# @cloudcycle/postgraphile-plugin-aws-appsync-scalars

> Postgraphile plugin to convert Postgraphile-generated custom scalar names to those AWS AppSync accepts

Latest version **0.0.3** (published 2022-10-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @cloudcycle/postgraphile-plugin-aws-appsync-scalars
pnpm add @cloudcycle/postgraphile-plugin-aws-appsync-scalars
yarn add @cloudcycle/postgraphile-plugin-aws-appsync-scalars
bun add @cloudcycle/postgraphile-plugin-aws-appsync-scalars
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2022-10-14 |
| First published | 2022-09-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 20.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Isac Casapu |
| Maintainers | yitzikc |
| Keywords | Postgraphile, plugin, AWS, AppSync |

## Links

- npm: https://www.npmjs.com/package/@cloudcycle/postgraphile-plugin-aws-appsync-scalars
- Repository: https://github.com/CloudCycle/postgraphile-plugin-aws-appsync-scalars
- Homepage: https://github.com/CloudCycle/postgraphile-plugin-aws-appsync-scalars#readme
- Issues: https://github.com/CloudCycle/postgraphile-plugin-aws-appsync-scalars/issues
- npm.io page: https://npm.io/package/@cloudcycle/postgraphile-plugin-aws-appsync-scalars

## Dependencies (1)

- [graphile-utils](https://npm.io/package/graphile-utils.md) ^4.12.3

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2022-10-14
- 0.0.2 — 2022-10-14
- 0.0.1 — 2022-09-06
- 0.0.1-pre1 — 2022-09-05

## README

postgraphile-plugin-aws-appsync-scalars
=======================================


This plugin for PostGraphile converts Postgraphile-generated custom scalar names to those AWS AppSync accepts.

Current name mappings:

| PostGraphile type | AWS type |
|-------------------|----------|
| JSON | AWSJSON |
| Datetime | AWSDateTime |
| Date | AWSDate |
| BigInt | Int |
| BigFloat | Float |
| Cursor | String |


Limitations
-----------

No warning is issued if you failed to set dynamic-json to false. In that case,
the resulting schema will presented by AWS AppSync will not match what PostGrahile expects to receive.


Installation
------------

Install using NPM or Yarn.

NPM:

```bash
npm install --save @cloudcycle/postgraphile-plugin-aws-appsync-scalars
```

Yarn:
```bash
yarn add @cloudcycle/postgraphile-plugin-aws-appsync-scalars
```

Usage
-----

CLI:

```bash
postgraphile --dynamic-json false --append-plugins @cloudcycle/postgraphile-plugin-aws-appsync-scalars
```

Library:

```javascript
import awsAppsyncScalarsPlugin from '@cloudcycle/postgraphile-plugin-aws-appsync-scalars';
```

Then add it to the appendPlugins array. E.g.:

```javascript
app.use(
  postgraphile(process.env.AUTH_DATABASE_URL, "app_public", {
    appendPlugins: [
      awsAppsyncScalarsPlugin,
      // Any other plugins that reference types explicitly
      // should go here.
    ],

    // Ensure JSON fields are returned serialised to strings, as this is
    // what the AWSJSON type expects.
    dynamicJson: false,

    // Optional customisation
    graphileBuildOptions: {
    },
    // ... other settings ...
  })
);
```

Interoperability
----------------

The order in which this plugin is specified could affect the resulting
schema, and you may achieve more predictable results by listing this plugin first. When another plugin makes explicit references to
types, this plugin needs to be listed in _append_plugins_ before it. In particular, this is the case with [the @graphile/pg-aggregates plugin](https://www.npmjs.com/package/@graphile/pg-aggregates).

Roadmap
-------

* Add unit tests
* Support scalar types from the PostGIS plugin, notably GeoJSON.
* Allow the mapping of PosgreSQL types to AppSync compatible types to be
  customised.
* Allow user-specified types (e.g. SQL domains) to be converted.
* Allow AWS types for fields, arguments etc. to be specified via smart-comments, so
that we could make use of the extra checking AWS AppSync performs when using AWSEmail,
AWSPhone etc.

---
_Source: https://npm.io/package/@cloudcycle/postgraphile-plugin-aws-appsync-scalars · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
