@sixb/core 0.1.13 → 0.1.15

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 (236) hide show
  1. package/dist/actions/index.js +22 -22
  2. package/dist/agents/index.js +34 -34
  3. package/dist/agents/index.js.map +1 -1
  4. package/dist/agents/streams/index.js +2 -2
  5. package/dist/agents/streams/internal.js +2 -2
  6. package/dist/auth/errors.d.ts +12 -0
  7. package/dist/auth/errors.d.ts.map +1 -1
  8. package/dist/auth/index.d.ts +1 -1
  9. package/dist/auth/index.d.ts.map +1 -1
  10. package/dist/auth/index.js +7 -5
  11. package/dist/auth/index.js.map +1 -1
  12. package/dist/auth/runtime.d.ts.map +1 -1
  13. package/dist/auth/strategy.d.ts +2 -0
  14. package/dist/auth/strategy.d.ts.map +1 -1
  15. package/dist/auth/strategy.js +4 -2
  16. package/dist/auth/strategy.js.map +1 -1
  17. package/dist/auth/types.d.ts +8 -0
  18. package/dist/auth/types.d.ts.map +1 -1
  19. package/dist/authorization/index.js +2 -2
  20. package/dist/bootstrap/index.js +37 -37
  21. package/dist/{chunk-693f3zn8.js → chunk-1jvq82rp.js} +3 -3
  22. package/dist/{chunk-0321g649.js → chunk-2jntasmh.js} +13 -2
  23. package/dist/{chunk-0321g649.js.map → chunk-2jntasmh.js.map} +3 -3
  24. package/dist/{chunk-cvrbhvtr.js → chunk-2tz5vnvz.js} +28 -28
  25. package/dist/{chunk-cvrbhvtr.js.map → chunk-2tz5vnvz.js.map} +1 -1
  26. package/dist/{chunk-898y24dd.js → chunk-3c90jvfj.js} +2 -2
  27. package/dist/{chunk-vn3yh259.js → chunk-4gmng3vf.js} +1 -1
  28. package/dist/{chunk-91wthfwe.js → chunk-4jph1t3v.js} +7 -7
  29. package/dist/{chunk-znw0zvy4.js → chunk-4wn7bxxa.js} +25 -7
  30. package/dist/chunk-4wn7bxxa.js.map +12 -0
  31. package/dist/{chunk-3qpcrcj8.js → chunk-6aawea28.js} +2 -4
  32. package/dist/chunk-6aawea28.js.map +10 -0
  33. package/dist/{chunk-rzkr70gr.js → chunk-6fsr7y93.js} +5 -1
  34. package/dist/{chunk-rzkr70gr.js.map → chunk-6fsr7y93.js.map} +3 -3
  35. package/dist/{chunk-y487ywrv.js → chunk-6q7c68yx.js} +4 -4
  36. package/dist/{chunk-ypj2wqtj.js → chunk-70jmg2zx.js} +2 -2
  37. package/dist/{chunk-s24qbp32.js → chunk-7jc21943.js} +3 -3
  38. package/dist/{chunk-rzcjp5m2.js → chunk-8fjmqjyx.js} +1 -1
  39. package/dist/{chunk-m8zkvep1.js → chunk-8w27xf9e.js} +1 -1
  40. package/dist/{chunk-z9h698s8.js → chunk-a4g5yjm0.js} +1 -1
  41. package/dist/{chunk-gmt22nxx.js → chunk-adbve9zt.js} +1 -1
  42. package/dist/{chunk-mf6hwpzh.js → chunk-dqkd3kdj.js} +41 -23
  43. package/dist/{chunk-mf6hwpzh.js.map → chunk-dqkd3kdj.js.map} +3 -3
  44. package/dist/{chunk-gbcrz0gr.js → chunk-ex8s8wsk.js} +6 -6
  45. package/dist/{chunk-4tnrzqqh.js → chunk-fj1dvp37.js} +1 -1
  46. package/dist/{chunk-gc226ten.js → chunk-fjw417jf.js} +127 -69
  47. package/dist/{chunk-gc226ten.js.map → chunk-fjw417jf.js.map} +4 -4
  48. package/dist/{chunk-ht4a7mjg.js → chunk-g4rbm4a6.js} +42 -8
  49. package/dist/{chunk-ht4a7mjg.js.map → chunk-g4rbm4a6.js.map} +3 -3
  50. package/dist/{chunk-qma80ych.js → chunk-hn2r7z41.js} +3 -2
  51. package/dist/chunk-hn2r7z41.js.map +11 -0
  52. package/dist/{chunk-bdhfn0ww.js → chunk-kkqwzy6h.js} +1 -1
  53. package/dist/{chunk-bep5rrdq.js → chunk-mmac1mp6.js} +2 -2
  54. package/dist/{chunk-w9bp61e7.js → chunk-n5t4mq6z.js} +5 -5
  55. package/dist/{chunk-n33e8dz8.js → chunk-p0nbkys4.js} +1 -1
  56. package/dist/{chunk-04h4t2b5.js → chunk-py2dw8cw.js} +3 -3
  57. package/dist/{chunk-jhyc777j.js → chunk-q3grgzp1.js} +2 -2
  58. package/dist/{chunk-9pfw47qx.js → chunk-qne45xqq.js} +53 -48
  59. package/dist/{chunk-9pfw47qx.js.map → chunk-qne45xqq.js.map} +7 -7
  60. package/dist/{chunk-cbn96bve.js → chunk-r5sc1d2b.js} +2 -2
  61. package/dist/{chunk-y6vnvayj.js → chunk-vjcd8d27.js} +1 -1
  62. package/dist/{chunk-jmwy25mf.js → chunk-wd34wnsy.js} +6 -6
  63. package/dist/{chunk-63fp9x3q.js → chunk-wem5vqjw.js} +7 -7
  64. package/dist/{chunk-darm7eeg.js → chunk-xr7y35yj.js} +3 -3
  65. package/dist/{chunk-a69fkrtr.js → chunk-y0zmae99.js} +5 -5
  66. package/dist/{chunk-xgptywp0.js → chunk-y2aq6ag9.js} +1 -1
  67. package/dist/{chunk-2hbhn1ff.js → chunk-yfppyaty.js} +1 -1
  68. package/dist/{chunk-rqtdtm43.js → chunk-z708gemf.js} +129 -70
  69. package/dist/{chunk-rqtdtm43.js.map → chunk-z708gemf.js.map} +5 -5
  70. package/dist/deploy/define.d.ts +4 -0
  71. package/dist/deploy/define.d.ts.map +1 -0
  72. package/dist/deploy/index.d.ts +3 -0
  73. package/dist/deploy/index.d.ts.map +1 -0
  74. package/dist/deploy/index.js +10 -0
  75. package/dist/deploy/index.js.map +10 -0
  76. package/dist/deploy/internal.d.ts +3 -0
  77. package/dist/deploy/internal.d.ts.map +1 -0
  78. package/dist/deploy/internal.js +244 -0
  79. package/dist/deploy/internal.js.map +11 -0
  80. package/dist/deploy/services.d.ts +8 -0
  81. package/dist/deploy/services.d.ts.map +1 -0
  82. package/dist/deploy/types.d.ts +309 -0
  83. package/dist/deploy/types.d.ts.map +1 -0
  84. package/dist/deploy/validation.d.ts +7 -0
  85. package/dist/deploy/validation.d.ts.map +1 -0
  86. package/dist/error-reporting/internal.js +3 -3
  87. package/dist/errors/catalog.d.ts +4 -0
  88. package/dist/errors/catalog.d.ts.map +1 -1
  89. package/dist/errors/internal.js +1 -1
  90. package/dist/events/index.js +3 -3
  91. package/dist/execution/agent.js +33 -33
  92. package/dist/execution/primitive.js +29 -29
  93. package/dist/execution/request.js +31 -31
  94. package/dist/execution/request.js.map +1 -1
  95. package/dist/index.js +49 -49
  96. package/dist/index.js.map +1 -1
  97. package/dist/maintenance/ontology-maintenance.d.ts +2 -0
  98. package/dist/maintenance/ontology-maintenance.d.ts.map +1 -1
  99. package/dist/maintenance/types.d.ts +8 -2
  100. package/dist/maintenance/types.d.ts.map +1 -1
  101. package/dist/materialization/dataset-watermark.d.ts +6 -1
  102. package/dist/materialization/dataset-watermark.d.ts.map +1 -1
  103. package/dist/materialization/index.js +1 -1
  104. package/dist/materialization/model.d.ts +6 -0
  105. package/dist/materialization/model.d.ts.map +1 -1
  106. package/dist/materializer/index.js +18 -18
  107. package/dist/materializer/index.js.map +1 -1
  108. package/dist/materializer/projections/finish-run.d.ts.map +1 -1
  109. package/dist/materializer/projections/replace.d.ts.map +1 -1
  110. package/dist/materializer/projections/source-materialization.d.ts +6 -2
  111. package/dist/materializer/projections/source-materialization.d.ts.map +1 -1
  112. package/dist/models/execution/index.js +14 -14
  113. package/dist/objects/index.js +21 -21
  114. package/dist/objects/query/index.js +15 -15
  115. package/dist/pipelines/index.js +19 -19
  116. package/dist/projections/internal.js +16 -16
  117. package/dist/projections/types.d.ts +1 -1
  118. package/dist/projections/types.d.ts.map +1 -1
  119. package/dist/queues/in-memory.d.ts +1 -1
  120. package/dist/queues/in-memory.d.ts.map +1 -1
  121. package/dist/runtime/internal.js +19 -19
  122. package/dist/shares/internal.js +14 -14
  123. package/dist/shares/internal.js.map +1 -1
  124. package/dist/storage/action-runs/failure.js +2 -2
  125. package/dist/storage/ai-limits/enforcement.js +2 -2
  126. package/dist/storage/auth/errors.d.ts +1 -1
  127. package/dist/storage/auth/errors.d.ts.map +1 -1
  128. package/dist/storage/auth/in-memory/auth-storage.d.ts +2 -1
  129. package/dist/storage/auth/in-memory/auth-storage.d.ts.map +1 -1
  130. package/dist/storage/auth/types.d.ts +15 -7
  131. package/dist/storage/auth/types.d.ts.map +1 -1
  132. package/dist/storage/connector-connections/provider.js +1 -1
  133. package/dist/storage/file-upload-sessions/provider.js +5 -5
  134. package/dist/storage/index.d.ts +2 -2
  135. package/dist/storage/index.d.ts.map +1 -1
  136. package/dist/storage/index.js +29 -29
  137. package/dist/storage/index.js.map +1 -1
  138. package/dist/storage/internal.js +1 -1
  139. package/dist/storage/ontology/in-memory/sources.d.ts +6 -3
  140. package/dist/storage/ontology/in-memory/sources.d.ts.map +1 -1
  141. package/dist/storage/ontology/index.d.ts +1 -1
  142. package/dist/storage/ontology/index.d.ts.map +1 -1
  143. package/dist/storage/ontology/provider.d.ts +16 -3
  144. package/dist/storage/ontology/provider.d.ts.map +1 -1
  145. package/dist/storage/ontology/provider.js +8 -4
  146. package/dist/storage/ontology/provider.js.map +1 -1
  147. package/dist/storage/ontology/sources.d.ts +36 -8
  148. package/dist/storage/ontology/sources.d.ts.map +1 -1
  149. package/dist/storage/projection-runs/in-memory.d.ts +3 -1
  150. package/dist/storage/projection-runs/in-memory.d.ts.map +1 -1
  151. package/dist/storage/projection-runs/index.d.ts +1 -1
  152. package/dist/storage/projection-runs/index.d.ts.map +1 -1
  153. package/dist/storage/projection-runs/lifecycle.d.ts +12 -0
  154. package/dist/storage/projection-runs/lifecycle.d.ts.map +1 -1
  155. package/dist/storage/projection-runs/provider.js +10 -4
  156. package/dist/storage/projection-runs/provider.js.map +1 -1
  157. package/dist/storage/projection-runs/types.d.ts +32 -1
  158. package/dist/storage/projection-runs/types.d.ts.map +1 -1
  159. package/dist/storage/workflow-runs/provider.js +5 -5
  160. package/dist/syncs/index.js +20 -20
  161. package/dist/testing/auth-storage-contract.d.ts.map +1 -1
  162. package/dist/testing/index.js +381 -171
  163. package/dist/testing/index.js.map +5 -5
  164. package/dist/testing/ontology-storage-contract.d.ts.map +1 -1
  165. package/dist/testing/projection-run-storage-contract.d.ts.map +1 -1
  166. package/dist/webhooks/internal.js +15 -15
  167. package/dist/webhooks/internal.js.map +1 -1
  168. package/dist/workers/index.js +1 -1
  169. package/dist/workflows/index.js +34 -34
  170. package/package.json +13 -1
  171. package/src/auth/errors.ts +23 -0
  172. package/src/auth/index.ts +1 -1
  173. package/src/auth/runtime.ts +56 -22
  174. package/src/auth/strategy.ts +2 -0
  175. package/src/auth/types.ts +8 -0
  176. package/src/deploy/define.ts +6 -0
  177. package/src/deploy/index.ts +41 -0
  178. package/src/deploy/internal.ts +7 -0
  179. package/src/deploy/services.ts +51 -0
  180. package/src/deploy/types.ts +338 -0
  181. package/src/deploy/validation.ts +261 -0
  182. package/src/errors/catalog.ts +4 -0
  183. package/src/maintenance/ontology-maintenance.ts +32 -2
  184. package/src/maintenance/types.ts +8 -2
  185. package/src/materialization/dataset-watermark.ts +6 -4
  186. package/src/materialization/model.ts +7 -0
  187. package/src/materializer/README.md +26 -6
  188. package/src/materializer/projections/finish-run.ts +129 -26
  189. package/src/materializer/projections/replace.ts +67 -49
  190. package/src/materializer/projections/source-materialization.ts +11 -6
  191. package/src/projections/types.ts +1 -0
  192. package/src/storage/auth/errors.ts +0 -1
  193. package/src/storage/auth/in-memory/auth-storage.ts +44 -65
  194. package/src/storage/auth/types.ts +15 -7
  195. package/src/storage/index.ts +6 -1
  196. package/src/storage/ontology/in-memory/sources.ts +119 -55
  197. package/src/storage/ontology/index.ts +4 -1
  198. package/src/storage/ontology/provider.ts +64 -7
  199. package/src/storage/ontology/sources.ts +42 -8
  200. package/src/storage/projection-runs/in-memory.ts +41 -2
  201. package/src/storage/projection-runs/index.ts +2 -0
  202. package/src/storage/projection-runs/lifecycle.ts +61 -4
  203. package/src/storage/projection-runs/types.ts +41 -1
  204. package/src/testing/auth-storage-contract.ts +104 -130
  205. package/src/testing/ontology-storage-contract.ts +141 -15
  206. package/src/testing/projection-run-storage-contract.ts +174 -1
  207. package/dist/chunk-3qpcrcj8.js.map +0 -10
  208. package/dist/chunk-qma80ych.js.map +0 -11
  209. package/dist/chunk-znw0zvy4.js.map +0 -12
  210. /package/dist/{chunk-693f3zn8.js.map → chunk-1jvq82rp.js.map} +0 -0
  211. /package/dist/{chunk-898y24dd.js.map → chunk-3c90jvfj.js.map} +0 -0
  212. /package/dist/{chunk-vn3yh259.js.map → chunk-4gmng3vf.js.map} +0 -0
  213. /package/dist/{chunk-91wthfwe.js.map → chunk-4jph1t3v.js.map} +0 -0
  214. /package/dist/{chunk-y487ywrv.js.map → chunk-6q7c68yx.js.map} +0 -0
  215. /package/dist/{chunk-ypj2wqtj.js.map → chunk-70jmg2zx.js.map} +0 -0
  216. /package/dist/{chunk-s24qbp32.js.map → chunk-7jc21943.js.map} +0 -0
  217. /package/dist/{chunk-rzcjp5m2.js.map → chunk-8fjmqjyx.js.map} +0 -0
  218. /package/dist/{chunk-m8zkvep1.js.map → chunk-8w27xf9e.js.map} +0 -0
  219. /package/dist/{chunk-z9h698s8.js.map → chunk-a4g5yjm0.js.map} +0 -0
  220. /package/dist/{chunk-gmt22nxx.js.map → chunk-adbve9zt.js.map} +0 -0
  221. /package/dist/{chunk-gbcrz0gr.js.map → chunk-ex8s8wsk.js.map} +0 -0
  222. /package/dist/{chunk-4tnrzqqh.js.map → chunk-fj1dvp37.js.map} +0 -0
  223. /package/dist/{chunk-bdhfn0ww.js.map → chunk-kkqwzy6h.js.map} +0 -0
  224. /package/dist/{chunk-bep5rrdq.js.map → chunk-mmac1mp6.js.map} +0 -0
  225. /package/dist/{chunk-w9bp61e7.js.map → chunk-n5t4mq6z.js.map} +0 -0
  226. /package/dist/{chunk-n33e8dz8.js.map → chunk-p0nbkys4.js.map} +0 -0
  227. /package/dist/{chunk-04h4t2b5.js.map → chunk-py2dw8cw.js.map} +0 -0
  228. /package/dist/{chunk-jhyc777j.js.map → chunk-q3grgzp1.js.map} +0 -0
  229. /package/dist/{chunk-cbn96bve.js.map → chunk-r5sc1d2b.js.map} +0 -0
  230. /package/dist/{chunk-y6vnvayj.js.map → chunk-vjcd8d27.js.map} +0 -0
  231. /package/dist/{chunk-jmwy25mf.js.map → chunk-wd34wnsy.js.map} +0 -0
  232. /package/dist/{chunk-63fp9x3q.js.map → chunk-wem5vqjw.js.map} +0 -0
  233. /package/dist/{chunk-darm7eeg.js.map → chunk-xr7y35yj.js.map} +0 -0
  234. /package/dist/{chunk-a69fkrtr.js.map → chunk-y0zmae99.js.map} +0 -0
  235. /package/dist/{chunk-xgptywp0.js.map → chunk-y2aq6ag9.js.map} +0 -0
  236. /package/dist/{chunk-2hbhn1ff.js.map → chunk-yfppyaty.js.map} +0 -0
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  createSixbError2,
4
4
  isSixbError2
