@sixb/core 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/index.js +25 -25
- package/dist/actions/types/context.d.ts +2 -2
- package/dist/actions/types/context.d.ts.map +1 -1
- package/dist/actions/worker.js +1 -1
- package/dist/agents/index.js +41 -40
- package/dist/agents/index.js.map +1 -1
- package/dist/auth/index.js +5 -5
- package/dist/authorization/index.js +2 -2
- package/dist/blob-storage/download-urls.d.ts +41 -0
- package/dist/blob-storage/download-urls.d.ts.map +1 -0
- package/dist/blob-storage/execution.d.ts +9 -1
- package/dist/blob-storage/execution.d.ts.map +1 -1
- package/dist/blob-storage/index.js +5 -3
- package/dist/blob-storage/index.js.map +1 -1
- package/dist/blob-storage/internal.d.ts +2 -0
- package/dist/blob-storage/internal.d.ts.map +1 -0
- package/dist/blob-storage/internal.js +11 -0
- package/dist/blob-storage/internal.js.map +9 -0
- package/dist/bootstrap/index.js +45 -44
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/{chunk-8x74221e.js → chunk-10styjgk.js} +18 -13
- package/dist/{chunk-8x74221e.js.map → chunk-10styjgk.js.map} +3 -3
- package/dist/{chunk-hgqpcmyr.js → chunk-1hqwggsn.js} +47 -19
- package/dist/chunk-1hqwggsn.js.map +12 -0
- package/dist/{chunk-zb47r1c8.js → chunk-23xs4qp9.js} +2 -2
- package/dist/{chunk-gmdvns8f.js → chunk-2am3db31.js} +2 -2
- package/dist/{chunk-fj1dvp37.js → chunk-2vhg6ysa.js} +1 -1
- package/dist/{chunk-dp7yk20b.js → chunk-33saed7g.js} +1 -1
- package/dist/{chunk-mdnw7nj8.js → chunk-3rrezgyc.js} +33 -8
- package/dist/chunk-3rrezgyc.js.map +15 -0
- package/dist/{chunk-jgwb25gc.js → chunk-4as3wt1c.js} +13 -5
- package/dist/chunk-4as3wt1c.js.map +12 -0
- package/dist/chunk-4ra628t7.js +88 -0
- package/dist/chunk-4ra628t7.js.map +10 -0
- package/dist/{chunk-chdg6eqq.js → chunk-52c5zb0z.js} +2 -2
- package/dist/{chunk-69kt9q43.js → chunk-5be2ath4.js} +1 -1
- package/dist/{chunk-qnd7ehe5.js → chunk-5thzcb8g.js} +2 -2
- package/dist/{chunk-6z1q7j19.js → chunk-5yd8cchh.js} +1126 -780
- package/dist/chunk-5yd8cchh.js.map +66 -0
- package/dist/{chunk-3q7z9hd4.js → chunk-6wbm6ymz.js} +234 -40
- package/dist/{chunk-3q7z9hd4.js.map → chunk-6wbm6ymz.js.map} +8 -6
- package/dist/{chunk-kvysp909.js → chunk-7ecp4v7a.js} +26 -19
- package/dist/chunk-7ecp4v7a.js.map +17 -0
- package/dist/{chunk-f85hpqnm.js → chunk-99nd4rc1.js} +3 -3
- package/dist/{chunk-f85hpqnm.js.map → chunk-99nd4rc1.js.map} +3 -3
- package/dist/{chunk-dsv8kdgk.js → chunk-9g6jz9kk.js} +5 -5
- package/dist/{chunk-39tqv9hz.js → chunk-9se093qz.js} +5 -6
- package/dist/{chunk-39tqv9hz.js.map → chunk-9se093qz.js.map} +3 -4
- package/dist/{chunk-7g2gjvah.js → chunk-a7er86jd.js} +1 -1
- package/dist/{chunk-zdkcdshk.js → chunk-aq39q04r.js} +41 -3
- package/dist/{chunk-zdkcdshk.js.map → chunk-aq39q04r.js.map} +4 -3
- package/dist/chunk-b9affek3.js +261 -0
- package/dist/chunk-b9affek3.js.map +12 -0
- package/dist/{chunk-b9y8hcm2.js → chunk-c2rga5cx.js} +1 -1
- package/dist/{chunk-f72rbvsb.js → chunk-cnb5kv05.js} +2 -2
- package/dist/chunk-d62kjtbg.js.map +2 -2
- package/dist/{chunk-vjqt7q3a.js → chunk-dam456ve.js} +233 -34
- package/dist/{chunk-vjqt7q3a.js.map → chunk-dam456ve.js.map} +7 -5
- package/dist/{chunk-sbcm1b92.js → chunk-e67ynxcr.js} +3 -3
- package/dist/{chunk-xnx96gfy.js → chunk-ere85b8y.js} +17 -8
- package/dist/chunk-ere85b8y.js.map +15 -0
- package/dist/{chunk-k4kkp58d.js → chunk-ewqa58h9.js} +12 -2
- package/dist/chunk-ewqa58h9.js.map +11 -0
- package/dist/{chunk-cq44v1a6.js → chunk-f1xh7a32.js} +3 -3
- package/dist/{chunk-h4138ww2.js → chunk-fggq3d9k.js} +450 -799
- package/dist/chunk-fggq3d9k.js.map +49 -0
- package/dist/{chunk-kttr5ftm.js → chunk-gf7yht60.js} +3 -3
- package/dist/chunk-h8teetr0.js +9 -0
- package/dist/chunk-h8teetr0.js.map +10 -0
- package/dist/chunk-hn2r7z41.js.map +1 -1
- package/dist/{chunk-nj0020ay.js → chunk-jjrn5v0p.js} +1 -1
- package/dist/{chunk-nvymebc1.js → chunk-jnfxmr3f.js} +1 -1
- package/dist/{chunk-nkbev3tr.js → chunk-k4g51s47.js} +3 -3
- package/dist/{chunk-a0073121.js → chunk-kpx7jrmn.js} +3 -1
- package/dist/chunk-kpx7jrmn.js.map +12 -0
- package/dist/{chunk-h044jb97.js → chunk-pja9jfz6.js} +172 -10
- package/dist/chunk-pja9jfz6.js.map +19 -0
- package/dist/chunk-pqajwytd.js.map +1 -1
- package/dist/{chunk-mr60an99.js → chunk-qczk96d9.js} +22 -2
- package/dist/{chunk-mr60an99.js.map → chunk-qczk96d9.js.map} +3 -3
- package/dist/{chunk-s3csryxe.js → chunk-rj69qcrd.js} +8 -2
- package/dist/chunk-rj69qcrd.js.map +11 -0
- package/dist/{chunk-swxzncrv.js → chunk-rpxz486p.js} +32 -5
- package/dist/{chunk-swxzncrv.js.map → chunk-rpxz486p.js.map} +4 -4
- package/dist/{chunk-tkdbge6v.js → chunk-rx7h5fdx.js} +1 -1
- package/dist/{chunk-tnvafr7g.js → chunk-s7ftxrdr.js} +105 -7
- package/dist/chunk-s7ftxrdr.js.map +22 -0
- package/dist/{chunk-h866d223.js → chunk-sk0hcjsz.js} +1 -1
- package/dist/{chunk-2xvgy3x5.js → chunk-svabwqdq.js} +2 -2
- package/dist/{chunk-667x4drs.js → chunk-t9shqx3w.js} +2 -2
- package/dist/{chunk-40qb8wpe.js → chunk-tjjgy3z4.js} +26 -23
- package/dist/{chunk-40qb8wpe.js.map → chunk-tjjgy3z4.js.map} +3 -3
- package/dist/{chunk-gkxsenvp.js → chunk-vp3z1ckh.js} +31 -7
- package/dist/{chunk-gkxsenvp.js.map → chunk-vp3z1ckh.js.map} +5 -4
- package/dist/{chunk-cxj8y8t0.js → chunk-vre348sb.js} +2 -2
- package/dist/{chunk-vsvrv7n8.js → chunk-w9yycd3t.js} +1 -1
- package/dist/{chunk-g4rbm4a6.js → chunk-wt4szfec.js} +379 -331
- package/dist/chunk-wt4szfec.js.map +14 -0
- package/dist/{chunk-a7ne02hk.js → chunk-xcy5ddha.js} +6 -6
- package/dist/{chunk-zvmr2hqk.js → chunk-xyvy73tj.js} +4 -3
- package/dist/{chunk-zvmr2hqk.js.map → chunk-xyvy73tj.js.map} +3 -3
- package/dist/datasets/write.js +1 -1
- package/dist/execution/agent.js +38 -37
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/authorized-object-reader.d.ts +3 -1
- package/dist/execution/authorized-object-reader.d.ts.map +1 -1
- package/dist/execution/primitive.js +36 -35
- package/dist/execution/primitive.js.map +2 -2
- package/dist/execution/request.js +37 -36
- package/dist/execution/request.js.map +2 -2
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +62 -59
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/in-memory.d.ts +5 -1
- package/dist/lake-storage/in-memory.d.ts.map +1 -1
- package/dist/lake-storage/index.d.ts +1 -1
- package/dist/lake-storage/index.d.ts.map +1 -1
- package/dist/lake-storage/index.js +2 -2
- package/dist/lake-storage/types.d.ts +26 -0
- package/dist/lake-storage/types.d.ts.map +1 -1
- package/dist/maintenance/ontology-maintenance.d.ts +5 -1
- package/dist/maintenance/ontology-maintenance.d.ts.map +1 -1
- package/dist/maintenance/types.d.ts +1 -4
- package/dist/maintenance/types.d.ts.map +1 -1
- package/dist/materialization/event-envelopes.d.ts +20 -0
- package/dist/materialization/event-envelopes.d.ts.map +1 -0
- package/dist/materialization/events.d.ts +29 -3
- package/dist/materialization/events.d.ts.map +1 -1
- package/dist/materialization/index.d.ts +4 -1
- package/dist/materialization/index.d.ts.map +1 -1
- package/dist/materialization/index.js +9 -3
- package/dist/materialization/index.js.map +1 -1
- package/dist/materializer/edits/plan.d.ts +2 -10
- package/dist/materializer/edits/plan.d.ts.map +1 -1
- package/dist/materializer/effective/build-events.d.ts +5 -21
- package/dist/materializer/effective/build-events.d.ts.map +1 -1
- package/dist/materializer/effective/vector-indexing.d.ts +2 -3
- package/dist/materializer/effective/vector-indexing.d.ts.map +1 -1
- package/dist/materializer/effective/vectors.d.ts +2 -3
- package/dist/materializer/effective/vectors.d.ts.map +1 -1
- package/dist/materializer/execution/scope.d.ts +1 -11
- package/dist/materializer/execution/scope.d.ts.map +1 -1
- package/dist/materializer/execution/work-executor.d.ts +5 -7
- package/dist/materializer/execution/work-executor.d.ts.map +1 -1
- package/dist/materializer/execution/work-records.d.ts +1 -3
- package/dist/materializer/execution/work-records.d.ts.map +1 -1
- package/dist/materializer/index.js +31 -32
- package/dist/materializer/index.js.map +1 -1
- package/dist/materializer/projections/replace.d.ts.map +1 -1
- package/dist/materializer/projections/replacement-plan.d.ts +8 -11
- package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
- package/dist/materializer/shared/batching.d.ts +5 -0
- package/dist/materializer/shared/batching.d.ts.map +1 -1
- package/dist/materializer/telemetry/plan.d.ts +2 -8
- package/dist/materializer/telemetry/plan.d.ts.map +1 -1
- package/dist/models/audio/catalog.d.ts +20 -0
- package/dist/models/audio/catalog.d.ts.map +1 -0
- package/dist/models/audio/errors.d.ts +8 -0
- package/dist/models/audio/errors.d.ts.map +1 -0
- package/dist/models/audio/file.d.ts +9 -0
- package/dist/models/audio/file.d.ts.map +1 -0
- package/dist/models/audio/runtime.d.ts +8 -0
- package/dist/models/audio/runtime.d.ts.map +1 -0
- package/dist/models/audio/types.d.ts +60 -0
- package/dist/models/audio/types.d.ts.map +1 -0
- package/dist/models/catalog.d.ts +23 -1
- package/dist/models/catalog.d.ts.map +1 -1
- package/dist/models/definitions.d.ts +1 -1
- package/dist/models/definitions.d.ts.map +1 -1
- package/dist/models/events.d.ts +3 -0
- package/dist/models/events.d.ts.map +1 -1
- package/dist/models/execution/index.js +22 -22
- package/dist/models/execution/model-call-admission.d.ts +6 -1
- package/dist/models/execution/model-call-admission.d.ts.map +1 -1
- package/dist/models/execution/model-call-limits.d.ts.map +1 -1
- package/dist/models/execution/model-call-recorder.d.ts.map +1 -1
- package/dist/models/execution/reranking.d.ts +4 -0
- package/dist/models/execution/reranking.d.ts.map +1 -0
- package/dist/models/execution/usage.d.ts.map +1 -1
- package/dist/models/execution.d.ts +2 -1
- package/dist/models/execution.d.ts.map +1 -1
- package/dist/models/generation-types.d.ts +2 -0
- package/dist/models/generation-types.d.ts.map +1 -1
- package/dist/models/index.d.ts +7 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +6 -2
- package/dist/models/index.js.map +1 -1
- package/dist/models/pricing.d.ts +2 -2
- package/dist/models/pricing.d.ts.map +1 -1
- package/dist/models/reranking-model.d.ts +49 -0
- package/dist/models/reranking-model.d.ts.map +1 -0
- package/dist/objects/index.js +25 -25
- package/dist/objects/query/executor.d.ts +2 -1
- package/dist/objects/query/executor.d.ts.map +1 -1
- package/dist/objects/query/index.d.ts +1 -1
- package/dist/objects/query/index.d.ts.map +1 -1
- package/dist/objects/query/index.js +22 -22
- package/dist/objects/query/ir.d.ts +8 -1
- package/dist/objects/query/ir.d.ts.map +1 -1
- package/dist/objects/query/normalize.d.ts.map +1 -1
- package/dist/objects/query/planner.d.ts +1 -1
- package/dist/objects/query/planner.d.ts.map +1 -1
- package/dist/objects/query/primary-id.d.ts +7 -0
- package/dist/objects/query/primary-id.d.ts.map +1 -0
- package/dist/objects/query/reranking-executor.d.ts +13 -0
- package/dist/objects/query/reranking-executor.d.ts.map +1 -0
- package/dist/objects/query/reranking-limits.d.ts +3 -0
- package/dist/objects/query/reranking-limits.d.ts.map +1 -0
- package/dist/objects/query/reranking-query.d.ts +4 -0
- package/dist/objects/query/reranking-query.d.ts.map +1 -0
- package/dist/objects/query/validate.d.ts.map +1 -1
- package/dist/objects/sdk/query-builder.d.ts +8 -0
- package/dist/objects/sdk/query-builder.d.ts.map +1 -1
- package/dist/objects/sdk/query-executor.d.ts +2 -2
- package/dist/objects/sdk/query-executor.d.ts.map +1 -1
- package/dist/objects/sdk/runtime-query-executor.d.ts.map +1 -1
- package/dist/objects/vectors/indexing-dispatch.d.ts +21 -0
- package/dist/objects/vectors/indexing-dispatch.d.ts.map +1 -0
- package/dist/objects/vectors/query.d.ts.map +1 -1
- package/dist/ontology/builders.d.ts.map +1 -1
- package/dist/ontology/index.d.ts +1 -1
- package/dist/ontology/index.d.ts.map +1 -1
- package/dist/ontology/index.js +3 -3
- package/dist/ontology/internal.js +2 -2
- package/dist/ontology/query-capabilities.d.ts +1 -0
- package/dist/ontology/query-capabilities.d.ts.map +1 -1
- package/dist/ontology/types.d.ts +20 -0
- package/dist/ontology/types.d.ts.map +1 -1
- package/dist/ontology/validation/query.d.ts.map +1 -1
- package/dist/pipelines/index.js +23 -23
- package/dist/projections/internal.js +22 -22
- package/dist/query.d.ts +4 -2
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +2 -2
- package/dist/queues/in-memory.d.ts +3 -0
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/queues/index.js +1 -1
- package/dist/queues/types.d.ts +4 -0
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +1 -0
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +1 -0
- package/dist/runtime/internal.d.ts.map +1 -1
- package/dist/runtime/internal.js +28 -26
- package/dist/runtime/internal.js.map +1 -1
- package/dist/runtime/public-origin.d.ts +10 -0
- package/dist/runtime/public-origin.d.ts.map +1 -0
- package/dist/runtime/sixb.d.ts +1 -0
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/runtime/types.d.ts +12 -2
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/sandboxes/index.js +5 -5
- package/dist/shares/internal.js +19 -19
- package/dist/storage/agents/provider.js +2 -2
- package/dist/storage/ai-cost/analytics.d.ts +1 -0
- package/dist/storage/ai-cost/analytics.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.js +3 -3
- package/dist/storage/ai-cost/types.d.ts +1 -1
- package/dist/storage/ai-cost/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/validation.d.ts.map +1 -1
- package/dist/storage/ai-limits/enforcement.js +2 -2
- package/dist/storage/ai-limits/in-memory.d.ts.map +1 -1
- package/dist/storage/ai-limits/provider.d.ts +7 -2
- package/dist/storage/ai-limits/provider.d.ts.map +1 -1
- package/dist/storage/ai-limits/provider.js +4 -2
- package/dist/storage/ai-limits/provider.js.map +1 -1
- package/dist/storage/ai-limits/types.d.ts +3 -0
- package/dist/storage/ai-limits/types.d.ts.map +1 -1
- package/dist/storage/ai-usage/record.d.ts.map +1 -1
- package/dist/storage/ai-usage/types.d.ts +8 -4
- package/dist/storage/ai-usage/types.d.ts.map +1 -1
- package/dist/storage/ai-usage/usage.d.ts.map +1 -1
- package/dist/storage/file-download-grants/in-memory.d.ts +11 -0
- package/dist/storage/file-download-grants/in-memory.d.ts.map +1 -0
- package/dist/storage/file-download-grants/index.d.ts +3 -0
- package/dist/storage/file-download-grants/index.d.ts.map +1 -0
- package/dist/storage/file-download-grants/record.d.ts +11 -0
- package/dist/storage/file-download-grants/record.d.ts.map +1 -0
- package/dist/storage/file-download-grants/types.d.ts +44 -0
- package/dist/storage/file-download-grants/types.d.ts.map +1 -0
- package/dist/storage/file-upload-sessions/provider.js +6 -6
- package/dist/storage/in-memory/index.d.ts +4 -0
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +5 -3
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +30 -30
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.d.ts +1 -0
- package/dist/storage/internal.d.ts.map +1 -1
- package/dist/storage/internal.js +8 -4
- package/dist/storage/internal.js.map +1 -1
- package/dist/storage/migrations/index.d.ts +1 -1
- package/dist/storage/migrations/index.d.ts.map +1 -1
- package/dist/storage/migrations/migrate-storage.d.ts +3 -3
- package/dist/storage/migrations/migrate-storage.d.ts.map +1 -1
- package/dist/storage/migrations/types.d.ts +7 -0
- package/dist/storage/migrations/types.d.ts.map +1 -1
- package/dist/storage/objects/in-memory/query.d.ts.map +1 -1
- package/dist/storage/objects/in-memory/selected-reader.d.ts.map +1 -1
- package/dist/storage/objects/in-memory/storage.d.ts.map +1 -1
- package/dist/storage/objects/query-preparation.d.ts +39 -0
- package/dist/storage/objects/query-preparation.d.ts.map +1 -0
- package/dist/storage/objects/types.d.ts +2 -0
- package/dist/storage/objects/types.d.ts.map +1 -1
- package/dist/storage/ontology/commits.d.ts +1 -6
- package/dist/storage/ontology/commits.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/index.d.ts +4 -2
- package/dist/storage/ontology/in-memory/index.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations-state.d.ts +0 -2
- package/dist/storage/ontology/in-memory/materializations-state.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations-work.d.ts +1 -3
- package/dist/storage/ontology/in-memory/materializations-work.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts +23 -57
- package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/outbox.d.ts +3 -2
- package/dist/storage/ontology/in-memory/outbox.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/replacement-plans.d.ts +104 -0
- package/dist/storage/ontology/in-memory/replacement-plans.d.ts.map +1 -0
- package/dist/storage/ontology/in-memory/shared-state.d.ts +17 -2
- package/dist/storage/ontology/in-memory/shared-state.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/source-roots.d.ts +3 -1
- package/dist/storage/ontology/in-memory/source-roots.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/sources.d.ts +1 -2
- package/dist/storage/ontology/in-memory/sources.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/state-reader.d.ts +25 -0
- package/dist/storage/ontology/in-memory/state-reader.d.ts.map +1 -0
- package/dist/storage/ontology/index.d.ts +6 -3
- package/dist/storage/ontology/index.d.ts.map +1 -1
- package/dist/storage/ontology/materializations.d.ts +40 -59
- package/dist/storage/ontology/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/outbox.d.ts +4 -6
- package/dist/storage/ontology/outbox.d.ts.map +1 -1
- package/dist/storage/ontology/provider-work.d.ts +114 -3
- package/dist/storage/ontology/provider-work.d.ts.map +1 -1
- package/dist/storage/ontology/provider.d.ts +14 -39
- package/dist/storage/ontology/provider.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +26 -12
- package/dist/storage/ontology/provider.js.map +1 -1
- package/dist/storage/ontology/replacement-plans.d.ts +103 -0
- package/dist/storage/ontology/replacement-plans.d.ts.map +1 -0
- package/dist/storage/ontology/sources.d.ts +0 -8
- package/dist/storage/ontology/sources.d.ts.map +1 -1
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +1 -1
- package/dist/storage/projection-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/projection-runs/types.d.ts +2 -0
- package/dist/storage/projection-runs/types.d.ts.map +1 -1
- package/dist/storage/types.d.ts +2 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.js +6 -6
- package/dist/syncs/index.js +24 -24
- package/dist/testing/ai-cost-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-limit-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-usage-storage-contract.d.ts.map +1 -1
- package/dist/testing/file-download-grant-storage-contract.d.ts +9 -0
- package/dist/testing/file-download-grant-storage-contract.d.ts.map +1 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +2549 -1490
- package/dist/testing/index.js.map +14 -13
- package/dist/testing/lake-storage-contract.d.ts.map +1 -1
- package/dist/testing/materializer-storage-contract.d.ts +14 -0
- package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
- package/dist/testing/object-read-scope-contract.d.ts.map +1 -1
- package/dist/testing/ontology-contract-fixture.d.ts +5 -1
- package/dist/testing/ontology-contract-fixture.d.ts.map +1 -1
- package/dist/testing/ontology-storage-contract.d.ts.map +1 -1
- package/dist/testing/projection-run-storage-contract.d.ts.map +1 -1
- package/dist/testing/queues-contract.d.ts.map +1 -1
- package/dist/webhooks/internal.js +20 -20
- package/dist/workers/index.js +15 -17
- package/dist/workers/index.js.map +3 -3
- package/dist/workers/queue-worker.d.ts +3 -2
- package/dist/workers/queue-worker.d.ts.map +1 -1
- package/dist/workflows/index.js +42 -41
- package/dist/workflows/index.js.map +1 -1
- package/package.json +7 -1
- package/src/actions/types/context.ts +5 -2
- package/src/blob-storage/download-urls.ts +138 -0
- package/src/blob-storage/execution.ts +32 -1
- package/src/blob-storage/internal.ts +1 -0
- package/src/execution/authorized-object-reader.ts +8 -1
- package/src/index.ts +25 -0
- package/src/lake-storage/in-memory.ts +38 -9
- package/src/lake-storage/index.ts +2 -0
- package/src/lake-storage/types.ts +30 -0
- package/src/maintenance/ontology-maintenance.ts +50 -23
- package/src/maintenance/types.ts +1 -4
- package/src/materialization/event-envelopes.ts +168 -0
- package/src/materialization/events.ts +40 -4
- package/src/materialization/index.ts +9 -1
- package/src/materializer/README.md +55 -10
- package/src/materializer/edits/commit.ts +3 -19
- package/src/materializer/edits/plan.ts +20 -71
- package/src/materializer/effective/build-events.ts +42 -136
- package/src/materializer/effective/vector-indexing.ts +2 -3
- package/src/materializer/effective/vectors.ts +2 -3
- package/src/materializer/execution/scope.ts +1 -38
- package/src/materializer/execution/work-executor.ts +21 -115
- package/src/materializer/execution/work-records.ts +0 -15
- package/src/materializer/projections/replace.ts +106 -63
- package/src/materializer/projections/replacement-plan.ts +73 -218
- package/src/materializer/shared/batching.ts +7 -0
- package/src/materializer/telemetry/append.ts +2 -14
- package/src/materializer/telemetry/plan.ts +6 -43
- package/src/models/audio/catalog.ts +90 -0
- package/src/models/audio/errors.ts +19 -0
- package/src/models/audio/file.ts +78 -0
- package/src/models/audio/runtime.ts +182 -0
- package/src/models/audio/types.ts +69 -0
- package/src/models/catalog.ts +52 -5
- package/src/models/definitions.ts +8 -1
- package/src/models/events.ts +3 -0
- package/src/models/execution/README.md +20 -1
- package/src/models/execution/model-call-admission.ts +6 -1
- package/src/models/execution/model-call-limits.ts +21 -11
- package/src/models/execution/model-call-recorder.ts +1 -0
- package/src/models/execution/model-call-recovery.ts +1 -0
- package/src/models/execution/reranking.ts +137 -0
- package/src/models/execution/usage.ts +1 -0
- package/src/models/execution.ts +5 -1
- package/src/models/generation-types.ts +2 -0
- package/src/models/index.ts +32 -0
- package/src/models/pricing.ts +2 -1
- package/src/models/reranking-model.ts +114 -0
- package/src/objects/query/executor.ts +42 -2
- package/src/objects/query/explain.ts +8 -0
- package/src/objects/query/index.ts +1 -0
- package/src/objects/query/ir.ts +10 -0
- package/src/objects/query/normalize.ts +2 -0
- package/src/objects/query/planner.ts +12 -1
- package/src/objects/query/primary-id.ts +56 -0
- package/src/objects/query/reranking-executor.ts +91 -0
- package/src/objects/query/reranking-limits.ts +3 -0
- package/src/objects/query/reranking-query.ts +8 -0
- package/src/objects/query/validate.ts +33 -1
- package/src/objects/sdk/query-builder.ts +15 -2
- package/src/objects/sdk/query-executor.ts +2 -2
- package/src/objects/sdk/runtime-query-executor.ts +7 -4
- package/src/objects/vectors/README.md +6 -2
- package/src/objects/vectors/indexing-dispatch.ts +83 -0
- package/src/objects/vectors/query.ts +3 -0
- package/src/ontology/builders.ts +1 -0
- package/src/ontology/index.ts +2 -0
- package/src/ontology/query-capabilities.ts +1 -1
- package/src/ontology/types.ts +21 -0
- package/src/ontology/validation/query.ts +57 -0
- package/src/query.ts +4 -0
- package/src/queues/in-memory.ts +54 -19
- package/src/queues/types.ts +4 -0
- package/src/runtime/host.ts +28 -1
- package/src/runtime/index.ts +1 -0
- package/src/runtime/internal.ts +1 -0
- package/src/runtime/public-origin.ts +33 -0
- package/src/runtime/sixb.ts +13 -2
- package/src/runtime/types.ts +12 -2
- package/src/storage/ai-cost/analytics.ts +2 -0
- package/src/storage/ai-cost/codec.ts +2 -1
- package/src/storage/ai-cost/types.ts +1 -0
- package/src/storage/ai-cost/validation.ts +21 -8
- package/src/storage/ai-limits/in-memory.ts +10 -2
- package/src/storage/ai-limits/provider.ts +29 -2
- package/src/storage/ai-limits/types.ts +3 -0
- package/src/storage/ai-usage/record.ts +9 -0
- package/src/storage/ai-usage/types.ts +8 -4
- package/src/storage/ai-usage/usage.ts +2 -0
- package/src/storage/file-download-grants/in-memory.ts +73 -0
- package/src/storage/file-download-grants/index.ts +8 -0
- package/src/storage/file-download-grants/record.ts +47 -0
- package/src/storage/file-download-grants/types.ts +48 -0
- package/src/storage/in-memory/index.ts +13 -2
- package/src/storage/index.ts +31 -13
- package/src/storage/internal.ts +1 -0
- package/src/storage/migrations/index.ts +1 -0
- package/src/storage/migrations/migrate-storage.ts +36 -12
- package/src/storage/migrations/types.ts +8 -0
- package/src/storage/objects/in-memory/query.ts +2 -0
- package/src/storage/objects/in-memory/selected-reader.ts +1 -0
- package/src/storage/objects/in-memory/storage.ts +1 -0
- package/src/storage/objects/query-preparation.ts +77 -0
- package/src/storage/objects/types.ts +2 -0
- package/src/storage/ontology/commits.ts +1 -6
- package/src/storage/ontology/in-memory/index.ts +28 -9
- package/src/storage/ontology/in-memory/materializations-finalization.ts +35 -68
- package/src/storage/ontology/in-memory/materializations-state.ts +0 -22
- package/src/storage/ontology/in-memory/materializations-work.ts +0 -45
- package/src/storage/ontology/in-memory/materializations.ts +172 -653
- package/src/storage/ontology/in-memory/outbox.ts +37 -29
- package/src/storage/ontology/in-memory/replacement-plans.ts +697 -0
- package/src/storage/ontology/in-memory/shared-state.ts +24 -2
- package/src/storage/ontology/in-memory/source-roots.ts +7 -2
- package/src/storage/ontology/in-memory/sources.ts +7 -33
- package/src/storage/ontology/in-memory/state-reader.ts +245 -0
- package/src/storage/ontology/index.ts +19 -13
- package/src/storage/ontology/materializations.ts +45 -74
- package/src/storage/ontology/outbox.ts +4 -7
- package/src/storage/ontology/provider-header-validation.ts +0 -57
- package/src/storage/ontology/provider-work.ts +381 -90
- package/src/storage/ontology/provider.ts +74 -171
- package/src/storage/ontology/replacement-plans.ts +117 -0
- package/src/storage/ontology/sources.ts +0 -12
- package/src/storage/operation-scope.ts +33 -1
- package/src/storage/projection-runs/in-memory.ts +7 -1
- package/src/storage/projection-runs/types.ts +2 -0
- package/src/storage/types.ts +2 -0
- package/src/testing/ai-cost-storage-contract.ts +1 -0
- package/src/testing/ai-limit-storage-contract.ts +62 -0
- package/src/testing/ai-usage-storage-contract.ts +31 -0
- package/src/testing/file-download-grant-storage-contract.ts +139 -0
- package/src/testing/index.ts +4 -0
- package/src/testing/lake-storage-contract.ts +87 -1
- package/src/testing/materializer-storage-contract.ts +1008 -1
- package/src/testing/object-read-scope-contract.ts +1 -0
- package/src/testing/ontology-contract-fixture.ts +11 -87
- package/src/testing/ontology-storage-contract.ts +70 -39
- package/src/testing/projection-run-storage-contract.ts +14 -0
- package/src/testing/queues-contract.ts +59 -0
- package/src/workers/queue-worker.ts +19 -16
- package/dist/chunk-6z1q7j19.js.map +0 -62
- package/dist/chunk-7ytf06d3.js +0 -113
- package/dist/chunk-7ytf06d3.js.map +0 -10
- package/dist/chunk-a0073121.js.map +0 -12
- package/dist/chunk-g4rbm4a6.js.map +0 -15
- package/dist/chunk-h044jb97.js.map +0 -15
- package/dist/chunk-h4138ww2.js.map +0 -50
- package/dist/chunk-hgqpcmyr.js.map +0 -12
- package/dist/chunk-jgwb25gc.js.map +0 -12
- package/dist/chunk-k4kkp58d.js.map +0 -11
- package/dist/chunk-kvysp909.js.map +0 -17
- package/dist/chunk-mdnw7nj8.js.map +0 -15
- package/dist/chunk-s3csryxe.js.map +0 -11
- package/dist/chunk-tnvafr7g.js.map +0 -19
- package/dist/chunk-xnx96gfy.js.map +0 -15
- package/dist/materializer/execution/plan-stream.d.ts +0 -8
- package/dist/materializer/execution/plan-stream.d.ts.map +0 -1
- package/src/materializer/execution/plan-stream.ts +0 -121
- /package/dist/{chunk-zb47r1c8.js.map → chunk-23xs4qp9.js.map} +0 -0
- /package/dist/{chunk-gmdvns8f.js.map → chunk-2am3db31.js.map} +0 -0
- /package/dist/{chunk-fj1dvp37.js.map → chunk-2vhg6ysa.js.map} +0 -0
- /package/dist/{chunk-dp7yk20b.js.map → chunk-33saed7g.js.map} +0 -0
- /package/dist/{chunk-chdg6eqq.js.map → chunk-52c5zb0z.js.map} +0 -0
- /package/dist/{chunk-69kt9q43.js.map → chunk-5be2ath4.js.map} +0 -0
- /package/dist/{chunk-qnd7ehe5.js.map → chunk-5thzcb8g.js.map} +0 -0
- /package/dist/{chunk-dsv8kdgk.js.map → chunk-9g6jz9kk.js.map} +0 -0
- /package/dist/{chunk-7g2gjvah.js.map → chunk-a7er86jd.js.map} +0 -0
- /package/dist/{chunk-b9y8hcm2.js.map → chunk-c2rga5cx.js.map} +0 -0
- /package/dist/{chunk-f72rbvsb.js.map → chunk-cnb5kv05.js.map} +0 -0
- /package/dist/{chunk-sbcm1b92.js.map → chunk-e67ynxcr.js.map} +0 -0
- /package/dist/{chunk-cq44v1a6.js.map → chunk-f1xh7a32.js.map} +0 -0
- /package/dist/{chunk-kttr5ftm.js.map → chunk-gf7yht60.js.map} +0 -0
- /package/dist/{chunk-nj0020ay.js.map → chunk-jjrn5v0p.js.map} +0 -0
- /package/dist/{chunk-nvymebc1.js.map → chunk-jnfxmr3f.js.map} +0 -0
- /package/dist/{chunk-nkbev3tr.js.map → chunk-k4g51s47.js.map} +0 -0
- /package/dist/{chunk-tkdbge6v.js.map → chunk-rx7h5fdx.js.map} +0 -0
- /package/dist/{chunk-h866d223.js.map → chunk-sk0hcjsz.js.map} +0 -0
- /package/dist/{chunk-2xvgy3x5.js.map → chunk-svabwqdq.js.map} +0 -0
- /package/dist/{chunk-667x4drs.js.map → chunk-t9shqx3w.js.map} +0 -0
- /package/dist/{chunk-cxj8y8t0.js.map → chunk-vre348sb.js.map} +0 -0
- /package/dist/{chunk-vsvrv7n8.js.map → chunk-w9yycd3t.js.map} +0 -0
- /package/dist/{chunk-a7ne02hk.js.map → chunk-xcy5ddha.js.map} +0 -0
|
@@ -5,19 +5,22 @@ import {
|
|
|
5
5
|
projectionEntityKey2,
|
|
6
6
|
telemetryPointKey2,
|
|
7
7
|
linkRefSortKey2,
|
|
8
|
-
linkScopeSortKey2
|
|
9
|
-
|
|
8
|
+
linkScopeSortKey2,
|
|
9
|
+
materializationEventKindOrdinal2,
|
|
10
|
+
createEventId2,
|
|
11
|
+
materializationEvent2,
|
|
12
|
+
eventAttribution2
|
|
13
|
+
} from "./chunk-b9affek3.js";
|
|
10
14
|
import {
|
|
11
15
|
MaterializationValidationError2,
|
|
12
16
|
MaterializationConflictError2
|
|
13
17
|
} from "./chunk-96yw3pwd.js";
|
|
14
18
|
import {
|
|
15
|
-
assertJsonValue2,
|
|
16
19
|
stableJsonStringify2
|
|
17
20
|
} from "./chunk-wy0qdqfm.js";
|
|
18
21
|
|
|
19
22
|
// src/storage/ontology/provider.ts
|
|
20
|
-
import { createHash
|
|
23
|
+
import { createHash, randomUUID } from "crypto";
|
|
21
24
|
|
|
22
25
|
// src/storage/ontology/provider-validation.ts
|
|
23
26
|
function assertNonblank2(value, label) {
|
|
@@ -46,36 +49,8 @@ function invalidCorrelation2(message) {
|
|
|
46
49
|
throw new MaterializationValidationError2(message);
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
// src/materialization/identity.ts
|
|
50
|
-
import { createHash } from "crypto";
|
|
51
|
-
var ONTOLOGY_MATERIALIZATION_EVENT_KIND_ORDER2 = Object.freeze([
|
|
52
|
-
"object.created",
|
|
53
|
-
"object.updated",
|
|
54
|
-
"object.deleted",
|
|
55
|
-
"link.created",
|
|
56
|
-
"link.updated",
|
|
57
|
-
"link.deleted",
|
|
58
|
-
"telemetry.appended"
|
|
59
|
-
]);
|
|
60
|
-
function materializationEventKindOrdinal2(kind) {
|
|
61
|
-
return ONTOLOGY_MATERIALIZATION_EVENT_KIND_ORDER2.indexOf(kind);
|
|
62
|
-
}
|
|
63
|
-
function sha256Canonical2(value) {
|
|
64
|
-
assertJsonValue2(value, "Canonical hash input");
|
|
65
|
-
return createHash("sha256").update(stableJsonStringify2(value)).digest("hex");
|
|
66
|
-
}
|
|
67
|
-
function createRequestHash2(normalizedCallerIntent) {
|
|
68
|
-
return sha256Canonical2(normalizedCallerIntent);
|
|
69
|
-
}
|
|
70
|
-
function createCommitId2(projectId, idempotencyKey) {
|
|
71
|
-
return sha256Canonical2([projectId, idempotencyKey]);
|
|
72
|
-
}
|
|
73
|
-
function createEventId2(projectId, commitId, ordinal) {
|
|
74
|
-
return sha256Canonical2([projectId, commitId, ordinal]);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
52
|
// src/storage/ontology/materializations.ts
|
|
78
|
-
function
|
|
53
|
+
function materializationApplyPhase2(kind) {
|
|
79
54
|
switch (kind) {
|
|
80
55
|
case "object-override-upsert":
|
|
81
56
|
case "object-override-delete":
|
|
@@ -97,6 +72,126 @@ function materializationApplyPhase(kind) {
|
|
|
97
72
|
}
|
|
98
73
|
}
|
|
99
74
|
|
|
75
|
+
// src/storage/ontology/provider-header-validation.ts
|
|
76
|
+
function assertMaterializationHeader2({ commit }) {
|
|
77
|
+
assertCommitEnvelope(commit);
|
|
78
|
+
switch (commit.intent.kind) {
|
|
79
|
+
case "edit":
|
|
80
|
+
assertEditCommit(commit, commit.intent);
|
|
81
|
+
break;
|
|
82
|
+
case "projection":
|
|
83
|
+
assertProjectionCommit(commit, commit.intent);
|
|
84
|
+
break;
|
|
85
|
+
case "telemetry":
|
|
86
|
+
assertTelemetryCommit(commit, commit.intent);
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function assertCommitEnvelope(commit) {
|
|
91
|
+
assertNonblank2(commit.projectId, "Materialization project id");
|
|
92
|
+
assertNonblank2(commit.id, "Materialization commit id");
|
|
93
|
+
assertNonblank2(commit.idempotencyKey, "Materialization idempotency key");
|
|
94
|
+
assertNonblank2(commit.requestHash, "Materialization request hash");
|
|
95
|
+
assertNonblank2(commit.executionId, "Materialization execution id");
|
|
96
|
+
assertNonblank2(commit.ontologyRevision, "Materialization ontology revision");
|
|
97
|
+
assertTimestamp2(commit.committedAt, "Materialization commit time");
|
|
98
|
+
}
|
|
99
|
+
function assertEditCommit(commit, intent) {
|
|
100
|
+
assertNonnegativeInteger2(intent.operationCount, "Edit commit operation count");
|
|
101
|
+
switch (commit.origin.kind) {
|
|
102
|
+
case "action":
|
|
103
|
+
assertNonblank2(commit.origin.actionId, "Action origin action id");
|
|
104
|
+
assertNonblank2(commit.origin.runId, "Action origin run id");
|
|
105
|
+
return;
|
|
106
|
+
case "runtime":
|
|
107
|
+
assertNonblank2(commit.origin.requestId, "Runtime origin request id");
|
|
108
|
+
return;
|
|
109
|
+
default:
|
|
110
|
+
invalidCorrelation2("Edit commit origin does not correlate with its intent.");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function assertProjectionCommit(commit, intent) {
|
|
114
|
+
if (commit.origin.kind !== "projection") {
|
|
115
|
+
invalidCorrelation2("Projection commit origin does not correlate with its intent.");
|
|
116
|
+
}
|
|
117
|
+
assertProjectionSemanticMetadata(commit);
|
|
118
|
+
assertNonblank2(commit.origin.projectionRunId, "Projection run id");
|
|
119
|
+
assertTimestamp2(intent.datasetVersion.createdAt, "Projection dataset version createdAt");
|
|
120
|
+
if (commit.origin.projectionId !== intent.source.projectionId) {
|
|
121
|
+
invalidCorrelation2("Projection commit origin does not match its projection.");
|
|
122
|
+
}
|
|
123
|
+
if (commit.origin.datasetId !== intent.datasetVersion.datasetId || commit.origin.datasetVersionId !== intent.datasetVersion.versionId) {
|
|
124
|
+
invalidCorrelation2("Projection commit origin does not match its dataset version.");
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function assertTelemetryCommit(commit, intent) {
|
|
128
|
+
if (commit.origin.kind !== "telemetry") {
|
|
129
|
+
invalidCorrelation2("Telemetry commit origin does not correlate with its intent.");
|
|
130
|
+
}
|
|
131
|
+
assertTelemetryPointCounts(intent);
|
|
132
|
+
if (intent.source.kind === "runtime") {
|
|
133
|
+
assertRuntimeTelemetryCommit(commit);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
assertProjectionTelemetryCommit(commit, intent.source, intent.inputPointCount);
|
|
137
|
+
}
|
|
138
|
+
function assertTelemetryPointCounts(intent) {
|
|
139
|
+
assertNonnegativeInteger2(intent.pointCount, "Telemetry commit point count");
|
|
140
|
+
assertNonnegativeInteger2(intent.inputPointCount, "Telemetry commit input point count");
|
|
141
|
+
if (intent.inputPointCount < intent.pointCount) {
|
|
142
|
+
invalidCorrelation2("Telemetry input point count cannot be lower than its canonical point count.");
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function assertRuntimeTelemetryCommit(commit) {
|
|
146
|
+
if (commit.origin.kind !== "telemetry" || commit.origin.source.kind !== "runtime") {
|
|
147
|
+
invalidCorrelation2("Runtime telemetry origin does not correlate with its intent.");
|
|
148
|
+
}
|
|
149
|
+
if (commit.projectionRevision !== undefined || commit.ownershipHash !== undefined) {
|
|
150
|
+
invalidCorrelation2("Runtime telemetry commit contains projection-only metadata.");
|
|
151
|
+
}
|
|
152
|
+
assertNonblank2(commit.origin.source.requestId, "Runtime telemetry request id");
|
|
153
|
+
}
|
|
154
|
+
function assertProjectionTelemetryCommit(commit, source, inputPointCount) {
|
|
155
|
+
if (commit.origin.kind !== "telemetry" || commit.origin.source.kind !== "projection") {
|
|
156
|
+
invalidCorrelation2("Projection telemetry origin does not correlate with its intent.");
|
|
157
|
+
}
|
|
158
|
+
const origin = commit.origin.source;
|
|
159
|
+
assertProjectionSemanticMetadata(commit);
|
|
160
|
+
assertNonblank2(origin.projectionRunId, "Telemetry projection run id");
|
|
161
|
+
assertTimestamp2(source.datasetVersion.createdAt, "Telemetry dataset version createdAt");
|
|
162
|
+
assertProjectionTelemetryBatch(source, inputPointCount);
|
|
163
|
+
if (origin.projectionId !== source.projection.projectionId) {
|
|
164
|
+
invalidCorrelation2("Projection telemetry origin does not match its projection.");
|
|
165
|
+
}
|
|
166
|
+
if (origin.datasetId !== source.datasetVersion.datasetId || origin.datasetVersionId !== source.datasetVersion.versionId) {
|
|
167
|
+
invalidCorrelation2("Projection telemetry origin does not match its dataset version.");
|
|
168
|
+
}
|
|
169
|
+
if (origin.batchOrdinal !== source.batchOrdinal) {
|
|
170
|
+
invalidCorrelation2("Projection telemetry origin does not match its batch ordinal.");
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function assertProjectionTelemetryBatch(source, inputPointCount) {
|
|
174
|
+
assertNonnegativeInteger2(source.batchOrdinal, "Projection telemetry batch ordinal");
|
|
175
|
+
assertPositiveInteger2(source.sourceRowCount, "Projection telemetry source row count");
|
|
176
|
+
assertNonnegativeInteger2(source.sourceRowsSkipped, "Projection telemetry skipped row count");
|
|
177
|
+
if (source.sourceRowsSkipped > source.sourceRowCount) {
|
|
178
|
+
invalidCorrelation2("Projection telemetry skipped rows exceed its source row count.");
|
|
179
|
+
}
|
|
180
|
+
if (inputPointCount < source.sourceRowCount - source.sourceRowsSkipped) {
|
|
181
|
+
invalidCorrelation2("Projection telemetry input points do not account for every non-skipped source row.");
|
|
182
|
+
}
|
|
183
|
+
if (typeof source.inputExhausted !== "boolean") {
|
|
184
|
+
invalidCorrelation2("Projection telemetry input exhaustion marker is invalid.");
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function assertProjectionSemanticMetadata(commit) {
|
|
188
|
+
if (commit.projectionRevision === undefined || commit.ownershipHash === undefined) {
|
|
189
|
+
invalidCorrelation2("Projection materialization is missing semantic identity metadata.");
|
|
190
|
+
}
|
|
191
|
+
assertNonblank2(commit.projectionRevision, "Projection revision");
|
|
192
|
+
assertNonblank2(commit.ownershipHash, "Projection ownership hash");
|
|
193
|
+
}
|
|
194
|
+
|
|
100
195
|
// src/storage/ontology/provider-work.ts
|
|
101
196
|
function assertPageRows2(value) {
|
|
102
197
|
if (!Number.isSafeInteger(value) || value <= 0)
|
|
@@ -105,38 +200,220 @@ function assertPageRows2(value) {
|
|
|
105
200
|
function materializationChunkRows2(chunk) {
|
|
106
201
|
return chunk.overrides.objects.upserts.length + chunk.overrides.objects.deletes.length + chunk.overrides.links.edges.upserts.length + chunk.overrides.links.edges.deletes.length + chunk.overrides.links.slots.upserts.length + chunk.overrides.links.slots.deletes.length + chunk.effective.objectUpserts.length + chunk.effective.objectDeletes.length + chunk.effective.linkUpserts.length + chunk.effective.linkDeletes.length + chunk.timeseries.pointUpserts.length + chunk.outbox.length;
|
|
107
202
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
203
|
+
function materializationPlanChunk2(items, outbox = []) {
|
|
204
|
+
const chunk = {
|
|
205
|
+
overrides: {
|
|
206
|
+
objects: {
|
|
207
|
+
upserts: [],
|
|
208
|
+
deletes: []
|
|
209
|
+
},
|
|
210
|
+
links: {
|
|
211
|
+
edges: {
|
|
212
|
+
upserts: [],
|
|
213
|
+
deletes: []
|
|
214
|
+
},
|
|
215
|
+
slots: {
|
|
216
|
+
upserts: [],
|
|
217
|
+
deletes: []
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
effective: {
|
|
222
|
+
objectUpserts: [],
|
|
223
|
+
objectDeletes: [],
|
|
224
|
+
linkUpserts: [],
|
|
225
|
+
linkDeletes: []
|
|
226
|
+
},
|
|
227
|
+
timeseries: { pointUpserts: [] },
|
|
228
|
+
outbox
|
|
229
|
+
};
|
|
230
|
+
for (const item of items) {
|
|
231
|
+
switch (item.kind) {
|
|
232
|
+
case "object-override-upsert":
|
|
233
|
+
chunk.overrides.objects.upserts.push(item.value);
|
|
234
|
+
break;
|
|
235
|
+
case "object-override-delete":
|
|
236
|
+
chunk.overrides.objects.deletes.push(item.value);
|
|
237
|
+
break;
|
|
238
|
+
case "link-override-upsert":
|
|
239
|
+
chunk.overrides.links.edges.upserts.push(item.value);
|
|
240
|
+
break;
|
|
241
|
+
case "link-override-delete":
|
|
242
|
+
chunk.overrides.links.edges.deletes.push(item.value);
|
|
243
|
+
break;
|
|
244
|
+
case "link-slot-override-upsert":
|
|
245
|
+
chunk.overrides.links.slots.upserts.push(item.value);
|
|
246
|
+
break;
|
|
247
|
+
case "link-slot-override-delete":
|
|
248
|
+
chunk.overrides.links.slots.deletes.push(item.value);
|
|
249
|
+
break;
|
|
250
|
+
case "object-upsert":
|
|
251
|
+
chunk.effective.objectUpserts.push(item.value);
|
|
252
|
+
break;
|
|
253
|
+
case "object-delete":
|
|
254
|
+
chunk.effective.objectDeletes.push(item.value);
|
|
255
|
+
break;
|
|
256
|
+
case "link-upsert":
|
|
257
|
+
chunk.effective.linkUpserts.push(item.value);
|
|
258
|
+
break;
|
|
259
|
+
case "link-delete":
|
|
260
|
+
chunk.effective.linkDeletes.push(item.value);
|
|
261
|
+
break;
|
|
262
|
+
case "point-upsert":
|
|
263
|
+
chunk.timeseries.pointUpserts.push(item.value);
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return chunk;
|
|
268
|
+
}
|
|
269
|
+
function materializationOutboxWrite2(commit, event, commitOrdinal) {
|
|
270
|
+
return {
|
|
271
|
+
id: createEventId2(commit.projectId, commit.id, commitOrdinal),
|
|
272
|
+
commitOrdinal,
|
|
273
|
+
event,
|
|
274
|
+
createdAt: commit.committedAt
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
function claimedOutboxRows2(rows, contextOf) {
|
|
278
|
+
const attributions = new Map;
|
|
279
|
+
return rows.map(({ id, commitId, commitOrdinal, event, ...row }) => {
|
|
280
|
+
const context = contextOf(commitId);
|
|
281
|
+
if (!context) {
|
|
282
|
+
throw new Error(`[Sixb] Ontology outbox event '${id}' has no commit '${commitId}'.`);
|
|
283
|
+
}
|
|
284
|
+
let attribution = attributions.get(commitId);
|
|
285
|
+
if (!attribution) {
|
|
286
|
+
attribution = eventAttribution2(context.execution);
|
|
287
|
+
attributions.set(commitId, attribution);
|
|
288
|
+
}
|
|
289
|
+
return {
|
|
290
|
+
...row,
|
|
291
|
+
envelope: materializationEvent2(event, { id, commitOrdinal }, context.commit, attribution)
|
|
292
|
+
};
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
function assertReplacementPlanCommit2(commit, opened) {
|
|
296
|
+
assertMaterializationHeader2({ commit, expected: NO_EXPECTATIONS });
|
|
297
|
+
if (opened && (commit.id !== opened.commitId || commit.committedAt !== opened.committedAt)) {
|
|
298
|
+
throw new MaterializationValidationError2("Replacement plan work must carry the commit its plan was opened with.");
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
var NO_EXPECTATIONS = { sources: [], objects: [], links: [], linkScopes: [], points: [] };
|
|
302
|
+
function prepareReplacementIdentities2(input, opened) {
|
|
303
|
+
assertReplacementPlanCommit2(input.commit, opened);
|
|
304
|
+
const header = { commit: input.commit, expected: NO_EXPECTATIONS };
|
|
305
|
+
const keys = new Set;
|
|
306
|
+
return input.planned.map((planned) => {
|
|
307
|
+
const prepared = prepareReplacementIdentity(planned, header);
|
|
308
|
+
if (keys.has(prepared.entityKey)) {
|
|
309
|
+
throw new MaterializationValidationError2(`Replacement identity ${prepared.entityKey} is staged twice.`);
|
|
310
|
+
}
|
|
311
|
+
keys.add(prepared.entityKey);
|
|
312
|
+
return prepared;
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
function prepareReplacementIdentity(planned, header) {
|
|
316
|
+
const { identity } = planned;
|
|
317
|
+
const identityKind = identity.kind;
|
|
318
|
+
const key = identity.kind === "object" ? objectRefKey2(identity.ref) : linkRefKey2(identity.ref);
|
|
319
|
+
const keys = new Set;
|
|
320
|
+
let classified = false;
|
|
321
|
+
let change = null;
|
|
322
|
+
for (const record of planned.records) {
|
|
323
|
+
assertWorkRecord2(record, header);
|
|
324
|
+
if (keys.has(record.recordKey)) {
|
|
325
|
+
throw new MaterializationConflictError2("effective-state", `Duplicate materialization work key '${record.recordKey}'.`);
|
|
326
|
+
}
|
|
327
|
+
keys.add(record.recordKey);
|
|
328
|
+
if (record.kind === "classification") {
|
|
329
|
+
if (record.entityKind !== identityKind || record.identityKey !== key) {
|
|
330
|
+
throw new MaterializationValidationError2("A replacement identity can only classify itself.");
|
|
331
|
+
}
|
|
332
|
+
classified = true;
|
|
333
|
+
}
|
|
334
|
+
if (record.kind !== "plan")
|
|
335
|
+
continue;
|
|
336
|
+
const { item } = record;
|
|
337
|
+
if (item.kind === "object-upsert" || item.kind === "link-upsert") {
|
|
338
|
+
change = item.value.expected.exists ? "updated" : "created";
|
|
339
|
+
} else if (item.kind === "object-delete" || item.kind === "link-delete") {
|
|
340
|
+
change = "deleted";
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return {
|
|
344
|
+
kind: identityKind,
|
|
345
|
+
key,
|
|
346
|
+
entityKey: projectionEntityKey2(identity),
|
|
347
|
+
records: planned.records,
|
|
348
|
+
classified,
|
|
349
|
+
change
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
function projectionChangeCounts(records) {
|
|
353
|
+
let objects = 0;
|
|
354
|
+
let links = 0;
|
|
355
|
+
const counts = {
|
|
356
|
+
objectsCreated: 0,
|
|
357
|
+
objectsUpdated: 0,
|
|
358
|
+
objectsDeleted: 0,
|
|
359
|
+
linksCreated: 0,
|
|
360
|
+
linksUpdated: 0,
|
|
361
|
+
linksDeleted: 0
|
|
362
|
+
};
|
|
363
|
+
for (const record of records) {
|
|
364
|
+
if (record.kind === "classification") {
|
|
365
|
+
if (record.entityKind === "object")
|
|
366
|
+
objects += 1;
|
|
367
|
+
if (record.entityKind === "link")
|
|
368
|
+
links += 1;
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
if (record.kind !== "plan")
|
|
372
|
+
continue;
|
|
373
|
+
const { item } = record;
|
|
374
|
+
if (item.kind === "object-upsert") {
|
|
375
|
+
if (item.value.expected.exists)
|
|
376
|
+
counts.objectsUpdated += 1;
|
|
377
|
+
else
|
|
378
|
+
counts.objectsCreated += 1;
|
|
379
|
+
} else if (item.kind === "object-delete")
|
|
380
|
+
counts.objectsDeleted += 1;
|
|
381
|
+
else if (item.kind === "link-upsert") {
|
|
382
|
+
if (item.value.expected.exists)
|
|
383
|
+
counts.linksUpdated += 1;
|
|
384
|
+
else
|
|
385
|
+
counts.linksCreated += 1;
|
|
386
|
+
} else if (item.kind === "link-delete")
|
|
387
|
+
counts.linksDeleted += 1;
|
|
388
|
+
}
|
|
389
|
+
return {
|
|
390
|
+
...counts,
|
|
391
|
+
objectsUnchanged: objects - counts.objectsCreated - counts.objectsUpdated - counts.objectsDeleted,
|
|
392
|
+
linksUnchanged: links - counts.linksCreated - counts.linksUpdated - counts.linksDeleted
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
function createCardinalityValidator2() {
|
|
396
|
+
let view = null;
|
|
397
|
+
let scope = null;
|
|
398
|
+
let occupant = null;
|
|
399
|
+
return {
|
|
400
|
+
accept(record) {
|
|
401
|
+
if (record.view !== view || record.scopeSortKey !== scope) {
|
|
402
|
+
view = record.view;
|
|
403
|
+
scope = record.scopeSortKey;
|
|
404
|
+
occupant = null;
|
|
405
|
+
}
|
|
406
|
+
if (!record.occupied)
|
|
407
|
+
return;
|
|
408
|
+
if (occupant !== null && occupant !== record.linkSortKey) {
|
|
409
|
+
throw cardinalityViolation2(record.view, record.ref.source.objectTypeId, record.ref.linkId);
|
|
410
|
+
}
|
|
411
|
+
occupant = record.linkSortKey;
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
function cardinalityViolation2(view, sourceTypeId, linkId) {
|
|
416
|
+
return new MaterializationValidationError2(view === "candidate" ? `Projection source scope '${sourceTypeId}.${linkId}' has cardinality one.` : `Link scope '${sourceTypeId}.${linkId}' has cardinality one.`);
|
|
140
417
|
}
|
|
141
418
|
function assertWorkRecord2(record, header) {
|
|
142
419
|
if (record.recordKey.trim().length === 0) {
|
|
@@ -150,7 +427,7 @@ function assertWorkRecord2(record, header) {
|
|
|
150
427
|
return;
|
|
151
428
|
}
|
|
152
429
|
if (record.kind === "event") {
|
|
153
|
-
if (!/^[0-9a-f]+$/.test(record.sortKey) || !Number.isSafeInteger(record.eventKindRank) || record.eventKindRank < 0 || record.eventKindRank !== materializationEventKindOrdinal2(record.draft.type)
|
|
430
|
+
if (!/^[0-9a-f]+$/.test(record.sortKey) || !Number.isSafeInteger(record.eventKindRank) || record.eventKindRank < 0 || record.eventKindRank !== materializationEventKindOrdinal2(record.draft.type)) {
|
|
154
431
|
throw new MaterializationValidationError2("Materialization event work is invalid.");
|
|
155
432
|
}
|
|
156
433
|
return;
|
|
@@ -182,9 +459,9 @@ function workUniquenessKey2(record) {
|
|
|
182
459
|
}
|
|
183
460
|
}
|
|
184
461
|
function comparePlanWork2(left, right) {
|
|
185
|
-
return left.applyPhase - right.applyPhase ||
|
|
462
|
+
return left.applyPhase - right.applyPhase || materializationPlanKindRank2(left.item.kind) - materializationPlanKindRank2(right.item.kind) || left.sortKey.localeCompare(right.sortKey) || left.recordKey.localeCompare(right.recordKey);
|
|
186
463
|
}
|
|
187
|
-
function
|
|
464
|
+
function materializationPlanKindRank2(kind) {
|
|
188
465
|
switch (kind) {
|
|
189
466
|
case "object-override-upsert":
|
|
190
467
|
return 0;
|
|
@@ -220,13 +497,7 @@ function compareEventWork2(left, right) {
|
|
|
220
497
|
return left.eventKindRank - right.eventKindRank || left.sortKey.localeCompare(right.sortKey) || left.recordKey.localeCompare(right.recordKey);
|
|
221
498
|
}
|
|
222
499
|
function planPhaseMatches(record) {
|
|
223
|
-
return record.applyPhase ===
|
|
224
|
-
}
|
|
225
|
-
function assertPlanChunkCorrelations2(chunk, commit) {
|
|
226
|
-
for (const item of materializationPlanItems2(chunk))
|
|
227
|
-
assertPlanItemCorrelation(item, commit);
|
|
228
|
-
for (const value of chunk.outbox)
|
|
229
|
-
assertOutboxCorrelation(value, commit);
|
|
500
|
+
return record.applyPhase === materializationApplyPhase2(record.item.kind);
|
|
230
501
|
}
|
|
231
502
|
function assertPlanItemCorrelation(item, commit) {
|
|
232
503
|
switch (item.kind) {
|
|
@@ -268,12 +539,6 @@ function assertPointWriteCorrelation(value, commit) {
|
|
|
268
539
|
invalidCorrelation2("Timeseries point last commit id does not match its session commit.");
|
|
269
540
|
}
|
|
270
541
|
}
|
|
271
|
-
function assertOutboxCorrelation(value, commit) {
|
|
272
|
-
const { envelope } = value;
|
|
273
|
-
if (envelope.projectId !== commit.projectId || envelope.commitId !== commit.id || envelope.occurredAt !== commit.committedAt || value.availableAt !== commit.committedAt || value.createdAt !== commit.committedAt || stableJsonStringify2(envelope.origin) !== stableJsonStringify2(commit.origin) || !sameAttribution(envelope, commit) || !Number.isSafeInteger(envelope.commitOrdinal) || envelope.commitOrdinal < 0 || envelope.id !== createEventId2(commit.projectId, commit.id, envelope.commitOrdinal)) {
|
|
274
|
-
invalidCorrelation2("Outbox event does not correlate with its materialization commit.");
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
542
|
function assertCommitWriteCorrelation(lastCommitId, updatedAt, commit, label) {
|
|
278
543
|
if (lastCommitId !== commit.id || updatedAt !== commit.committedAt) {
|
|
279
544
|
invalidCorrelation2(`${label} provenance does not match its session commit.`);
|
|
@@ -289,170 +554,10 @@ function assertLinkRefEqual(left, right, label) {
|
|
|
289
554
|
invalidCorrelation2(`${label} row and expected references differ.`);
|
|
290
555
|
}
|
|
291
556
|
}
|
|
292
|
-
function sameAttribution(event, commit) {
|
|
293
|
-
return stableJsonStringify2(event.requestedBy ?? null) === stableJsonStringify2(commit.requestedBy ?? null) && stableJsonStringify2(event.executor) === stableJsonStringify2(commit.executor);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
// src/storage/ontology/provider-header-validation.ts
|
|
297
|
-
function assertMaterializationHeader2({ commit }) {
|
|
298
|
-
assertCommitEnvelope(commit);
|
|
299
|
-
switch (commit.intent.kind) {
|
|
300
|
-
case "edit":
|
|
301
|
-
assertEditCommit(commit, commit.intent);
|
|
302
|
-
break;
|
|
303
|
-
case "projection":
|
|
304
|
-
assertProjectionCommit(commit, commit.intent);
|
|
305
|
-
break;
|
|
306
|
-
case "telemetry":
|
|
307
|
-
assertTelemetryCommit(commit, commit.intent);
|
|
308
|
-
break;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
function assertCommitEnvelope(commit) {
|
|
312
|
-
assertNonblank2(commit.projectId, "Materialization project id");
|
|
313
|
-
assertNonblank2(commit.id, "Materialization commit id");
|
|
314
|
-
assertNonblank2(commit.idempotencyKey, "Materialization idempotency key");
|
|
315
|
-
assertNonblank2(commit.requestHash, "Materialization request hash");
|
|
316
|
-
assertNonblank2(commit.executionId, "Materialization execution id");
|
|
317
|
-
assertNonblank2(commit.ontologyRevision, "Materialization ontology revision");
|
|
318
|
-
assertTimestamp2(commit.committedAt, "Materialization commit time");
|
|
319
|
-
assertCommitAttribution(commit);
|
|
320
|
-
}
|
|
321
|
-
function assertCommitAttribution(commit) {
|
|
322
|
-
const { requestedBy, executor } = commit;
|
|
323
|
-
if (requestedBy !== undefined) {
|
|
324
|
-
if (requestedBy.type !== "user" && requestedBy.type !== "serviceAccount") {
|
|
325
|
-
invalidCorrelation2("Materialization requester must be a user or service account.");
|
|
326
|
-
}
|
|
327
|
-
assertNonblank2(requestedBy.id, "Materialization requester id");
|
|
328
|
-
}
|
|
329
|
-
switch (executor?.type) {
|
|
330
|
-
case "request":
|
|
331
|
-
assertNonblank2(executor.requestId, "Materialization executor request id");
|
|
332
|
-
return;
|
|
333
|
-
case "primitive":
|
|
334
|
-
assertNonblank2(executor.kind, "Materialization executor primitive kind");
|
|
335
|
-
assertNonblank2(executor.id, "Materialization executor primitive id");
|
|
336
|
-
assertNonblank2(executor.runId, "Materialization executor run id");
|
|
337
|
-
return;
|
|
338
|
-
case "agent":
|
|
339
|
-
assertNonblank2(executor.runId, "Materialization executor Agent run id");
|
|
340
|
-
return;
|
|
341
|
-
case "kernel":
|
|
342
|
-
assertNonblank2(executor.operation?.type, "Materialization executor kernel operation");
|
|
343
|
-
return;
|
|
344
|
-
default:
|
|
345
|
-
invalidCorrelation2("Materialization executor is invalid.");
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
function assertPrimitiveExecutor(commit, kind, id, runId) {
|
|
349
|
-
const { executor } = commit;
|
|
350
|
-
if (executor.type !== "primitive" || executor.kind !== kind || executor.id !== id || executor.runId !== runId) {
|
|
351
|
-
invalidCorrelation2(`Commit ${kind} origin does not match its executor.`);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
function assertEditCommit(commit, intent) {
|
|
355
|
-
assertNonnegativeInteger2(intent.operationCount, "Edit commit operation count");
|
|
356
|
-
switch (commit.origin.kind) {
|
|
357
|
-
case "action":
|
|
358
|
-
assertNonblank2(commit.origin.actionId, "Action origin action id");
|
|
359
|
-
assertNonblank2(commit.origin.runId, "Action origin run id");
|
|
360
|
-
assertPrimitiveExecutor(commit, "action", commit.origin.actionId, commit.origin.runId);
|
|
361
|
-
return;
|
|
362
|
-
case "runtime":
|
|
363
|
-
assertNonblank2(commit.origin.requestId, "Runtime origin request id");
|
|
364
|
-
return;
|
|
365
|
-
default:
|
|
366
|
-
invalidCorrelation2("Edit commit origin does not correlate with its intent.");
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
function assertProjectionCommit(commit, intent) {
|
|
370
|
-
if (commit.origin.kind !== "projection") {
|
|
371
|
-
invalidCorrelation2("Projection commit origin does not correlate with its intent.");
|
|
372
|
-
}
|
|
373
|
-
assertProjectionSemanticMetadata(commit);
|
|
374
|
-
assertNonblank2(commit.origin.projectionRunId, "Projection run id");
|
|
375
|
-
assertTimestamp2(intent.datasetVersion.createdAt, "Projection dataset version createdAt");
|
|
376
|
-
if (commit.origin.projectionId !== intent.source.projectionId) {
|
|
377
|
-
invalidCorrelation2("Projection commit origin does not match its projection.");
|
|
378
|
-
}
|
|
379
|
-
if (commit.origin.datasetId !== intent.datasetVersion.datasetId || commit.origin.datasetVersionId !== intent.datasetVersion.versionId) {
|
|
380
|
-
invalidCorrelation2("Projection commit origin does not match its dataset version.");
|
|
381
|
-
}
|
|
382
|
-
assertPrimitiveExecutor(commit, "projection", commit.origin.projectionId, commit.origin.projectionRunId);
|
|
383
|
-
}
|
|
384
|
-
function assertTelemetryCommit(commit, intent) {
|
|
385
|
-
if (commit.origin.kind !== "telemetry") {
|
|
386
|
-
invalidCorrelation2("Telemetry commit origin does not correlate with its intent.");
|
|
387
|
-
}
|
|
388
|
-
assertTelemetryPointCounts(intent);
|
|
389
|
-
if (intent.source.kind === "runtime") {
|
|
390
|
-
assertRuntimeTelemetryCommit(commit);
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
393
|
-
assertProjectionTelemetryCommit(commit, intent.source, intent.inputPointCount);
|
|
394
|
-
}
|
|
395
|
-
function assertTelemetryPointCounts(intent) {
|
|
396
|
-
assertNonnegativeInteger2(intent.pointCount, "Telemetry commit point count");
|
|
397
|
-
assertNonnegativeInteger2(intent.inputPointCount, "Telemetry commit input point count");
|
|
398
|
-
if (intent.inputPointCount < intent.pointCount) {
|
|
399
|
-
invalidCorrelation2("Telemetry input point count cannot be lower than its canonical point count.");
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
function assertRuntimeTelemetryCommit(commit) {
|
|
403
|
-
if (commit.origin.kind !== "telemetry" || commit.origin.source.kind !== "runtime") {
|
|
404
|
-
invalidCorrelation2("Runtime telemetry origin does not correlate with its intent.");
|
|
405
|
-
}
|
|
406
|
-
if (commit.projectionRevision !== undefined || commit.ownershipHash !== undefined) {
|
|
407
|
-
invalidCorrelation2("Runtime telemetry commit contains projection-only metadata.");
|
|
408
|
-
}
|
|
409
|
-
assertNonblank2(commit.origin.source.requestId, "Runtime telemetry request id");
|
|
410
|
-
}
|
|
411
|
-
function assertProjectionTelemetryCommit(commit, source, inputPointCount) {
|
|
412
|
-
if (commit.origin.kind !== "telemetry" || commit.origin.source.kind !== "projection") {
|
|
413
|
-
invalidCorrelation2("Projection telemetry origin does not correlate with its intent.");
|
|
414
|
-
}
|
|
415
|
-
const origin = commit.origin.source;
|
|
416
|
-
assertProjectionSemanticMetadata(commit);
|
|
417
|
-
assertNonblank2(origin.projectionRunId, "Telemetry projection run id");
|
|
418
|
-
assertTimestamp2(source.datasetVersion.createdAt, "Telemetry dataset version createdAt");
|
|
419
|
-
assertProjectionTelemetryBatch(source, inputPointCount);
|
|
420
|
-
if (origin.projectionId !== source.projection.projectionId) {
|
|
421
|
-
invalidCorrelation2("Projection telemetry origin does not match its projection.");
|
|
422
|
-
}
|
|
423
|
-
if (origin.datasetId !== source.datasetVersion.datasetId || origin.datasetVersionId !== source.datasetVersion.versionId) {
|
|
424
|
-
invalidCorrelation2("Projection telemetry origin does not match its dataset version.");
|
|
425
|
-
}
|
|
426
|
-
if (origin.batchOrdinal !== source.batchOrdinal) {
|
|
427
|
-
invalidCorrelation2("Projection telemetry origin does not match its batch ordinal.");
|
|
428
|
-
}
|
|
429
|
-
assertPrimitiveExecutor(commit, "projection", origin.projectionId, origin.projectionRunId);
|
|
430
|
-
}
|
|
431
|
-
function assertProjectionTelemetryBatch(source, inputPointCount) {
|
|
432
|
-
assertNonnegativeInteger2(source.batchOrdinal, "Projection telemetry batch ordinal");
|
|
433
|
-
assertPositiveInteger2(source.sourceRowCount, "Projection telemetry source row count");
|
|
434
|
-
assertNonnegativeInteger2(source.sourceRowsSkipped, "Projection telemetry skipped row count");
|
|
435
|
-
if (source.sourceRowsSkipped > source.sourceRowCount) {
|
|
436
|
-
invalidCorrelation2("Projection telemetry skipped rows exceed its source row count.");
|
|
437
|
-
}
|
|
438
|
-
if (inputPointCount < source.sourceRowCount - source.sourceRowsSkipped) {
|
|
439
|
-
invalidCorrelation2("Projection telemetry input points do not account for every non-skipped source row.");
|
|
440
|
-
}
|
|
441
|
-
if (typeof source.inputExhausted !== "boolean") {
|
|
442
|
-
invalidCorrelation2("Projection telemetry input exhaustion marker is invalid.");
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
function assertProjectionSemanticMetadata(commit) {
|
|
446
|
-
if (commit.projectionRevision === undefined || commit.ownershipHash === undefined) {
|
|
447
|
-
invalidCorrelation2("Projection materialization is missing semantic identity metadata.");
|
|
448
|
-
}
|
|
449
|
-
assertNonblank2(commit.projectionRevision, "Projection revision");
|
|
450
|
-
assertNonblank2(commit.ownershipHash, "Projection ownership hash");
|
|
451
|
-
}
|
|
452
557
|
|
|
453
558
|
// src/storage/ontology/provider.ts
|
|
454
559
|
function startScopeAccumulator2(source, linkId) {
|
|
455
|
-
const hash =
|
|
560
|
+
const hash = createHash("sha256");
|
|
456
561
|
hash.update("[");
|
|
457
562
|
return {
|
|
458
563
|
source: structuredClone(source),
|
|
@@ -526,16 +631,11 @@ class ProviderMaterializationSessionState2 {
|
|
|
526
631
|
transactionId;
|
|
527
632
|
id = randomUUID();
|
|
528
633
|
providerToken = {};
|
|
529
|
-
workStreams = {
|
|
530
|
-
apply: { started: false, completed: false, emittedCount: 0 },
|
|
531
|
-
cardinality: { started: false, completed: false, emittedCount: 0 },
|
|
532
|
-
event: { started: false, completed: false, emittedCount: 0 }
|
|
533
|
-
};
|
|
534
634
|
active = true;
|
|
535
635
|
workSealed = false;
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
636
|
+
vectorChangesStreamed = false;
|
|
637
|
+
applied = false;
|
|
638
|
+
appliedEventCount = 0;
|
|
539
639
|
constructor(header, transactionId) {
|
|
540
640
|
this.header = header;
|
|
541
641
|
this.transactionId = transactionId;
|
|
@@ -544,6 +644,20 @@ class ProviderMaterializationSessionState2 {
|
|
|
544
644
|
return { providerToken: this.providerToken };
|
|
545
645
|
}
|
|
546
646
|
}
|
|
647
|
+
function beginMaterializationVectorChanges2(state) {
|
|
648
|
+
if (state.vectorChangesStreamed || state.applied) {
|
|
649
|
+
throw new MaterializationConflictError2("effective-state", "Materialization vector changes stream once per session, before the plan applies.");
|
|
650
|
+
}
|
|
651
|
+
state.vectorChangesStreamed = true;
|
|
652
|
+
state.workSealed = true;
|
|
653
|
+
}
|
|
654
|
+
function beginMaterializationApply2(state) {
|
|
655
|
+
if (state.applied) {
|
|
656
|
+
throw new MaterializationConflictError2("effective-state", "A materialization plan applies once per session.");
|
|
657
|
+
}
|
|
658
|
+
state.applied = true;
|
|
659
|
+
state.workSealed = true;
|
|
660
|
+
}
|
|
547
661
|
|
|
548
662
|
class ProviderMaterializationTransactionLifecycle2 {
|
|
549
663
|
openSessions = new Set;
|
|
@@ -568,8 +682,11 @@ class ProviderMaterializationTransactionLifecycle2 {
|
|
|
568
682
|
}
|
|
569
683
|
}
|
|
570
684
|
function prepareMaterializationWork2(state, input) {
|
|
685
|
+
if (state.header.plan) {
|
|
686
|
+
throw new MaterializationConflictError2("effective-state", "A plan-bound materialization session applies its plan and stages no work.");
|
|
687
|
+
}
|
|
571
688
|
if (state.workSealed) {
|
|
572
|
-
throw new MaterializationConflictError2("effective-state", "Materialization work cannot be staged
|
|
689
|
+
throw new MaterializationConflictError2("effective-state", "Materialization work cannot be staged once vector changes stream or the plan applies.");
|
|
573
690
|
}
|
|
574
691
|
const keys = new Set;
|
|
575
692
|
const uniqueKeys = new Set;
|
|
@@ -579,46 +696,21 @@ function prepareMaterializationWork2(state, input) {
|
|
|
579
696
|
if (keys.has(record.recordKey) || uniqueKeys.has(uniqueKey)) {
|
|
580
697
|
throw duplicateMaterializationWork2(record.recordKey);
|
|
581
698
|
}
|
|
582
|
-
if (record.kind === "incident-object"
|
|
583
|
-
throw new MaterializationConflictError2("effective-state", "
|
|
699
|
+
if (record.kind === "incident-object" || record.kind === "object-existence") {
|
|
700
|
+
throw new MaterializationConflictError2("effective-state", "Replacement work is staged on a replacement plan, not on a session.");
|
|
584
701
|
}
|
|
585
702
|
keys.add(record.recordKey);
|
|
586
703
|
uniqueKeys.add(uniqueKey);
|
|
587
704
|
return { record, uniqueKey, columns: materializationWorkColumns2(record) };
|
|
588
705
|
});
|
|
589
706
|
}
|
|
590
|
-
function correlateMaterializationChunk2(state, chunk, actualItems, expectedItems, expectedEvents) {
|
|
591
|
-
if (actualItems.length > 0 && (!state.workStreams.apply.started || state.appliedPlanCount + actualItems.length > state.workStreams.apply.emittedCount)) {
|
|
592
|
-
invalidMaterializationCorrelation("Materialization plan items cannot be applied before they are streamed.");
|
|
593
|
-
}
|
|
594
|
-
for (let index = 0;index < actualItems.length; index += 1) {
|
|
595
|
-
if (stableJsonStringify2(actualItems[index]) !== stableJsonStringify2(expectedItems[index])) {
|
|
596
|
-
invalidMaterializationCorrelation("Materialization plan items must be applied in exact streamed order.");
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
if (chunk.outbox.length > 0 && (!state.workStreams.event.started || state.appliedOutboxCount + chunk.outbox.length > state.workStreams.event.emittedCount)) {
|
|
600
|
-
invalidMaterializationCorrelation("Materialization events cannot be applied before they are streamed.");
|
|
601
|
-
}
|
|
602
|
-
for (let index = 0;index < chunk.outbox.length; index += 1) {
|
|
603
|
-
const expected = expectedEvents[index];
|
|
604
|
-
const actual = chunk.outbox[index]?.envelope;
|
|
605
|
-
if (!expected || !actual) {
|
|
606
|
-
invalidMaterializationCorrelation("Materialization outbox events must follow exact streamed order.");
|
|
607
|
-
}
|
|
608
|
-
const { id: _id, commitOrdinal, ...draft } = actual;
|
|
609
|
-
if (commitOrdinal !== state.appliedOutboxCount + index || stableJsonStringify2(draft) !== stableJsonStringify2(expected.draft)) {
|
|
610
|
-
invalidMaterializationCorrelation("Materialization outbox events must follow exact streamed order.");
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
return {
|
|
614
|
-
appliedPlanCount: state.appliedPlanCount + actualItems.length,
|
|
615
|
-
appliedOutboxCount: state.appliedOutboxCount + chunk.outbox.length
|
|
616
|
-
};
|
|
617
|
-
}
|
|
618
707
|
function assertMaterializationFinalizationCorrelation2(state, input) {
|
|
619
708
|
const { commit } = state.header;
|
|
620
709
|
const { result, sourceActivations } = input.finalization;
|
|
621
|
-
if (
|
|
710
|
+
if (!state.applied) {
|
|
711
|
+
invalidMaterializationCorrelation("A materialization plan must apply before it finalizes.");
|
|
712
|
+
}
|
|
713
|
+
if (result.commitId !== commit.id || result.kind !== commit.intent.kind || result.committedAt !== commit.committedAt || result.created !== true || !Number.isSafeInteger(result.eventCount) || result.eventCount < 0 || result.eventCount !== state.appliedEventCount) {
|
|
622
714
|
invalidMaterializationCorrelation("Materialization result does not correlate with its commit intent.");
|
|
623
715
|
}
|
|
624
716
|
if (commit.intent.kind === "edit") {
|
|
@@ -636,31 +728,13 @@ function assertMaterializationFinalizationCorrelation2(state, input) {
|
|
|
636
728
|
invalidMaterializationCorrelation("Telemetry result does not correlate with its point intent.");
|
|
637
729
|
}
|
|
638
730
|
}
|
|
639
|
-
function assertMaterializationLaneCompletion2(state, counts) {
|
|
640
|
-
if (counts.apply > 0 && !state.workStreams.apply.completed) {
|
|
641
|
-
invalidMaterializationCorrelation("Materialization plan work was not fully streamed.");
|
|
642
|
-
}
|
|
643
|
-
if (state.appliedPlanCount !== counts.apply) {
|
|
644
|
-
invalidMaterializationCorrelation("Materialization plan work was not applied exactly once.");
|
|
645
|
-
}
|
|
646
|
-
if (counts.cardinality > 0 && !state.workStreams.cardinality.completed) {
|
|
647
|
-
invalidMaterializationCorrelation("Materialization cardinality work was not fully validated.");
|
|
648
|
-
}
|
|
649
|
-
if (counts.event > 0 && !state.workStreams.event.completed) {
|
|
650
|
-
invalidMaterializationCorrelation("Materialization event work was not fully drained.");
|
|
651
|
-
}
|
|
652
|
-
if (counts.event !== state.appliedOutboxCount) {
|
|
653
|
-
invalidMaterializationCorrelation("Materialization event work was not fully written to the outbox.");
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
731
|
function assertSourceActivationCorrelation2(state, activation) {
|
|
657
732
|
const { commit } = state.header;
|
|
658
733
|
if (commit.intent.kind !== "projection" || commit.origin.kind !== "projection" || activation.source.projectionId !== commit.intent.source.projectionId || activation.source.projectionId !== commit.origin.projectionId || activation.execution.projectionRunId !== commit.origin.projectionRunId || activation.protocol !== "replacement" || stableJsonStringify2(activation.datasetVersion) !== stableJsonStringify2(commit.intent.datasetVersion) || activation.projectionRevision !== commit.projectionRevision || activation.ownershipHash !== commit.ownershipHash || activation.ontologyRevision !== commit.ontologyRevision || activation.lastCommitId !== commit.id || activation.updatedAt !== commit.committedAt || !state.header.expected.sources.some((expected) => stableJsonStringify2(expected) === stableJsonStringify2(activation.expected))) {
|
|
659
734
|
invalidMaterializationCorrelation("Source activation does not correlate with its projection commit.");
|
|
660
735
|
}
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
invalidMaterializationCorrelation("Source activation does not match fully streamed replacement state.");
|
|
736
|
+
if (!state.header.plan || state.header.plan.source.projectionId !== activation.source.projectionId || state.header.plan.materializationId !== activation.materializationId) {
|
|
737
|
+
invalidMaterializationCorrelation("Source activation does not match the replacement plan the session applies.");
|
|
664
738
|
}
|
|
665
739
|
}
|
|
666
740
|
function invalidMaterializationCorrelation(message) {
|
|
@@ -711,7 +785,7 @@ function materializationWorkColumns2(record) {
|
|
|
711
785
|
return {
|
|
712
786
|
lane: "apply",
|
|
713
787
|
majorOrder: record.applyPhase,
|
|
714
|
-
minorOrder:
|
|
788
|
+
minorOrder: materializationPlanKindRank2(record.item.kind),
|
|
715
789
|
sortOne: record.sortKey,
|
|
716
790
|
sortTwo: ""
|
|
717
791
|
};
|
|
@@ -736,32 +810,6 @@ function materializationWorkColumns2(record) {
|
|
|
736
810
|
}
|
|
737
811
|
return { lane: "none", majorOrder: 0, minorOrder: 0, sortOne: "", sortTwo: "" };
|
|
738
812
|
}
|
|
739
|
-
function materializationPlanKindRank(kind) {
|
|
740
|
-
switch (kind) {
|
|
741
|
-
case "object-override-upsert":
|
|
742
|
-
return 0;
|
|
743
|
-
case "object-override-delete":
|
|
744
|
-
return 1;
|
|
745
|
-
case "link-override-upsert":
|
|
746
|
-
return 2;
|
|
747
|
-
case "link-override-delete":
|
|
748
|
-
return 3;
|
|
749
|
-
case "link-slot-override-upsert":
|
|
750
|
-
return 4;
|
|
751
|
-
case "link-slot-override-delete":
|
|
752
|
-
return 5;
|
|
753
|
-
case "point-upsert":
|
|
754
|
-
return 6;
|
|
755
|
-
case "link-delete":
|
|
756
|
-
return 7;
|
|
757
|
-
case "object-delete":
|
|
758
|
-
return 8;
|
|
759
|
-
case "object-upsert":
|
|
760
|
-
return 9;
|
|
761
|
-
case "link-upsert":
|
|
762
|
-
return 10;
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
813
|
function duplicateMaterializationWork2(key) {
|
|
766
814
|
return new MaterializationConflictError2("effective-state", key === undefined ? "Duplicate materialization work." : `Duplicate materialization work key '${key}'.`);
|
|
767
815
|
}
|
|
@@ -1031,6 +1079,6 @@ function sourceConflict2(message) {
|
|
|
1031
1079
|
return new MaterializationConflictError2("source-materialization", message);
|
|
1032
1080
|
}
|
|
1033
1081
|
|
|
1034
|
-
export {
|
|
1082
|
+
export { assertNonblank2, assertPositiveInteger2, assertNonnegativeInteger2, assertTimestamp2, invalidCorrelation2, materializationApplyPhase2, assertMaterializationHeader2, assertPageRows2, materializationChunkRows2, materializationPlanChunk2, materializationOutboxWrite2, claimedOutboxRows2, assertReplacementPlanCommit2, prepareReplacementIdentities2, projectionChangeCounts, createCardinalityValidator2, cardinalityViolation2, assertWorkRecord2, workUniquenessKey2, comparePlanWork2, materializationPlanKindRank2, compareCardinalityWork2, compareEventWork2, startScopeAccumulator2, appendScopeSnapshot2, finishScopeAccumulator2, linkSlotOverrideValue2, ProviderMaterializationSessionState2, beginMaterializationVectorChanges2, beginMaterializationApply2, ProviderMaterializationTransactionLifecycle2, prepareMaterializationWork2, assertMaterializationFinalizationCorrelation2, assertSourceActivationCorrelation2, uniqueSorted2, sameNonnegativeCounts2, effectiveConflict2, assertExpectedObjectRevision2, assertExpectedLinkRevision2, assertExpectedLinkScopeRevision2, materializationWorkColumns2, duplicateMaterializationWork2, canonicalJson2, originColumns2, originWhere2, objectRefFromColumns2, linkRefFromColumns2, sourceEntityKey2, sourceStageRows2, sourceStageRow2, sourceStageRoots2, reconcileSourceStageRows2, sourceMaterializationIdentity2, assertSourceBeginInput2, assertSourceWriteIdentity2, assertSourceProject2, assertSourceExecutionIdentity2, assertSourceCandidateOwner2, assertSourceStagedRow2, sourceEntityColumns2, sourceEntityFromKey2, sourceAssertionPayload2, sourceAssertionFromColumns2, isExactStagingManifest2, sourceConflict2 };
|
|
1035
1083
|
|
|
1036
|
-
//# debugId=
|
|
1084
|
+
//# debugId=B570E8BCB142312B64756E2164756E21
|