@pothos/selection-mapper 0.2.0 → 0.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @pothos/selection-mapper
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b9fd6f2: Remove the `setFieldMapping` export, which no Pothos plugin uses any more.
8
+
3
9
  ## 0.2.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -11,10 +11,9 @@ their own. Use the plugins.
11
11
 
12
12
  The surface is what those plugins import and nothing more: `Plan` (with the statics `Plan.fromInfo`
13
13
  and `Plan.forParentRow`), `Adapter` and `NodeAdapter`, the loader-map helpers (`cacheKey`,
14
- `forOperation`, `getLoaderMapping`, `setFieldMapping`, `setLoaderMappings`, `setRowFieldMapping`,
15
- `setRowMappings`), `mappingParentTypes`, `selectedFieldNames` and `deepEqual`. Turning a plan
16
- into the query a resolver is handed is each plugin's own job — prisma's `queryFromInfo` and
17
- drizzle's differ — so neither of them is here.
14
+ `forOperation`, `getLoaderMapping`, `setLoaderMappings`, `setRowFieldMapping`, `setRowMappings`),
15
+ `mappingParentTypes`, `selectedFieldNames` and `deepEqual`. Each plugin builds the query it passes
16
+ to a resolver itself. Prisma's `queryFromInfo` and drizzle's differ, so neither is here.
18
17
 
19
18
  ## Vocabulary
20
19
 
package/dts/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  export { Adapter } from './adapter.js';
7
7
  export { deepEqual } from './deep-equal.js';
8
- export { cacheKey, fieldKey, forExecution, forOperation, getLoaderMapping, type Mapping, type Mappings, setFieldMapping, setLoaderMappings, setRowFieldMapping, setRowMappings, } from './loader-map.js';
8
+ export { cacheKey, fieldKey, forExecution, forOperation, getLoaderMapping, type Mapping, type Mappings, setLoaderMappings, setRowFieldMapping, setRowMappings, } from './loader-map.js';
9
9
  export { type IndirectInclude, type IndirectPathSegment, type PathSegment, selectedFieldNames, } from './matches.js';
10
10
  export { type Node, NodeAdapter, type QueryVisitor } from './node.js';
11
11
  export { mappingParentTypes } from './parent-types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,IAAI,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,UAAU,GACX,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,IAAI,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,UAAU,GACX,MAAM,YAAY,CAAC"}
@@ -30,31 +30,31 @@ export declare function unionMappings(into: Mapping | undefined, from: Mapping):
30
30
  /**
31
31
  * The entries of `cache` for the operation `info` is in. Keyed on its `variableValues`, which
32
32
  * every executor coerces afresh for each operation, so operations sharing a context never share
33
- * an entry. The events of a subscription may share them, so a plan cached here runs its `select`
34
- * and `query` callbacks once for all of them; use `forExecution` where they read per-event state.
33
+ * an entry. The events of a subscription may share one, so a plan cached here runs its `select`
34
+ * and `query` callbacks once for all of them. Use `forExecution` if the callbacks read per-event
35
+ * state.
35
36
  */
36
37
  export declare function forOperation<T>(cache: WeakMap<object, Map<string, T>>, info: GraphQLResolveInfo): Map<string, T>;
37
38
  /**
38
- * The entries of `cache` for the execution `info` is in, by `executionOf`, as mappings are kept:
39
- * each event of a subscription gets its own, and @defer and @stream payloads share their
40
- * execution's.
39
+ * The entries of `cache` for the execution `info` is in. Each event of a subscription gets its own
40
+ * entries, and `@defer` and `@stream` payloads share the entries of their execution.
41
41
  */
42
42
  export declare function forExecution<T>(cache: WeakMap<object, Map<string, T>>, info: GraphQLResolveInfo): Map<string, T>;
43
43
  /** The string keys of a response path joined by `.`; list indices are dropped. */
44
44
  export declare function responsePath(path: GraphQLResolveInfo['path'] | undefined): string;
45
45
  export declare function cacheKey(type: string, path: GraphQLResolveInfo['path']): string;
46
46
  /**
47
- * `cacheKey(type, info.path)` and the identity of every node in `info.fieldNodes`. The path keeps
48
- * each place in the response apart, list indices aside, so the root fields of a mutation, which run
49
- * in turn and whose callbacks may read what an earlier one changed, never share a plan. The nodes
50
- * decide what a plan loads: fragments on different types can merge different nodes into one
51
- * response path, so a plan keyed on the path alone would be reused for a field asking for
52
- * something else.
47
+ * The key to cache a field's plan under: `cacheKey(type, info.path)` plus an id for each node in
48
+ * `info.fieldNodes`. The path leaves out list indices, so the items of a list share a plan. The
49
+ * root fields of a mutation run in turn, and a callback may read what an earlier field changed.
50
+ * Their paths differ, so each gets its own plan. The nodes are part of the key because fragments on
51
+ * different types can merge different nodes into one response path, and a plan keyed on the path
52
+ * alone would be reused for a field that selects something else.
53
53
  */
54
54
  export declare function fieldKey(type: string, info: GraphQLResolveInfo): string;
55
55
  /**
56
56
  * Records the mappings of a plan rooted at the field `info` resolves, under that field's path.
57
- * The plan loaded the whole field, so its mappings answer for everything resolved beneath this
57
+ * The plan loaded the whole field, so its mappings are used for everything resolved beneath this
58
58
  * execution of it. Multiple plans can contribute to one field (Relay nodes of different model
59
59
  * types share the list's path), so later contributions replace matching keys and retain others.
60
60
  */