5
- } from "./chunk-rzkr70gr.js";
5
+ } from "./chunk-6fsr7y93.js";
6
6
  import {
7
7
  resolveExecutionScopeAuthorization,
8
8
  AuthorizationError2,
9
9
  assertProviderAccess2
10
- } from "./chunk-rzcjp5m2.js";
10
+ } from "./chunk-8fjmqjyx.js";
11
11
  import {
12
12
  isOAuthConnectorDefinition2
13
13
  } from "./chunk-9x8dybsb.js";
@@ -6,7 +6,7 @@ import {
6
6
  reportEventDeliveryFailure3,
7
7
  reportRuleEvaluationFailure3,
8
8
  reportVectorIndexingFailure2
9
- } from "./chunk-bdhfn0ww.js";
9
+ } from "./chunk-kkqwzy6h.js";
10
10
 
11
11
  // src/error-reporting/capability.ts
12
12
  var ERROR_REPORTER = Symbol("sixb.error-reporter");
@@ -7,16 +7,16 @@ import {
7
7
  ShareDefinitionError2,
8
8
  isShareDefinition,
9
9
  snapshotShareDefinition
10
- } from "./chunk-9pfw47qx.js";
10
+ } from "./chunk-qne45xqq.js";
11
11
  import {
12
12
  isProjectionDefinition2
13
- } from "./chunk-rzcjp5m2.js";
13
+ } from "./chunk-8fjmqjyx.js";
14
14
  import {
15
15
  isDatasetDefinition2
16
16
  } from "./chunk-cd234ba4.js";
