@pothos/selection-mapper 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/.swcrc +10 -0
  2. package/LICENSE +6 -0
  3. package/README.md +92 -0
  4. package/dts/adapter.d.ts +74 -0
  5. package/dts/adapter.d.ts.map +1 -0
  6. package/dts/deep-equal.d.ts +7 -0
  7. package/dts/deep-equal.d.ts.map +1 -0
  8. package/dts/index.d.ts +13 -0
  9. package/dts/index.d.ts.map +1 -0
  10. package/dts/loader-map.d.ts +63 -0
  11. package/dts/loader-map.d.ts.map +1 -0
  12. package/dts/matches.d.ts +113 -0
  13. package/dts/matches.d.ts.map +1 -0
  14. package/dts/node.d.ts +85 -0
  15. package/dts/node.d.ts.map +1 -0
  16. package/dts/plan.d.ts +176 -0
  17. package/dts/plan.d.ts.map +1 -0
  18. package/dts/types.d.ts +97 -0
  19. package/dts/types.d.ts.map +1 -0
  20. package/dts/walk.d.ts +24 -0
  21. package/dts/walk.d.ts.map +1 -0
  22. package/esm/adapter.d.ts +74 -0
  23. package/esm/adapter.d.ts.map +1 -0
  24. package/esm/adapter.js +47 -0
  25. package/esm/adapter.js.map +1 -0
  26. package/esm/deep-equal.d.ts +7 -0
  27. package/esm/deep-equal.d.ts.map +1 -0
  28. package/esm/deep-equal.js +50 -0
  29. package/esm/deep-equal.js.map +1 -0
  30. package/esm/index.d.ts +13 -0
  31. package/esm/index.d.ts.map +1 -0
  32. package/esm/index.js +12 -0
  33. package/esm/index.js.map +1 -0
  34. package/esm/loader-map.d.ts +63 -0
  35. package/esm/loader-map.d.ts.map +1 -0
  36. package/esm/loader-map.js +197 -0
  37. package/esm/loader-map.js.map +1 -0
  38. package/esm/matches.d.ts +113 -0
  39. package/esm/matches.d.ts.map +1 -0
  40. package/esm/matches.js +419 -0
  41. package/esm/matches.js.map +1 -0
  42. package/esm/node.d.ts +85 -0
  43. package/esm/node.d.ts.map +1 -0
  44. package/esm/node.js +232 -0
  45. package/esm/node.js.map +1 -0
  46. package/esm/package.json +3 -0
  47. package/esm/plan.d.ts +176 -0
  48. package/esm/plan.d.ts.map +1 -0
  49. package/esm/plan.js +339 -0
  50. package/esm/plan.js.map +1 -0
  51. package/esm/types.d.ts +97 -0
  52. package/esm/types.d.ts.map +1 -0
  53. package/esm/types.js +10 -0
  54. package/esm/types.js.map +1 -0
  55. package/esm/walk.d.ts +24 -0
  56. package/esm/walk.d.ts.map +1 -0
  57. package/esm/walk.js +442 -0
  58. package/esm/walk.js.map +1 -0
  59. package/lib/adapter.js +43 -0
  60. package/lib/adapter.js.map +1 -0
  61. package/lib/deep-equal.js +60 -0
  62. package/lib/deep-equal.js.map +1 -0
  63. package/lib/index.js +57 -0
  64. package/lib/index.js.map +1 -0
  65. package/lib/loader-map.js +209 -0
  66. package/lib/loader-map.js.map +1 -0
  67. package/lib/matches.js +427 -0
  68. package/lib/matches.js.map +1 -0
  69. package/lib/node.js +245 -0
  70. package/lib/node.js.map +1 -0
  71. package/lib/plan.js +349 -0
  72. package/lib/plan.js.map +1 -0
  73. package/lib/types.js +9 -0
  74. package/lib/types.js.map +1 -0
  75. package/lib/walk.js +455 -0
  76. package/lib/walk.js.map +1 -0
  77. package/package.json +55 -0
  78. package/src/adapter.ts +96 -0
  79. package/src/deep-equal.ts +67 -0
  80. package/src/index.ts +32 -0
  81. package/src/loader-map.ts +287 -0
  82. package/src/matches.ts +681 -0
  83. package/src/node.ts +327 -0
  84. package/src/plan.ts +454 -0
  85. package/src/types.ts +123 -0
  86. package/src/walk.ts +696 -0
