@opensaas/stack-core 0.36.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 (77) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +121 -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/config/index.d.ts +1 -1
  36. package/dist/config/index.d.ts.map +1 -1
  37. package/dist/config/types.d.ts +126 -0
  38. package/dist/config/types.d.ts.map +1 -1
  39. package/dist/context/index.d.ts.map +1 -1
  40. package/dist/context/index.js +38 -27
  41. package/dist/context/index.js.map +1 -1
  42. package/dist/fields/index.d.ts.map +1 -1
  43. package/dist/fields/index.js +28 -5
  44. package/dist/fields/index.js.map +1 -1
  45. package/dist/index.d.ts +1 -1
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js.map +1 -1
  48. package/dist/query/index.d.ts +29 -0
  49. package/dist/query/index.d.ts.map +1 -1
  50. package/dist/query/index.js +27 -0
  51. package/dist/query/index.js.map +1 -1
  52. package/dist/query/relationship-options.d.ts +1 -1
  53. package/dist/query/relationship-options.js +1 -1
  54. package/package.json +1 -1
  55. package/src/access/access-filter.test.ts +205 -275
  56. package/src/access/access-filter.ts +84 -267
  57. package/src/access/declared-dependencies.test.ts +277 -0
  58. package/src/access/declared-dependencies.ts +122 -37
  59. package/src/access/depth-limits.ts +8 -7
  60. package/src/access/errors.ts +16 -12
  61. package/src/access/field-visibility.ts +99 -14
  62. package/src/access/index.ts +1 -7
  63. package/src/access/relationship-count.ts +1 -1
  64. package/src/config/index.ts +2 -0
  65. package/src/config/types.ts +130 -0
  66. package/src/context/index.ts +52 -33
  67. package/src/fields/index.ts +35 -5
  68. package/src/index.ts +2 -0
  69. package/src/query/index.ts +53 -0
  70. package/src/query/relationship-options.ts +1 -1
  71. package/tests/access-relationships.test.ts +18 -16
  72. package/tests/computed-field-selective-evaluation.test.ts +418 -0
  73. package/tests/context.test.ts +27 -0
  74. package/tests/field-types.test.ts +12 -0
  75. package/tests/needs-declared-dependencies.test.ts +7 -4
  76. package/tests/resolve-chain.test.ts +11 -11
  77. package/tsconfig.tsbuildinfo +1 -1
@@ -331,7 +331,7 @@ describe('resolve chain — concurrent hook invocations are isolated (#844)', ()
331
331
  expect(observedLengths.sort()).toEqual([1, 1, 1])
332
332
  })
333
333
 
334
- it('an unrelated top-level read in flight alongside a hook still gets its full explicit include scoped', async () => {
334
+ it('an unrelated top-level read in flight alongside a hook still gets its own explicit include scoped', async () => {
335
335
  let releaseSlowHook: () => void = () => {}
336
336
 
337
337
  const config: OpenSaasConfig = {
@@ -389,21 +389,21 @@ describe('resolve chain — concurrent hook invocations are isolated (#844)', ()
389
389
  await new Promise((resolve) => setTimeout(resolve, 0))
390
390
 
391
391
  // While the slow hook is still in flight, issue a plain top-level read
392
- // that has nothing to do with it. A bare read fetches scalars only
393
- // (ADR-0024), so name `child` explicitlya caller include naming a
394
- // relation BARE (`true`, no nested include of its own) still picks up the
395
- // access-controlled include for whatever lies beneath it.
396
- const fastPromise = context.db.fast.findMany({ include: { child: true } })
392
+ // that has nothing to do with it, explicitly naming a nested path two
393
+ // levels deep (child grandchild) the "One hop" rule (ADR-0026) means
394
+ // reaching grandchild requires naming it, which this request does.
395
+ const fastPromise = context.db.fast.findMany({
396
+ include: { child: { include: { grandchild: true } } },
397
+ })
397
398
 
398
399
  await fastPromise
399
400
  releaseSlowHook()
400
401
  await slowPromise
401
402
 
402
- // The unrelated read's access-controlled scoping must still descend two
403
- // levels deep (child grandchild), not collapse to a bare `{ child: true }`
404
- // because it happened to run while a totally different read's hook was
405
- // active — `insideResolveOutput` must stay scoped to the hook's OWN
406
- // derived context, never leak into a concurrently-running, unrelated one.
403
+ // The unrelated read's access-controlled scoping must descend exactly as
404
+ // far as ITS OWN request named, unaffected by a totally different read's
405
+ // hook being in flight concurrently no shared, leaking context state
406
+ // between the two.
407
407
  expect(prisma.fast.findMany.mock.calls[0][0].include).toEqual({
408
408
  child: { include: { grandchild: true } },
409
409
  })