@@ -66,16 +66,8 @@ export declare function setLoaderMappings(ctx: object, info: GraphQLResolveInfo,
66
66
  */
67
67
  export declare function setRowMappings(ctx: object, info: GraphQLResolveInfo, mappings: Mappings): void;
68
68
  /**
69
- * Records the mapping of the field `info` resolves (under its own parent type) along with the
70
- * mappings beneath it, so both the field's resolver and the resolvers below it can look
71
- * themselves up. `row` is the value the field is about to resolve with: the parent row when it
72
- * was loaded by the planned query, and the reloaded row when the fallback loader fetched it.
73
- */
74
- export declare function setFieldMapping(ctx: object, info: GraphQLResolveInfo, mapping: Mapping, row: unknown): void;
75
- /**
76
- * `setFieldMapping` for a plan that loaded `row` alone: the field's own mapping is recorded
77
- * against `row` rather than claimed for the whole field, so the field's lookup on `row` answers
78
- * from it whatever the field's other rows were loaded with.
69
+ * Records a mapping for `row` only, for the field `info` resolves. Use it when the plan loaded
70
+ * `row` alone. The field's other rows don't use this mapping.
79
71
  *
80
72
  * Descendants inherit the mapping through this field's execution scope, even when their parent
81
73
  * is a child object or a connection wrapper rather than the row that was reloaded.
@@ -84,8 +76,9 @@ export declare function setRowFieldMapping(ctx: object, info: GraphQLResolveInfo
84
76
  /**
85
77
  * The mapping recorded for the field `info` resolves on `row`, preferring one recorded for that
86
78
  * row over the plan's. `row` is the value whose data the mapping describes — the resolver's
87
- * parent. The plan's comes from the nearest field execution above that recorded one: with none
88
- * above, no plan loaded `row`, whatever was recorded for another row at the same path.
79
+ * parent. The plan's mapping comes from the nearest field execution above this one that recorded
80
+ * mappings. Returns `null` if there is none or it has no mapping for this field, even if a mapping
81
+ * was recorded for another row at the same path.
89
82
  */
90
83
  export declare function getLoaderMapping(ctx: object, info: GraphQLResolveInfo, type: string, row?: unknown): Mapping | null;
91
84
  //# sourceMappingURL=loader-map.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loader-map.d.ts","sourceRoot":"","sources":["../src/loader-map.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,QAAQ,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/C,mFAAmF;AACnF,eAAO,MAAM,aAAa,EAAE,OAAkE,CAAC;AAK/F;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAiC/E;AA8GD;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AE,kBAAkB,CAAC,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,CAgBjF;AAoBD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,UAEtE;AAMD;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAevE;AAyBD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,QAK1F;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,QAIvF;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,kBAAkB,EACxB,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,OAAO,QAWb;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,kBAAkB,EACxB,IAAI,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,OAAO,GACZ,OAAO,GAAG,IAAI,CA+BhB"}
package/esm/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  export { Adapter } from './adapter.js';
7
7
  export { deepEqual } from './deep-equal.js';
8
- export { cacheKey, fieldKey, forExecution, forOperation, getLoaderMapping, type Mapping, type Mappings, setFieldMapping, setLoaderMappings, setRowFieldMapping, setRowMappings, } from './loader-map.js';
8
+ export { cacheKey, fieldKey, forExecution, forOperation, getLoaderMapping, type Mapping, type Mappings, setLoaderMappings, setRowFieldMapping, setRowMappings, } from './loader-map.js';
9
9
  export { type IndirectInclude, type IndirectPathSegment, type PathSegment, selectedFieldNames, } from './matches.js';
10
10
  export { type Node, NodeAdapter, type QueryVisitor } from './node.js';
11
11
  export { mappingParentTypes } from './parent-types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,IAAI,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,UAAU,GACX,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,IAAI,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,UAAU,GACX,MAAM,YAAY,CAAC"}
package/esm/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * adapters and loaders call. Everything else is module-private; see the README.
5
5
  */ export { Adapter } from './adapter.js';
6
6
  export { deepEqual } from './deep-equal.js';
7
- export { cacheKey, fieldKey, forExecution, forOperation, getLoaderMapping, setFieldMapping, setLoaderMappings, setRowFieldMapping, setRowMappings } from './loader-map.js';
7
+ export { cacheKey, fieldKey, forExecution, forOperation, getLoaderMapping, setLoaderMappings, setRowFieldMapping, setRowMappings } from './loader-map.js';
8
8
  export { selectedFieldNames } from './matches.js';
9
9
  export { NodeAdapter } from './node.js';
10
10
  export { mappingParentTypes } from './parent-types.js';
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["Adapter","deepEqual","cacheKey","fieldKey","forExecution","forOperation","getLoaderMapping","setFieldMapping","setLoaderMappings","setRowFieldMapping","setRowMappings","selectedFieldNames","NodeAdapter","mappingParentTypes","Plan"],"mappings":"AAAA;;;;CAIC,GACD,SAASA,OAAO,QAAQ,eAAe;AACvC,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SACEC,QAAQ,EACRC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,gBAAgB,EAGhBC,eAAe,EACfC,iBAAiB,EACjBC,kBAAkB,EAClBC,cAAc,QACT,kBAAkB;AACzB,SAIEC,kBAAkB,QACb,eAAe;AACtB,SAAoBC,WAAW,QAA2B,YAAY;AACtE,SAASC,kBAAkB,QAAQ,oBAAoB;AACvD,SAASC,IAAI,QAAyB,YAAY"}
1
+ {"version":3,"sources":["../src/index.ts"],"names":["Adapter","deepEqual","cacheKey","fieldKey","forExecution","forOperation","getLoaderMapping","setLoaderMappings","setRowFieldMapping","setRowMappings","selectedFieldNames","NodeAdapter","mappingParentTypes","Plan"],"mappings":"AAAA;;;;CAIC,GACD,SAASA,OAAO,QAAQ,eAAe;AACvC,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SACEC,QAAQ,EACRC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,gBAAgB,EAGhBC,iBAAiB,EACjBC,kBAAkB,EAClBC,cAAc,QACT,kBAAkB;AACzB,SAIEC,kBAAkB,QACb,eAAe;AACtB,SAAoBC,WAAW,QAA2B,YAAY;AACtE,SAASC,kBAAkB,QAAQ,oBAAoB;AACvD,SAASC,IAAI,QAAyB,YAAY"}
@@ -30,31 +30,31 @@ export declare function unionMappings(into: Mapping | undefined, from: Mapping):
30
30
  /**
31
31
  * The entries of `cache` for the operation `info` is in. Keyed on its `variableValues`, which
32
32
  * every executor coerces afresh for each operation, so operations sharing a context never share
33
- * an entry. The events of a subscription may share them, so a plan cached here runs its `select`
34
- * and `query` callbacks once for all of them; use `forExecution` where they read per-event state.
33
+ * an entry. The events of a subscription may share one, so a plan cached here runs its `select`
34
+ * and `query` callbacks once for all of them. Use `forExecution` if the callbacks read per-event
35
+ * state.
35
36
  */
36
37
  export declare function forOperation<T>(cache: WeakMap<object, Map<string, T>>, info: GraphQLResolveInfo): Map<string, T>;
37
38
  /**
38
- * The entries of `cache` for the execution `info` is in, by `executionOf`, as mappings are kept:
39
- * each event of a subscription gets its own, and @defer and @stream payloads share their
40
- * execution's.
39
+ * The entries of `cache` for the execution `info` is in. Each event of a subscription gets its own
40
+ * entries, and `@defer` and `@stream` payloads share the entries of their execution.
41
41
  */
42
42
  export declare function forExecution<T>(cache: WeakMap<object, Map<string, T>>, info: GraphQLResolveInfo): Map<string, T>;
43
43
  /** The string keys of a response path joined by `.`; list indices are dropped. */
44
44
  export declare function responsePath(path: GraphQLResolveInfo['path'] | undefined): string;
45
45
  export declare function cacheKey(type: string, path: GraphQLResolveInfo['path']): string;
46
46
  /**
47
- * `cacheKey(type, info.path)` and the identity of every node in `info.fieldNodes`. The path keeps
48
- * each place in the response apart, list indices aside, so the root fields of a mutation, which run
49
- * in turn and whose callbacks may read what an earlier one changed, never share a plan. The nodes
50
- * decide what a plan loads: fragments on different types can merge different nodes into one
51
- * response path, so a plan keyed on the path alone would be reused for a field asking for
52
- * something else.
47
+ * The key to cache a field's plan under: `cacheKey(type, info.path)` plus an id for each node in
48
+ * `info.fieldNodes`. The path leaves out list indices, so the items of a list share a plan. The
49
+ * root fields of a mutation run in turn, and a callback may read what an earlier field changed.
50
+ * Their paths differ, so each gets its own plan. The nodes are part of the key because fragments on
51
+ * different types can merge different nodes into one response path, and a plan keyed on the path
52
+ * alone would be reused for a field that selects something else.
53
53
  */
54
54
  export declare function fieldKey(type: string, info: GraphQLResolveInfo): string;
