viborm 1.10.0 → 1.12.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 (136) hide show
  1. package/dist/adapters.d.mts +1 -1
  2. package/dist/adapters.mjs +1 -1
  3. package/dist/builder-CUyS5pxN.mjs +2 -0
  4. package/dist/builder-CUyS5pxN.mjs.map +1 -0
  5. package/dist/bun-sql.d.mts +1 -1
  6. package/dist/bun-sql.mjs +1 -1
  7. package/dist/bun-sqlite.d.mts +1 -1
  8. package/dist/bun-sqlite.mjs +1 -1
  9. package/dist/cache/cloudflare-kv.d.mts +1 -1
  10. package/dist/cache/memory.d.mts +1 -1
  11. package/dist/cache.d.mts +1 -1
  12. package/dist/cache.mjs +1 -1
  13. package/dist/chain-CoOL8l4W.mjs +2 -0
  14. package/dist/chain-CoOL8l4W.mjs.map +1 -0
  15. package/dist/cli.mjs +1 -1
  16. package/dist/{client-C4vu0G3p.d.mts → client-DMbHPHC_.d.mts} +1 -1
  17. package/dist/client-Db-sVg93.mjs +2 -0
  18. package/dist/client-Db-sVg93.mjs.map +1 -0
  19. package/dist/{client-BJuTpcYj.mjs → client-Dpgesimv.mjs} +3 -3
  20. package/dist/{client-BJuTpcYj.mjs.map → client-Dpgesimv.mjs.map} +1 -1
  21. package/dist/client.d.mts +2 -2
  22. package/dist/client.mjs +1 -1
  23. package/dist/config.d.mts +1 -1
  24. package/dist/config.mjs +1 -1
  25. package/dist/d1.d.mts +1 -1
  26. package/dist/d1.mjs +1 -1
  27. package/dist/driver.d.mts +1 -1
  28. package/dist/every-B1gLSYOW.mjs +2 -0
  29. package/dist/{every-CyllpuCG.mjs.map → every-B1gLSYOW.mjs.map} +1 -1
  30. package/dist/{identifier-conversion-BVE8cfFA.mjs → identifier-conversion-D3oCaSia.mjs} +2 -2
  31. package/dist/{identifier-conversion-BVE8cfFA.mjs.map → identifier-conversion-D3oCaSia.mjs.map} +1 -1
  32. package/dist/{index-BCPc_r4I.d.mts → index-B4Bo2kEi.d.mts} +694 -448
  33. package/dist/index.d.mts +2 -2
  34. package/dist/index.mjs +1 -1
  35. package/dist/instrumentation.d.mts +1 -1
  36. package/dist/instrumentation.mjs +1 -1
  37. package/dist/{libsql-CcKrXiun.mjs → libsql-C4sm2U20.mjs} +2 -2
  38. package/dist/{libsql-CcKrXiun.mjs.map → libsql-C4sm2U20.mjs.map} +1 -1
  39. package/dist/libsql.d.mts +1 -1
  40. package/dist/libsql.mjs +1 -1
  41. package/dist/{memory-B0HOEpPu.mjs → memory-BXOh0pq2.mjs} +2 -2
  42. package/dist/{memory-B0HOEpPu.mjs.map → memory-BXOh0pq2.mjs.map} +1 -1
  43. package/dist/migrations/mysql.d.mts +4 -4
  44. package/dist/migrations/mysql.mjs +1 -1
  45. package/dist/migrations/postgres.d.mts +4 -4
  46. package/dist/migrations/postgres.mjs +1 -1
  47. package/dist/migrations/sqlite.d.mts +4 -4
  48. package/dist/migrations/sqlite.mjs +1 -1
  49. package/dist/migrations/tenant.d.mts +2 -2
  50. package/dist/migrations/tenant.mjs +1 -1
  51. package/dist/migrations.d.mts +4 -4
  52. package/dist/migrations.mjs +1 -1
  53. package/dist/model-u8Ug971J.mjs.map +1 -1
  54. package/dist/{mysql-sGTzkV2q.mjs → mysql-BR0XTumr.mjs} +2 -2
  55. package/dist/{mysql-sGTzkV2q.mjs.map → mysql-BR0XTumr.mjs.map} +1 -1
  56. package/dist/mysql-adapter-BZtZrWeX.mjs +2 -0
  57. package/dist/mysql-adapter-BZtZrWeX.mjs.map +1 -0
  58. package/dist/mysql2.d.mts +1 -1
  59. package/dist/mysql2.mjs +1 -1
  60. package/dist/neon-http.d.mts +1 -1
  61. package/dist/neon-http.mjs +1 -1
  62. package/dist/{object-store-Dq6MthBh.d.mts → object-store-BI1YgcZ9.d.mts} +3 -3
  63. package/dist/on.d.mts +1 -1
  64. package/dist/on.mjs +1 -1
  65. package/dist/on.mjs.map +1 -1
  66. package/dist/ordering.d.mts +47 -36
  67. package/dist/ordering.mjs +1 -1
  68. package/dist/ordering.mjs.map +1 -1
  69. package/dist/permissions.d.mts +16 -9
  70. package/dist/permissions.mjs +1 -1
  71. package/dist/permissions.mjs.map +1 -1
  72. package/dist/pg.d.mts +1 -1
  73. package/dist/pg.mjs +1 -1
  74. package/dist/pglite.d.mts +1 -1
  75. package/dist/pglite.mjs +1 -1
  76. package/dist/planetscale.d.mts +1 -1
  77. package/dist/planetscale.mjs +1 -1
  78. package/dist/{planner-CTJ_dhbu.d.mts → planner-rsXqQbJR.d.mts} +1 -1
  79. package/dist/{postgres-C2uUUh0t.mjs → postgres-CrjBX4Yj.mjs} +2 -2
  80. package/dist/{postgres-C2uUUh0t.mjs.map → postgres-CrjBX4Yj.mjs.map} +1 -1
  81. package/dist/{postgres-adapter-CK1Ytkt1.mjs → postgres-adapter--PJvhRSM.mjs} +2 -2
  82. package/dist/{postgres-adapter-CK1Ytkt1.mjs.map → postgres-adapter--PJvhRSM.mjs.map} +1 -1
  83. package/dist/postgres-adapter-BJcelBCx.mjs +2 -0
  84. package/dist/postgres-adapter-BJcelBCx.mjs.map +1 -0
  85. package/dist/postgres.d.mts +1 -1
  86. package/dist/postgres.mjs +1 -1
  87. package/dist/{result-shape-B_hdiom4.mjs → result-shape-BPdZ1rUk.mjs} +2 -2
  88. package/dist/{result-shape-B_hdiom4.mjs.map → result-shape-BPdZ1rUk.mjs.map} +1 -1
  89. package/dist/rows-C4hPsLfi.mjs +2 -0
  90. package/dist/rows-C4hPsLfi.mjs.map +1 -0
  91. package/dist/schema/json.d.mts +7 -2
  92. package/dist/schema/json.mjs +1 -1
  93. package/dist/schema/json.mjs.map +1 -1
  94. package/dist/{schema-DYPfTOQl.mjs → schema-C8_nS6Ub.mjs} +2 -2
  95. package/dist/{schema-DYPfTOQl.mjs.map → schema-C8_nS6Ub.mjs.map} +1 -1
  96. package/dist/{schema-introspection-DilpMD0-.mjs → schema-introspection-BiG5153d.mjs} +2 -2
  97. package/dist/{schema-introspection-DilpMD0-.mjs.map → schema-introspection-BiG5153d.mjs.map} +1 -1
  98. package/dist/schema.d.mts +2 -2
  99. package/dist/schema.mjs +1 -1
  100. package/dist/select-assembly-Dcaqm09G.mjs.map +1 -1
  101. package/dist/soft-delete.d.mts +10 -10
  102. package/dist/soft-delete.mjs.map +1 -1
  103. package/dist/sqlite-adapter-CMRvEsOv.mjs +2 -0
  104. package/dist/sqlite-adapter-CMRvEsOv.mjs.map +1 -0
  105. package/dist/sqlite3.d.mts +1 -1
  106. package/dist/sqlite3.mjs +1 -1
  107. package/dist/{to-many-5gt2AWLE.mjs → to-many-CMK2Ys4N.mjs} +2 -2
  108. package/dist/{to-many-5gt2AWLE.mjs.map → to-many-CMK2Ys4N.mjs.map} +1 -1
  109. package/dist/types-C4v6iAmY.mjs.map +1 -1
  110. package/dist/{utils-CmNRGkRq.mjs → utils-BLIPe1Cb.mjs} +2 -2
  111. package/dist/{utils-CmNRGkRq.mjs.map → utils-BLIPe1Cb.mjs.map} +1 -1
  112. package/dist/validation.d.mts +1 -1
  113. package/dist/validation.mjs +1 -1
  114. package/dist/validator-CtSM_qvW.mjs +2 -0
  115. package/dist/validator-CtSM_qvW.mjs.map +1 -0
  116. package/dist/version-BPr1CKHw.mjs +2 -0
  117. package/dist/{version-COPScbnP.mjs.map → version-BPr1CKHw.mjs.map} +1 -1
  118. package/package.json +17 -17
  119. package/dist/builder-CK7lE3ee.mjs +0 -2
  120. package/dist/builder-CK7lE3ee.mjs.map +0 -1
  121. package/dist/chain-BJa7ew8x.mjs +0 -2
  122. package/dist/chain-BJa7ew8x.mjs.map +0 -1
  123. package/dist/client-BTF53MwW.mjs +0 -2
  124. package/dist/client-BTF53MwW.mjs.map +0 -1
  125. package/dist/every-CyllpuCG.mjs +0 -2
  126. package/dist/mysql-adapter-CWisQgdc.mjs +0 -2
  127. package/dist/mysql-adapter-CWisQgdc.mjs.map +0 -1
  128. package/dist/postgres-adapter-BnqAsfkG.mjs +0 -2
  129. package/dist/postgres-adapter-BnqAsfkG.mjs.map +0 -1
  130. package/dist/rows-DVyzZyFn.mjs +0 -2
  131. package/dist/rows-DVyzZyFn.mjs.map +0 -1
  132. package/dist/sqlite-adapter-BHx--tnz.mjs +0 -2
  133. package/dist/sqlite-adapter-BHx--tnz.mjs.map +0 -1
  134. package/dist/validator-CYKdGTvX.mjs +0 -2
  135. package/dist/validator-CYKdGTvX.mjs.map +0 -1
  136. package/dist/version-COPScbnP.mjs +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"version-COPScbnP.mjs","names":["packageMetadata.version"],"sources":["../package.json","../src/version.ts"],"sourcesContent":["","import packageMetadata from \"../package.json\";\n\n/** Package version shared by runtime surfaces and bundled from package.json. */\nexport const VIBORM_VERSION = packageMetadata.version;\n"],"mappings":"ACGA,MAAa"}
