@opensaas/stack-core 0.37.0 → 0.38.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 (62) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +68 -0
  3. package/CLAUDE.md +21 -3
  4. package/dist/access/access-filter.d.ts +30 -118
  5. package/dist/access/access-filter.d.ts.map +1 -1
  6. package/dist/access/access-filter.js +70 -206
  7. package/dist/access/access-filter.js.map +1 -1
  8. package/dist/access/access-filter.test.js +148 -188
  9. package/dist/access/access-filter.test.js.map +1 -1
  10. package/dist/access/declared-dependencies.d.ts +66 -26
  11. package/dist/access/declared-dependencies.d.ts.map +1 -1
  12. package/dist/access/declared-dependencies.js +67 -17
  13. package/dist/access/declared-dependencies.js.map +1 -1
  14. package/dist/access/declared-dependencies.test.d.ts +2 -0
  15. package/dist/access/declared-dependencies.test.d.ts.map +1 -0
  16. package/dist/access/declared-dependencies.test.js +226 -0
  17. package/dist/access/declared-dependencies.test.js.map +1 -0
  18. package/dist/access/depth-limits.d.ts +8 -7
  19. package/dist/access/depth-limits.d.ts.map +1 -1
  20. package/dist/access/depth-limits.js +8 -7
  21. package/dist/access/depth-limits.js.map +1 -1
  22. package/dist/access/errors.d.ts +12 -8
  23. package/dist/access/errors.d.ts.map +1 -1
  24. package/dist/access/errors.js +16 -12
  25. package/dist/access/errors.js.map +1 -1
  26. package/dist/access/field-visibility.d.ts +2 -1
  27. package/dist/access/field-visibility.d.ts.map +1 -1
  28. package/dist/access/field-visibility.js +91 -17
  29. package/dist/access/field-visibility.js.map +1 -1
  30. package/dist/access/index.d.ts +1 -2
  31. package/dist/access/index.d.ts.map +1 -1
  32. package/dist/access/index.js +1 -1
  33. package/dist/access/index.js.map +1 -1
  34. package/dist/access/relationship-count.d.ts +1 -1
  35. package/dist/context/index.d.ts.map +1 -1
  36. package/dist/context/index.js +38 -27
  37. package/dist/context/index.js.map +1 -1
  38. package/dist/query/index.d.ts +29 -0
  39. package/dist/query/index.d.ts.map +1 -1
  40. package/dist/query/index.js +27 -0
  41. package/dist/query/index.js.map +1 -1
  42. package/dist/query/relationship-options.d.ts +1 -1
  43. package/dist/query/relationship-options.js +1 -1
  44. package/package.json +1 -1
  45. package/src/access/access-filter.test.ts +205 -275
  46. package/src/access/access-filter.ts +84 -267
  47. package/src/access/declared-dependencies.test.ts +277 -0
  48. package/src/access/declared-dependencies.ts +122 -37
  49. package/src/access/depth-limits.ts +8 -7
  50. package/src/access/errors.ts +16 -12
  51. package/src/access/field-visibility.ts +99 -14
  52. package/src/access/index.ts +1 -7
  53. package/src/access/relationship-count.ts +1 -1
  54. package/src/context/index.ts +52 -33
  55. package/src/query/index.ts +53 -0
  56. package/src/query/relationship-options.ts +1 -1
  57. package/tests/access-relationships.test.ts +18 -16
  58. package/tests/computed-field-selective-evaluation.test.ts +418 -0
  59. package/tests/context.test.ts +27 -0
  60. package/tests/needs-declared-dependencies.test.ts +7 -4
  61. package/tests/resolve-chain.test.ts +11 -11
  62. package/tsconfig.tsbuildinfo +1 -1
@@ -1,139 +1,32 @@
1
1
  import { checkAccess, getRelatedListConfig } from './engine.js';
2
2
  import { READ_INCLUDE_MAX_DEPTH } from './depth-limits.js';
3
3
  import { AccessScopeDepthExceededError } from './errors.js';