17
17
  import {
18
18
  isPipelineDefinition2
19
- } from "./chunk-2hbhn1ff.js";
19
+ } from "./chunk-yfppyaty.js";
20
20
  import {
21
21
  assertPredicateShape,
22
22
  createPropertyPredicateBuilder,
@@ -28,13 +28,13 @@ import {
28
28
  } from "./chunk-e1c18xjx.js";
29
29
  import {
30
30
  isSyncDefinition2
31
- } from "./chunk-jhyc777j.js";
31
+ } from "./chunk-q3grgzp1.js";
32
32
  import {
33
33
  isWorkflowDefinition2
34
- } from "./chunk-cvrbhvtr.js";
34
+ } from "./chunk-2tz5vnvz.js";
35
35
  import {
36
36
  compileShareAccessPlan
37
- } from "./chunk-gmt22nxx.js";
37
+ } from "./chunk-adbve9zt.js";
38
38
  import {
39
39
  isConnectorDefinition
40
40
  } from "./chunk-9x8dybsb.js";
@@ -10,12 +10,12 @@ import {
10
10
  isAllowed2,
11
11
  assertAuthorized2,
12
12
  canViewActionRun2
13
- } from "./chunk-rzcjp5m2.js";
13
+ } from "./chunk-8fjmqjyx.js";
14
14
  import {
15
15
  ActionRunTimeoutError2,
16
16
  createSixbError2,
17
17
  toSixbFailure2
18
- } from "./chunk-rzkr70gr.js";
18
+ } from "./chunk-6fsr7y93.js";
19
19
  import {
20
20
  collectUserRefIds,
21
21
  userReferenceProblem
@@ -26,7 +26,7 @@ import {
26
26
  import {
27
27
  ACTION_RUN_FAILURE_CODES2,
28
28
  parseActionRunFailure2
29
- } from "./chunk-xgptywp0.js";
29
+ } from "./chunk-y2aq6ag9.js";
30
30
  import {
31
31
  ActionRunError2
32
32
  } from "./chunk-fc5zfxy1.js";
@@ -35,7 +35,7 @@ import {
35
35
  normalizeActionParams,
36
36
  validateActionSubject,
37
37
  resolveObjectActionSubject
38
- } from "./chunk-9pfw47qx.js";
38
+ } from "./chunk-qne45xqq.js";
39
39
  import {
40
40
  snapshotVectorProfiles
41
41
  } from "./chunk-3nx8vj5a.js";