1
+ {"version":3,"file":"version-BPr1CKHw.mjs","names":["packageMetadata.version"],"sources":["../package.json","../src/version.ts"],"sourcesContent":["","import packageMetadata from \"../package.json\";\n\n/** Package version shared by runtime surfaces and bundled from package.json. */\nexport const VIBORM_VERSION = packageMetadata.version;\n"],"mappings":"ACGA,MAAa"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viborm",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "description": "Type-safe ORM for PostgreSQL, MySQL, and SQLite with a Prisma-inspired API",
5
5
  "repository": {
6
6
  "type": "git",
@@ -402,29 +402,29 @@
402
402
  "name": "D1 Worker (viborm/d1)",
403
403
  "path": "node_modules/.cache/viborm-size/d1-worker.mjs",
404
404
  "gzip": true,
405
- "limit": "199.9 kB",
406
- "message": "Raised 170 → 171.9 kB by the measured +1,868 B of RBAC M1 wave 1 (OD-17): rows predicates admitted, layered and parameterized, numbered binds, bound views. Raised 171.9 → 177.6 kB by the measured +5,630 B (177.29 kB) of RBAC M2 wave 4 (K4 produced rows judged in the statement, K5 evidence and read-gated fields; OD-17, measured + 0.3 kB headroom). Raised 177.6 → 179 kB by the measured +1,355 B (178.65 kB) of RBAC M2 wave 5 (E5: shared relation bodies, D1 balanced conjunctions, the judged write's own sentinel, the allocation fixes; the uncacheable control, OD-10; OD-17, measured + 0.3 kB headroom). Raised 179 → 179.7 kB by the measured 179.37 kB of the RBAC second review's fixes (2026-10-17): per-dialect produced rows for a judged createMany (ENG-3, setOperations.typedRows), caller SQL kept out of shared-body keys (ENG-4, Sql.peekRuns), isolated nesting levels where deepExpressions is false (ENG-6, subqueries.isolated) (OD-17, measured rounded up to 0.1 kB + 0.3 kB). Permissions application reuse (2026-10-18) measures 179,947 B: private policy-definition caching, immutable row admission and control-reference reuse. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.2 (2026-10-19) measures 182,905 B: per-model policy compilation (lazy rows.verbs entries admitted on first use, lazy acyclic, per-chain reference checks), $exists and { $row, up } in row predicates (admission, preparation and lowering frames, shared or correlated bodies, the write re-judgement that reads them), and repeated bodies shared in UPDATE and DELETE statements. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.3 (2026-10-19) measures 183,229 B: to-one relation ordering through one LEFT JOIN, the mixed-direction cursor bound, outer-reference chains joined into one EXISTS, merged quantifiers, shared bodies in located lookups, the NOT MATERIALIZED spelling, the upsert refusal's cause; schema validation rules no longer kept (-1.65 kB). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.4.0 (2026-10-20) measures 187,904 B: writes answering relation projections in their own statement, findUnique batching (+1.75 kB), the undefined bulk-where refusal and $extends result computed fields (+2.2 kB), SQLite AS MATERIALIZED nested bodies, single-window distinct, junction-joined many-to-many filters on SQLite. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Neki relation budget (2026-10-21) measures 191,623 B: recursive walks carrying the columns their next hop reads, and past 256 relations a statement's repeated walks as one reaching set and rows joined to the key sets they test, one-column sets held as PostgreSQL arrays (relationsPerStatement: stated, or 256 where a PostgreSQL driver reads Neki from its first connection's startup or first refusal; D1 256). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Nested-write round trips (2026-10-22) measures 192,646 B: a nested write answering its result out of its root statement, a nested root update locating its row in its own UPDATE, and an upsert probe holding the row it finds on PostgreSQL (locksMissingKeys). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. To-many targets read together (2026-10-22) measures 193,276 B: a to-many connect or set reading its targets in one statement and linking them in one INSERT (Selection.rows, linkMany). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Shared connect UPDATEs and batched planning reads (2026-10-23) measure 194,142 B: reference-side connect and set targets moved by one UPDATE (updateRows), and on D1 and Neon HTTP a nested write’s planning lookups read in one read-only batch (readTogether). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. The 1.4.1 fixes (opt-in findUnique batching in its leader's context, non-null unique selectors, grouped batch-route reads, indexed target matching; 2026-10-24) measure 195.25 kB on CI's Node 22.12 build, so 194.5 kB → 195.6 kB under the same OD-17 rule. 1.5.1 (2026-10-26) measures 195,680 B: provider codes of any SQLSTATE-shaped class kept, a PostgreSQL connection lost under a statement mapped to a retryable ConnectionError, a migration failure keeping its cause's disclosure, and the client symbol migrations read diagnostics through; 195.6 kB → 196 kB under the same OD-17 rule. The statements a write hook costs, lowered (2026-10-29): a PostgreSQL upsert keeps its one INSERT … ON CONFLICT and reads its arm from RETURNING (adapter.mutations.upserted, xmax = 0), and without RETURNING a createMany whose rows carry their keys is one INSERT plus one read and a delete with a scalar select locks and reads its rows in one SELECT … FOR UPDATE: measures 196.25 kB; 196 kB → 196.6 kB under the same OD-17 rule. viborm/on nested writes and onError (2026-10-29: nested rows captured by key in the operation's own unit, nested updateMany/deleteMany from their own RETURNING, a failing hook reported to onError instead of failing its committed write) measures 197.07 kB; 196.6 kB → 197.4 kB under the same OD-17 rule. viborm/ordering's core seam (2026-10-31: the order capability (a model's default order threaded with the call's row facts, applied at root reads, to-many relation reads and paged aggregate windows, keyed into cached reads), computed insert values (an extension's create stamp the INSERT computes once its rows are final), and model factories receiving the client scope) measures 197.8 kB; 197.4 kB → 198.1 kB under the same OD-17 rule. viborm/ordering's move in one UPDATE (2026-10-31: an update's data may hold an extension-computed value, set aside from admission and replaced by its expression before the SET) measures 198.17 kB; 198.1 kB → 198.5 kB under the same OD-17 rule. The extensions-composition PR's the core seam extensions compose through (2026-11-01: RowsOf, an extension's own SQL taking the call's row domain and an admitted where; JoinedValue and adapter.mutations.updateFrom, an updateMany value read from a derived table its UPDATE joins; a MySQL lock's captured keys handed to the write) measures 198.61 kB; 198.5 kB → 199 kB under the same OD-17 rule. A policy's tenant (2026-11-02: the bound a layer's own related rows put on the sets its predicates compute over a whole table, read positively, and the polarity of what a rule reads, so a negative test is never bounded) measures 199.03 kB; 199 kB → 199.4 kB under the same OD-17 rule. V2 as an opt-in (2026-11-03: `recurse: { selective: true }`, the closure flag, the enclosing-body frames and the read count that decide which stated walks are lifted) measures 199.6 kB on CI's Node 22.12 build; 199.4 kB → 199.9 kB under the same OD-17 rule."
405
+ "limit": "205.5 kB",
406
+ "message": "Raised 170 → 171.9 kB by the measured +1,868 B of RBAC M1 wave 1 (OD-17): rows predicates admitted, layered and parameterized, numbered binds, bound views. Raised 171.9 → 177.6 kB by the measured +5,630 B (177.29 kB) of RBAC M2 wave 4 (K4 produced rows judged in the statement, K5 evidence and read-gated fields; OD-17, measured + 0.3 kB headroom). Raised 177.6 → 179 kB by the measured +1,355 B (178.65 kB) of RBAC M2 wave 5 (E5: shared relation bodies, D1 balanced conjunctions, the judged write's own sentinel, the allocation fixes; the uncacheable control, OD-10; OD-17, measured + 0.3 kB headroom). Raised 179 → 179.7 kB by the measured 179.37 kB of the RBAC second review's fixes (2026-10-17): per-dialect produced rows for a judged createMany (ENG-3, setOperations.typedRows), caller SQL kept out of shared-body keys (ENG-4, Sql.peekRuns), isolated nesting levels where deepExpressions is false (ENG-6, subqueries.isolated) (OD-17, measured rounded up to 0.1 kB + 0.3 kB). Permissions application reuse (2026-10-18) measures 179,947 B: private policy-definition caching, immutable row admission and control-reference reuse. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.2 (2026-10-19) measures 182,905 B: per-model policy compilation (lazy rows.verbs entries admitted on first use, lazy acyclic, per-chain reference checks), $exists and { $row, up } in row predicates (admission, preparation and lowering frames, shared or correlated bodies, the write re-judgement that reads them), and repeated bodies shared in UPDATE and DELETE statements. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.3 (2026-10-19) measures 183,229 B: to-one relation ordering through one LEFT JOIN, the mixed-direction cursor bound, outer-reference chains joined into one EXISTS, merged quantifiers, shared bodies in located lookups, the NOT MATERIALIZED spelling, the upsert refusal's cause; schema validation rules no longer kept (-1.65 kB). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.4.0 (2026-10-20) measures 187,904 B: writes answering relation projections in their own statement, findUnique batching (+1.75 kB), the undefined bulk-where refusal and $extends result computed fields (+2.2 kB), SQLite AS MATERIALIZED nested bodies, single-window distinct, junction-joined many-to-many filters on SQLite. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Neki relation budget (2026-10-21) measures 191,623 B: recursive walks carrying the columns their next hop reads, and past 256 relations a statement's repeated walks as one reaching set and rows joined to the key sets they test, one-column sets held as PostgreSQL arrays (relationsPerStatement: stated, or 256 where a PostgreSQL driver reads Neki from its first connection's startup or first refusal; D1 256). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Nested-write round trips (2026-10-22) measures 192,646 B: a nested write answering its result out of its root statement, a nested root update locating its row in its own UPDATE, and an upsert probe holding the row it finds on PostgreSQL (locksMissingKeys). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. To-many targets read together (2026-10-22) measures 193,276 B: a to-many connect or set reading its targets in one statement and linking them in one INSERT (Selection.rows, linkMany). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Shared connect UPDATEs and batched planning reads (2026-10-23) measure 194,142 B: reference-side connect and set targets moved by one UPDATE (updateRows), and on D1 and Neon HTTP a nested write’s planning lookups read in one read-only batch (readTogether). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. The 1.4.1 fixes (opt-in findUnique batching in its leader's context, non-null unique selectors, grouped batch-route reads, indexed target matching; 2026-10-24) measure 195.25 kB on CI's Node 22.12 build, so 194.5 kB → 195.6 kB under the same OD-17 rule. 1.5.1 (2026-10-26) measures 195,680 B: provider codes of any SQLSTATE-shaped class kept, a PostgreSQL connection lost under a statement mapped to a retryable ConnectionError, a migration failure keeping its cause's disclosure, and the client symbol migrations read diagnostics through; 195.6 kB → 196 kB under the same OD-17 rule. The statements a write hook costs, lowered (2026-10-29): a PostgreSQL upsert keeps its one INSERT … ON CONFLICT and reads its arm from RETURNING (adapter.mutations.upserted, xmax = 0), and without RETURNING a createMany whose rows carry their keys is one INSERT plus one read and a delete with a scalar select locks and reads its rows in one SELECT … FOR UPDATE: measures 196.25 kB; 196 kB → 196.6 kB under the same OD-17 rule. viborm/on nested writes and onError (2026-10-29: nested rows captured by key in the operation's own unit, nested updateMany/deleteMany from their own RETURNING, a failing hook reported to onError instead of failing its committed write) measures 197.07 kB; 196.6 kB → 197.4 kB under the same OD-17 rule. viborm/ordering's core seam (2026-10-31: the order capability (a model's default order threaded with the call's row facts, applied at root reads, to-many relation reads and paged aggregate windows, keyed into cached reads), computed insert values (an extension's create stamp the INSERT computes once its rows are final), and model factories receiving the client scope) measures 197.8 kB; 197.4 kB → 198.1 kB under the same OD-17 rule. viborm/ordering's move in one UPDATE (2026-10-31: an update's data may hold an extension-computed value, set aside from admission and replaced by its expression before the SET) measures 198.17 kB; 198.1 kB → 198.5 kB under the same OD-17 rule. The extensions-composition PR's the core seam extensions compose through (2026-11-01: RowsOf, an extension's own SQL taking the call's row domain and an admitted where; JoinedValue and adapter.mutations.updateFrom, an updateMany value read from a derived table its UPDATE joins; a MySQL lock's captured keys handed to the write) measures 198.61 kB; 198.5 kB → 199 kB under the same OD-17 rule. A policy's tenant (2026-11-02: the bound a layer's own related rows put on the sets its predicates compute over a whole table, read positively, and the polarity of what a rule reads, so a negative test is never bounded) measures 199.03 kB; 199 kB → 199.4 kB under the same OD-17 rule. V2 as an opt-in (2026-11-03: `recurse: { selective: true }`, the closure flag, the enclosing-body frames and the read count that decide which stated walks are lifted) measures 199.6 kB on CI's Node 22.12 build; 199.4 kB → 199.9 kB under the same OD-17 rule. Raised 199.9 → 205.5 kB by the measured 205.17 kB in CI of a declared model as a junction and $through (reads, filters, writes; after one reduction pass; OD-17, measured + 0.3 kB headroom)."
407
407
  },
408
408
  {
409
409
  "name": "pg + migrations Worker (viborm/pg + viborm/migrations/postgres)",
410
410
  "path": "node_modules/.cache/viborm-size/pg-migrations-worker.mjs",
411
411
  "gzip": true,
412
- "limit": "308 kB",
413
- "message": "Raised 273 → 274.4 kB by the measured +1,392 B of RBAC M1 wave 2 (K3, OD-17): rows verbs, written fields, write judgements and the clear premise; it held wave 1's +1,819 B inside its headroom. Raised 274.4 → 279.5 kB by the measured +5,720 B (279.12 kB) of RBAC M2 wave 4 (K4 produced rows judged in the statement, K5 evidence and read-gated fields; OD-17, measured + 0.3 kB headroom). Raised 279.5 → 280.8 kB by the measured +1,340 B (280.46 kB) of RBAC M2 wave 5 (E5: shared relation bodies, D1 balanced conjunctions, the judged write's own sentinel, the allocation fixes; the uncacheable control, OD-10; OD-17, measured + 0.3 kB headroom). Raised 280.8 → 281.6 kB by the measured 281.27 kB of the RBAC second review's fixes (2026-10-17): per-dialect produced rows for a judged createMany (ENG-3, setOperations.typedRows), caller SQL kept out of shared-body keys (ENG-4, Sql.peekRuns), isolated nesting levels where deepExpressions is false (ENG-6, subqueries.isolated), and createClient forwarding sharedRelationBodies (ENG-5) (OD-17, measured rounded up to 0.1 kB + 0.3 kB). Permissions application reuse (2026-10-18) measures 281,876 B: private policy-definition caching, immutable row admission and control-reference reuse. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.2 (2026-10-19) measures 284,679 B: per-model policy compilation (lazy rows.verbs entries admitted on first use, lazy acyclic, per-chain reference checks), $exists and { $row, up } in row predicates (admission, preparation and lowering frames, shared or correlated bodies, the write re-judgement that reads them), and repeated bodies shared in UPDATE and DELETE statements. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.3 (2026-10-19) measures 286,646 B: to-one relation ordering through one LEFT JOIN, the mixed-direction cursor bound, outer-reference chains joined into one EXISTS, merged quantifiers, shared bodies in located lookups, the NOT MATERIALIZED spelling, the upsert refusal's cause. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.4.0 (2026-10-20) measures 291,400 B: writes answering relation projections in their own statement, findUnique batching (+1.75 kB), the undefined bulk-where refusal and $extends result computed fields (+2.2 kB), SQLite AS MATERIALIZED nested bodies, single-window distinct, junction-joined many-to-many filters on SQLite. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Neki relation budget (2026-10-21) measures 295,514 B: recursive walks carrying the columns their next hop reads, and past 256 relations a statement's repeated walks as one reaching set and rows joined to the key sets they test, one-column sets held as PostgreSQL arrays (relationsPerStatement: stated, or 256 where a PostgreSQL driver reads Neki from its first connection's startup or first refusal; D1 256). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Nested-write round trips (2026-10-22) measures 296,563 B: a nested write answering its result out of its root statement, a nested root update locating its row in its own UPDATE, and an upsert probe holding the row it finds on PostgreSQL (locksMissingKeys). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. To-many targets read together (2026-10-22) measures 297,199 B: a to-many connect or set reading its targets in one statement and linking them in one INSERT (Selection.rows, linkMany). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Incremental snapshot artifacts (2026-10-22) measure 298,985 B after two bundle-reduction reviews. Owner-approved limit follows rounding up to 0.1 kB plus 0.3 kB headroom; other resource and coverage limits are unchanged. Final prune-review fixes measure 299,039 B and remain within that approved limit. Shared connect UPDATEs and batched planning reads (2026-10-23) measure 298,088 B: reference-side connect and set targets moved by one UPDATE (updateRows), and on D1 and Neon HTTP a nested write’s planning lookups read in one read-only batch (readTogether). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Incremental snapshot artifacts merged with shared connect UPDATEs and batched planning reads (2026-10-23) measure 299,920 B together. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. The 1.4.1 fixes (opt-in findUnique batching in its leader's context, non-null unique selectors, grouped batch-route reads, indexed target matching; 2026-10-24) measure 301.01 kB on CI's Node 22.12 build, so 300.3 kB → 301.4 kB under the same OD-17 rule. Keyed snapshot deltas (1.5.0, 2026-10-25: snapshot-delta-2 reading, the named-element encoder and its positional fallback) measure 301,703 B on CI's Node 22.12 build, so 301.4 kB → 302.1 kB under the same OD-17 rule. 1.5.1 (2026-10-26) measures 302,580 B: provider codes of any SQLSTATE-shaped class kept, a PostgreSQL connection lost under a statement mapped to a retryable ConnectionError, a migration failure keeping its cause's disclosure, and the client symbol migrations read diagnostics through (and, in this bundle, Neki's stepwise migrations, the disclosing migration session and located migration failures); 302.1 kB → 302.9 kB under the same OD-17 rule. viborm/on (2026-10-29) measures 303,060 B: the write-hooks seam core keeps for the official `on` extension and the MySQL createMany skipDuplicates fix; 302.9 kB → 303.4 kB under the same OD-17 rule. The statements a write hook costs, lowered (2026-10-29): a PostgreSQL upsert keeps its one INSERT … ON CONFLICT and reads its arm from RETURNING (adapter.mutations.upserted, xmax = 0), and without RETURNING a createMany whose rows carry their keys is one INSERT plus one read and a delete with a scalar select locks and reads its rows in one SELECT … FOR UPDATE: measures 303.39 kB; 303.4 kB → 303.7 kB under the same OD-17 rule. viborm/on nested writes and onError (2026-10-29: nested rows captured by key in the operation's own unit, nested updateMany/deleteMany from their own RETURNING, a failing hook reported to onError instead of failing its committed write) measures 304.11 kB; 303.7 kB → 304.5 kB under the same OD-17 rule. Raised 304.5 → 305.3 kB by the measured +527 B over the limit (305.03 kB) of #85 (1.6.0): PostgreSQL push reads the CHECK constraints on the columns an enum recreation converts, drops and re-adds them (measured + 0.3 kB headroom). viborm/ordering's core seam (2026-10-31) measures 305.77 kB; 305.3 kB → 306.1 kB under the same OD-17 rule. viborm/ordering's move in one UPDATE (2026-10-31: an update's data may hold an extension-computed value, set aside from admission and replaced by its expression before the SET) measures 306.15 kB; 306.1 kB → 306.5 kB under the same OD-17 rule. The extensions-composition PR's the core seam extensions compose through (2026-11-01: RowsOf, an extension's own SQL taking the call's row domain and an admitted where; JoinedValue and adapter.mutations.updateFrom, an updateMany value read from a derived table its UPDATE joins; a MySQL lock's captured keys handed to the write) measures 306.61 kB; 306.5 kB → 307 kB under the same OD-17 rule. A policy's tenant (2026-11-02: the bound a layer's own related rows put on the sets its predicates compute over a whole table, read positively, and the polarity of what a rule reads, so a negative test is never bounded) measures 307.07 kB; 307 kB → 307.4 kB under the same OD-17 rule. V2 as an opt-in (2026-11-03: `recurse: { selective: true }`, the closure flag, the enclosing-body frames and the read count that decide which stated walks are lifted) measures 307.66 kB on CI's Node 22.12 build; 307.4 kB → 308 kB under the same OD-17 rule."
412
+ "limit": "313.5 kB",
413
+ "message": "Raised 273 → 274.4 kB by the measured +1,392 B of RBAC M1 wave 2 (K3, OD-17): rows verbs, written fields, write judgements and the clear premise; it held wave 1's +1,819 B inside its headroom. Raised 274.4 → 279.5 kB by the measured +5,720 B (279.12 kB) of RBAC M2 wave 4 (K4 produced rows judged in the statement, K5 evidence and read-gated fields; OD-17, measured + 0.3 kB headroom). Raised 279.5 → 280.8 kB by the measured +1,340 B (280.46 kB) of RBAC M2 wave 5 (E5: shared relation bodies, D1 balanced conjunctions, the judged write's own sentinel, the allocation fixes; the uncacheable control, OD-10; OD-17, measured + 0.3 kB headroom). Raised 280.8 → 281.6 kB by the measured 281.27 kB of the RBAC second review's fixes (2026-10-17): per-dialect produced rows for a judged createMany (ENG-3, setOperations.typedRows), caller SQL kept out of shared-body keys (ENG-4, Sql.peekRuns), isolated nesting levels where deepExpressions is false (ENG-6, subqueries.isolated), and createClient forwarding sharedRelationBodies (ENG-5) (OD-17, measured rounded up to 0.1 kB + 0.3 kB). Permissions application reuse (2026-10-18) measures 281,876 B: private policy-definition caching, immutable row admission and control-reference reuse. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.2 (2026-10-19) measures 284,679 B: per-model policy compilation (lazy rows.verbs entries admitted on first use, lazy acyclic, per-chain reference checks), $exists and { $row, up } in row predicates (admission, preparation and lowering frames, shared or correlated bodies, the write re-judgement that reads them), and repeated bodies shared in UPDATE and DELETE statements. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.3 (2026-10-19) measures 286,646 B: to-one relation ordering through one LEFT JOIN, the mixed-direction cursor bound, outer-reference chains joined into one EXISTS, merged quantifiers, shared bodies in located lookups, the NOT MATERIALIZED spelling, the upsert refusal's cause. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.4.0 (2026-10-20) measures 291,400 B: writes answering relation projections in their own statement, findUnique batching (+1.75 kB), the undefined bulk-where refusal and $extends result computed fields (+2.2 kB), SQLite AS MATERIALIZED nested bodies, single-window distinct, junction-joined many-to-many filters on SQLite. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Neki relation budget (2026-10-21) measures 295,514 B: recursive walks carrying the columns their next hop reads, and past 256 relations a statement's repeated walks as one reaching set and rows joined to the key sets they test, one-column sets held as PostgreSQL arrays (relationsPerStatement: stated, or 256 where a PostgreSQL driver reads Neki from its first connection's startup or first refusal; D1 256). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Nested-write round trips (2026-10-22) measures 296,563 B: a nested write answering its result out of its root statement, a nested root update locating its row in its own UPDATE, and an upsert probe holding the row it finds on PostgreSQL (locksMissingKeys). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. To-many targets read together (2026-10-22) measures 297,199 B: a to-many connect or set reading its targets in one statement and linking them in one INSERT (Selection.rows, linkMany). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Incremental snapshot artifacts (2026-10-22) measure 298,985 B after two bundle-reduction reviews. Owner-approved limit follows rounding up to 0.1 kB plus 0.3 kB headroom; other resource and coverage limits are unchanged. Final prune-review fixes measure 299,039 B and remain within that approved limit. Shared connect UPDATEs and batched planning reads (2026-10-23) measure 298,088 B: reference-side connect and set targets moved by one UPDATE (updateRows), and on D1 and Neon HTTP a nested write’s planning lookups read in one read-only batch (readTogether). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Incremental snapshot artifacts merged with shared connect UPDATEs and batched planning reads (2026-10-23) measure 299,920 B together. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. The 1.4.1 fixes (opt-in findUnique batching in its leader's context, non-null unique selectors, grouped batch-route reads, indexed target matching; 2026-10-24) measure 301.01 kB on CI's Node 22.12 build, so 300.3 kB → 301.4 kB under the same OD-17 rule. Keyed snapshot deltas (1.5.0, 2026-10-25: snapshot-delta-2 reading, the named-element encoder and its positional fallback) measure 301,703 B on CI's Node 22.12 build, so 301.4 kB → 302.1 kB under the same OD-17 rule. 1.5.1 (2026-10-26) measures 302,580 B: provider codes of any SQLSTATE-shaped class kept, a PostgreSQL connection lost under a statement mapped to a retryable ConnectionError, a migration failure keeping its cause's disclosure, and the client symbol migrations read diagnostics through (and, in this bundle, Neki's stepwise migrations, the disclosing migration session and located migration failures); 302.1 kB → 302.9 kB under the same OD-17 rule. viborm/on (2026-10-29) measures 303,060 B: the write-hooks seam core keeps for the official `on` extension and the MySQL createMany skipDuplicates fix; 302.9 kB → 303.4 kB under the same OD-17 rule. The statements a write hook costs, lowered (2026-10-29): a PostgreSQL upsert keeps its one INSERT … ON CONFLICT and reads its arm from RETURNING (adapter.mutations.upserted, xmax = 0), and without RETURNING a createMany whose rows carry their keys is one INSERT plus one read and a delete with a scalar select locks and reads its rows in one SELECT … FOR UPDATE: measures 303.39 kB; 303.4 kB → 303.7 kB under the same OD-17 rule. viborm/on nested writes and onError (2026-10-29: nested rows captured by key in the operation's own unit, nested updateMany/deleteMany from their own RETURNING, a failing hook reported to onError instead of failing its committed write) measures 304.11 kB; 303.7 kB → 304.5 kB under the same OD-17 rule. Raised 304.5 → 305.3 kB by the measured +527 B over the limit (305.03 kB) of #85 (1.6.0): PostgreSQL push reads the CHECK constraints on the columns an enum recreation converts, drops and re-adds them (measured + 0.3 kB headroom). viborm/ordering's core seam (2026-10-31) measures 305.77 kB; 305.3 kB → 306.1 kB under the same OD-17 rule. viborm/ordering's move in one UPDATE (2026-10-31: an update's data may hold an extension-computed value, set aside from admission and replaced by its expression before the SET) measures 306.15 kB; 306.1 kB → 306.5 kB under the same OD-17 rule. The extensions-composition PR's the core seam extensions compose through (2026-11-01: RowsOf, an extension's own SQL taking the call's row domain and an admitted where; JoinedValue and adapter.mutations.updateFrom, an updateMany value read from a derived table its UPDATE joins; a MySQL lock's captured keys handed to the write) measures 306.61 kB; 306.5 kB → 307 kB under the same OD-17 rule. A policy's tenant (2026-11-02: the bound a layer's own related rows put on the sets its predicates compute over a whole table, read positively, and the polarity of what a rule reads, so a negative test is never bounded) measures 307.07 kB; 307 kB → 307.4 kB under the same OD-17 rule. V2 as an opt-in (2026-11-03: `recurse: { selective: true }`, the closure flag, the enclosing-body frames and the read count that decide which stated walks are lifted) measures 307.66 kB on CI's Node 22.12 build; 307.4 kB → 308 kB under the same OD-17 rule. Raised 308 → 313.5 kB by the measured 313.2 kB in CI of a declared model as a junction and $through (reads, filters, writes; after one reduction pass; OD-17, measured + 0.3 kB headroom)."
414
414
  },
415
415
  {
416
416
  "name": "pg application (viborm/pg)",
417
417
  "path": "node_modules/.cache/viborm-size/pg-representative.mjs",
418
418
  "gzip": true,
419
- "limit": "201.1 kB",
420
- "message": "Raised 170 → 171.9 kB by the measured +1,900 B of RBAC M1 wave 1 (OD-17): rows predicates admitted, layered and parameterized, numbered binds, bound views. Raised 171.9 → 173.34 kB by the measured +1,440 B of RBAC M1 wave 2 (K3, OD-17): rows verbs, written fields, write judgements and the clear premise. Raised 173.34 → 178.2 kB by the measured +5,650 B (177.84 kB) of RBAC M2 wave 4 (K4 produced rows judged in the statement, K5 evidence and read-gated fields; OD-17, measured + 0.3 kB headroom). Raised 178.2 → 179.5 kB by the measured +1,278 B (179.12 kB) of RBAC M2 wave 5 (E5: shared relation bodies, D1 balanced conjunctions, the judged write's own sentinel, the allocation fixes; the uncacheable control, OD-10; OD-17, measured + 0.3 kB headroom). Raised 179.5 → 180.3 kB by the measured 179.99 kB of the RBAC second review's fixes (2026-10-17): per-dialect produced rows for a judged createMany (ENG-3, setOperations.typedRows), caller SQL kept out of shared-body keys (ENG-4, Sql.peekRuns), isolated nesting levels where deepExpressions is false (ENG-6, subqueries.isolated), and createClient forwarding sharedRelationBodies (ENG-5) (OD-17, measured rounded up to 0.1 kB + 0.3 kB). Permissions application reuse (2026-10-18) measures 180,567 B: private policy-definition caching, immutable row admission and control-reference reuse. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.2 (2026-10-19) measures 183,392 B: per-model policy compilation (lazy rows.verbs entries admitted on first use, lazy acyclic, per-chain reference checks), $exists and { $row, up } in row predicates (admission, preparation and lowering frames, shared or correlated bodies, the write re-judgement that reads them), and repeated bodies shared in UPDATE and DELETE statements. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.3 (2026-10-19) measures 183,719 B: to-one relation ordering through one LEFT JOIN, the mixed-direction cursor bound, outer-reference chains joined into one EXISTS, merged quantifiers, shared bodies in located lookups, the NOT MATERIALIZED spelling, the upsert refusal's cause; schema validation rules no longer kept (-1.65 kB). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.4.0 (2026-10-20) measures 188,385 B: writes answering relation projections in their own statement, findUnique batching (+1.75 kB), the undefined bulk-where refusal and $extends result computed fields (+2.2 kB), SQLite AS MATERIALIZED nested bodies, single-window distinct, junction-joined many-to-many filters on SQLite. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Neki relation budget (2026-10-21) measures 192,547 B: recursive walks carrying the columns their next hop reads, and past 256 relations a statement's repeated walks as one reaching set and rows joined to the key sets they test, one-column sets held as PostgreSQL arrays (relationsPerStatement: stated, or 256 where a PostgreSQL driver reads Neki from its first connection's startup or first refusal; D1 256). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Nested-write round trips (2026-10-22) measures 193,572 B: a nested write answering its result out of its root statement, a nested root update locating its row in its own UPDATE, and an upsert probe holding the row it finds on PostgreSQL (locksMissingKeys). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. To-many targets read together (2026-10-22) measures 194,198 B: a to-many connect or set reading its targets in one statement and linking them in one INSERT (Selection.rows, linkMany). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Shared connect UPDATEs and batched planning reads (2026-10-23) measure 195,084 B: reference-side connect and set targets moved by one UPDATE (updateRows), and on D1 and Neon HTTP a nested write’s planning lookups read in one read-only batch (readTogether). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. The 1.4.1 fixes (opt-in findUnique batching in its leader's context, non-null unique selectors, grouped batch-route reads, indexed target matching; 2026-10-24) measure 196.22 kB on CI's Node 22.12 build, so 195.4 kB → 196.6 kB under the same OD-17 rule. 1.5.1 (2026-10-26) measures 196,680 B: provider codes of any SQLSTATE-shaped class kept, a PostgreSQL connection lost under a statement mapped to a retryable ConnectionError, a migration failure keeping its cause's disclosure, and the client symbol migrations read diagnostics through; 196.6 kB → 197 kB under the same OD-17 rule. viborm/on (2026-10-29) measures 197,018 B (+221 B): the write-hooks seam core keeps for the official `on` extension (its identity in the chain, the client's write plan and its one outcome registration, the engine's upsert arm report) and the MySQL createMany skipDuplicates fix; 197 kB → 197.4 kB under the same OD-17 rule. The statements a write hook costs, lowered (2026-10-29): a PostgreSQL upsert keeps its one INSERT … ON CONFLICT and reads its arm from RETURNING (adapter.mutations.upserted, xmax = 0), and without RETURNING a createMany whose rows carry their keys is one INSERT plus one read and a delete with a scalar select locks and reads its rows in one SELECT … FOR UPDATE: measures 197.33 kB; 197.4 kB → 197.7 kB under the same OD-17 rule. viborm/on nested writes and onError (2026-10-29: nested rows captured by key in the operation's own unit, nested updateMany/deleteMany from their own RETURNING, a failing hook reported to onError instead of failing its committed write) measures 198.17 kB; 197.7 kB → 198.5 kB under the same OD-17 rule. viborm/ordering's core seam (2026-10-31: the order capability (a model's default order threaded with the call's row facts, applied at root reads, to-many relation reads and paged aggregate windows, keyed into cached reads), computed insert values (an extension's create stamp the INSERT computes once its rows are final), and model factories receiving the client scope) measures 198.85 kB (+670 B); 198.5 kB → 199.2 kB under the same OD-17 rule. viborm/ordering's move in one UPDATE (2026-10-31: an update's data may hold an extension-computed value, set aside from admission and replaced by its expression before the SET) measures 199.21 kB; 199.2 kB → 199.6 kB under the same OD-17 rule. The extensions-composition PR's the core seam extensions compose through (2026-11-01: RowsOf, an extension's own SQL taking the call's row domain and an admitted where; JoinedValue and adapter.mutations.updateFrom, an updateMany value read from a derived table its UPDATE joins; a MySQL lock's captured keys handed to the write) measures 199.63 kB; 199.6 kB → 200 kB under the same OD-17 rule. A policy's tenant (2026-11-02: the bound a layer's own related rows put on the sets its predicates compute over a whole table, read positively, and the polarity of what a rule reads, so a negative test is never bounded) measures 200.07 kB; 200 kB → 200.4 kB under the same OD-17 rule. V2 as an opt-in (2026-11-03: `recurse: { selective: true }`, the closure flag, the enclosing-body frames and the read count that decide which stated walks are lifted) measures 200.72 kB on CI's Node 22.12 build; 200.4 kB → 201.1 kB under the same OD-17 rule."
419
+ "limit": "206.7 kB",
420
+ "message": "Raised 170 → 171.9 kB by the measured +1,900 B of RBAC M1 wave 1 (OD-17): rows predicates admitted, layered and parameterized, numbered binds, bound views. Raised 171.9 → 173.34 kB by the measured +1,440 B of RBAC M1 wave 2 (K3, OD-17): rows verbs, written fields, write judgements and the clear premise. Raised 173.34 → 178.2 kB by the measured +5,650 B (177.84 kB) of RBAC M2 wave 4 (K4 produced rows judged in the statement, K5 evidence and read-gated fields; OD-17, measured + 0.3 kB headroom). Raised 178.2 → 179.5 kB by the measured +1,278 B (179.12 kB) of RBAC M2 wave 5 (E5: shared relation bodies, D1 balanced conjunctions, the judged write's own sentinel, the allocation fixes; the uncacheable control, OD-10; OD-17, measured + 0.3 kB headroom). Raised 179.5 → 180.3 kB by the measured 179.99 kB of the RBAC second review's fixes (2026-10-17): per-dialect produced rows for a judged createMany (ENG-3, setOperations.typedRows), caller SQL kept out of shared-body keys (ENG-4, Sql.peekRuns), isolated nesting levels where deepExpressions is false (ENG-6, subqueries.isolated), and createClient forwarding sharedRelationBodies (ENG-5) (OD-17, measured rounded up to 0.1 kB + 0.3 kB). Permissions application reuse (2026-10-18) measures 180,567 B: private policy-definition caching, immutable row admission and control-reference reuse. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.2 (2026-10-19) measures 183,392 B: per-model policy compilation (lazy rows.verbs entries admitted on first use, lazy acyclic, per-chain reference checks), $exists and { $row, up } in row predicates (admission, preparation and lowering frames, shared or correlated bodies, the write re-judgement that reads them), and repeated bodies shared in UPDATE and DELETE statements. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.3 (2026-10-19) measures 183,719 B: to-one relation ordering through one LEFT JOIN, the mixed-direction cursor bound, outer-reference chains joined into one EXISTS, merged quantifiers, shared bodies in located lookups, the NOT MATERIALIZED spelling, the upsert refusal's cause; schema validation rules no longer kept (-1.65 kB). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.4.0 (2026-10-20) measures 188,385 B: writes answering relation projections in their own statement, findUnique batching (+1.75 kB), the undefined bulk-where refusal and $extends result computed fields (+2.2 kB), SQLite AS MATERIALIZED nested bodies, single-window distinct, junction-joined many-to-many filters on SQLite. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Neki relation budget (2026-10-21) measures 192,547 B: recursive walks carrying the columns their next hop reads, and past 256 relations a statement's repeated walks as one reaching set and rows joined to the key sets they test, one-column sets held as PostgreSQL arrays (relationsPerStatement: stated, or 256 where a PostgreSQL driver reads Neki from its first connection's startup or first refusal; D1 256). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Nested-write round trips (2026-10-22) measures 193,572 B: a nested write answering its result out of its root statement, a nested root update locating its row in its own UPDATE, and an upsert probe holding the row it finds on PostgreSQL (locksMissingKeys). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. To-many targets read together (2026-10-22) measures 194,198 B: a to-many connect or set reading its targets in one statement and linking them in one INSERT (Selection.rows, linkMany). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Shared connect UPDATEs and batched planning reads (2026-10-23) measure 195,084 B: reference-side connect and set targets moved by one UPDATE (updateRows), and on D1 and Neon HTTP a nested write’s planning lookups read in one read-only batch (readTogether). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. The 1.4.1 fixes (opt-in findUnique batching in its leader's context, non-null unique selectors, grouped batch-route reads, indexed target matching; 2026-10-24) measure 196.22 kB on CI's Node 22.12 build, so 195.4 kB → 196.6 kB under the same OD-17 rule. 1.5.1 (2026-10-26) measures 196,680 B: provider codes of any SQLSTATE-shaped class kept, a PostgreSQL connection lost under a statement mapped to a retryable ConnectionError, a migration failure keeping its cause's disclosure, and the client symbol migrations read diagnostics through; 196.6 kB → 197 kB under the same OD-17 rule. viborm/on (2026-10-29) measures 197,018 B (+221 B): the write-hooks seam core keeps for the official `on` extension (its identity in the chain, the client's write plan and its one outcome registration, the engine's upsert arm report) and the MySQL createMany skipDuplicates fix; 197 kB → 197.4 kB under the same OD-17 rule. The statements a write hook costs, lowered (2026-10-29): a PostgreSQL upsert keeps its one INSERT … ON CONFLICT and reads its arm from RETURNING (adapter.mutations.upserted, xmax = 0), and without RETURNING a createMany whose rows carry their keys is one INSERT plus one read and a delete with a scalar select locks and reads its rows in one SELECT … FOR UPDATE: measures 197.33 kB; 197.4 kB → 197.7 kB under the same OD-17 rule. viborm/on nested writes and onError (2026-10-29: nested rows captured by key in the operation's own unit, nested updateMany/deleteMany from their own RETURNING, a failing hook reported to onError instead of failing its committed write) measures 198.17 kB; 197.7 kB → 198.5 kB under the same OD-17 rule. viborm/ordering's core seam (2026-10-31: the order capability (a model's default order threaded with the call's row facts, applied at root reads, to-many relation reads and paged aggregate windows, keyed into cached reads), computed insert values (an extension's create stamp the INSERT computes once its rows are final), and model factories receiving the client scope) measures 198.85 kB (+670 B); 198.5 kB → 199.2 kB under the same OD-17 rule. viborm/ordering's move in one UPDATE (2026-10-31: an update's data may hold an extension-computed value, set aside from admission and replaced by its expression before the SET) measures 199.21 kB; 199.2 kB → 199.6 kB under the same OD-17 rule. The extensions-composition PR's the core seam extensions compose through (2026-11-01: RowsOf, an extension's own SQL taking the call's row domain and an admitted where; JoinedValue and adapter.mutations.updateFrom, an updateMany value read from a derived table its UPDATE joins; a MySQL lock's captured keys handed to the write) measures 199.63 kB; 199.6 kB → 200 kB under the same OD-17 rule. A policy's tenant (2026-11-02: the bound a layer's own related rows put on the sets its predicates compute over a whole table, read positively, and the polarity of what a rule reads, so a negative test is never bounded) measures 200.07 kB; 200 kB → 200.4 kB under the same OD-17 rule. V2 as an opt-in (2026-11-03: `recurse: { selective: true }`, the closure flag, the enclosing-body frames and the read count that decide which stated walks are lifted) measures 200.72 kB on CI's Node 22.12 build; 200.4 kB → 201.1 kB under the same OD-17 rule. Raised 201.1 → 206.7 kB by the measured 206.31 kB in CI of a declared model as a junction and $through (reads, filters, writes; after one reduction pass; OD-17, measured + 0.3 kB headroom)."
421
421
  },
422
422
  {
423
423
  "name": "pg application + soft delete",
424
424
  "path": "node_modules/.cache/viborm-size/pg-soft-delete.mjs",
425
425
  "gzip": true,
426
- "limit": "201.8 kB",
427
- "message": "Raised 173.5 → 178.6 kB by the measured +5,670 B (178.24 kB) of RBAC M2 wave 4 (K4 produced rows judged in the statement, K5 evidence and read-gated fields; OD-17, measured + 0.3 kB headroom). Raised 178.6 → 179.9 kB by the measured +1,270 B (179.51 kB) of RBAC M2 wave 5 (E5: shared relation bodies, D1 balanced conjunctions, the judged write's own sentinel, the allocation fixes; the uncacheable control, OD-10; OD-17, measured + 0.3 kB headroom). Raised 179.9 → 180.7 kB by the measured 180.39 kB of the RBAC second review's fixes (2026-10-17): per-dialect produced rows for a judged createMany (ENG-3, setOperations.typedRows), caller SQL kept out of shared-body keys (ENG-4, Sql.peekRuns), isolated nesting levels where deepExpressions is false (ENG-6, subqueries.isolated), createClient forwarding sharedRelationBodies (ENG-5), and soft delete's module-level steps (COST-1, COST-2) (OD-17, measured rounded up to 0.1 kB + 0.3 kB). Permissions application reuse (2026-10-18) measures 180,978 B: private policy-definition caching, immutable row admission and control-reference reuse. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.2 (2026-10-19) measures 183,799 B: per-model policy compilation (lazy rows.verbs entries admitted on first use, lazy acyclic, per-chain reference checks), $exists and { $row, up } in row predicates (admission, preparation and lowering frames, shared or correlated bodies, the write re-judgement that reads them), and repeated bodies shared in UPDATE and DELETE statements. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.3 (2026-10-19) measures 184,116 B: to-one relation ordering through one LEFT JOIN, the mixed-direction cursor bound, outer-reference chains joined into one EXISTS, merged quantifiers, shared bodies in located lookups, the NOT MATERIALIZED spelling, the upsert refusal's cause; schema validation rules no longer kept (-1.65 kB). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.4.0 (2026-10-20) measures 188,764 B: writes answering relation projections in their own statement, findUnique batching (+1.75 kB), the undefined bulk-where refusal and $extends result computed fields (+2.2 kB), SQLite AS MATERIALIZED nested bodies, single-window distinct, junction-joined many-to-many filters on SQLite. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Neki relation budget (2026-10-21) measures 192,936 B: recursive walks carrying the columns their next hop reads, and past 256 relations a statement's repeated walks as one reaching set and rows joined to the key sets they test, one-column sets held as PostgreSQL arrays (relationsPerStatement: stated, or 256 where a PostgreSQL driver reads Neki from its first connection's startup or first refusal; D1 256). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Nested-write round trips (2026-10-22) measures 193,977 B: a nested write answering its result out of its root statement, a nested root update locating its row in its own UPDATE, and an upsert probe holding the row it finds on PostgreSQL (locksMissingKeys). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. To-many targets read together (2026-10-22) measures 194,609 B: a to-many connect or set reading its targets in one statement and linking them in one INSERT (Selection.rows, linkMany). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Shared connect UPDATEs and batched planning reads (2026-10-23) measure 195,500 B: reference-side connect and set targets moved by one UPDATE (updateRows), and on D1 and Neon HTTP a nested write’s planning lookups read in one read-only batch (readTogether). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. The 1.4.1 fixes (opt-in findUnique batching in its leader's context, non-null unique selectors, grouped batch-route reads, indexed target matching; 2026-10-24) measure 196.66 kB on CI's Node 22.12 build, so 195.8 kB → 197 kB under the same OD-17 rule. 1.5.1 (2026-10-26) measures 197,060 B: provider codes of any SQLSTATE-shaped class kept, a PostgreSQL connection lost under a statement mapped to a retryable ConnectionError, a migration failure keeping its cause's disclosure, and the client symbol migrations read diagnostics through; 197 kB → 197.4 kB under the same OD-17 rule. viborm/on (2026-10-29) measures 197,461 B (+258 B): the write-hooks seam core keeps for the official `on` extension (its identity in the chain, the client's write plan and its one outcome registration, the engine's upsert arm report) and the MySQL createMany skipDuplicates fix; 197.4 kB → 197.8 kB under the same OD-17 rule. The statements a write hook costs, lowered (2026-10-29): a PostgreSQL upsert keeps its one INSERT … ON CONFLICT and reads its arm from RETURNING (adapter.mutations.upserted, xmax = 0), and without RETURNING a createMany whose rows carry their keys is one INSERT plus one read and a delete with a scalar select locks and reads its rows in one SELECT … FOR UPDATE: measures 197.76 kB; 197.8 kB → 198.1 kB under the same OD-17 rule. viborm/on nested writes and onError (2026-10-29: nested rows captured by key in the operation's own unit, nested updateMany/deleteMany from their own RETURNING, a failing hook reported to onError instead of failing its committed write) measures 198.54 kB; 198.1 kB → 198.9 kB under the same OD-17 rule. viborm/ordering's core seam (2026-10-31) measures 199.26 kB; 198.9 kB → 199.6 kB under the same OD-17 rule. viborm/ordering's move in one UPDATE (2026-10-31: an update's data may hold an extension-computed value, set aside from admission and replaced by its expression before the SET) measures 199.62 kB; 199.6 kB → 200 kB under the same OD-17 rule. Extensions next, final (2026-11-01) measures 200,087 B: the core RowsOf seam (an extension's own SQL takes the call's row domain, about 0.1 kB in every app) beside soft delete's one-step definition, purge and marker check; 200 kB → 200.4 kB under OD-17. A policy's tenant (2026-11-02: the bound a layer's own related rows put on the sets its predicates compute over a whole table, read positively, and the polarity of what a rule reads, so a negative test is never bounded) measures 200.68 kB; 200.4 kB → 201 kB under the same OD-17 rule. 1.9.1 (2026-11-02: the upsert fold under other models' stamps, ordering's writes keeping updatedAt() and its anchors read by key, softDelete actorId) measures 201.05 kB on CI's Node 22.12 build; 201 kB → 201.4 kB under the same OD-17 rule. V2 as an opt-in (2026-11-03: `recurse: { selective: true }`, the closure flag, the enclosing-body frames and the read count that decide which stated walks are lifted) measures 201.41 kB on CI's Node 22.12 build; 201.4 kB → 201.8 kB under the same OD-17 rule."
426
+ "limit": "207.3 kB",
427
+ "message": "Raised 173.5 → 178.6 kB by the measured +5,670 B (178.24 kB) of RBAC M2 wave 4 (K4 produced rows judged in the statement, K5 evidence and read-gated fields; OD-17, measured + 0.3 kB headroom). Raised 178.6 → 179.9 kB by the measured +1,270 B (179.51 kB) of RBAC M2 wave 5 (E5: shared relation bodies, D1 balanced conjunctions, the judged write's own sentinel, the allocation fixes; the uncacheable control, OD-10; OD-17, measured + 0.3 kB headroom). Raised 179.9 → 180.7 kB by the measured 180.39 kB of the RBAC second review's fixes (2026-10-17): per-dialect produced rows for a judged createMany (ENG-3, setOperations.typedRows), caller SQL kept out of shared-body keys (ENG-4, Sql.peekRuns), isolated nesting levels where deepExpressions is false (ENG-6, subqueries.isolated), createClient forwarding sharedRelationBodies (ENG-5), and soft delete's module-level steps (COST-1, COST-2) (OD-17, measured rounded up to 0.1 kB + 0.3 kB). Permissions application reuse (2026-10-18) measures 180,978 B: private policy-definition caching, immutable row admission and control-reference reuse. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.2 (2026-10-19) measures 183,799 B: per-model policy compilation (lazy rows.verbs entries admitted on first use, lazy acyclic, per-chain reference checks), $exists and { $row, up } in row predicates (admission, preparation and lowering frames, shared or correlated bodies, the write re-judgement that reads them), and repeated bodies shared in UPDATE and DELETE statements. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.3 (2026-10-19) measures 184,116 B: to-one relation ordering through one LEFT JOIN, the mixed-direction cursor bound, outer-reference chains joined into one EXISTS, merged quantifiers, shared bodies in located lookups, the NOT MATERIALIZED spelling, the upsert refusal's cause; schema validation rules no longer kept (-1.65 kB). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.4.0 (2026-10-20) measures 188,764 B: writes answering relation projections in their own statement, findUnique batching (+1.75 kB), the undefined bulk-where refusal and $extends result computed fields (+2.2 kB), SQLite AS MATERIALIZED nested bodies, single-window distinct, junction-joined many-to-many filters on SQLite. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Neki relation budget (2026-10-21) measures 192,936 B: recursive walks carrying the columns their next hop reads, and past 256 relations a statement's repeated walks as one reaching set and rows joined to the key sets they test, one-column sets held as PostgreSQL arrays (relationsPerStatement: stated, or 256 where a PostgreSQL driver reads Neki from its first connection's startup or first refusal; D1 256). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Nested-write round trips (2026-10-22) measures 193,977 B: a nested write answering its result out of its root statement, a nested root update locating its row in its own UPDATE, and an upsert probe holding the row it finds on PostgreSQL (locksMissingKeys). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. To-many targets read together (2026-10-22) measures 194,609 B: a to-many connect or set reading its targets in one statement and linking them in one INSERT (Selection.rows, linkMany). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Shared connect UPDATEs and batched planning reads (2026-10-23) measure 195,500 B: reference-side connect and set targets moved by one UPDATE (updateRows), and on D1 and Neon HTTP a nested write’s planning lookups read in one read-only batch (readTogether). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. The 1.4.1 fixes (opt-in findUnique batching in its leader's context, non-null unique selectors, grouped batch-route reads, indexed target matching; 2026-10-24) measure 196.66 kB on CI's Node 22.12 build, so 195.8 kB → 197 kB under the same OD-17 rule. 1.5.1 (2026-10-26) measures 197,060 B: provider codes of any SQLSTATE-shaped class kept, a PostgreSQL connection lost under a statement mapped to a retryable ConnectionError, a migration failure keeping its cause's disclosure, and the client symbol migrations read diagnostics through; 197 kB → 197.4 kB under the same OD-17 rule. viborm/on (2026-10-29) measures 197,461 B (+258 B): the write-hooks seam core keeps for the official `on` extension (its identity in the chain, the client's write plan and its one outcome registration, the engine's upsert arm report) and the MySQL createMany skipDuplicates fix; 197.4 kB → 197.8 kB under the same OD-17 rule. The statements a write hook costs, lowered (2026-10-29): a PostgreSQL upsert keeps its one INSERT … ON CONFLICT and reads its arm from RETURNING (adapter.mutations.upserted, xmax = 0), and without RETURNING a createMany whose rows carry their keys is one INSERT plus one read and a delete with a scalar select locks and reads its rows in one SELECT … FOR UPDATE: measures 197.76 kB; 197.8 kB → 198.1 kB under the same OD-17 rule. viborm/on nested writes and onError (2026-10-29: nested rows captured by key in the operation's own unit, nested updateMany/deleteMany from their own RETURNING, a failing hook reported to onError instead of failing its committed write) measures 198.54 kB; 198.1 kB → 198.9 kB under the same OD-17 rule. viborm/ordering's core seam (2026-10-31) measures 199.26 kB; 198.9 kB → 199.6 kB under the same OD-17 rule. viborm/ordering's move in one UPDATE (2026-10-31: an update's data may hold an extension-computed value, set aside from admission and replaced by its expression before the SET) measures 199.62 kB; 199.6 kB → 200 kB under the same OD-17 rule. Extensions next, final (2026-11-01) measures 200,087 B: the core RowsOf seam (an extension's own SQL takes the call's row domain, about 0.1 kB in every app) beside soft delete's one-step definition, purge and marker check; 200 kB → 200.4 kB under OD-17. A policy's tenant (2026-11-02: the bound a layer's own related rows put on the sets its predicates compute over a whole table, read positively, and the polarity of what a rule reads, so a negative test is never bounded) measures 200.68 kB; 200.4 kB → 201 kB under the same OD-17 rule. 1.9.1 (2026-11-02: the upsert fold under other models' stamps, ordering's writes keeping updatedAt() and its anchors read by key, softDelete actorId) measures 201.05 kB on CI's Node 22.12 build; 201 kB → 201.4 kB under the same OD-17 rule. V2 as an opt-in (2026-11-03: `recurse: { selective: true }`, the closure flag, the enclosing-body frames and the read count that decide which stated walks are lifted) measures 201.41 kB on CI's Node 22.12 build; 201.4 kB → 201.8 kB under the same OD-17 rule. Raised 201.8 → 207.3 kB by the measured 206.98 kB in CI of a declared model as a junction and $through (reads, filters, writes; after one reduction pass; OD-17, measured + 0.3 kB headroom)."
428
428
  },
429
429
  {
430
430
  "name": "soft-delete extension entry",
@@ -437,8 +437,8 @@
437
437
  "name": "pg application + permissions",
438
438
  "path": "node_modules/.cache/viborm-size/pg-permissions.mjs",
439
439
  "gzip": true,
440
- "limit": "214.2 kB",
441
- "message": "The pg application with viborm/permissions applied (the guide's blog policy: an actor schema, an explicit authorId predicate and an actor condition, $as per request, one read, one create, one can): measured 184,652 B at the M2 exit (wave 5), +5,534 B over the pg application row (the entry's compiler with placement, moves, acyclic relations and evidence, can/assert through $access). First measured 181,404 B at c7d1951cd (U10). Limit = measured rounded up to 0.1 kB + 0.3 kB (OD-17). Raised 185 → 185.8 kB by the measured +488 B (185.49 kB) of the independent review's fixes (2026-10-16): refusals of unknown policy, model and field-entry keys, mistyped declaration keys, keyLimit models and undeclared ceilings; can/assert over findUnique with one ask per level; the prover's structural equality and R6 safeguard (OD-17). Comma-separated action keys measure 185,861 B (2026-10-16): normalized bindings and rejection of empty, repeated, overlapping and reserved members. Limit 186.2 kB follows the same rounding plus 0.3 kB rule (OD-17). CRUD permissions and complementary credential scopes measure 186,347 B (2026-10-17); limit 186.7 kB follows the approved measured rounding plus 0.3 kB rule (OD-17). Conditional parameter-read preservation and the permissions rename measure 187,685 B (2026-10-17), +1,338 B from the last recorded application measurement; limit 188 kB follows OD-17 rounding plus 0.3 kB. The simplifier preserves missing/null and whole-list refusals while retaining compact inherited predicates. Raised by the second review's fixes (2026-10-17: typed VALUES rows for judged inserts, caller-text runs in shared-body keys, isolated nesting levels on D1), measured 188.19 kB after the permissions rename; limit = measured rounded up to 0.1 kB + 0.3 kB (OD-17). Actor admission and polymorphic projection consistency (2026-10-18) measure 189,787 B: required native actor validation, per-grant availability and variant projection admission. Limit follows OD-17 rounding to 0.1 kB plus 0.3 kB. Permissions application reuse (2026-10-18) measures 190,939 B: private policy-definition caching, immutable row admission and control-reference reuse. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Cold compilation sharing (2026-10-18) measures 191,498 B: compilation-local structural keys and shared guards in the policy simplifier, and admission that parses and walks each shared sub-predicate once. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.2 (2026-10-19) measures 196,216 B: per-model compilation (the policy compiler, the declaration snapshot, frozen lazy entries), $exists and { $row, up } in rules, and the refusal of field references and empty actor conditions. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.3 (2026-10-19) measures 196,634 B: to-one relation ordering through one LEFT JOIN, the mixed-direction cursor bound, outer-reference chains joined into one EXISTS, merged quantifiers, shared bodies in located lookups, the NOT MATERIALIZED spelling, the upsert refusal's cause; schema validation rules no longer kept (-1.65 kB). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.4.0 (2026-10-20) measures 201,329 B: writes answering relation projections in their own statement, findUnique batching (+1.75 kB), the undefined bulk-where refusal and $extends result computed fields (+2.2 kB), SQLite AS MATERIALIZED nested bodies, single-window distinct, junction-joined many-to-many filters on SQLite. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Neki relation budget (2026-10-21) measures 205,450 B: recursive walks carrying the columns their next hop reads, and past 256 relations a statement's repeated walks as one reaching set and rows joined to the key sets they test, one-column sets held as PostgreSQL arrays (relationsPerStatement: stated, or 256 where a PostgreSQL driver reads Neki from its first connection's startup or first refusal; D1 256). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Nested-write round trips (2026-10-22) measures 206,535 B: a nested write answering its result out of its root statement, a nested root update locating its row in its own UPDATE, and an upsert probe holding the row it finds on PostgreSQL (locksMissingKeys). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. To-many targets read together (2026-10-22) measures 207,162 B: a to-many connect or set reading its targets in one statement and linking them in one INSERT (Selection.rows, linkMany). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Shared connect UPDATEs and batched planning reads (2026-10-23) measure 208,063 B: reference-side connect and set targets moved by one UPDATE (updateRows), and on D1 and Neon HTTP a nested write’s planning lookups read in one read-only batch (readTogether). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. The 1.4.1 fixes (opt-in findUnique batching in its leader's context, non-null unique selectors, grouped batch-route reads, indexed target matching; 2026-10-24) measure 209.17 kB on CI's Node 22.12 build, so 208.4 kB → 209.5 kB under the same OD-17 rule. Native insensitive matching (2026-10-29: ILIKE/LOWER folds, a client-escaped PostgreSQL pattern, foldable JSON-path strings) measures 209.56 kB on CI, so 209.5 kB → 209.9 kB under the same OD-17 rule. The statements a write hook costs, lowered (2026-10-29): a PostgreSQL upsert keeps its one INSERT … ON CONFLICT and reads its arm from RETURNING (adapter.mutations.upserted, xmax = 0), and without RETURNING a createMany whose rows carry their keys is one INSERT plus one read and a delete with a scalar select locks and reads its rows in one SELECT … FOR UPDATE: measures 210.07 kB; 209.9 kB → 210.4 kB under the same OD-17 rule. viborm/on nested writes and onError (2026-10-29: nested rows captured by key in the operation's own unit, nested updateMany/deleteMany from their own RETURNING, a failing hook reported to onError instead of failing its committed write) measures 210.84 kB; 210.4 kB → 211.2 kB under the same OD-17 rule. viborm/ordering's core seam (2026-10-31) measures 211.54 kB; 211.2 kB → 211.9 kB under the same OD-17 rule. viborm/ordering's move in one UPDATE (2026-10-31: an update's data may hold an extension-computed value, set aside from admission and replaced by its expression before the SET) measures 211.96 kB; 211.9 kB → 212.3 kB under the same OD-17 rule. The extensions-composition PR's the core seam extensions compose through (2026-11-01: RowsOf, an extension's own SQL taking the call's row domain and an admitted where; JoinedValue and adapter.mutations.updateFrom, an updateMany value read from a derived table its UPDATE joins; a MySQL lock's captured keys handed to the write) measures 212.39 kB; 212.3 kB → 212.7 kB under the same OD-17 rule. A policy's tenant (2026-11-02: the bound a layer's own related rows put on the sets its predicates compute over a whole table, read positively, and the polarity of what a rule reads, so a negative test is never bounded) measures 213.20 kB; 212.7 kB → 213.6 kB under the same OD-17 rule. V2 as an opt-in (2026-11-03: `recurse: { selective: true }`, the closure flag, the enclosing-body frames and the read count that decide which stated walks are lifted) measures 213.86 kB on CI's Node 22.12 build; 213.6 kB → 214.2 kB under the same OD-17 rule."
440
+ "limit": "219.7 kB",
441
+ "message": "The pg application with viborm/permissions applied (the guide's blog policy: an actor schema, an explicit authorId predicate and an actor condition, $as per request, one read, one create, one can): measured 184,652 B at the M2 exit (wave 5), +5,534 B over the pg application row (the entry's compiler with placement, moves, acyclic relations and evidence, can/assert through $access). First measured 181,404 B at c7d1951cd (U10). Limit = measured rounded up to 0.1 kB + 0.3 kB (OD-17). Raised 185 → 185.8 kB by the measured +488 B (185.49 kB) of the independent review's fixes (2026-10-16): refusals of unknown policy, model and field-entry keys, mistyped declaration keys, keyLimit models and undeclared ceilings; can/assert over findUnique with one ask per level; the prover's structural equality and R6 safeguard (OD-17). Comma-separated action keys measure 185,861 B (2026-10-16): normalized bindings and rejection of empty, repeated, overlapping and reserved members. Limit 186.2 kB follows the same rounding plus 0.3 kB rule (OD-17). CRUD permissions and complementary credential scopes measure 186,347 B (2026-10-17); limit 186.7 kB follows the approved measured rounding plus 0.3 kB rule (OD-17). Conditional parameter-read preservation and the permissions rename measure 187,685 B (2026-10-17), +1,338 B from the last recorded application measurement; limit 188 kB follows OD-17 rounding plus 0.3 kB. The simplifier preserves missing/null and whole-list refusals while retaining compact inherited predicates. Raised by the second review's fixes (2026-10-17: typed VALUES rows for judged inserts, caller-text runs in shared-body keys, isolated nesting levels on D1), measured 188.19 kB after the permissions rename; limit = measured rounded up to 0.1 kB + 0.3 kB (OD-17). Actor admission and polymorphic projection consistency (2026-10-18) measure 189,787 B: required native actor validation, per-grant availability and variant projection admission. Limit follows OD-17 rounding to 0.1 kB plus 0.3 kB. Permissions application reuse (2026-10-18) measures 190,939 B: private policy-definition caching, immutable row admission and control-reference reuse. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Cold compilation sharing (2026-10-18) measures 191,498 B: compilation-local structural keys and shared guards in the policy simplifier, and admission that parses and walks each shared sub-predicate once. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.2 (2026-10-19) measures 196,216 B: per-model compilation (the policy compiler, the declaration snapshot, frozen lazy entries), $exists and { $row, up } in rules, and the refusal of field references and empty actor conditions. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.3 (2026-10-19) measures 196,634 B: to-one relation ordering through one LEFT JOIN, the mixed-direction cursor bound, outer-reference chains joined into one EXISTS, merged quantifiers, shared bodies in located lookups, the NOT MATERIALIZED spelling, the upsert refusal's cause; schema validation rules no longer kept (-1.65 kB). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.4.0 (2026-10-20) measures 201,329 B: writes answering relation projections in their own statement, findUnique batching (+1.75 kB), the undefined bulk-where refusal and $extends result computed fields (+2.2 kB), SQLite AS MATERIALIZED nested bodies, single-window distinct, junction-joined many-to-many filters on SQLite. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Neki relation budget (2026-10-21) measures 205,450 B: recursive walks carrying the columns their next hop reads, and past 256 relations a statement's repeated walks as one reaching set and rows joined to the key sets they test, one-column sets held as PostgreSQL arrays (relationsPerStatement: stated, or 256 where a PostgreSQL driver reads Neki from its first connection's startup or first refusal; D1 256). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Nested-write round trips (2026-10-22) measures 206,535 B: a nested write answering its result out of its root statement, a nested root update locating its row in its own UPDATE, and an upsert probe holding the row it finds on PostgreSQL (locksMissingKeys). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. To-many targets read together (2026-10-22) measures 207,162 B: a to-many connect or set reading its targets in one statement and linking them in one INSERT (Selection.rows, linkMany). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Shared connect UPDATEs and batched planning reads (2026-10-23) measure 208,063 B: reference-side connect and set targets moved by one UPDATE (updateRows), and on D1 and Neon HTTP a nested write’s planning lookups read in one read-only batch (readTogether). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. The 1.4.1 fixes (opt-in findUnique batching in its leader's context, non-null unique selectors, grouped batch-route reads, indexed target matching; 2026-10-24) measure 209.17 kB on CI's Node 22.12 build, so 208.4 kB → 209.5 kB under the same OD-17 rule. Native insensitive matching (2026-10-29: ILIKE/LOWER folds, a client-escaped PostgreSQL pattern, foldable JSON-path strings) measures 209.56 kB on CI, so 209.5 kB → 209.9 kB under the same OD-17 rule. The statements a write hook costs, lowered (2026-10-29): a PostgreSQL upsert keeps its one INSERT … ON CONFLICT and reads its arm from RETURNING (adapter.mutations.upserted, xmax = 0), and without RETURNING a createMany whose rows carry their keys is one INSERT plus one read and a delete with a scalar select locks and reads its rows in one SELECT … FOR UPDATE: measures 210.07 kB; 209.9 kB → 210.4 kB under the same OD-17 rule. viborm/on nested writes and onError (2026-10-29: nested rows captured by key in the operation's own unit, nested updateMany/deleteMany from their own RETURNING, a failing hook reported to onError instead of failing its committed write) measures 210.84 kB; 210.4 kB → 211.2 kB under the same OD-17 rule. viborm/ordering's core seam (2026-10-31) measures 211.54 kB; 211.2 kB → 211.9 kB under the same OD-17 rule. viborm/ordering's move in one UPDATE (2026-10-31: an update's data may hold an extension-computed value, set aside from admission and replaced by its expression before the SET) measures 211.96 kB; 211.9 kB → 212.3 kB under the same OD-17 rule. The extensions-composition PR's the core seam extensions compose through (2026-11-01: RowsOf, an extension's own SQL taking the call's row domain and an admitted where; JoinedValue and adapter.mutations.updateFrom, an updateMany value read from a derived table its UPDATE joins; a MySQL lock's captured keys handed to the write) measures 212.39 kB; 212.3 kB → 212.7 kB under the same OD-17 rule. A policy's tenant (2026-11-02: the bound a layer's own related rows put on the sets its predicates compute over a whole table, read positively, and the polarity of what a rule reads, so a negative test is never bounded) measures 213.20 kB; 212.7 kB → 213.6 kB under the same OD-17 rule. V2 as an opt-in (2026-11-03: `recurse: { selective: true }`, the closure flag, the enclosing-body frames and the read count that decide which stated walks are lifted) measures 213.86 kB on CI's Node 22.12 build; 213.6 kB → 214.2 kB under the same OD-17 rule. Raised 214.2 → 219.7 kB by the measured 219.38 kB in CI of a declared model as a junction and $through (reads, filters, writes; after one reduction pass; OD-17, measured + 0.3 kB headroom)."
442
442
  },
443
443
  {
444
444
  "name": "permissions extension entry",
@@ -451,8 +451,8 @@
451
451
  "name": "pg application + on",
452
452
  "path": "node_modules/.cache/viborm-size/pg-on.mjs",
453
453
  "gzip": true,
454
- "limit": "202.8 kB",
455
- "message": "The pg application with viborm/on applied (one create hook): its difference from the pg application row is what installing write hooks costs, measured 198,157 B (+1,139 B) on 2026-10-29. Limit follows OD-17: measured rounded up to 0.1 kB plus 0.3 kB. The statements a write hook costs, lowered (2026-10-29): a PostgreSQL upsert keeps its one INSERT … ON CONFLICT and reads its arm from RETURNING (adapter.mutations.upserted, xmax = 0), and without RETURNING a createMany whose rows carry their keys is one INSERT plus one read and a delete with a scalar select locks and reads its rows in one SELECT … FOR UPDATE: measures 198.45 kB; 198.5 kB → 198.8 kB under the same OD-17 rule. The adversarial review's fixes (2026-10-29: the hooked value cut back before any extension sees it, the upsert arm reported before planning, a probe in the same unit where an adapter has no marker, one failing array hook no longer hiding the next, copied rows and arguments, declarations checked when applied) measure 198.91 kB; 198.8 kB → 199.3 kB under the same OD-17 rule. viborm/on nested writes and onError (2026-10-29: nested rows captured by key in the operation's own unit, nested updateMany/deleteMany from their own RETURNING, a failing hook reported to onError instead of failing its committed write) measures 199.68 kB; 199.3 kB → 200 kB under the same OD-17 rule. viborm/ordering's core seam (2026-10-31) measures 200.54 kB; 200 kB → 200.9 kB under the same OD-17 rule. viborm/ordering's move in one UPDATE (2026-10-31: an update's data may hold an extension-computed value, set aside from admission and replaced by its expression before the SET) measures 200.92 kB; 200.9 kB → 201.3 kB under the same OD-17 rule. The extensions-composition PR's the core seam extensions compose through (2026-11-01: RowsOf, an extension's own SQL taking the call's row domain and an admitted where; JoinedValue and adapter.mutations.updateFrom, an updateMany value read from a derived table its UPDATE joins; a MySQL lock's captured keys handed to the write) measures 201.39 kB; 201.3 kB → 201.7 kB under the same OD-17 rule. A policy's tenant (2026-11-02: the bound a layer's own related rows put on the sets its predicates compute over a whole table, read positively, and the polarity of what a rule reads, so a negative test is never bounded) measures 201.85 kB; 201.7 kB → 202.2 kB under the same OD-17 rule. V2 as an opt-in (2026-11-03: `recurse: { selective: true }`, the closure flag, the enclosing-body frames and the read count that decide which stated walks are lifted) measures 202.49 kB on CI's Node 22.12 build; 202.2 kB → 202.8 kB under the same OD-17 rule."
454
+ "limit": "208.4 kB",
455
+ "message": "The pg application with viborm/on applied (one create hook): its difference from the pg application row is what installing write hooks costs, measured 198,157 B (+1,139 B) on 2026-10-29. Limit follows OD-17: measured rounded up to 0.1 kB plus 0.3 kB. The statements a write hook costs, lowered (2026-10-29): a PostgreSQL upsert keeps its one INSERT … ON CONFLICT and reads its arm from RETURNING (adapter.mutations.upserted, xmax = 0), and without RETURNING a createMany whose rows carry their keys is one INSERT plus one read and a delete with a scalar select locks and reads its rows in one SELECT … FOR UPDATE: measures 198.45 kB; 198.5 kB → 198.8 kB under the same OD-17 rule. The adversarial review's fixes (2026-10-29: the hooked value cut back before any extension sees it, the upsert arm reported before planning, a probe in the same unit where an adapter has no marker, one failing array hook no longer hiding the next, copied rows and arguments, declarations checked when applied) measure 198.91 kB; 198.8 kB → 199.3 kB under the same OD-17 rule. viborm/on nested writes and onError (2026-10-29: nested rows captured by key in the operation's own unit, nested updateMany/deleteMany from their own RETURNING, a failing hook reported to onError instead of failing its committed write) measures 199.68 kB; 199.3 kB → 200 kB under the same OD-17 rule. viborm/ordering's core seam (2026-10-31) measures 200.54 kB; 200 kB → 200.9 kB under the same OD-17 rule. viborm/ordering's move in one UPDATE (2026-10-31: an update's data may hold an extension-computed value, set aside from admission and replaced by its expression before the SET) measures 200.92 kB; 200.9 kB → 201.3 kB under the same OD-17 rule. The extensions-composition PR's the core seam extensions compose through (2026-11-01: RowsOf, an extension's own SQL taking the call's row domain and an admitted where; JoinedValue and adapter.mutations.updateFrom, an updateMany value read from a derived table its UPDATE joins; a MySQL lock's captured keys handed to the write) measures 201.39 kB; 201.3 kB → 201.7 kB under the same OD-17 rule. A policy's tenant (2026-11-02: the bound a layer's own related rows put on the sets its predicates compute over a whole table, read positively, and the polarity of what a rule reads, so a negative test is never bounded) measures 201.85 kB; 201.7 kB → 202.2 kB under the same OD-17 rule. V2 as an opt-in (2026-11-03: `recurse: { selective: true }`, the closure flag, the enclosing-body frames and the read count that decide which stated walks are lifted) measures 202.49 kB on CI's Node 22.12 build; 202.2 kB → 202.8 kB under the same OD-17 rule. Raised 202.8 → 208.4 kB by the measured 208.1 kB in CI of a declared model as a junction and $through (reads, filters, writes; after one reduction pass; OD-17, measured + 0.3 kB headroom)."
456
456
  },
457
457
  {
458
458
  "name": "on extension entry",
@@ -465,8 +465,8 @@
465
465
  "name": "pg application + ordering",
466
466
  "path": "node_modules/.cache/viborm-size/pg-ordering.mjs",
467
467
  "gzip": true,
468
- "limit": "209.4 kB",
469
- "message": "The pg application with viborm/ordering applied (one ordered model, a create and a move): its difference from the pg application row is what ordering a list costs, measured 203,010 B (+4,160 B) on 2026-10-31. Limit follows OD-17: measured rounded up to 0.1 kB plus 0.3 kB. The adversarial review's fixes (2026-10-31: respacing as one statement over whole lists, rows named by identity in move, stored keys published instead of their expressions, the filtered MAX for backfilled tables) measure 203.87 kB; 203.4 kB → 204.2 kB under the same OD-17 rule. The second review's fixes (2026-10-31) measure 204.22 kB; 204.2 kB → 204.6 kB under the same OD-17 rule. The move computed by its UPDATE (2026-10-31: the key expression between.ts builds, the one-statement path, the engine's computed update values) measures 206.17 kB; 204.6 kB → 206.5 kB under the same OD-17 rule. Extensions next (2026-11-01) measures 206,552 B (+95 B): ordering as one definition, the move's anchor read through the caller's view under rows, rekey invalidating the call's chain's cache, the scope's chain facts in core; 206.5 kB → 206.9 kB under the same OD-17 rule. Extensions next, final (2026-11-01) measures 207,840 B: move's subqueries through the call's row domain (RowsOf), and rekey as an updateMany through the client whose ranks keep the members the caller cannot see in place (one SQL map on PostgreSQL and SQLite, a read and a CASE on MySQL); 206.9 kB → 208.2 kB under the same OD-17 rule. 1.9.1 (2026-11-02: the upsert fold under other models' stamps, ordering's writes keeping updatedAt() and its anchors read by key, softDelete actorId) measures 208.53 kB on CI's Node 22.12 build; 208.2 kB → 208.9 kB under the same OD-17 rule. 1.10.0 (2026-11-03: V4's key-ordered recursive edges, recurse.fewRows and recurse.selective) measures 209,039 B on CI's Node 24 build; 208.9 kB → 209.4 kB under the same OD-17 rule."
468
+ "limit": "214.7 kB",
469
+ "message": "The pg application with viborm/ordering applied (one ordered model, a create and a move): its difference from the pg application row is what ordering a list costs, measured 203,010 B (+4,160 B) on 2026-10-31. Limit follows OD-17: measured rounded up to 0.1 kB plus 0.3 kB. The adversarial review's fixes (2026-10-31: respacing as one statement over whole lists, rows named by identity in move, stored keys published instead of their expressions, the filtered MAX for backfilled tables) measure 203.87 kB; 203.4 kB → 204.2 kB under the same OD-17 rule. The second review's fixes (2026-10-31) measure 204.22 kB; 204.2 kB → 204.6 kB under the same OD-17 rule. The move computed by its UPDATE (2026-10-31: the key expression between.ts builds, the one-statement path, the engine's computed update values) measures 206.17 kB; 204.6 kB → 206.5 kB under the same OD-17 rule. Extensions next (2026-11-01) measures 206,552 B (+95 B): ordering as one definition, the move's anchor read through the caller's view under rows, rekey invalidating the call's chain's cache, the scope's chain facts in core; 206.5 kB → 206.9 kB under the same OD-17 rule. Extensions next, final (2026-11-01) measures 207,840 B: move's subqueries through the call's row domain (RowsOf), and rekey as an updateMany through the client whose ranks keep the members the caller cannot see in place (one SQL map on PostgreSQL and SQLite, a read and a CASE on MySQL); 206.9 kB → 208.2 kB under the same OD-17 rule. 1.9.1 (2026-11-02: the upsert fold under other models' stamps, ordering's writes keeping updatedAt() and its anchors read by key, softDelete actorId) measures 208.53 kB on CI's Node 22.12 build; 208.2 kB → 208.9 kB under the same OD-17 rule. 1.10.0 (2026-11-03: V4's key-ordered recursive edges, recurse.fewRows and recurse.selective) measures 209,039 B on CI's Node 24 build; 208.9 kB → 209.4 kB under the same OD-17 rule. Raised 209.4 → 214.7 kB by the measured 214.37 kB in CI of a declared model as a junction and $through (reads, filters, writes; after one reduction pass; OD-17, measured + 0.3 kB headroom)."
470
470
  },
471
471
  {
472
472
  "name": "ordering extension entry",
@@ -491,8 +491,8 @@
491
491
  "name": "every public entry",
492
492
  "path": "node_modules/.cache/viborm-size/full.mjs",
493
493
  "gzip": true,
494
- "limit": "449.5 kB",
495
- "message": "Raised 394 → 398.1 kB by the measured +5,700 B (397.74 kB) of RBAC M2 wave 4 (K4 produced rows judged in the statement, K5 evidence and read-gated fields; OD-17, measured + 0.3 kB headroom). Raised 398.1 → 405.9 kB by the measured +7,818 B (405.56 kB) of RBAC M2 wave 5: the fixture now exports viborm/rbac (U10), the entry's placement, moves and evidence (U9), and the core growth of E5 and OD-10 (OD-17, measured + 0.3 kB headroom). Raised 405.9 → 406.9 kB by the measured +692 B (406.59 kB) of the independent review's fixes (2026-10-16): the rbac entry's refusals and prover fixes, and the marker judgement in core (OD-17). The permissions rename and conditional-read simplification fixes measure 407,193 B (2026-10-17); limit 407.5 kB follows OD-17 rounding plus 0.3 kB. Raised by the second review's fixes (2026-10-17: typed VALUES rows for judged inserts, caller-text runs in shared-body keys, isolated nesting levels on D1), measured 407.81 kB after the permissions rename; limit = measured rounded up to 0.1 kB + 0.3 kB (OD-17). Actor admission and polymorphic projection consistency (2026-10-18) measure 409,474 B; limit follows OD-17 rounding to 0.1 kB plus 0.3 kB. Permissions application reuse (2026-10-18) measures 410,754 B: private policy-definition caching, immutable row admission and control-reference reuse. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Cold compilation sharing (2026-10-18) measures 411,254 B: compilation-local structural keys and shared guards in the policy simplifier, and admission that parses and walks each shared sub-predicate once. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.2 (2026-10-19) measures 415,968 B: per-model policy compilation (lazy rows.verbs entries admitted on first use, lazy acyclic, per-chain reference checks), $exists and { $row, up } in row predicates (admission, preparation and lowering frames, shared or correlated bodies, the write re-judgement that reads them), and repeated bodies shared in UPDATE and DELETE statements. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.3 (2026-10-19) measures 418,009 B: to-one relation ordering through one LEFT JOIN, the mixed-direction cursor bound, outer-reference chains joined into one EXISTS, merged quantifiers, shared bodies in located lookups, the NOT MATERIALIZED spelling, the upsert refusal's cause; schema validation rules no longer kept (-1.65 kB). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.4.0 (2026-10-20) measures 422,953 B: writes answering relation projections in their own statement, findUnique batching (+1.75 kB), the undefined bulk-where refusal and $extends result computed fields (+2.2 kB), SQLite AS MATERIALIZED nested bodies, single-window distinct, junction-joined many-to-many filters on SQLite. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Neki relation budget (2026-10-21) measures 427,195 B: recursive walks carrying the columns their next hop reads, and past 256 relations a statement's repeated walks as one reaching set and rows joined to the key sets they test, one-column sets held as PostgreSQL arrays (relationsPerStatement: stated, or 256 where a PostgreSQL driver reads Neki from its first connection's startup or first refusal; D1 256). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Nested-write round trips (2026-10-22) measures 428,233 B: a nested write answering its result out of its root statement, a nested root update locating its row in its own UPDATE, and an upsert probe holding the row it finds on PostgreSQL (locksMissingKeys). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. To-many targets read together (2026-10-22) measures 428,889 B: a to-many connect or set reading its targets in one statement and linking them in one INSERT (Selection.rows, linkMany). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Incremental snapshot artifacts (2026-10-22) measure 430,540 B after two bundle-reduction reviews. Owner-approved limit follows rounding up to 0.1 kB plus 0.3 kB headroom; other resource and coverage limits are unchanged. Final prune-review fixes measure 430,609 B and remain within that approved limit. Shared connect UPDATEs and batched planning reads (2026-10-23) measure 429,766 B: reference-side connect and set targets moved by one UPDATE (updateRows), and on D1 and Neon HTTP a nested write’s planning lookups read in one read-only batch (readTogether). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Incremental snapshot artifacts merged with shared connect UPDATEs and batched planning reads (2026-10-23) measure 431,468 B together. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. The 1.4.1 fixes (opt-in findUnique batching in its leader's context, non-null unique selectors, grouped batch-route reads, indexed target matching; 2026-10-24) measure 432.54 kB on CI's Node 22.12 build, so 431.8 kB → 432.9 kB under the same OD-17 rule. Keyed snapshot deltas (1.5.0, 2026-10-25: snapshot-delta-2 reading, the named-element encoder and its positional fallback) measure 433,314 B on CI's Node 22.12 and Node 24 builds, so 432.9 kB → 433.7 kB under the same OD-17 rule. 1.5.1 (2026-10-26) measures 434,030 B: provider codes of any SQLSTATE-shaped class kept, a PostgreSQL connection lost under a statement mapped to a retryable ConnectionError, a migration failure keeping its cause's disclosure, and the client symbol migrations read diagnostics through (and, in this bundle, Neki's stepwise migrations, the disclosing migration session and located migration failures); 433.7 kB → 434.4 kB under the same OD-17 rule. viborm/on (2026-10-29) measures 435,652 B: the fixture now exports viborm/on (its entry, its plan and delivery) and core's write-hooks seam; 434.4 kB → 436 kB under the same OD-17 rule. The statements a write hook costs, lowered (2026-10-29): a PostgreSQL upsert keeps its one INSERT … ON CONFLICT and reads its arm from RETURNING (adapter.mutations.upserted, xmax = 0), and without RETURNING a createMany whose rows carry their keys is one INSERT plus one read and a delete with a scalar select locks and reads its rows in one SELECT … FOR UPDATE: measures 435.94 kB; 436 kB → 436.3 kB under the same OD-17 rule. The adversarial review's fixes (2026-10-29: the hooked value cut back before any extension sees it, the upsert arm reported before planning, a probe in the same unit where an adapter has no marker, one failing array hook no longer hiding the next, copied rows and arguments, declarations checked when applied) measure 436.49 kB; 436.3 kB → 436.8 kB under the same OD-17 rule. viborm/on nested writes and onError (2026-10-29: nested rows captured by key in the operation's own unit, nested updateMany/deleteMany from their own RETURNING, a failing hook reported to onError instead of failing its committed write) measures 437.29 kB; 436.8 kB → 437.6 kB under the same OD-17 rule. Raised 437.6 → 438.6 kB by the measured +719 B over the limit (438.32 kB) of #85 (1.6.0) and on()'s reachability gate (measured + 0.3 kB headroom). viborm/ordering (2026-10-31: the entry and its core seam) measures 442.68 kB; 438.6 kB → 443 kB under the same OD-17 rule. The adversarial review's fixes (2026-10-31: respacing as one statement over whole lists, rows named by identity in move, stored keys published instead of their expressions, the filtered MAX for backfilled tables) measure 443.53 kB; 443 kB → 443.9 kB under the same OD-17 rule. The second review's fixes and move in two statements (2026-10-31) measure 444.02 kB; 443.9 kB → 444.4 kB under the same OD-17 rule. The move computed by its UPDATE (2026-10-31: the key expression between.ts builds, the one-statement path, the engine's computed update values) measures 445.62 kB; 444.4 kB → 446 kB under the same OD-17 rule. Extensions next (2026-11-01) measures 446,167 B (+234 B): rows and defaultOmit no longer refused after methods, the scope's chain facts, the soft-delete marker check and purge, ordering's anchor read, the tombstone lock handing its keys to the write; 446 kB → 446.5 kB under the same OD-17 rule. Extensions next, final (2026-11-01) measures 447,514 B: the RowsOf seam and ordering's rekey through the client; 446.5 kB → 447.9 kB under the same OD-17 rule. 1.9.0 (2026-11-02: a policy's tenant and rows.bound, move({ data }), a stamped field skipping the default it replaces) measures 448,117 B on CI's Node 22.12 build; 447.9 kB → 448.5 kB under the same OD-17 rule. 1.9.1 (2026-11-02: the upsert fold under other models' stamps, ordering's writes keeping updatedAt() and its anchors read by key, softDelete actorId) measures 448.70 kB on CI's Node 22.12 build; 448.5 kB → 449 kB under the same OD-17 rule. 1.10.0 (2026-11-03: V4's key-ordered recursive edges, recurse.fewRows and recurse.selective) measures 449,154 B on CI's Node 24 build; 449 kB → 449.5 kB under the same OD-17 rule."
494
+ "limit": "455.1 kB",
495
+ "message": "Raised 394 → 398.1 kB by the measured +5,700 B (397.74 kB) of RBAC M2 wave 4 (K4 produced rows judged in the statement, K5 evidence and read-gated fields; OD-17, measured + 0.3 kB headroom). Raised 398.1 → 405.9 kB by the measured +7,818 B (405.56 kB) of RBAC M2 wave 5: the fixture now exports viborm/rbac (U10), the entry's placement, moves and evidence (U9), and the core growth of E5 and OD-10 (OD-17, measured + 0.3 kB headroom). Raised 405.9 → 406.9 kB by the measured +692 B (406.59 kB) of the independent review's fixes (2026-10-16): the rbac entry's refusals and prover fixes, and the marker judgement in core (OD-17). The permissions rename and conditional-read simplification fixes measure 407,193 B (2026-10-17); limit 407.5 kB follows OD-17 rounding plus 0.3 kB. Raised by the second review's fixes (2026-10-17: typed VALUES rows for judged inserts, caller-text runs in shared-body keys, isolated nesting levels on D1), measured 407.81 kB after the permissions rename; limit = measured rounded up to 0.1 kB + 0.3 kB (OD-17). Actor admission and polymorphic projection consistency (2026-10-18) measure 409,474 B; limit follows OD-17 rounding to 0.1 kB plus 0.3 kB. Permissions application reuse (2026-10-18) measures 410,754 B: private policy-definition caching, immutable row admission and control-reference reuse. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Cold compilation sharing (2026-10-18) measures 411,254 B: compilation-local structural keys and shared guards in the policy simplifier, and admission that parses and walks each shared sub-predicate once. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.2 (2026-10-19) measures 415,968 B: per-model policy compilation (lazy rows.verbs entries admitted on first use, lazy acyclic, per-chain reference checks), $exists and { $row, up } in row predicates (admission, preparation and lowering frames, shared or correlated bodies, the write re-judgement that reads them), and repeated bodies shared in UPDATE and DELETE statements. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.3.3 (2026-10-19) measures 418,009 B: to-one relation ordering through one LEFT JOIN, the mixed-direction cursor bound, outer-reference chains joined into one EXISTS, merged quantifiers, shared bodies in located lookups, the NOT MATERIALIZED spelling, the upsert refusal's cause; schema validation rules no longer kept (-1.65 kB). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. 1.4.0 (2026-10-20) measures 422,953 B: writes answering relation projections in their own statement, findUnique batching (+1.75 kB), the undefined bulk-where refusal and $extends result computed fields (+2.2 kB), SQLite AS MATERIALIZED nested bodies, single-window distinct, junction-joined many-to-many filters on SQLite. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Neki relation budget (2026-10-21) measures 427,195 B: recursive walks carrying the columns their next hop reads, and past 256 relations a statement's repeated walks as one reaching set and rows joined to the key sets they test, one-column sets held as PostgreSQL arrays (relationsPerStatement: stated, or 256 where a PostgreSQL driver reads Neki from its first connection's startup or first refusal; D1 256). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Nested-write round trips (2026-10-22) measures 428,233 B: a nested write answering its result out of its root statement, a nested root update locating its row in its own UPDATE, and an upsert probe holding the row it finds on PostgreSQL (locksMissingKeys). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. To-many targets read together (2026-10-22) measures 428,889 B: a to-many connect or set reading its targets in one statement and linking them in one INSERT (Selection.rows, linkMany). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Incremental snapshot artifacts (2026-10-22) measure 430,540 B after two bundle-reduction reviews. Owner-approved limit follows rounding up to 0.1 kB plus 0.3 kB headroom; other resource and coverage limits are unchanged. Final prune-review fixes measure 430,609 B and remain within that approved limit. Shared connect UPDATEs and batched planning reads (2026-10-23) measure 429,766 B: reference-side connect and set targets moved by one UPDATE (updateRows), and on D1 and Neon HTTP a nested write’s planning lookups read in one read-only batch (readTogether). Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. Incremental snapshot artifacts merged with shared connect UPDATEs and batched planning reads (2026-10-23) measure 431,468 B together. Limit follows the approved OD-17 measured rounding to 0.1 kB plus 0.3 kB; resource and coverage limits are unchanged. The 1.4.1 fixes (opt-in findUnique batching in its leader's context, non-null unique selectors, grouped batch-route reads, indexed target matching; 2026-10-24) measure 432.54 kB on CI's Node 22.12 build, so 431.8 kB → 432.9 kB under the same OD-17 rule. Keyed snapshot deltas (1.5.0, 2026-10-25: snapshot-delta-2 reading, the named-element encoder and its positional fallback) measure 433,314 B on CI's Node 22.12 and Node 24 builds, so 432.9 kB → 433.7 kB under the same OD-17 rule. 1.5.1 (2026-10-26) measures 434,030 B: provider codes of any SQLSTATE-shaped class kept, a PostgreSQL connection lost under a statement mapped to a retryable ConnectionError, a migration failure keeping its cause's disclosure, and the client symbol migrations read diagnostics through (and, in this bundle, Neki's stepwise migrations, the disclosing migration session and located migration failures); 433.7 kB → 434.4 kB under the same OD-17 rule. viborm/on (2026-10-29) measures 435,652 B: the fixture now exports viborm/on (its entry, its plan and delivery) and core's write-hooks seam; 434.4 kB → 436 kB under the same OD-17 rule. The statements a write hook costs, lowered (2026-10-29): a PostgreSQL upsert keeps its one INSERT … ON CONFLICT and reads its arm from RETURNING (adapter.mutations.upserted, xmax = 0), and without RETURNING a createMany whose rows carry their keys is one INSERT plus one read and a delete with a scalar select locks and reads its rows in one SELECT … FOR UPDATE: measures 435.94 kB; 436 kB → 436.3 kB under the same OD-17 rule. The adversarial review's fixes (2026-10-29: the hooked value cut back before any extension sees it, the upsert arm reported before planning, a probe in the same unit where an adapter has no marker, one failing array hook no longer hiding the next, copied rows and arguments, declarations checked when applied) measure 436.49 kB; 436.3 kB → 436.8 kB under the same OD-17 rule. viborm/on nested writes and onError (2026-10-29: nested rows captured by key in the operation's own unit, nested updateMany/deleteMany from their own RETURNING, a failing hook reported to onError instead of failing its committed write) measures 437.29 kB; 436.8 kB → 437.6 kB under the same OD-17 rule. Raised 437.6 → 438.6 kB by the measured +719 B over the limit (438.32 kB) of #85 (1.6.0) and on()'s reachability gate (measured + 0.3 kB headroom). viborm/ordering (2026-10-31: the entry and its core seam) measures 442.68 kB; 438.6 kB → 443 kB under the same OD-17 rule. The adversarial review's fixes (2026-10-31: respacing as one statement over whole lists, rows named by identity in move, stored keys published instead of their expressions, the filtered MAX for backfilled tables) measure 443.53 kB; 443 kB → 443.9 kB under the same OD-17 rule. The second review's fixes and move in two statements (2026-10-31) measure 444.02 kB; 443.9 kB → 444.4 kB under the same OD-17 rule. The move computed by its UPDATE (2026-10-31: the key expression between.ts builds, the one-statement path, the engine's computed update values) measures 445.62 kB; 444.4 kB → 446 kB under the same OD-17 rule. Extensions next (2026-11-01) measures 446,167 B (+234 B): rows and defaultOmit no longer refused after methods, the scope's chain facts, the soft-delete marker check and purge, ordering's anchor read, the tombstone lock handing its keys to the write; 446 kB → 446.5 kB under the same OD-17 rule. Extensions next, final (2026-11-01) measures 447,514 B: the RowsOf seam and ordering's rekey through the client; 446.5 kB → 447.9 kB under the same OD-17 rule. 1.9.0 (2026-11-02: a policy's tenant and rows.bound, move({ data }), a stamped field skipping the default it replaces) measures 448,117 B on CI's Node 22.12 build; 447.9 kB → 448.5 kB under the same OD-17 rule. 1.9.1 (2026-11-02: the upsert fold under other models' stamps, ordering's writes keeping updatedAt() and its anchors read by key, softDelete actorId) measures 448.70 kB on CI's Node 22.12 build; 448.5 kB → 449 kB under the same OD-17 rule. 1.10.0 (2026-11-03: V4's key-ordered recursive edges, recurse.fewRows and recurse.selective) measures 449,154 B on CI's Node 24 build; 449 kB → 449.5 kB under the same OD-17 rule. Raised 449.5 → 455.1 kB by the measured 454.79 kB in CI of a declared model as a junction and $through (reads, filters, writes; after one reduction pass; OD-17, measured + 0.3 kB headroom)."
496
496
  }
497
497
  ]