4
- /**
5
- * Collapse a rich, provenance-carrying include entry down to the plain
6
- * Prisma-shaped form. A `nested` result that is `depth-exceeded` or
7
- * `nothing-to-scope` contributes no `include` key — this is the AUTO-include
8
- * silently stopping, which is correct when no caller asked for anything past
9
- * this point (see `AccessIncludeResult` doc comment).
10
- */
11
- function toPrismaEntry(entry) {
12
- const result = {};
13
- if (entry.where)
14
- result.where = entry.where;
15
- if (entry.nested.kind === 'scoped') {
16
- const nestedInclude = toPrismaInclude(entry.nested);
17
- if (nestedInclude && Object.keys(nestedInclude).length > 0) {
18
- result.include = nestedInclude;
19
- }
20
- }
21
- return Object.keys(result).length > 0 ? result : true;
22
- }
23
- /**
24
- * Collapse an `AccessIncludeResult` to the plain Prisma `include` shape used
25
- * when there is no caller-supplied include to merge against (the direct
26
- * auto-include path). `nothing-to-scope` and `depth-exceeded` both become
27
- * `undefined` here — at this call site nothing was explicitly requested past
28
- * either boundary, so there is nothing to deny.
29
- */
30
- export function toPrismaInclude(result) {
31
- if (result.kind !== 'scoped')
32
- return undefined;
33
- const out = {};
34
- for (const [key, entry] of Object.entries(result.include)) {
35
- out[key] = toPrismaEntry(entry);
36
- }
37
- return out;
38
- }
39
- /**
40
- * Build the access-controlled include for a list's fields.
41
- *
42
- * This allows us to filter relationships at the database level instead of in
43
- * memory. Returns an {@link AccessIncludeResult} rather than a plain include
44
- * object so that `mergeIncludeWithAccessControl` can tell a genuine "nothing
45
- * to scope" apart from "the engine hit its depth cap" (see that type's doc
46
- * comment and ADR-0022).
47
- */
48
- export async function buildIncludeWithAccessControl(fieldConfigs, args, config, depth = 0,
49
- // List names already on the path from the root to here. Used to detect
50
- // relationship cycles (A → B → … → A) and stop the auto-include from
51
- // re-descending them. Seed it with the root list name at the call site.
52
- visitedLists = []) {
53
- if (depth >= READ_INCLUDE_MAX_DEPTH) {
54
- return { kind: 'depth-exceeded' };
55
- }
56
- // Inside a resolveOutput/virtual-field context we still scope each immediate
57
- // relation (its own access `where`), but do not auto-expand INTO its nested
58
- // relations — this keeps a single hook-issued read's include from growing
59
- // depth-first. Correction (ADR-0023): this does NOT by itself terminate a
60
- // cycle, despite what an earlier version of this comment claimed. A
61
- // self-referential relation read from inside a hook is a NEW top-level
62
- // read, invisible to this function's own recursion — the loop runs through
63
- // the hook↔read boundary, not through repeated calls to
64
- // `buildIncludeWithAccessControl`. Loop termination is the resolve chain's
65
- // job: `field-visibility.ts`'s `resolveReadableFieldValue` refuses to
66
- // re-enter a `(list, field)` pair already on the chain. What this check
67
- // still does correctly is row-scope the immediate relation rather than
68
- // skipping scoping altogether (issue #830's second trigger).
69
- const insideResolveOutput = args.context._resolveOutputChain.length > 0;
70
- const include = {};
71
- let hasRelationships = false;
72
- for (const [fieldName, fieldConfig] of Object.entries(fieldConfigs)) {
73
- if (fieldConfig?.type === 'relationship' && 'ref' in fieldConfig && fieldConfig.ref) {
74
- hasRelationships = true;
75
- const relatedConfig = getRelatedListConfig(fieldConfig.ref, config);
76
- if (relatedConfig) {
77
- // Check query access for the related list
78
- const queryAccess = relatedConfig.listConfig.access?.operation?.query;
79
- const accessResult = await checkAccess(queryAccess, {
80
- session: args.session,
81
- context: args.context,
82
- });
83
- // If access is completely denied, exclude this relationship
84
- if (accessResult === false) {
85
- continue;
86
- }
87
- const where = typeof accessResult === 'object' ? accessResult : undefined;
88
- // Cycle guard: if the related list already appears on the path from the
89
- // root, DO NOT auto-include its relationships again. On a cyclic
90
- // readable-relationship graph (A → B → … → A) the depth-first walk would
91
- // otherwise re-descend the cycle on every branch, and — combined with the
92
- // bare-`true` leaf re-expansion in `mergeIncludeWithAccessControl` — build
93
- // an include tree deep/large enough to overflow the call stack in
94
- // downstream processing (the RSC serializer's recursive `Map.set`). This
95
- // extends the SF-20 (#566) fix: a bare-`true` leaf must resolve to a
96
- // genuine single-level fetch, not a re-expansion of the full auto-include.
97
- // The relation itself is still included (as a FLAT fetch of its own
98
- // columns); only its onward relationships are pruned at the back-edge.
99
- let nested = { kind: 'nothing-to-scope' };
100
- const relatedListName = relatedConfig.listName;
101
- if (!insideResolveOutput && !visitedLists.includes(relatedListName)) {
102
- nested = await buildIncludeWithAccessControl(relatedConfig.listConfig.fields, args, config, depth + 1, [...visitedLists, relatedListName]);
103
- }
104
- include[fieldName] = { where, nested };
105
- }
106
- }
107
- }
108
- return hasRelationships ? { kind: 'scoped', include } : { kind: 'nothing-to-scope' };
4
+ /** A plain object — excludes `null` and arrays, which `typeof x === 'object'` alone would admit. */
5
+ function isPlainObject(value) {
6
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
109
7
  }
110
8
  /**
111
9
  * Narrow an unknown include value to the structured object form (vs bare `true`
112
10
  * or any other primitive). Caller-supplied includes arrive untyped at the
113
- * runtime boundary, so we validate the shape here rather than casting.
11
+ * runtime boundary: narrow to a plain object first, then validate each field's
12
+ * own type before trusting it, rather than casting the whole value wholesale.
114
13
  *
115
14
  * A numeric `take` on a to-many relation include (a caller-supplied row bound,
116
15
  * issue #752) is carried through: it only ever NARROWS the fetched rows and can
117
- * never widen past the access `where`, so preserving it is access-neutral. The
118
- * access-controlled include never sets `take` itself — it originates solely
119
- * from the caller — so `mergeIncludeWithAccessControl` re-attaches it below.
16
+ * never widen past the access `where`, so preserving it is access-neutral.
120
17
  */
121
18
  function asEntryObject(value) {
122
- if (value && typeof value === 'object') {
123
- const obj = value;
124
- const where = obj.where;
125
- const include = obj.include;
126
- const take = obj.take;
127
- const entry = {};
128
- if (where && typeof where === 'object')
129
- entry.where = where;
130
- if (include && typeof include === 'object')
131
- entry.include = include;
132
- if (typeof take === 'number')
133
- entry.take = take;
134
- return entry;
135
- }
136
- return null;
19
+ if (!isPlainObject(value))
20
+ return null;
21
+ const { where, include, take } = value;
22
+ const entry = {};
23
+ if (isPlainObject(where))
24
+ entry.where = where;
25
+ if (isPlainObject(include))
26
+ entry.include = include;
27
+ if (typeof take === 'number')
28
+ entry.take = take;
29
+ return entry;
137
30
  }
138
31
  /**
139
32
  * AND-combine an access `where` with a caller-supplied nested `where`.
@@ -150,104 +43,75 @@ function andWhere(accessWhere, callerWhere) {
150
43
  return accessWhere ?? callerWhere;
151
44
  }
152
45
  /**
153
- * Merge a caller-supplied `include` with the access-controlled include — phase-1
154
- * row/relation scoping for explicit caller selections.
155
- *
156
- * The caller's `include` decides WHICH relations to fetch; access control decides
157
- * WHETHER each relation may be fetched and WITH WHAT filter. Replacing the
158
- * access-controlled include with the caller's wholesale (the bug in #566) drops
159
- * every per-relation access `where` and denied-relation exclusion, silently
160
- * bypassing row-level access on any non-sudo read that passes `include`.
46
+ * Build the access-scoped `include` for exactly the relations a read
47
+ * requested, recursing only into branches `requestedInclude` itself names.
161
48
  *
162
- * For each relation the caller asks to include:
163
- * - If the relation is a config-declared relationship but is ABSENT from the
164
- * access-controlled include, its `query` access returned `false` it is DROPPED
165
- * (not fetched).
166
- * - If it is present (allowed, possibly with a filter), the access entry is used
167
- * as the base: the access `where` is AND-combined with any caller-supplied
168
- * nested `where`, and nested includes are recursively merged using the related
169
- * list's field configs (so deeply-nested selections are filtered at every
170
- * level). A bare caller `true` becomes the access-controlled shape (filter +
171
- * nested filtered include), never bare `true`.
172
- * - If the caller names a key that is NOT a config-declared relationship, it is
173
- * passed through unchanged (access control does not govern it).
49
+ * For each key in `requestedInclude`:
50
+ * - Not a config-declared relationship access control does not govern it;
51
+ * passed through unchanged (e.g. a fragment/caller key that isn't a
52
+ * relationship at all).
53
+ * - A declared relationship whose related list's `query` access denies it
54
+ * (`=== false`) dropped entirely, no matter what the request asked for
55
+ * nested beneath it (#566): the caller chooses *which* relations, access
56
+ * control chooses *whether* and *with what filter*.
57
+ * - Otherwise the access `where` is AND-combined with any caller-supplied
58
+ * nested `where` (never replaced — the other half of #566), a
59
+ * caller-supplied `take` rides through unchanged (#752), and the "One
60
+ * hop" rule (ADR-0026) nested relations are scoped ONLY if
61
+ * `requestedInclude` itself named a nested `include` here. A bare relation
62
+ * (or one with no nested `include`) fetches its own columns and stops: no
63
+ * recursive call, no access evaluation on anything beneath it.
174
64
  *
175
- * `accessControlledInclude` is the {@link AccessIncludeResult} for THIS level:
176
- * - `nothing-to-scope` nothing to merge against (the list has no
177
- * relationships, or we're inside a resolveOutput context where the caller
178
- * include is irrelevant to begin with). Pass the caller's include through
179
- * unchanged this is a non-denial outcome, not "every relation denied".
180
- * - `depth-exceeded` the engine could not compute a scope for THIS level at
181
- * all because it sits at or past `READ_INCLUDE_MAX_DEPTH`. If the caller
182
- * named anything here, that is exactly the case that used to pass through
183
- * unscoped (issue #830): throw `AccessScopeDepthExceededError` instead. An
184
- * empty caller include at this level (nothing further requested) is not an
185
- * error — there's simply nothing to do.
186
- * - `scoped` → the normal per-relation merge below: a declared relationship
187
- * ABSENT from the access include was denied (drop it); one PRESENT is used
188
- * as the base, AND-combining `where`s and recursing into nested includes.
189
- *
190
- * `listKey` and `depth` are carried only to build a useful
191
- * `AccessScopeDepthExceededError` message; they do not affect merge behaviour.
65
+ * **Depth is a cost limit, not a cycle guard (ADR-0026).** A `requestedInclude`
66
+ * is always a finite literal the caller's own object, or
67
+ * `foldDeclaredDependencies`'s already-cycle-guarded fold so this recursion
68
+ * cannot loop unboundedly on its own; nothing here walks the relationship
69
+ * graph unprompted. `READ_INCLUDE_MAX_DEPTH` still bounds how deep a request
70
+ * may reach, fail-closed per ADR-0022: a request naming anything at or past
71
+ * the cap throws `AccessScopeDepthExceededError` rather than silently
72
+ * returning less than what was asked for.
192
73
  */
193
- export function mergeIncludeWithAccessControl(callerInclude, accessControlledInclude, fieldConfigs, config, listKey, depth = 0) {
194
- if (accessControlledInclude.kind === 'nothing-to-scope') {
195
- return callerInclude;
74
+ export async function buildAccessScopedInclude(requestedInclude, fieldConfigs, args, config, listKey, depth = 0) {
75
+ const requestedKeys = Object.keys(requestedInclude);
76
+ if (depth >= READ_INCLUDE_MAX_DEPTH && requestedKeys.length > 0) {
77
+ throw new AccessScopeDepthExceededError(listKey, requestedKeys[0], depth);
196
78
  }
197
- if (accessControlledInclude.kind === 'depth-exceeded') {
198
- const [firstRelationName] = Object.keys(callerInclude);
199
- if (firstRelationName !== undefined) {
200
- throw new AccessScopeDepthExceededError(listKey, firstRelationName, depth);
201
- }
202
- return {};
203
- }
204
- const merged = {};
205
- const accessInclude = accessControlledInclude.include;
206
- for (const [relationName, callerValue] of Object.entries(callerInclude)) {
79
+ const result = {};
80
+ for (const [relationName, requestedValue] of Object.entries(requestedInclude)) {
207
81
  const fieldConfig = fieldConfigs[relationName];
208
82
  const isDeclaredRelationship = fieldConfig?.type === 'relationship' && 'ref' in fieldConfig && !!fieldConfig.ref;
209
- // Not a config-declared relationship → access control does not govern it; pass through unchanged.
210
83
  if (!isDeclaredRelationship) {
211
- merged[relationName] = callerValue;
212
- continue;
213
- }
214
- const accessEntry = accessInclude[relationName];
215
- // Declared relationship absent from the access include → query access denied → drop it.
216
- if (accessEntry === undefined) {
84
+ result[relationName] = requestedValue;
217
85
  continue;
218
86
  }
219
- const callerEntry = asEntryObject(callerValue);
220
- // Resolve the related list's field configs so nested includes merge recursively.
221
87
  const relatedConfig = getRelatedListConfig(fieldConfig.ref, config);
222
- const relatedFields = relatedConfig?.listConfig.fields;
223
- const mergedWhere = andWhere(accessEntry.where, callerEntry?.where);
224
- let mergedNested;
225
- if (callerEntry?.include && relatedFields && relatedConfig) {
226
- // Recurse: scope the caller's nested selection against the nested access
227
- // result. If that result is 'depth-exceeded', the recursive call itself
228
- // throws — the caller named something the engine cannot scope.
229
- mergedNested = mergeIncludeWithAccessControl(callerEntry.include, accessEntry.nested, relatedFields, config, relatedConfig.listName, depth + 1);
88
+ if (!relatedConfig)
89
+ continue;
90
+ const queryAccess = relatedConfig.listConfig.access?.operation?.query;
91
+ const accessResult = await checkAccess(queryAccess, {
92
+ session: args.session,
93
+ context: args.context,
94
+ });
95
+ if (accessResult === false) {
96
+ continue;
230
97
  }
231
- else if (accessEntry.nested.kind === 'scoped') {
232
- // Caller selected the relation bare (no nested include); keep the
233
- // access-controlled nested include so deeper relations stay filtered.
234
- mergedNested = toPrismaInclude(accessEntry.nested);
98
+ const accessWhere = typeof accessResult === 'object' ? accessResult : undefined;
99
+ const requestedEntry = asEntryObject(requestedValue);
100
+ const mergedWhere = andWhere(accessWhere, requestedEntry?.where);
101
+ let nestedInclude;
102
+ if (requestedEntry?.include) {
103
+ nestedInclude = await buildAccessScopedInclude(requestedEntry.include, relatedConfig.listConfig.fields, args, config, relatedConfig.listName, depth + 1);
235
104
  }
236
- // If the caller's entry has no nested include, a 'depth-exceeded' nested
237
- // result is silent here too — nothing was asked for past this point.
238
105
  const entry = {};
239
106
  if (mergedWhere)
240
107
  entry.where = mergedWhere;
241
- if (mergedNested && Object.keys(mergedNested).length > 0)
242
- entry.include = mergedNested;
243
- // Preserve a caller-supplied row bound on the relation (issue #752). It only
244
- // narrows, never widens, so it rides on top of the access `where`/include.
245
- if (callerEntry?.take !== undefined)
246
- entry.take = callerEntry.take;
247
- // A bare-`true` relation with no access filter, nested include, or row bound stays `true`.
248
- merged[relationName] = Object.keys(entry).length > 0 ? entry : true;
108
+ if (nestedInclude && Object.keys(nestedInclude).length > 0)
109
+ entry.include = nestedInclude;
110
+ if (requestedEntry?.take !== undefined)
111
+ entry.take = requestedEntry.take;
112
+ result[relationName] = Object.keys(entry).length > 0 ? entry : true;
249
113
  }
250
- return merged;
114
+ return result;
251
115
  }
252
116
  /**
253
117
  * Remove keys that correspond to `virtual` fields from a Prisma `include`
@@ -1 +1 @@
1
- {"version":3,"file":"access-filter.js","sourceRoot":"","sources":["../../src/access/access-filter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAoD3D;;;;;;GAMG;AACH,SAAS,aAAa,CAAC,KAAuB;IAC5C,MAAM,MAAM,GAAsD,EAAE,CAAA;IACpE,IAAI,KAAK,CAAC,KAAK;QAAE,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;IAC3C,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACnC,MAAM,aAAa,GAAG,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QACnD,IAAI,aAAa,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3D,MAAM,CAAC,OAAO,GAAG,aAAa,CAAA;QAChC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,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