@@ -49,10 +49,10 @@ import {
49
49
  validateObjectFacetRequests,
50
50
  preflightObjectQueryLinks,
51
51
  executeObjectQueryLinks2
52
- } from "./chunk-898y24dd.js";
52
+ } from "./chunk-3c90jvfj.js";
53
53
  import {
54
54
  reportRunFailure2
55
- } from "./chunk-y6vnvayj.js";
55
+ } from "./chunk-vjcd8d27.js";
56
56
  import {
57
57
  ObjectQueryValidationError2
58
58
  } from "./chunk-a0073121.js";
@@ -60,7 +60,7 @@ import {
60
60
  executionRecordInputFromRuntime,
61
61
  ensureExecutionRecord2,
62
62
  createPrimitiveExecutionRecord
63
- } from "./chunk-m8zkvep1.js";
63
+ } from "./chunk-8w27xf9e.js";
64
64
  import {
65
65
  actionSubjectsEqual2,
66
66
  actionRunParamsEqual2,
@@ -3,14 +3,14 @@ import {
3
3
  AuthStorageError2,
4
4
  SYSTEM_PRINCIPAL2,
5
5
  principalsEqual2
6
- } from "./chunk-9pfw47qx.js";
6
+ } from "./chunk-qne45xqq.js";
7
7
  import {
8
8
  agentServiceAccountId2,
9
9
  resolveAuthorizationContext2
10
- } from "./chunk-rzcjp5m2.js";
10
+ } from "./chunk-8fjmqjyx.js";
11
11
  import {
12
12
  createSixbError2
13
- } from "./chunk-rzkr70gr.js";
13
+ } from "./chunk-6fsr7y93.js";
14
14
  import {
15
15
  findPrimitiveRunExecution,
16
16
  findAgentRunExecution
@@ -2,17 +2,17 @@
2
2
  import {
3
3
  createSixbError2,
4
4
  toSixbFailure2
5
- } from "./chunk-rzkr70gr.js";
5
+ } from "./chunk-6fsr7y93.js";
6
6
  import {
7
7
  reportRunFailure2
8
- } from "./chunk-y6vnvayj.js";
8
+ } from "./chunk-vjcd8d27.js";
9
9
  import {
10
10
  resolveExecutionScopeAuthorization,
11
11
  assertAuthorized2
12
- } from "./chunk-rzcjp5m2.js";
12
+ } from "./chunk-8fjmqjyx.js";
13
13
  import {
14
14
  SYNC_RUN_FAILURE_CODES2
15
- } from "./chunk-gc226ten.js";
15
+ } from "./chunk-fjw417jf.js";
16
16
  import {
17
17
  SyncRunError2
18
18
  } from "./chunk-jmfet9r4.js";
