graphile-utils 4.12.2 → 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 +33 -24
  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
package/CHANGELOG.md ADDED
@@ -0,0 +1,35 @@
1
+ # graphile-utils
2
+
3
+ ## 5.0.0-0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`25037fc15`](undefined)]:
8
+ - grafast@0.0.1-0.2
9
+ - graphile-build-pg@5.0.0-0.3
10
+ - graphile-build@5.0.0-0.3
11
+
12
+ ## 5.0.0-0.2
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [[`55f15cf35`](undefined)]:
17
+ - grafast@0.0.1-0.1
18
+ - graphile-build-pg@5.0.0-0.2
19
+ - graphile-build@5.0.0-0.2
20
+
21
+ ## 5.0.0-0.1
22
+
23
+ ### Patch Changes
24
+
25
+ - [#125](https://github.com/benjie/postgraphile-private/pull/125)
26
+ [`91f2256b3`](https://github.com/benjie/postgraphile-private/commit/91f2256b3fd699bec19fc86f1ca79df057e58639)
27
+ Thanks [@benjie](https://github.com/benjie)! - Initial changesets release
28
+
29
+ - Updated dependencies
30
+ [[`91f2256b3`](https://github.com/benjie/postgraphile-private/commit/91f2256b3fd699bec19fc86f1ca79df057e58639)]:
31
+ - grafast@0.0.1-0.0
32
+ - graphile-build@5.0.0-0.1
33
+ - graphile-build-pg@5.0.0-0.1
34
+ - graphile-config@0.0.1-0.0
35
+ - pg-introspection@0.0.1-0.0
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ # V5: NOT YET FULLY IMPLEMENTED
2
+
1
3
  # graphile-utils
2
4
 
3
5
  <span class="badge-patreon"><a href="https://patreon.com/benjie" title="Support Graphile development on Patreon"><img src="https://img.shields.io/badge/sponsor-via%20Patreon-orange.svg" alt="Patreon sponsor button" /></a></span>
@@ -6,12 +8,12 @@
6
8
  ![MIT license](https://img.shields.io/npm/l/graphile-utils.svg)
7
9
  [![Follow](https://img.shields.io/badge/twitter-@GraphileHQ-blue.svg)](https://twitter.com/GraphileHQ)
8
10
 
9
- This package contains helpers for building plugins for GraphQL schemas
10
- utilising Graphile Engine, such as the one produced by
11
- [PostGraphile](https://graphile.org/postgraphile).
11
+ This package contains helpers for building plugins for GraphQL schemas utilising
12
+ Graphile Build, such as the one produced by
13
+ [PostGraphile](https://postgraphile.org).
12
14
 
13
15
  Documentation is currently available
14
- [here](https://graphile.org/postgraphile/extending/).
16
+ [here](https://postgraphile.org/postgraphile/next/extending/).
15
17
 
16
18
  PRs to improve documentation are always welcome!
17
19
 
@@ -19,19 +21,26 @@ PRs to improve documentation are always welcome!
19
21
 
20
22
  ## Crowd-funded open-source software
21
23
 
22
- To help us develop this software sustainably under the MIT license, we ask
23
- all individuals and businesses that use it to help support its ongoing
24
- maintenance and development via sponsorship.
24
+ To help us develop this software sustainably under the MIT license, we ask all
25
+ individuals and businesses that use it to help support its ongoing maintenance
26
+ and development via sponsorship.
25
27
 
26
28
  ### [Click here to find out more about sponsors and sponsorship.](https://www.graphile.org/sponsor/)
27
29
 
28
30
  And please give some love to our featured sponsors 🤩:
29
31
 
30
32
  <table><tr>
33
+ <td align="center"><a href="https://surge.io/"><img src="https://graphile.org/images/sponsors/surge.png" width="90" height="90" alt="Surge" /><br />Surge</a> *</td>
34
+ <td align="center"><a href="https://www.netflix.com/"><img src="https://graphile.org/images/sponsors/Netflix.png" width="90" height="90" alt="Netflix" /><br />Netflix</a> *</td>
35
+ <td align="center"><a href="https://qwick.com/"><img src="https://graphile.org/images/sponsors/qwick.png" width="90" height="90" alt="Qwick" /><br />Qwick</a> *</td>
36
+ <td align="center"><a href="https://www.the-guild.dev/"><img src="https://graphile.org/images/sponsors/theguild.png" width="90" height="90" alt="The Guild" /><br />The Guild</a> *</td>
37
+ </tr><tr>
31
38
  <td align="center"><a href="http://chads.website"><img src="https://graphile.org/images/sponsors/chadf.png" width="90" height="90" alt="Chad Furman" /><br />Chad Furman</a> *</td>
32
- <td align="center"><a href="https://storyscript.com/?utm_source=postgraphile"><img src="https://graphile.org/images/sponsors/storyscript.png" width="90" height="90" alt="Storyscript" /><br />Storyscript</a> *</td>
33
- <td align="center"><a href="https://postlight.com/?utm_source=graphile"><img src="https://graphile.org/images/sponsors/postlight.jpg" width="90" height="90" alt="Postlight" /><br />Postlight</a> *</td>
34
- <td align="center"><a href="https://surge.io/"><img src="https://graphile.org/images/sponsors/surge.png" width="90" height="90" alt="Surge.io" /><br />Surge.io</a> *</td>
39
+ <td align="center"><a href="https://www.fanatics.com/"><img src="https://graphile.org/images/sponsors/fanatics.png" width="90" height="90" alt="Fanatics" /><br />Fanatics</a> *</td>
40
+ <td align="center"><a href="https://dovetailapp.com/"><img src="https://graphile.org/images/sponsors/dovetail.png" width="90" height="90" alt="Dovetail" /><br />Dovetail</a> *</td>
41
+ <td align="center"><a href="https://www.enzuzo.com/"><img src="https://graphile.org/images/sponsors/enzuzo.png" width="90" height="90" alt="Enzuzo" /><br />Enzuzo</a> *</td>
42
+ </tr><tr>
43
+ <td align="center"><a href="https://stellate.co/"><img src="https://graphile.org/images/sponsors/Stellate.png" width="90" height="90" alt="Stellate" /><br />Stellate</a> *</td>
35
44
  </tr></table>
36
45
 
37
46
  <em>\* Sponsors the entire Graphile suite</em>
@@ -41,10 +50,10 @@ And please give some love to our featured sponsors 🤩:
41
50
  ### `gql`
42
51
 
43
52
  Similar to the default export from `graphql-tag`, this export can be used to
44
- form tagged template literals that are useful when building schema
45
- extensions. `gql` in `graphile-utils` differs from `graphql-tag` in a number
46
- of ways, most notably: it can use interpolation to generate dynamically named
47
- fields and types, and it can embed raw values using the `embed` helper.
53
+ form tagged template literals that are useful when building schema extensions.
54
+ `gql` in `graphile-utils` differs from `graphql-tag` in a number of ways, most
55
+ notably: it can use interpolation to generate dynamically named fields and
56
+ types, and it can embed raw values using the `embed` helper.
48
57
 
49
58
  ### `embed`
50
59
 
@@ -53,10 +62,10 @@ directives.
53
62
 
54
63
  ### `makeExtendSchemaPlugin`
55
64
 
56
- Docs: https://www.graphile.org/postgraphile/make-extend-schema-plugin/
65
+ Docs: https://postgraphile.org/postgraphile/next/make-extend-schema-plugin
57
66
 
58
- Enables you to add additonal types or extend existing types within your
59
- Graphile Engine GraphQL schema.
67
+ Enables you to add additonal types or extend existing types within your Graphile
68
+ Engine GraphQL schema.
60
69
 
61
70
  ```js
62
71
  const {
@@ -78,7 +87,7 @@ module.exports = MySchemaExtensionPlugin;
78
87
  e.g.:
79
88
 
80
89
  ```js
81
- makeExtendSchemaPlugin(build => ({
90
+ makeExtendSchemaPlugin((build) => ({
82
91
  typeDefs: gql`
83
92
  type Random {
84
93
  float: Float!
@@ -108,7 +117,7 @@ makeExtendSchemaPlugin(build => ({
108
117
 
109
118
  ### `makeAddInflectorsPlugin`
110
119
 
111
- Docs: https://www.graphile.org/postgraphile/make-add-inflectors-plugin/
120
+ Docs: https://postgraphile.org/postgraphile/next/make-add-inflectors-plugin
112
121
 
113
122
  If you don't like the default naming conventions that come with a Graphile
114
123
  Engine GraphQL schema then it's easy for you to override them using the
@@ -116,13 +125,13 @@ inflector.
116
125
 
117
126
  ### `makeChangeNullabilityPlugin`
118
127
 
119
- Docs: https://www.graphile.org/postgraphile/make-change-nullability-plugin/
128
+ Docs: https://postgraphile.org/postgraphile/next/make-change-nullability-plugin
120
129
 
121
130
  Use this plugin to override the nullability of fields in your GraphQL schema.
122
131
 
123
132
  ### `makeProcessSchemaPlugin`
124
133
 
125
- Docs: https://www.graphile.org/postgraphile/make-process-schema-plugin/
134
+ Docs: https://postgraphile.org/postgraphile/next/make-process-schema-plugin
126
135
 
127
136
  Enables you to process the schema after it's built, e.g. print it to a file,
128
137
  augment it with a third party library (e.g. graphql-shield), etc.
@@ -131,6 +140,6 @@ augment it with a third party library (e.g. graphql-shield), etc.
131
140
 
132
141
  Docs: https://www.graphile.org/postgraphile/make-wrap-resolvers-plugin/
133
142
 
134
- Enables you to wrap the field resolvers in the generated GraphQL API,
135
- allowing you to take an action before or after the resolver, or even modify
136
- the resolver result.
143
+ Enables you to wrap the field resolvers in the generated GraphQL API, allowing
144
+ you to take an action before or after the resolver, or even modify the resolver
145
+ result.
package/dist/gql.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import type { DocumentNode } from "graphql";
2
+ export declare function gql(strings: TemplateStringsArray, ...interpolatedValues: Array<string | DocumentNode>): DocumentNode;
3
+ //# sourceMappingURL=gql.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gql.d.ts","sourceRoot":"","sources":["../src/gql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,YAAY,EAAE,MAAM,SAAS,CAAC;AAarE,wBAAgB,GAAG,CACjB,OAAO,EAAE,oBAAoB,EAC7B,GAAG,kBAAkB,EAAE,KAAK,CAAC,MAAM,GAAG,YAAY,CAAC,GAClD,YAAY,CAgDd"}
package/dist/gql.js ADDED
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gql = void 0;
4
+ // eslint-disable-next-line no-restricted-syntax
5
+ const graphql_1 = require("graphql");
6
+ function isGraphQLDocument(input) {
7
+ return (input &&
8
+ typeof input === "object" &&
9
+ input.kind === "Document" &&
10
+ Array.isArray(input.definitions));
11
+ }
12
+ function gql(strings, ...interpolatedValues) {
13
+ const gqlStrings = [];
14
+ const placeholders = {};
15
+ const additionalDefinitions = [];
16
+ for (let idx = 0, length = strings.length; idx < length; idx++) {
17
+ gqlStrings.push(strings[idx]);
18
+ if (idx === length - 1) {
19
+ // NOOP: last string, so no matching interpolatedValue.
20
+ }
21
+ else {
22
+ const interpolatedValue = interpolatedValues[idx];
23
+ if (typeof interpolatedValue === "string") {
24
+ gqlStrings.push(String(interpolatedValue));
25
+ }
26
+ else if (isGraphQLDocument(interpolatedValue)) {
27
+ additionalDefinitions.push(...interpolatedValue.definitions);
28
+ }
29
+ else {
30
+ throw new Error(`Placeholder ${idx + 1} is invalid - expected string or GraphQL AST, but received '${typeof interpolatedValue}'. Happened after '${gqlStrings.join("")}'`);
31
+ }
32
+ }
33
+ }
34
+ const ast = (0, graphql_1.parse)(gqlStrings.join(""));
35
+ const visitor = {
36
+ enter: (node) => {
37
+ if (node.kind === "Document") {
38
+ return {
39
+ ...node,
40
+ definitions: [...node.definitions, ...additionalDefinitions],
41
+ };
42
+ }
43
+ else if (node.kind === "Argument") {
44
+ if (node.value.kind === "StringValue") {
45
+ if (placeholders[node.value.value]) {
46
+ return {
47
+ ...node,
48
+ value: placeholders[node.value.value],
49
+ };
50
+ }
51
+ }
52
+ }
53
+ return undefined;
54
+ },
55
+ };
56
+ const astWithPlaceholdersReplaced = (0, graphql_1.visit)(ast, visitor);
57
+ return astWithPlaceholdersReplaced;
58
+ }
59
+ exports.gql = gql;
60
+ //# sourceMappingURL=gql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gql.js","sourceRoot":"","sources":["../src/gql.ts"],"names":[],"mappings":";;;AACA,gDAAgD;AAChD,qCAAuC;AAEvC,SAAS,iBAAiB,CAAC,KAAU;IACnC,OAAO,CACL,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,CAAC,IAAI,KAAK,UAAU;QACzB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CACjC,CAAC;AACJ,CAAC;AAED,SAAgB,GAAG,CACjB,OAA6B,EAC7B,GAAG,kBAAgD;IAEnD,MAAM,UAAU,GAAG,E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AAI,KAAK,aAAa,EAAE;oBACrC,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;wBAClC,OAAO;4BACL,GAAG,IAAI;4BACP,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;yBACtC,CAAC;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;AAnDD,kBAmDC"}
@@ -0,0 +1,8 @@
1
+ export { gql } from "./gql.js";
2
+ export { makeAddInflectorsPlugin } from "./makeAddInflectorsPlugin.js";
3
+ export { ChangeNullabilityRules, ChangeNullabilityTypeRules, makeChangeNullabilityPlugin, NullabilitySpec, NullabilitySpecString, } from "./makeChangeNullabilityPlugin.js";
4
+ export { makeExtendSchemaPlugin } from "./makeExtendSchemaPlugin.js";
5
+ export { makeJSONPgSmartTagsPlugin, makePgSmartTagsFromFilePlugin, makePgSmartTagsPlugin, TagsFilePlugin, } from "./makePgSmartTagsPlugin.js";
6
+ export { makeProcessSchemaPlugin } from "./makeProcessSchemaPlugin.js";
7
+ export { makeWrapPlansPlugin, PlanWrapperFilter, PlanWrapperFilterRule, PlanWrapperFn, PlanWrapperRule, PlanWrapperRules, PlanWrapperRulesGenerator, } from "./makeWrapPlansPlugin.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,eAAe,EACf,qBAAqB,GACtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,qBAAqB,EACrB,cAAc,GACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,0BAA0B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeWrapPlansPlugin = exports.makeProcessSchemaPlugin = exports.TagsFilePlugin = exports.makePgSmartTagsPlugin = exports.makePgSmartTagsFromFilePlugin = exports.makeJSONPgSmartTagsPlugin = exports.makeExtendSchemaPlugin = exports.makeChangeNullabilityPlugin = exports.makeAddInflectorsPlugin = exports.gql = void 0;
4
+ var gql_js_1 = require("./gql.js");
5
+ Object.defineProperty(exports, "gql", { enumerable: true, get: function () { return gql_js_1.gql; } });
6
+ var makeAddInflectorsPlugin_js_1 = require("./makeAddInflectorsPlugin.js");
7
+ Object.defineProperty(exports, "makeAddInflectorsPlugin", { enumerable: true, get: function () { return makeAddInflectorsPlugin_js_1.makeAddInflectorsPlugin; } });
8
+ var makeChangeNullabilityPlugin_js_1 = require("./makeChangeNullabilityPlugin.js");
9
+ Object.defineProperty(exports, "makeChangeNullabilityPlugin", { enumerable: true, get: function () { return makeChangeNullabilityPlugin_js_1.makeChangeNullabilityPlugin; } });
10
+ var makeExtendSchemaPlugin_js_1 = require("./makeExtendSchemaPlugin.js");
11
+ Object.defineProperty(exports, "makeExtendSchemaPlugin", { enumerable: true, get: function () { return makeExtendSchemaPlugin_js_1.makeExtendSchemaPlugin; } });
12
+ var makePgSmartTagsPlugin_js_1 = require("./makePgSmartTagsPlugin.js");
13
+ Object.defineProperty(exports, "makeJSONPgSmartTagsPlugin", { enumerable: true, get: function () { return makePgSmartTagsPlugin_js_1.makeJSONPgSmartTagsPlugin; } });
14
+ Object.defineProperty(exports, "makePgSmartTagsFromFilePlugin", { enumerable: true, get: function () { return makePgSmartTagsPlugin_js_1.makePgSmartTagsFromFilePlugin; } });
15
+ Object.defineProperty(exports, "makePgSmartTagsPlugin", { enumerable: true, get: function () { return makePgSmartTagsPlugin_js_1.makePgSmartTagsPlugin; } });
16
+ Object.defineProperty(exports, "TagsFilePlugin", { enumerable: true, get: function () { return makePgSmartTagsPlugin_js_1.TagsFilePlugin; } });
17
+ var makeProcessSchemaPlugin_js_1 = require("./makeProcessSchemaPlugin.js");
18
+ Object.defineProperty(exports, "makeProcessSchemaPlugin", { enumerable: true, get: function () { return makeProcessSchemaPlugin_js_1.makeProcessSchemaPlugin; } });
19
+ var makeWrapPlansPlugin_js_1 = require("./makeWrapPlansPlugin.js");
20
+ Object.defineProperty(exports, "makeWrapPlansPlugin", { enumerable: true, get: function () { return makeWrapPlansPlugin_js_1.makeWrapPlansPlugin; } });
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAAtB,6FAAA,GAAG,OAAA;AACZ,2EAAuE;AAA9D,qIAAA,uBAAuB,OAAA;AAChC,mFAM0C;AAHxC,6IAAA,2BAA2B,OAAA;AAI7B,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA;AAC/B,uEAKoC;AAJlC,qIAAA,yBAAyB,OAAA;AACzB,yIAAA,6BAA6B,OAAA;AAC7B,iIAAA,qBAAqB,OAAA;AACrB,0HAAA,cAAc,OAAA;AAEhB,2EAAuE;AAA9D,qIAAA,uBAAuB,OAAA;AAChC,mEAQkC;AAPhC,6HAAA,mBAAmB,OAAA"}
@@ -0,0 +1,3 @@
1
+ /** @deprecated Build a plugin directly */
2
+ export declare function makeAddInflectorsPlugin(): never;
3
+ //# sourceMappingURL=makeAddInflectorsPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeAddInflectorsPlugin.d.ts","sourceRoot":"","sources":["../src/makeAddInflectorsPlugin.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,wBAAgB,uBAAuB,IAAI,KAAK,CAmC/C"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeAddInflectorsPlugin = void 0;
4
+ /** @deprecated Build a plugin directly */
5
+ function makeAddInflectorsPlugin() {
6
+ throw new Error(`makeAddInflectorsPlugin is no longer supported; the new plugin system makes it a little easier to write it yourself:
7
+
8
+ \`\`\`
9
+ // Import types for TypeScript
10
+ import "graphile-config";
11
+ import "graphile-build";
12
+ import "graphile-build-pg";
13
+
14
+ export const MyInflectorPlugin: GraphileConfig.Plugin = {
15
+ // Unique name for your plugin:
16
+ name: 'MyInflectorPlugin',
17
+ version: '0.0.0',
18
+
19
+ inflection: {
20
+ replace: {
21
+ builtin(
22
+ // The previous version of this inflector, the one you're replacing
23
+ previous,
24
+
25
+ // The resolved configuration
26
+ preset,
27
+
28
+ // Everything else is the arguments to this inflector
29
+ ...args
30
+ ) {
31
+ if (name === "Query") return "RootQuery";
32
+ return previous.call(this, ...args);
33
+ }
34
+ }
35
+ }
36
+ }
37
+ \`\`\`
38
+
39
+ `);
40
+ }
41
+ exports.makeAddInflectorsPlugin = makeAddInflectorsPlugin;
42
+ //# sourceMappingURL=makeAddInflectorsPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeAddInflectorsPlugin.js","sourceRoot":"","sources":["../src/makeAddInflectorsPlugin.ts"],"names":[],"mappings":";;;AAAA,0CAA0C;AAC1C,SAAgB,uBAAuB;IACrC,MAAM,IAAI,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCjB,CAAC,CAAC;AACH,CAAC;AAnCD,0DAmCC"}
@@ -0,0 +1,15 @@
1
+ export declare type NullabilitySpecString = "" | "!" | "[]" | "[]!" | "[!]" | "[!]!" | "[[]]" | "[[]]!" | "[[]!]" | "[[]!]!" | "[[!]]" | "[[!]]!" | "[[!]!]" | "[[!]!]!";
2
+ export declare type NullabilitySpec = boolean | NullabilitySpecString;
3
+ export interface ChangeNullabilityTypeRules {
4
+ [fieldName: string]: NullabilitySpec | {
5
+ type?: NullabilitySpec;
6
+ args?: {
7
+ [argName: string]: NullabilitySpec;
8
+ };
9
+ };
10
+ }
11
+ export interface ChangeNullabilityRules {
12
+ [typeName: string]: ChangeNullabilityTypeRules;
13
+ }
14
+ export declare function makeChangeNullabilityPlugin(rules: ChangeNullabilityRules): GraphileConfig.Plugin;
15
+ //# sourceMappingURL=makeChangeNullabilityPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeChangeNullabilityPlugin.d.ts","sourceRoot":"","sources":["../src/makeChangeNullabilityPlugin.ts"],"names":[],"mappings":"AAQA,oBAAY,qBAAqB,GAC7B,EAAE,GACF,GAAG,GACH,IAAI,GACJ,KAAK,GACL,KAAK,GACL,MAAM,GACN,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,SAAS,CAAC;AAGd,oBAAY,eAAe,GAAG,OAAO,GAAG,qBAAqB,CAAC;AAE9D,MAAM,WAAW,0BAA0B;IACzC,CAAC,SAAS,EAAE,MAAM,GACd,eAAe,GACf;QACE,IAAI,CAAC,EAAE,eAAe,CAAC;QACvB,IAAI,CAAC,EAAE;YACL,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAAC;SACpC,CAAC;KACH,CAAC;CACP;AACD,MAAM,WAAW,sBAAsB;IACrC,CAAC,QAAQ,EAAE,MAAM,GAAG,0BAA0B,CAAC;CAChD;AA+ED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,sBAAsB,GAC5B,cAAc,CAAC,MAAM,CAiJvB"}
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeChangeNullabilityPlugin = void 0;
4
+ const util_1 = require("util");
5
+ let counter = 0;
6
+ function doIt(inType, rawSpec, graphql, location, originalSpec = rawSpec) {
7
+ const spec = rawSpec === true ? "" : rawSpec === false ? "!" : rawSpec;
8
+ if (typeof spec !== "string") {
9
+ throw new Error(`Invalid spec for '${location}': '${(0, util_1.inspect)(originalSpec)}'`);
10
+ }
11
+ const shouldBeNonNull = spec.endsWith("!");
12
+ const isNonNull = graphql.isNonNullType(inType);
13
+ const nullableType = isNonNull ? inType.ofType : inType;
14
+ const specSansBang = shouldBeNonNull
15
+ ? spec.substring(0, spec.length - 1)
16
+ : spec;
17
+ if (specSansBang.startsWith("[")) {
18
+ if (!specSansBang.endsWith("]")) {
19
+ throw new Error(`Invalid syntax in spec for '${location}': '${(0, util_1.inspect)(originalSpec)}'`);
20
+ }
21
+ const rest = specSansBang.substring(1, specSansBang.length - 1);
22
+ if (!graphql.isListType(nullableType)) {
23
+ throw new Error(`Spec for '${location}' anticipated a list where there wasn't one: '${(0, util_1.inspect)(originalSpec)}'`);
24
+ }
25
+ const listInnerType = nullableType.ofType;
26
+ const innerType = doIt(listInnerType, rest, graphql, location, originalSpec);
27
+ const newListType = innerType === listInnerType
28
+ ? nullableType
29
+ : new graphql.GraphQLList(innerType);
30
+ if (newListType === nullableType && isNonNull === shouldBeNonNull) {
31
+ return inType;
32
+ }
33
+ else if (shouldBeNonNull) {
34
+ return new graphql.GraphQLNonNull(newListType);
35
+ }
36
+ else {
37
+ return newListType;
38
+ }
39
+ }
40
+ else {
41
+ if (specSansBang.length > 0) {
42
+ throw new Error(`Invalid syntax in spec for '${location}'; expected nothing left, but found '${specSansBang}': '${(0, util_1.inspect)(originalSpec)}'`);
43
+ }
44
+ if (shouldBeNonNull && isNonNull) {
45
+ return inType;
46
+ }
47
+ else if (shouldBeNonNull) {
48
+ return new graphql.GraphQLNonNull(nullableType);
49
+ }
50
+ else {
51
+ return nullableType;
52
+ }
53
+ }
54
+ return inType;
55
+ }
56
+ function makeChangeNullabilityPlugin(rules) {
57
+ const expectedMatches = Object.entries(rules).flatMap(([typeName, typeRules]) => Object.keys(typeRules).map((fieldName) => `${typeName}.${fieldName}`));
58
+ let pendingMatches = new Set();
59
+ function objectOrInterfaceFieldCallback(field, build, context) {
60
+ const { Self, scope: { fieldName }, } = context;
61
+ const typeRules = rules[Self.name];
62
+ if (!typeRules) {
63
+ return field;
64
+ }
65
+ const rawRule = typeRules[fieldName];
66
+ if (rawRule == null) {
67
+ return field;
68
+ }
69
+ const rule = typeof rawRule !== "object" ? { type: rawRule } : rawRule;
70
+ pendingMatches.delete(`${Self.name}.${fieldName}`);
71
+ if (rule.type) {
72
+ field.type = doIt(field.type, rule.type, build.graphql, `${Self.name}.${fieldName}`);
73
+ }
74
+ return field;
75
+ }
76
+ function objectOrInterfaceArgsCallback(args, build, context) {
77
+ const { Self, scope: { fieldName }, } = context;
78
+ const typeRules = rules[Self.name];
79
+ if (!typeRules) {
80
+ return args;
81
+ }
82
+ const rawRule = typeRules[fieldName];
83
+ if (rawRule == null) {
84
+ return args;
85
+ }
86
+ const rule = typeof rawRule !== "object" ? { type: rawRule } : rawRule;
87
+ if (rule.args) {
88
+ for (const [argName, spec] of Object.entries(rule.args)) {
89
+ const arg = args?.[argName];
90
+ if (!arg) {
91
+ throw new Error(`Could not find ${Self.name}.${fieldName} argument named '${argName}' (names: ${Object.keys(args).length > 0
92
+ ? `'${Object.keys(args).join("', '")}'`
93
+ : "none"})`);
94
+ }
95
+ arg.type = doIt(arg.type, spec, build.graphql, `${Self.name}.${fieldName}(${argName}:)`);
96
+ }
97
+ }
98
+ return args;
99
+ }
100
+ return {
101
+ name: `ChangeNullabilityPlugin_${++counter}`,
102
+ version: "0.0.0",
103
+ schema: {
104
+ hooks: {
105
+ init(_) {
106
+ pendingMatches = new Set(expectedMatches);
107
+ return _;
108
+ },
109
+ GraphQLInputObjectType_fields_field(field, build, context) {
110
+ const { Self, scope: { fieldName }, } = context;
111
+ const typeRules = rules[Self.name];
112
+ if (!typeRules) {
113
+ return field;
114
+ }
115
+ const rawRule = typeRules[fieldName];
116
+ if (rawRule == null) {
117
+ return field;
118
+ }
119
+ const rule = typeof rawRule !== "object" ? { type: rawRule } : rawRule;
120
+ pendingMatches.delete(`${Self.name}.${fieldName}`);
121
+ if (rule.type) {
122
+ field.type = doIt(field.type, rule.type, build.graphql, `${Self.name}.${fieldName}`);
123
+ }
124
+ if (rule.args) {
125
+ throw new Error(`${Self.name} is an input type, field '${fieldName}' cannot have args`);
126
+ }
127
+ return field;
128
+ },
129
+ GraphQLInterfaceType_fields_field: objectOrInterfaceFieldCallback,
130
+ GraphQLInterfaceType_fields_field_args: objectOrInterfaceArgsCallback,
131
+ GraphQLObjectType_fields_field: objectOrInterfaceFieldCallback,
132
+ GraphQLObjectType_fields_field_args: objectOrInterfaceArgsCallback,
133
+ finalize(schema) {
134
+ if (pendingMatches.size > 0) {
135
+ throw new Error(`The following entries in your makeChangeNullabilityPlugin didn't match anything in your GraphQL schema; please check your spelling: ${[
136
+ ...pendingMatches,
137
+ ].join(", ")}`);
138
+ }
139
+ return schema;
140
+ },
141
+ },
142
+ },
143
+ };
144
+ }
145
+ exports.makeChangeNullabilityPlugin = makeChangeNullabilityPlugin;
146
+ //# sourceMappingURL=makeChangeNullabilityPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeChangeNullabilityPlugin.js","sourceRoot":"","sources":["../src/makeChangeNullabilityPlugin.ts"],"names":[],"mappings":";;;AAMA,+BAA+B;AAmC/B,IAAI,OAAO,GAAG,CAAC,CAAC;AAEhB,SAAS,IAAI,CACX,MAAmB,EACnB,OAAwB,EACxB,OAA0B,EAC1B,QAAgB,EAChB,YAAY,GAAG,OAAO;IAEtB,MAAM,IAAI,GAAG,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC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,MAAM,OAAO,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;oBACrC,IAAI,OAAO,IAAI,IAAI,EAAE;wBACnB,OAAO,KAAK,CAAC;qBACd;oBACD,MAAM,IAAI,GACR,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;oBAC5D,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,SAAS,EAAE,CAAC,CAAC;oBACnD,IAAI,IAAI,CAAC,IAAI,EAAE;wBACb,KAAK,CAAC,IAAI,GAAG,IAAI,CACf,KAAK,CAAC,IAAI,EACV,IAAI,CAAC,IAAI,EACT,KAAK,CAAC,OAAO,EACb,GAAG,IAAI,CAAC,IAAI,IAAI,SAAS,EAAE,CACR,CAAC;qBACvB;oBACD,IAAI,IAAI,CAAC,IAAI,EAAE;wBACb,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,CAAC,IAAI,6BAA6B,SAAS,oBAAoB,CACvE,CAAC;qBACH;oBACD,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,iCAAiC,EAAE,8BAA8B;gBACjE,sCAAsC,EAAE,6BAA6B;gBACrE,8BAA8B,EAAE,8BAA8B;gBAC9D,mCAAmC,EAAE,6BAA6B;gBAClE,QAAQ,CAAC,MAAM;oBACb,IAAI,cAAc,CAAC,IAAI,GAAG,CAAC,EAAE;wBAC3B,MAAM,IAAI,KAAK,CACb,uIAAuI;4BACrI,GAAG,cAAc;yBAClB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACf,CAAC;qBACH;oBACD,OAAO,MAAM,CAAC;gBAChB,CAAC;aACF;SACF;KACF,CAAC;AACJ,CAAC;AAnJD,kEAmJC"}
@@ -0,0 +1,78 @@
1
+ import type { FieldPlanResolver } from "grafast";
2
+ import type { GraphileBuild } from "graphile-build";
3
+ import type { DirectiveDefinitionNode, DocumentNode, EnumTypeDefinitionNode, GraphQLDirective, GraphQLEnumType, GraphQLFieldResolver, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLIsTypeOfFn, GraphQLObjectType, GraphQLScalarType, GraphQLTypeResolver, GraphQLUnionType, InputObjectTypeDefinitionNode, InterfaceTypeDefinitionNode, ObjectTypeDefinitionNode, ScalarTypeDefinitionNode, UnionTypeDefinitionNode } from "graphql";
4
+ export interface ObjectFieldConfig<TSource = any, TContext = any> {
5
+ plan?: FieldPlanResolver<any, any, any>;
6
+ subscribePlan?: FieldPlanResolver<any, any, any>;
7
+ /** @deprecated Use 'plan' */
8
+ resolve?: GraphQLFieldResolver<TSource, TContext>;
9
+ /** @deprecated Use 'subscribePlan' */
10
+ subscribe?: GraphQLFieldResolver<TSource, TContext>;
11
+ __resolveType?: GraphQLTypeResolver<TSource, TContext>;
12
+ __isTypeOf?: GraphQLIsTypeOfFn<TSource, TContext>;
13
+ }
14
+ export interface ObjectResolver<TSource = any, TContext = any> {
15
+ [key: string]: GraphQLFieldResolver<TSource, TContext> | ObjectFieldConfig<TSource, TContext>;
16
+ }
17
+ export interface ObjectPlan<TSource = any, TContext = any> {
18
+ [key: string]: FieldPlanResolver<any, any, any> | ObjectFieldConfig<TSource, TContext>;
19
+ }
20
+ export interface EnumResolver {
21
+ [key: string]: string | number | Array<any> | Record<string, any> | symbol;
22
+ }
23
+ /** @deprecated Use Plans instead */
24
+ export interface Resolvers<TSource = any, TContext = any> {
25
+ [key: string]: ObjectResolver<TSource, TContext> | EnumResolver;
26
+ }
27
+ export interface Plans<TSource = any, TContext = any> {
28
+ [key: string]: ObjectPlan<TSource, TContext> | EnumResolver;
29
+ }
30
+ export interface ExtensionDefinition {
31
+ typeDefs: DocumentNode | DocumentNode[];
32
+ /** @deprecated Use 'plans' instead */
33
+ resolvers?: Resolvers;
34
+ plans?: Plans;
35
+ }
36
+ export declare function EXPORTABLE<T, TScope extends any[]>(factory: (...args: TScope) => T, args: [...TScope]): T;
37
+ declare type ParentConstructors<T> = {
38
+ new (...args: any[]): T;
39
+ };
40
+ declare type NewTypeDef = {
41
+ type: ParentConstructors<GraphQLObjectType>;
42
+ definition: ObjectTypeDefinitionNode;
43
+ } | {
44
+ type: ParentConstructors<GraphQLInputObjectType>;
45
+ definition: InputObjectTypeDefinitionNode;
46
+ } | {
47
+ type: ParentConstructors<GraphQLInterfaceType>;
48
+ definition: InterfaceTypeDefinitionNode;
49
+ } | {
50
+ type: ParentConstructors<GraphQLUnionType>;
51
+ definition: UnionTypeDefinitionNode;
52
+ } | {
53
+ type: ParentConstructors<GraphQLScalarType>;
54
+ definition: ScalarTypeDefinitionNode;
55
+ } | {
56
+ type: ParentConstructors<GraphQLEnumType>;
57
+ definition: EnumTypeDefinitionNode;
58
+ } | {
59
+ type: typeof GraphQLDirective;
60
+ definition: DirectiveDefinitionNode;
61
+ };
62
+ declare global {
63
+ namespace GraphileBuild {
64
+ interface Build {
65
+ makeExtendSchemaPlugin: {
66
+ [uniquePluginName: string]: {
67
+ typeExtensions: any;
68
+ newTypes: Array<NewTypeDef>;
69
+ resolvers: Resolvers;
70
+ plans: Plans;
71
+ };
72
+ };
73
+ }
74
+ }
75
+ }
76
+ export declare function makeExtendSchemaPlugin(generator: ExtensionDefinition | ((build: Partial<GraphileBuild.Build> & GraphileBuild.BuildBase, schemaOptions: GraphileBuild.GraphileBuildSchemaOptions) => ExtensionDefinition), uniquePluginName?: string): GraphileConfig.Plugin;
77
+ export {};
78
+ //# sourceMappingURL=makeExtendSchemaPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeExtendSchemaPlugin.d.ts","sourceRoot":"","sources":["../src/makeExtendSchemaPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAEV,uBAAuB,EAIvB,YAAY,EACZ,sBAAsB,EAGtB,gBAAgB,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