498
498
  }
@@ -1,2 +0,0 @@
1
- import{n as e}from"./chunk-BuuaeEvq.mjs";import{o as t,s as n}from"./value-guards-CK9guf2Z.mjs";import{t as r}from"./validation-pfpKPPZ_.mjs";import{A as i,D as a,c as o,i as s,l as c,n as l,o as u,p as d,r as f,s as p,t as m}from"./v-CWY9ntMb.mjs";import{H as h,J as g,K as _,U as v,W as y,c as ee,it as te,s as b}from"./geo-point-codec-Ggv29hSH.mjs";import{r as ne}from"./sql-BsBoKwaf.mjs";import{i as re}from"./keys-CyfjT6uC.mjs";import{t as ie}from"./hydration-Dd2H4EyY.mjs";import{f as ae,n as oe}from"./validator-CYKdGTvX.mjs";import{i as se,r as ce}from"./physical-CjG29tya.mjs";import{t as le}from"./current-nScH-oH5.mjs";import{t as x}from"./types-C4v6iAmY.mjs";import{n as ue}from"./geo-area-codec-B3QtKij8.mjs";function lazyRecord(e){let t={};for(let n of Object.keys(e)){let r=e[n],i;Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get(){return r&&=(i=r(),void 0),i}})}return t}var de=class LazyScalarSchemas{base;#e;#t;#n;constructor(e){this.base=e.base,this.#e={build:e.create},this.#t={build:e.update},this.#n={build:e.filter},Object.defineProperties(this,{create:{enumerable:!0,configurable:!0,get:LazyScalarSchemas.#r},update:{enumerable:!0,configurable:!0,get:LazyScalarSchemas.#i},filter:{enumerable:!0,configurable:!0,get:LazyScalarSchemas.#a}})}static#r(){if(`value`in this.#e)return this.#e.value;let e=this.#e.build();return this.#e={value:e},e}static#i(){if(`value`in this.#t)return this.#t.value;let e=this.#t.build();return this.#t={value:e},e}static#a(){if(`value`in this.#n)return this.#n.value;let e=this.#n.build();return this.#n={value:e},e}};function lazyScalarSchemas(e){return new de(e)}const S=l.enum([`asc`,`desc`]),fe=l.enum([`l2`,`cosine`]),forbiddenOrderByKeySchema=e=>l.refused(`OrderBy key '${e}' is not valid here.`),C=l.union([S,l.object({sort:S,nulls:l.enum([`first`,`last`]),_distance:forbiddenOrderByKeySchema(`_distance`)},{atLeast:[`sort`]})]),pe=l.object({_distance:l.object({to:l.array(l.number()),metric:fe,sort:S},{atLeast:[`to`,`metric`]}),sort:forbiddenOrderByKeySchema(`sort`),nulls:forbiddenOrderByKeySchema(`nulls`)},{atLeast:[`_distance`]}),me=l.object({_distance:l.object({to:l.point(),sort:S},{partial:!1}),sort:forbiddenOrderByKeySchema(`sort`),nulls:forbiddenOrderByKeySchema(`nulls`)},{atLeast:[`_distance`]}),he=l.union([C,pe]),isOrderableScalarState=e=>e.type!==`point`&&(e.type!==`decimal`||e.array!==!0),w=l.refused(`A decimal list cannot be used for numeric ordering.`);function isDecimalListScalarKey(e,t){let n=e[`~`].state.scalars[t][`~`].state;return n.type===`decimal`&&n.array===!0}const getOrderBySchema=(e,t)=>{let n=[],r=[],i=[],a=[],o=Object.keys(e[`~`].state.scalars);for(let t of o){if(isDecimalListScalarKey(e,t)){a.push(t);continue}let o=e[`~`].state.scalars[t][`~`].state;if(o.type===`vector`){n.push(t);continue}if(o.type===`point`){r.push(t);continue}i.push(t)}let s=f(i,C),c=f(n,he),u=f(r,me),p=f(a,w),m=d(t.relations,`orderBy`),h=d(t.polymorphic,`orderBy`),g=l.object({...s,...c,...u,...p,...m,...h}),_=l.noOperandExpression(g,`'orderBy'`);return Reflect.set(g[`~standard`],`validate`,_[`~standard`].validate),g},paginationTake=()=>l.integer();function nonNegativeInteger(e){return h(`integer`,t=>{let n=b(t);return n.issues?n:n.value<0?v(e):n})}const paginationSkip=()=>nonNegativeInteger(`skip must be greater than or equal to 0`),bulkWriteLimit=()=>nonNegativeInteger(`limit must be greater than or equal to 0`),ge=[`int`,`number`,`decimal`,`bigint`],isSummableScalar=e=>e.array!==!0&&ge.includes(e.type),getAggregateScalarSchemas=e=>{let t=e[`~`].state,n=[`_all`],r=[],i=[],a=[],o=[];for(let e of Object.keys(t.scalars)){let s=t.scalars[e];n.push(e),isSummableScalar(s[`~`].state)&&r.push(e),s[`~`].state.array!==!0&&s[`~`].state.type!==`point`&&i.push(e),s[`~`].state.array===!0&&a.push(e),s[`~`].state.type===`point`&&o.push(e)}let s=l.boolean({optional:!0}),projection=e=>l.fromKeys(a,l.refused(`A list cannot be projected by '${e}'; only '_count' is supported.`)),pointProjection=e=>l.fromKeys(o,l.refused(`A GeoPoint cannot be projected by '${e}'; use a distance projection or '_count'.`));return{count:l.fromKeys(n,s),avg:l.object({...l.fromKeys(r,s).entries,...projection(`_avg`).entries,...pointProjection(`_avg`).entries}),sum:l.object({...l.fromKeys(r,s).entries,...projection(`_sum`).entries,...pointProjection(`_sum`).entries}),min:l.object({...l.fromKeys(i,s).entries,...projection(`_min`).entries,...pointProjection(`_min`).entries}),max:l.object({...l.fromKeys(i,s).entries,...projection(`_max`).entries,...pointProjection(`_max`).entries})}},getCountArgs=(e,t)=>{let n=getAggregateScalarSchemas(e);return l.object({where:l.lazyRef(()=>t.where),orderBy:l.lazyRef(()=>l.union([t.orderBy,l.array(t.orderBy)])),cursor:l.lazyRef(()=>t.whereUnique),take:paginationTake(),skip:paginationSkip(),select:n.count},{optional:!0})},getExistArgs=e=>l.object({where:l.lazyRef(()=>e.where)},{optional:!0}),getAggregateArgs=(e,t)=>{let n=getAggregateScalarSchemas(e);return l.object({where:l.lazyRef(()=>t.where),orderBy:l.lazyRef(()=>l.union([t.orderBy,l.array(t.orderBy)])),cursor:l.lazyRef(()=>t.whereUnique),take:paginationTake(),skip:paginationSkip(),_count:l.union([l.literal(!0),n.count]),_avg:n.avg,_sum:n.sum,_min:n.min,_max:n.max})},buildAggregateFilterOps=(e,t)=>l.object({equals:t(),in:l.array(e()),notIn:l.array(e()),gt:e(),gte:e(),lt:e(),lte:e(),not:t()},{optional:!0}),T=buildAggregateFilterOps(()=>l.number(),()=>l.number({nullable:!0})),_e=l.object({equals:l.literal(null),not:l.literal(null)},{optional:!0}),isRuntimeListFilterSchema=e=>{if(e.type!==`union`)return!1;let t=Reflect.get(e,`options`);if(!Array.isArray(t)||t.length!==2)return!1;let n=t[1];return typeof n==`object`&&!!n&&Reflect.get(n,`type`)===`object`},listHavingSchema=e=>{let refusal=e=>l.refused(`A list cannot use '${e}' in having; only '_count' is supported.`),t={_count:T,_avg:refusal(`_avg`),_sum:refusal(`_sum`),_min:refusal(`_min`),_max:refusal(`_max`)};return isRuntimeListFilterSchema(e)?l.noOperandExpression(l.union([e.options[0],e.options[1].extend(t)]),`'having'`):l.refused(`The list filter schema cannot be used in having because its trusted shape is unavailable.`)},sumOperandDomain=e=>({precision:2**53-1,scale:e.scale}),havingAggregateSchema=(e,t)=>{let n=e?.type===`decimal`?e.decimal:void 0;if(!n)return l.object({_count:T,_avg:e&&isSummableScalar(e)?T:l.refused(`Only numeric scalars support '_avg' in having.`),_sum:e&&isSummableScalar(e)?T:l.refused(`Only numeric scalars support '_sum' in having.`),_min:l.union([t,_e]),_max:l.union([t,_e])},{optional:!0});let r=buildAggregateFilterOps(()=>l.decimal({decimal:n}),()=>l.decimal({decimal:n,nullable:!0})),i=sumOperandDomain(n);return l.object({_count:T,_avg:r,_sum:buildAggregateFilterOps(()=>l.decimal({decimal:i}),()=>l.decimal({decimal:i,nullable:!0})),_min:r,_max:r},{optional:!0})};function getHavingSchema(e,t){let n={};for(let[r,i]of Object.entries(t.scalars)){let t=e[`~`].state.scalars[r]?.[`~`].state;if(t?.type===`point`){n[r]=l.refused(`A GeoPoint cannot be used in 'having'.`);continue}n[r]=t?.array===!0?listHavingSchema(i.filter):l.noOperandExpression(l.union([havingAggregateSchema(t,i.filter),i.filter]),`'having'`)}let r=l.object({AND:()=>l.optional(l.union([r,l.array(r)])),OR:()=>l.optional(l.array(r)),NOT:()=>l.optional(l.union([r,l.array(r)]))},{optional:!0}).extend(n);return s(r,e)}const E=l.enum([`asc`,`desc`]),getGroupByOrderBySchema=e=>{let t=e[`~`].state,n=[],r=[],i=[],a=[],o=[],s=[],c=[];for(let e of Object.keys(t.scalars)){let l=t.scalars[e];n.push(e),l[`~`].state.array===!0&&a.push(e),l[`~`].state.type===`point`?c.push(e):isOrderableScalarState(l[`~`].state)?r.push(e):i.push(e),isSummableScalar(l[`~`].state)&&o.push(e),l[`~`].state.array!==!0&&l[`~`].state.type!==`point`&&s.push(e)}let aggregateOrder=(e,t)=>l.object({...l.fromKeys(t,E).entries,...l.fromKeys(a,l.refused(`A list cannot be ordered by '${e}'; only '_count' is supported.`)).entries,...l.fromKeys(c,l.refused(`A GeoPoint cannot be ordered by '${e}'; use '_distance' or '_count'.`)).entries});return l.object({...l.fromKeys(r,C).entries,...l.fromKeys(i,w).entries,_count:l.fromKeys([`_all`,...n],E),_avg:aggregateOrder(`_avg`,o),_sum:aggregateOrder(`_sum`,o),_min:aggregateOrder(`_min`,s),_max:aggregateOrder(`_max`,s)})},D=[`_avg`,`_sum`,`_min`,`_max`],groupByCollisions=e=>{let t=e.by;if(new Set(t).size!==t.length)return`GroupBy operation does not allow duplicate fields in 'by'`;for(let n of D)if(e[n]!==void 0&&t.includes(n))return`Aggregate '${n}' cannot be selected together with a model field named '${n}'.`},O=new Set([`_count`,...D]),ve=new Set([`AND`,`OR`,`NOT`]),ungroupedHavingPath=(e,n,r)=>{for(let[i,a]of Object.entries(e??{}))if(!(a===void 0||n.includes(i))){if(ve.has(i)&&!Object.hasOwn(r,i)){let e=Array.isArray(a)?a:[a];for(let[t,o]of e.entries()){let e=ungroupedHavingPath(o,n,r);if(e)return Array.isArray(a)?[i,t,...e]:[i,...e]}continue}if(!(t(a)&&Object.entries(a).some(([e,t])=>t!==void 0&&O.has(e))))return[i]}},groupedMembershipIssue=({by:e,having:t,orderBy:n},r)=>{if(e.length===0)return{message:`groupBy needs at least one field in 'by'.`,path:[`by`]};let i=ungroupedHavingPath(t,e,r);if(i)return{message:`Scalar '${String(i.at(-1))}' used in 'having' must be included in 'by'.`,path:[`having`,...i]};let a=Array.isArray(n)?n:[n];for(let[t,r]of a.entries())for(let[i,a]of Object.entries(r??{}))if(!(a===void 0||e.includes(i))&&!O.has(i))return{message:`GroupBy orderBy field '${i}' must be included in 'by' or be an aggregate (_count, _avg, _sum, _min, _max).`,path:Array.isArray(n)?[`orderBy`,t,i]:[`orderBy`,i]}},getGroupByArgs=(e,t,n)=>{let r=e[`~`].state,i=Object.keys(r.scalars).filter(e=>r.scalars[e][`~`].state.type!==`point`),a=l.enum(i),o=getAggregateScalarSchemas(e),s=getHavingSchema(e,t),c=getGroupByOrderBySchema(e);return l.object({by:l.union([l.array(a),l.shorthandArray(a)]),where:l.lazyRef(()=>n.where),having:s,orderBy:l.union([c,l.array(c)]),take:paginationTake(),skip:paginationSkip(),_count:l.union([l.literal(!0),o.count]),_avg:o.avg,_sum:o.sum,_min:o.min,_max:o.max},{atLeast:[`by`],refuse:e=>groupByCollisions(e)??groupedMembershipIssue(e,r.scalars)})},projectableScalarNames=e=>{let t=e[`~`].state,n=t.omit,r=Object.keys(t.scalars);return n?r.filter(e=>!Object.hasOwn(n,e)||n[e]!==!0):r},ye=l.boolean({optional:!0}),getOmitSchema=e=>l.object(l.fromKeys(projectableScalarNames(e),ye).entries,{optional:!0}),k=e(e=>({issues:[{message:e}]}),`issue`),modelLabel=e=>e[`~`].names.ts??e[`~`].state.tableName??`model`,buildOmitSelection=(e,t)=>{let n={};for(let r of projectableScalarNames(e))t[r]!==!0&&(n[r]=!0);return Object.keys(n).length>0?n:void 0},emptyOmitProjectionMessage=(e,t)=>`'omit' on '${t}' excluded every readable field of model '${modelLabel(e)}'. At least one field must remain in the result: drop a field from 'omit', or use 'select' to name what you want.`,emptySelectedOmitProjectionMessage=(e,t)=>`'omit' on '${t}' excluded every selected field of model '${modelLabel(e)}'. At least one field must remain in the result: remove a field from 'omit' or add another field to 'select'.`,hasProjectedValue=e=>{for(let t in e){let n=e[t];if(n!==!1&&n!==void 0)return!0}return!1},subtractOmitFromSelection=(e,t)=>{let n={};for(let r of Object.keys(e))t[r]!==!0&&(n[r]=e[r]);return n},withOmitProjection=(e,n,r)=>{let i=e[`~standard`],validate=e=>{let a=t(e)&&e.omit!==void 0,o=i.validate(e);return!a||o.issues?o:projectOmit(o,n,r)};return{...e,parse:validate,"~standard":{version:i.version,vendor:i.vendor,validate,get types(){return i.types},get jsonSchema(){return i.jsonSchema}}}};function projectOmit(e,n,r){let i=e.value,a=i.omit,o=t(i.select)?i.select:void 0,s=o?subtractOmitFromSelection(o,a):buildOmitSelection(n,a);if(!s)return k(emptyOmitProjectionMessage(n,r));if(o&&hasProjectedValue(o)&&!hasProjectedValue(s))return k(emptySelectedOmitProjectionMessage(n,r));let{omit:c,...l}=i;return{value:{...l,select:s}}}const getUpsertProjectionSchema=(e,t)=>withOmitProjection(l.object({select:l.lazyRef(()=>t.select),include:l.lazyRef(()=>t.include),omit:l.lazyRef(()=>t.omit)}),e,`upsert`),be={issues:[{message:`Mutually exclusive fields cannot be used together: select, include`}]},hasSelectAndInclude=e=>t(e)&&e.select!==void 0&&e.include!==void 0,rejectSelectInclude=e=>{let t=e[`~standard`],validate=e=>hasSelectAndInclude(e)?be:t.validate(e);return{...e,parse:validate,"~standard":{version:t.version,vendor:t.vendor,validate,get types(){return t.types},get jsonSchema(){return t.jsonSchema}}}},getDistinctSchema=e=>{let t=Object.keys(e[`~`].state.scalars).filter(t=>e[`~`].state.scalars[t][`~`].state.type!==`point`);return l.singleOrArray(l.enum(t))},getFindUniqueArgs=(e,t)=>withOmitProjection(rejectSelectInclude(l.object({where:l.lazyRef(()=>t.whereUniqueExtended),select:l.lazyRef(()=>t.select),include:l.lazyRef(()=>t.include),omit:l.lazyRef(()=>t.omit)},{atLeast:[`where`]})),e,`findUnique`),getFindFirstArgs=(e,t)=>withOmitProjection(rejectSelectInclude(l.object({where:l.lazyRef(()=>t.where),orderBy:l.lazyRef(()=>l.union([t.orderBy,l.array(t.orderBy)])),take:paginationTake(),skip:paginationSkip(),cursor:l.lazyRef(()=>t.whereUnique),select:l.lazyRef(()=>t.select),include:l.lazyRef(()=>t.include),omit:l.lazyRef(()=>t.omit),distinct:l.lazyRef(()=>getDistinctSchema(e))},{optional:!0})),e,`findFirst`),getFindManyArgs=(e,t)=>withOmitProjection(rejectSelectInclude(l.object({where:l.lazyRef(()=>t.where),orderBy:l.lazyRef(()=>l.union([t.orderBy,l.array(t.orderBy)])),take:paginationTake(),skip:paginationSkip(),cursor:l.lazyRef(()=>t.whereUnique),select:l.lazyRef(()=>t.select),include:l.lazyRef(()=>t.include),omit:l.lazyRef(()=>t.omit),distinct:l.lazyRef(()=>getDistinctSchema(e))},{optional:!0})),e,`findMany`),restrictToScalarProjection=(e,t,n)=>{let r=new Set(Object.keys(t[`~`].state.relations)),i=e[`~standard`],validate=e=>{if(hasOwnKey(e,`include`))return issue(`'include' is not supported on '${n}': a bulk write returns the rows its write statement produced, and viborm does not project relations into them. Select the scalar fields you need and read relations in a separate query.`);let t=findProjectedRelation(e,r);return t===void 0?i.validate(e):issue(`'select.${t}' is not supported on '${n}': a bulk write projects scalar fields only. Read the relation in a separate query.`)};return{...e,parse:validate,"~standard":{version:i.version,vendor:i.vendor,validate,get types(){return i.types},get jsonSchema(){return i.jsonSchema}}}},issue=e=>({issues:[{message:e}]}),hasOwnKey=(e,n)=>t(e)&&Object.hasOwn(e,n),findProjectedRelation=(e,n)=>{if(!t(e))return;let r=e.select;if(t(r)){for(let e of Object.keys(r))if(r[e]!==void 0&&(e===`_count`||n.has(e)))return e}},matchesEveryRow=e=>e===0||e===1,and=(e,t)=>e===2||t===2?2:e===3||t===3?3:e===1||t===1?1:0,conjunction=e=>e.reduce(and,0),negation=e=>e===1?2:e===2?1:e,disjunction=e=>{let t=2;for(let n of e){if(n===1)return 1;n===3&&(t=3)}return t};function truthOf(e,n,r){if(!t(e))return 3;let i=0;for(let t in e){let a=e[t],o=n===``?t:`${n}.${t}`;if(a===void 0){if(!r)return 3;r.push(o);continue}if(i=and(i,memberTruth(t,a,o,r)),n===``&&!matchesEveryRow(i))return i}return i}function memberTruth(e,n,r,i){if(e===`AND`||e===`OR`||e===`NOT`){let t=(Array.isArray(n)?n:[n]).map((e,t)=>truthOf(e,Array.isArray(n)?`${r}[${t}]`:r,i));return e===`AND`?conjunction(t):e===`OR`?disjunction(t.filter(e=>e!==0)):conjunction(t.map(negation))}if(t(n)&&n.every!==void 0){for(let e of Object.keys(n))if(e!==`every`){if(n[e]!==void 0||!i)return 3;i.push(`${r}.${e}`)}return matchesEveryRow(truthOf(n.every,`${r}.every`,i))?1:3}return 3}function undefinedOnlyWhere(e){let t=[];if(matchesEveryRow(truthOf(e,``,t))&&t.length!==0)return matchesEveryRow(truthOf(e,``,void 0))?void 0:t}function refusingUndefinedOnlyWhere(e,n,r,i){let a=e[`~standard`],o=a.validate,s=r?`every related row`:`every row`,c=`${r?`This nested `:``}${n} would ${n===`deleteMany`?`delete`:`update`} ${s}`;return a.validate=e=>{let n=o(e);if(n.issues)return n;let r=Array.isArray(e)?e:[e];for(let n=0;n<r.length;n++){let a=r[n],o=undefinedOnlyWhere(i?t(a)?a[i]:void 0:a);if(!o)continue;let l=Array.isArray(e)?[n]:[];return i&&l.push(i),{issues:[{message:`${c}: its where names only undefined values (${o.join(`, `)}), and an undefined value is no condition. Remove them, or pass where: {} to mean ${s}.`,path:l}]}}return n},e}const getCreateArgs=(e,t)=>withOmitProjection(rejectSelectInclude(l.object({data:l.lazyRef(()=>t.create),select:l.lazyRef(()=>t.select),include:l.lazyRef(()=>t.include),omit:l.lazyRef(()=>t.omit)},{atLeast:[`data`]})),e,`create`),refuseDefaultOnlySkipDuplicates=e=>{if(e.skipDuplicates===!0)return e.data.some(e=>t(e)&&Object.values(e).every(e=>e===void 0))?`createMany with skipDuplicates cannot include a row with no explicit scalar values; no portable duplicate-only DEFAULT VALUES primitive exists.`:void 0},getCreateManyArgs=(e,t)=>withOmitProjection(restrictToScalarProjection(l.object({data:l.lazyRef(()=>l.array(t.bulkCreate)),skipDuplicates:l.boolean({optional:!0}),select:l.lazyRef(()=>t.scalarSelect),omit:l.lazyRef(()=>t.omit)},{atLeast:[`data`],refuse:refuseDefaultOnlySkipDuplicates}),e,`createMany`),e,`createMany`),getUpdateArgs=(e,t)=>withOmitProjection(rejectSelectInclude(l.object({where:l.lazyRef(()=>t.whereUniqueExtended),data:l.lazyRef(()=>t.update),select:l.lazyRef(()=>t.select),include:l.lazyRef(()=>t.include),omit:l.lazyRef(()=>t.omit)},{atLeast:[`where`,`data`]})),e,`update`),getUpdateManyArgs=(e,t)=>withOmitProjection(restrictToScalarProjection(refusingUndefinedOnlyWhere(l.object({where:l.lazyRef(()=>t.where),data:l.lazyRef(()=>t.update),select:l.lazyRef(()=>t.scalarSelect),omit:l.lazyRef(()=>t.omit),limit:bulkWriteLimit()},{atLeast:[`data`]}),`updateMany`,!1,`where`),e,`updateMany`),e,`updateMany`),getDeleteArgs=(e,t)=>withOmitProjection(rejectSelectInclude(l.object({where:l.lazyRef(()=>t.whereUniqueExtended),select:l.lazyRef(()=>t.select),include:l.lazyRef(()=>t.include),omit:l.lazyRef(()=>t.omit)},{atLeast:[`where`]})),e,`delete`),getDeleteManyArgs=(e,t)=>withOmitProjection(restrictToScalarProjection(refusingUndefinedOnlyWhere(l.object({where:l.lazyRef(()=>t.where),select:l.lazyRef(()=>t.scalarSelect),omit:l.lazyRef(()=>t.omit),limit:bulkWriteLimit()},{optional:!0}),`deleteMany`,!1,`where`),e,`deleteMany`),e,`deleteMany`),getUpsertArgs=(e,t)=>withOmitProjection(rejectSelectInclude(l.object({where:l.lazyRef(()=>t.whereUniqueExtended),create:l.lazyRef(()=>t.create),update:l.lazyRef(()=>t.update),select:l.lazyRef(()=>t.select),include:l.lazyRef(()=>t.include),omit:l.lazyRef(()=>t.omit),targetWhere:l.lazyRef(()=>t.where),setWhere:l.lazyRef(()=>t.where)},{atLeast:[`where`,`create`,`update`]})),e,`upsert`),getArgsSchemas=(e,t,n)=>lazyRecord({findUnique:()=>getFindUniqueArgs(e,n),findFirst:()=>getFindFirstArgs(e,n),findMany:()=>getFindManyArgs(e,n),create:()=>getCreateArgs(e,n),createMany:()=>getCreateManyArgs(e,n),update:()=>getUpdateArgs(e,n),updateMany:()=>getUpdateManyArgs(e,n),delete:()=>getDeleteArgs(e,n),deleteMany:()=>getDeleteManyArgs(e,n),upsert:()=>getUpsertArgs(e,n),count:()=>getCountArgs(e,n),exist:()=>getExistArgs(n),aggregate:()=>getAggregateArgs(e,n),groupBy:()=>getGroupByArgs(e,t,n)}),slotMayBeEmpty=e=>{let t=e.edge;return t.kind===`junction`||t.kind===`variantJunctionCarrier`?!0:t.kind===`variantRowCarrier`?isSlot(t.carrier,e.slot)?t.storage.typeColumn.nullable:!0:isSlot(t.owner,e.slot)?nullableForeignFields(t).length>0:!0},clearableMembership=e=>{let t=e.edge;if(t.kind===`junction`||t.kind===`variantJunctionCarrier`)return{kind:`junctionRow`};if(t.kind===`variantRowCarrier`)return t.storage.typeColumn.nullable?{kind:`columns`,fields:[t.storage.typeColumn.name,t.storage.idColumn.name]}:{kind:`none`};let[n,...r]=nullableForeignFields(t);return n?{kind:`columns`,fields:[n,...r]}:{kind:`none`}},membershipCanBeCleared=e=>clearableMembership(e).kind!==`none`;function isSlot(e,t){return e.source===t.source&&e.field===t.field}function nullableForeignFields(e){let t=e.owner.source[`~`].state.scalars;return e.reference.members.map(e=>e.foreignField).filter(e=>t[e]?.[`~`].state.nullable===!0)}const getScalarCreate=(e,t)=>{let n=e[`~`].state,r={atLeast:Object.keys(n.scalars).filter(e=>!n.shape[e][`~`].state.optional),provides:e[`~`].names.ts};return l.fromObject(t.scalars,`create`,r)};function getBulkCreate(e,t,n){let r=e[`~`].state,i=getFkFields(r),a=getFkRequirementKeySets(r,n),o=getRequiredCreateScalars(r,i),s=l.fromObject(t.scalars,`create`),c=l.fromObject(t.relations,`create`),u=l.fromObject(t.polymorphic,`createMany`);return l.object({...s.entries,...c.entries,...u.entries},{atLeast:o,requiresOneOfKeySets:a,provides:e[`~`].names.ts})}const getRelationCreate=e=>l.fromObject(e.relations,`create`);function getFkFields(e){let t=new Set;for(let n of Object.values(e.relations)){let e=n[`~`].state.foreignKey;if(e)for(let n of e.fields)t.add(n)}return t}function getRequiredCreateScalars(e,t){return Object.keys(e.scalars).filter(n=>!t.has(n)&&mustBeSuppliedOnCreate(e,n))}function mustBeSuppliedOnCreate(e,t){let n=e.scalars[t][`~`].state;return!(n.hasDefault||n.optional)}function getFkRequirementKeySets(e,t){let n=[];for(let[r,i]of Object.entries(e.relations)){let a=i[`~`].state;if(a.cardinality!==`one`)continue;let o=a.foreignKey;if(o){let i=o.fields.filter(t=>mustBeSuppliedOnCreate(e,t));if(i.length>0){let e=t.get(r),a=e&&!slotMayBeEmpty(e)?o.fields:i;n.push([a,[r]])}continue}let s=t.get(r);s&&!slotMayBeEmpty(s)&&n.push([[r]])}return n}const getCreateSchema=(e,t,n)=>{let r=e[`~`].state,i=getFkFields(r),a=getFkRequirementKeySets(r,n),o=getRequiredCreateScalars(r,i),s=l.fromObject(t.scalars,`create`),c=l.fromObject(t.relations,`create`),u=l.fromObject(t.polymorphic,`create`);return l.object({...s.entries,...c.entries,...u.entries},{atLeast:o,requiresOneOfKeySets:a,provides:e[`~`].names.ts})};function nonNullable(e,t){let n=e[`~standard`].validate,r=h(`nonNullable`,e=>e===null?v(t):n(e));return r.wrapped=e,r}const getUniqueScalarSchemas=(e,t)=>{let n={};for(let r of Object.keys(e[`~`].state.uniques)){let e=t.scalars[r];e&&(n[r]=e)}return n},getScalarFilter=e=>l.fromObject(e.scalars,`filter`),uniqueMember=e=>nonNullable(e,`A unique selector cannot be null: a unique index holds any number of nulls, so null names no single row.`),getUniqueFilter=(e,t)=>{let n={};for(let[r,i]of Object.entries(getUniqueScalarSchemas(e,t)))n[r]=uniqueMember(i.base);return l.object(n)},getRelationFilter=e=>l.fromObject(e.relations,`filter`),compoundSelector=(e,t)=>{let n={};for(let r of Object.keys(e.entries))n[r]=uniqueMember(t[r].base);return l.object(n,{partial:!1})},compoundSelectors=(e,t)=>{let n={};for(let[r,i]of Object.entries(e??{}))n[r]=compoundSelector(i,t);return n},getCompoundConstraintFilter=(e,t)=>{let n=e[`~`].state;if(!(n.compoundUniques||n.compoundId))return l.object({});let r=t.scalars;return l.object({...compoundSelectors(n.compoundUniques,r),...compoundSelectors(n.compoundId,r)})},getCompoundIdFilter=(e,t)=>{let n=e[`~`].state;return n.compoundId?l.object(compoundSelectors(n.compoundId,t.scalars)):l.object({})},A=l.boolean({optional:!0}),xe=l.enum([`l2`,`cosine`]),toManyRelationNames=e=>{let t=e[`~`].state.relations,n=[];for(let e of Object.keys(t))t[e][`~`].state.cardinality===`many`&&n.push(e);return n},getCountSchema=(e,t)=>{let n=toManyRelationNames(e),r=l.fromObject(t.relations,`countFilter`,{optional:!0}),i=l.fromObject(t.polymorphic,`countFilter`,{optional:!0});return l.union([l.coerce(l.literal(!0),()=>{let e={};for(let t of n)e[t]=!0;return{select:e}}),l.object({select:l.object({...r.entries,...i.entries},{optional:!0})},{optional:!0})])},Se=l.object({_distance:l.object({to:l.array(l.number()),metric:xe},{partial:!1})},{partial:!1}),Ce=l.object({_distance:l.object({to:l.point()},{partial:!1})},{partial:!1}),we=l.union([A,Se]),Te=l.union([A,Ce]),selects=e=>e!==void 0&&e!==!1,requireSelectedField=e=>Object.entries(e).some(([e,n])=>e===`_count`?t(n)&&Object.values(new Object(n.select)).some(selects):selects(n))?void 0:`select needs at least one truthy value; leave it out to return the default row.`,getScalarSelectEntries=e=>{let t=[],n=[],r=[],i=projectableScalarNames(e);for(let a of i){let i=e[`~`].state.scalars[a];if(i[`~`].state.type===`vector`){t.push(a);continue}if(i[`~`].state.type===`point`){n.push(a);continue}r.push(a)}let a=l.fromKeys(r,A),o=l.fromKeys(t,we),s=l.fromKeys(n,Te);return{...a.entries,...o.entries,...s.entries}},getScalarSelectSchema=e=>l.object(getScalarSelectEntries(e),{refuse:requireSelectedField}),getSelectSchema=(e,t)=>{let n=getScalarSelectEntries(e),r=l.fromObject(t.relations,`select`),i=l.fromObject(t.polymorphic,`select`);return l.object({...n,...r.entries,...i.entries,_count:getCountSchema(e,t)},{refuse:requireSelectedField})},getIncludeSchema=(e,t)=>{let n=l.fromObject(t.relations,`include`,{optional:!0}),r=l.fromObject(t.polymorphic,`include`,{optional:!0});return l.object({...n.entries,...r.entries,_count:getCountSchema(e,t)})},getScalarUpdate=e=>l.fromObject(e.scalars,`update`),getRelationUpdate=e=>l.fromObject(e.relations,`update`),getUpdateSchema=e=>{let t=l.fromObject(e.relations,`update`),n=l.fromObject(e.polymorphic,`update`);return getScalarUpdate(e).extend(t.entries).extend(n.entries)},getWhereSchema=(e,t)=>{let n=d(t.scalars,`filter`),r=d(t.relations,`filter`),i=d(t.polymorphic,`filter`),a=l.object({AND:()=>l.optional(l.union([a,l.array(a)])),OR:()=>l.optional(l.array(a)),NOT:()=>l.optional(l.union([a,l.array(a)])),...n,...r,...i});return s(u(a),e)};function getDecimalListWhereUniqueEntries(e){let t=[];for(let n of Object.keys(e[`~`].state.scalars)){let r=e[`~`].state.scalars[n][`~`].state;r.type===`decimal`&&r.array===!0&&t.push(n)}return l.fromKeys(t,l.refused(`A decimal list cannot be used as a unique selector or cursor.`))}const getWhereUniqueSchema=(e,t)=>{let n=getUniqueFilter(e,t),r=getCompoundConstraintFilter(e,t),i={...n.entries,...r.entries},a=Object.keys(i),o=getDecimalListWhereUniqueEntries(e),s={...i,...o.entries};return l.object(s,{nonEmpty:!0,requiresOneOf:[a]})},getWhereUniqueExtendedSchema=(e,t)=>{let n=getUniqueFilter(e,t),r=getCompoundConstraintFilter(e,t),i=getWhereSchema(e,t),a={...n.entries,...r.entries},o=Object.keys(a),c={...i.entries,...a};return s(l.object(c,{nonEmpty:!0,requiresOneOf:[o]}),e)},getCoreSchemas=(e,t,n)=>{let r=lazyRecord({scalarFilter:()=>getScalarFilter(t),uniqueFilter:()=>getUniqueFilter(e,t),relationFilter:()=>getRelationFilter(t),compoundIdFilter:()=>getCompoundIdFilter(e,t),compoundConstraintFilter:()=>getCompoundConstraintFilter(e,t),scalarCreate:()=>getScalarCreate(e,t),bulkCreate:()=>getBulkCreate(e,t,n),relationCreate:()=>getRelationCreate(t),scalarUpdate:()=>getScalarUpdate(t),relationUpdate:()=>getRelationUpdate(t),where:()=>getWhereSchema(e,t),whereUnique:()=>getWhereUniqueSchema(e,t),whereUniqueExtended:()=>getWhereUniqueExtendedSchema(e,t),create:()=>getCreateSchema(e,t,n),update:()=>getUpdateSchema(t),select:()=>getSelectSchema(e,t),omit:()=>getOmitSchema(e),upsertProjection:()=>getUpsertProjectionSchema(e,r),scalarSelect:()=>getScalarSelectSchema(e),include:()=>getIncludeSchema(e,t),orderBy:()=>getOrderBySchema(e,t)});return r},getModelSchemas=(e,t,n)=>{let r=getCoreSchemas(e,t,n);return{core:r,args:getArgsSchemas(e,t,r),scalars:t.scalars,relations:t.relations,polymorphic:t.polymorphic}},countFilterFactory=(e,t)=>l.union([l.literal(!0),l.object({where:()=>t().core.where})]),j={kind:`none`,keys:[]},isAskingSlot=(e,t)=>t.source===e.slot.source&&t.field===e.slot.field,ownedByEnclosingStep=e=>{let t=e.edge;return t.kind===`foreignKey`?isAskingSlot(e,t.owner)?j:{kind:`columns`,keys:t.reference.members.map(e=>e.foreignField)}:t.kind===`variantRowCarrier`||t.kind===`variantJunctionCarrier`?isAskingSlot(e,t.carrier)?j:{kind:`carrier`,keys:[t.carrier.field]}:j},nestedRelationDataProjection=(t,n)=>{let r=ownedByEnclosingStep(t),bareUpdate=()=>n().core.update,i=e(()=>m.omit(n().core.create,r.keys),`getCreateSchema`),a=e(()=>m.omit(bareUpdate(),r.keys),`getUpdateSchema`);return{getCreateSchema:i,getUpdateSchema:a,getSelectedUpsertUpdateSchema:r.kind===`carrier`?bareUpdate:a,getCreateUpsertUpdateSchema:r.kind===`columns`?bareUpdate:a}},Ee=new Set([`disconnect`,`delete`]),De=new Set([`create`,`connect`,`connectOrCreate`]);function isAcceptedComposition(e,t){if(e.length<=1)return!0;let n,r,i=!1;for(let t of e)if(Ee.has(t)){if(n!==void 0)return!1;n=t}else if(De.has(t)){if(r!==void 0)return!1;r=t}else if(t===`update`)i=!0;else return!1;return r===void 0||n===`delete`&&r===`connectOrCreate`?!1:i?t||n===void 0&&r===`connect`:!0}const unsupportedCombination=e=>({issues:[{message:`Unsupported to-one operation combination: ${e.join(`, `)}`}]});function enforceCompositionLattice(e,n,r,i){if(e.issues)return e;let a=e.value;if(!t(a))return e;let o=[];for(let e of n){let t=a[e];t!==void 0&&t!==!1&&o.push(e)}return i?o.length===1?e:o.length===0?{issues:[{message:`Missing to-one operation: expected exactly one of ${n.join(`, `)}`}]}:unsupportedCombination(o):isAcceptedComposition(o,r)?e:unsupportedCombination(o)}function toOneMutationSchema(e,t,n,r){let i=l.object(e,t),a=Object.keys(e),o=i[`~standard`].validate,s=n===!0,c=r===`exactlyOne`,validate=(e,t)=>enforceCompositionLattice(o(e,t),a,s,c),u={...i,"~standard":{version:1,vendor:`viborm`,validate,get jsonSchema(){return i[`~standard`].jsonSchema}}};return Object.defineProperty(u,` vibInferred`,{value:void 0,enumerable:!1}),u}const toOneCreateFactory=(e,t)=>{let n=nestedRelationDataProjection(e,t).getCreateSchema;return toOneMutationSchema({create:n,connect:()=>t().core.whereUnique,connectOrCreate:m.object({where:()=>t().core.whereUnique,create:n},{partial:!1})},{optional:!0})},toManyCreateFactory=(e,t)=>{let n=nestedRelationDataProjection(e,t),r=n.getCreateSchema,i=m.object({data:()=>m.array(r()),skipDuplicates:m.boolean({optional:!0})},{atLeast:[`data`],refuse:refuseDefaultOnlySkipDuplicates});return m.object({create:()=>m.singleOrArray(r()),createMany:i,connect:()=>m.singleOrArray(t().core.whereUnique),connectOrCreate:()=>m.singleOrArray(m.object({where:()=>t().core.whereUnique,create:r},{partial:!1})),upsert:()=>m.singleOrArray(m.object({where:()=>t().core.whereUnique,create:r,update:n.getCreateUpsertUpdateSchema},{partial:!1}))},{optional:!0})},Oe=1e4;function carriesRepeatedKey(e,t){return e===!1||t<e}const M=Object.freeze({minimum:1,maximum:1e3}),N=Object.assign(h(`integer`,e=>{let t=b(e);return t.issues?t:t.value>=M.minimum&&t.value<=M.maximum?y(t.value):v(`recurse.depth must be a positive safe integer between 1 and 1000`)}),M),P=l.object({depth:l.optional(l.union([N,l.literal(!1)])),preventCycles:l.optional(l.refused(`preventCycles applies only to a junction graph; a foreign-key recursion rejects every cycle it reaches`))}),F=l.object({depth:l.optional(N),preventCycles:l.optional(l.boolean())}),I=l.object({depth:l.literal(!1),preventCycles:l.optional(l.literal(!0))},{atLeast:[`depth`]}),L={maxOccurrences:l.optional(h(`integer`,e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=1?y(e):v(`recurse.maxOccurrences must be a positive safe integer`))),fewRows:l.optional(l.boolean())},R={selective:l.optional(l.boolean())},withOptions=(e,t)=>({...e,...t.maxOccurrences!==void 0&&{maxOccurrences:t.maxOccurrences},...t.selective===!0&&{selective:!0},...t.fewRows===!0&&{fewRows:!0}}),normalizeForeignKey=e=>withOptions({depth:e.depth??100,cycles:`reject`},e),normalizeGraph=e=>withOptions({depth:e.depth??100,cycles:e.preventCycles===!1?`allow`:`prevent`},e),z=l.coerce(l.literal(!0),()=>normalizeForeignKey({})),B=l.coerce(l.literal(!0),()=>normalizeGraph({})),ke={projection:{foreignKey:l.union([z,l.coerce(P.extend(L),normalizeForeignKey)]),junction:l.union([B,l.coerce(l.union([F.extend(L),I.extend(L)]),normalizeGraph)])},filter:{foreignKey:l.union([z,l.coerce(P.extend(R),normalizeForeignKey)]),junction:l.union([B,l.coerce(l.union([F.extend(R),I.extend(R)]),normalizeGraph)])}};function recurrenceSchema(e,t=`projection`){let{edge:n,slot:r}=e;if(n.kind!==`foreignKey`&&n.kind!==`junction`)return;let[i,a]=n.endpoints;if(i.source===a.source&&re(r.source).rowKey)return ke[t][n.kind]}const V=`recurse is available only on an ordinary self relation (a foreign key or a junction, never variant storage) whose model has a complete primary key`,unavailableRecurrence=()=>l.optional(l.refused(V)),unavailableRecursiveClause=e=>l.optional(l.refused(`${e} cannot be combined with recurse`)),withoutUnspelledClosure=e=>{if(!(t(e)&&(`recurse`in e||`self`in e&&e.self===void 0)))return e;let{recurse:n,self:r,...i}=e;return r===void 0?i:{...i,self:r}},withRecursiveNode=(e,n)=>{let r=e[`~standard`].validate,i=n?.[`~standard`].validate,a=h(`union`,e=>!t(e)||e.recurse===void 0?r(withoutUnspelledClosure(e)):i?i(e):v(V,[`recurse`])),o=Array.isArray(e.options)?e.options:[e];return Object.assign(a,{options:[...o,...n?[n]:[]]})},H=h(`object`,()=>y({is:null})),U=[`some`,`every`,`none`],Ae=[`is`,`isNot`],requireRelationQuantifier=(e,t)=>{let n=`Relation filter '${e.slot.field}' requires one of: ${t.join(`, `)}.`;return e=>t.some(t=>e[t]!==void 0)?void 0:n},quantifierEntries=e=>({some:()=>e().core.where,every:()=>e().core.where,none:()=>e().core.where}),recursiveFilter=(e,t)=>{let n=recurrenceSchema(e,`filter`);return n&&m.object({recurse:o(n),self:m.boolean(),...quantifierEntries(t),is:unavailableRecursiveClause(`is`),isNot:unavailableRecursiveClause(`isNot`)},{atLeast:[`recurse`],refuse:requireRelationQuantifier(e,U)})},je=new Set([`is`,`isNot`]),isExplicitToOneFilter=e=>{for(let t in e)if(!je.has(t))return!1;return!0},toOneFilterFactory=(e,n)=>{let r=slotMayBeEmpty(e),i=m.object({is:()=>m.maybeNullable(n().core.where,r),isNot:()=>m.maybeNullable(n().core.where,r)},{refuse:requireRelationQuantifier(e,Ae)}),a=m.lazy(()=>m.coerce(n().core.where,e=>({is:e}))),o=r?[H,i,a]:[i,a],s=h(`union`,e=>e===null?r?g(H,e):v(`Expected object`):t(e)?isExplicitToOneFilter(e)?g(i,e):g(a,e):v(`Expected object`));return withRecursiveNode(Object.assign(s,{options:o}),recursiveFilter(e,n))},toManyFilterFactory=(e,t)=>withRecursiveNode(m.object(quantifierEntries(t),{refuse:requireRelationQuantifier(e,U)}),recursiveFilter(e,t)),isOrderableToOneRelation=e=>e.cardinality===`one`&&!x(e),createToManyRelationOrderByFailureSchema=e=>l.refused(`Relation orderBy '${e}' cannot order through a to-many relation; use '_count'.`),getModelScalarOrderByEntries=e=>{let t=[],n=[],r=[],i=Object.keys(e[`~`].state.scalars);for(let a of i){if(isDecimalListScalarKey(e,a)){r.push(a);continue}if(e[`~`].state.scalars[a][`~`].state.type===`vector`){t.push(a);continue}n.push(a)}let a=f(n,C),o=f(t,he),s=f(r,w);return{...a,...o,...s}},getToOneRelationOrderByEntries=(e,t)=>{if(t<=0)return{};let n={},r=e[`~`].state.relations;for(let[e,i]of Object.entries(r)){let r=i[`~`].state;if(isOrderableToOneRelation(r)){n[e]=()=>l.lazyRef(()=>buildToOneOrderBySchema(i[`~`].settleTarget(),t-1));continue}n[e]=createToManyRelationOrderByFailureSchema(e)}return n},buildToOneOrderBySchema=(e,t)=>{let n=getModelScalarOrderByEntries(e),r=getToOneRelationOrderByEntries(e,t);return l.object({...n,...r})},toOneOrderByFactory=(e,t)=>()=>l.lazyRef(()=>buildToOneOrderBySchema(e[`~`].settleTarget(),7)),toManyOrderByFactory=e=>l.object({_count:l.enum([`asc`,`desc`])}),getTargetState=e=>getTargetModel(e)[`~`].state,getTargetModel=e=>e[`~`].settleTarget(),buildSelectionForModel=e=>{let t={};for(let n of projectableScalarNames(e))t[n]=!0;return t},nestedOmitLabel=e=>{let t=e[`~`].state.name;return t?`include.${t}`:`a nested include`},withOmitForModel=(e,t,n)=>withOmitProjection(n,e,t),withNestedOmit=(e,t)=>withOmitForModel(getTargetModel(e),nestedOmitLabel(e),t),askingKeyRefusal=e=>l.optional(l.refused(`${e} is produced by recurse and cannot be selected again inside its own recursive node`)),projectionWithoutAsking=(e,t)=>e.extend({[t]:askingKeyRefusal(t)}),termOrList=e=>l.union([e,l.array(e)]),buildRecursiveNode=(e,t,n,r,i={})=>l.coerce(withNestedOmit(e,rejectSelectInclude(l.object({...i,select:()=>projectionWithoutAsking(r().core.select,t),include:()=>projectionWithoutAsking(r().core.include,t),omit:()=>r().core.omit,recurse:n}))),includeToField(e)),withRecurrence=(e,t,n,r,i)=>{let a=recurrenceSchema(n);return a?withRecursiveNode(e,buildRecursiveNode(t,n.slot.field,a,r,i?.())):e},nestedDistinctNames=e=>Object.keys(getTargetState(e).scalars),includeToFieldForModel=e=>t=>{if(Object.hasOwn(t,`select`)&&t.select!==!1)return t;let n=buildSelectionForModel(e);return Object.keys(n).length===0?t:{...t,select:n}},includeToField=e=>includeToFieldForModel(getTargetModel(e)),defaultSelectionNode=e=>{let t=buildSelectionForModel(e);return Object.keys(t).length>0?{select:t}:{}},booleanToSelect=e=>l.coerce(l.boolean(),t=>t?defaultSelectionNode(getTargetModel(e)):!1),toOneIncludeFactory=(e,t,n)=>withRecurrence(l.union([booleanToSelect(e),l.coerce(withNestedOmit(e,rejectSelectInclude(l.object({select:()=>n().core.select,include:()=>n().core.include,omit:()=>n().core.omit,recurse:unavailableRecurrence()}))),includeToField(e))]),e,t,n),buildToManyNestedNode=e=>{let{targetModel:t,label:n,scalarNames:r}=e,at=t=>e.core()[t];return l.coerce(withOmitForModel(t,n,rejectSelectInclude(l.object({where:()=>at(`where`),orderBy:()=>termOrList(at(`orderBy`)),take:paginationTake(),skip:paginationSkip(),cursor:()=>at(`whereUnique`),distinct:l.enum(r,{array:!0}),select:()=>at(`select`),include:()=>at(`include`),omit:()=>at(`omit`),recurse:unavailableRecurrence()}))),includeToFieldForModel(t))},toManyIncludeFactory=(e,t,n)=>withRecurrence(l.union([booleanToSelect(e),buildToManyNestedNode({targetModel:getTargetModel(e),label:nestedOmitLabel(e),core:()=>n().core,scalarNames:nestedDistinctNames(e)})]),e,t,n,()=>({where:()=>n().core.where,orderBy:()=>termOrList(n().core.orderBy),take:unavailableRecursiveClause(`take`),skip:unavailableRecursiveClause(`skip`),cursor:unavailableRecursiveClause(`cursor`),distinct:unavailableRecursiveClause(`distinct`)})),Me=toOneIncludeFactory,Ne=toManyIncludeFactory;function readToOneUpdateForm(e,t){return hasEnvelopeShape(e)?!t||e.where!==void 0?`envelope`:`ambiguous`:`bare`}function toOneUpdateEnvelope(e,t){return t?{where:{},data:e}:{data:e}}function hasEnvelopeShape(e){return isPlainObject(e)&&Object.hasOwn(e,`data`)&&isPlainObject(e.data)}function isPlainObject(e){if(!t(e))return!1;let n=Object.getPrototypeOf(e);return n===Object.prototype||n===null}function toOneUpdateTargetFactory(e,t){let n=t,r=l.object({where:()=>e().core.where,data:n},{atLeast:[`data`]}),i=l.lazy(n),a=[r,i],o,targetOwnsDataField=()=>(o===void 0&&(o=Object.hasOwn(n().entries,`data`)),o),s=h(`union`,e=>{let t=targetOwnsDataField(),n=readToOneUpdateForm(e,t);if(n===`ambiguous`)return v("Ambiguous to-one nested `update`: `{ data: … }` reads both as the `{ where?, data }` envelope and as bare update data for this target's own `data` field. Spell the envelope out — `update: { where: {}, data: { … } }` updates the target's fields (put a filter in `where` to make it conditional), and `update: { where: {}, data: { data: … } }` writes its `data` field.");if(n===`envelope`)return g(r,e);let a=g(i,e);return a.issues?a:y(toOneUpdateEnvelope(a.value,t))});return s.options=a,s}const toOneUpdateFactory=(e,t,n)=>{let r=nestedRelationDataProjection(t,n),i=r.getCreateSchema,a=r.getUpdateSchema,o={create:i,connect:()=>n().core.whereUnique,connectOrCreate:l.object({where:()=>n().core.whereUnique,create:i},{partial:!1}),update:()=>toOneUpdateTargetFactory(n,a),upsert:l.object({create:i,update:a},{partial:!1})},s=e.foreignKey===void 0;return slotMayBeEmpty(t)?membershipCanBeCleared(t)?toOneMutationSchema({...o,disconnect:l.boolean(),delete:l.boolean()},void 0,s):toOneMutationSchema({...o,delete:l.boolean()},void 0,s):toOneMutationSchema(o,void 0,s)},toManyUpdateFactory=(e,t)=>{let n=nestedRelationDataProjection(e,t),r=n.getCreateSchema,i=n.getUpdateSchema,a=n.getSelectedUpsertUpdateSchema,o=l.object({data:()=>l.array(r()),skipDuplicates:l.boolean({optional:!0})},{atLeast:[`data`],refuse:refuseDefaultOnlySkipDuplicates}),s=l.object({where:()=>t().core.whereUnique,create:r},{partial:!1}),c=l.object({where:()=>t().core.whereUniqueExtended,data:i},{atLeast:[`where`,`data`]}),u=refusingUndefinedOnlyWhere(l.object({where:()=>t().core.where,data:i},{atLeast:[`data`]}),`updateMany`,!0,`where`),d=l.object({where:()=>t().core.whereUniqueExtended,create:r,update:a},{partial:!1}),f=membershipCanBeCleared(e)?{disconnect:()=>l.singleOrArray(t().core.whereUnique)}:{};return l.object({create:()=>l.singleOrArray(r()),createMany:o,connect:()=>l.singleOrArray(t().core.whereUnique),...f,delete:()=>l.singleOrArray(t().core.whereUniqueExtended),connectOrCreate:l.singleOrArray(s),set:()=>l.singleOrArray(t().core.whereUnique),update:l.singleOrArray(c),updateMany:l.singleOrArray(u),upsert:l.singleOrArray(d),deleteMany:()=>refusingUndefinedOnlyWhere(l.singleOrArray(t().core.where),`deleteMany`,!0)})},toOneSchemas=(e,t,n)=>{let r=e[`~`].state;return{filter:l.lazy(()=>toOneFilterFactory(t,n)),create:l.lazy(()=>toOneCreateFactory(t,n)),update:l.lazy(()=>toOneUpdateFactory(r,t,n)),select:l.lazy(()=>Me(e,t,n)),include:l.lazy(()=>toOneIncludeFactory(e,t,n)),orderBy:toOneOrderByFactory(e,n),countFilter:l.lazy(()=>countFilterFactory(r,n))}},toManySchemas=(e,t,n)=>{let r=e[`~`].state;return{filter:l.lazy(()=>toManyFilterFactory(t,n)),create:l.lazy(()=>toManyCreateFactory(t,n)),update:l.lazy(()=>toManyUpdateFactory(t,n)),select:l.lazy(()=>Ne(e,t,n)),include:l.lazy(()=>toManyIncludeFactory(e,t,n)),orderBy:l.lazy(()=>toManyOrderByFactory(r)),countFilter:l.lazy(()=>countFilterFactory(r,n))}},getRelationSchemas=(e,t,n)=>e[`~`].state.cardinality===`many`?toManySchemas(e,t,n):toOneSchemas(e,t,n),getRelationsSchemas=(e,t,n)=>{let r={},i=e[`~`].state.relations;for(let a in i){let o=i[a];if(x(o[`~`].state))continue;let s=resolvedSlotOrThrow(e,a,n);r[a]=()=>getRelationSchemas(o,s,t(o))}return lazyRecord(r)},resolvedSlotOrThrow=(e,t,n)=>{let i=n.get(t);if(i)return i;let a=e[`~`].names.ts??`model`;throw new r({kind:`registry`,property:t},[{path:`${a}.${t}`,message:`The resolved relation index does not describe '${a}.${t}'`}])},polymorphicPublicTypes=e=>Object.keys(e.target.entries);function taggedVerb(e,t,n){return l.singleOrArray(l.union(e.map(e=>l.object({type:l.literal(e),...t(e)},n))))}function collectionVerbs(e,t){let n=t,r=polymorphicPublicTypes(e),tagged=(e,t={partial:!1})=>taggedVerb(r,e,t);return{create:tagged(e=>({data:()=>n[e]().core.create})),createMany:tagged(e=>({data:()=>l.array(n[e]().core.create),skipDuplicates:l.boolean({optional:!0})}),{atLeast:[`type`,`data`],refuse:refuseDefaultOnlySkipDuplicates}),connect:tagged(e=>({where:()=>n[e]().core.whereUnique})),connectOrCreate:tagged(e=>({where:()=>n[e]().core.whereUnique,create:()=>n[e]().core.create})),set:tagged(e=>({where:()=>n[e]().core.whereUnique})),disconnect:tagged(e=>({where:()=>n[e]().core.whereUnique})),delete:tagged(e=>({where:()=>n[e]().core.whereUniqueExtended})),deleteMany:refusingUndefinedOnlyWhere(tagged(e=>({where:()=>n[e]().core.where})),`deleteMany`,!0,`where`),update:tagged(e=>({where:()=>n[e]().core.whereUniqueExtended,data:()=>n[e]().core.update}),{atLeast:[`type`,`where`,`data`]}),updateMany:refusingUndefinedOnlyWhere(tagged(e=>({where:()=>n[e]().core.where,data:()=>n[e]().core.update}),{atLeast:[`type`,`data`]}),`updateMany`,!0,`where`),upsert:tagged(e=>({where:()=>n[e]().core.whereUniqueExtended,create:()=>n[e]().core.create,update:()=>n[e]().core.update}))}}function polymorphicCollectionCreateFactory(e,t){let n=collectionVerbs(e,t);return l.object({create:n.create,createMany:n.createMany,connect:n.connect,connectOrCreate:n.connectOrCreate},{optional:!0})}function polymorphicCollectionUpdateFactory(e,t){let n=collectionVerbs(e,t);return l.object({create:n.create,createMany:n.createMany,connect:n.connect,connectOrCreate:n.connectOrCreate,set:n.set,disconnect:n.disconnect,delete:n.delete,deleteMany:n.deleteMany,update:n.update,updateMany:n.updateMany,upsert:n.upsert})}function taggedTargetPredicate(e,t){let n=polymorphicPublicTypes(e).flatMap(e=>{let n=t[e];return[l.object({type:l.literal(e)},{partial:!1}),l.object({type:l.literal(e),is:()=>n().core.where},{partial:!1}),l.object({type:l.literal(e),isNot:()=>n().core.where},{partial:!1})]});return l.union(n)}function polymorphicCollectionCountFilterFactory(e,t){let n=t;return l.union([l.literal(!0),l.object({where:taggedTargetPredicate(e,n)})])}const polymorphicToOneCountFilterRefusal=()=>l.refused(`A polymorphic to-one slot has no collection to count.`);function polymorphicCreateFactory(e,t){let n=t,r=polymorphicPublicTypes(e);return toOneMutationSchema({connect:l.union(r.map(e=>l.object({type:l.literal(e),where:()=>n[e]().core.whereUnique},{partial:!1}))),create:l.union(r.map(e=>l.object({type:l.literal(e),data:()=>n[e]().core.create},{partial:!1}))),connectOrCreate:l.union(r.map(e=>l.object({type:l.literal(e),where:()=>n[e]().core.whereUnique,create:()=>n[e]().core.create},{partial:!1})))},void 0,!1,`exactlyOne`)}function polymorphicCreateManyFactory(e,t){let n=t;return l.union(polymorphicPublicTypes(e).map(e=>l.object({connect:l.object({type:l.literal(e),where:()=>n[e]().core.whereUnique},{partial:!1})},{partial:!1})))}function polymorphicFilterFactory(e,n){let r=taggedTargetPredicate(e,n),i=[l.object({is:l.literal(null)},{partial:!1}),l.object({isNot:l.literal(null)},{partial:!1})],a=l.union(i),o=l.literal(null,{transform:()=>({is:null})}),s=e.optional===!0,c=s?[o,a,r]:[r],u=h(`union`,e=>e===null?s?g(o,e):v(`Expected polymorphic filter with a type`):t(e)?Object.hasOwn(e,`type`)?g(r,e):s?g(a,e):v(`Expected polymorphic filter with a type`):v(`Expected object`));return u.options=c,u}function polymorphicCollectionFilterFactory(e,t,n){let r=taggedTargetPredicate(t,n),i=`Polymorphic collection filter '${e}' requires one of: some, every, none.`;return l.object({some:r,every:r,none:r},{refuse:e=>e.some!==void 0||e.every!==void 0||e.none!==void 0?void 0:i})}const polymorphicCollectionOrderByFactory=()=>l.object({_count:l.enum([`asc`,`desc`])}),polymorphicToOneOrderByRefusal=()=>l.refused(`A polymorphic to-one slot cannot be ordered on: the target model is chosen per row, so there is no single column to sort by.`);function polymorphicSelectFactory(e,t){let n=e[`~`].state,r=t,i={};for(let t of polymorphicPublicTypes(n)){let n=r[t],a=e[`~`].settleTarget(t);i[t]=()=>l.union([l.literal(!0),l.lazy(()=>{let e=n(),r=a,i=withOmitProjection(rejectSelectInclude(l.object({select:()=>e.core.select,include:()=>e.core.include,omit:()=>e.core.omit})),r,`polymorphic.${t}`);return l.coerce(i,e=>{if(e.select!==void 0)return e;let t={};for(let e of projectableScalarNames(r))t[e]=!0;return Object.keys(t).length===0?e:{...e,select:t}})})])}return l.union([l.boolean(),l.object(i)])}const Pe=polymorphicSelectFactory,onlyAllowList=e=>{let t=l.enum(e,{array:!0});return Object.assign(h(`polymorphic_only`,n=>{let r=g(t,n);if(r.issues)return r;let i=new Set;for(let e of r.value){if(i.has(e))return v(`Duplicate value in 'only': '${e}'`);i.add(e)}return y(e.filter(e=>i.has(e)))}),{wrapped:t})},rejectVariantsOutsideOnly=e=>{let n=e[`~standard`],validate=e=>{if(!t(e))return n.validate(e);let r=e.only,i=e.variants;if(!(Array.isArray(r)&&t(i)))return n.validate(e);let a=n.validate(e);if(a.issues)return a;let o=new Set(r),s=Object.keys(i).find(e=>!o.has(e));return s===void 0?a:{issues:[{message:`Variant '${s}' is not in 'only'`,path:[`variants`,s]}]}};return{...e,parse:validate,"~standard":{version:n.version,vendor:n.vendor,validate,get types(){return n.types},get jsonSchema(){return n.jsonSchema}}}};function polymorphicCollectionSelectFactory(e,t){let n=e[`~`].state,r=polymorphicPublicTypes(n),i={};for(let n of r){let r=t[n],a=e[`~`].settleTarget(n);i[n]=()=>l.union([l.coerce(l.literal(!0),()=>defaultSelectionNode(a)),l.lazy(()=>buildToManyNestedNode({targetModel:a,label:`polymorphic.${n}`,core:()=>r().core,scalarNames:Object.keys(a[`~`].state.scalars)}))])}let a=rejectVariantsOutsideOnly(l.object({only:onlyAllowList(r),variants:l.object(i)}));return l.union([l.boolean(),a])}const Fe=polymorphicCollectionSelectFactory;function polymorphicUpdateFactory(e,t){let n=t,r=polymorphicPublicTypes(e),typed=e=>({type:l.literal(e)}),i={connect:l.union(r.map(e=>l.object({...typed(e),where:()=>n[e]().core.whereUnique},{partial:!1}))),create:l.union(r.map(e=>l.object({...typed(e),data:()=>n[e]().core.create},{partial:!1}))),connectOrCreate:l.union(r.map(e=>l.object({...typed(e),where:()=>n[e]().core.whereUnique,create:()=>n[e]().core.create},{partial:!1}))),update:l.union(r.map(e=>l.object({...typed(e),where:()=>n[e]().core.where,data:()=>n[e]().core.update},{atLeast:[`type`,`data`]}))),upsert:l.union(r.map(e=>l.object({...typed(e),create:()=>n[e]().core.create,update:()=>n[e]().core.update},{partial:!1})))};return e.optional===!0?toOneMutationSchema({...i,delete:l.union(r.map(e=>l.object(typed(e),{partial:!1}))),disconnect:l.literal(!0)},void 0,!1,`exactlyOne`):toOneMutationSchema(i,void 0,!1,`exactlyOne`)}function getTargetSchemas(e,t,n){let r={};for(let i of Object.keys(t.target.entries))r[i]=()=>n(e[`~`].settleTarget(i));return r}function getPolymorphicRelationsSchemas(e,t){let n={},r=e[`~`].state.relations;for(let e of Object.keys(r)){let i=r[e],a=i[`~`].state;x(a)&&(n[e]=()=>{let n=getTargetSchemas(i,a,t);return a.cardinality===`many`?lazyRecord({filter:()=>polymorphicCollectionFilterFactory(e,a,n),create:()=>polymorphicCollectionCreateFactory(a,n),createMany:()=>polymorphicCollectionCreateFactory(a,n),update:()=>polymorphicCollectionUpdateFactory(a,n),select:()=>polymorphicCollectionSelectFactory(i,n),include:()=>Fe(i,n),orderBy:()=>polymorphicCollectionOrderByFactory(),countFilter:()=>polymorphicCollectionCountFilterFactory(a,n)}):lazyRecord({filter:()=>polymorphicFilterFactory(a,n),create:()=>polymorphicCreateFactory(a,n),createMany:()=>polymorphicCreateManyFactory(a,n),update:()=>polymorphicUpdateFactory(a,n),select:()=>polymorphicSelectFactory(i,n),include:()=>Pe(i,n),orderBy:()=>polymorphicToOneOrderByRefusal(),countFilter:()=>polymorphicToOneCountFilterRefusal()})})}return lazyRecord(n)}const scalarInternKey=(e,t)=>{if(e.schema!==void 0)return null;let n=t===void 0?``:`:${t.format}:${t.prefix??``}:${t.length??``}`;return`${e.nullable?1:0}${e.array?1:0}${e.withTimezone?1:0}${n}`},createScalarInterner=()=>{let e=new Map;return(t,n)=>{if(t===null)return n();let r=e.get(t);return r===void 0&&(r=n(),e.set(t,r)),r}},Ie=new Set([`path`,`mode`]),requireFilterOperation=e=>Object.entries(e).some(([e,t])=>!Ie.has(e)&&t!==void 0)?void 0:`Filter must contain at least one operation.`,buildNegatableFilterSchema=(e,t)=>{let n=l.object({...e.entries,not:l.union([l.shorthandFilter(t),l.lazyRef(()=>n)])},{refuse:requireFilterOperation});return l.union([l.shorthandFilter(t),c(n)])},comparisonFilterFamily=(e,t,n)=>{let createBase=()=>l.object({in:p(n()),notIn:p(n()),lt:l.comparisonOperand(e,t()),lte:l.comparisonOperand(e,t()),gt:l.comparisonOperand(e,t()),gte:l.comparisonOperand(e,t())}),r;return t=>{r??=createBase();let n=l.comparisonOperand(e,t);return buildNegatableFilterSchema(r.extend({equals:n}),n)}},listFilterFamily=(e,t)=>{let createBase=()=>l.object({has:p(e()),hasEvery:p(t()),hasSome:p(t()),isEmpty:l.boolean()}),n;return e=>(n??=createBase(),buildNegatableFilterSchema(n.extend({equals:p(e)}),e))},Le=h(`nonzero_divisor`,e=>e===0||e===0n?v(`Division by zero is not allowed`):y(e)),arithmeticUpdateFamily=e=>(t,n=!1)=>l.union([l.shorthandUpdate(t),l.object({set:t,increment:n?l.refused(W):e(),decrement:n?l.refused(W):e(),multiply:n?l.refused(W):e(),divide:n?l.refused(W):withScalarOutputDomain(e(),Le)})]),W=`Arithmetic on a field with .schema() cannot validate the resulting stored value; use set with a validated value.`;function withScalarOutputDomain(e,t){let n=e[`~standard`].validate,r={...e};Object.defineProperties(r,Object.getOwnPropertyDescriptors(e));let i=Object.getOwnPropertyDescriptors(e[`~standard`]);Reflect.deleteProperty(i,`validate`);let a=Object.defineProperties({},i);return Object.defineProperty(a,`validate`,{value:e=>{let r=n(e);return r.issues?r:g(t,r.value)}}),Object.defineProperty(r,`~standard`,{value:a}),r}const buildSetUpdate=e=>l.union([l.shorthandUpdate(e),l.object({set:e},{partial:!1})]),listUpdateFamily=(e,t)=>n=>l.union([l.shorthandUpdate(n),l.object({set:n,push:l.union([l.shorthandArray(e()),t()]),unshift:l.union([l.shorthandArray(e()),t()])})]),once=e=>{let t;return()=>(t??=e(),t)},createScalarInterners=()=>({update:createScalarInterner(),filter:createScalarInterner()}),internedVariant=(e,t,n)=>()=>e(t,n),internedScalarSchemas=(e,t,n)=>lazyScalarSchemas({base:n.base,create:n.create,update:internedVariant(e.update,t,n.update),filter:internedVariant(e.filter,t,n.filter)}),comparableScalar=(e,t,n)=>{let r=once(()=>t()),i=once(()=>t({array:!0})),a=comparisonFilterFamily(e,r,i),o=listFilterFamily(r,i),s=n?arithmeticUpdateFamily(r):buildSetUpdate,c=listUpdateFamily(r,i),l=createScalarInterners();return e=>{let storedDomain=(n=!1)=>t({nullable:e.nullable,array:e.array,disallowZero:n}),n=e.schema===void 0?e.base:withScalarOutputDomain(e.base,storedDomain()),refinedListUpdate=()=>listUpdateFamily(()=>withScalarOutputDomain(t({...e,array:!1,nullable:!1,optional:!1,default:void 0}),r()),()=>withScalarOutputDomain(t({...e,array:!0,nullable:!1,optional:!1,default:void 0}),i()))(n);return internedScalarSchemas(l,scalarInternKey(e),{base:n,create:()=>e.schema===void 0?t(e):withScalarOutputDomain(t(e),storedDomain(e.disallowZero)),update:()=>e.array?e.schema===void 0?c(e.base):refinedListUpdate():s(n,e.schema!==void 0),filter:()=>e.array?o(storedDomain()):a(storedDomain())})}},Re=comparableScalar(`bigint`,l.bigint,!0),G=l.blob({array:!0}),buildBlobFilterSchema=e=>buildNegatableFilterSchema(l.object({equals:e,in:G,notIn:G}),e),buildBlobSchema=e=>lazyScalarSchemas({base:e.base,create:()=>l.blob(e),update:()=>buildSetUpdate(e.base),filter:()=>buildBlobFilterSchema(e.base)}),K=once(()=>l.boolean()),q=once(()=>l.boolean({array:!0})),buildBooleanFilterSchema=e=>{let t=l.comparisonOperand(`boolean`,e);return buildNegatableFilterSchema(l.object({equals:t}),t)},ze=listFilterFamily(K,q),Be=listUpdateFamily(K,q),Ve=createScalarInterners(),buildBooleanSchema=e=>internedScalarSchemas(Ve,scalarInternKey(e),{base:e.base,create:()=>l.boolean(e),update:()=>e.array?Be(e.base):buildSetUpdate(e.base),filter:()=>e.array?ze(e.base):buildBooleanFilterSchema(e.base)}),He=comparableScalar(`date`,l.isoDate,!1),Ue=comparableScalar(`datetime`,l.isoTimestamp,!1),domainOf=e=>({decimal:e.decimal}),decimalComparisonOperand=e=>{let t=l.comparisonOperand(`decimal`,e),n=t[`~standard`].validate,r=h(`comparison_operand`,e=>{let t=n(e);return t.issues?_(t.issues):ne(t.value)?v(`An SQL fragment is not a decimal operand: it carries no precision or scale, so the comparison would mean something different on each provider. Use a field reference or raw SQL.`):y(t.value)}),i={type:`comparison_operand`,fieldType:`decimal`,wrapped:e,acceptsUndefined:t.acceptsUndefined};return Object.assign(r,i)},OPERATION_REFUSAL=e=>`A decimal update takes exactly one operation: ${e.join(`, `)}`,We=new Set([`__defineGetter__`,`__defineSetter__`,`__lookupGetter__`,`__lookupSetter__`,`__proto__`,`constructor`,`hasOwnProperty`,`isPrototypeOf`,`propertyIsEnumerable`,`toLocaleString`,`toString`,`valueOf`]),exactlyOneOperation=e=>{let n=Object.keys(e),r=new Set(n),isOperation=e=>r.has(e),i=h(`exact_one`,r=>{let i;try{if(!t(r))return v(`Expected object`);let e=Reflect.ownKeys(r);if(e.length!==1)return v(OPERATION_REFUSAL(n));let[a]=e;if(typeof a!=`string`||!isOperation(a))return v(OPERATION_REFUSAL(n));let o=new Set,s=Reflect.getPrototypeOf(r);for(;s!==null;){if(o.has(s))return v(OPERATION_REFUSAL(n));o.add(s);let e=s===Object.prototype;for(let t of Reflect.ownKeys(s))if(!e||typeof t!=`string`||!We.has(t))return v(OPERATION_REFUSAL(n));s=Reflect.getPrototypeOf(s)}let c=Reflect.get(r,a);if(c===void 0)return v(OPERATION_REFUSAL(n));i={operation:a,operand:c}}catch{return v(OPERATION_REFUSAL(n))}let{operation:a,operand:o}=i,s=e[a],c=g(s,o);if(c.issues){if(s.type===`refused`)return c;let[e]=c.issues;return v(e.message,[a,...e.path??[]])}let l=Object.create(null);return l[a]=c.value,y(l)}),a={type:`exact_one`,entries:e};return Object.assign(i,a)},buildDecimalCreateSchema=e=>{if(!e.hasDefault||typeof e.default==`function`)return l.decimal(e);if(e.array&&Array.isArray(e.default)){let t=e.default;return l.optional(e.base,()=>t.slice())}return l.optional(e.base,e.default)};function buildDecimalSchema(e){let t=domainOf(e),member=()=>l.decimal(t),list=()=>l.decimal({...t,array:!0}),writeMember=()=>l.decimal({...t,schema:e.schema}),writeList=()=>l.decimal({...t,array:!0,schema:e.schema}),arithmeticMember=()=>e.schema===void 0?member():l.refused(W),filterBase=()=>l.decimal({...t,nullable:e.nullable,array:e.array});return lazyScalarSchemas({base:e.base,create:()=>buildDecimalCreateSchema(e),update:()=>e.array?l.union([l.shorthandUpdate(e.base),exactlyOneOperation({set:e.base,push:l.union([l.shorthandArray(writeMember()),writeList()]),unshift:l.union([l.shorthandArray(writeMember()),writeList()]),increment:l.refused(`A decimal list update does not support 'increment'.`),decrement:l.refused(`A decimal list update does not support 'decrement'.`),multiply:l.refused(`A decimal list update does not support 'multiply'.`),divide:l.refused(`A decimal list update does not support 'divide'.`)})]):l.union([l.shorthandUpdate(e.base),exactlyOneOperation({set:e.base,increment:arithmeticMember(),decrement:arithmeticMember(),multiply:arithmeticMember(),divide:arithmeticMember()})]),filter:()=>e.array?buildNegatableFilterSchema(l.object({equals:filterBase(),has:member(),hasEvery:list(),hasSome:list(),isEmpty:l.boolean(),in:l.refused(`A decimal list filter does not support 'in'.`),notIn:l.refused(`A decimal list filter does not support 'notIn'.`),lt:l.refused(`A decimal list filter does not support 'lt'.`),lte:l.refused(`A decimal list filter does not support 'lte'.`),gt:l.refused(`A decimal list filter does not support 'gt'.`),gte:l.refused(`A decimal list filter does not support 'gte'.`)}),filterBase()):buildDecimalFilterSchema(filterBase(),member,list)})}const buildDecimalFilterSchema=(e,t,n)=>{let r=decimalComparisonOperand(e);return buildNegatableFilterSchema(l.object({equals:r,in:p(n()),notIn:p(n()),lt:decimalComparisonOperand(t()),lte:decimalComparisonOperand(t()),gt:decimalComparisonOperand(t()),gte:decimalComparisonOperand(t())}),r)},orderedEnumRefusal=e=>l.refused(`Filter operation '${e}' is not supported on an enum field: PostgreSQL orders enum values by their declaration order while MySQL and SQLite compare them as text, so the same query would answer differently per provider. Use 'equals'/'in', or model the field as a string or int if you need ordering.`),enumBase=e=>l.enum(e),enumList=e=>l.enum(e,{array:!0}),buildEnumFilterSchema=(e,t)=>{let n=enumList(t),r=l.comparisonOperand(`enum`,e);return buildNegatableFilterSchema(l.object({equals:r,in:p(n),notIn:p(n),lt:orderedEnumRefusal(`lt`),lte:orderedEnumRefusal(`lte`),gt:orderedEnumRefusal(`gt`),gte:orderedEnumRefusal(`gte`)}),r)},buildEnumListFilterSchema=(e,t)=>listFilterFamily(()=>enumBase(t),()=>enumList(t))(e),buildEnumListUpdateSchema=(e,t)=>listUpdateFamily(()=>enumBase(t),()=>enumList(t))(e),buildEnumSchema=e=>{let t=e.base.values;return lazyScalarSchemas({base:e.base,create:()=>l.enum(t,e),update:()=>e.array?buildEnumListUpdateSchema(e.base,t):buildSetUpdate(e.base),filter:()=>e.array?buildEnumListFilterSchema(e.base,t):buildEnumFilterSchema(e.base,t)})},Ge=comparableScalar(`int`,l.integer,!0),J=`a JSON filter operand`,Y=`JSON write data`,X=[`DbNull`,`JsonNull`,`AnyNull`],Ke=[`DbNull`,`JsonNull`],qe=[`JsonNull`],Je=/^\d+$/,unsupportedPathString=(e,t)=>`JSON filter has an unsupported path string '${e}': ${t}. The supported grammar is '\$', '\$.key', '\$.key[0]' and nothing else; use the array form (path: ['a', 'b']) for keys containing '.', '[' or ']'.`,parseJsonStringPath=e=>{if(!e.startsWith(`$`))return unsupportedPathString(e,`a path string must start with '$'`);let t=[],n=1;for(;n<e.length;){let r=e[n];if(r===`.`){n+=1;let r=n;for(;n<e.length&&e[n]!==`.`&&e[n]!==`[`;)n+=1;let i=e.slice(r,n);if(i.length===0)return unsupportedPathString(e,`an object key may not be empty`);if(i.includes(`*`))return unsupportedPathString(e,`wildcards are not supported`);t.push(i);continue}if(r===`[`){let r=e.indexOf(`]`,n);if(r===-1)return unsupportedPathString(e,`an unclosed '['`);let i=e.slice(n+1,r);if(!Je.test(i))return unsupportedPathString(e,`'[${i}]' is not a non-negative integer array index`);t.push(i),n=r+1;continue}return unsupportedPathString(e,`unexpected '${r}'`)}return t},portablePathRefusal=e=>e.some(e=>e.includes(`"`)||e.includes(`\\`))?`JSON filter requires a portable JSON path; segments containing '"' or '\\' are not supported.`:void 0,Ye=l.array(l.string()),Xe=l.string(),buildJsonPathSchema=()=>{let e=h(`union`,e=>{if(Array.isArray(e)){let t=e.map(String),n=portablePathRefusal(t);return n?v(n):y(t)}if(typeof e!=`string`)return v(`Expected string or array of strings`);let t=parseJsonStringPath(e);if(typeof t==`string`)return v(t);let n=portablePathRefusal(t);return n?v(n):y(t)});return e.options=[Ye,Xe],e},Ze=[`string_contains`,`string_starts_with`,`string_ends_with`],inertModeRefusal=e=>{if(e.mode===`insensitive`&&!(e.not!==void 0&&i(e.not)===void 0))return Ze.some(t=>e[t]!==void 0)?void 0:`JSON filter sets mode: 'insensitive' but has no string_contains/string_starts_with/string_ends_with operation for it to apply to.`},pathSentinelRefusal=e=>{if(e.path===void 0)return;let{equals:n,not:r}=e,a=i(n)??i(r)??(t(r)?i(r.equals):void 0);return a&&`JSON filter cannot combine 'path' with the ${a} sentinel: the sentinels distinguish the database NULL from the JSON null value of the WHOLE column. Use 'path' with 'equals: null' to test for a JSON null at that path.`},buildJsonFilterSchema=e=>{let t=l.union([l.number(),l.string()]),n=l.noFieldRef(e,J),r={equals:p(l.jsonNullOr(X,n,J)),path:buildJsonPathSchema(),mode:l.enum([`default`,`insensitive`]),lt:t,lte:t,gt:t,gte:t,string_contains:l.string(),string_starts_with:l.string(),string_ends_with:l.string(),array_contains:n,array_starts_with:n,array_ends_with:n},refuse=e=>requireFilterOperation(e)??inertModeRefusal(e)??pathSentinelRefusal(e),a=l.object(r,{refuse}),o=l.object({...r,not:l.jsonNullOr(X,a,J)},{refuse}),s=o[`~standard`].validate;return Object.defineProperty(o[`~standard`],`validate`,{value:e=>{let t=i(e);return t?v(`${t} is an operand, not a JSON filter; compare with { equals: ${t} }.`):s(e)}}),o},nullWriteRefusal=e=>e?`null is ambiguous in JSON write data: it could mean the database NULL or the JSON value null. Use DbNull for the database NULL, or JsonNull for the JSON value null.`:`null is ambiguous in JSON write data: it could mean the database NULL or the JSON value null. This field is not nullable, so use JsonNull to write the JSON value null.`,buildJsonWriteOperand=(e,t)=>l.jsonWrite(e.nullable?Ke:qe,l.noFieldRef(t,Y),Y,nullWriteRefusal(e.nullable)),isSetEnvelope=e=>t(e)&&Object.hasOwn(e,`set`)&&Object.keys(e).length===1,buildJsonUpdateSchema=(e,t)=>{let n=buildJsonWriteOperand(e,t),r=l.object({set:n},{partial:!1}),i=l.shorthandUpdate(n),a=l.union([r,i]);return Object.defineProperty(a[`~standard`],`validate`,{value:e=>isSetEnvelope(e)?g(r,e):g(i,e)}),a},buildJsonSchema=e=>lazyScalarSchemas({base:e.base,create:()=>{let t=buildJsonWriteOperand(e,l.json(e)),n=t[`~standard`].validate,admit=t=>{if(t!==void 0||!e.hasDefault)return n(t);let r;try{r=typeof e.default==`function`?e.default():e.default}catch{return v(`JSON default failed`)}return r===void 0?v(`JSON default must resolve to a value`):r===null?e.nullable?y(null):n(a):n(r)};return Object.defineProperty(t[`~standard`],`validate`,{value:e=>{if(!isSetEnvelope(e))return admit(e);let t=admit(e.set);return t.issues?{issues:t.issues.map(({message:e,path:t})=>({message:e,path:[`set`,...t??[]]}))}:t}}),t},update:()=>buildJsonUpdateSchema(e,e.base),filter:()=>buildJsonFilterSchema(l.json())}),Qe=comparableScalar(`number`,l.number,!0),Z=h(`number`,e=>{let t=ee(e);return t.issues?t:t.value<0?v(`Distance comparisons must use non-negative meters`):y(t.value)}),pointDistanceSchema=()=>l.object({to:l.point(),lt:Z,lte:Z,gt:Z,gte:Z},{atLeast:[`to`],requiresOneOf:[[`lt`,`lte`,`gt`,`gte`]]}),buildPointFilterSchema=e=>buildNegatableFilterSchema(l.object({equals:e,distance:pointDistanceSchema(),within:ue()}),e),buildPointSchema=e=>lazyScalarSchemas({base:e.base,create:()=>l.point(e),update:()=>buildSetUpdate(e.base),filter:()=>buildPointFilterSchema(e.base)}),Q=once(()=>l.string()),$=once(()=>l.string({array:!0})),$e=once(()=>l.object({in:$(),notIn:$(),contains:l.fieldRefOr(`string`,Q()),startsWith:l.fieldRefOr(`string`,Q()),endsWith:l.fieldRefOr(`string`,Q()),mode:l.enum([`default`,`insensitive`])})),et=once(()=>l.object({in:$(),notIn:$()})),buildStringFilterSchema=(e,t)=>{let n=l.comparisonOperand(`string`,e);return buildNegatableFilterSchema($e().extend({equals:n,lt:n,lte:n,gt:n,gte:n,in:p(t),notIn:p(t)}),n)},buildCompactIdFilterSchema=(e,t)=>{let n=l.comparisonOperand(`string`,e);return buildNegatableFilterSchema(et().extend({equals:n,lt:n,lte:n,gt:n,gte:n,in:p(t),notIn:p(t)}),n)},tt=listFilterFamily(Q,$),nt=listUpdateFamily(Q,$),rt=createScalarInterners(),domainBaseOf=(e,t)=>{if(t===void 0)return e.base;let n={nullable:e.nullable,array:e.array,schema:e.schema,idDomain:t};return l.string(n)},domainMembersOf=e=>e===void 0?$():l.string({array:!0,idDomain:e}),domainStateOf=(e,t)=>t===void 0?e:{...e,idDomain:t},buildStringSchema=(e,t)=>{let n=e.array===!0?se(e):ce(e)??t,filterBase=()=>l.string({nullable:e.nullable,array:e.array,idDomain:n}),r=domainBaseOf(e,n),i=e.schema===void 0||n!==void 0?r:withScalarOutputDomain(r,filterBase()),refinedListUpdate=()=>listUpdateFamily(()=>n===void 0?withScalarOutputDomain(l.string({schema:e.schema}),Q()):l.string({schema:e.schema,idDomain:n}),()=>n===void 0?withScalarOutputDomain(l.string({array:!0,schema:e.schema}),$()):l.string({array:!0,schema:e.schema,idDomain:n}))(i);return internedScalarSchemas(rt,scalarInternKey(e,n),{base:i,create:()=>e.schema===void 0||n!==void 0?l.string(domainStateOf(e,n)):withScalarOutputDomain(l.string(domainStateOf(e,n)),filterBase()),update:()=>e.array?e.schema===void 0&&n===void 0?nt(i):refinedListUpdate():buildSetUpdate(i),filter:()=>e.array?n===void 0?tt(filterBase()):listFilterFamily(()=>l.string({idDomain:n}),()=>domainMembersOf(n))(filterBase()):n!==void 0&&te(n.format)?buildCompactIdFilterSchema(filterBase(),domainMembersOf(n)):buildStringFilterSchema(filterBase(),domainMembersOf(n))})},it=comparableScalar(`time`,l.isoTime,!1),buildVectorFilterSchema=e=>buildNegatableFilterSchema(l.object({equals:e}),e),buildVectorSchema=e=>lazyScalarSchemas({base:e.base,create:()=>l.vector(e.dimension,e),update:()=>buildSetUpdate(e.base),filter:()=>buildVectorFilterSchema(e.base)}),getScalarSchemas=(e,t)=>ot[e.type](e,t),ot={bigint:Re,blob:buildBlobSchema,boolean:buildBooleanSchema,datetime:Ue,decimal:buildDecimalSchema,enum:buildEnumSchema,int:Ge,json:buildJsonSchema,number:Qe,point:buildPointSchema,string:buildStringSchema,vector:buildVectorSchema,date:He,time:it},getScalarsSchemas=(e,t)=>{let n={},r=e[`~`].state.scalars;for(let e in r){let i=r[e][`~`].state;n[e]=()=>{let n=getScalarSchemas(i,t?.get(e));return i.autoGenerate?.kind===`now`?insertOnly(n):i.autoGenerate?.kind===`updatedAt`&&!i.array?updatesAt(n,i.type):n}}return lazyRecord(n)},insertOnly=e=>Object.defineProperty(e,`update`,{value:void 0,enumerable:!0}),updatedAtUpdate=(e,t)=>{let n={acceptsUndefined:!0,wrapped:e};return Object.assign(h(`optional`,n=>g(e,n===void 0?le(t):n)),n)},updatesAt=(e,t)=>lazyScalarSchemas({base:e.base,create:()=>e.create,update:()=>updatedAtUpdate(e.update,t),filter:()=>e.filter});var SchemaRegistry=class{#e=new Map;#t;#n;proxy;constructor(e,t){this.#t=e,this.#n=t,this.proxy=new Proxy({},{get:(t,i)=>{if(!(n(i)&&Object.hasOwn(e,i)&&e[i])){let e=String(i);throw new r({kind:`registry`,property:e},[{path:e,message:`${e} does not exist`}])}return this.getModelSchemas(e[i])}})}#r=e=>()=>{let t=e[`~`].settleTarget();return this.getModelSchemas(t)};#i=e=>{let t=getScalarsSchemas(e,ae(this.#n).get(e)),n=this.#n.get(e),r=getRelationsSchemas(e,this.#r,n),i=getPolymorphicRelationsSchemas(e,this.getModelSchemas),{args:a,core:o}=getModelSchemas(e,{scalars:t,relations:r,polymorphic:i},n);return{scalars:t,relations:r,polymorphic:i,args:a,core:o}};getModelSchemas=e=>{let t=this.#e.get(e);return t||(t=this.#i(e),this.#e.set(e,t)),t};validate=(e,t,n)=>{let i=Object.hasOwn(this.#t,e)?this.#t[e]:void 0;if(!i){let n=String(e);throw new r({kind:`operation`,operation:t,model:n},[{path:n,message:`${n} does not exist`}],{meta:{model:n}})}let a=this.getModelSchemas(i);if(!Object.hasOwn(a.args,t))throw new r({kind:`registry`,model:e,property:String(t)},[{path:`operation`,message:`${String(t)} does not exist`}]);try{let i=g(a.args[t],n);if(i.issues)throw new r(t,i.issues.map(e=>({path:e.path?.map(e=>e).join(`.`)??``,message:e.message})),{meta:{model:e}});return i.value??{}}catch(n){throw n instanceof r?n:new r({kind:`operation`,operation:t,model:e},[{path:``,message:`The external schema validator threw unexpectedly`}],{...n instanceof Error?{cause:n}:{},meta:{model:e}})}}};const createResolvedSchemaRegistry=(e,t)=>new SchemaRegistry(e,t),createSchemaRegistry=e=>(ie(e),createResolvedSchemaRegistry(e,oe(e)));export{clearableMembership as a,carriesRepeatedKey as i,createSchemaRegistry as n,slotMayBeEmpty as o,Oe as r,projectableScalarNames as s,createResolvedSchemaRegistry as t};
2
- //# sourceMappingURL=builder-CK7lE3ee.mjs.map