@@ -20,7 +20,7 @@ import {
20
20
  executionRecordInputFromRuntime,
21
21
  ensureExecutionRecord2,
22
22
  createPrimitiveExecutionRecord
23
- } from "./chunk-m8zkvep1.js";
23
+ } from "./chunk-8w27xf9e.js";
24
24
 
25
25
  // src/syncs/errors.ts
26
26
  class SyncValidationError2 extends Error {
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  parseSixbFailure2
4
- } from "./chunk-rzkr70gr.js";
4
+ } from "./chunk-6fsr7y93.js";
5
5
  import {
6
6
  isPlainRecord
7
7
  } from "./chunk-wy0qdqfm.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-cd234ba4.js";
9
9
  import {
10
10
  PipelineError2
11
- } from "./chunk-w9bp61e7.js";
11
+ } from "./chunk-n5t4mq6z.js";
12
12
 
13
13
  // src/lake-storage/sql-transforms.ts
14
14
  var SQL_DIALECT = {
@@ -39,36 +39,35 @@ import {
39
39
  createCommitId2,
40
40
  createEventId2,
41
41
  materializationApplyPhase
42
- } from "./chunk-ht4a7mjg.js";
42
+ } from "./chunk-g4rbm4a6.js";
43
43
  import {
44
44
  ProjectionValidationError2,
45
45
  validateProjectionsAtStartup,
46
46
  isProjectionDefinition2,
47
47
  resolveExecutionScopeAuthorization
48
- } from "./chunk-rzcjp5m2.js";
48
+ } from "./chunk-8fjmqjyx.js";
49
49
  import {
50
50
  objectBatchKey2,
51
51
  vectorConfiguration,
52
52
  vectorSources,
53
53
  normalizeVector2
54
- } from "./chunk-gc226ten.js";
54
+ } from "./chunk-fjw417jf.js";
55
55
  import {
56
56
  parseDatasetTimestamp2
57
57
  } from "./chunk-z667z3sg.js";
58
58
  import {
59
59
  executionRecordInputFromRuntime,
60
60
  ensureExecutionRecord2
61
- } from "./chunk-m8zkvep1.js";
61
+ } from "./chunk-8w27xf9e.js";
62
62
  import {
63
63
  isStorageSerializationFailure2
64
64
  } from "./chunk-zdkcdshk.js";
65
65
  import {
66
66
  assertPinnedDatasetWatermark2
67
- } from "./chunk-3qpcrcj8.js";
67
+ } from "./chunk-6aawea28.js";
68
68
  import {
69
69
  MaterializationValidationError2,
70
70
  MaterializationObjectNotFoundError2,
71
- MaterializationCancellationError2,
72
71
  MaterializationConflictError2
73
72
  } from "./chunk-96yw3pwd.js";