55
55
  /**
56
56
  * Records the mappings of a plan rooted at the field `info` resolves, under that field's path.
57
- * The plan loaded the whole field, so its mappings answer for everything resolved beneath this
57
+ * The plan loaded the whole field, so its mappings are used for everything resolved beneath this
58
58
  * execution of it. Multiple plans can contribute to one field (Relay nodes of different model
59
59
  * types share the list's path), so later contributions replace matching keys and retain others.
60
60
  */
@@ -66,16 +66,8 @@ export declare function setLoaderMappings(ctx: object, info: GraphQLResolveInfo,
66
66
  */
67
67
  export declare function setRowMappings(ctx: object, info: GraphQLResolveInfo, mappings: Mappings): void;
68
68
  /**
69
- * Records the mapping of the field `info` resolves (under its own parent type) along with the
70
- * mappings beneath it, so both the field's resolver and the resolvers below it can look
71
- * themselves up. `row` is the value the field is about to resolve with: the parent row when it
72
- * was loaded by the planned query, and the reloaded row when the fallback loader fetched it.
73
- */
74
- export declare function setFieldMapping(ctx: object, info: GraphQLResolveInfo, mapping: Mapping, row: unknown): void;
75
- /**
76
- * `setFieldMapping` for a plan that loaded `row` alone: the field's own mapping is recorded
77
- * against `row` rather than claimed for the whole field, so the field's lookup on `row` answers
78
- * from it whatever the field's other rows were loaded with.
69
+ * Records a mapping for `row` only, for the field `info` resolves. Use it when the plan loaded
70
+ * `row` alone. The field's other rows don't use this mapping.
79
71
  *
80
72
  * Descendants inherit the mapping through this field's execution scope, even when their parent
81
73
  * is a child object or a connection wrapper rather than the row that was reloaded.
@@ -84,8 +76,9 @@ export declare function setRowFieldMapping(ctx: object, info: GraphQLResolveInfo
84
76
  /**
85
77
  * The mapping recorded for the field `info` resolves on `row`, preferring one recorded for that
86
78
  * row over the plan's. `row` is the value whose data the mapping describes — the resolver's
87
- * parent. The plan's comes from the nearest field execution above that recorded one: with none
88
- * above, no plan loaded `row`, whatever was recorded for another row at the same path.
79
+ * parent. The plan's mapping comes from the nearest field execution above this one that recorded
80
+ * mappings. Returns `null` if there is none or it has no mapping for this field, even if a mapping
81
+ * was recorded for another row at the same path.
89
82
  */
90
83
  export declare function getLoaderMapping(ctx: object, info: GraphQLResolveInfo, type: string, row?: unknown): Mapping | null;
91
84
  //# sourceMappingURL=loader-map.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loader-map.d.ts","sourceRoot":"","sources":["../src/loader-map.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,QAAQ,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/C,mF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M,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EACtC,IAAI,EAAE,kBAAkB,GACvB,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAEhB;AAoBD,kFAAkF;AAClF,wBAAgB,YAAY,CAAC,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,CAgBjF;AAoBD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,UAEtE;AAMD;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAevE;AAyBD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,QAK1F;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,QAIvF;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,kBAAkB,EACxB,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,OAAO,QAWb;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,kBAAkB,EACxB,IAAI,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,OAAO,GACZ,OAAO,GAAG,IAAI,CA+BhB"}
package/esm/loader-map.js CHANGED
@@ -74,9 +74,7 @@ function cache(ctx, info) {
74
74
  let cached = executions.get(execution);
75
75
  if (!cached) {
76
76
  cached = {
77
- mappings: new Map(),
78
77
  places: new Map(),
79
- rehomed: new Map(),
80
78
  rows: new WeakMap(),
81
79
  rowScoped: false,
82
80
  scopes: new WeakMap()
@@ -105,15 +103,15 @@ function cache(ctx, info) {
105
103
  /**
106
104
  * The entries of `cache` for the operation `info` is in. Keyed on its `variableValues`, which
107
105
  * every executor coerces afresh for each operation, so operations sharing a context never share
108
- * an entry. The events of a subscription may share them, so a plan cached here runs its `select`
109
- * and `query` callbacks once for all of them; use `forExecution` where they read per-event state.
106
+ * an entry. The events of a subscription may share one, so a plan cached here runs its `select`
107
+ * and `query` callbacks once for all of them. Use `forExecution` if the callbacks read per-event
108
+ * state.
110
109
  */ export function forOperation(cache, info) {
111
110
  return entriesFor(cache, info.variableValues);
112
111
  }
113
112
  /**
114
- * The entries of `cache` for the execution `info` is in, by `executionOf`, as mappings are kept:
115
- * each event of a subscription gets its own, and @defer and @stream payloads share their
116
- * execution's.
113
+ * The entries of `cache` for the execution `info` is in. Each event of a subscription gets its own
114
+ * entries, and `@defer` and `@stream` payloads share the entries of their execution.
117
115
  */ export function forExecution(cache, info) {
118
116
  return entriesFor(cache, executionOf(info));
119
117
  }
@@ -161,12 +159,12 @@ export function cacheKey(type, path) {
161
159
  /** A number for each field node seen, by identity. Weak, so the nodes go with their document. */ const fieldNodeIds = new WeakMap();
162
160
  let nextFieldNodeId = 0;
163
161
  /**
164
- * `cacheKey(type, info.path)` and the identity of every node in `info.fieldNodes`. The path keeps
165
- * each place in the response apart, list indices aside, so the root fields of a mutation, which run
166
- * in turn and whose callbacks may read what an earlier one changed, never share a plan. The nodes
167
- * decide what a plan loads: fragments on different types can merge different nodes into one
168
- * response path, so a plan keyed on the path alone would be reused for a field asking for
169
- * something else.
162
+ * The key to cache a field's plan under: `cacheKey(type, info.path)` plus an id for each node in
163
+ * `info.fieldNodes`. The path leaves out list indices, so the items of a list share a plan. The
164
+ * root fields of a mutation run in turn, and a callback may read what an earlier field changed.
165
+ * Their paths differ, so each gets its own plan. The nodes are part of the key because fragments on
166
+ * different types can merge different nodes into one response path, and a plan keyed on the path
167
+ * alone would be reused for a field that selects something else.
170
168
  */ export function fieldKey(type, info) {
171
169
  let key = cacheKey(type, info.path);
172
170
  for (const node of info.fieldNodes){
@@ -179,42 +177,9 @@ let nextFieldNodeId = 0;
179
177
  }
180
178
  return key;
181
179
  }
182
- /**
183
- * The keys `mappings` is recorded under when it is rehomed beneath `prefix`. Built once per
184
- * prefix: the strings depend on the path and the plan's own keys, never on which row is being
185
- * recorded for.
186
- */ function rehomedKeys(cached, prefix) {
187
- let keys = cached.rehomed.get(prefix);
188
- if (!keys) {
189
- keys = new Map();
190
- cached.rehomed.set(prefix, keys);
191
- }
192
- return keys;
193
- }
194
- /** `key`, a plan's own `Type@relative.path`, moved beneath `prefix`. Built once per prefix. */ function rehome(keys, key, prefix) {
195
- let under = keys.get(key);
196
- if (under === undefined) {
197
- const at = key.indexOf('@');
198
- under = `${key.slice(0, at)}@${prefix}.${key.slice(at + 1)}`;
199
- keys.set(key, under);
200
- }
201
- return under;
202
- }
203
180
  /** `row` if a mapping can be hung off it. A root field resolves with no parent value at all. */ function ownerOf(row) {
204
181
  return typeof row === 'object' && row !== null ? row : null;
205
182
  }
206
- /**
207
- * Records `mapping` at `key` for `row`. An unclaimed key takes it, and a key already holding this
208
- * very mapping needs no write, so the rows after the first write nothing. Only a key two plans
209
- * disagree about gives the row a mapping of its own — or, with no row to hang it off, nothing.
210
- */ function claim(cached, key, mapping, row, place) {
211
- const held = cached.mappings.get(key);
212
- if (held === undefined) {
213
- cached.mappings.set(key, mapping);
214
- } else if (held !== mapping && row) {
215
- claimForRow(cached, key.slice(0, key.indexOf('@')), mapping, row, place);
216
- }
217
- }
218
183
  /**
219
184
  * Records `mapping` for this field execution against `row` alone.
220
185
  */ function claimForRow(cached, type, mapping, row, place) {
@@ -233,22 +198,17 @@ let nextFieldNodeId = 0;
233
198
  }
234
199
  /**
235
200
  * Records the mappings of a plan rooted at the field `info` resolves, under that field's path.
236
- * The plan loaded the whole field, so its mappings answer for everything resolved beneath this
201
+ * The plan loaded the whole field, so its mappings are used for everything resolved beneath this
237
202
  * execution of it. Multiple plans can contribute to one field (Relay nodes of different model
238
203
  * types share the list's path), so later contributions replace matching keys and retain others.
239
204
  */ export function setLoaderMappings(ctx, info, mappings) {
240
205
  const cached = cache(ctx, info);
241
- const prefix = responsePath(info.path);
242
- const keys = rehomedKeys(cached, prefix);
243
206
  const place = placeOf(cached, info, info.path);
244
207
  const previous = cached.scopes.get(place);
245
208
  cached.scopes.set(place, previous ? {
246
209
  ...previous,
247
210
  ...mappings
248
211
  } : mappings);
249
- for (const key of Object.keys(mappings)){
250
- cached.mappings.set(rehome(keys, key, prefix), mappings[key]);
251
- }
252
212
  }
253
213
  /**
254
214
  * Records a row's mappings and scopes its descendants to this concrete field execution. A
@@ -259,20 +219,8 @@ let nextFieldNodeId = 0;
259
219
  cached.scopes.set(placeOf(cached, info, info.path), mappings);
260
220
  }
261
221
  /**
262
- * Records the mapping of the field `info` resolves (under its own parent type) along with the
263
- * mappings beneath it, so both the field's resolver and the resolvers below it can look
264
- * themselves up. `row` is the value the field is about to resolve with: the parent row when it
265
- * was loaded by the planned query, and the reloaded row when the fallback loader fetched it.
266
- */ export function setFieldMapping(ctx, info, mapping, row) {
267
- const cached = cache(ctx, info);
268
- const place = placeOf(cached, info, info.path);
269
- claim(cached, cacheKey(info.parentType.name, info.path), mapping, ownerOf(row), place);
270
- cached.scopes.set(place, mapping.nested);
271
- }
272
- /**
273
- * `setFieldMapping` for a plan that loaded `row` alone: the field's own mapping is recorded
274
- * against `row` rather than claimed for the whole field, so the field's lookup on `row` answers
275
- * from it whatever the field's other rows were loaded with.
222
+ * Records a mapping for `row` only, for the field `info` resolves. Use it when the plan loaded
223
+ * `row` alone. The field's other rows don't use this mapping.
276
224
  *
277
225
  * Descendants inherit the mapping through this field's execution scope, even when their parent
278
226
  * is a child object or a connection wrapper rather than the row that was reloaded.
@@ -288,8 +236,9 @@ let nextFieldNodeId = 0;
288
236
  /**
289
237
  * The mapping recorded for the field `info` resolves on `row`, preferring one recorded for that
290
238
  * row over the plan's. `row` is the value whose data the mapping describes — the resolver's
291
- * parent. The plan's comes from the nearest field execution above that recorded one: with none
292
- * above, no plan loaded `row`, whatever was recorded for another row at the same path.
239
+ * parent. The plan's mapping comes from the nearest field execution above this one that recorded
240
+ * mappings. Returns `null` if there is none or it has no mapping for this field, even if a mapping
241
+ * was recorded for another row at the same path.
293
242
  */ export function getLoaderMapping(ctx, info, type, row) {
294
243
  const { path } = info;
295
244
  const cached = cache(ctx, info);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/loader-map.ts"],"names":["createContextCache","EMPTY_MAPPING","Object","freeze","nested","unions","WeakMap","unionMappings","into","from","byFrom","get","set","known","key","keys","union","position","undefined","contextCaches","executionOf","info","signal","getAbortSignal","path","typename","variableValues","prev","cache","ctx","executions","execution","cached","mappings","Map","places","rehomed","rows","rowScoped","scopes","placeOf","at","executionPath","place","forOperation","entriesFor","forExecution","entries","pathKeys","responsePath","prefix","executionPaths","String","cacheKey","type","fieldNodeIds","nextFieldNodeId","fieldKey","node","fieldNodes","id","rehomedKeys","rehome","under","indexOf","slice","ownerOf","row","claim","mapping","held","claimForRow","byPlace","own","setLoaderMappings","previous","setRowMappings","setFieldMapping","parentType","name","setRowFieldMapping","owner","getLoaderMapping","ancestor","scope","length"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,eAAe;AAsBlD,iFAAiF,GACjF,OAAO,MAAMC,gBAAyBC,OAAOC,MAAM,CAAC;IAAEC,QAAQF,OAAOC,MAAM,CAAC,CAAC;AAAe,GAAG;AAE/F,6FAA6F,GAC7F,MAAME,SAAS,IAAIC;AAEnB;;;;;;;CAOC,GACD,OAAO,SAASC,cAAcC,IAAyB,EAAEC,IAAa;IACpE,IAAI,CAACD,QAAQA,SAASP,eAAe;QACnC,OAAOQ;IACT;IAEA,IAAID,SAASC,QAAQA,SAASR,eAAe;QAC3C,OAAOO;IACT;IAEA,IAAIE,SAASL,OAAOM,GAAG,CAACH;IAExB,IAAI,CAACE,QAAQ;QACXA,SAAS,IAAIJ;QACbD,OAAOO,GAAG,CAACJ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tB,MAAMxB,QAAQH,QAAQR,QAAQX,MAAMA,KAAKG,IAAI;IAE7C,IAAIyD,OAAO;QACTV,YAAYvC,QAAQX,KAAKyD,UAAU,CAACC,IAAI,EAAEV,SAASY,OAAOtC;IAC5D;IAEAX,OAAOO,MAAM,CAAC3B,GAAG,CAAC+B,OAAO0B,QAAQjE,MAAM;AACzC;AAEA;;;;;CAKC,GACD,OAAO,SAAS8E,iBACdrD,GAAW,EACXR,IAAwB,EACxBiC,IAAY,EACZa,GAAa;IAEb,MAAM,EAAE3C,IAAI,EAAE,GAAGH;IACjB,MAAMW,SAASJ,MAAMC,KAAKR;IAE1B,IAAIW,OAAOM,SAAS,EAAE;QACpB,MAAM2C,QAAQf,QAAQC;QACtB,MAAMM,MACJQ,SACAjD,OAAOK,IAAI,CACR1B,GAAG,CAACsE,QACHtE,IAAI6B,QAAQR,QAAQX,MAAMG,QAC1Bb,IAAI2C;QAEV,IAAImB,KAAK;YACP,OAAOA;QACT;IACF;IAEA,IAAK,IAAIU,WAAW3D,KAAKG,IAAI,EAAEwD,UAAUA,WAAWA,SAASxD,IAAI,CAAE;QACjE,MAAMyD,QAAQpD,OAAOO,MAAM,CAAC5B,GAAG,CAAC6B,QAAQR,QAAQX,MAAM8D;QAEtD,IAAIC,OAAO;YACT,wFAAwF;YACxF,0CAA0C;YAC1C,OACEA,KAAK,CAAC,GAAG9B,KAAK,CAAC,EAAEL,aAAazB,MAAMyC,KAAK,CAAChB,aAAakC,UAAUE,MAAM,GAAG,IAAI,CAAC,IAAI;QAEvF;IACF;IAEA,OAAO;AACT"}
1
+ {"version":3,"sources":["../src/loader-map.ts"],"names":["createContextCache","EMPTY_MAPPING","Object","freeze","nested","unions","WeakMap","unionMappings","into","from","byFrom","get","set","known","key","keys","union","position","undefined","contextCaches","executionOf","info","signal","getAbortSignal","path","typename","variableValues","prev","cache","ctx","executions","execution","cached","places","Map","rows","rowScoped","scopes","placeOf","at","executionPath","place","forOperation","entriesFor","forExecution","entries","pathKeys","responsePath","prefix","executionPaths","String","cacheKey","type","fieldNodeIds","nextFieldNodeId","fieldKey","node","fieldNodes","id","ownerOf","row","claimForRow","mapping","byPlace","own","setLoaderMappings","mappings","previous","setRowMappings","setRowFieldMapping","owner","parentType","name","getLoaderMapping","ancestor","scope","slice","length"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,eAAe;AAsBlD,iFAAiF,GACjF,OAAO,MAAMC,gBAAyBC,OAAOC,MAAM,CAAC;IAAEC,QAAQF,OAAOC,MAAM,CAAC,CAAC;AAAe,GAAG;AAE/F,6FAA6F,GAC7F,MAAME,SAAS,IAAIC;AAEnB;;;;;;;CAOC,GACD,OAAO,SAASC,cAAcC,IAAyB,EAAEC,IAAa;IACpE,IAAI,CAACD,QAAQA,SAASP,eAAe;QACnC,OAAOQ;IACT;IAEA,IAAID,SAASC,QAAQA,SAASR,eAAe;QAC3C,OAAOO;IACT;IAEA,IAAIE,SAASL,OAAOM,GAAG,CAACH;IAExB,IAAI,CAACE,QAAQ;QACXA,SAAS,IAAIJ;QACbD,OAAOO,GAAG,CAACJ,MAAME;IACnB;IAEA,MAAMG,QAAQH,OAAOC,GAAG,CAACF;IAEzB,IAAII,OAAO;QACT,OAAOA;IACT;IAEA,MAAMT,SAAmB;QAAE,GAAGI,KAAKJ,MAAM;IAAC;IAE1C,KAAK,MAAMU,OAAOZ,OAAOa,IAAI,CAACN,KAAKL,MAAM,EAAG;QAC1CA,MAAM,CAACU,IAAI,GAAGP,cAAcH,MAAM,CAACU,IAAI,EAAEL,KAAKL,MAAM,CAACU,IAAI;IAC3D;IAEA,MAAME,QAAQR,KAAKS,QAAQ,KAAKC,YAAY;QAAEd;IAAO,IAAI;QAAEA;QAAQa,UAAUT,KAAKS,QAAQ;IAAC;IAE3FP,OAAOE,GAAG,CAACH,MAAMO;IAEjB,OAAOA;AACT;AAwBA,gEAAgE,GAChE,MAAMG,gBAAgBnB,mBAAmB,IAAM,IAAIM;AAEnD;;;;;;;;;;;;CAYC,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AEA,OAAO;AACT"}
package/lib/index.js CHANGED
@@ -46,9 +46,6 @@ _export(exports, {
46
46
  get selectedFieldNames () {
47
47
  return _matches.selectedFieldNames;
48
48
  },
49
- get setFieldMapping () {
50
- return _loadermap.setFieldMapping;
51
- },
52
49
  get setLoaderMappings () {
53
50
  return _loadermap.setLoaderMappings;
54
51
  },
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["Adapter","NodeAdapter","Plan","cacheKey","deepEqual","fieldKey","forExecution","forOperation","getLoaderMapping","mappingParentTypes","selectedFieldNames","setFieldMapping","setLoaderMappings","setRowFieldMapping","setRowMappings"],"mappings":"AAAA;;;;CAIC;;;;;;;;;;;QACQA;eAAAA,gBAAO;;QAqBIC;eAAAA,iBAAW;;QAEtBC;eAAAA,UAAI;;QApBXC;eAAAA,mBAAQ;;QAFDC;eAAAA,oBAAS;;QAGhBC;eAAAA,mBAAQ;;QACRC;eAAAA,uBAAY;;QACZC;eAAAA,uBAAY;;QACZC;eAAAA,2BAAgB;;QAeTC;eAAAA,+BAAkB;;QAHzBC;eAAAA,2BAAkB;;QATlBC;eAAAA,0BAAe;;QACfC;eAAAA,4BAAiB;;QACjBC;eAAAA,6BAAkB;;QAClBC;eAAAA,yBAAc;;;yBAbQ;2BACE;2BAanB;yBAMA;sBACmD;6BACvB;sBACG"}
1
+ {"version":3,"sources":["../src/index.ts"],"names":["Adapter","NodeAdapter","Plan","cacheKey","deepEqual","fieldKey","forExecution","forOperation","getLoaderMapping","mappingParentTypes","selectedFieldNames","setLoaderMappings","setRowFieldMapping","setRowMappings"],"mappings":"AAAA;;;;CAIC;;;;;;;;;;;QACQA;eAAAA,gBAAO;;QAoBIC;eAAAA,iBAAW;;QAEtBC;eAAAA,UAAI;;QAnBXC;eAAAA,mBAAQ;;QAFDC;eAAAA,oBAAS;;QAGhBC;eAAAA,mBAAQ;;QACRC;eAAAA,uBAAY;;QACZC;eAAAA,uBAAY;;QACZC;eAAAA,2BAAgB;;QAcTC;eAAAA,+BAAkB;;QAHzBC;eAAAA,2BAAkB;;QARlBC;eAAAA,4BAAiB;;QACjBC;eAAAA,6BAAkB;;QAClBC;eAAAA,yBAAc;;;yBAZQ;2BACE;2BAYnB;yBAMA;sBACmD;6BACvB;sBACG"}
package/lib/loader-map.js CHANGED
@@ -30,9 +30,6 @@ _export(exports, {
30
30
  get responsePath () {
31
31
  return responsePath;
32
32
  },
33
- get setFieldMapping () {
34
- return setFieldMapping;
35
- },
36
33
  get setLoaderMappings () {
37
34
  return setLoaderMappings;
38
35
  },
@@ -115,9 +112,7 @@ function cache(ctx, info) {
115
112
  let cached = executions.get(execution);
116
113
  if (!cached) {
117
114
  cached = {
118
- mappings: new Map(),
119
115
  places: new Map(),
120
- rehomed: new Map(),
121
116
  rows: new WeakMap(),
122
117
  rowScoped: false,
123
118
  scopes: new WeakMap()
@@ -204,42 +199,9 @@ function fieldKey(type, info) {
204
199
  }
205
200
  return key;
206
201
  }
207
- /**
208
- * The keys `mappings` is recorded under when it is rehomed beneath `prefix`. Built once per
209
- * prefix: the strings depend on the path and the plan's own keys, never on which row is being
210
- * recorded for.
211
- */ function rehomedKeys(cached, prefix) {
212
- let keys = cached.rehomed.get(prefix);
213
- if (!keys) {
214
- keys = new Map();
215
- cached.rehomed.set(prefix, keys);
216
- }
217
- return keys;
218
- }
219
- /** `key`, a plan's own `Type@relative.path`, moved beneath `prefix`. Built once per prefix. */ function rehome(keys, key, prefix) {
220
- let under = keys.get(key);
221
- if (under === undefined) {
222
- const at = key.indexOf('@');
223
- under = `${key.slice(0, at)}@${prefix}.${key.slice(at + 1)}`;
224
- keys.set(key, under);
225
- }
226
- return under;
227
- }
228
202
  /** `row` if a mapping can be hung off it. A root field resolves with no parent value at all. */ function ownerOf(row) {
229
203
  return typeof row === 'object' && row !== null ? row : null;
230
204
  }
231
- /**
232
- * Records `mapping` at `key` for `row`. An unclaimed key takes it, and a key already holding this
233
- * very mapping needs no write, so the rows after the first write nothing. Only a key two plans
234
- * disagree about gives the row a mapping of its own — or, with no row to hang it off, nothing.
235
- */ function claim(cached, key, mapping, row, place) {
236
- const held = cached.mappings.get(key);
237
- if (held === undefined) {
238
- cached.mappings.set(key, mapping);
239
- } else if (held !== mapping && row) {
240
- claimForRow(cached, key.slice(0, key.indexOf('@')), mapping, row, place);
241
- }
242
- }
243
205
  /**
244
206
  * Records `mapping` for this field execution against `row` alone.
245
207
  */ function claimForRow(cached, type, mapping, row, place) {
@@ -258,28 +220,17 @@ function fieldKey(type, info) {
258
220
  }
259
221
  function setLoaderMappings(ctx, info, mappings) {
260
222
  const cached = cache(ctx, info);
261
- const prefix = responsePath(info.path);
262
- const keys = rehomedKeys(cached, prefix);
263
223
  const place = placeOf(cached, info, info.path);
264
224
  const previous = cached.scopes.get(place);
265
225
  cached.scopes.set(place, previous ? {
266
226
  ...previous,
267
227
  ...mappings
268
228
  } : mappings);
269
- for (const key of Object.keys(mappings)){
270
- cached.mappings.set(rehome(keys, key, prefix), mappings[key]);
271
- }
272
229
  }
273
230
  function setRowMappings(ctx, info, mappings) {
274
231
  const cached = cache(ctx, info);
275
232
  cached.scopes.set(placeOf(cached, info, info.path), mappings);
276
233
  }
277
- function setFieldMapping(ctx, info, mapping, row) {
278
- const cached = cache(ctx, info);
279
- const place = placeOf(cached, info, info.path);
280
- claim(cached, cacheKey(info.parentType.name, info.path), mapping, ownerOf(row), place);
281
- cached.scopes.set(place, mapping.nested);
282
- }
283
234
  function setRowFieldMapping(ctx, info, mapping, row) {
284
235
  const cached = cache(ctx, info);
285
236
  const owner = ownerOf(row);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/loader-map.ts"],"names":["EMPTY_MAPPING","cacheKey","fieldKey","forExecution","forOperation","getLoaderMapping","responsePath","setFieldMapping","setLoaderMappings","setRowFieldMapping","setRowMappings","unionMappings","Object","freeze","nested","unions","WeakMap","into","from","byFrom","get","set","known","key","keys","union","position","undefined","contextCaches","createContextCache","executionOf","info","signal","getAbortSignal","path","typename","variableValues","prev","cache","ctx","executions","execution","cached","mappings","Map","places","rehomed","rows","rowScoped","scopes","placeOf","at","executionPath","place","entriesFor","entries","pathKeys","prefix","executionPaths","String","type","fieldNodeIds","nextFieldNodeId","node","fieldNodes","id","rehomedKeys","rehome","under","indexOf","slice","ownerOf","row","claim","mapping","held","claimForRow","byPlace","own","previous","parentType","name","owner","ancestor","scope","length"],"mappings":";;;;;;;;;;;QAuBaA;eAAAA;;QA4OGC;eAAAA;;QAgBAC;eAAAA;;QA9EAC;eAAAA;;QAZAC;eAAAA;;QA+PAC;eAAAA;;QAzNAC;eAAAA;;QA6KAC;eAAAA;;QA9BAC;eAAAA;;QAmDAC;eAAAA;;QAjCAC;eAAAA;;QA5VAC;eAAAA;;;sBApCmB;AAuB5B,MAAMX,gBAAyBY,OAAOC,MAAM,CAAC;IAAEC,QAAQF,OAAOC,MAAM,CAAC,CAAC;AAAe;AAE5F,6FAA6F,GAC7F,MAAME,SAAS,IAAIC;AAUZ,SAASL,cAAcM,IAAyB,EAAEC,IAAa;IACpE,IAAI,CAACD,QAAQA,SAASjB,eAAe;QACnC,OAAOkB;IACT;IAEA,IAAID,SAASC,QAAQA,SAASlB,eAAe;QAC3C,OAAOiB;IACT;IAEA,IAAIE,SAASJ,OAAOK,GAAG,CAACH;IAExB,IAAI,CAACE,QAAQ;QACXA,SAAS,IAAIH;QACbD,OAAOM,GAAG,CAACJ,MAAME;IACnB;IAEA,MAAMG,QAAQH,OAAOC,GAAG,CAACF;IAEzB,IAAII,OAAO;QACT,OAAOA;IACT;IAEA,MAAMR,SAAmB;QAAE,GAAGG,KAAKH,MAAM;IAAC;IAE1C,KAAK,MAAMS,OAAOX,OAAOY,IAAI,CAACN,KAAKJ,MAAM,EAAG;QAC1CA,MAAM,CAACS,IAAI,GAAGZ,cAAcG,MAAM,CAACS,IAAI,EAAEL,KAAKJ,MAAM,CAACS,IAAI;IAC3D;IAEA,MAAME,QAAQR,KAAKS,QAAQ,KAAKC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AQR,QAAQX,MAAMG,QAC1Bd,IAAIwC;QAEV,IAAIkB,KAAK;YACP,OAAOA;QACT;IACF;IAEA,IAAK,IAAIK,WAAWjD,KAAKG,IAAI,EAAE8C,UAAUA,WAAWA,SAAS9C,IAAI,CAAE;QACjE,MAAM+C,QAAQ1C,OAAOO,MAAM,CAAC7B,GAAG,CAAC8B,QAAQR,QAAQX,MAAMoD;QAEtD,IAAIC,OAAO;YACT,wFAAwF;YACxF,0CAA0C;YAC1C,OACEA,KAAK,CAAC,GAAGxB,KAAK,CAAC,EAAEtD,aAAa4B,MAAMoC,KAAK,CAAChE,aAAa6E,UAAUE,MAAM,GAAG,IAAI,CAAC,IAAI;QAEvF;IACF;IAEA,OAAO;AACT"}
1
+ {"version":3,"sources":["../src/loader-map.ts"],"names":["EMPTY_MAPPING","cacheKey","fieldKey","forExecution","forOperation","getLoaderMapping","responsePath","setLoaderMappings","setRowFieldMapping","setRowMappings","unionMappings","Object","freeze","nested","unions","WeakMap","into","from","byFrom","get","set","known","key","keys","union","position","undefined","contextCaches","createContextCache","executionOf","info","signal","getAbortSignal","path","typename","variableValues","prev","cache","ctx","executions","execution","cached","places","Map","rows","rowScoped","scopes","placeOf","at","executionPath","place","entriesFor","entries","pathKeys","prefix","executionPaths","String","type","fieldNodeIds","nextFieldNodeId","node","fieldNodes","id","ownerOf","row","claimForRow","mapping","byPlace","own","mappings","previous","owner","parentType","name","ancestor","scope","slice","length"],"mappings":";;;;;;;;;;;QAuBaA;eAAAA;;QAkOGC;eAAAA;;QAgBAC;eAAAA;;QA9EAC;eAAAA;;QAXAC;eAAAA;;QAwLAC;eAAAA;;QAnJAC;eAAAA;;QAkGAC;eAAAA;;QAyBAC;eAAAA;;QAbAC;eAAAA;;QA/RAC;eAAAA;;;sBApCmB;AAuB5B,MAAMV,gBAAyBW,OAAOC,MAAM,CAAC;IAAEC,QAAQF,OAAOC,MAAM,CAAC,CAAC;AAAe;AAE5F,6FAA6F,GAC7F,MAAME,SAAS,IA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B2B,IAAY,EACZO,GAAa;IAEb,MAAM,EAAE/B,IAAI,EAAE,GAAGH;IACjB,MAAMW,SAASJ,MAAMC,KAAKR;IAE1B,IAAIW,OAAOI,SAAS,EAAE;QACpB,MAAM0B,QAAQR,QAAQC;QACtB,MAAMI,MACJG,SACA9B,OAAOG,IAAI,CACRzB,GAAG,CAACoD,QACHpD,IAAI4B,QAAQN,QAAQX,MAAMG,QAC1Bd,IAAIsC;QAEV,IAAIW,KAAK;YACP,OAAOA;QACT;IACF;IAEA,IAAK,IAAIM,WAAWzC,KAAKG,IAAI,EAAEsC,UAAUA,WAAWA,SAAStC,IAAI,CAAE;QACjE,MAAMuC,QAAQlC,OAAOK,MAAM,CAAC3B,GAAG,CAAC4B,QAAQN,QAAQX,MAAM4C;QAEtD,IAAIC,OAAO;YACT,wFAAwF;YACxF,0CAA0C;YAC1C,OACEA,KAAK,CAAC,GAAGlB,KAAK,CAAC,EAAEnD,aAAa2B,MAAM2C,KAAK,CAACtE,aAAaoE,UAAUG,MAAM,GAAG,IAAI,CAAC,IAAI;QAEvF;IACF;IAEA,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pothos/selection-mapper",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "shared selection-to-query walker for Pothos ORM plugins",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./dts/index.d.ts",
package/src/index.ts CHANGED
@@ -13,7 +13,6 @@ export {
13
13
  getLoaderMapping,
14
14
  type Mapping,
15
15
  type Mappings,
16
- setFieldMapping,
17
16
  setLoaderMappings,
18
17
  setRowFieldMapping,
19
18
  setRowMappings,
package/src/loader-map.ts CHANGED
@@ -70,30 +70,22 @@ export function unionMappings(into: Mapping | undefined, from: Mapping): Mapping
70
70
  }
71
71
 
72
72
  /**
73
- * Per execution: the mappings recorded so far, and the keys they were recorded under, by
74
- * the path prefix that rehomed them. `responsePath` drops list indices, so every row of a list
75
- * rebuilds the same key strings; a prefix builds them once.
73
+ * Per execution: the mappings recorded so far.
76
74
  *
77
- * `scopes` holds what a plan recorded beneath a field execution: everything resolved beneath it
78
- * was loaded by that plan, so it answers for all of it, and for nothing else. `rows` holds a
79
- * mapping that answers for one row only — because two plans disagreed about a key, or because the
80
- * plan loaded that row alone. A mapping carries the position a connection pages with, so a row
81
- * answering from another row's mapping would page with arguments its own data was never fetched
82
- * with. `rowScoped` stays false while nothing has been recorded there, so a request whose rows
83
- * were all loaded the same way pays nothing for the row tier.
84
- *
85
- * `mappings` holds a mapping recorded for each path, list indices dropped. It tells whether
86
- * the plans of a path's rows agree (see `claim`), and never answers a lookup: a row at the same
87
- * path that no plan loaded would read it as proof that one had.
75
+ * `scopes` holds what a plan recorded beneath a field execution: everything resolved beneath it was
76
+ * loaded by that plan, so it answers for all of it, and for nothing else. `rows` holds a mapping
77
+ * from a plan that loaded one row alone, and answers for that row only. A mapping carries the
78
+ * position a connection pages with, so a row answering from another row's mapping would page with
79
+ * arguments its own data was never fetched with. `rowScoped` stays false while nothing has been
80
+ * recorded there, so a request whose rows were all loaded the same way pays nothing for the row
81
+ * tier.
88
82
  *
89
83
  * `scopes` and `rows` are keyed by a field execution's place (see `placeOf`), which tells sibling
90
84
  * rows apart, in weak maps: a `Map` holding every path link of a request tripled the time spent
91
85
  * collecting garbage.
92
86
  */
93
87
  interface Cache {
94
- mappings: Map<string, Mapping>;
95
88
  places: Map<string, object>;
96
- rehomed: Map<string, Map<string, string>>;
97
89
  rows: WeakMap<object, WeakMap<object, Map<string, Mapping>>>;
98
90
  rowScoped: boolean;
99
91
  scopes: WeakMap<object, Mappings>;
@@ -142,9 +134,7 @@ function cache(ctx: object, info: GraphQLResolveInfo): Cache {
142
134
 
143
135
  if (!cached) {
144
136
  cached = {
145
- mappings: new Map(),
146
137
  places: new Map(),
147
- rehomed: new Map(),
148
138
  rows: new WeakMap(),
149
139
  rowScoped: false,
150
140
  scopes: new WeakMap(),
@@ -180,8 +170,9 @@ function placeOf(cached: Cache, info: GraphQLResolveInfo, path: GraphQLResolveIn
180
170
  /**
181
171
  * The entries of `cache` for the operation `info` is in. Keyed on its `variableValues`, which
182
172
  * every executor coerces afresh for each operation, so operations sharing a context never share
183
- * an entry. The events of a subscription may share them, so a plan cached here runs its `select`
184
- * and `query` callbacks once for all of them; use `forExecution` where they read per-event state.
173
+ * an entry. The events of a subscription may share one, so a plan cached here runs its `select`
174
+ * and `query` callbacks once for all of them. Use `forExecution` if the callbacks read per-event
175
+ * state.
185
176
  */
186
177
  export function forOperation<T>(
187
178
  cache: WeakMap<object, Map<string, T>>,
@@ -191,9 +182,8 @@ export function forOperation<T>(
191
182
  }
192
183
 
193
184
  /**
194
- * The entries of `cache` for the execution `info` is in, by `executionOf`, as mappings are kept:
195
- * each event of a subscription gets its own, and @defer and @stream payloads share their
196
- * execution's.
185
+ * The entries of `cache` for the execution `info` is in. Each event of a subscription gets its own
186
+ * entries, and `@defer` and `@stream` payloads share the entries of their execution.
197
187
  */
198
188
  export function forExecution<T>(
199
189
  cache: WeakMap<object, Map<string, T>>,
@@ -266,12 +256,12 @@ const fieldNodeIds = new WeakMap<object, number>();
266
256
  let nextFieldNodeId = 0;
267
257
 
268
258
  /**
269
- * `cacheKey(type, info.path)` and the identity of every node in `info.fieldNodes`. The path keeps
270
- * each place in the response apart, list indices aside, so the root fields of a mutation, which run
271
- * in turn and whose callbacks may read what an earlier one changed, never share a plan. The nodes
272
- * decide what a plan loads: fragments on different types can merge different nodes into one
273
- * response path, so a plan keyed on the path alone would be reused for a field asking for
274
- * something else.
259
+ * The key to cache a field's plan under: `cacheKey(type, info.path)` plus an id for each node in
260
+ * `info.fieldNodes`. The path leaves out list indices, so the items of a list share a plan. The
261
+ * root fields of a mutation run in turn, and a callback may read what an earlier field changed.
262
+ * Their paths differ, so each gets its own plan. The nodes are part of the key because fragments on
263
+ * different types can merge different nodes into one response path, and a plan keyed on the path
264
+ * alone would be reused for a field that selects something else.
275
265
  */
276
266
  export function fieldKey(type: string, info: GraphQLResolveInfo): string {
277
267
  let key = cacheKey(type, info.path);
@@ -290,56 +280,11 @@ export function fieldKey(type: string, info: GraphQLResolveInfo): string {
290
280
  return key;
291
281
  }
292
282
 
293
- /**
294
- * The keys `mappings` is recorded under when it is rehomed beneath `prefix`. Built once per
295
- * prefix: the strings depend on the path and the plan's own keys, never on which row is being
296
- * recorded for.
297
- */
298
- function rehomedKeys(cached: Cache, prefix: string) {
299
- let keys = cached.rehomed.get(prefix);
300
-
301
- if (!keys) {
302
- keys = new Map();
303
- cached.rehomed.set(prefix, keys);
304
- }
305
-
306
- return keys;
307
- }
308
-
309
- /** `key`, a plan's own `Type@relative.path`, moved beneath `prefix`. Built once per prefix. */
310
- function rehome(keys: Map<string, string>, key: string, prefix: string) {
311
- let under = keys.get(key);
312
-
313
- if (under === undefined) {
314
- const at = key.indexOf('@');
315
-
316
- under = `${key.slice(0, at)}@${prefix}.${key.slice(at + 1)}`;
317
- keys.set(key, under);
318
- }
319
-
320
- return under;
321
- }
322
-
323
283
  /** `row` if a mapping can be hung off it. A root field resolves with no parent value at all. */
324
284
  function ownerOf(row: unknown): object | null {
325
285
  return typeof row === 'object' && row !== null ? row : null;
326
286
  }
327
287
 
328
- /**
329
- * Records `mapping` at `key` for `row`. An unclaimed key takes it, and a key already holding this
330
- * very mapping needs no write, so the rows after the first write nothing. Only a key two plans
331
- * disagree about gives the row a mapping of its own — or, with no row to hang it off, nothing.
332
- */
333
- function claim(cached: Cache, key: string, mapping: Mapping, row: object | null, place: object) {
334
- const held = cached.mappings.get(key);
335
-
336
- if (held === undefined) {
337
- cached.mappings.set(key, mapping);
338
- } else if (held !== mapping && row) {
339
- claimForRow(cached, key.slice(0, key.indexOf('@')), mapping, row, place);
340
- }
341
- }
342
-
343
288
  /**
344
289
  * Records `mapping` for this field execution against `row` alone.
345
290
  */
@@ -360,21 +305,15 @@ function claimForRow(cached: Cache, type: string, mapping: Mapping, row: object,
360
305
 
361
306
  /**
362
307
  * Records the mappings of a plan rooted at the field `info` resolves, under that field's path.
363
- * The plan loaded the whole field, so its mappings answer for everything resolved beneath this
308
+ * The plan loaded the whole field, so its mappings are used for everything resolved beneath this
364
309
  * execution of it. Multiple plans can contribute to one field (Relay nodes of different model
365
310
  * types share the list's path), so later contributions replace matching keys and retain others.
366
311
  */
367
312
  export function setLoaderMappings(ctx: object, info: GraphQLResolveInfo, mappings: Mappings) {
368
313
  const cached = cache(ctx, info);
369
- const prefix = responsePath(info.path);
370
- const keys = rehomedKeys(cached, prefix);
371
314
  const place = placeOf(cached, info, info.path);
372
315
  const previous = cached.scopes.get(place);
373
316
  cached.scopes.set(place, previous ? { ...previous, ...mappings } : mappings);
374
-
375
- for (const key of Object.keys(mappings)) {
376
- cached.mappings.set(rehome(keys, key, prefix), mappings[key]);
377
- }
378
317
  }
379
318
 
380
319
  /**
@@ -389,28 +328,8 @@ export function setRowMappings(ctx: object, info: GraphQLResolveInfo, mappings:
389
328
  }
390
329
 
391
330
  /**
392
- * Records the mapping of the field `info` resolves (under its own parent type) along with the
393
- * mappings beneath it, so both the field's resolver and the resolvers below it can look
394
- * themselves up. `row` is the value the field is about to resolve with: the parent row when it
395
- * was loaded by the planned query, and the reloaded row when the fallback loader fetched it.
396
- */
397
- export function setFieldMapping(
398
- ctx: object,
399
- info: GraphQLResolveInfo,
400
- mapping: Mapping,
401
- row: unknown,
402
- ) {
403
- const cached = cache(ctx, info);
404
- const place = placeOf(cached, info, info.path);
405
-
406
- claim(cached, cacheKey(info.parentType.name, info.path), mapping, ownerOf(row), place);
407
- cached.scopes.set(place, mapping.nested);
408
- }
409
-
410
- /**
411
- * `setFieldMapping` for a plan that loaded `row` alone: the field's own mapping is recorded
412
- * against `row` rather than claimed for the whole field, so the field's lookup on `row` answers
413
- * from it whatever the field's other rows were loaded with.
331
+ * Records a mapping for `row` only, for the field `info` resolves. Use it when the plan loaded
332
+ * `row` alone. The field's other rows don't use this mapping.
414
333
  *
415
334
  * Descendants inherit the mapping through this field's execution scope, even when their parent
416
335
  * is a child object or a connection wrapper rather than the row that was reloaded.
@@ -435,8 +354,9 @@ export function setRowFieldMapping(
435
354
  /**
436
355
  * The mapping recorded for the field `info` resolves on `row`, preferring one recorded for that
437
356
  * row over the plan's. `row` is the value whose data the mapping describes — the resolver's
438
- * parent. The plan's comes from the nearest field execution above that recorded one: with none
439
- * above, no plan loaded `row`, whatever was recorded for another row at the same path.
357
+ * parent. The plan's mapping comes from the nearest field execution above this one that recorded
358
+ * mappings. Returns `null` if there is none or it has no mapping for this field, even if a mapping
359
+ * was recorded for another row at the same path.
440
360
  */
441
361
  export function getLoaderMapping(
442
362
  ctx: object,