0.1.0 • Published 2 years ago
@cloudcycle/postgraphile-plugin-prefix-schema v0.1.0
postgraphile-plugin-prefix-schema
This plugin for PostGraphile prepends the name of the SQL schema to the types in the GraphQL schema generated by Postgrahile. It does so in a way matching the capitalization style of the original type, so that camel-case, capital-case etc. are preserved.
Limitations
Only a single SQL schema may be used. If multiple schemas are used (which PostGraphile allows), the plugin will abort with an error.
Installation
Install using NPM or Yarn: NPM:
npm install --save @cloudcycle/postgraphile-plugin-prefix-schema
Yarn:
yarn add @cloudcycle/postgraphile-plugin-prefix-schema
Usage
CLI:
postgraphile --append-plugins @cloudcycle/postgraphile-plugin-prefix-schema
Library:
import prefixSchemaPlugin from '@cloudcycle/postgraphile-plugin-prefix-schema';
Then add it to the appendPlugins array. E.g.:
app.use(
postgraphile(process.env.AUTH_DATABASE_URL, "app_public", {
appendPlugins: [prefixSchemaPlugin],
// Optional customisation
graphileBuildOptions: {
/*
* Uncomment if you want simple collections to lose the 'List' suffix
* (and connections to gain a 'Connection' suffix).
*/
//pgOmitListSuffix: true,
/*
* Uncomment if you want 'userPatch' instead of 'patch' in update
* mutations.
*/
//pgSimplifyPatch: false,
/*
* Uncomment if you want 'allUsers' instead of 'users' at root level.
*/
//pgSimplifyAllRows: false,
/*
* Uncomment if you want primary key queries and mutations to have
* `ById` (or similar) suffix; and the `nodeId` queries/mutations
* to lose their `ByNodeId` suffix.
*/
// pgShortPk: true,
},
// ... other settings ...
})
);
Roadmap
- Add unit tests
- Provide a way to specify the prefix explicitly. This will allow using this plugin where multiple SQL schemas are specified.
0.1.0
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.3-pre2
2 years ago
0.0.3-pre1
2 years ago
0.0.3-pre3
2 years ago
0.1.0-pre1
2 years ago
0.0.1
2 years ago