graphile-utils 5.0.0-beta.8 → 5.0.0-rc.1
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 +1074 -1
- package/README.md +87 -72
- package/dist/exportable.d.ts +4 -1
- package/dist/exportable.d.ts.map +1 -1
- package/dist/exportable.js +15 -4
- package/dist/exportable.js.map +1 -1
- package/dist/gql.js +1 -2
- package/dist/gql.js.map +1 -1
- package/dist/index.d.ts +42 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/makeAddInflectorsPlugin.js +2 -3
- package/dist/makeAddInflectorsPlugin.js.map +1 -1
- package/dist/makeAddPgTableConditionPlugin.d.ts +32 -6
- package/dist/makeAddPgTableConditionPlugin.d.ts.map +1 -1
- package/dist/makeAddPgTableConditionPlugin.js +28 -11
- package/dist/makeAddPgTableConditionPlugin.js.map +1 -1
- package/dist/makeAddPgTableOrderByPlugin.d.ts +15 -10
- package/dist/makeAddPgTableOrderByPlugin.d.ts.map +1 -1
- package/dist/makeAddPgTableOrderByPlugin.js +43 -35
- package/dist/makeAddPgTableOrderByPlugin.js.map +1 -1
- package/dist/makeChangeNullabilityPlugin.d.ts +3 -1
- package/dist/makeChangeNullabilityPlugin.d.ts.map +1 -1
- package/dist/makeChangeNullabilityPlugin.js +98 -18
- package/dist/makeChangeNullabilityPlugin.js.map +1 -1
- package/dist/makeExtendSchemaPlugin.d.ts +55 -26
- package/dist/makeExtendSchemaPlugin.d.ts.map +1 -1
- package/dist/makeExtendSchemaPlugin.js +402 -105
- package/dist/makeExtendSchemaPlugin.js.map +1 -1
- package/dist/makePgSmartTagsPlugin.d.ts +16 -3
- package/dist/makePgSmartTagsPlugin.d.ts.map +1 -1
- package/dist/makePgSmartTagsPlugin.js +24 -18
- package/dist/makePgSmartTagsPlugin.js.map +1 -1
- package/dist/makeProcessSchemaPlugin.d.ts +3 -1
- package/dist/makeProcessSchemaPlugin.d.ts.map +1 -1
- package/dist/makeProcessSchemaPlugin.js +4 -2
- package/dist/makeProcessSchemaPlugin.js.map +1 -1
- package/dist/makeWrapPlansPlugin.d.ts +6 -3
- package/dist/makeWrapPlansPlugin.d.ts.map +1 -1
- package/dist/makeWrapPlansPlugin.js +40 -18
- package/dist/makeWrapPlansPlugin.js.map +1 -1
- package/dist/parseIdentifierParts.js +1 -2
- package/dist/parseIdentifierParts.js.map +1 -1
- package/package.json +29 -23
package/README.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# V5: NOT YET FULLY IMPLEMENTED
|
|
2
|
-
|
|
3
1
|
# graphile-utils
|
|
4
2
|
|
|
5
3
|
<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>
|
|
@@ -21,9 +19,9 @@ PRs to improve documentation are always welcome!
|
|
|
21
19
|
|
|
22
20
|
## Crowd-funded open-source software
|
|
23
21
|
|
|
24
|
-
To help us develop this software sustainably
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
To help us develop this software sustainably, we ask all individuals and
|
|
23
|
+
businesses that use it to help support its ongoing maintenance and development
|
|
24
|
+
via sponsorship.
|
|
27
25
|
|
|
28
26
|
### [Click here to find out more about sponsors and sponsorship.](https://www.graphile.org/sponsor/)
|
|
29
27
|
|
|
@@ -31,112 +29,129 @@ And please give some love to our featured sponsors 🤩:
|
|
|
31
29
|
|
|
32
30
|
<table><tr>
|
|
33
31
|
<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>
|
|
34
|
-
<td align="center"><a href="https://
|
|
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.netflix.com/"><img src="https://graphile.org/images/sponsors/Netflix.png" width="90" height="90" alt="Netflix" /><br />Netflix</a> *</td>
|
|
37
|
-
</tr><tr>
|
|
38
|
-
<td align="center"><a href=""><img src="https://graphile.org/images/sponsors/chadf.png" width="90" height="90" alt="Chad Furman" /><br />Chad Furman</a> *</td>
|
|
39
|
-
<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>
|
|
40
|
-
<td align="center"><a href="https://www.accenture.com/"><img src="https://graphile.org/images/sponsors/accenture.svg" width="90" height="90" alt="Accenture" /><br />Accenture</a> *</td>
|
|
32
|
+
<td align="center"><a href="https://gosteelhead.com/"><img src="https://graphile.org/images/sponsors/steelhead.svg" width="90" height="90" alt="Steelhead" /><br />Steelhead</a> *</td>
|
|
41
33
|
</tr></table>
|
|
42
34
|
|
|
43
35
|
<em>\* Sponsors the entire Graphile suite</em>
|
|
44
36
|
|
|
45
37
|
<!-- SPONSORS_END -->
|
|
46
38
|
|
|
47
|
-
### `
|
|
48
|
-
|
|
49
|
-
Similar to the default export from `graphql-tag`, this export can be used to
|
|
50
|
-
form tagged template literals that are useful when building schema extensions.
|
|
51
|
-
`gql` in `graphile-utils` differs from `graphql-tag` in a number of ways, most
|
|
52
|
-
notably: it can use interpolation to generate dynamically named fields and
|
|
53
|
-
types, and it can embed raw values using the `embed` helper.
|
|
54
|
-
|
|
55
|
-
### `embed`
|
|
39
|
+
### `extendSchema`
|
|
56
40
|
|
|
57
|
-
|
|
58
|
-
directives.
|
|
59
|
-
|
|
60
|
-
### `makeExtendSchemaPlugin`
|
|
61
|
-
|
|
62
|
-
Docs: https://postgraphile.org/postgraphile/next/make-extend-schema-plugin
|
|
41
|
+
Docs: https://postgraphile.org/postgraphile/next/extend-schema
|
|
63
42
|
|
|
64
43
|
Enables you to add additonal types or extend existing types within your Graphile
|
|
65
44
|
Engine GraphQL schema.
|
|
66
45
|
|
|
67
46
|
```js
|
|
68
|
-
|
|
69
|
-
makeExtendSchemaPlugin,
|
|
70
|
-
gql,
|
|
71
|
-
} = require('graphile-utils');
|
|
47
|
+
import { extendSchema } from 'graphile-utils';
|
|
72
48
|
|
|
73
49
|
const MySchemaExtensionPlugin =
|
|
74
|
-
|
|
50
|
+
extendSchema(
|
|
75
51
|
build => ({
|
|
76
|
-
typeDefs:
|
|
77
|
-
|
|
52
|
+
typeDefs: /* GraphQL */ `...`,
|
|
53
|
+
objects: {...},
|
|
54
|
+
interfaces: {...},
|
|
55
|
+
unions: {...},
|
|
78
56
|
})
|
|
79
57
|
);
|
|
80
58
|
|
|
81
|
-
|
|
59
|
+
export default MySchemaExtensionPlugin;
|
|
82
60
|
```
|
|
83
61
|
|
|
84
62
|
e.g.:
|
|
85
63
|
|
|
86
64
|
```js
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
65
|
+
export default extendSchema((build) => {
|
|
66
|
+
const {
|
|
67
|
+
grafast: { constant },
|
|
68
|
+
} = build;
|
|
69
|
+
return {
|
|
70
|
+
typeDefs: /* GraphQL */ `
|
|
71
|
+
type Random {
|
|
72
|
+
float: Float!
|
|
73
|
+
number(min: Int!, max: Int!): Int!
|
|
74
|
+
}
|
|
75
|
+
extend type Query {
|
|
76
|
+
random: Random
|
|
77
|
+
}
|
|
78
|
+
`,
|
|
79
|
+
objects: {
|
|
80
|
+
Query: {
|
|
81
|
+
plans: {
|
|
82
|
+
random() {
|
|
83
|
+
return constant({});
|
|
84
|
+
},
|
|
85
|
+
},
|
|
101
86
|
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
87
|
+
Random: {
|
|
88
|
+
plans: {
|
|
89
|
+
float() {
|
|
90
|
+
return lambda(null, () => Math.random());
|
|
91
|
+
},
|
|
92
|
+
number(_parent, { $min, $max }) {
|
|
93
|
+
return lambda(
|
|
94
|
+
[$min, $max],
|
|
95
|
+
([min, max]) => min + Math.floor(Math.random() * (max - min + 1)),
|
|
96
|
+
);
|
|
97
|
+
},
|
|
98
|
+
},
|
|
109
99
|
},
|
|
110
100
|
},
|
|
111
|
-
}
|
|
112
|
-
})
|
|
101
|
+
};
|
|
102
|
+
});
|
|
113
103
|
```
|
|
114
104
|
|
|
115
|
-
|
|
105
|
+
#### `gql`
|
|
116
106
|
|
|
117
|
-
|
|
107
|
+
Similar to the default export from `graphql-tag`, this export can be used to
|
|
108
|
+
form tagged template literals that are useful when building schema extensions.
|
|
109
|
+
`gql` in `graphile-utils` differs from `graphql-tag` in a number of ways, most
|
|
110
|
+
notably: it can use interpolation to generate dynamically named fields and
|
|
111
|
+
types, and it can embed raw values using the `embed` helper.
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
extendSchema({ typeDefs: gql`...` });
|
|
115
|
+
```
|
|
118
116
|
|
|
119
|
-
|
|
120
|
-
Engine GraphQL schema then it's easy for you to override them using the
|
|
121
|
-
inflector.
|
|
117
|
+
#### `embed`
|
|
122
118
|
|
|
123
|
-
|
|
119
|
+
Used to wrap a value to be included in a `gql` AST, e.g. for use in GraphQL
|
|
120
|
+
directives.
|
|
124
121
|
|
|
125
|
-
|
|
122
|
+
```ts
|
|
123
|
+
extendSchema({ typeDefs: gql`...${embed(...)}...` });
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### `changeNullability`
|
|
127
|
+
|
|
128
|
+
Docs: https://postgraphile.org/postgraphile/next/change-nullability
|
|
126
129
|
|
|
127
130
|
Use this plugin to override the nullability of fields in your GraphQL schema.
|
|
128
131
|
|
|
129
|
-
### `
|
|
132
|
+
### `processSchema`
|
|
130
133
|
|
|
131
|
-
Docs: https://postgraphile.org/postgraphile/next/
|
|
134
|
+
Docs: https://postgraphile.org/postgraphile/next/process-schema
|
|
132
135
|
|
|
133
136
|
Enables you to process the schema after it's built, e.g. print it to a file,
|
|
134
137
|
augment it with a third party library (e.g. graphql-shield), etc.
|
|
135
138
|
|
|
136
|
-
### `
|
|
139
|
+
### `wrapPlans`
|
|
140
|
+
|
|
141
|
+
Docs: https://postgraphile.org/postgraphile/next/wrap-plans
|
|
142
|
+
|
|
143
|
+
Enables you to wrap the field plan resolvers in the generated Grafast schema,
|
|
144
|
+
allowing you to augment the way in which existing fields operate.
|
|
137
145
|
|
|
138
|
-
|
|
146
|
+
## Developing
|
|
139
147
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
148
|
+
### Testing
|
|
149
|
+
|
|
150
|
+
Make sure you first follow the instructions in the
|
|
151
|
+
[CONTRIBUTING.md file at the root of the repository](../../CONTRIBUTING.md),
|
|
152
|
+
then run the test with the following commands:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
yarn prepack
|
|
156
|
+
yarn test
|
|
157
|
+
```
|
package/dist/exportable.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export declare function EXPORTABLE<T, TScope extends any[]>(factory: (...args: TScope) => T, args: [...TScope]): T;
|
|
1
|
+
export declare function EXPORTABLE<T, TScope extends any[]>(factory: (...args: TScope) => T, args: [...TScope], nameHint?: string): T;
|
|
2
|
+
export declare function isForbidden(thing: unknown): thing is {
|
|
3
|
+
$$export: false;
|
|
4
|
+
};
|
|
2
5
|
//# sourceMappingURL=exportable.d.ts.map
|
package/dist/exportable.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exportable.d.ts","sourceRoot":"","sources":["../src/exportable.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,SAAS,GAAG,EAAE,EAChD,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,MAAM,KAAK,CAAC,EAC/B,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,GAChB,CAAC,
|
|
1
|
+
{"version":3,"file":"exportable.d.ts","sourceRoot":"","sources":["../src/exportable.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,SAAS,GAAG,EAAE,EAChD,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,MAAM,KAAK,CAAC,EAC/B,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,EACjB,QAAQ,CAAC,EAAE,MAAM,GAChB,CAAC,CAmBH;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,QAAQ,EAAE,KAAK,CAAA;CAAE,CAOxE"}
|
package/dist/exportable.js
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EXPORTABLE =
|
|
4
|
-
|
|
3
|
+
exports.EXPORTABLE = EXPORTABLE;
|
|
4
|
+
exports.isForbidden = isForbidden;
|
|
5
|
+
function EXPORTABLE(factory, args, nameHint) {
|
|
6
|
+
const forbiddenIndex = args.findIndex(isForbidden);
|
|
7
|
+
if (forbiddenIndex >= 0) {
|
|
8
|
+
throw new Error(`${nameHint ?? "Anonymous"} EXPORTABLE call's args[${forbiddenIndex}] is not allowed to be exported.`);
|
|
9
|
+
}
|
|
5
10
|
const fn = factory(...args);
|
|
6
|
-
if ((typeof fn === "
|
|
11
|
+
if (((typeof fn === "object" && fn !== null) || typeof fn === "function") &&
|
|
7
12
|
!("$exporter$factory" in fn)) {
|
|
8
13
|
Object.defineProperties(fn, {
|
|
9
14
|
$exporter$args: { value: args },
|
|
10
15
|
$exporter$factory: { value: factory },
|
|
16
|
+
$exporter$name: { writable: true, value: nameHint },
|
|
11
17
|
});
|
|
12
18
|
}
|
|
13
19
|
return fn;
|
|
14
20
|
}
|
|
15
|
-
|
|
21
|
+
function isForbidden(thing) {
|
|
22
|
+
return ((typeof thing === "object" || typeof thing === "function") &&
|
|
23
|
+
thing !== null &&
|
|
24
|
+
"$$export" in thing &&
|
|
25
|
+
thing.$$export === false);
|
|
26
|
+
}
|
|
16
27
|
//# sourceMappingURL=exportable.js.map
|
package/dist/exportable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exportable.js","sourceRoot":"","sources":["../src/exportable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exportable.js","sourceRoot":"","sources":["../src/exportable.ts"],"names":[],"mappings":";;AAAA,gCAuBC;AAED,kCAOC;AAhCD,SAAgB,UAAU,CACxB,OAA+B,EAC/B,IAAiB,EACjB,QAAiB;IAEjB,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACnD,IAAI,cAAc,IAAI,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACb,GAAG,QAAQ,IAAI,WAAW,2BAA2B,cAAc,kCAAkC,CACtG,CAAC;IACJ,CAAC;IACD,MAAM,EAAE,GAAM,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;IAC/B,IACE,CAAC,CAAC,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,IAAI,CAAC,IAAI,OAAO,EAAE,KAAK,UAAU,CAAC;QACrE,CAAC,CAAC,mBAAmB,IAAI,EAAE,CAAC,EAC5B,CAAC;QACD,MAAM,CAAC,gBAAgB,CAAC,EAAE,EAAE;YAC1B,cAAc,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;YAC/B,iBAAiB,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;YACrC,cAAc,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE;SACpD,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAgB,WAAW,CAAC,KAAc;IACxC,OAAO,CACL,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,UAAU,CAAC;QAC1D,KAAK,KAAK,IAAI;QACd,UAAU,IAAI,KAAK;QACnB,KAAK,CAAC,QAAQ,KAAK,KAAK,CACzB,CAAC;AACJ,CAAC"}
|
package/dist/gql.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.gql =
|
|
3
|
+
exports.gql = gql;
|
|
4
4
|
// eslint-disable-next-line no-restricted-syntax
|
|
5
5
|
const graphql_1 = require("grafast/graphql");
|
|
6
6
|
function isGraphQLDocument(input) {
|
|
@@ -56,5 +56,4 @@ function gql(strings, ...interpolatedValues) {
|
|
|
56
56
|
const astWithPlaceholdersReplaced = (0, graphql_1.visit)(ast, visitor);
|
|
57
57
|
return astWithPlaceholdersReplaced;
|
|
58
58
|
}
|
|
59
|
-
exports.gql = gql;
|
|
60
59
|
//# sourceMappingURL=gql.js.map
|
package/dist/gql.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gql.js","sourceRoot":"","sources":["../src/gql.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gql.js","sourceRoot":"","sources":["../src/gql.ts"],"names":[],"mappings":";;AAaA,kBAmDC;AA/DD,gDAAgD;AAChD,6CAA+C;AAE/C,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,EAAE,CAAC;IACtB,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzC,MAAM,qBAAqB,GAA0B,EAAE,CAAC;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AAC,IAAI,KAAK,aAAa,EAAE,CAAC;oBACtC,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;wBACnC,OAAO;4BACL,GAAG,IAAI;4BACP,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;yBACtC,CAAC;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,46 @@
|
|
|
1
|
+
import type { BaseGraphQLArguments, Step } from "grafast";
|
|
1
2
|
export { EXPORTABLE } from "./exportable.js";
|
|
2
3
|
export { gql } from "./gql.js";
|
|
3
4
|
export { makeAddInflectorsPlugin } from "./makeAddInflectorsPlugin.js";
|
|
4
|
-
export { makeAddPgTableConditionPlugin } from "./makeAddPgTableConditionPlugin.js";
|
|
5
|
-
export { makeAddPgTableOrderByPlugin, MakeAddPgTableOrderByPluginOrders, NullsSortMethod, orderByAscDesc, OrderByAscDescOptions, } from "./makeAddPgTableOrderByPlugin.js";
|
|
6
|
-
export { ChangeNullabilityRules, ChangeNullabilityTypeRules, makeChangeNullabilityPlugin, NullabilitySpec, NullabilitySpecString, } from "./makeChangeNullabilityPlugin.js";
|
|
7
|
-
export { EnumResolver, ExtensionDefinition, makeExtendSchemaPlugin,
|
|
8
|
-
export { makeJSONPgSmartTagsPlugin, makePgSmartTagsFromFilePlugin, makePgSmartTagsPlugin, TagsFilePlugin, } from "./makePgSmartTagsPlugin.js";
|
|
9
|
-
export { makeProcessSchemaPlugin } from "./makeProcessSchemaPlugin.js";
|
|
10
|
-
export { makeWrapPlansPlugin, PlanWrapperFilter, PlanWrapperFilterRule, PlanWrapperFn, PlanWrapperRule, PlanWrapperRules, PlanWrapperRulesGenerator, } from "./makeWrapPlansPlugin.js";
|
|
5
|
+
export { addPgTableCondition, makeAddPgTableConditionPlugin, } from "./makeAddPgTableConditionPlugin.js";
|
|
6
|
+
export { addPgTableOrderBy, makeAddPgTableOrderByPlugin, MakeAddPgTableOrderByPluginOrders, NullsSortMethod, orderByAscDesc, OrderByAscDescOptions, } from "./makeAddPgTableOrderByPlugin.js";
|
|
7
|
+
export { changeNullability, ChangeNullabilityRules, ChangeNullabilityTypeRules, makeChangeNullabilityPlugin, NullabilitySpec, NullabilitySpecString, } from "./makeChangeNullabilityPlugin.js";
|
|
8
|
+
export { EnumResolver, extendSchema, ExtensionDefinition, makeExtendSchemaPlugin, ObjectPlan, ObjectResolver, Plans, Resolvers, } from "./makeExtendSchemaPlugin.js";
|
|
9
|
+
export { jsonPgSmartTags, makeJSONPgSmartTagsPlugin, makePgSmartTagsFromFilePlugin, makePgSmartTagsPlugin, pgSmartTags, pgSmartTagsFromFile, TagsFilePlugin, } from "./makePgSmartTagsPlugin.js";
|
|
10
|
+
export { makeProcessSchemaPlugin, processSchema, } from "./makeProcessSchemaPlugin.js";
|
|
11
|
+
export { makeWrapPlansPlugin, PlanWrapperFilter, PlanWrapperFilterRule, PlanWrapperFn, PlanWrapperRule, PlanWrapperRules, PlanWrapperRulesGenerator, wrapPlans, } from "./makeWrapPlansPlugin.js";
|
|
12
|
+
declare module "grafast" {
|
|
13
|
+
interface ScalarPlan<TInternal = any, TExternal = any> {
|
|
14
|
+
scope?: GraphileBuild.ScopeScalar;
|
|
15
|
+
}
|
|
16
|
+
interface EnumPlan {
|
|
17
|
+
scope?: GraphileBuild.ScopeEnum;
|
|
18
|
+
}
|
|
19
|
+
interface EnumValueConfig {
|
|
20
|
+
scope?: Omit<GraphileBuild.ScopeEnumValuesValue, "valueName">;
|
|
21
|
+
}
|
|
22
|
+
interface ObjectPlan<TSource extends Step = Step> {
|
|
23
|
+
scope?: GraphileBuild.ScopeObject;
|
|
24
|
+
}
|
|
25
|
+
interface ObjectFieldConfig<TSource extends Step = Step, TArgs extends BaseGraphQLArguments = any, TResultStep extends Step = Step> {
|
|
26
|
+
scope?: Omit<GraphileBuild.ScopeObjectFieldsField, "fieldName">;
|
|
27
|
+
}
|
|
28
|
+
interface UnionPlan<TSpecifier = any, TSource extends Step = Step> {
|
|
29
|
+
scope?: GraphileBuild.ScopeUnion;
|
|
30
|
+
}
|
|
31
|
+
interface InterfacePlan<TSpecifier = any, TSource extends Step = Step> {
|
|
32
|
+
scope?: GraphileBuild.ScopeInterface;
|
|
33
|
+
fields?: {
|
|
34
|
+
[fieldName: string]: {
|
|
35
|
+
scope?: GraphileBuild.ScopeInterfaceFieldsField;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
interface InputObjectPlan {
|
|
40
|
+
scope?: GraphileBuild.ScopeInputObject;
|
|
41
|
+
}
|
|
42
|
+
interface InputObjectFieldConfig<TParent = any, TData = any> {
|
|
43
|
+
scope?: Omit<GraphileBuild.ScopeInputObjectFieldsField, "fieldName">;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
11
46
|
//# sourceMappingURL=index.d.ts.map
|
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,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,
|
|
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,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,IAAI;QAC9C,KAAK,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC;KACnC;IACD,UAAU,iBAAiB,CACzB,OAAO,SAAS,IAAI,GAAG,IAAI,EAC3B,KAAK,SAAS,oBAAoB,GAAG,GAAG,EACxC,WAAW,SAAS,IAAI,GAAG,IAAI;QAE/B,KAAK,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,sBAAsB,EAAE,WAAW,CAAC,CAAC;KACjE;IACD,UAAU,SAAS,CAAC,UAAU,GAAG,GAAG,EAAE,OAAO,SAAS,IAAI,GAAG,IAAI;QAC/D,KAAK,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC;KAClC;IACD,UAAU,aAAa,CAAC,UAAU,GAAG,GAAG,EAAE,OAAO,SAAS,IAAI,GAAG,IAAI;QACnE,KAAK,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC;QACrC,MAAM,CAAC,EAAE;YACP,CAAC,SAAS,EAAE,MAAM,GAAG;gBACnB,KAAK,CAAC,EAAE,aAAa,CAAC,yBAAyB,CAAC;aACjD,CAAC;SACH,CAAC;KACH;IACD,UAAU,eAAe;QACvB,KAAK,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC;KACxC;IACD,UAAU,sBAAsB,CAAC,OAAO,GAAG,GAAG,EAAE,KAAK,GAAG,GAAG;QACzD,KAAK,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,2BAA2B,EAAE,WAAW,CAAC,CAAC;KACtE;CACF"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
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.orderByAscDesc = exports.makeAddPgTableOrderByPlugin = exports.makeAddPgTableConditionPlugin = exports.makeAddInflectorsPlugin = exports.gql = exports.EXPORTABLE = void 0;
|
|
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
4
|
var exportable_js_1 = require("./exportable.js");
|
|
5
5
|
Object.defineProperty(exports, "EXPORTABLE", { enumerable: true, get: function () { return exportable_js_1.EXPORTABLE; } });
|
|
6
6
|
var gql_js_1 = require("./gql.js");
|
|
@@ -8,21 +8,31 @@ Object.defineProperty(exports, "gql", { enumerable: true, get: function () { ret
|
|
|
8
8
|
var makeAddInflectorsPlugin_js_1 = require("./makeAddInflectorsPlugin.js");
|
|
9
9
|
Object.defineProperty(exports, "makeAddInflectorsPlugin", { enumerable: true, get: function () { return makeAddInflectorsPlugin_js_1.makeAddInflectorsPlugin; } });
|
|
10
10
|
var makeAddPgTableConditionPlugin_js_1 = require("./makeAddPgTableConditionPlugin.js");
|
|
11
|
+
Object.defineProperty(exports, "addPgTableCondition", { enumerable: true, get: function () { return makeAddPgTableConditionPlugin_js_1.addPgTableCondition; } });
|
|
11
12
|
Object.defineProperty(exports, "makeAddPgTableConditionPlugin", { enumerable: true, get: function () { return makeAddPgTableConditionPlugin_js_1.makeAddPgTableConditionPlugin; } });
|
|
12
13
|
var makeAddPgTableOrderByPlugin_js_1 = require("./makeAddPgTableOrderByPlugin.js");
|
|
14
|
+
Object.defineProperty(exports, "addPgTableOrderBy", { enumerable: true, get: function () { return makeAddPgTableOrderByPlugin_js_1.addPgTableOrderBy; } });
|
|
13
15
|
Object.defineProperty(exports, "makeAddPgTableOrderByPlugin", { enumerable: true, get: function () { return makeAddPgTableOrderByPlugin_js_1.makeAddPgTableOrderByPlugin; } });
|
|
14
16
|
Object.defineProperty(exports, "orderByAscDesc", { enumerable: true, get: function () { return makeAddPgTableOrderByPlugin_js_1.orderByAscDesc; } });
|
|
15
17
|
var makeChangeNullabilityPlugin_js_1 = require("./makeChangeNullabilityPlugin.js");
|
|
18
|
+
Object.defineProperty(exports, "changeNullability", { enumerable: true, get: function () { return makeChangeNullabilityPlugin_js_1.changeNullability; } });
|
|
16
19
|
Object.defineProperty(exports, "makeChangeNullabilityPlugin", { enumerable: true, get: function () { return makeChangeNullabilityPlugin_js_1.makeChangeNullabilityPlugin; } });
|
|
17
20
|
var makeExtendSchemaPlugin_js_1 = require("./makeExtendSchemaPlugin.js");
|
|
21
|
+
Object.defineProperty(exports, "extendSchema", { enumerable: true, get: function () { return makeExtendSchemaPlugin_js_1.extendSchema; } });
|
|
18
22
|
Object.defineProperty(exports, "makeExtendSchemaPlugin", { enumerable: true, get: function () { return makeExtendSchemaPlugin_js_1.makeExtendSchemaPlugin; } });
|
|
19
23
|
var makePgSmartTagsPlugin_js_1 = require("./makePgSmartTagsPlugin.js");
|
|
24
|
+
Object.defineProperty(exports, "jsonPgSmartTags", { enumerable: true, get: function () { return makePgSmartTagsPlugin_js_1.jsonPgSmartTags; } });
|
|
20
25
|
Object.defineProperty(exports, "makeJSONPgSmartTagsPlugin", { enumerable: true, get: function () { return makePgSmartTagsPlugin_js_1.makeJSONPgSmartTagsPlugin; } });
|
|
21
26
|
Object.defineProperty(exports, "makePgSmartTagsFromFilePlugin", { enumerable: true, get: function () { return makePgSmartTagsPlugin_js_1.makePgSmartTagsFromFilePlugin; } });
|
|
22
27
|
Object.defineProperty(exports, "makePgSmartTagsPlugin", { enumerable: true, get: function () { return makePgSmartTagsPlugin_js_1.makePgSmartTagsPlugin; } });
|
|
28
|
+
Object.defineProperty(exports, "pgSmartTags", { enumerable: true, get: function () { return makePgSmartTagsPlugin_js_1.pgSmartTags; } });
|
|
29
|
+
Object.defineProperty(exports, "pgSmartTagsFromFile", { enumerable: true, get: function () { return makePgSmartTagsPlugin_js_1.pgSmartTagsFromFile; } });
|
|
23
30
|
Object.defineProperty(exports, "TagsFilePlugin", { enumerable: true, get: function () { return makePgSmartTagsPlugin_js_1.TagsFilePlugin; } });
|
|
24
31
|
var makeProcessSchemaPlugin_js_1 = require("./makeProcessSchemaPlugin.js");
|
|
25
32
|
Object.defineProperty(exports, "makeProcessSchemaPlugin", { enumerable: true, get: function () { return makeProcessSchemaPlugin_js_1.makeProcessSchemaPlugin; } });
|
|
33
|
+
Object.defineProperty(exports, "processSchema", { enumerable: true, get: function () { return makeProcessSchemaPlugin_js_1.processSchema; } });
|
|
26
34
|
var makeWrapPlansPlugin_js_1 = require("./makeWrapPlansPlugin.js");
|
|
27
35
|
Object.defineProperty(exports, "makeWrapPlansPlugin", { enumerable: true, get: function () { return makeWrapPlansPlugin_js_1.makeWrapPlansPlugin; } });
|
|
36
|
+
Object.defineProperty(exports, "wrapPlans", { enumerable: true, get: function () { return makeWrapPlansPlugin_js_1.wrapPlans; } });
|
|
37
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
28
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":";;;
|
|
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;AAE/B,mFAO0C;AANxC,mIAAA,iBAAiB,OAAA;AACjB,6IAAA,2BAA2B,OAAA;AAG3B,gIAAA,cAAc,OAAA;AAGhB,mFAO0C;AANxC,mIAAA,iBAAiB,OAAA;AAGjB,6IAAA,2BAA2B,OAAA;AAI7B,yEASqC;AAPnC,yHAAA,YAAY,OAAA;AAEZ,mIAAA,sBAAsB,OAAA;AAMxB,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;AAEf,mEASkC;AARhC,6HAAA,mBAAmB,OAAA;AAOnB,mHAAA,SAAS,OAAA;AA0CX,qDAAqD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeAddInflectorsPlugin =
|
|
3
|
+
exports.makeAddInflectorsPlugin = makeAddInflectorsPlugin;
|
|
4
4
|
/** @deprecated Build a plugin directly */
|
|
5
5
|
function makeAddInflectorsPlugin() {
|
|
6
6
|
throw new Error(`makeAddInflectorsPlugin is no longer supported; the new plugin system makes it a little easier to write it yourself:
|
|
@@ -29,7 +29,7 @@ export const MyInflectorPlugin: GraphileConfig.Plugin = {
|
|
|
29
29
|
...args
|
|
30
30
|
) {
|
|
31
31
|
if (name === "Query") return "RootQuery";
|
|
32
|
-
return previous
|
|
32
|
+
return previous(...args);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -38,5 +38,4 @@ export const MyInflectorPlugin: GraphileConfig.Plugin = {
|
|
|
38
38
|
|
|
39
39
|
`);
|
|
40
40
|
}
|
|
41
|
-
exports.makeAddInflectorsPlugin = makeAddInflectorsPlugin;
|
|
42
41
|
//# sourceMappingURL=makeAddInflectorsPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeAddInflectorsPlugin.js","sourceRoot":"","sources":["../src/makeAddInflectorsPlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"makeAddInflectorsPlugin.js","sourceRoot":"","sources":["../src/makeAddInflectorsPlugin.ts"],"names":[],"mappings":";;AACA,0DAmCC;AApCD,0CAA0C;AAC1C,SAAgB,uBAAuB;IACrC,MAAM,IAAI,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCjB,CAAC,CAAC;AACH,CAAC"}
|
|
@@ -1,14 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
1
|
+
import { sqlValueWithCodec } from "@dataplan/pg";
|
|
2
|
+
import type { GrafastInputFieldConfig } from "grafast";
|
|
3
3
|
import type { SQL, sql } from "pg-sql2";
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function addPgTableCondition(match: {
|
|
5
5
|
serviceName?: string;
|
|
6
6
|
schemaName: string;
|
|
7
7
|
tableName: string;
|
|
8
|
-
}, conditionFieldName: string, conditionFieldSpecGenerator: (build: GraphileBuild.Build) => GrafastInputFieldConfig
|
|
9
|
-
$condition: PgConditionStep<PgSelectStep>;
|
|
8
|
+
}, conditionFieldName: string, conditionFieldSpecGenerator: (build: GraphileBuild.Build) => GrafastInputFieldConfig, conditionGenerator?: (value: unknown, helpers: {
|
|
10
9
|
sql: typeof sql;
|
|
11
10
|
sqlTableAlias: SQL;
|
|
12
|
-
|
|
11
|
+
sqlValueWithCodec: typeof sqlValueWithCodec;
|
|
12
|
+
build: ReturnType<typeof pruneBuild>;
|
|
13
13
|
}) => SQL | null | undefined): GraphileConfig.Plugin;
|
|
14
|
+
/** @deprecated renamed to addPgTableCondition */
|
|
15
|
+
export declare const makeAddPgTableConditionPlugin: typeof addPgTableCondition;
|
|
16
|
+
declare function pruneBuild(build: GraphileBuild.Build): {
|
|
17
|
+
sql: import("pg-sql2").PgSQL<never>;
|
|
18
|
+
grafast: typeof import("grafast");
|
|
19
|
+
graphql: typeof import("graphql");
|
|
20
|
+
dataplanPg: typeof import("@dataplan/pg");
|
|
21
|
+
input: {
|
|
22
|
+
pgRegistry: import("@dataplan/pg").PgRegistry<Record<string, import("@dataplan/pg").PgCodec<string, {
|
|
23
|
+
[x: string]: import("@dataplan/pg").PgCodecAttribute<import("@dataplan/pg").PgCodec<string, /*elided*/ any | undefined, any, any, import("@dataplan/pg").PgCodec<string, any, any, any, any, any, any> | undefined, import("@dataplan/pg").PgCodec<string, any, any, any, any, any, any> | undefined, import("@dataplan/pg").PgCodec<string, undefined, any, any, undefined, any, undefined> | undefined>, boolean>;
|
|
24
|
+
} | undefined, any, any, any, any, any>>, Record<string, import("@dataplan/pg").PgResourceOptions<string, import("@dataplan/pg").PgCodecWithAttributes<{
|
|
25
|
+
[x: string]: import("@dataplan/pg").PgCodecAttribute<import("@dataplan/pg").PgCodec<string, /*elided*/ any | undefined, any, any, import("@dataplan/pg").PgCodec<string, any, any, any, any, any, any> | undefined, import("@dataplan/pg").PgCodec<string, any, any, any, any, any, any> | undefined, import("@dataplan/pg").PgCodec<string, undefined, any, any, undefined, any, undefined> | undefined>, boolean>;
|
|
26
|
+
}>, readonly import("@dataplan/pg").PgResourceUnique<{
|
|
27
|
+
[x: string]: import("@dataplan/pg").PgCodecAttribute<import("@dataplan/pg").PgCodec<string, /*elided*/ any | undefined, any, any, import("@dataplan/pg").PgCodec<string, any, any, any, any, any, any> | undefined, import("@dataplan/pg").PgCodec<string, any, any, any, any, any, any> | undefined, import("@dataplan/pg").PgCodec<string, undefined, any, any, undefined, any, undefined> | undefined>, boolean>;
|
|
28
|
+
}>[], readonly import("@dataplan/pg").PgResourceParameter<string | null, import("@dataplan/pg").PgCodec<string, {
|
|
29
|
+
[x: string]: import("@dataplan/pg").PgCodecAttribute<import("@dataplan/pg").PgCodec<string, /*elided*/ any | undefined, any, any, import("@dataplan/pg").PgCodec<string, any, any, any, any, any, any> | undefined, import("@dataplan/pg").PgCodec<string, any, any, any, any, any, any> | undefined, import("@dataplan/pg").PgCodec<string, undefined, any, any, undefined, any, undefined> | undefined>, boolean>;
|
|
30
|
+
} | undefined, any, any, import("@dataplan/pg").PgCodec<string, any, any, any, any, any, any> | undefined, import("@dataplan/pg").PgCodec<string, any, any, any, any, any, any> | undefined, import("@dataplan/pg").PgCodec<string, undefined, any, any, undefined, any, undefined> | undefined>>[] | undefined>>, Record<string, Record<string, import("@dataplan/pg").PgCodecRelationConfig<import("@dataplan/pg").PgCodec<string, {
|
|
31
|
+
[x: string]: import("@dataplan/pg").PgCodecAttribute<import("@dataplan/pg").PgCodec<string, /*elided*/ any | undefined, any, any, import("@dataplan/pg").PgCodec<string, any, any, any, any, any, any> | undefined, import("@dataplan/pg").PgCodec<string, any, any, any, any, any, any> | undefined, import("@dataplan/pg").PgCodec<string, undefined, any, any, undefined, any, undefined> | undefined>, boolean>;
|
|
32
|
+
}, any, any, undefined, any, undefined>, import("@dataplan/pg").PgResourceOptions<any, import("@dataplan/pg").PgCodecWithAttributes<{
|
|
33
|
+
[x: string]: import("@dataplan/pg").PgCodecAttribute<import("@dataplan/pg").PgCodec<string, /*elided*/ any | undefined, any, any, import("@dataplan/pg").PgCodec<string, any, any, any, any, any, any> | undefined, import("@dataplan/pg").PgCodec<string, any, any, any, any, any, any> | undefined, import("@dataplan/pg").PgCodec<string, undefined, any, any, undefined, any, undefined> | undefined>, boolean>;
|
|
34
|
+
}>, any, any>>>>, {
|
|
35
|
+
[executorName: string]: import("@dataplan/pg").PgExecutor<any, any>;
|
|
36
|
+
}>;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export {};
|
|
14
40
|
//# sourceMappingURL=makeAddPgTableConditionPlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeAddPgTableConditionPlugin.d.ts","sourceRoot":"","sources":["../src/makeAddPgTableConditionPlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"makeAddPgTableConditionPlugin.d.ts","sourceRoot":"","sources":["../src/makeAddPgTableConditionPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAIxC,wBAAgB,mBAAmB,CACjC,KAAK,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EACtE,kBAAkB,EAAE,MAAM,EAC1B,2BAA2B,EAAE,CAC3B,KAAK,EAAE,aAAa,CAAC,KAAK,KACvB,uBAAuB,EAE5B,kBAAkB,CAAC,EAAE,CACnB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE;IACP,GAAG,EAAE,OAAO,GAAG,CAAC;IAChB,aAAa,EAAE,GAAG,CAAC;IACnB,iBAAiB,EAAE,OAAO,iBAAiB,CAAC;IAG5C,KAAK,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;CAGtC,KACE,GAAG,GAAG,IAAI,GAAG,SAAS,GAC1B,cAAc,CAAC,MAAM,CAqGvB;AAED,iDAAiD;AACjD,eAAO,MAAM,6BAA6B,4BAAsB,CAAC;AAEjE,iBAAS,UAAU,CAAC,KAAK,EAAE,aAAa,CAAC,KAAK;;;;;;;;;;;;;;;;;;;;;;EAkB7C"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeAddPgTableConditionPlugin = void 0;
|
|
4
|
+
exports.addPgTableCondition = addPgTableCondition;
|
|
5
|
+
const pg_1 = require("@dataplan/pg");
|
|
4
6
|
const exportable_js_1 = require("./exportable.js");
|
|
5
|
-
function
|
|
7
|
+
function addPgTableCondition(match, conditionFieldName, conditionFieldSpecGenerator,
|
|
8
|
+
// DEPRECATED! Use `apply` instead.
|
|
9
|
+
conditionGenerator) {
|
|
6
10
|
const { serviceName = "main", schemaName, tableName } = match;
|
|
7
11
|
const displayName = `makeAddPgTableConditionPlugin__${schemaName}__${tableName}__${conditionFieldName}`;
|
|
8
12
|
const plugin = {
|
|
@@ -39,10 +43,10 @@ function makeAddPgTableConditionPlugin(match, conditionFieldName, conditionField
|
|
|
39
43
|
return fields;
|
|
40
44
|
}
|
|
41
45
|
const conditionFieldSpec = conditionFieldSpecGenerator(build);
|
|
42
|
-
if (conditionFieldSpec.
|
|
43
|
-
conditionFieldSpec.extensions?.grafast?.
|
|
46
|
+
if (conditionFieldSpec.apply ||
|
|
47
|
+
conditionFieldSpec.extensions?.grafast?.apply) {
|
|
44
48
|
if (conditionGenerator) {
|
|
45
|
-
throw new Error(`${displayName}: You supplied '
|
|
49
|
+
throw new Error(`${displayName}: You supplied 'apply' for your field spec, so you cannot also supply a 'conditionGenerator'`);
|
|
46
50
|
}
|
|
47
51
|
// Done.
|
|
48
52
|
}
|
|
@@ -51,17 +55,19 @@ function makeAddPgTableConditionPlugin(match, conditionFieldName, conditionField
|
|
|
51
55
|
throw new Error(`${displayName}: You have not supplied 'applyPlan' for your field spec, nor a 'conditionGenerator', so we don't know what to do with this condition`);
|
|
52
56
|
}
|
|
53
57
|
// build applyPlan
|
|
54
|
-
|
|
58
|
+
const _build = pruneBuild(build);
|
|
59
|
+
conditionFieldSpec.apply = (0, exportable_js_1.EXPORTABLE)((_build, conditionGenerator, sql, sqlValueWithCodec) => function apply(condition, val) {
|
|
55
60
|
const expression = conditionGenerator(val, {
|
|
56
|
-
$condition,
|
|
57
61
|
sql,
|
|
58
|
-
sqlTableAlias:
|
|
59
|
-
|
|
62
|
+
sqlTableAlias: condition.alias,
|
|
63
|
+
sqlValueWithCodec,
|
|
64
|
+
build: _build,
|
|
65
|
+
condition,
|
|
60
66
|
});
|
|
61
67
|
if (expression) {
|
|
62
|
-
|
|
68
|
+
condition.where(expression);
|
|
63
69
|
}
|
|
64
|
-
}, [
|
|
70
|
+
}, [_build, conditionGenerator, sql, pg_1.sqlValueWithCodec], "addPgTableCondition_generator");
|
|
65
71
|
}
|
|
66
72
|
const meta = build._pluginMeta[displayName];
|
|
67
73
|
meta.seen = true;
|
|
@@ -76,5 +82,16 @@ function makeAddPgTableConditionPlugin(match, conditionFieldName, conditionField
|
|
|
76
82
|
};
|
|
77
83
|
return plugin;
|
|
78
84
|
}
|
|
79
|
-
|
|
85
|
+
/** @deprecated renamed to addPgTableCondition */
|
|
86
|
+
exports.makeAddPgTableConditionPlugin = addPgTableCondition;
|
|
87
|
+
function pruneBuild(build) {
|
|
88
|
+
const { sql, grafast, graphql, dataplanPg, input: { pgRegistry }, } = build;
|
|
89
|
+
return (0, exportable_js_1.EXPORTABLE)((dataplanPg, grafast, graphql, pgRegistry, sql) => ({
|
|
90
|
+
sql,
|
|
91
|
+
grafast,
|
|
92
|
+
graphql,
|
|
93
|
+
dataplanPg,
|
|
94
|
+
input: { pgRegistry },
|
|
95
|
+
}), [dataplanPg, grafast, graphql, pgRegistry, sql]);
|
|
96
|
+
}
|
|
80
97
|
//# sourceMappingURL=makeAddPgTableConditionPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeAddPgTableConditionPlugin.js","sourceRoot":"","sources":["../src/makeAddPgTableConditionPlugin.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"makeAddPgTableConditionPlugin.js","sourceRoot":"","sources":["../src/makeAddPgTableConditionPlugin.ts"],"names":[],"mappings":";;;AAOA,kDAyHC;AA/HD,qCAAiD;AAIjD,mDAA6C;AAE7C,SAAgB,mBAAmB,CACjC,KAAsE,EACtE,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