@axinom/mosaic-graphql-common 0.1.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +16 -0
  2. package/dist/common/checks.d.ts +9 -0
  3. package/dist/common/checks.d.ts.map +1 -0
  4. package/dist/common/checks.js +21 -0
  5. package/dist/common/checks.js.map +1 -0
  6. package/dist/common/index.d.ts +3 -0
  7. package/dist/common/index.d.ts.map +1 -0
  8. package/dist/common/index.js +19 -0
  9. package/dist/common/index.js.map +1 -0
  10. package/dist/common/types.d.ts +13 -0
  11. package/dist/common/types.d.ts.map +1 -0
  12. package/dist/common/types.js +15 -0
  13. package/dist/common/types.js.map +1 -0
  14. package/dist/index.d.ts +4 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +20 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/plugins/add-error-codes-enum-plugin.d.ts +27 -0
  19. package/dist/plugins/add-error-codes-enum-plugin.d.ts.map +1 -0
  20. package/dist/plugins/add-error-codes-enum-plugin.js +78 -0
  21. package/dist/plugins/add-error-codes-enum-plugin.js.map +1 -0
  22. package/dist/plugins/annotate-types-with-permissions-plugin.d.ts +22 -0
  23. package/dist/plugins/annotate-types-with-permissions-plugin.d.ts.map +1 -0
  24. package/dist/plugins/annotate-types-with-permissions-plugin.js +145 -0
  25. package/dist/plugins/annotate-types-with-permissions-plugin.js.map +1 -0
  26. package/dist/plugins/deprecate-stray-node-id-fields-plugin.d.ts +14 -0
  27. package/dist/plugins/deprecate-stray-node-id-fields-plugin.d.ts.map +1 -0
  28. package/dist/plugins/deprecate-stray-node-id-fields-plugin.js +37 -0
  29. package/dist/plugins/deprecate-stray-node-id-fields-plugin.js.map +1 -0
  30. package/dist/plugins/generic-bulk-plugin-factory.d.ts +49 -0
  31. package/dist/plugins/generic-bulk-plugin-factory.d.ts.map +1 -0
  32. package/dist/plugins/generic-bulk-plugin-factory.js +181 -0
  33. package/dist/plugins/generic-bulk-plugin-factory.js.map +1 -0
  34. package/dist/plugins/graphiql-management-mode-plugin-hook.d.ts +13 -0
  35. package/dist/plugins/graphiql-management-mode-plugin-hook.d.ts.map +1 -0
  36. package/dist/plugins/graphiql-management-mode-plugin-hook.js +44 -0
  37. package/dist/plugins/graphiql-management-mode-plugin-hook.js.map +1 -0
  38. package/dist/plugins/index.d.ts +10 -0
  39. package/dist/plugins/index.d.ts.map +1 -0
  40. package/dist/plugins/index.js +26 -0
  41. package/dist/plugins/index.js.map +1 -0
  42. package/dist/plugins/omit-from-query-root-plugin.d.ts +17 -0
  43. package/dist/plugins/omit-from-query-root-plugin.d.ts.map +1 -0
  44. package/dist/plugins/omit-from-query-root-plugin.js +43 -0
  45. package/dist/plugins/omit-from-query-root-plugin.js.map +1 -0
  46. package/dist/plugins/operations-enum-generator-plugin-factory.d.ts +15 -0
  47. package/dist/plugins/operations-enum-generator-plugin-factory.d.ts.map +1 -0
  48. package/dist/plugins/operations-enum-generator-plugin-factory.js +108 -0
  49. package/dist/plugins/operations-enum-generator-plugin-factory.js.map +1 -0
  50. package/dist/plugins/subscriptions-plugin-factory.d.ts +9 -0
  51. package/dist/plugins/subscriptions-plugin-factory.d.ts.map +1 -0
  52. package/dist/plugins/subscriptions-plugin-factory.js +67 -0
  53. package/dist/plugins/subscriptions-plugin-factory.js.map +1 -0
  54. package/dist/plugins/validation-directives-plugin.d.ts +6 -0
  55. package/dist/plugins/validation-directives-plugin.d.ts.map +1 -0
  56. package/dist/plugins/validation-directives-plugin.js +117 -0
  57. package/dist/plugins/validation-directives-plugin.js.map +1 -0
  58. package/dist/postgraphile/enhance-graphql-errors.d.ts +48 -0
  59. package/dist/postgraphile/enhance-graphql-errors.d.ts.map +1 -0
  60. package/dist/postgraphile/enhance-graphql-errors.js +67 -0
  61. package/dist/postgraphile/enhance-graphql-errors.js.map +1 -0
  62. package/dist/postgraphile/index.d.ts +4 -0
  63. package/dist/postgraphile/index.d.ts.map +1 -0
  64. package/dist/postgraphile/index.js +20 -0
  65. package/dist/postgraphile/index.js.map +1 -0
  66. package/dist/postgraphile/postgraphile-options-builder.d.ts +273 -0
  67. package/dist/postgraphile/postgraphile-options-builder.d.ts.map +1 -0
  68. package/dist/postgraphile/postgraphile-options-builder.js +419 -0
  69. package/dist/postgraphile/postgraphile-options-builder.js.map +1 -0
  70. package/dist/postgraphile/websocket-utils.d.ts +11 -0
  71. package/dist/postgraphile/websocket-utils.d.ts.map +1 -0
  72. package/dist/postgraphile/websocket-utils.js +17 -0
  73. package/dist/postgraphile/websocket-utils.js.map +1 -0
  74. package/package.json +61 -0
  75. package/src/common/checks.ts +23 -0
  76. package/src/common/index.ts +2 -0
  77. package/src/common/types.ts +15 -0
  78. package/src/index.ts +3 -0
  79. package/src/plugins/add-error-codes-enum-plugin.ts +102 -0
  80. package/src/plugins/annotate-types-with-permissions-plugin.spec.ts +158 -0
  81. package/src/plugins/annotate-types-with-permissions-plugin.ts +205 -0
  82. package/src/plugins/deprecate-stray-node-id-fields-plugin.ts +41 -0
  83. package/src/plugins/generic-bulk-plugin-factory.ts +313 -0
  84. package/src/plugins/graphiql-management-mode-plugin-hook.ts +46 -0
  85. package/src/plugins/index.ts +9 -0
  86. package/src/plugins/omit-from-query-root-plugin.ts +69 -0
  87. package/src/plugins/operations-enum-generator-plugin-factory.ts +130 -0
  88. package/src/plugins/subscriptions-plugin-factory.ts +114 -0
  89. package/src/plugins/validation-directives-plugin.ts +141 -0
  90. package/src/postgraphile/enhance-graphql-errors.spec.ts +241 -0
  91. package/src/postgraphile/enhance-graphql-errors.ts +138 -0
  92. package/src/postgraphile/index.ts +3 -0
  93. package/src/postgraphile/postgraphile-options-builder.spec.ts +744 -0
  94. package/src/postgraphile/postgraphile-options-builder.ts +510 -0
  95. package/src/postgraphile/websocket-utils.ts +19 -0
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ValidationDirectivesPlugin = void 0;
7
+ const graphile_build_1 = require("graphile-build");
8
+ const inflection_1 = __importDefault(require("inflection"));
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
+ async function loadDbConstraints(builder) {
11
+ const constraintQuery = `
12
+ SELECT
13
+ oid, conname, conrelid, conkey, pg_get_constraintdef(oid) AS definition
14
+ FROM
15
+ pg_constraint
16
+ WHERE
17
+ contype = 'c' AND conrelid > 0;`;
18
+ // this pgConfig is not part of the public TS builder API so it may change
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ const queryResult = await builder.options.pgConfig.query(constraintQuery);
21
+ return queryResult.rows;
22
+ }
23
+ async function getConstraints(builder) {
24
+ const constraints = {};
25
+ const rows = await loadDbConstraints(builder);
26
+ for (const row of rows) {
27
+ const key = `${row.conrelid}`;
28
+ constraints[key] = constraints[key] || [];
29
+ constraints[key].push({
30
+ id: row.oid,
31
+ name: row.conname,
32
+ tableId: row.conrelid,
33
+ definition: row.definition,
34
+ tableIndexes: row.conkey,
35
+ });
36
+ }
37
+ return constraints;
38
+ }
39
+ function mapCheckToValidation(constraint) {
40
+ const regex = /CHECK\s*\(\s*([a-zA-Z0-9_]+\.){0,1}([a-zA-Z0-9_]+)\s*\(\s*(['a-zA-Z0-9_]+)\s*,\s*(['a-zA-Z0-9_]+)/gm;
41
+ const result = regex.exec(constraint);
42
+ if ((result === null || result === void 0 ? void 0 : result.length) && result.length > 4) {
43
+ switch (result[2]) {
44
+ // custom handle when parameters are used - otherwise default is fine
45
+ case 'constraint_max_length':
46
+ return `@maxLength(${result[4]})`;
47
+ case 'constraint_min_length':
48
+ return `@minLength(${result[4]})`;
49
+ default:
50
+ // eslint-disable-next-line no-case-declarations
51
+ const constraintName = inflection_1.default.camelize(result[2].replace('constraint_', ''), true);
52
+ return `@${constraintName}()`;
53
+ }
54
+ }
55
+ return '';
56
+ }
57
+ /**
58
+ * Plugin that adds validation directives to graphql schema descriptions.
59
+ */
60
+ const ValidationDirectivesPlugin = async (builder) => {
61
+ const constraints = await getConstraints(builder);
62
+ builder.hook('GraphQLInputObjectType:fields', (fields, _build, context) => {
63
+ var _a, _b;
64
+ const tableConstraints = constraints[`${(_a = context.scope.pgIntrospection) === null || _a === void 0 ? void 0 : _a.id}`];
65
+ const columnMappings = {};
66
+ // check if there are any constraints in the DB
67
+ if (tableConstraints && Object.keys(fields).length) {
68
+ for (const constraint of tableConstraints) {
69
+ for (const tableIndex of constraint.tableIndexes) {
70
+ // find the DB column by its index with 'pg_constraint.conkey'
71
+ const column = context.scope.pgIntrospection.attributes.find((at) => at.num === tableIndex);
72
+ const validation = mapCheckToValidation(constraint.definition);
73
+ if (validation) {
74
+ // Converting the column name to camelCase to follow the general GraphQL naming pattern when adding it to the description.
75
+ const prop = (0, graphile_build_1.camelCase)(column.name);
76
+ columnMappings[prop] = (_b = columnMappings[prop]) !== null && _b !== void 0 ? _b : { annotations: [] };
77
+ columnMappings[prop].annotations.push(validation);
78
+ }
79
+ }
80
+ }
81
+ }
82
+ for (const prop in columnMappings) {
83
+ const f = fields[prop];
84
+ if (f) {
85
+ const annotations = columnMappings[prop].annotations.sort().join('\n');
86
+ f.description = f.description
87
+ ? `${f.description}\n${annotations}`
88
+ : annotations;
89
+ }
90
+ }
91
+ return fields;
92
+ });
93
+ builder.hook('GraphQLSchema', (schemaConfig /*, build*/) => {
94
+ return schemaConfig;
95
+ // The following would allow to add custom directives.
96
+ // They can only be used on the server! They are not sent back to clients.
97
+ // return {
98
+ // ...schemaConfig,
99
+ // directives: [
100
+ // ...(schemaConfig.directives || []),
101
+ // build.newWithHooks(
102
+ // build.graphql.GraphQLDirective,
103
+ // {
104
+ // name: 'upper',
105
+ // locations: ['FIELD_DEFINITION', 'FIELD'],
106
+ // args: {
107
+ // name: { type: build.graphql.GraphQLString },
108
+ // },
109
+ // },
110
+ // { isUpperDirective: true },
111
+ // ),
112
+ // ],
113
+ // };
114
+ });
115
+ };
116
+ exports.ValidationDirectivesPlugin = ValidationDirectivesPlugin;
117
+ //# sourceMappingURL=validation-directives-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-directives-plugin.js","sourceRoot":"","sources":["../../src/plugins/validation-directives-plugin.ts"],"names":[],"mappings":";;;;;;AAAA,mDAAkE;AAClE,4DAAoC;AAepC,8DAA8D;AAC9D,KAAK,UAAU,iBAAiB,CAAC,OAAsB;IACrD,MAAM,eAAe,GAAG;;;;;;sCAMY,CAAC;IAErC,0EAA0E;IAC1E,8DAA8D;IAC9D,MAAM,WAAW,GAAG,MAAO,OAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAC/D,eAAe,CAChB,CAAC;IACF,OAAO,WAAW,CAAC,IAAI,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,OAAsB;IAClD,MAAM,WAAW,GAAgB,EAAE,CAAC;IACpC,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;QACtB,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC9B,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAC1C,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACpB,EAAE,EAAE,GAAG,CAAC,GAAG;YACX,IAAI,EAAE,GAAG,CAAC,OAAO;YACjB,OAAO,EAAE,GAAG,CAAC,QAAQ;YACrB,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,YAAY,EAAE,GAAG,CAAC,MAAM;SACzB,CAAC,CAAC;KACJ;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAS,oBAAoB,CAAC,UAAkB;IAC9C,MAAM,KAAK,GACT,qGAAqG,CAAC;IAExG,MAAM,MAAM,GAAG,KAAK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zD,aAAa;QACb,WAAW;QACX,oCAAoC;QACpC,SAAS;QACT,OAAO;QACP,KAAK;IACP,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AA9DW,QAAA,0BAA0B,8BA8DrC"}
@@ -0,0 +1,48 @@
1
+ import { GraphQLError, OperationTypeNode } from 'graphql';
2
+ import { GraphQLErrorExtended } from 'postgraphile';
3
+ import { Dict } from '../common';
4
+ /**
5
+ * A GraphQLErrorExtended object with additional properties.
6
+ * This error is thrown by the GraphQL API and returned to the original requester.
7
+ */
8
+ export declare type GraphQLErrorEnhanced = GraphQLErrorExtended & {
9
+ extensions: {
10
+ /** The timestamp when the error was raised */
11
+ timestamp: string;
12
+ };
13
+ timestamp: string;
14
+ code: string;
15
+ details?: Dict<unknown>;
16
+ };
17
+ export declare const GeneralGraphQlErrorCode = "GENERAL_GRAPHQL_ERROR";
18
+ /**
19
+ * Contains data about the failed GraphQL request without exposing passed variables, since they can contain sensitive values.
20
+ */
21
+ export interface GraphQlOperation {
22
+ /**
23
+ * Type of operation, e.g. query, mutation or subscription.
24
+ */
25
+ operationType?: OperationTypeNode;
26
+ /**
27
+ * Name of operation, if defined.
28
+ */
29
+ operationName?: string;
30
+ /**
31
+ * List of root endpoints, since a single operation can perform multiple queries/mutations.
32
+ */
33
+ rootEndpoints?: string[];
34
+ }
35
+ /**
36
+ * Default graphql error handler. Extracts information to return as an error response (timestamp, message, code and path parameters) and logs error and response information using provided logger.
37
+ *
38
+ * @param errors - Array of original graphql errors
39
+ * @param operationName - The operation name that was executed in case the request contained more than one operation. Found in `req.body.operationName`.
40
+ * @param customizeFields - Override error fields message, exception code, and add extensions fields with your custom values. Extension fields are added to the extensions object and cannot use existing field names.
41
+ * @param log - allows you to log the error with parts of the GraphQL request data
42
+ */
43
+ export declare const enhanceGraphqlErrors: (errors: readonly GraphQLError[], operationName?: string, customizeFields?: ((error: GraphQLError, originalError?: Error | null) => {
44
+ message?: string;
45
+ code?: string;
46
+ extensions?: Dict<unknown>;
47
+ } | undefined) | undefined, log?: ((error: GraphQLErrorEnhanced, operations?: GraphQlOperation[]) => void) | undefined) => GraphQLErrorEnhanced[];
48
+ //# sourceMappingURL=enhance-graphql-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enhance-graphql-errors.d.ts","sourceRoot":"","sources":["../../src/postgraphile/enhance-graphql-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAEZ,iBAAiB,EAGlB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;GAGG;AACH,MAAM,CAAC,OAAO,MAAM,oBAAoB,GAAG,oBAAoB,GAAG;IAChE,UAAU,EAAE;QACV,8CAA8C;QAC9C,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IAEF,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,uBAAuB,0BAA0B,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAClC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AA2CD;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,WACvB,SAAS,YAAY,EAAE,kBACf,MAAM,6BAEb,YAAY,kBACH,KAAK,GAAG,IAAI,KAE1B;IACE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC;CAC5B,GACD,SAAS,8BACC,oBAAoB,eAAe,gBAAgB,EAAE,KAAK,IAAI,kBAC3E,oBAAoB,EA4BtB,CAAC"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.enhanceGraphqlErrors = exports.GeneralGraphQlErrorCode = void 0;
4
+ const graphql_1 = require("graphql");
5
+ exports.GeneralGraphQlErrorCode = 'GENERAL_GRAPHQL_ERROR';
6
+ const basicErrorMapper = (error, operationName) => {
7
+ var _a;
8
+ return Object.assign(Object.assign({}, error), { message: (_a = error.message) !== null && _a !== void 0 ? _a : 'No error description was provided', extensions: {
9
+ timestamp: new Date().toISOString(),
10
+ operationName,
11
+ exception: {
12
+ code: exports.GeneralGraphQlErrorCode,
13
+ },
14
+ },
15
+ //TODO: remove backwards compatibility after 01-11-2023
16
+ timestamp: new Date().toISOString(), code: exports.GeneralGraphQlErrorCode, details: undefined });
17
+ };
18
+ const getGraphQlOperations = (requestBody) => {
19
+ try {
20
+ const parsedGqlRequest = (0, graphql_1.parse)(requestBody);
21
+ return parsedGqlRequest.definitions.map((op) => {
22
+ var _a, _b;
23
+ return ({
24
+ name: (_b = (_a = op.name) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 'NO_OPERATION_NAME',
25
+ operation: op.operation,
26
+ rootEndpoints: op.selectionSet.selections.map((selection) => selection.name.value),
27
+ });
28
+ });
29
+ }
30
+ catch (_a) {
31
+ // Unable to parse the GraphQL request string.
32
+ return undefined;
33
+ }
34
+ };
35
+ /**
36
+ * Default graphql error handler. Extracts information to return as an error response (timestamp, message, code and path parameters) and logs error and response information using provided logger.
37
+ *
38
+ * @param errors - Array of original graphql errors
39
+ * @param operationName - The operation name that was executed in case the request contained more than one operation. Found in `req.body.operationName`.
40
+ * @param customizeFields - Override error fields message, exception code, and add extensions fields with your custom values. Extension fields are added to the extensions object and cannot use existing field names.
41
+ * @param log - allows you to log the error with parts of the GraphQL request data
42
+ */
43
+ const enhanceGraphqlErrors = (errors, operationName, customizeFields, log) => {
44
+ return errors.map((error) => {
45
+ var _a, _b, _c, _d;
46
+ const enhancedError = basicErrorMapper(error, operationName);
47
+ if (customizeFields) {
48
+ const custom = customizeFields(error, error.originalError);
49
+ enhancedError.message = (_a = custom === null || custom === void 0 ? void 0 : custom.message) !== null && _a !== void 0 ? _a : enhancedError.message;
50
+ enhancedError.extensions = Object.assign(Object.assign({}, custom === null || custom === void 0 ? void 0 : custom.extensions), enhancedError.extensions);
51
+ enhancedError.extensions.exception.code =
52
+ (_b = custom === null || custom === void 0 ? void 0 : custom.code) !== null && _b !== void 0 ? _b : enhancedError.extensions.exception.code;
53
+ //TODO: remove backwards compatibility after 01-11-2023
54
+ enhancedError.code = enhancedError.extensions.exception.code;
55
+ enhancedError.details = custom === null || custom === void 0 ? void 0 : custom.extensions;
56
+ }
57
+ if (log) {
58
+ const originalError = error.originalError;
59
+ const request = ((_c = error.source) === null || _c === void 0 ? void 0 : _c.body) || ((_d = originalError === null || originalError === void 0 ? void 0 : originalError.source) === null || _d === void 0 ? void 0 : _d.body);
60
+ const graphQlOperations = getGraphQlOperations(request);
61
+ log(enhancedError, graphQlOperations);
62
+ }
63
+ return enhancedError;
64
+ });
65
+ };
66
+ exports.enhanceGraphqlErrors = enhanceGraphqlErrors;
67
+ //# sourceMappingURL=enhance-graphql-errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enhance-graphql-errors.js","sourceRoot":"","sources":["../../src/postgraphile/enhance-graphql-errors.ts"],"names":[],"mappings":";;;AAAA,qCAOiB;AAmBJ,QAAA,uBAAuB,GAAG,uBAAuB,CAAC;AAoB/D,MAAM,gBAAgB,GAAG,CACvB,KAAmB,EACnB,aAAsB,EACA,EAAE;;IACxB,uCACK,KAAK,KACR,OAAO,EAAE,MAAA,KAAK,CAAC,OAAO,mCAAI,mCAAmC,EAC7D,UAAU,EAAE;YACV,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,aAAa;YACb,SAAS,EAAE;gBACT,IAAI,EAAE,+BAAuB;a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aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,GAClB,aAAa,CAAC,UAAU,CAC5B,CAAC;YACF,aAAa,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI;gBACrC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,mCAAI,aAAa,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC;YAE1D,uDAAuD;YACvD,aAAa,CAAC,IAAI,GAAG,aAAa,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC;YAC7D,aAAa,CAAC,OAAO,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,CAAC;SAC5C;QAED,IAAI,GAAG,EAAE;YACP,MAAM,aAAa,GAAG,KAAK,CAAC,aAA2C,CAAC;YACxE,MAAM,OAAO,GAAG,CAAA,MAAA,KAAK,CAAC,MAAM,0CAAE,IAAI,MAAI,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,MAAM,0CAAE,IAAI,CAAA,CAAC;YAClE,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;YACxD,GAAG,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;SACvC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AA1CW,QAAA,oBAAoB,wBA0C/B"}
@@ -0,0 +1,4 @@
1
+ export * from './enhance-graphql-errors';
2
+ export * from './postgraphile-options-builder';
3
+ export * from './websocket-utils';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/postgraphile/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./enhance-graphql-errors"), exports);
18
+ __exportStar(require("./postgraphile-options-builder"), exports);
19
+ __exportStar(require("./websocket-utils"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/postgraphile/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,iEAA+C;AAC/C,oDAAkC"}
@@ -0,0 +1,273 @@
1
+ import { Request, Response } from 'express';
2
+ import { Plugin } from 'graphile-build';
3
+ import { GraphQLError } from 'graphql';
4
+ import { GraphQLErrorExtended, Middleware, Options, PostGraphileOptions, PostGraphilePlugin, mixed } from 'postgraphile';
5
+ import { Dict } from '../common';
6
+ /**
7
+ * This is the function type that must be used when developing Hook Plugin factory functions.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ const subscriptionAuthorizationHookFactory = (
12
+ buildOptions: PostGraphileOptions<Request, Response> | undefined,
13
+ ): PostGraphilePlugin => {
14
+ return {
15
+ // returns a PostGraphilePlugin
16
+ }
17
+ }
18
+ * ```
19
+ */
20
+ export type HookPluginFactory = (buildOptions: PostGraphileOptions<Request, Response> | undefined) => PostGraphilePlugin;
21
+ /**
22
+ * A builder class that allows construction of postgraphile options using multiple dedicated extension methods.
23
+ */
24
+ export declare class PostgraphileOptionsBuilder {
25
+ private transformers;
26
+ private headers;
27
+ private pluginHooks;
28
+ private hookFuncs;
29
+ /**
30
+ * Builds a postgraphile options object with previously used extension methods.
31
+ */
32
+ build(): PostGraphileOptions<Request, Response>;
33
+ /**
34
+ * Builds a hook plugin that adds custom headers to http responses.
35
+ */
36
+ private buildHeadersHookPlugin;
37
+ /**
38
+ * This builder option must be used if the Hook Plugin requires PostGraphileOptions in the logic.
39
+ * A function which returns a PostGraphilePlugin should be passed into this method.
40
+ * That function will use PostGraphileOptions created in the build() method and attach the plugin returned from the function as a Postgraphile Hook.
41
+ * @example
42
+ *
43
+ * ```ts
44
+ new PostgraphileOptionsBuilder()
45
+ .addHookPluginFactory(customHookFactory)
46
+ * ```
47
+ *
48
+ * @param hookFunction This is a function which takes an argument of type PostGraphileOptions<Request, Response> and returns a PostGraphilePlugin object.
49
+ * @returns
50
+ */
51
+ addHookPluginFactory(hookFunction: HookPluginFactory): PostgraphileOptionsBuilder;
52
+ /**
53
+ * This function takes a PostGraphilePlugin object and attaches it as a Postgraphile Hook when build() is called.
54
+ * @example
55
+ *
56
+ * ```ts
57
+ new PostgraphileOptionsBuilder()
58
+ .addHookPluginFunction(subscriptionAuthorizationHook)
59
+ * ```
60
+ *
61
+ * @param hookPlugin This is a PostGraphilePlugin object.
62
+ * @returns
63
+ */
64
+ addHookPlugin(hookPlugin: PostGraphilePlugin): PostgraphileOptionsBuilder;
65
+ /**
66
+ * Sets `pgSettings` property of postgraphile options object.
67
+ * Example:
68
+ *
69
+ * ```ts
70
+ new PostgraphileOptionsBuilder()
71
+ .setPgSettings(async req => {
72
+ const { subject } = await getManagementAuthenticationContext(req, idServiceParams);
73
+ return buildPgSettings(subject, config.dbGqlRole, config.serviceId);
74
+ })
75
+ * ```
76
+ *
77
+ * @param pgSettings A plain object specifying custom config values to set in the PostgreSQL transaction (accessed via current_setting('my.custom.setting')) or an (optionally asynchronous) function which will return the same (or a Promise to the same) based on the incoming web request (e.g. to extract session data).
78
+ */
79
+ setPgSettings(pgSettings: (req: Request) => Promise<Dict<mixed>> | Dict<mixed>): PostgraphileOptionsBuilder;
80
+ /**
81
+ * Sets `handleErrors` property of postgraphile options object.
82
+ * Example:
83
+ *
84
+ * ```ts
85
+ new PostgraphileOptionsBuilder()
86
+ .setErrorsHandler((errors, req) => {
87
+ return enhanceGraphqlErrors(
88
+ result.errors,
89
+ req.body.operationName,
90
+ customizeGraphQlErrorFields(defaultPgErrorMapper),
91
+ logGraphQlError(defaultWriteLogMapper, this.logger),
92
+ );
93
+ }
94
+ })
95
+ * ```
96
+ *
97
+ * @param handleErrors Enables ability to modify errors before sending them down to the client. Optionally can send down custom responses. If you use this then showErrorStack and extendedError may have no effect.
98
+ */
99
+ setErrorsHandler(handleErrors: (errors: readonly GraphQLError[], req: Request, res: Response) => GraphQLErrorExtended[]): PostgraphileOptionsBuilder;
100
+ /**
101
+ * Sets properties of postgraphile options object to be used in without any conditions. Additional calls will override and add properties.
102
+ * Example:
103
+ *
104
+ * ```ts
105
+ new PostgraphileOptionsBuilder()
106
+ .setProperties({
107
+ enableCors: true,
108
+ dynamicJson: true,
109
+ ignoreRBAC: false,
110
+ legacyRelations: 'omit',
111
+ setofFunctionsContainNulls: false,
112
+ })
113
+ * ```
114
+ * @param properties An object containing postgraphile options.
115
+ */
116
+ setProperties(properties: PostGraphileOptions<Request, Response>): PostgraphileOptionsBuilder;
117
+ /**
118
+ * Sets properties of postgraphile options object to be used based on some
119
+ * condition (use if true, omit if false). Additional calls will override and
120
+ * add properties.
121
+ * Example:
122
+ *
123
+ * ```ts
124
+ new PostgraphileOptionsBuilder()
125
+ .setConditionalProperties(config.isDev, {
126
+ exportGqlSchemaPath: './src/generated/schema.graphql',
127
+ watchPg: true,
128
+ graphiql: true,
129
+ enhanceGraphiql: true,
130
+ allowExplain: true,
131
+ })
132
+ * ```
133
+ * @param properties An object containing postgraphile options.
134
+ */
135
+ setConditionalProperties(condition: boolean, properties: PostGraphileOptions<Request, Response>): PostgraphileOptionsBuilder;
136
+ /**
137
+ * Sets all necessary postgraphile properties to enable subscriptions.
138
+ * Example:
139
+ *
140
+ * ```ts
141
+ new PostgraphileOptionsBuilder()
142
+ .enableSubscriptions({
143
+ plugin: SubscriptionsPlugin,
144
+ websocketMiddlewares: middlewares,
145
+ hookFactory: subscriptionAuthorizationHookFactory
146
+ })
147
+ * ```
148
+ *
149
+ * Results in something like this:
150
+ *
151
+ * ```ts
152
+ import PgPubsub from '@graphile/pg-pubsub';
153
+ import { makePluginHook } from 'postgraphile';
154
+ //.........
155
+ {
156
+ appendPlugins: [SubscriptionsPlugin], // Other plugins will be included if they were added using other methods
157
+ pluginHook: makePluginHook([PgPubsub, subscriptionAuthorizationHook]),
158
+ subscriptions: true,
159
+ websocketMiddlewares, // Empty array if websocketMiddlewares are not specified
160
+ }
161
+ * ```
162
+ *
163
+ * To make sure that Postgraphile is able to correctly establish WebSockets
164
+ * connection, additional changes should be done by using
165
+ * `enhanceHttpServerWithSubscriptions`.
166
+ *
167
+ * See more here: https://www.graphile.org/postgraphile/subscriptions/#advanced-setup
168
+ *
169
+ * @param plugin Graphile engine plugin that adds one or multiple subscription
170
+ * endpoints. Can be added separately.
171
+ * @param websocketMiddlewares If you're using websockets (subscriptions ||
172
+ * live) then you may want to authenticate your users using sessions or
173
+ * similar. You can pass some simple middlewares here that will be executed
174
+ * against the websocket connection in order to perform authentication.
175
+ * @param hookFactory A factory function for a Postgraphile hook plugin.
176
+ */
177
+ enableSubscriptions({ plugin, websocketMiddlewares, hookFactory, }: {
178
+ plugin: Plugin;
179
+ websocketMiddlewares?: Middleware<Request, Response>[];
180
+ hookFactory?: HookPluginFactory;
181
+ }): PostgraphileOptionsBuilder;
182
+ /**
183
+ * Adds multiple graphile engine plugins to `appendPlugins` array of postgraphile options object. `setAdditionalGraphQLContextFromRequest` and `addGraphileBuildOptions` methods can be used to pass parameters to said plugins.
184
+ * Example:
185
+ *
186
+ ```ts
187
+ new PostgraphileOptionsBuilder()
188
+ .addPlugins(
189
+ PgSimplifyInflectorPlugin,
190
+ ScalarTypesPlugin,
191
+ SmartTagsPlugin,
192
+ ValidationDirectivesPlugin,
193
+ )
194
+ ```
195
+ * @param plugins Comma-separated list of Graphile Engine schema plugins to load after the default plugins.
196
+ */
197
+ addPlugins(...plugins: Plugin[]): PostgraphileOptionsBuilder;
198
+ /**
199
+ * Adds multiple graphile engine plugins to `appendPlugins` array of postgraphile options object.
200
+ * `setAdditionalGraphQLContextFromRequest` and `addGraphileBuildOptions` methods can be used to pass parameters to said plugins.
201
+ * Explicit condition parameter is used to make a decision if plugins should be used or not (use if true, omit if false).
202
+ * Example:
203
+ *
204
+ ```ts
205
+ new PostgraphileOptionsBuilder()
206
+ .addConditionalPlugins(config.isDev || config.enablePopulatePlugins, PopulateMoviesPlugin, PopulateTvshowsPlugin)
207
+ ```
208
+ * @param plugins Comma-separated list of Graphile Engine schema plugins to load after the default plugins.
209
+ */
210
+ addConditionalPlugins(condition: boolean, ...plugins: Plugin[]): PostgraphileOptionsBuilder;
211
+ /**
212
+ * Skips multiple default postgraphile plugins by adding them to `skipPlugins` array of postgraphile options object .
213
+ * Example:
214
+ *
215
+ ```ts
216
+ new PostgraphileOptionsBuilder()
217
+ .skipPlugins(NodePlugin, MutationPayloadQueryPlugin)
218
+ ```
219
+ * @param plugins Comma-separated list of Graphile Engine schema plugins to skip.
220
+ */
221
+ skipPlugins(...plugins: Plugin[]): PostgraphileOptionsBuilder;
222
+ /**
223
+ * Adds properties to resulting `graphileBuildOptions` property of postgraphile options object. Useful for modifying default postgraphile plugin settings.
224
+ * Example:
225
+ *
226
+ ```ts
227
+ new PostgraphileOptionsBuilder()
228
+ .addGraphileBuildOptions({ pgSkipInstallingWatchFixtures: true })
229
+ ```
230
+ * @param graphileBuildOptions Additional Options to pass through into the graphile schema building system (received via the second argument of a plugin).
231
+ */
232
+ addGraphileBuildOptions(graphileBuildOptions: Partial<Options>): PostgraphileOptionsBuilder;
233
+ /**
234
+ * Adds `additionalGraphQLContextFromRequest` property to postgraphile options object. Define only once. Multiple calls will not expand previous calls, but will override them.
235
+ *
236
+ * Example:
237
+ ```ts
238
+ new PostgraphileOptionsBuilder()
239
+ .setAdditionalGraphQLContextFromRequest(async req => {
240
+ const { subject } = await getManagementAuthenticationContext(req);
241
+ return { subject, serviceId: config.serviceId };
242
+ })
243
+ ```
244
+ * @param callback Some Graphile Engine schema plugins may need additional information available on the context argument to the resolver - you can use this function to provide such information based on the incoming request - you can even use this to change the response , e.g. setting cookies.
245
+ */
246
+ setAdditionalGraphQLContextFromRequest(callback: (req: Request, res: Response) => Promise<Record<string, any>>): PostgraphileOptionsBuilder;
247
+ /**
248
+ * Enables or disables graphiql GUI depending on a passed condition parameter. Enable if true, disable if false.
249
+ * Sets 3 postgraphile properties: `graphiql`, `enhanceGraphiql` and `allowExplain`.
250
+ * Example:
251
+ *
252
+ * ```ts
253
+ new PostgraphileOptionsBuilder()
254
+ .setGraphiql(config.graphqlGuiEnabled)
255
+ * ```
256
+ */
257
+ setGraphiql(condition: boolean): PostgraphileOptionsBuilder;
258
+ /**
259
+ * Sets a response header for each GraphQL request.
260
+ *
261
+ * @param name header name
262
+ * @param value header value
263
+ */
264
+ setHeader(name: string, value: string | number | string[]): PostgraphileOptionsBuilder;
265
+ /**
266
+ * Sets default values for properties that we see as best practices which most
267
+ * services should start from. This includes the default GraphQL errors handler,
268
+ * suggested default properties, development properties in dev-environments,
269
+ * and excludes the 'NodePlugin'.
270
+ */
271
+ setDefaultSettings(isDev: boolean, graphqlGuiEnabled: boolean): PostgraphileOptionsBuilder;
272
+ }
273
+ //# sourceMappingURL=postgraphile-options-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgraphile-options-builder.d.ts","sourceRoot":"","sources":["../../src/postgraphile/postgraphile-options-builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAc,MAAM,EAAE,MAAM,gB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