graphile-utils 4.12.3 → 5.0.0-0.3

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 (80) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +28 -26
  3. package/dist/gql.d.ts +3 -0
  4. package/dist/gql.d.ts.map +1 -0
  5. package/dist/gql.js +60 -0
  6. package/dist/gql.js.map +1 -0
  7. package/dist/index.d.ts +8 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +21 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/makeAddInflectorsPlugin.d.ts +3 -0
  12. package/dist/makeAddInflectorsPlugin.d.ts.map +1 -0
  13. package/dist/makeAddInflectorsPlugin.js +42 -0
  14. package/dist/makeAddInflectorsPlugin.js.map +1 -0
  15. package/dist/makeChangeNullabilityPlugin.d.ts +15 -0
  16. package/dist/makeChangeNullabilityPlugin.d.ts.map +1 -0
  17. package/dist/makeChangeNullabilityPlugin.js +146 -0
  18. package/dist/makeChangeNullabilityPlugin.js.map +1 -0
  19. package/dist/makeExtendSchemaPlugin.d.ts +78 -0
  20. package/dist/makeExtendSchemaPlugin.d.ts.map +1 -0
  21. package/dist/makeExtendSchemaPlugin.js +654 -0
  22. package/dist/makeExtendSchemaPlugin.js.map +1 -0
  23. package/{node8plus → dist}/makePgSmartTagsPlugin.d.ts +25 -10
  24. package/dist/makePgSmartTagsPlugin.d.ts.map +1 -0
  25. package/dist/makePgSmartTagsPlugin.js +398 -0
  26. package/dist/makePgSmartTagsPlugin.js.map +1 -0
  27. package/dist/makeProcessSchemaPlugin.d.ts +6 -0
  28. package/dist/makeProcessSchemaPlugin.d.ts.map +1 -0
  29. package/dist/makeProcessSchemaPlugin.js +20 -0
  30. package/dist/makeProcessSchemaPlugin.js.map +1 -0
  31. package/dist/makeWrapPlansPlugin.d.ts +22 -0
  32. package/dist/makeWrapPlansPlugin.d.ts.map +1 -0
  33. package/dist/makeWrapPlansPlugin.js +94 -0
  34. package/dist/makeWrapPlansPlugin.js.map +1 -0
  35. package/dist/parseIdentifierParts.d.ts +2 -0
  36. package/dist/parseIdentifierParts.d.ts.map +1 -0
  37. package/{node8plus → dist}/parseIdentifierParts.js +2 -1
  38. package/dist/parseIdentifierParts.js.map +1 -0
  39. package/package.json +38 -26
  40. package/LICENSE.md +0 -24
  41. package/node8plus/fieldHelpers.d.ts +0 -13
  42. package/node8plus/fieldHelpers.js +0 -81
  43. package/node8plus/fieldHelpers.js.map +0 -1
  44. package/node8plus/gql.d.ts +0 -11
  45. package/node8plus/gql.js +0 -76
  46. package/node8plus/gql.js.map +0 -1
  47. package/node8plus/index.d.ts +0 -12
  48. package/node8plus/index.js +0 -26
  49. package/node8plus/index.js.map +0 -1
  50. package/node8plus/introspectionHelpers.d.ts +0 -7
  51. package/node8plus/introspectionHelpers.js +0 -62
  52. package/node8plus/introspectionHelpers.js.map +0 -1
  53. package/node8plus/makeAddInflectorsPlugin.d.ts +0 -7
  54. package/node8plus/makeAddInflectorsPlugin.js +0 -21
  55. package/node8plus/makeAddInflectorsPlugin.js.map +0 -1
  56. package/node8plus/makeAddPgTableConditionPlugin.d.ts +0 -8
  57. package/node8plus/makeAddPgTableConditionPlugin.js +0 -89
  58. package/node8plus/makeAddPgTableConditionPlugin.js.map +0 -1
  59. package/node8plus/makeAddPgTableOrderByPlugin.d.ts +0 -23
  60. package/node8plus/makeAddPgTableOrderByPlugin.js +0 -76
  61. package/node8plus/makeAddPgTableOrderByPlugin.js.map +0 -1
  62. package/node8plus/makeChangeNullabilityPlugin.d.ts +0 -8
  63. package/node8plus/makeChangeNullabilityPlugin.js +0 -28
  64. package/node8plus/makeChangeNullabilityPlugin.js.map +0 -1
  65. package/node8plus/makeExtendSchemaPlugin.d.ts +0 -28
  66. package/node8plus/makeExtendSchemaPlugin.js +0 -703
  67. package/node8plus/makeExtendSchemaPlugin.js.map +0 -1
  68. package/node8plus/makePgSmartTagsPlugin.js +0 -200
  69. package/node8plus/makePgSmartTagsPlugin.js.map +0 -1
  70. package/node8plus/makePluginByCombiningPlugins.d.ts +0 -2
  71. package/node8plus/makePluginByCombiningPlugins.js +0 -11
  72. package/node8plus/makePluginByCombiningPlugins.js.map +0 -1
  73. package/node8plus/makeProcessSchemaPlugin.d.ts +0 -5
  74. package/node8plus/makeProcessSchemaPlugin.js +0 -9
  75. package/node8plus/makeProcessSchemaPlugin.js.map +0 -1
  76. package/node8plus/makeWrapResolversPlugin.d.ts +0 -30
  77. package/node8plus/makeWrapResolversPlugin.js +0 -80
  78. package/node8plus/makeWrapResolversPlugin.js.map +0 -1
  79. package/node8plus/parseIdentifierParts.d.ts +0 -1
  80. package/node8plus/parseIdentifierParts.js.map +0 -1
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeWrapPlansPlugin = void 0;
4
+ const grafast_1 = require("grafast");
5
+ const util_1 = require("util");
6
+ let counter = 0;
7
+ function makeWrapPlansPlugin(rulesOrGeneratorOrFilter, rule) {
8
+ if (rule && typeof rule !== "function") {
9
+ throw new Error("Invalid call signature for makeWrapPlansPlugin, expected second argument to be a function");
10
+ }
11
+ const name = `WrapPlansPlugin_${++counter}`;
12
+ const symbol = Symbol(name);
13
+ return {
14
+ name,
15
+ version: "0.0.0",
16
+ schema: {
17
+ hooks: {
18
+ build(build) {
19
+ // Disambiguate first argument
20
+ const rulesOrGenerator = rule ? null : rulesOrGeneratorOrFilter;
21
+ const filter = rule
22
+ ? rulesOrGeneratorOrFilter
23
+ : null;
24
+ const rules = typeof rulesOrGenerator === "function"
25
+ ? rulesOrGenerator(build.options)
26
+ : rulesOrGenerator;
27
+ build[symbol] = {
28
+ rules,
29
+ filter,
30
+ };
31
+ return build;
32
+ },
33
+ GraphQLObjectType_fields_field(field, build, context) {
34
+ const rules = build[symbol].rules;
35
+ const filter = build[symbol].filter;
36
+ const { Self, scope: { fieldName }, } = context;
37
+ let planWrapperOrSpec;
38
+ if (filter) {
39
+ const filterResult = filter(context, build, field, build.options);
40
+ if (!filterResult) {
41
+ if (filterResult !== null) {
42
+ // eslint-disable-next-line no-console
43
+ console.error(`Filter should return either a truthy value, or 'null', instead received: '${filterResult}'`);
44
+ }
45
+ return field;
46
+ }
47
+ planWrapperOrSpec = rule(filterResult);
48
+ }
49
+ else if (rules) {
50
+ const typeRules = rules[Self.name];
51
+ if (!typeRules) {
52
+ return field;
53
+ }
54
+ planWrapperOrSpec = typeRules[fieldName];
55
+ }
56
+ else {
57
+ // Should not happen
58
+ throw new Error("Bad call signature for function makeWrapPlansPlugin");
59
+ }
60
+ if (!planWrapperOrSpec) {
61
+ return field;
62
+ }
63
+ const planWrapper = typeof planWrapperOrSpec === "function"
64
+ ? planWrapperOrSpec
65
+ : planWrapperOrSpec.plan;
66
+ if (!planWrapper) {
67
+ return field;
68
+ }
69
+ const { plan: oldPlan = ($obj) => (0, grafast_1.access)($obj, fieldName), } = field;
70
+ return {
71
+ ...field,
72
+ plan(...planParams) {
73
+ // A replacement for `oldPlan` that automatically passes through arguments that weren't replaced
74
+ const smartPlan = (...overrideParams) => {
75
+ const $prev = oldPlan(
76
+ // @ts-ignore We're calling it dynamically, allowing the parent to override args.
77
+ ...overrideParams.concat(planParams.slice(overrideParams.length)));
78
+ if (!($prev instanceof grafast_1.ExecutableStep)) {
79
+ console.error(`Wrapped a plan function, but that function did not return a step!\n${String(oldPlan)}\n${(0, util_1.inspect)(field)}`);
80
+ throw new Error("Wrapped a plan function, but that function did not return a step!");
81
+ }
82
+ return $prev;
83
+ };
84
+ const [$source, fieldArgs, info] = planParams;
85
+ return planWrapper(smartPlan, $source, fieldArgs, info);
86
+ },
87
+ };
88
+ },
89
+ },
90
+ },
91
+ };
92
+ }
93
+ exports.makeWrapPlansPlugin = makeWrapPlansPlugin;
94
+ //# sourceMappingURL=makeWrapPlansPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeWrapPlansPlugin.js","sourceRoot":"","sources":["../src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ACjF,GAAG,cAAc,CAAC,MAAM,CACtB,UAAU,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CACxC,CACF,CAAC;gCACF,IAAI,CAAC,CAAC,KAAK,YAAY,wBAAc,CAAC,EAAE;oCACtC,OAAO,CAAC,KAAK,CACX,sEAAsE,MAAM,CAC1E,OAAO,CACR,KAAK,IAAA,cAAO,EAAC,KAAK,CAAC,EAAE,CACvB,CAAC;oCAEF,MAAM,IAAI,KAAK,CACb,mEAAmE,CACpE,CAAC;iCACH;gCACD,OAAO,KAAK,CAAC;4BACf,CAAC,CAAC;4BACF,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC;4BAC9C,OAAO,WAAW,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;wBAC1D,CAAC;qBACF,CAAC;gBACJ,CAAC;aACF;SACF;KACF,CAAC;AACJ,CAAC;AAzHD,kDAyHC"}
@@ -0,0 +1,2 @@
1
+ export declare function parseIdentifierParts(identifier: string): string[];
2
+ //# sourceMappingURL=parseIdentifierParts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseIdentifierParts.d.ts","sourceRoot":"","sources":["../src/parseIdentifierParts.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CA0CjE"}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseIdentifierParts = void 0;
3
4
  function parseIdentifierParts(identifier) {
4
5
  let hadQuotes = false;
5
6
  let inQuotes = false;
@@ -43,5 +44,5 @@ function parseIdentifierParts(identifier) {
43
44
  parts.push(current);
44
45
  return parts;
45
46
  }
46
- exports.default = parseIdentifierParts;
47
+ exports.parseIdentifierParts = parseIdentifierParts;
47
48
  //# sourceMappingURL=parseIdentifierParts.js.map
@@ -0,0 +1 @@
1
+ {"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UAAU,GAAG,CACtF,CAAC;aACH;YACD,OAAO,IAAI,IAAI,CAAC;SACjB;KACF;IACD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpB,OAAO,KAAK,CAAC;AACf,CAAC;AA1CD,oDA0CC"}
package/package.json CHANGED
@@ -1,17 +1,24 @@
1
1
  {
2
2
  "name": "graphile-utils",
3
- "version": "4.12.3",
3
+ "version": "5.0.0-0.3",
4
4
  "description": "Utilities to help with building graphile-build plugins",
5
- "main": "node8plus/index.js",
6
- "types": "node8plus/index.d.ts",
5
+ "type": "commonjs",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
7
14
  "scripts": {
8
- "test": "scripts/test",
9
- "prepack": "mkdir -p node8plus && tsc",
15
+ "test": "jest -i",
16
+ "prepack": "tsc -b",
10
17
  "watch": "mkdir -p node8plus && tsc --watch"
11
18
  },
12
19
  "repository": {
13
20
  "type": "git",
14
- "url": "git+https://github.com/graphile/graphile-engine.git"
21
+ "url": "git+https://github.com/graphile/heart.git"
15
22
  },
16
23
  "keywords": [
17
24
  "graphile",
@@ -21,36 +28,41 @@
21
28
  "build",
22
29
  "extension",
23
30
  "utils",
24
- "utilities"
31
+ "utilities",
32
+ "graphite"
25
33
  ],
26
34
  "author": "Benjie Gillam <code@benjiegillam.com>",
27
35
  "license": "MIT",
28
36
  "bugs": {
29
- "url": "https://github.com/graphile/graphile-engine/issues"
37
+ "url": "https://github.com/graphile/heart/issues"
30
38
  },
31
- "homepage": "https://github.com/graphile/graphile-engine/tree/master/packages/graphile-utils",
39
+ "homepage": "https://github.com/graphile/heart/tree/main/graphile-build/graphile-utils",
32
40
  "dependencies": {
33
41
  "debug": "^4.1.1",
34
- "graphql": ">=0.9 <0.14 || ^14.0.2 || ^15.4.0",
35
- "tslib": "^2.0.1"
42
+ "graphile-config": "^0.0.1-0.0",
43
+ "tslib": "^2.4.0"
36
44
  },
37
45
  "engines": {
38
- "node": ">=8.6"
39
- },
40
- "devDependencies": {
41
- "graphile-build": "4.12.3",
42
- "graphile-build-pg": "4.12.3",
43
- "jest": "25.x",
44
- "jest-serializer-graphql-schema": "4.10.0",
45
- "ts-node": "^9.0.0",
46
- "typescript": "^4.0.2"
46
+ "node": ">=14.17"
47
47
  },
48
48
  "peerDependencies": {
49
- "graphile-build": "^4.5.0",
50
- "graphile-build-pg": "^4.5.0"
49
+ "grafast": "^0.0.1-0.2",
50
+ "graphile-build": "^5.0.0-0.3",
51
+ "graphile-build-pg": "^5.0.0-0.3",
52
+ "graphql": "*",
53
+ "pg-introspection": "^0.0.1-0.0"
54
+ },
55
+ "devDependencies": {
56
+ "graphile-build": "^5.0.0-0.3",
57
+ "graphile-build-pg": "^5.0.0-0.3",
58
+ "jest": "^28.1.0",
59
+ "jest-serializer-graphql-schema": "^5.0.0-0.1",
60
+ "nodemon": "^2.0.15",
61
+ "ts-node": "^10.9.1",
62
+ "typescript": "^4.8.1-rc"
51
63
  },
52
64
  "files": [
53
- "node8plus"
54
- ],
55
- "gitHead": "eb1056b59f8217807e1c53076f9081d08c09aa76"
56
- }
65
+ "dist",
66
+ "index.js"
67
+ ]
68
+ }
package/LICENSE.md DELETED
@@ -1,24 +0,0 @@
1
- # The MIT License (MIT)
2
-
3
- Copyright © `2019` Benjie Gillam
4
-
5
- Permission is hereby granted, free of charge, to any person
6
- obtaining a copy of this software and associated documentation
7
- files (the “Software”), to deal in the Software without
8
- restriction, including without limitation the rights to use,
9
- copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the
11
- Software is furnished to do so, subject to the following
12
- conditions:
13
-
14
- The above copyright notice and this permission notice shall be
15
- included in all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
18
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
- OTHER DEALINGS IN THE SOFTWARE.
@@ -1,13 +0,0 @@
1
- import type { GraphQLResolveInfo } from "graphql";
2
- import type { Build, Context } from "graphile-build";
3
- import type { QueryBuilder, SQL } from "graphile-build-pg";
4
- export declare type SelectGraphQLResultFromTable = (tableFragment: SQL, builderCallback: (alias: SQL, sqlBuilder: QueryBuilder) => void) => Promise<any>;
5
- export interface GraphileHelpers<TSource> {
6
- build: Build;
7
- fieldContext: Context<TSource>;
8
- selectGraphQLResultFromTable: SelectGraphQLResultFromTable;
9
- }
10
- export declare function makeFieldHelpers<TSource>(build: Build, fieldContext: Context<TSource>, context: any, resolveInfo: GraphQLResolveInfo): GraphileHelpers<TSource>;
11
- export declare function requireColumn<Type>(build: Build, context: Context<Type>, method: "addArgDataGenerator" | "addDataGenerator", col: string, alias: string): void;
12
- export declare function requireChildColumn<Type>(build: Build, context: Context<Type>, col: string, alias: string): void;
13
- export declare function requireSiblingColumn<Type>(build: Build, context: Context<Type>, col: string, alias: string): void;
@@ -1,81 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.requireSiblingColumn = exports.requireChildColumn = exports.requireColumn = exports.makeFieldHelpers = void 0;
4
- const debug_1 = require("debug");
5
- // Not really the right scope, but eases debugging for users
6
- const debugSql = (0, debug_1.default)("graphile-build-pg:sql");
7
- function makeFieldHelpers(build, fieldContext, context, resolveInfo) {
8
- const { parseResolveInfo, pgQueryFromResolveData, pgSql: sql,
9
- // Default is for support of graphile-build-pg pre 4.12:
10
- formatSQLForDebugging = require("graphile-build-pg").formatSQLForDebugging, } = build;
11
- const { getDataFromParsedResolveInfoFragment, scope } = fieldContext;
12
- const { pgFieldIntrospection, isPgFieldConnection } = scope;
13
- const isConnection = !!isPgFieldConnection;
14
- const table = pgFieldIntrospection && pgFieldIntrospection.kind === "class"
15
- ? pgFieldIntrospection
16
- : null;
17
- const primaryKeyConstraint = table && table.primaryKeyConstraint;
18
- const primaryKeys = primaryKeyConstraint && primaryKeyConstraint.keyAttributes;
19
- const selectGraphQLResultFromTable = async (tableFragment, builderCallback) => {
20
- const { pgClient } = context;
21
- const parsedResolveInfoFragment = parseResolveInfo(resolveInfo);
22
- const PayloadType = resolveInfo.returnType;
23
- const resolveData = getDataFromParsedResolveInfoFragment(parsedResolveInfoFragment, PayloadType);
24
- const tableAlias = sql.identifier(Symbol());
25
- const query = pgQueryFromResolveData(tableFragment, tableAlias, resolveData, {
26
- withPaginationAsFields: isConnection,
27
- }, (sqlBuilder) => {
28
- if (!isConnection &&
29
- primaryKeys &&
30
- build.options.subscriptions &&
31
- table) {
32
- sqlBuilder.selectIdentifiers(table);
33
- }
34
- if (typeof builderCallback === "function") {
35
- builderCallback(tableAlias, sqlBuilder);
36
- }
37
- }, context, resolveInfo.rootValue);
38
- const { text, values } = sql.compile(query);
39
- if (debugSql.enabled)
40
- debugSql("%s", "\n" + formatSQLForDebugging(text));
41
- const { rows } = await pgClient.query(text, values);
42
- if (isConnection) {
43
- return build.pgAddStartEndCursor(rows[0]);
44
- }
45
- else {
46
- const liveRecord = resolveInfo.rootValue && resolveInfo.rootValue.liveRecord;
47
- if (build.options.subscriptions &&
48
- !isConnection &&
49
- primaryKeys &&
50
- liveRecord) {
51
- rows.forEach((row) => row && liveRecord("pg", table, row.__identifiers));
52
- }
53
- return rows;
54
- }
55
- };
56
- const graphileHelpers = {
57
- build,
58
- fieldContext,
59
- selectGraphQLResultFromTable,
60
- };
61
- return graphileHelpers;
62
- }
63
- exports.makeFieldHelpers = makeFieldHelpers;
64
- function requireColumn(build, context, method, col, alias) {
65
- const { pgSql: sql } = build;
66
- context[method](() => ({
67
- pgQuery: (queryBuilder) => {
68
- queryBuilder.select(sql.query `${queryBuilder.getTableAlias()}.${sql.identifier(col)}`, alias);
69
- },
70
- }));
71
- }
72
- exports.requireColumn = requireColumn;
73
- function requireChildColumn(build, context, col, alias) {
74
- return requireColumn(build, context, "addArgDataGenerator", col, alias);
75
- }
76
- exports.requireChildColumn = requireChildColumn;
77
- function requireSiblingColumn(build, context, col, alias) {
78
- return requireColumn(build, context, "addDataGenerator", col, alias);
79
- }
80
- exports.requireSiblingColumn = requireSiblingColumn;
81
- //# sourceMappingURL=fieldHelpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fieldHelpers.js","sourceRoot":"","sources":["../src/fieldHelpers.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAKjC,4DAA4D;AAC5D,MAAM,QAAQ,GAAG,IAAA,eAAY,EAAC,uBAAuB,CAAC,CAAC;AAavD,SAAgB,gBAAgB,CAC9B,KAAY,EACZ,YAA8B,EAC9B,OAAY,EACZ,WAA+B;IAE/B,MAAM,EACJ,gBAAgB,EAChB,sBAAsB,EACtB,KAAK,EAAE,GAAG;IAEV,wDAAwD;IACxD,qBAAqB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,qBAAqB,GAC3E,GAAG,KAAK,CAAC;IACV,MAAM,EAAE,oCAAoC,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC;IACrE,MAAM,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC;IAE5D,MAAM,YAAY,GAAG,CAAC,CAAC,mBAAmB,CAAC;IAE3C,MAAM,KAAK,GACT,oBAAoB,IAAI,oBAAoB,CAAC,IAAI,KAAK,OAAO;QAC3D,CAAC,CAAC,oBAAoB;QACtB,CAAC,CAAC,IAAI,CAAC;IACX,MAAM,oBAAoB,GAAG,KAAK,IAAI,KAAK,CAAC,oBAAoB,CAAC;IACjE,MAA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ACtB,GAAW,EACX,KAAa;IAEb,OAAO,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AACvE,CAAC;AAPD,oDAOC"}
@@ -1,11 +0,0 @@
1
- import { DocumentNode } from "graphql";
2
- declare const $$embed: unique symbol;
3
- export interface GraphileEmbed<T = any> {
4
- [$$embed]: true;
5
- kind: "GraphileEmbed";
6
- value: T;
7
- }
8
- export declare function isEmbed(obj: any): obj is GraphileEmbed;
9
- export declare function embed<T>(value: T): GraphileEmbed<T>;
10
- export declare function gql(strings: TemplateStringsArray, ...interpolatedValues: Array<string | GraphileEmbed | DocumentNode>): DocumentNode;
11
- export {};
package/node8plus/gql.js DELETED
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.gql = exports.embed = exports.isEmbed = void 0;
4
- const graphql_1 = require("graphql");
5
- const $$embed = Symbol("graphile-embed");
6
- function isEmbed(obj) {
7
- return obj && obj[$$embed] === true;
8
- }
9
- exports.isEmbed = isEmbed;
10
- function embed(value) {
11
- return {
12
- [$$embed]: true,
13
- kind: "GraphileEmbed",
14
- value,
15
- };
16
- }
17
- exports.embed = embed;
18
- function isGraphQLDocument(input) {
19
- return (input &&
20
- typeof input === "object" &&
21
- input.kind === "Document" &&
22
- Array.isArray(input.definitions));
23
- }
24
- function gql(strings, ...interpolatedValues) {
25
- const gqlStrings = [];
26
- const placeholders = {};
27
- const additionalDefinitions = [];
28
- const createPlaceholderFor = (value) => {
29
- const rand = String(Math.random());
30
- placeholders[rand] = value;
31
- return `"${rand}"`;
32
- };
33
- for (let idx = 0, length = strings.length; idx < length; idx++) {
34
- gqlStrings.push(strings[idx]);
35
- if (idx === length - 1) {
36
- // NOOP: last string, so no matching interpolatedValue.
37
- }
38
- else {
39
- const interpolatedValue = interpolatedValues[idx];
40
- if (isEmbed(interpolatedValue)) {
41
- gqlStrings.push(createPlaceholderFor(interpolatedValue));
42
- }
43
- else {
44
- if (typeof interpolatedValue === "string") {
45
- gqlStrings.push(String(interpolatedValue));
46
- }
47
- else if (isGraphQLDocument(interpolatedValue)) {
48
- additionalDefinitions.push(...interpolatedValue.definitions);
49
- }
50
- else {
51
- throw new Error(`Placeholder ${idx + 1} is invalid - expected string or GraphQL AST, but received '${typeof interpolatedValue}'. Happened after '${gqlStrings.join("")}'`);
52
- }
53
- }
54
- }
55
- }
56
- const ast = (0, graphql_1.parse)(gqlStrings.join(""));
57
- const visitor = {
58
- enter: (node) => {
59
- if (node.kind === "Document") {
60
- return Object.assign(Object.assign({}, node), { definitions: [...node.definitions, ...additionalDefinitions] });
61
- }
62
- else if (node.kind === "Argument") {
63
- if (node.value.kind === "StringValue") {
64
- if (placeholders[node.value.value]) {
65
- return Object.assign(Object.assign({}, node), { value: placeholders[node.value.value] });
66
- }
67
- }
68
- }
69
- return undefined;
70
- },
71
- };
72
- const astWithPlaceholdersReplaced = (0, graphql_1.visit)(ast, visitor);
73
- return astWithPlaceholdersReplaced;
74
- }
75
- exports.gql = gql;
76
- //# sourceMappingURL=gql.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gql.js","sourceRoot":"","sources":["../src/gql.ts"],"names":[],"mappings":";;;AAAA,qCAA8E;AAC9E,MAAM,OAAO,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAQzC,SAAgB,OAAO,CAAC,GAAQ;IAC9B,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;AACtC,CAAC;AAFD,0BAEC;AAED,SAAgB,KAAK,CAAI,KAAQ;IAC/B,OAAO;QACL,CAAC,OAAO,CAAC,EAAE,IAAI;QACf,IAAI,EAAE,eAAe;QACrB,KAAK;KACN,CAAC;AACJ,CAAC;AAND,sBAMC;AAED,SAAS,iBAAiB,CAAC,KAAU;IACnC,OAAO,CACL,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,CAAC,IAAI,KAAK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GAAG,CACR,+DAA+D,OAAO,iBAAiB,sBAAsB,UAAU,CAAC,IAAI,CAC1H,EAAE,CACH,GAAG,CACL,CAAC;iBACH;aACF;SACF;KACF;IACD,MAAM,GAAG,GAAG,IAAA,eAAK,EAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG;QACd,KAAK,EAAE,CAAC,IAAa,EAAE,EAAE;YACvB,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE;gBAC5B,uCACK,IAAI,KACP,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,GAAG,qBAAqB,CAAC,IAC5D;aACH;iBAAM,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE;gBACnC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,aAAa,EAAE;oBACrC,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;wBAClC,uCACK,IAAI,KACP,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IACrC;qBACH;iBACF;aACF;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;KACF,CAAC;IACF,MAAM,2BAA2B,GAAG,IAAA,eAAK,EAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACxD,OAAO,2BAA2B,CAAC;AACrC,CAAC;AA5DD,kBA4DC"}
@@ -1,12 +0,0 @@
1
- import { embed, gql } from "./gql";
2
- import makeAddInflectorsPlugin from "./makeAddInflectorsPlugin";
3
- import makeExtendSchemaPlugin from "./makeExtendSchemaPlugin";
4
- import makePluginByCombiningPlugins from "./makePluginByCombiningPlugins";
5
- import makeWrapResolversPlugin from "./makeWrapResolversPlugin";
6
- import makeChangeNullabilityPlugin from "./makeChangeNullabilityPlugin";
7
- import makeProcessSchemaPlugin from "./makeProcessSchemaPlugin";
8
- import makeAddPgTableConditionPlugin from "./makeAddPgTableConditionPlugin";
9
- import makeAddPgTableOrderByPlugin, { orderByAscDesc, OrderByAscDescOptions, MakeAddPgTableOrderByPluginOrders } from "./makeAddPgTableOrderByPlugin";
10
- export { AugmentedGraphQLFieldResolver, ObjectFieldResolver, ObjectResolver, EnumResolver, Resolvers, ExtensionDefinition, } from "./makeExtendSchemaPlugin";
11
- export * from "./makePgSmartTagsPlugin";
12
- export { embed, gql, makeAddInflectorsPlugin, makeExtendSchemaPlugin, makePluginByCombiningPlugins, makeWrapResolversPlugin, makeChangeNullabilityPlugin, makeProcessSchemaPlugin, makeAddPgTableConditionPlugin, makeAddPgTableOrderByPlugin, orderByAscDesc, OrderByAscDescOptions, MakeAddPgTableOrderByPluginOrders, };
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.orderByAscDesc = exports.makeAddPgTableOrderByPlugin = exports.makeAddPgTableConditionPlugin = exports.makeProcessSchemaPlugin = exports.makeChangeNullabilityPlugin = exports.makeWrapResolversPlugin = exports.makePluginByCombiningPlugins = exports.makeExtendSchemaPlugin = exports.makeAddInflectorsPlugin = exports.gql = exports.embed = void 0;
4
- const tslib_1 = require("tslib");
5
- const gql_1 = require("./gql");
6
- Object.defineProperty(exports, "embed", { enumerable: true, get: function () { return gql_1.embed; } });
7
- Object.defineProperty(exports, "gql", { enumerable: true, get: function () { return gql_1.gql; } });
8
- const makeAddInflectorsPlugin_1 = require("./makeAddInflectorsPlugin");
9
- exports.makeAddInflectorsPlugin = makeAddInflectorsPlugin_1.default;
10
- const makeExtendSchemaPlugin_1 = require("./makeExtendSchemaPlugin");
11
- exports.makeExtendSchemaPlugin = makeExtendSchemaPlugin_1.default;
12
- const makePluginByCombiningPlugins_1 = require("./makePluginByCombiningPlugins");
13
- exports.makePluginByCombiningPlugins = makePluginByCombiningPlugins_1.default;
14
- const makeWrapResolversPlugin_1 = require("./makeWrapResolversPlugin");
15
- exports.makeWrapResolversPlugin = makeWrapResolversPlugin_1.default;
16
- const makeChangeNullabilityPlugin_1 = require("./makeChangeNullabilityPlugin");
17
- exports.makeChangeNullabilityPlugin = makeChangeNullabilityPlugin_1.default;
18
- const makeProcessSchemaPlugin_1 = require("./makeProcessSchemaPlugin");
19
- exports.makeProcessSchemaPlugin = makeProcessSchemaPlugin_1.default;
20
- const makeAddPgTableConditionPlugin_1 = require("./makeAddPgTableConditionPlugin");
21
- exports.makeAddPgTableConditionPlugin = makeAddPgTableConditionPlugin_1.default;
22
- const makeAddPgTableOrderByPlugin_1 = require("./makeAddPgTableOrderByPlugin");
23
- exports.makeAddPgTableOrderByPlugin = makeAddPgTableOrderByPlugin_1.default;
24
- Object.defineProperty(exports, "orderByAscDesc", { enumerable: true, get: function () { return makeAddPgTableOrderByPlugin_1.orderByAscDesc; } });
25
- (0, tslib_1.__exportStar)(require("./makePgSmartTagsPlugin"), exports);
26
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,+BAAmC;AAwBjC,sFAxBO,WAAK,OAwBP;AACL,oFAzBc,SAAG,OAyBd;AAxBL,uEAAgE;AAyB9D,kCAzBK,iCAAuB,CAyBL;AAxBzB,qEAA8D;AAyB5D,iCAzBK,gCAAsB,CAyBL;AAxBxB,iFAA0E;AAyBxE,uCAzBK,sCAA4B,CAyBL;AAxB9B,uEAAgE;AAyB9D,kCAzBK,iCAAuB,CAyBL;AAxBzB,+EAAwE;AAyBtE,sCAzBK,qCAA2B,CAyBL;AAxB7B,uEAAgE;AAyB9D,kCAzBK,iCAAuB,CAyBL;AAxBzB,mFAA4E;AAyB1E,wCAzBK,uCAA6B,CAyBL;AAxB/B,+EAIuC;AAqBrC,sCAzBK,qCAA2B,CAyBL;AAC3B,+FAzBA,4CAAc,OAyBA;AAZhB,uEAAwC"}
@@ -1,7 +0,0 @@
1
- import type { PgClass, PgConstraint, PgAttribute, PgEntity, PgProc } from "graphile-build-pg";
2
- import type { Build } from "graphile-build";
3
- export declare function isAttribute(obj: PgEntity): obj is PgAttribute;
4
- export declare function isConstraint(obj: PgEntity): obj is PgConstraint;
5
- export declare function isClass(obj: PgEntity): obj is PgClass;
6
- export declare function isProcedure(obj: PgEntity): obj is PgProc;
7
- export declare function entityIsIdentifiedBy(obj: PgEntity, identifier: string, build: Build): boolean;
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.entityIsIdentifiedBy = exports.isProcedure = exports.isClass = exports.isConstraint = exports.isAttribute = void 0;
4
- const parseIdentifierParts_1 = require("./parseIdentifierParts");
5
- function isAttribute(obj) {
6
- return obj.kind === "attribute";
7
- }
8
- exports.isAttribute = isAttribute;
9
- function isConstraint(obj) {
10
- return obj.kind === "constraint";
11
- }
12
- exports.isConstraint = isConstraint;
13
- function isClass(obj) {
14
- return obj.kind === "class";
15
- }
16
- exports.isClass = isClass;
17
- function isProcedure(obj) {
18
- return obj.kind === "procedure";
19
- }
20
- exports.isProcedure = isProcedure;
21
- function entityIsIdentifiedBy(obj, identifier, build) {
22
- const parts = (0, parseIdentifierParts_1.default)(identifier);
23
- if (parts.length === 1) {
24
- const [expectedName] = parts;
25
- return obj.name === expectedName;
26
- }
27
- else if (parts.length === 2) {
28
- const [parentName, expectedName] = parts;
29
- if (isAttribute(obj) || isConstraint(obj)) {
30
- // Parent is a table
31
- const klass = build.pgIntrospectionResultsByKind.class.find((kls) => kls.id === obj.classId);
32
- return obj.name === expectedName && !!klass && klass.name === parentName;
33
- }
34
- else if (isClass(obj) || isProcedure(obj)) {
35
- // Parent is a schema
36
- return obj.name === expectedName && obj.namespaceName === parentName;
37
- }
38
- else {
39
- throw new Error(`Type '${obj.kind}' not supported by makeSmartCommentsPlugin`);
40
- }
41
- }
42
- else if (parts.length === 3) {
43
- const [grandparentName, parentName, expectedName] = parts;
44
- if (isAttribute(obj) || isConstraint(obj)) {
45
- // Parent is a table, grandparent is a schema
46
- const klass = build.pgIntrospectionResultsByKind.class.find((kls) => kls.id === obj.classId);
47
- return (obj.name === expectedName &&
48
- !!klass &&
49
- klass.name === parentName &&
50
- klass.namespaceName === grandparentName);
51
- }
52
- else {
53
- // Parent is a schema; grandparent doesn't make sense
54
- throw new Error(`Identifier '${identifier}' does not make sense for a '${obj.kind}' entity`);
55
- }
56
- }
57
- else {
58
- throw new Error(`makeSmartCommentsPlugin did not know how to interpret match '${identifier}'`);
59
- }
60
- }
61
- exports.entityIsIdentifiedBy = entityIsIdentifiedBy;
62
- //# sourceMappingURL=introspectionHelpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"introspectionHelpers.js","sourceRoot":"","sources":["../src/introspectionHelpers.ts"],"names":[],"mappings":";;;AAOA,iEAA0D;AAG1D,SAAgB,WAAW,CAAC,GAAa;IACvC,OAAO,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC;AAClC,CAAC;AAFD,kCAEC;AAED,SAAgB,YAAY,CAAC,GAAa;IACxC,OAAO,GAAG,CAAC,IAAI,KAAK,YAAY,CAAC;AACnC,CAAC;AAFD,oCAEC;AAED,SAAgB,OAAO,CAAC,GAAa;IACnC,OAAO,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC;AAC9B,CAAC;AAFD,0BAEC;AAED,SAAgB,WAAW,CAAC,GAAa;IACvC,OAAO,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC;AAClC,CAAC;AAFD,kCAEC;AAED,SAAgB,oBAAoB,CAClC,GAAa,EACb,UAAkB,EAClB,KAAY;IAEZ,MAAM,KAAK,GAAG,IAAA,8BAAoB,EAAC,UAAU,CAAC,CAAC;IAC/C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACtB,MAAM,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC;QAC7B,OAAO,GAAG,CAAC,IAAI,KAAK,YAAY,CAAC;KAClC;SAAM,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7B,MAAM,CAAC,UAAU,EAAE,YAA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b,eAAe,UAAU,gCAAgC,GAAG,CAAC,IAAI,UAAU,CAC5E,CAAC;SACH;KACF;SAAM;QACL,MAAM,IAAI,KAAK,CACb,gEAAgE,UAAU,GAAG,CAC9E,CAAC;KACH;AACH,CAAC;AAnDD,oDAmDC"}
@@ -1,7 +0,0 @@
1
- import type { Plugin, Options, Build } from "graphile-build";
2
- interface Inflectors {
3
- [str: string]: (...args: Array<any>) => any;
4
- }
5
- declare type InflectorsGenerator = (inflection: Inflectors, build: Build, options: Options) => Inflectors;
6
- export default function makeAddInflectorsPlugin(additionalInflectorsOrGenerator: Inflectors | InflectorsGenerator, replace?: boolean): Plugin;
7
- export {};
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function makeAddInflectorsPlugin(additionalInflectorsOrGenerator, replace = false) {
4
- return (builder, options) => {
5
- builder.hook("inflection", (inflection, build) => {
6
- const additionalInflectors = typeof additionalInflectorsOrGenerator === "function"
7
- ? additionalInflectorsOrGenerator(inflection, build, options)
8
- : additionalInflectorsOrGenerator;
9
- if (replace) {
10
- // Overwrite directly so that we don't lose the 'extend' hints
11
- Object.assign(inflection, additionalInflectors);
12
- return inflection;
13
- }
14
- else {
15
- return build.extend(inflection, additionalInflectors, `Adding inflectors ('${Object.keys(additionalInflectors).join("', '")}') via makeAddInflectorsPlugin. You can pass \`true\` as the second argument to makeAddInflectorsPlugin to allow overwriting existing inflectors.`);
16
- }
17
- });
18
- };
19
- }
20
- exports.default = makeAddInflectorsPlugin;
21
- //# sourceMappingURL=makeAddInflectorsPlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"makeAddInflectorsPlugin.js","sourceRoot":"","sources":["../src/makeAddInflectorsPlugin.ts"],"names":[],"mappings":";;AAWA,SAAwB,uBAAuB,CAC7C,+BAAiE,EACjE,OAAO,GAAG,KAAK;IAEf,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;QAC1B,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE;YAC/C,MAAM,oBAAoB,GACxB,OAAO,+BAA+B,KAAK,UAAU;gBACnD,CAAC,CAAC,+BAA+B,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC;gBAC7D,CAAC,CAAC,+BAA+B,CAAC;YACtC,IAAI,OAAO,EAAE;gBACX,8DAA8D;gBAC9D,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC;gBAChD,OAAO,UAAU,CAAC;aACnB;iBAAM;gBACL,OAAO,KAAK,CAAC,MAAM,CACjB,UAAU,EACV,oBAAoB,EACpB,uBAAuB,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAC3D,MAAM,CACP,mJAAmJ,CACrJ,CAAC;aACH;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAzBD,0CAyBC"}
@@ -1,8 +0,0 @@
1
- import type { GraphQLInputFieldConfig } from "graphql";
2
- import type { SQL, sql as sqlType, QueryBuilder } from "graphile-build-pg";
3
- import type { Build, Plugin } from "graphile-build";
4
- export default function makeAddPgTableConditionPlugin(schemaName: string, tableName: string, conditionFieldName: string, conditionFieldSpecGenerator: (build: Build) => GraphQLInputFieldConfig, conditionGenerator: (value: unknown, helpers: {
5
- queryBuilder: QueryBuilder;
6
- sql: typeof sqlType;
7
- sqlTableAlias: SQL;
8
- }, build: Build) => SQL | null | undefined): Plugin;