74
73
  import {
@@ -3314,23 +3313,26 @@ function prepareProjectionRunFinish(context, raw) {
3314
3313
  const source = normalizeProjectionSourceRef(raw.input.source);
3315
3314
  const datasetVersion = normalizePinnedDatasetVersion(raw.input.datasetVersion);
3316
3315
  const projectionExecution = normalizeProjectionExecution2(raw.input.execution);
3317
- const resolved = raw.input.protocol === "replacement" ? context.projectionRegistry.resolveSource(source.projectionId) : context.projectionRegistry.resolveTelemetry(source.projectionId);
3318
- if (resolved.datasetId !== datasetVersion.datasetId) {
3316
+ const input = { ...raw.input, source, datasetVersion, execution: projectionExecution };
3317
+ return {
3318
+ projectId: context.projectId,
3319
+ input,
3320
+ deployed: input.status === "succeeded" ? resolveDeployedProjection(context, input) : null,
3321
+ finishedAt: new Date(raw.input.finishedAt ?? context.clock()),
3322
+ execution: prepareMaterializerExecution(context.projectId, raw.scope)
3323
+ };
3324
+ }
3325
+ function resolveDeployedProjection(context, input) {
3326
+ const resolved = input.protocol === "replacement" ? context.projectionRegistry.resolveSource(input.source.projectionId) : context.projectionRegistry.resolveTelemetry(input.source.projectionId);
3327
+ if (resolved.datasetId !== input.datasetVersion.datasetId) {
3319
3328
  throw new MaterializationValidationError2(`Projection '${resolved.projectionId}' requires dataset '${resolved.datasetId}'.`);
3320
3329
  }
3321
3330
  const identity = createProjectionRunMaterializationIdentity({
3322
3331
  resolved,
3323
- datasetVersion,
3332
+ datasetVersion: input.datasetVersion,
3324
3333
  ontologyRevision: context.projectionRegistry.ontologyRevision
3325
3334
  });
3326
- return {
3327
- projectId: context.projectId,
3328
- input: { ...raw.input, source, datasetVersion, execution: projectionExecution },
3329
- identity,
3330
- resolved,
3331
- finishedAt: new Date(raw.input.finishedAt ?? context.clock()),
3332
- execution: prepareMaterializerExecution(context.projectId, raw.scope)
3333
- };
3335
+ return { identity, resolved };
3334
3336
  }
3335
3337
  async function finishProjectionRunTransaction(storage, command) {
3336
3338
  await ensureMaterializerExecution(storage.executions, command.execution);
@@ -3339,33 +3341,78 @@ async function finishProjectionRunTransaction(storage, command) {
3339
3341
  id: command.input.source.projectionId,
3340
3342
  runId: command.input.execution.projectionRunId
3341
3343
  });
3342
- const { projectionRuns, run } = await lockProjectionRunForMaterialization(storage, {
3344
+ const { projectionRuns, run } = command.deployed ? await lockProjectionRunForMaterialization(storage, {
3343
3345
  projectId: command.projectId,
3344
3346
  projectionRunId: command.input.execution.projectionRunId,
3345
3347
  executionToken: command.input.execution.executionToken,
3346
- identity: command.identity,
3347
- resolved: command.resolved
3348
- });
3348
+ identity: command.deployed.identity,
3349
+ resolved: command.deployed.resolved
3350
+ }) : await lockProjectionRunAsStored(storage, command);
3349
3351
  assertMaterializerRunExecution(command.execution, run.executionId, `Projection run '${run.id}'`);
3350
3352
  if (command.input.protocol === "replacement") {
3351
3353
  await assertReplacementTerminalDecision(storage, command);
3354
+ if (command.input.status === "superseded") {
3355
+ await assertRunSuperseded(projectionRuns, command);
3356
+ }
3357
+ if (command.input.status !== "succeeded") {
3358
+ await storage.ontology.sources.abandon({
3359
+ kind: "run",
3360
+ projectId: command.projectId,
3361
+ source: command.input.source,
3362
+ execution: command.input.execution,
3363
+ abandonedAt: command.finishedAt.toISOString()
3364
+ });
3365
+ }
3352
3366
  }
3353
3367
  await projectionRuns.finish({
3354
3368
  id: command.input.execution.projectionRunId,
3355
3369
  projectId: command.projectId,
3356
3370
  executionToken: command.input.execution.executionToken,
3357
- identity: command.identity,
3371
+ identity: run.identity,
3358
3372
  ...terminalDecision(command.input),
3359
3373
  finishedAt: command.finishedAt
3360
3374
  });
3361
3375
  }
3376
+ async function assertRunSuperseded(projectionRuns, command) {
3377
+ const newer = await projectionRuns.findSupersedingRun({
3378
+ projectId: command.projectId,
3379
+ id: command.input.execution.projectionRunId
3380
+ });
3381
+ if (newer)
3382
+ return;
3383
+ throw new MaterializationConflictError2("run-correlation", `Projection run '${command.input.execution.projectionRunId}' cannot be superseded: no run of a later dataset version stands to replace it.`);
3384
+ }
3385
+ async function lockProjectionRunAsStored(storage, command) {
3386
+ const projectionRuns = storage.projectionRuns;
3387
+ if (!projectionRuns) {
3388
+ throw new MaterializationValidationError2("Storage transaction does not provide projection run capabilities.");
3389
+ }
3390
+ const { input } = command;
3391
+ const stored = await projectionRuns.getById({
3392
+ projectId: command.projectId,
3393
+ id: input.execution.projectionRunId
3394
+ });
3395
+ if (!stored || stored.identity.projectionId !== input.source.projectionId || stored.identity.protocol !== input.protocol || !datasetVersionsEqual(stored.identity.datasetVersion, input.datasetVersion)) {
3396
+ throw new MaterializationConflictError2("run-correlation", `Projection run '${input.execution.projectionRunId}' does not match its finish decision.`);
3397
+ }
3398
+ const run = await projectionRuns.lockForMaterialization({
3399
+ id: stored.id,
3400
+ projectId: command.projectId,
3401
+ executionToken: input.execution.executionToken,
3402
+ identity: stored.identity
3403
+ });
3404
+ return { projectionRuns, run };
3405
+ }
3362
3406
  function assertValidTerminalDecision(input) {
3363
3407
  if (input.protocol !== "replacement" && input.protocol !== "telemetry") {
3364
3408
  throw new MaterializationValidationError2("Projection finish protocol is invalid.");
3365
3409
  }
3366
- if (input.status !== "succeeded" && input.status !== "failed" && input.status !== "cancelled") {
3410
+ if (input.status !== "succeeded" && input.status !== "failed" && input.status !== "cancelled" && input.status !== "superseded") {
3367
3411
  throw new MaterializationValidationError2("Projection finish status must be terminal.");
3368
3412
  }
3413
+ if (input.status === "superseded" && input.protocol !== "replacement") {
3414
+ throw new MaterializationValidationError2("Only a replacement projection run can be superseded.");
3415
+ }
3369
3416
  const inputExhausted = "inputExhausted" in input ? input.inputExhausted : undefined;
3370
3417
  if (input.status === "succeeded" && input.protocol === "telemetry") {
3371
3418
  if (inputExhausted === true)
@@ -3377,6 +3424,9 @@ function assertValidTerminalDecision(input) {
3377
3424
  }
3378
3425
  }
3379
3426
  function terminalDecision(input) {
3427
+ if (input.status === "superseded") {
3428
+ return { protocol: "replacement", status: "superseded" };
3429
+ }
3380
3430
  if (input.status !== "succeeded") {
3381
3431
  return {
3382
3432
  protocol: input.protocol,
@@ -3409,8 +3459,9 @@ async function assertReplacementTerminalDecision(storage, command) {
3409
3459
  }
3410
3460
  }
3411
3461
  function assertReplacementCommitCorrelation(commit, command) {
3412
- const { input, identity } = command;
3413
- if (commit.origin.kind !== "projection" || commit.executionId !== command.execution.executionId || commit.intent.kind !== "projection" || commit.result.kind !== "projection" || commit.origin.projectionRunId !== input.execution.projectionRunId || commit.origin.projectionId !== input.source.projectionId || commit.intent.source.projectionId !== input.source.projectionId || !datasetVersionsEqual(commit.intent.datasetVersion, input.datasetVersion) || commit.ontologyRevision !== identity.ontologyRevision || commit.projectionRevision !== identity.projectionRevision || commit.ownershipHash !== identity.ownershipHash) {
3462
+ const { input } = command;
3463
+ const identity = command.deployed?.identity;
3464
+ if (!identity || commit.origin.kind !== "projection" || commit.executionId !== command.execution.executionId || commit.intent.kind !== "projection" || commit.result.kind !== "projection" || commit.origin.projectionRunId !== input.execution.projectionRunId || commit.origin.projectionId !== input.source.projectionId || commit.intent.source.projectionId !== input.source.projectionId || !datasetVersionsEqual(commit.intent.datasetVersion, input.datasetVersion) || commit.ontologyRevision !== identity.ontologyRevision || commit.projectionRevision !== identity.projectionRevision || commit.ownershipHash !== identity.ownershipHash) {
3414
3465
  throw new MaterializationConflictError2("run-correlation", `Projection replacement run '${input.execution.projectionRunId}' commit identity does not match.`);
3415
3466
  }
3416
3467
  }
@@ -3801,16 +3852,19 @@ async function stageProjectionMaterialization(context, input) {
3801
3852
  }
3802
3853
  const root = normalizeProjectionEntity(rawEntry.root);
3803
3854
  validateProjectionRootRef(context.projectionRegistry.resolveSource(input.source.projectionId), root);
3804
- yield { root, stagingOrdinal: rootCount++ };
3855
+ const stagingOrdinal = rootCount++;
3856
+ if (stagingOrdinal >= input.resumeStagingOrdinal)
3857
+ yield { root, stagingOrdinal };
3805
3858
  continue;
3806
3859
  }
3807
3860
  const entry = input.validateEntry(normalizeProjectionSourceEntry2(rawEntry));
3808
- const stagingOrdinal = rootCount;
3861
+ const stagingOrdinal = rootCount++;
3862
+ assertionCount += entry.assertions.length;
3863
+ if (stagingOrdinal < input.resumeStagingOrdinal)
3864
+ continue;
3809
3865
  for (const assertion of entry.assertions) {
3810
- assertionCount += 1;
3811
3866
  yield { root: entry.root, assertion, stagingOrdinal };
3812
3867
  }
3813
- rootCount += 1;
3814
3868
  }
3815
3869
  throwIfAborted(input.signal);
3816
3870
  }
@@ -3847,13 +3901,8 @@ async function replaceProjection(context, raw) {
3847
3901
  if (replay)
3848
3902
  return replay;
3849
3903
  const candidate = await prepareProjectionCandidate(context, command);
3850
- try {
3851
- const ready = await stageProjectionCandidate(context, command, candidate);
3852
- return await commitProjectionCandidate(context, command, ready);
3853
- } catch (error) {
3854
- await abandonFailedCandidate(context, command, candidate, error);
3855
- throw error;
3856
- }
3904
+ const ready = await stageProjectionCandidate(context, command, candidate);
3905
+ return commitProjectionCandidate(context, command, ready);
3857
3906
  }
3858
3907
  function prepareProjectionReplacement(context, raw) {
3859
3908
  const source = normalizeProjectionSourceRef(raw.input.source);
@@ -3931,12 +3980,11 @@ function projectionReplayResult(commit, command) {
3931
3980
  return { ...structuredClone(commit.result), created: false };
3932
3981
  }
3933
3982
  async function prepareProjectionCandidate(context, command) {
3934
- await context.storage.ontology.sources.abandon({
3935
- kind: "reclaim",
3983
+ const adopted = await context.storage.ontology.sources.adopt({
3936
3984
  projectId: context.projectId,
3937
3985
  source: command.source,
3938
3986
  execution: command.execution,
3939
- abandonedAt: context.clock().toISOString()
3987
+ adoptedAt: context.clock().toISOString()
3940
3988
  });
3941
3989
  const active = await context.storage.ontology.sources.getActive({
3942
3990
  projectId: context.projectId,
@@ -3944,17 +3992,48 @@ async function prepareProjectionCandidate(context, command) {
3944
3992
  });
3945
3993
  validateProjectionWatermark(active, command.datasetVersion);
3946
3994
  assertDeltaBase(active, command);
3995
+ const expectedSource = {
3996
+ source: command.source,
3997
+ activeMaterializationId: active?.materializationId ?? null,
3998
+ lastCommitId: active?.lastCommitId ?? null
3999
+ };
4000
+ if (adopted && sameSourceBase(adopted.record.base, command.base)) {
4001
+ return {
4002
+ materializationId: adopted.record.materializationId,
4003
+ createdAt: adopted.record.createdAt,
4004
+ adopted,
4005
+ expectedSource
4006
+ };
4007
+ }
4008
+ if (adopted) {
4009
+ await context.storage.ontology.sources.abandon({
4010
+ kind: "candidate",
4011
+ projectId: context.projectId,
4012
+ source: command.source,
4013
+ materializationId: adopted.record.materializationId,
4014
+ execution: command.execution,
4015
+ abandonedAt: context.clock().toISOString()
4016
+ });
4017
+ }
3947
4018
  return {
3948
4019
  materializationId: context.materializationId(),
3949
4020
  createdAt: context.clock().toISOString(),
3950
- expectedSource: {
3951
- source: command.source,
3952
- activeMaterializationId: active?.materializationId ?? null,
3953
- lastCommitId: active?.lastCommitId ?? null
3954
- }
4021
+ expectedSource
3955
4022
  };
3956
4023
  }
3957
4024
  async function stageProjectionCandidate(context, command, candidate) {
4025
+ const staged = await stageOrReuseCandidate(context, command, candidate);
4026
+ return {
4027
+ ...candidate,
4028
+ staged,
4029
+ identity: timestampCommitIdentity2(command.identity, context.clock())
4030
+ };
4031
+ }
4032
+ async function stageOrReuseCandidate(context, command, candidate) {
4033
+ const adopted = candidate.adopted?.record;
4034
+ if (adopted?.status === "ready" && adopted.rootCount !== null) {
4035
+ return { rootCount: adopted.rootCount, assertionCount: adopted.assertionCount ?? 0 };
4036
+ }
3958
4037
  const input = {
3959
4038
  source: command.source,
3960
4039
  materializationId: candidate.materializationId,
@@ -3966,14 +4045,10 @@ async function stageProjectionCandidate(context, command, candidate) {
3966
4045
  createdAt: candidate.createdAt,
3967
4046
  entries: command.entries,
3968
4047
  ...command.base ? { base: command.base } : {},
4048
+ resumeStagingOrdinal: candidate.adopted?.resumeStagingOrdinal ?? 0,
3969
4049
  validateEntry: createProjectionEntryValidator(context.ontology, command.resolved)
3970
4050
  };
3971
- const staged = await stageCandidateEntries(context, input, command.signal);
3972
- return {
3973
- ...candidate,
3974
- staged,
3975
- identity: timestampCommitIdentity2(command.identity, context.clock())
3976
- };
4051
+ return stageCandidateEntries(context, input, command.signal);
3977
4052
  }
3978
4053
  async function stageCandidateEntries(context, input, signal) {
3979
4054
  if (signal === undefined)
@@ -4092,30 +4167,14 @@ function projectionActivation(command, ready) {
4092
4167
  updatedAt: ready.identity.committedAt
4093
4168
  };
4094
4169
  }
4095
- async function abandonFailedCandidate(context, command, candidate, error) {
4096
- if (!shouldAbandonCandidate(error))
4097
- return;
4098
- await context.storage.ontology.sources.abandon({
4099
- kind: "candidate",
4100
- projectId: context.projectId,
4101
- source: command.source,
4102
- materializationId: candidate.materializationId,
4103
- execution: command.execution,
4104
- abandonedAt: context.clock().toISOString()
4105
- });
4106
- }
4107
- function shouldAbandonCandidate(error) {
4108
- if (error instanceof MaterializationValidationError2)
4109
- return true;
4110
- if (error instanceof MaterializationCancellationError2)
4111
- return true;
4112
- return error instanceof MaterializationConflictError2 && (error.kind === "run-correlation" || error.kind === "idempotency");
4113
- }
4114
4170
  function validateProjectionWatermark(active, next) {
4115
4171
  if (!active)
4116
4172
  return;
4117
4173
  assertPinnedDatasetWatermark2(active.datasetVersion, next, "Projection replacement");
4118
4174
  }
4175
+ function sameSourceBase(left, right) {
4176
+ return left?.materializationId === right?.materializationId && left?.lastCommitId === right?.lastCommitId;
4177
+ }
4119
4178
  function assertDeltaBase(active, command) {
4120
4179
  if (command.base && (!active || active.materializationId !== command.base.materializationId || active.lastCommitId !== command.base.lastCommitId || active.projectionRevision !== command.runIdentity.projectionRevision || active.ontologyRevision !== command.runIdentity.ontologyRevision || active.ownershipHash !== command.runIdentity.ownershipHash)) {
4121
4180
  throw new MaterializationConflictError2("source-materialization", "Projection delta no longer matches the active source or its definition.");
@@ -4664,4 +4723,4 @@ function createOntologyMaterializer2(input) {
4664
4723
  }
4665
4724
  export { computeOntologyRevision2, computeProjectionRevision2, computeProjectionOwnershipHash2, ProjectionRegistry2, createActionIdempotencyKey2, createRuntimeIdempotencyKey2, createProjectionIdempotencyKey2, createRuntimeTelemetryIdempotencyKey2, createProjectionTelemetryIdempotencyKey2, createCommitIdentity2, timestampCommitIdentity2, createTimedCommitIdentity2, createProjectionMaterializationId2, createLinkScopeFingerprint2, normalizeJsonProperties2, normalizeOntologyEditCommit2, normalizeProjectionExecution2, normalizeProjectionSourceEntry2, normalizeTelemetryAppend2, OntologyMaterializer2, createOntologyMaterializer2 };
4666
4725
 
4667
- //# debugId=61B9FC5452B219F064756E2164756E21
4726
+ //# debugId=F46021ED4DFD665364756E2164756E21