package/esm/plan.js ADDED
@@ -0,0 +1,339 @@
1
+ /**
2
+ * One root being planned: the two entry points that build one from a resolver's `info`, the
3
+ * merges a traversal collected for it, and the fold that turns those merges into a node.
4
+ *
5
+ * A plan holds no node — playing it builds one — so the same plan can be played more than once,
6
+ * behind a different seed each time. Playing is where a merge is accepted or rejected and the
7
+ * only place a mapping is recorded; the traversal decides nothing, so a field that lost to
8
+ * another occurrence of itself is still on the list and a play whose seed makes it fit takes it.
9
+ */ import { PothosValidationError } from '@pothos/core';
10
+ import { getNamedType } from 'graphql';
11
+ import { setLoaderMappings, unionMappings } from './loader-map.js';
12
+ import { findMatches, includeOf, matchesForModel, modelOf, resolveType } from './matches.js';
13
+ import { walkBranches, walkField } from './walk.js';
14
+ // Shared, since neither carries anything per merge.
15
+ const AS_QUERY = Object.freeze({
16
+ asQuery: true
17
+ });
18
+ const LENIENT = Object.freeze({
19
+ lenient: true
20
+ });
21
+ export class Plan {
22
+ adapter;
23
+ position;
24
+ initial;
25
+ context;
26
+ info;
27
+ skipDeferredFragments;
28
+ /** What the plan loads. A node is created for it once per play. */ model;
29
+ /**
30
+ * The merges waiting on a user callback that returned a promise, in the order they were
31
+ * appended. Absent until the first one: a synchronous plan never creates a promise.
32
+ */ pending;
33
+ /** The traversal's whole output: every merge it collected, in the order it collected them. */ merges = [];
34
+ /**
35
+ * The play `settle` ran, which a later play takes whole when the seed conflicts with none of
36
+ * it. Never handed out: a play that reuses it copies it into a node of its own.
37
+ */ played;
38
+ /**
39
+ * The plan for the field `info` resolves, settled, or undefined when paths are given and
40
+ * nothing is selected under them. Declared synchronous: the result is a promise only when a
41
+ * select function returned one, and must then be awaited. The plan is handed out rather than
42
+ * played, so a plugin that owes a resolver a synchronous query builder settles this first and
43
+ * plays it behind the resolver's own selection with `plan.query(select)`.
44
+ */ static fromInfo(adapter, options) {
45
+ const { info, typeName, path, paths } = options;
46
+ const returnType = getNamedType(info.returnType);
47
+ const target = typeName ? info.schema.getType(typeName) : returnType;
48
+ // graphql merges every occurrence of the field's response key into `info.fieldNodes`; each is
49
+ // planned into the one root, so the query answers whichever occurrence a resolver runs for.
50
+ let rootType = target;
51
+ let branches;
52
+ if (paths?.length || path?.length) {
53
+ const includePaths = normalizePaths(paths?.length ? paths : [
54
+ path
55
+ ]);
56
+ const prefix = includeOf(returnType)?.path;
57
+ const found = info.fieldNodes.flatMap((fieldNode)=>findMatches(info, returnType, fieldNode, includePaths, {
58
+ prefix
59
+ }));
60
+ if (found.length === 0) {
61
+ return undefined;
62
+ }
63
+ // Matches are filtered against the model the root loads, which is the first match's own
64
+ // when no `typeName` names it: the return type is then a wrapper with no model, and
65
+ // filtering by it would keep every match whatever model it returns.
66
+ rootType = typeName ? target : found[0].type;
67
+ const matches = matchesForModel(adapter, info.schema, found, rootType);
68
+ // Every match is planned into the one root, entered under its own type first.
69
+ branches = matches.map((match)=>({
70
+ // A matched type with its own model (including variants of the target model) is walked
71
+ // with its own model. Types without a model (interfaces, wrappers) are walked as the
72
+ // requested type so its fields can be found.
73
+ type: typeName && !modelOf(adapter, info.schema, match.type) ? target : match.type,
74
+ fieldNodes: [
75
+ match.field
76
+ ],
77
+ indirectPath: match.path,
78
+ deferred: match.deferred
79
+ }));
80
+ } else {
81
+ branches = [
82
+ {
83
+ type: target,
84
+ fieldNodes: info.fieldNodes,
85
+ indirectPath: [],
86
+ deferred: false
87
+ }
88
+ ];
89
+ }
90
+ const plan = new Plan(adapter, options, rootType, positionForResolvedField(info), options.initial);
91
+ try {
92
+ walkBranches(plan, branches);
93
+ } catch (error) {
94
+ plan.abandon();
95
+ throw error;
96
+ }
97
+ return plan.finish(plan.settle);
98
+ }
99
+ /**
100
+ * The plan loading the field `info` resolves for its parent row, played. The loaded row
101
+ * replaces the parent the field resolver sees, so besides the field's own selection it
102
+ * carries the parent type's type-level selection. The field is what the row is loaded for, so
103
+ * it is merged first and a type-level relation whose arguments conflict with it is left out.
104
+ */ static forParentRow(adapter, context, info, skipDeferredFragments) {
105
+ const type = info.parentType;
106
+ const plan = new Plan(adapter, {
107
+ context,
108
+ info,
109
+ skipDeferredFragments
110
+ }, type);
111
+ try {
112
+ // Every node selecting the field (one per fragment it appears under) plans into the same
113
+ // row, so the loaded row satisfies each of them.
114
+ for (const fieldNode of info.fieldNodes){
115
+ walkField(plan, type, fieldNode, []);
116
+ }
117
+ } catch (error) {
118
+ plan.abandon();
119
+ throw error;
120
+ }
121
+ return plan.finish(plan.enterParentType, type);
122
+ }
123
+ /**
124
+ * `source` is an entry point's options for a root plan and the parent plan for a nested one,
125
+ * which is why `initial` is passed beside it: it belongs to the root alone and a nested plan
126
+ * must never inherit one. `position` is where the field this plan hangs beneath is, undefined
127
+ * when there is no field above the plan.
128
+ */ constructor(adapter, source, type, position, /** Merged first by a play a caller gives no seed of its own. */ initial){
129
+ this.adapter = adapter;
130
+ this.position = position;
131
+ this.initial = initial;
132
+ this.context = source.context;
133
+ this.info = source.info;
134
+ this.skipDeferredFragments = source.skipDeferredFragments ?? adapter.skipDeferredFragments;
135
+ const model = modelOf(adapter, source.info.schema, type);
136
+ if (!model) {
137
+ throw new PothosValidationError(`Expected ${resolveType(source.info.schema, type).name} to have a model`);
138
+ }
139
+ // Not entered: a type is entered when its selection set is walked.
140
+ this.model = model;
141
+ }
142
+ /**
143
+ * The plan beneath one nested selection: this plan's adapter, context, info and deferred
144
+ * setting, with merges of its own. It hangs beneath the field whose select function made it.
145
+ */ nested(type, position) {
146
+ return new Plan(this.adapter, this, type, position);
147
+ }
148
+ /** Appends one merge to the list a play folds. The traversal's only way to add to a plan. */ collect(merge) {
149
+ this.merges.push(merge);
150
+ }
151
+ /**
152
+ * The relation query of the nested selection this plan was made for. It takes the head of the
153
+ * list, so it is merged before the fields walked beneath it whether the callback that produced
154
+ * it answered at once or resolved after the walk. A nested plan has at most one.
155
+ */ collectQuery(query) {
156
+ this.merges.unshift({
157
+ kind: 'query',
158
+ query
159
+ });
160
+ }
161
+ /**
162
+ * Appends the merge of `value` to the plan's pending chain. Only merges are chained, never user
163
+ * code, so a link can never append another and the chain needs no loop. Each link waits on the
164
+ * previous one, so async merges run in the order they were appended. Both promises get a
165
+ * handler at once, so a callback that rejects early is never an unhandled rejection.
166
+ */ chain(value, merge) {
167
+ const prev = this.pending;
168
+ this.pending = prev ? Promise.all([
169
+ prev,
170
+ value
171
+ ]).then(([, v])=>merge(v)) : Promise.resolve(value).then(merge);
172
+ }
173
+ /**
174
+ * A plan that threw synchronously never reaches `finish`, so the merges it had already chained
175
+ * would reject unobserved once their callbacks settle. The throw is what the caller sees.
176
+ */ abandon() {
177
+ this.pending?.catch(noop);
178
+ }
179
+ finish(done, arg) {
180
+ return this.pending ? this.pending.then(()=>done.call(this, arg)) : done.call(this, arg);
181
+ }
182
+ /**
183
+ * A fresh node with this plan's merges folded into it, and the mappings of the merges it took.
184
+ * `seed` takes the place of the plan's own `initial`: it is merged before anything the traversal
185
+ * collected, so a relation or computed value the document plans with other arguments loses, and
186
+ * its field falls back to loading on its own.
187
+ *
188
+ * Synchronous, and runs no user callback, so a play of an async plan costs no more than a play
189
+ * of a synchronous one.
190
+ */ play(seed) {
191
+ const { adapter } = this;
192
+ const root = adapter.createNode(this.model);
193
+ const settled = this.reusable(seed);
194
+ // Merged before anything else, so on a conflict it wins. A settled play already holds the
195
+ // plan's own `initial`, so reusing one merges the seed and nothing else: `mergeQuery` is not
196
+ // required to be idempotent.
197
+ const first = settled ? seed : seed ?? this.initial;
198
+ if (first) {
199
+ adapter.mergeQuery(root, first);
200
+ }
201
+ if (settled) {
202
+ // Every merge that play took still fits and every merge it left out still does not, so
203
+ // the node it built is taken whole.
204
+ adapter.mergeNode(root, settled.root);
205
+ return {
206
+ plan: this,
207
+ root,
208
+ mappings: settled.mappings
209
+ };
210
+ }
211
+ const mappings = {};
212
+ for (const merge of this.merges){
213
+ switch(merge.kind){
214
+ case 'type':
215
+ adapter.mergeQuery(root, merge.query);
216
+ break;
217
+ case 'query':
218
+ adapter.mergeQuery(root, merge.query, AS_QUERY);
219
+ break;
220
+ case 'variant':
221
+ this.mergeVariant(root, merge.type, merge.variant, merge.query);
222
+ break;
223
+ case 'field':
224
+ {
225
+ // One options object for the pair: `mergeQuery` reads only the alias, and
226
+ // `canMergeQuery` only the `ignoreArgs` beside it.
227
+ const options = {
228
+ ignoreArgs: true,
229
+ alias: merge.alias
230
+ };
231
+ // A field's selection is merged, and its mapping recorded, only while it fits what is
232
+ // already in the node; otherwise it is left out and its resolver loads its own data.
233
+ if (adapter.canMergeQuery(root, merge.query, options)) {
234
+ adapter.mergeQuery(root, merge.query, options);
235
+ mappings[merge.key] = unionMappings(mappings[merge.key], merge.mapping);
236
+ }
237
+ break;
238
+ }
239
+ default:
240
+ {
241
+ const unknown = merge;
242
+ throw new PothosValidationError(`Unknown root merge ${String(unknown.kind)}`);
243
+ }
244
+ }
245
+ }
246
+ return {
247
+ plan: this,
248
+ root,
249
+ mappings
250
+ };
251
+ }
252
+ /**
253
+ * The plan played behind `seed`, its mappings recorded for the resolvers beneath it, and its
254
+ * node serialized. A cached plan accepts the current resolver info to scope each execution.
255
+ * Every play records its mappings on the request context; an adapter whose
256
+ * resolvers read a loaded row another way simply never looks them up.
257
+ */ query(seed, info = this.info) {
258
+ // With no seed, a settled play's node is what a fresh play would build, so hand it straight
259
+ // over: `toQuery` does not mutate, and a later seeded play still merges from it.
260
+ const { root, mappings } = seed === undefined && this.played ? this.played : this.play(seed);
261
+ setLoaderMappings(this.context, info, mappings);
262
+ return this.adapter.toQuery(root);
263
+ }
264
+ /**
265
+ * The plan played once, so a play-time error — a conflict between two type-level selections —
266
+ * is raised now rather than only inside a `query()` a resolver may never call. That play is
267
+ * kept, and a later one whose seed conflicts with none of it takes it whole, so settling costs
268
+ * the resolver's own play nothing.
269
+ */ settle() {
270
+ this.played = this.play();
271
+ return this;
272
+ }
273
+ /**
274
+ * The plan played, with `type`'s type-level selection merged in behind it, minus what conflicts
275
+ * with the field the row is loaded for. A parent-row plan is never replayed behind a caller's
276
+ * selection, so it plays once, here.
277
+ */ enterParentType(type) {
278
+ const played = this.play();
279
+ const selection = this.adapter.typeSelection(type);
280
+ if (selection) {
281
+ this.adapter.mergeQuery(played.root, selection, LENIENT);
282
+ }
283
+ return played;
284
+ }
285
+ /**
286
+ * A settled play that a play seeded with `seed` can take whole, or undefined. A seed conflicting
287
+ * with nothing the settled play holds changes no decision it made, since every rejection was
288
+ * against something the seed leaves in place — unless the seed stands in for the plan's own
289
+ * `initial`, which the settled play already merged.
290
+ */ reusable(seed) {
291
+ if (!this.played || seed !== undefined && this.initial !== undefined) {
292
+ return undefined;
293
+ }
294
+ return seed === undefined || !this.adapter.firstConflict(this.played.root, seed) ? this.played : undefined;
295
+ }
296
+ /**
297
+ * Unlike a field-level select, a type-level selection has no per-field fallback, so a relation
298
+ * argument or a computed value that conflicts with what is already in the node is an error
299
+ * rather than a rejection.
300
+ */ mergeVariant(node, type, variant, selection) {
301
+ const conflict = this.adapter.firstConflict(node, selection);
302
+ if (conflict) {
303
+ switch(conflict.kind){
304
+ case 'relation':
305
+ throw new PothosValidationError(`Type-level selections of ${type.name} and ${variant.name} conflict on relation "${conflict.name}". Move the relation arguments to a field-level select on one of the types.`);
306
+ case 'extra':
307
+ throw new PothosValidationError(`Type-level selections of ${type.name} and ${variant.name} conflict on extra "${conflict.name}". Define the extra with the same function on both types, or move it to a field-level select on one of the types.`);
308
+ default:
309
+ {
310
+ const unknown = conflict.kind;
311
+ throw new PothosValidationError(`Unknown type-level conflict ${unknown}`);
312
+ }
313
+ }
314
+ }
315
+ this.adapter.mergeQuery(node, selection);
316
+ }
317
+ }
318
+ /**
319
+ * Where the field being resolved is, which every position beneath it links back to, so a select
320
+ * function can tell where in the query its field sits. Undefined when `info` does not name the
321
+ * field it resolves (a caller building one by hand): the plan then starts at its own fields.
322
+ */ function positionForResolvedField(info) {
323
+ const node = info.fieldNodes[0];
324
+ const field = info.parentType?.getFields()[node.name.value];
325
+ return field && {
326
+ parent: undefined,
327
+ type: info.parentType,
328
+ field,
329
+ node
330
+ };
331
+ }
332
+ function normalizePaths(paths) {
333
+ return paths.map((path)=>path.map((segment)=>typeof segment === 'string' ? {
334
+ name: segment
335
+ } : segment));
336
+ }
337
+ function noop() {}
338
+
339
+ //# sourceMappingURL=plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plan.ts"],"names":["PothosValidationError","getNamedType","setLoaderMappings","unionMappings","findMatches","includeOf","matchesForModel","modelOf","resolveType","walkBranches","walkField","AS_QUERY","Object","freeze","asQuery","LENIENT","lenient","Plan","context","info","skipDeferredFragments","model","pending","merges","played","fromInfo","adapter","options","typeName","path","paths","returnType","target","schema","getType","rootType","branches","length","includePaths","normalizePaths","prefix","found","fieldNodes","flatMap","fieldNode","undefined","type","matches","map","match","field","indirectPath","deferred","plan","positionForResolvedField","initial","error","abandon","finish","settle","forParentRow","parentType","enterParentType","source","position","name","nested","collect","merge","push","collectQuery","query","unshift","kind","chain","value","prev","Promise","all","then","v","resolve","catch","noop","done","arg","call","play","seed","root","createNode","settled","reusable","first","mergeQuery","mergeNode","mappings","mergeVariant","variant","ignoreArgs","alias","canMergeQuery","key","mapping","unknown","String","toQuery","selection","typeSelection","firstConflict","node","conflict","getFields","parent","segment"],"mappings":"AAAA;;;;;;;;CAQC,GACD,SAASA,qBAAqB,QAAQ,eAAe;AACrD,SAAyDC,YAAY,QAAQ,UAAU;AAEvF,SAAsCC,iBAAiB,EAAEC,aAAa,QAAQ,kBAAkB;AAChG,SACEC,WAAW,EAEXC,SAAS,EACTC,eAAe,EACfC,OAAO,EAEPC,WAAW,QACN,eAAe;AAGtB,SAAsBC,YAAY,EAAEC,SAAS,QAAQ,YAAY;AAEjE,oDAAoD;AACpD,MAAMC,WAAyBC,OAAOC,MAAM,CAAC;IAAEC,SAAS;AAAK;AAC7D,MAAMC,UAAwBH,OAAOC,MAAM,CAAC;IAAEG,SAAS;AAAK;AAwC5D,OAAO,MAAMC;;;;IACFC,QAAgB;IAChBC,KAAyB;IACzBC,sBAA+B;IACxC,iEAAiE,GACjE,AAASC,MAAa;IAEtB;;;GAGC,GACDC,QAAwB;IAExB,4FAA4F,GAC5F,AAAiBC,SAA6B,EAAE,CAAC;IAEjD;;;GAGC,GACD,AAAQC,OAA4C;IAEpD;;;;;;GAMC,GACD,OAAOC,SACLC,OAAwC,EACxCC,OAA4B,EACc;QAC1C,MAAM,EAAER,IAAI,EAAES,QAA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AAI,CAACrF,OAAO,CAACmF,aAAa,CAACC,MAAMH;QAElD,IAAII,UAAU;YACZ,OAAQA,SAAStC,IAAI;gBACnB,KAAK;oBACH,MAAM,IAAIzE,sBACR,CAAC,yBAAyB,EAAE8C,KAAKmB,IAAI,CAAC,KAAK,EAAEiC,QAAQjC,IAAI,CAAC,uBAAuB,EAAE8C,SAAS9C,IAAI,CAAC,2EAA2E,CAAC;gBAEjL,KAAK;oBACH,MAAM,IAAIjE,sBACR,CAAC,yBAAyB,EAAE8C,KAAKmB,IAAI,CAAC,KAAK,EAAEiC,QAAQjC,IAAI,CAAC,oBAAoB,EAAE8C,SAAS9C,IAAI,CAAC,iHAAiH,CAAC;gBAEpN;oBAAS;wBACP,MAAMuC,UAAiBO,SAAStC,IAAI;wBAEpC,MAAM,IAAIzE,sBAAsB,CAAC,4BAA4B,EAAEwG,SAAmB;oBACpF;YACF;QACF;QAEA,IAAI,CAAC9E,OAAO,CAACoE,UAAU,CAACgB,MAAMH;IAChC;AACF;AAEA;;;;CAIC,GACD,SAASrD,yBAAyBnC,IAAwB;IACxD,MAAM2F,OAAO3F,KAAKuB,UAAU,CAAC,EAAE;IAC/B,MAAMQ,QAAQ/B,KAAK0C,UAAU,EAAEmD,WAAW,CAACF,KAAK7C,IAAI,CAACU,KAAK,CAAC;IAE3D,OAAOzB,SAAS;QAAE+D,QAAQpE;QAAWC,MAAM3B,KAAK0C,UAAU;QAAEX;QAAO4D;IAAK;AAC1E;AAEA,SAASvE,eAAeT,KAAsB;IAC5C,OAAOA,MAAMkB,GAAG,CAAC,CAACnB,OAChBA,KAAKmB,GAAG,CAAC,CAACkE,UAAa,OAAOA,YAAY,WAAW;gBAAEjD,MAAMiD;YAAQ,IAAIA;AAE7E;AAEA,SAAS/B,QAAQ"}
package/esm/types.d.ts ADDED
@@ -0,0 +1,97 @@
1
+ /**
2
+ * The types the adapter contract and the entry points mention: where a field is, what a select
3
+ * function is handed, what an entry point takes, and how one merge differs from a plain one.
4
+ */
5
+ import type { MaybePromise } from '@pothos/core';
6
+ import type { FieldNode, GraphQLField, GraphQLInterfaceType, GraphQLObjectType, GraphQLResolveInfo } from 'graphql';
7
+ import type { IndirectInclude, PathSegment } from './matches.js';
8
+ export type WalkedType = GraphQLInterfaceType | GraphQLObjectType;
9
+ /**
10
+ * Where a field is. One link of a chain running from the field an entry point was called for down
11
+ * to the field being planned: the field's node in the document, the type it was found on, and the
12
+ * position of the field the plan it was found in hangs beneath.
13
+ *
14
+ * The walker builds one per select invocation and reads none of it, so a caller that wants a path
15
+ * or a name walks `parent` itself and materializes what it needs. A plan whose fields nothing asks
16
+ * about costs one link per select function and no arrays at all.
17
+ */
18
+ export interface Position {
19
+ /** The field this one is selected beneath, or undefined at the field the plan started from. */
20
+ readonly parent: Position | undefined;
21
+ /** The type the field was walked on: its parent type, or a same-model type the plan moved to. */
22
+ readonly type: WalkedType;
23
+ readonly field: GraphQLField<unknown, unknown>;
24
+ /** The field's node in the document, which carries its alias and arguments. */
25
+ readonly node: FieldNode;
26
+ }
27
+ /** A relation query: a query, or a callback building one from the field's arguments. */
28
+ export type NestedQuery<Query> = MaybePromise<Query | null | undefined> | ((args: object, ctx: object, position: Position) => MaybePromise<Query | null | undefined>);
29
+ /**
30
+ * The callback handed to a field's select function to plan the selection beneath the field:
31
+ * `query` is merged first (a function is called with the field's args, `true` means no query),
32
+ * then the selection found under `path` (an explicit include, or a string path from the field's
33
+ * return type) is walked as `type` (or the field's return type). Declared synchronous: the result
34
+ * is a promise only when a callback beneath it returned one, and must then be awaited.
35
+ */
36
+ export type NestedSelection<Query> = (query?: NestedQuery<Query> | true, path?: PathSegment[] | IndirectInclude, type?: string) => Query;
37
+ /** Inspect fields beneath the current selection, through fragments and wrappers. */
38
+ export interface SelectedFieldNode {
39
+ /** Lazily collect selected schema field names; aliases do not change the names. */
40
+ (): ReadonlySet<string>;
41
+ (path: string[]): FieldNode | null;
42
+ }
43
+ /** A function field selection. A falsy result selects nothing. */
44
+ export type SelectFn<Query> = (args: object, ctx: object, nested: NestedSelection<Query>, selectedFieldNode: SelectedFieldNode, position: Position) => MaybePromise<Query | false | null | undefined>;
45
+ export interface EntryOptions<Query> {
46
+ context: object;
47
+ info: GraphQLResolveInfo;
48
+ typeName?: string;
49
+ path?: PathSegment[];
50
+ paths?: PathSegment[][];
51
+ /**
52
+ * Merged into the root before anything is walked, so on a conflict it wins. `Plan.fromInfo`
53
+ * answers undefined when paths are given and nothing is selected under them; what a caller
54
+ * hands its resolver then is the caller's own rule, not this package's.
55
+ */
56
+ initial?: Query;
57
+ /**
58
+ * Overrides `Adapter.skipDeferredFragments` for this plan. The setting belongs to a builder
59
+ * while prisma's adapter is a module singleton, so that plugin passes it per entry point
60
+ * instead of putting it on the adapter.
61
+ */
62
+ skipDeferredFragments?: boolean;
63
+ }
64
+ /** How one merge into an adapter's node differs from a plain one. */
65
+ export interface MergeOptions {
66
+ /**
67
+ * The node's own top-level arguments are not compared. A field's selection is merged into a
68
+ * node whose arguments came from somewhere else, so only what is nested below is checked.
69
+ */
70
+ ignoreArgs?: boolean;
71
+ /**
72
+ * The query is a relation query, not a selection. A query without a column selection must add
73
+ * no columns: the plan beneath it adds the ones it needs.
74
+ */
75
+ asQuery?: boolean;
76
+ /**
77
+ * Keys that conflict with what the node holds are left out, one at a time, instead of the merge
78
+ * being refused or throwing.
79
+ */
80
+ lenient?: boolean;
81
+ /**
82
+ * The response key of the field the query came from, so an adapter that keeps one slot per
83
+ * selected field can name it. Absent for a type-level selection, an initial selection and a
84
+ * staged query.
85
+ */
86
+ alias?: string;
87
+ }
88
+ /**
89
+ * A key of a type-level selection that cannot be merged with what a node already holds. `kind`
90
+ * chooses the error message, so it is the ORM's own word for the key rather than this package's:
91
+ * prisma reports a conflicting `_count` as a `relation`, since that is what a user wrote.
92
+ */
93
+ export interface TypeLevelConflict {
94
+ kind: 'extra' | 'relation';
95
+ name: string;
96
+ }
97
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {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,CAAC,CAAC;IACxB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,IAAI,CAAC;CACpC;AAED,kEAAkE;AAClE,MAAM,MAAM,QAAQ,CAAC,KAAK,IAAI,CAC5B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,EAC9B,iBAAiB,EAAE,iBAAiB,EACpC,QAAQ,EAAE,QAAQ,KACf,YAAY,CAAC,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;AAEpD,MAAM,WAAW,YAAY,CAAC,KAAK;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,kBAAkB,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,WAAW,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,WAAW,EAAE,EAAE,CAAC;IACxB;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,qEAAqE;AACrE,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd"}
package/esm/types.js ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The types the adapter contract and the entry points mention: where a field is, what a select
3
+ * function is handed, what an entry point takes, and how one merge differs from a plain one.
4
+ */ /**
5
+ * A key of a type-level selection that cannot be merged with what a node already holds. `kind`
6
+ * chooses the error message, so it is the ORM's own word for the key rather than this package's:
7
+ * prisma reports a conflicting `_count` as a `relation`, since that is what a user wrote.
8
+ */ export { };
9
+
10
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;CAGC,GA+GD;;;;CAIC,GACD,WAGC"}
package/esm/walk.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import { type FieldNode, type GraphQLNamedType } from 'graphql';
2
+ import type { NodeBase } from './adapter.js';
3
+ import type { Plan } from './plan.js';
4
+ import type { WalkedType } from './types.js';
5
+ /**
6
+ * One selection to walk into a plan, before any indirect include on `type` is followed: the
7
+ * selection sets of `fieldNodes` (every node selecting one field), walked as `type`.
8
+ */
9
+ export interface Branch {
10
+ type: GraphQLNamedType;
11
+ fieldNodes: readonly FieldNode[];
12
+ indirectPath: string[];
13
+ deferred: boolean;
14
+ }
15
+ /**
16
+ * Walks every branch into `plan`. The types the selections are walked as, and the variants their
17
+ * fragments move to, are all collected before any field is, so type-level selections come first
18
+ * in the merge list and the plan does not depend on which occurrence of a field, or which path
19
+ * match, came first in the document.
20
+ */
21
+ export declare function walkBranches<Model, Query, NodeType extends NodeBase<Model>>(plan: Plan<Model, Query, NodeType>, branches: Branch[]): void;
22
+ /** Collects what `fieldNode` (a field of `type`) selects. */
23
+ export declare function walkField<Model, Query, NodeType extends NodeBase<Model>>(plan: Plan<Model, Query, NodeType>, type: WalkedType, fieldNode: FieldNode, indirectPath: string[]): void;
24
+ //# sourceMappingURL=walk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../src/walk.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,KAAK,SAAS,EAGd,KAAK,gBAAgB,EAOtB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAc7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAuC,UAAU,EAAE,MAAM,YAAY,CAAC;AAwClF;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,gBAAgB,CAAC;IACvB,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IACjC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAYD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,SAAS,QAAQ,CAAC,KAAK,CAAC,EACzE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAClC,QAAQ,EAAE,MAAM,EAAE,QAoCnB;AA4ND,6DAA6D;AAC7D,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,SAAS,QAAQ,CAAC,KAAK,CAAC,EACtE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAClC,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,MAAM,EAAE,QAmDvB"}