graphile-utils 5.0.0-rc.2 → 5.0.0-rc.4
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.
- package/CHANGELOG.md +134 -0
- package/dist/index.d.ts +14 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -33
- package/dist/index.js.map +1 -1
- package/dist/makeAddPgTableConditionPlugin.js +3 -3
- package/dist/makeAddPgTableOrderByPlugin.js +7 -7
- package/dist/makeExtendSchemaPlugin.d.ts.map +1 -1
- package/dist/makeExtendSchemaPlugin.js +86 -23
- package/dist/makeExtendSchemaPlugin.js.map +1 -1
- package/dist/makePgSmartTagsPlugin.d.ts +11 -6
- package/dist/makePgSmartTagsPlugin.d.ts.map +1 -1
- package/dist/makePgSmartTagsPlugin.js +45 -35
- package/dist/makePgSmartTagsPlugin.js.map +1 -1
- package/dist/makeWrapPlansPlugin.d.ts +19 -2
- package/dist/makeWrapPlansPlugin.d.ts.map +1 -1
- package/dist/makeWrapPlansPlugin.js +48 -5
- package/dist/makeWrapPlansPlugin.js.map +1 -1
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,139 @@
|
|
|
1
1
|
# graphile-utils
|
|
2
2
|
|
|
3
|
+
## 5.0.0-rc.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2910](https://github.com/graphile/crystal/pull/2910)
|
|
8
|
+
[`9eb3829`](https://github.com/graphile/crystal/commit/9eb3829ea337041e4585e0cfeb63b44e87d7d14f)
|
|
9
|
+
Thanks [@benjie](https://github.com/benjie)! - Use consistent type export
|
|
10
|
+
syntax
|
|
11
|
+
|
|
12
|
+
- [`a3722d6`](https://github.com/graphile/crystal/commit/a3722d613bc6fb9e32f167aae9a31eaa422ceef1)
|
|
13
|
+
Thanks [@benjie](https://github.com/benjie)! - Refactor to enable TypeScript
|
|
14
|
+
options rewriteRelativeImportExtensions and erasableSyntaxOnly (including
|
|
15
|
+
using .ts extensions in source code)
|
|
16
|
+
|
|
17
|
+
- [#2924](https://github.com/graphile/crystal/pull/2924)
|
|
18
|
+
[`8b4b611`](https://github.com/graphile/crystal/commit/8b4b611b42d167e06c5b1048f532d180468637e8)
|
|
19
|
+
Thanks [@benjie](https://github.com/benjie)! - `pgSmartTags()` and related
|
|
20
|
+
functions now have more natural typing/better inference and improved
|
|
21
|
+
performance.
|
|
22
|
+
|
|
23
|
+
- [#2921](https://github.com/graphile/crystal/pull/2921)
|
|
24
|
+
[`e688cc1`](https://github.com/graphile/crystal/commit/e688cc18f26b5b2d4e836e14cb44fadb544ae82c)
|
|
25
|
+
Thanks [@benjie](https://github.com/benjie)! - Give extendSchema() support for
|
|
26
|
+
argument applyPlan
|
|
27
|
+
|
|
28
|
+
- [#2895](https://github.com/graphile/crystal/pull/2895)
|
|
29
|
+
[`7b20942`](https://github.com/graphile/crystal/commit/7b2094266477eab8b94c77e3009199d3897cb097)
|
|
30
|
+
Thanks [@benjie](https://github.com/benjie)! - Fix the `wrapPlans()` resolver
|
|
31
|
+
emulation warning to only occur when the type has no `assertStep`, group
|
|
32
|
+
related calls and log them together, offer an option to disable this warning
|
|
33
|
+
(along with the ability to name the plugin), and introduce an error page with
|
|
34
|
+
detailed information about the why and how to fix of the issue.
|
|
35
|
+
- Updated dependencies
|
|
36
|
+
[[`9eb3829`](https://github.com/graphile/crystal/commit/9eb3829ea337041e4585e0cfeb63b44e87d7d14f),
|
|
37
|
+
[`a3722d6`](https://github.com/graphile/crystal/commit/a3722d613bc6fb9e32f167aae9a31eaa422ceef1),
|
|
38
|
+
[`0f913ee`](https://github.com/graphile/crystal/commit/0f913ee4d91e9383aceda001640e171aa8a3069a),
|
|
39
|
+
[`5fc379e`](https://github.com/graphile/crystal/commit/5fc379ea1ee56ea033a3f7d8c4a1ee00a6c83de7),
|
|
40
|
+
[`1d5d63e`](https://github.com/graphile/crystal/commit/1d5d63e376999b1b4d911e75cbff77a07d4e17b9),
|
|
41
|
+
[`7ca663e`](https://github.com/graphile/crystal/commit/7ca663e055a20f8d5e3f1c424896f1d120c4443a)]:
|
|
42
|
+
- graphile-build@5.0.0-rc.4
|
|
43
|
+
- graphile-config@1.0.0-rc.4
|
|
44
|
+
- @dataplan/pg@1.0.0-rc.4
|
|
45
|
+
- grafast@1.0.0-rc.5
|
|
46
|
+
- graphile-build-pg@5.0.0-rc.4
|
|
47
|
+
- tamedevil@0.1.0-rc.4
|
|
48
|
+
|
|
49
|
+
## 5.0.0-rc.3
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- [#2877](https://github.com/graphile/crystal/pull/2877)
|
|
54
|
+
[`1e45a3d`](https://github.com/graphile/crystal/commit/1e45a3d6495cfea45bfdde95af889a453b82def3)
|
|
55
|
+
Thanks [@benjie](https://github.com/benjie)! - Safety - use null prototype
|
|
56
|
+
objects in more places.
|
|
57
|
+
|
|
58
|
+
- [#2873](https://github.com/graphile/crystal/pull/2873)
|
|
59
|
+
[`0772086`](https://github.com/graphile/crystal/commit/0772086411a55d56b4e345cff1eef133eee31b36)
|
|
60
|
+
Thanks [@benjie](https://github.com/benjie)! - Update TypeScript configuration
|
|
61
|
+
to support Node 22 minimum
|
|
62
|
+
|
|
63
|
+
- [#2888](https://github.com/graphile/crystal/pull/2888)
|
|
64
|
+
[`1a56db2`](https://github.com/graphile/crystal/commit/1a56db2f53bc455a3d3ba6555a2cd777b27b271c)
|
|
65
|
+
Thanks [@benjaie](https://github.com/benjaie)! - Node v22+ is required for
|
|
66
|
+
this module.
|
|
67
|
+
|
|
68
|
+
- [#2875](https://github.com/graphile/crystal/pull/2875)
|
|
69
|
+
[`ced4abe`](https://github.com/graphile/crystal/commit/ced4abe359bb1c5edc432844cfdb283bf24b46eb)
|
|
70
|
+
Thanks [@benjie](https://github.com/benjie)! - `wrapPlans()` now refuses to
|
|
71
|
+
wrap the plan for a field that both has no plan and either has a `resolve()`
|
|
72
|
+
or `subscribe()` method (i.e. resolver emulation will be used). This is done
|
|
73
|
+
by simply skipping wrapping the resolver, and emitting a warning to the
|
|
74
|
+
console. This is a breaking fix as fields that may have previously had the
|
|
75
|
+
default plan resolver wrapped may no longer do so, but should not impact
|
|
76
|
+
anyone running a "pure" PostGraphile/Grafast schema (it only impacts you if
|
|
77
|
+
you are using traditional (non-plan) resolvers, e.g. via `extendSchema()`, and
|
|
78
|
+
you're also using `wrapPlans()` to target these same fields).
|
|
79
|
+
|
|
80
|
+
- [#2872](https://github.com/graphile/crystal/pull/2872)
|
|
81
|
+
[`4ca27c1`](https://github.com/graphile/crystal/commit/4ca27c1f543359d5a7dc53fae35fc35caddb4076)
|
|
82
|
+
Thanks [@benjie](https://github.com/benjie)! - Fix a bug where `apply()`
|
|
83
|
+
couldn't be added to enum values via `extendSchema()`. This is a breaking
|
|
84
|
+
fix - if you add non-scalar enum values to your schema via `extendSchema()`
|
|
85
|
+
then you will now need to use an object wrapper to set them instead (see
|
|
86
|
+
example below). An error will be thrown if we suspect this of being the case,
|
|
87
|
+
to ensure we don't incorrectly build your schema.
|
|
88
|
+
|
|
89
|
+
```diff
|
|
90
|
+
extendSchema({
|
|
91
|
+
typeDefs: `enum SomeEnum { FOO, BAR }`,
|
|
92
|
+
enums: {
|
|
93
|
+
SomeEnum: {
|
|
94
|
+
values: {
|
|
95
|
+
+ // Scalar values can be specified directly
|
|
96
|
+
FOO: 7,
|
|
97
|
+
|
|
98
|
+
+ // Non-scalars look like enum specification (`value`, `apply()`,
|
|
99
|
+
+ // `extensions`, etc), so must be specified via a wrapper object:
|
|
100
|
+
- BAR: { mol: 42 },
|
|
101
|
+
+ BAR: {
|
|
102
|
+
+ value: { mol: 42 },
|
|
103
|
+
+ },
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
- Updated dependencies
|
|
111
|
+
[[`44555c7`](https://github.com/graphile/crystal/commit/44555c7f479d531d6aef100f99859c3bcbf06c93),
|
|
112
|
+
[`86db203`](https://github.com/graphile/crystal/commit/86db203bf8e3697860c0bb52ac2d64b87170b3e8),
|
|
113
|
+
[`b69a2b0`](https://github.com/graphile/crystal/commit/b69a2b01cadc5ea2af5cf9cfcc52c34b1ad26481),
|
|
114
|
+
[`c2ae685`](https://github.com/graphile/crystal/commit/c2ae685a5ce001f79356c4a994613b16cdb01475),
|
|
115
|
+
[`1e45a3d`](https://github.com/graphile/crystal/commit/1e45a3d6495cfea45bfdde95af889a453b82def3),
|
|
116
|
+
[`0772086`](https://github.com/graphile/crystal/commit/0772086411a55d56b4e345cff1eef133eee31b36),
|
|
117
|
+
[`a60ed2a`](https://github.com/graphile/crystal/commit/a60ed2acc7abbdfce727eaef48f6ca0349c24635),
|
|
118
|
+
[`a565503`](https://github.com/graphile/crystal/commit/a5655035dfee7000c1d37e4791354d7a2ba35792),
|
|
119
|
+
[`d9ccc82`](https://github.com/graphile/crystal/commit/d9ccc82a30ca6167f480e5c8bc15d17df51c0d1c),
|
|
120
|
+
[`1a56db2`](https://github.com/graphile/crystal/commit/1a56db2f53bc455a3d3ba6555a2cd777b27b271c),
|
|
121
|
+
[`eafa3f0`](https://github.com/graphile/crystal/commit/eafa3f036ce68e6ffb65935f0a78edee2fa6bdf8),
|
|
122
|
+
[`22bfbc0`](https://github.com/graphile/crystal/commit/22bfbc0053294a716f1ec92c8c50fed556ea9a4e),
|
|
123
|
+
[`bd3250e`](https://github.com/graphile/crystal/commit/bd3250e0b8e0f45991e3553f9d3d1d0afa785f59),
|
|
124
|
+
[`456d387`](https://github.com/graphile/crystal/commit/456d387887bb6fb9a880d2c3cd8cc6ece8391cf0),
|
|
125
|
+
[`c65d03c`](https://github.com/graphile/crystal/commit/c65d03c2ad5f238f382eb9936c85571d00daa08b),
|
|
126
|
+
[`b27c562`](https://github.com/graphile/crystal/commit/b27c562409f7a2fd8a0eeaca96cd2c6b935efe4c),
|
|
127
|
+
[`f23f0cf`](https://github.com/graphile/crystal/commit/f23f0cf8812eddff7c91c529499a4f20f1f2978c),
|
|
128
|
+
[`a258427`](https://github.com/graphile/crystal/commit/a2584278e78535dc3c611c5257c332e515c280bc),
|
|
129
|
+
[`65d9556`](https://github.com/graphile/crystal/commit/65d9556cf18c54a7cd9c291aa10aa9806adb3c7a)]:
|
|
130
|
+
- grafast@1.0.0-rc.4
|
|
131
|
+
- graphile-build-pg@5.0.0-rc.3
|
|
132
|
+
- @dataplan/pg@1.0.0-rc.3
|
|
133
|
+
- graphile-build@5.0.0-rc.3
|
|
134
|
+
- graphile-config@1.0.0-rc.3
|
|
135
|
+
- tamedevil@0.1.0-rc.3
|
|
136
|
+
|
|
3
137
|
## 5.0.0-rc.2
|
|
4
138
|
|
|
5
139
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import type { BaseGraphQLArguments, Step } from "grafast";
|
|
2
|
-
export { EXPORTABLE } from "./exportable.
|
|
3
|
-
export { gql } from "./gql.
|
|
4
|
-
export { makeAddInflectorsPlugin } from "./makeAddInflectorsPlugin.
|
|
5
|
-
export { addPgTableCondition, makeAddPgTableConditionPlugin, } from "./makeAddPgTableConditionPlugin.
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
2
|
+
export { EXPORTABLE } from "./exportable.ts";
|
|
3
|
+
export { gql } from "./gql.ts";
|
|
4
|
+
export { makeAddInflectorsPlugin } from "./makeAddInflectorsPlugin.ts";
|
|
5
|
+
export { addPgTableCondition, makeAddPgTableConditionPlugin, } from "./makeAddPgTableConditionPlugin.ts";
|
|
6
|
+
export type { MakeAddPgTableOrderByPluginOrders, NullsSortMethod, OrderByAscDescOptions, } from "./makeAddPgTableOrderByPlugin.ts";
|
|
7
|
+
export { addPgTableOrderBy, makeAddPgTableOrderByPlugin, orderByAscDesc, } from "./makeAddPgTableOrderByPlugin.ts";
|
|
8
|
+
export type { ChangeNullabilityRules, ChangeNullabilityTypeRules, NullabilitySpec, NullabilitySpecString, } from "./makeChangeNullabilityPlugin.ts";
|
|
9
|
+
export { changeNullability, makeChangeNullabilityPlugin, } from "./makeChangeNullabilityPlugin.ts";
|
|
10
|
+
export type { EnumResolver, ExtensionDefinition, ObjectPlan, ObjectResolver, Plans, Resolvers, } from "./makeExtendSchemaPlugin.ts";
|
|
11
|
+
export { extendSchema, makeExtendSchemaPlugin, } from "./makeExtendSchemaPlugin.ts";
|
|
12
|
+
export { jsonPgSmartTags, makeJSONPgSmartTagsPlugin, makePgSmartTagsFromFilePlugin, makePgSmartTagsPlugin, pgSmartTags, pgSmartTagsFromFile, TagsFilePlugin, } from "./makePgSmartTagsPlugin.ts";
|
|
13
|
+
export { makeProcessSchemaPlugin, processSchema, } from "./makeProcessSchemaPlugin.ts";
|
|
14
|
+
export type { PlanWrapperFilter, PlanWrapperFilterRule, PlanWrapperFn, PlanWrapperRule, PlanWrapperRules, PlanWrapperRulesGenerator, } from "./makeWrapPlansPlugin.ts";
|
|
15
|
+
export { makeWrapPlansPlugin, wrapPlans } from "./makeWrapPlansPlugin.ts";
|
|
12
16
|
declare module "grafast" {
|
|
13
17
|
interface ScalarPlan<TInternal = any, TExternal = any> {
|
|
14
18
|
scope?: GraphileBuild.ScopeScalar;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACL,mBAAmB,EACnB,6BAA6B,GAC9B,MAAM,oCAAoC,C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I,CAAC,aAAa,CAAC,2BAA2B,EAAE,WAAW,CAAC,CAAC;KACtE;CACF"}
|
package/dist/index.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.wrapPlans = exports.makeWrapPlansPlugin = exports.processSchema = exports.makeProcessSchemaPlugin = exports.TagsFilePlugin = exports.pgSmartTagsFromFile = exports.pgSmartTags = exports.makePgSmartTagsPlugin = exports.makePgSmartTagsFromFilePlugin = exports.makeJSONPgSmartTagsPlugin = exports.jsonPgSmartTags = exports.makeExtendSchemaPlugin = exports.extendSchema = exports.makeChangeNullabilityPlugin = exports.changeNullability = exports.orderByAscDesc = exports.makeAddPgTableOrderByPlugin = exports.addPgTableOrderBy = exports.makeAddPgTableConditionPlugin = exports.addPgTableCondition = exports.makeAddInflectorsPlugin = exports.gql = exports.EXPORTABLE = void 0;
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "EXPORTABLE", { enumerable: true, get: function () { return
|
|
6
|
-
var
|
|
7
|
-
Object.defineProperty(exports, "gql", { enumerable: true, get: function () { return
|
|
8
|
-
var
|
|
9
|
-
Object.defineProperty(exports, "makeAddInflectorsPlugin", { enumerable: true, get: function () { return
|
|
10
|
-
var
|
|
11
|
-
Object.defineProperty(exports, "addPgTableCondition", { enumerable: true, get: function () { return
|
|
12
|
-
Object.defineProperty(exports, "makeAddPgTableConditionPlugin", { enumerable: true, get: function () { return
|
|
13
|
-
var
|
|
14
|
-
Object.defineProperty(exports, "addPgTableOrderBy", { enumerable: true, get: function () { return
|
|
15
|
-
Object.defineProperty(exports, "makeAddPgTableOrderByPlugin", { enumerable: true, get: function () { return
|
|
16
|
-
Object.defineProperty(exports, "orderByAscDesc", { enumerable: true, get: function () { return
|
|
17
|
-
var
|
|
18
|
-
Object.defineProperty(exports, "changeNullability", { enumerable: true, get: function () { return
|
|
19
|
-
Object.defineProperty(exports, "makeChangeNullabilityPlugin", { enumerable: true, get: function () { return
|
|
20
|
-
var
|
|
21
|
-
Object.defineProperty(exports, "extendSchema", { enumerable: true, get: function () { return
|
|
22
|
-
Object.defineProperty(exports, "makeExtendSchemaPlugin", { enumerable: true, get: function () { return
|
|
23
|
-
var
|
|
24
|
-
Object.defineProperty(exports, "jsonPgSmartTags", { enumerable: true, get: function () { return
|
|
25
|
-
Object.defineProperty(exports, "makeJSONPgSmartTagsPlugin", { enumerable: true, get: function () { return
|
|
26
|
-
Object.defineProperty(exports, "makePgSmartTagsFromFilePlugin", { enumerable: true, get: function () { return
|
|
27
|
-
Object.defineProperty(exports, "makePgSmartTagsPlugin", { enumerable: true, get: function () { return
|
|
28
|
-
Object.defineProperty(exports, "pgSmartTags", { enumerable: true, get: function () { return
|
|
29
|
-
Object.defineProperty(exports, "pgSmartTagsFromFile", { enumerable: true, get: function () { return
|
|
30
|
-
Object.defineProperty(exports, "TagsFilePlugin", { enumerable: true, get: function () { return
|
|
31
|
-
var
|
|
32
|
-
Object.defineProperty(exports, "makeProcessSchemaPlugin", { enumerable: true, get: function () { return
|
|
33
|
-
Object.defineProperty(exports, "processSchema", { enumerable: true, get: function () { return
|
|
34
|
-
var
|
|
35
|
-
Object.defineProperty(exports, "makeWrapPlansPlugin", { enumerable: true, get: function () { return
|
|
36
|
-
Object.defineProperty(exports, "wrapPlans", { enumerable: true, get: function () { return
|
|
4
|
+
var exportable_ts_1 = require("./exportable.js");
|
|
5
|
+
Object.defineProperty(exports, "EXPORTABLE", { enumerable: true, get: function () { return exportable_ts_1.EXPORTABLE; } });
|
|
6
|
+
var gql_ts_1 = require("./gql.js");
|
|
7
|
+
Object.defineProperty(exports, "gql", { enumerable: true, get: function () { return gql_ts_1.gql; } });
|
|
8
|
+
var makeAddInflectorsPlugin_ts_1 = require("./makeAddInflectorsPlugin.js");
|
|
9
|
+
Object.defineProperty(exports, "makeAddInflectorsPlugin", { enumerable: true, get: function () { return makeAddInflectorsPlugin_ts_1.makeAddInflectorsPlugin; } });
|
|
10
|
+
var makeAddPgTableConditionPlugin_ts_1 = require("./makeAddPgTableConditionPlugin.js");
|
|
11
|
+
Object.defineProperty(exports, "addPgTableCondition", { enumerable: true, get: function () { return makeAddPgTableConditionPlugin_ts_1.addPgTableCondition; } });
|
|
12
|
+
Object.defineProperty(exports, "makeAddPgTableConditionPlugin", { enumerable: true, get: function () { return makeAddPgTableConditionPlugin_ts_1.makeAddPgTableConditionPlugin; } });
|
|
13
|
+
var makeAddPgTableOrderByPlugin_ts_1 = require("./makeAddPgTableOrderByPlugin.js");
|
|
14
|
+
Object.defineProperty(exports, "addPgTableOrderBy", { enumerable: true, get: function () { return makeAddPgTableOrderByPlugin_ts_1.addPgTableOrderBy; } });
|
|
15
|
+
Object.defineProperty(exports, "makeAddPgTableOrderByPlugin", { enumerable: true, get: function () { return makeAddPgTableOrderByPlugin_ts_1.makeAddPgTableOrderByPlugin; } });
|
|
16
|
+
Object.defineProperty(exports, "orderByAscDesc", { enumerable: true, get: function () { return makeAddPgTableOrderByPlugin_ts_1.orderByAscDesc; } });
|
|
17
|
+
var makeChangeNullabilityPlugin_ts_1 = require("./makeChangeNullabilityPlugin.js");
|
|
18
|
+
Object.defineProperty(exports, "changeNullability", { enumerable: true, get: function () { return makeChangeNullabilityPlugin_ts_1.changeNullability; } });
|
|
19
|
+
Object.defineProperty(exports, "makeChangeNullabilityPlugin", { enumerable: true, get: function () { return makeChangeNullabilityPlugin_ts_1.makeChangeNullabilityPlugin; } });
|
|
20
|
+
var makeExtendSchemaPlugin_ts_1 = require("./makeExtendSchemaPlugin.js");
|
|
21
|
+
Object.defineProperty(exports, "extendSchema", { enumerable: true, get: function () { return makeExtendSchemaPlugin_ts_1.extendSchema; } });
|
|
22
|
+
Object.defineProperty(exports, "makeExtendSchemaPlugin", { enumerable: true, get: function () { return makeExtendSchemaPlugin_ts_1.makeExtendSchemaPlugin; } });
|
|
23
|
+
var makePgSmartTagsPlugin_ts_1 = require("./makePgSmartTagsPlugin.js");
|
|
24
|
+
Object.defineProperty(exports, "jsonPgSmartTags", { enumerable: true, get: function () { return makePgSmartTagsPlugin_ts_1.jsonPgSmartTags; } });
|
|
25
|
+
Object.defineProperty(exports, "makeJSONPgSmartTagsPlugin", { enumerable: true, get: function () { return makePgSmartTagsPlugin_ts_1.makeJSONPgSmartTagsPlugin; } });
|
|
26
|
+
Object.defineProperty(exports, "makePgSmartTagsFromFilePlugin", { enumerable: true, get: function () { return makePgSmartTagsPlugin_ts_1.makePgSmartTagsFromFilePlugin; } });
|
|
27
|
+
Object.defineProperty(exports, "makePgSmartTagsPlugin", { enumerable: true, get: function () { return makePgSmartTagsPlugin_ts_1.makePgSmartTagsPlugin; } });
|
|
28
|
+
Object.defineProperty(exports, "pgSmartTags", { enumerable: true, get: function () { return makePgSmartTagsPlugin_ts_1.pgSmartTags; } });
|
|
29
|
+
Object.defineProperty(exports, "pgSmartTagsFromFile", { enumerable: true, get: function () { return makePgSmartTagsPlugin_ts_1.pgSmartTagsFromFile; } });
|
|
30
|
+
Object.defineProperty(exports, "TagsFilePlugin", { enumerable: true, get: function () { return makePgSmartTagsPlugin_ts_1.TagsFilePlugin; } });
|
|
31
|
+
var makeProcessSchemaPlugin_ts_1 = require("./makeProcessSchemaPlugin.js");
|
|
32
|
+
Object.defineProperty(exports, "makeProcessSchemaPlugin", { enumerable: true, get: function () { return makeProcessSchemaPlugin_ts_1.makeProcessSchemaPlugin; } });
|
|
33
|
+
Object.defineProperty(exports, "processSchema", { enumerable: true, get: function () { return makeProcessSchemaPlugin_ts_1.processSchema; } });
|
|
34
|
+
var makeWrapPlansPlugin_ts_1 = require("./makeWrapPlansPlugin.js");
|
|
35
|
+
Object.defineProperty(exports, "makeWrapPlansPlugin", { enumerable: true, get: function () { return makeWrapPlansPlugin_ts_1.makeWrapPlansPlugin; } });
|
|
36
|
+
Object.defineProperty(exports, "wrapPlans", { enumerable: true, get: function () { return makeWrapPlansPlugin_ts_1.wrapPlans; } });
|
|
37
37
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
38
38
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,iDAA6C;AAApC,2GAAA,UAAU,OAAA;AACnB,mCAA+B;AAAtB,6FAAA,GAAG,OAAA;AACZ,2EAAuE;AAA9D,qIAAA,uBAAuB,OAAA;AAChC,uFAG4C;AAF1C,uIAAA,mBAAmB,OAAA;AACnB,iJAAA,6BAA6B,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,iDAA6C;AAApC,2GAAA,UAAU,OAAA;AACnB,mCAA+B;AAAtB,6FAAA,GAAG,OAAA;AACZ,2EAAuE;AAA9D,qIAAA,uBAAuB,OAAA;AAChC,uFAG4C;AAF1C,uIAAA,mBAAmB,OAAA;AACnB,iJAAA,6BAA6B,OAAA;AAO/B,mFAI0C;AAHxC,mIAAA,iBAAiB,OAAA;AACjB,6IAAA,2BAA2B,OAAA;AAC3B,gIAAA,cAAc,OAAA;AAQhB,mFAG0C;AAFxC,mIAAA,iBAAiB,OAAA;AACjB,6IAAA,2BAA2B,OAAA;AAU7B,yEAGqC;AAFnC,yHAAA,YAAY,OAAA;AACZ,mIAAA,sBAAsB,OAAA;AAExB,uEAQoC;AAPlC,2HAAA,eAAe,OAAA;AACf,qIAAA,yBAAyB,OAAA;AACzB,yIAAA,6BAA6B,OAAA;AAC7B,iIAAA,qBAAqB,OAAA;AACrB,uHAAA,WAAW,OAAA;AACX,+HAAA,mBAAmB,OAAA;AACnB,0HAAA,cAAc,OAAA;AAEhB,2EAGsC;AAFpC,qIAAA,uBAAuB,OAAA;AACvB,2HAAA,aAAa,OAAA;AAUf,mEAA0E;AAAjE,6HAAA,mBAAmB,OAAA;AAAE,mHAAA,SAAS,OAAA;AAyCvC,qDAAqD"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.makeAddPgTableConditionPlugin = void 0;
|
|
4
4
|
exports.addPgTableCondition = addPgTableCondition;
|
|
5
5
|
const pg_1 = require("@dataplan/pg");
|
|
6
|
-
const
|
|
6
|
+
const exportable_ts_1 = require("./exportable.js");
|
|
7
7
|
function addPgTableCondition(match, conditionFieldName, conditionFieldSpecGenerator,
|
|
8
8
|
// DEPRECATED! Use `apply` instead.
|
|
9
9
|
conditionGenerator) {
|
|
@@ -56,7 +56,7 @@ conditionGenerator) {
|
|
|
56
56
|
}
|
|
57
57
|
// build applyPlan
|
|
58
58
|
const _build = pruneBuild(build);
|
|
59
|
-
conditionFieldSpec.apply = (0,
|
|
59
|
+
conditionFieldSpec.apply = (0, exportable_ts_1.EXPORTABLE)((_build, conditionGenerator, sql, sqlValueWithCodec) => function apply(condition, val) {
|
|
60
60
|
const expression = conditionGenerator(val, {
|
|
61
61
|
sql,
|
|
62
62
|
sqlTableAlias: condition.alias,
|
|
@@ -86,7 +86,7 @@ conditionGenerator) {
|
|
|
86
86
|
exports.makeAddPgTableConditionPlugin = addPgTableCondition;
|
|
87
87
|
function pruneBuild(build) {
|
|
88
88
|
const { sql, grafast, graphql, dataplanPg, input: { pgRegistry }, } = build;
|
|
89
|
-
return (0,
|
|
89
|
+
return (0, exportable_ts_1.EXPORTABLE)((dataplanPg, grafast, graphql, pgRegistry, sql) => ({
|
|
90
90
|
sql,
|
|
91
91
|
grafast,
|
|
92
92
|
graphql,
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.makeAddPgTableOrderByPlugin = void 0;
|
|
4
4
|
exports.addPgTableOrderBy = addPgTableOrderBy;
|
|
5
5
|
exports.orderByAscDesc = orderByAscDesc;
|
|
6
|
-
const
|
|
6
|
+
const exportable_ts_1 = require("./exportable.js");
|
|
7
7
|
const counterByName = new Map();
|
|
8
8
|
function addPgTableOrderBy(match, ordersGenerator, hint = `Adding orders with addPgTableOrderBy to "${match.schemaName}"."${match.tableName}"`) {
|
|
9
9
|
const { serviceName = "main", schemaName, tableName } = match;
|
|
@@ -69,7 +69,7 @@ function orderByAscDesc(baseName, attributeOrSqlFragment, uniqueOrOptions = fals
|
|
|
69
69
|
: "LAST";
|
|
70
70
|
let spec;
|
|
71
71
|
const ascendingCb = typeof attributeOrSqlFragment === "string"
|
|
72
|
-
? (0,
|
|
72
|
+
? (0, exportable_ts_1.EXPORTABLE)((ascendingNulls, attributeOrSqlFragment, nullable, unique) => function apply(queryBuilder) {
|
|
73
73
|
queryBuilder.orderBy({
|
|
74
74
|
nulls: ascendingNulls,
|
|
75
75
|
attribute: attributeOrSqlFragment,
|
|
@@ -81,7 +81,7 @@ function orderByAscDesc(baseName, attributeOrSqlFragment, uniqueOrOptions = fals
|
|
|
81
81
|
}
|
|
82
82
|
}, [ascendingNulls, attributeOrSqlFragment, nullable, unique])
|
|
83
83
|
: typeof attributeOrSqlFragment === "function"
|
|
84
|
-
? (0,
|
|
84
|
+
? (0, exportable_ts_1.EXPORTABLE)((ascendingNulls, attributeOrSqlFragment, nullable, unique) => function apply(queryBuilder, info) {
|
|
85
85
|
queryBuilder.orderBy({
|
|
86
86
|
nulls: ascendingNulls,
|
|
87
87
|
...attributeOrSqlFragment(queryBuilder, info),
|
|
@@ -98,14 +98,14 @@ function orderByAscDesc(baseName, attributeOrSqlFragment, uniqueOrOptions = fals
|
|
|
98
98
|
direction: "ASC",
|
|
99
99
|
nullable,
|
|
100
100
|
}),
|
|
101
|
-
(0,
|
|
101
|
+
(0, exportable_ts_1.EXPORTABLE)((spec, unique) => function apply(queryBuilder) {
|
|
102
102
|
queryBuilder.orderBy(spec);
|
|
103
103
|
if (unique) {
|
|
104
104
|
queryBuilder.setOrderIsUnique();
|
|
105
105
|
}
|
|
106
106
|
}, [spec, unique]));
|
|
107
107
|
const descendingCb = typeof attributeOrSqlFragment === "string"
|
|
108
|
-
? (0,
|
|
108
|
+
? (0, exportable_ts_1.EXPORTABLE)((attributeOrSqlFragment, descendingNulls, nullable, unique) => function apply(queryBuilder) {
|
|
109
109
|
queryBuilder.orderBy({
|
|
110
110
|
nulls: descendingNulls,
|
|
111
111
|
attribute: attributeOrSqlFragment,
|
|
@@ -117,7 +117,7 @@ function orderByAscDesc(baseName, attributeOrSqlFragment, uniqueOrOptions = fals
|
|
|
117
117
|
}
|
|
118
118
|
}, [attributeOrSqlFragment, descendingNulls, nullable, unique])
|
|
119
119
|
: typeof attributeOrSqlFragment === "function"
|
|
120
|
-
? (0,
|
|
120
|
+
? (0, exportable_ts_1.EXPORTABLE)((attributeOrSqlFragment, descendingNulls, nullable, unique) => function apply(queryBuilder, info) {
|
|
121
121
|
queryBuilder.orderBy({
|
|
122
122
|
nulls: descendingNulls,
|
|
123
123
|
...attributeOrSqlFragment(queryBuilder, info),
|
|
@@ -134,7 +134,7 @@ function orderByAscDesc(baseName, attributeOrSqlFragment, uniqueOrOptions = fals
|
|
|
134
134
|
direction: "DESC",
|
|
135
135
|
nullable,
|
|
136
136
|
}),
|
|
137
|
-
(0,
|
|
137
|
+
(0, exportable_ts_1.EXPORTABLE)((spec, unique) => function apply(queryBuilder) {
|
|
138
138
|
queryBuilder.orderBy(spec);
|
|
139
139
|
if (unique) {
|
|
140
140
|
queryBuilder.setOrderIsUnique();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeExtendSchemaPlugin.d.ts","sourceRoot":"","sources":["../src/makeExtendSchemaPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EAEnB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"makeExtendSchemaPlugin.d.ts","sourceRoot":"","sources":["../src/makeExtendSchemaPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EAEnB,oBAAoB,EAIpB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,IAAI,iBAA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KAC9C,CAAC;CACH;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,aAAa,CAAC;QACtB,UAAU,KAAK;YACb,sBAAsB,EAAE;gBACtB,CAAC,gBAAgB,EAAE,MAAM,GAAG;oBAC1B,cAAc,EAAE,cAAc,CAAC;oBAC/B,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;oBAC5B,SAAS,EAAE,SAAS,CAAC;oBACrB,KAAK,EAAE,KAAK,CAAC;iBACd,CAAC;aACH,CAAC;SACH;KACF;CACF;AAED,wBAAgB,YAAY,CAC1B,SAAS,EACL,mBAAmB,GACnB,CAAC,CAAC,KAAK,EAAE,aAAa,CAAC,KAAK,KAAK,mBAAmB,CAAC,EACzD,gBAAgB,SAAyD,GACxE,cAAc,CAAC,MAAM,CAk3CvB;AAiBD,4CAA4C;AAC5C,eAAO,MAAM,sBAAsB,qBAAe,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeExtendSchemaPlugin = void 0;
|
|
4
4
|
exports.extendSchema = extendSchema;
|
|
5
|
-
const
|
|
5
|
+
const exportable_ts_1 = require("./exportable.js");
|
|
6
6
|
function extendSchema(generator, uniquePluginName = `ExtendSchemaPlugin_${String(Math.random()).slice(2)}`) {
|
|
7
7
|
let graphql;
|
|
8
8
|
if (typeof generator === "function" && generator.length >= 2) {
|
|
@@ -61,9 +61,9 @@ function extendSchema(generator, uniquePluginName = `ExtendSchemaPlugin_${String
|
|
|
61
61
|
GraphQLSchema: {
|
|
62
62
|
directives: [],
|
|
63
63
|
},
|
|
64
|
-
GraphQLInputObjectType:
|
|
65
|
-
GraphQLObjectType:
|
|
66
|
-
GraphQLInterfaceType:
|
|
64
|
+
GraphQLInputObjectType: Object.create(null),
|
|
65
|
+
GraphQLObjectType: Object.create(null),
|
|
66
|
+
GraphQLInterfaceType: Object.create(null),
|
|
67
67
|
};
|
|
68
68
|
const newTypes = [];
|
|
69
69
|
document.definitions.forEach((definition) => {
|
|
@@ -152,7 +152,7 @@ function extendSchema(generator, uniquePluginName = `ExtendSchemaPlugin_${String
|
|
|
152
152
|
else {
|
|
153
153
|
// Hackily convert the new format into the old format. We'll do away with
|
|
154
154
|
// this in future, but for now it's the easiest way to ensure compatibility
|
|
155
|
-
plans =
|
|
155
|
+
plans = Object.create(null);
|
|
156
156
|
const definitionNodes = document.definitions.filter((d) => d.kind === Kind.OBJECT_TYPE_DEFINITION ||
|
|
157
157
|
d.kind === Kind.INTERFACE_TYPE_DEFINITION ||
|
|
158
158
|
d.kind === Kind.UNION_TYPE_DEFINITION ||
|
|
@@ -231,7 +231,7 @@ function extendSchema(generator, uniquePluginName = `ExtendSchemaPlugin_${String
|
|
|
231
231
|
};
|
|
232
232
|
for (const [typeName, spec] of Object.entries(objects ?? {})) {
|
|
233
233
|
const fields = assertLocation(typeName, "objects");
|
|
234
|
-
const o =
|
|
234
|
+
const o = Object.create(null);
|
|
235
235
|
plans[typeName] = o;
|
|
236
236
|
const { plans: planResolvers = {}, ...rest } = spec;
|
|
237
237
|
for (const [key, val] of Object.entries(rest)) {
|
|
@@ -247,7 +247,7 @@ function extendSchema(generator, uniquePluginName = `ExtendSchemaPlugin_${String
|
|
|
247
247
|
}
|
|
248
248
|
for (const [typeName, spec] of Object.entries(inputObjects ?? {})) {
|
|
249
249
|
const fields = assertLocation(typeName, "inputObjects");
|
|
250
|
-
const o =
|
|
250
|
+
const o = Object.create(null);
|
|
251
251
|
plans[typeName] = o;
|
|
252
252
|
const { plans: planResolvers = {}, ...rest } = spec;
|
|
253
253
|
for (const [key, val] of Object.entries(rest)) {
|
|
@@ -263,7 +263,7 @@ function extendSchema(generator, uniquePluginName = `ExtendSchemaPlugin_${String
|
|
|
263
263
|
}
|
|
264
264
|
for (const [typeName, spec] of Object.entries(unions ?? {})) {
|
|
265
265
|
assertLocation(typeName, "unions");
|
|
266
|
-
const o =
|
|
266
|
+
const o = Object.create(null);
|
|
267
267
|
plans[typeName] = o;
|
|
268
268
|
for (const [key, val] of Object.entries(spec)) {
|
|
269
269
|
assertNotDunder(`unions.${typeName}`, key);
|
|
@@ -272,7 +272,7 @@ function extendSchema(generator, uniquePluginName = `ExtendSchemaPlugin_${String
|
|
|
272
272
|
}
|
|
273
273
|
for (const [typeName, spec] of Object.entries(interfaces ?? {})) {
|
|
274
274
|
const fields = assertLocation(typeName, "interfaces");
|
|
275
|
-
const o =
|
|
275
|
+
const o = Object.create(null);
|
|
276
276
|
plans[typeName] = o;
|
|
277
277
|
const { fields: fieldConfigs = {}, ...rest } = spec;
|
|
278
278
|
for (const [key, val] of Object.entries(rest)) {
|
|
@@ -309,7 +309,7 @@ function extendSchema(generator, uniquePluginName = `ExtendSchemaPlugin_${String
|
|
|
309
309
|
}
|
|
310
310
|
for (const [typeName, spec] of Object.entries(enums ?? {})) {
|
|
311
311
|
const enumValues = assertLocation(typeName, "enums");
|
|
312
|
-
const o =
|
|
312
|
+
const o = Object.create(null);
|
|
313
313
|
plans[typeName] = o;
|
|
314
314
|
const { values = {}, ...rest } = spec;
|
|
315
315
|
if ("plans" in rest) {
|
|
@@ -355,9 +355,54 @@ function extendSchema(generator, uniquePluginName = `ExtendSchemaPlugin_${String
|
|
|
355
355
|
// }
|
|
356
356
|
// }
|
|
357
357
|
// Ref: https://github.com/graphql/graphql-js/issues/525#issuecomment-255834625
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
358
|
+
const enumValueSpec = relevantResolver[valueName];
|
|
359
|
+
const extensions = Object.create(null);
|
|
360
|
+
build.exportNameHint(extensions, `${name}_${valueName}_extensions`);
|
|
361
|
+
let valueValue;
|
|
362
|
+
if (typeof enumValueSpec === "function") {
|
|
363
|
+
build.exportNameHint(enumValueSpec, `${name}_${valueName}_apply`);
|
|
364
|
+
// It's a plan
|
|
365
|
+
extensions.grafast = {
|
|
366
|
+
apply: enumValueSpec,
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
else if (typeof enumValueSpec === "object" &&
|
|
370
|
+
enumValueSpec != null) {
|
|
371
|
+
// It's a full spec
|
|
372
|
+
const fullConfig = enumValueSpec;
|
|
373
|
+
const keys = Object.keys(fullConfig);
|
|
374
|
+
const ALLOWED_KEYS = [
|
|
375
|
+
"extensions",
|
|
376
|
+
"apply",
|
|
377
|
+
"value",
|
|
378
|
+
"scope",
|
|
379
|
+
];
|
|
380
|
+
const forbiddenKeys = keys.filter((key) => !ALLOWED_KEYS.includes(key));
|
|
381
|
+
if (forbiddenKeys.length > 0) {
|
|
382
|
+
throw new Error(`Enum type ${name} value specification for ${valueName} has forbidden keys: ${forbiddenKeys.join(", ")}. If your enum is meant to have an object value, please specify it via a wrapper object with the 'value' key.`);
|
|
383
|
+
}
|
|
384
|
+
if (fullConfig.extensions) {
|
|
385
|
+
Object.assign(extensions, fullConfig.extensions);
|
|
386
|
+
}
|
|
387
|
+
if (fullConfig.apply) {
|
|
388
|
+
build.exportNameHint(fullConfig.apply, `${name}_${valueName}_apply`);
|
|
389
|
+
extensions.grafast = {
|
|
390
|
+
apply: fullConfig.apply,
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
if ("value" in fullConfig) {
|
|
394
|
+
valueValue = fullConfig.value;
|
|
395
|
+
}
|
|
396
|
+
if ("scope" in fullConfig) {
|
|
397
|
+
// TODO: handle scope
|
|
398
|
+
console.warn(`[WARNING] scope entry for enum value ${name}.${valueName} ignored.`);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
// It must be the value
|
|
403
|
+
valueValue = enumValueSpec;
|
|
404
|
+
}
|
|
405
|
+
valueValue ??= valueName;
|
|
361
406
|
const deprecatedDirective = valueDirectives.find((d) => d.directiveName === "deprecated");
|
|
362
407
|
const valueDeprecationReason = deprecatedDirective?.args.reason;
|
|
363
408
|
return {
|
|
@@ -367,6 +412,9 @@ function extendSchema(generator, uniquePluginName = `ExtendSchemaPlugin_${String
|
|
|
367
412
|
deprecationReason: valueDeprecationReason,
|
|
368
413
|
description: valueDescription,
|
|
369
414
|
directives: valueDirectives,
|
|
415
|
+
extensions: Object.keys(extensions).length > 0
|
|
416
|
+
? extensions
|
|
417
|
+
: undefined,
|
|
370
418
|
},
|
|
371
419
|
};
|
|
372
420
|
}, Object.create(null));
|
|
@@ -519,7 +567,7 @@ function extendSchema(generator, uniquePluginName = `ExtendSchemaPlugin_${String
|
|
|
519
567
|
const rawConfig = possiblePlan ?? possibleResolver;
|
|
520
568
|
const config = rawConfig
|
|
521
569
|
? rawConfig instanceof GraphQLScalarType
|
|
522
|
-
? (0,
|
|
570
|
+
? (0, exportable_ts_1.EXPORTABLE)((rawConfig) => rawConfig.toConfig(), [rawConfig])
|
|
523
571
|
: rawConfig
|
|
524
572
|
: null;
|
|
525
573
|
build.registerScalarType(name, scope, () => ({
|
|
@@ -528,14 +576,14 @@ function extendSchema(generator, uniquePluginName = `ExtendSchemaPlugin_${String
|
|
|
528
576
|
extensions: config?.extensions,
|
|
529
577
|
specifiedByURL: config?.specifiedByURL,
|
|
530
578
|
serialize: config?.serialize
|
|
531
|
-
? (0,
|
|
532
|
-
: (0,
|
|
579
|
+
? (0, exportable_ts_1.EXPORTABLE)((config) => config.serialize, [config])
|
|
580
|
+
: (0, exportable_ts_1.EXPORTABLE)(() => (value) => String(value), []),
|
|
533
581
|
parseValue: config?.parseValue
|
|
534
|
-
? (0,
|
|
535
|
-
: (0,
|
|
582
|
+
? (0, exportable_ts_1.EXPORTABLE)((config) => config.parseValue, [config])
|
|
583
|
+
: (0, exportable_ts_1.EXPORTABLE)(() => (value) => String(value), []),
|
|
536
584
|
parseLiteral: config?.parseLiteral
|
|
537
|
-
? (0,
|
|
538
|
-
: (0,
|
|
585
|
+
? (0, exportable_ts_1.EXPORTABLE)((config) => config.parseLiteral, [config])
|
|
586
|
+
: (0, exportable_ts_1.EXPORTABLE)((GraphQLError, Kind, name) => (ast) => {
|
|
539
587
|
if (ast.kind !== Kind.STRING) {
|
|
540
588
|
throw new GraphQLError(`${name} can only parse string values`);
|
|
541
589
|
}
|
|
@@ -786,7 +834,7 @@ function extendSchema(generator, uniquePluginName = `ExtendSchemaPlugin_${String
|
|
|
786
834
|
return memo;
|
|
787
835
|
}, Object.create(null));
|
|
788
836
|
}
|
|
789
|
-
return
|
|
837
|
+
return Object.create(null);
|
|
790
838
|
}
|
|
791
839
|
function getFields(build, context, SelfGeneric, fields, resolvers, plans) {
|
|
792
840
|
const { graphql: { getNullableType, getNamedType }, } = build;
|
|
@@ -812,6 +860,21 @@ function extendSchema(generator, uniquePluginName = `ExtendSchemaPlugin_${String
|
|
|
812
860
|
* other relevant methods.
|
|
813
861
|
*/
|
|
814
862
|
const possiblePlan = plans[Self.name]?.[fieldName];
|
|
863
|
+
if (typeof possiblePlan === "object" && possiblePlan !== null) {
|
|
864
|
+
for (const argName in args) {
|
|
865
|
+
const arg = args[argName];
|
|
866
|
+
const possibleArgPlan = possiblePlan.args?.[argName];
|
|
867
|
+
if (typeof possibleArgPlan === "function") {
|
|
868
|
+
arg.applyPlan = possibleArgPlan;
|
|
869
|
+
}
|
|
870
|
+
else if (possibleArgPlan) {
|
|
871
|
+
arg.applyPlan = possibleArgPlan?.applyPlan;
|
|
872
|
+
arg.applySubscribePlan = possibleArgPlan?.applySubscribePlan;
|
|
873
|
+
arg.extensions ??= Object.create(null);
|
|
874
|
+
Object.assign(arg.extensions, possibleArgPlan.extensions);
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}
|
|
815
878
|
build.exportNameHint(possiblePlan, `${Self.name}_${fieldName}_plan`);
|
|
816
879
|
const possibleResolver = resolvers[Self.name]?.[fieldName];
|
|
817
880
|
build.exportNameHint(possibleResolver, `${Self.name}_${fieldName}_resolver`);
|
|
@@ -883,7 +946,7 @@ function extendSchema(generator, uniquePluginName = `ExtendSchemaPlugin_${String
|
|
|
883
946
|
}
|
|
884
947
|
}, Object.create(null));
|
|
885
948
|
}
|
|
886
|
-
return
|
|
949
|
+
return Object.create(null);
|
|
887
950
|
}
|
|
888
951
|
function getInputFields(build, context, fields, plans) {
|
|
889
952
|
const { Self } = context;
|
|
@@ -923,7 +986,7 @@ function extendSchema(generator, uniquePluginName = `ExtendSchemaPlugin_${String
|
|
|
923
986
|
return memo;
|
|
924
987
|
}, Object.create(null));
|
|
925
988
|
}
|
|
926
|
-
return
|
|
989
|
+
return Object.create(null);
|
|
927
990
|
}
|
|
928
991
|
}
|
|
929
992
|
function scopeFromDirectives(directives) {
|