@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
|
@@ -1,28 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
MaterializationConflictError,
|
|
3
|
+
MaterializationValidationError,
|
|
4
|
+
} from "../../materialization/errors"
|
|
5
|
+
import { eventAttribution, materializationEvent } from "../../materialization/event-envelopes"
|
|
6
|
+
import type {
|
|
7
|
+
OntologyMaterializationEventAttribution,
|
|
8
|
+
OntologyMaterializationEventCommit,
|
|
9
|
+
} from "../../materialization/events"
|
|
3
10
|
import { createEventId, materializationEventKindOrdinal } from "../../materialization/identity"
|
|
4
|
-
import type {
|
|
11
|
+
import type {
|
|
12
|
+
EffectiveChangeCounts,
|
|
13
|
+
OntologyLinkRef,
|
|
14
|
+
OntologyObjectRef,
|
|
15
|
+
} from "../../materialization/model"
|
|
5
16
|
import {
|
|
6
17
|
linkRefKey,
|
|
7
18
|
linkRefSortKey,
|
|
8
19
|
linkScopeSortKey,
|
|
9
20
|
objectRefKey,
|
|
21
|
+
projectionEntityKey,
|
|
10
22
|
telemetryPointKey,
|
|
11
23
|
} from "../../materialization/refs"
|
|
12
24
|
import type { OntologyCommitWrite } from "./commits"
|
|
13
25
|
import {
|
|
26
|
+
type ExactEffectiveLinkDelete,
|
|
27
|
+
type ExactEffectiveLinkWrite,
|
|
28
|
+
type ExactEffectiveObjectDelete,
|
|
29
|
+
type ExactEffectiveObjectWrite,
|
|
30
|
+
type ExactLinkOverrideDelete,
|
|
31
|
+
type ExactLinkOverrideWrite,
|
|
32
|
+
type ExactLinkSlotOverrideDelete,
|
|
33
|
+
type ExactLinkSlotOverrideWrite,
|
|
34
|
+
type ExactObjectOverrideDelete,
|
|
35
|
+
type ExactObjectOverrideWrite,
|
|
14
36
|
type ExactTimeseriesPointWrite,
|
|
15
37
|
type MaterializationCardinalityOccupantWorkRecord,
|
|
16
38
|
type MaterializationEventWorkRecord,
|
|
17
|
-
type MaterializationPlanChunk,
|
|
18
39
|
type MaterializationPlanHeader,
|
|
19
40
|
type MaterializationPlanWorkItem,
|
|
20
41
|
type MaterializationPlanWorkRecord,
|
|
21
42
|
type MaterializationWorkRecord,
|
|
22
43
|
materializationApplyPhase,
|
|
23
44
|
} from "./materializations"
|
|
24
|
-
import type {
|
|
45
|
+
import type { ClaimedOntologyOutboxRow, OntologyMaterializationEventDraft } from "./outbox"
|
|
46
|
+
import { assertMaterializationHeader } from "./provider-header-validation"
|
|
25
47
|
import { assertTimestamp, invalidCorrelation } from "./provider-validation"
|
|
48
|
+
import type { PlannedReplacementIdentity, StageReplacementPlanInput } from "./replacement-plans"
|
|
26
49
|
|
|
27
50
|
export { invalidCorrelation } from "./provider-validation"
|
|
28
51
|
|
|
@@ -48,40 +71,355 @@ export function materializationChunkRows(chunk: MaterializationPlanChunk): numbe
|
|
|
48
71
|
)
|
|
49
72
|
}
|
|
50
73
|
|
|
51
|
-
export
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
]
|
|
74
|
+
export interface ExactOverrideWrites {
|
|
75
|
+
readonly objects: {
|
|
76
|
+
readonly upserts: readonly ExactObjectOverrideWrite[]
|
|
77
|
+
readonly deletes: readonly ExactObjectOverrideDelete[]
|
|
78
|
+
}
|
|
79
|
+
readonly links: {
|
|
80
|
+
readonly edges: {
|
|
81
|
+
readonly upserts: readonly ExactLinkOverrideWrite[]
|
|
82
|
+
readonly deletes: readonly ExactLinkOverrideDelete[]
|
|
83
|
+
}
|
|
84
|
+
readonly slots: {
|
|
85
|
+
readonly upserts: readonly ExactLinkSlotOverrideWrite[]
|
|
86
|
+
readonly deletes: readonly ExactLinkSlotOverrideDelete[]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface ExactEffectiveWrites {
|
|
92
|
+
readonly objectUpserts: readonly ExactEffectiveObjectWrite[]
|
|
93
|
+
readonly objectDeletes: readonly ExactEffectiveObjectDelete[]
|
|
94
|
+
readonly linkUpserts: readonly ExactEffectiveLinkWrite[]
|
|
95
|
+
readonly linkDeletes: readonly ExactEffectiveLinkDelete[]
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface ExactTimeseriesWrites {
|
|
99
|
+
readonly pointUpserts: readonly ExactTimeseriesPointWrite[]
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Plan items and outbox writes of one bounded provider write, grouped by table. */
|
|
103
|
+
export interface MaterializationPlanChunk {
|
|
104
|
+
readonly overrides: ExactOverrideWrites
|
|
105
|
+
readonly effective: ExactEffectiveWrites
|
|
106
|
+
readonly timeseries: ExactTimeseriesWrites
|
|
107
|
+
readonly outbox: readonly OntologyOutboxWrite[]
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Groups staged plan items, already in apply order, and outbox writes into one provider write. */
|
|
111
|
+
export function materializationPlanChunk(
|
|
112
|
+
items: readonly MaterializationPlanWorkItem[],
|
|
113
|
+
outbox: readonly OntologyOutboxWrite[] = []
|
|
114
|
+
): MaterializationPlanChunk {
|
|
115
|
+
const chunk = {
|
|
116
|
+
overrides: {
|
|
117
|
+
objects: {
|
|
118
|
+
upserts: [] as ExactObjectOverrideWrite[],
|
|
119
|
+
deletes: [] as ExactObjectOverrideDelete[],
|
|
120
|
+
},
|
|
121
|
+
links: {
|
|
122
|
+
edges: {
|
|
123
|
+
upserts: [] as ExactLinkOverrideWrite[],
|
|
124
|
+
deletes: [] as ExactLinkOverrideDelete[],
|
|
125
|
+
},
|
|
126
|
+
slots: {
|
|
127
|
+
upserts: [] as ExactLinkSlotOverrideWrite[],
|
|
128
|
+
deletes: [] as ExactLinkSlotOverrideDelete[],
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
effective: {
|
|
133
|
+
objectUpserts: [] as ExactEffectiveObjectWrite[],
|
|
134
|
+
objectDeletes: [] as ExactEffectiveObjectDelete[],
|
|
135
|
+
linkUpserts: [] as ExactEffectiveLinkWrite[],
|
|
136
|
+
linkDeletes: [] as ExactEffectiveLinkDelete[],
|
|
137
|
+
},
|
|
138
|
+
timeseries: { pointUpserts: [] as ExactTimeseriesPointWrite[] },
|
|
139
|
+
outbox,
|
|
140
|
+
}
|
|
141
|
+
for (const item of items) {
|
|
142
|
+
switch (item.kind) {
|
|
143
|
+
case "object-override-upsert":
|
|
144
|
+
chunk.overrides.objects.upserts.push(item.value)
|
|
145
|
+
break
|
|
146
|
+
case "object-override-delete":
|
|
147
|
+
chunk.overrides.objects.deletes.push(item.value)
|
|
148
|
+
break
|
|
149
|
+
case "link-override-upsert":
|
|
150
|
+
chunk.overrides.links.edges.upserts.push(item.value)
|
|
151
|
+
break
|
|
152
|
+
case "link-override-delete":
|
|
153
|
+
chunk.overrides.links.edges.deletes.push(item.value)
|
|
154
|
+
break
|
|
155
|
+
case "link-slot-override-upsert":
|
|
156
|
+
chunk.overrides.links.slots.upserts.push(item.value)
|
|
157
|
+
break
|
|
158
|
+
case "link-slot-override-delete":
|
|
159
|
+
chunk.overrides.links.slots.deletes.push(item.value)
|
|
160
|
+
break
|
|
161
|
+
case "object-upsert":
|
|
162
|
+
chunk.effective.objectUpserts.push(item.value)
|
|
163
|
+
break
|
|
164
|
+
case "object-delete":
|
|
165
|
+
chunk.effective.objectDeletes.push(item.value)
|
|
166
|
+
break
|
|
167
|
+
case "link-upsert":
|
|
168
|
+
chunk.effective.linkUpserts.push(item.value)
|
|
169
|
+
break
|
|
170
|
+
case "link-delete":
|
|
171
|
+
chunk.effective.linkDeletes.push(item.value)
|
|
172
|
+
break
|
|
173
|
+
case "point-upsert":
|
|
174
|
+
chunk.timeseries.pointUpserts.push(item.value)
|
|
175
|
+
break
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return chunk
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* One outbox row: a staged event draft at its commit ordinal. The draft is all a provider stores
|
|
183
|
+
* of the event; the commit's own row holds the context every event of that commit shares.
|
|
184
|
+
*/
|
|
185
|
+
export interface OntologyOutboxWrite {
|
|
186
|
+
readonly id: string
|
|
187
|
+
readonly commitOrdinal: number
|
|
188
|
+
readonly event: OntologyMaterializationEventDraft
|
|
189
|
+
/** The commit time: an event is due, and ordered, from the moment its commit is. */
|
|
190
|
+
readonly createdAt: string
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** The outbox write of a staged event draft at its commit ordinal. */
|
|
194
|
+
export function materializationOutboxWrite(
|
|
195
|
+
commit: Pick<OntologyCommitWrite, "projectId" | "id" | "committedAt">,
|
|
196
|
+
event: OntologyMaterializationEventDraft,
|
|
197
|
+
commitOrdinal: number
|
|
198
|
+
): OntologyOutboxWrite {
|
|
199
|
+
return {
|
|
200
|
+
id: createEventId(commit.projectId, commit.id, commitOrdinal),
|
|
201
|
+
commitOrdinal,
|
|
202
|
+
event,
|
|
203
|
+
createdAt: commit.committedAt,
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** A claimed outbox row as a provider reads it back: its draft and its commit's id. */
|
|
208
|
+
export interface ClaimedOutboxDraft extends Omit<ClaimedOntologyOutboxRow, "envelope"> {
|
|
209
|
+
readonly id: string
|
|
210
|
+
readonly commitId: string
|
|
211
|
+
readonly commitOrdinal: number
|
|
212
|
+
readonly event: OntologyMaterializationEventDraft
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** The commit an event belongs to and the execution that commit ran under. */
|
|
216
|
+
export interface OutboxEventContext {
|
|
217
|
+
readonly commit: OntologyMaterializationEventCommit
|
|
218
|
+
readonly execution: Parameters<typeof eventAttribution>[0]
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Claimed rows with their events rebuilt from their commits and executions. Both outlive their
|
|
223
|
+
* events, so a missing one is corrupt storage, not a retryable state.
|
|
224
|
+
*/
|
|
225
|
+
export function claimedOutboxRows(
|
|
226
|
+
rows: readonly ClaimedOutboxDraft[],
|
|
227
|
+
contextOf: (commitId: string) => OutboxEventContext | undefined
|
|
228
|
+
): ClaimedOntologyOutboxRow[] {
|
|
229
|
+
const attributions = new Map<string, OntologyMaterializationEventAttribution>()
|
|
230
|
+
return rows.map(({ id, commitId, commitOrdinal, event, ...row }) => {
|
|
231
|
+
const context = contextOf(commitId)
|
|
232
|
+
if (!context) {
|
|
233
|
+
throw new Error(`[Sixb] Ontology outbox event '${id}' has no commit '${commitId}'.`)
|
|
234
|
+
}
|
|
235
|
+
let attribution = attributions.get(commitId)
|
|
236
|
+
if (!attribution) {
|
|
237
|
+
attribution = eventAttribution(context.execution)
|
|
238
|
+
attributions.set(commitId, attribution)
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
...row,
|
|
242
|
+
envelope: materializationEvent(event, { id, commitOrdinal }, context.commit, attribution),
|
|
243
|
+
}
|
|
244
|
+
})
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** One planned replacement identity, checked and summarized for a provider to store. */
|
|
248
|
+
export interface PreparedReplacementIdentity {
|
|
249
|
+
readonly kind: "object" | "link"
|
|
250
|
+
/** `objectRefKey` or `linkRefKey`, as classification records and provider tables key it. */
|
|
251
|
+
readonly key: string
|
|
252
|
+
readonly entityKey: string
|
|
253
|
+
readonly records: readonly MaterializationWorkRecord[]
|
|
254
|
+
readonly classified: boolean
|
|
255
|
+
/** The effective change its work makes, null when it makes none. */
|
|
256
|
+
readonly change: "created" | "updated" | "deleted" | null
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Validates the commit a replacement plan carries: once the plan is open, the very commit it was
|
|
261
|
+
* opened with, time included.
|
|
262
|
+
*/
|
|
263
|
+
export function assertReplacementPlanCommit(
|
|
264
|
+
commit: OntologyCommitWrite,
|
|
265
|
+
opened?: { readonly commitId: string; readonly committedAt: string }
|
|
266
|
+
): void {
|
|
267
|
+
assertMaterializationHeader({ commit, expected: NO_EXPECTATIONS })
|
|
268
|
+
if (opened && (commit.id !== opened.commitId || commit.committedAt !== opened.committedAt)) {
|
|
269
|
+
throw new MaterializationValidationError(
|
|
270
|
+
"Replacement plan work must carry the commit its plan was opened with."
|
|
271
|
+
)
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const NO_EXPECTATIONS = { sources: [], objects: [], links: [], linkScopes: [], points: [] }
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* The identities of one `stage` call, checked against the commit the plan was opened with. Each is
|
|
279
|
+
* planned once: one listed twice is rejected.
|
|
280
|
+
*/
|
|
281
|
+
export function prepareReplacementIdentities(
|
|
282
|
+
input: Pick<StageReplacementPlanInput, "commit" | "planned">,
|
|
283
|
+
opened: { readonly commitId: string; readonly committedAt: string }
|
|
284
|
+
): PreparedReplacementIdentity[] {
|
|
285
|
+
assertReplacementPlanCommit(input.commit, opened)
|
|
286
|
+
const header = { commit: input.commit, expected: NO_EXPECTATIONS }
|
|
287
|
+
const keys = new Set<string>()
|
|
288
|
+
return input.planned.map((planned) => {
|
|
289
|
+
const prepared = prepareReplacementIdentity(planned, header)
|
|
290
|
+
if (keys.has(prepared.entityKey)) {
|
|
291
|
+
throw new MaterializationValidationError(
|
|
292
|
+
`Replacement identity ${prepared.entityKey} is staged twice.`
|
|
293
|
+
)
|
|
294
|
+
}
|
|
295
|
+
keys.add(prepared.entityKey)
|
|
296
|
+
return prepared
|
|
297
|
+
})
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function prepareReplacementIdentity(
|
|
301
|
+
planned: PlannedReplacementIdentity,
|
|
302
|
+
header: MaterializationPlanHeader
|
|
303
|
+
): PreparedReplacementIdentity {
|
|
304
|
+
const { identity } = planned
|
|
305
|
+
const identityKind = identity.kind
|
|
306
|
+
const key = identity.kind === "object" ? objectRefKey(identity.ref) : linkRefKey(identity.ref)
|
|
307
|
+
const keys = new Set<string>()
|
|
308
|
+
let classified = false
|
|
309
|
+
let change: PreparedReplacementIdentity["change"] = null
|
|
310
|
+
for (const record of planned.records) {
|
|
311
|
+
assertWorkRecord(record, header)
|
|
312
|
+
if (keys.has(record.recordKey)) {
|
|
313
|
+
throw new MaterializationConflictError(
|
|
314
|
+
"effective-state",
|
|
315
|
+
`Duplicate materialization work key '${record.recordKey}'.`
|
|
316
|
+
)
|
|
317
|
+
}
|
|
318
|
+
keys.add(record.recordKey)
|
|
319
|
+
if (record.kind === "classification") {
|
|
320
|
+
// Coverage is checked on the identity, so its classification must be its own.
|
|
321
|
+
if (record.entityKind !== identityKind || record.identityKey !== key) {
|
|
322
|
+
throw new MaterializationValidationError("A replacement identity can only classify itself.")
|
|
323
|
+
}
|
|
324
|
+
classified = true
|
|
325
|
+
}
|
|
326
|
+
if (record.kind !== "plan") continue
|
|
327
|
+
const { item } = record
|
|
328
|
+
if (item.kind === "object-upsert" || item.kind === "link-upsert") {
|
|
329
|
+
change = item.value.expected.exists ? "updated" : "created"
|
|
330
|
+
} else if (item.kind === "object-delete" || item.kind === "link-delete") {
|
|
331
|
+
change = "deleted"
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return {
|
|
335
|
+
kind: identityKind,
|
|
336
|
+
key,
|
|
337
|
+
entityKey: projectionEntityKey(identity),
|
|
338
|
+
records: planned.records,
|
|
339
|
+
classified,
|
|
340
|
+
change,
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/** The change counts a replacement commit reports, derived from its planned work. */
|
|
345
|
+
export function projectionChangeCounts(
|
|
346
|
+
records: Iterable<MaterializationWorkRecord>
|
|
347
|
+
): EffectiveChangeCounts {
|
|
348
|
+
let objects = 0
|
|
349
|
+
let links = 0
|
|
350
|
+
const counts = {
|
|
351
|
+
objectsCreated: 0,
|
|
352
|
+
objectsUpdated: 0,
|
|
353
|
+
objectsDeleted: 0,
|
|
354
|
+
linksCreated: 0,
|
|
355
|
+
linksUpdated: 0,
|
|
356
|
+
linksDeleted: 0,
|
|
357
|
+
}
|
|
358
|
+
for (const record of records) {
|
|
359
|
+
if (record.kind === "classification") {
|
|
360
|
+
if (record.entityKind === "object") objects += 1
|
|
361
|
+
if (record.entityKind === "link") links += 1
|
|
362
|
+
continue
|
|
363
|
+
}
|
|
364
|
+
if (record.kind !== "plan") continue
|
|
365
|
+
const { item } = record
|
|
366
|
+
if (item.kind === "object-upsert") {
|
|
367
|
+
if (item.value.expected.exists) counts.objectsUpdated += 1
|
|
368
|
+
else counts.objectsCreated += 1
|
|
369
|
+
} else if (item.kind === "object-delete") counts.objectsDeleted += 1
|
|
370
|
+
else if (item.kind === "link-upsert") {
|
|
371
|
+
if (item.value.expected.exists) counts.linksUpdated += 1
|
|
372
|
+
else counts.linksCreated += 1
|
|
373
|
+
} else if (item.kind === "link-delete") counts.linksDeleted += 1
|
|
374
|
+
}
|
|
375
|
+
return {
|
|
376
|
+
...counts,
|
|
377
|
+
objectsUnchanged:
|
|
378
|
+
objects - counts.objectsCreated - counts.objectsUpdated - counts.objectsDeleted,
|
|
379
|
+
linksUnchanged: links - counts.linksCreated - counts.linksUpdated - counts.linksDeleted,
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export interface CardinalityValidator {
|
|
384
|
+
/** Accepts staged cardinality records in canonical order (`compareCardinalityWork`). */
|
|
385
|
+
accept(record: MaterializationCardinalityOccupantWorkRecord): void
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Rejects a cardinality-one scope with two occupants. The candidate view is the projection source
|
|
390
|
+
* alone; the effective view is the resolved scope after this commit.
|
|
391
|
+
*/
|
|
392
|
+
export function createCardinalityValidator(): CardinalityValidator {
|
|
393
|
+
let view: MaterializationCardinalityOccupantWorkRecord["view"] | null = null
|
|
394
|
+
let scope: string | null = null
|
|
395
|
+
let occupant: string | null = null
|
|
396
|
+
return {
|
|
397
|
+
accept(record) {
|
|
398
|
+
if (record.view !== view || record.scopeSortKey !== scope) {
|
|
399
|
+
view = record.view
|
|
400
|
+
scope = record.scopeSortKey
|
|
401
|
+
occupant = null
|
|
402
|
+
}
|
|
403
|
+
if (!record.occupied) return
|
|
404
|
+
if (occupant !== null && occupant !== record.linkSortKey) {
|
|
405
|
+
throw cardinalityViolation(record.view, record.ref.source.objectTypeId, record.ref.linkId)
|
|
406
|
+
}
|
|
407
|
+
occupant = record.linkSortKey
|
|
408
|
+
},
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/** The user-facing error for a cardinality-one scope with two occupants. */
|
|
413
|
+
export function cardinalityViolation(
|
|
414
|
+
view: MaterializationCardinalityOccupantWorkRecord["view"],
|
|
415
|
+
sourceTypeId: string,
|
|
416
|
+
linkId: string
|
|
417
|
+
): MaterializationValidationError {
|
|
418
|
+
return new MaterializationValidationError(
|
|
419
|
+
view === "candidate"
|
|
420
|
+
? `Projection source scope '${sourceTypeId}.${linkId}' has cardinality one.`
|
|
421
|
+
: `Link scope '${sourceTypeId}.${linkId}' has cardinality one.`
|
|
422
|
+
)
|
|
85
423
|
}
|
|
86
424
|
|
|
87
425
|
export function assertWorkRecord(
|
|
@@ -103,12 +441,7 @@ export function assertWorkRecord(
|
|
|
103
441
|
!/^[0-9a-f]+$/.test(record.sortKey) ||
|
|
104
442
|
!Number.isSafeInteger(record.eventKindRank) ||
|
|
105
443
|
record.eventKindRank < 0 ||
|
|
106
|
-
record.eventKindRank !== materializationEventKindOrdinal(record.draft.type)
|
|
107
|
-
record.draft.projectId !== header.commit.projectId ||
|
|
108
|
-
record.draft.commitId !== header.commit.id ||
|
|
109
|
-
record.draft.occurredAt !== header.commit.committedAt ||
|
|
110
|
-
stableJsonStringify(record.draft.origin) !== stableJsonStringify(header.commit.origin) ||
|
|
111
|
-
!sameAttribution(record.draft, header.commit)
|
|
444
|
+
record.eventKindRank !== materializationEventKindOrdinal(record.draft.type)
|
|
112
445
|
) {
|
|
113
446
|
throw new MaterializationValidationError("Materialization event work is invalid.")
|
|
114
447
|
}
|
|
@@ -153,13 +486,14 @@ export function comparePlanWork(
|
|
|
153
486
|
): number {
|
|
154
487
|
return (
|
|
155
488
|
left.applyPhase - right.applyPhase ||
|
|
156
|
-
|
|
489
|
+
materializationPlanKindRank(left.item.kind) - materializationPlanKindRank(right.item.kind) ||
|
|
157
490
|
left.sortKey.localeCompare(right.sortKey) ||
|
|
158
491
|
left.recordKey.localeCompare(right.recordKey)
|
|
159
492
|
)
|
|
160
493
|
}
|
|
161
494
|
|
|
162
|
-
|
|
495
|
+
/** Canonical order of plan item kinds within an apply phase; providers store it with the work. */
|
|
496
|
+
export function materializationPlanKindRank(kind: MaterializationPlanWorkItem["kind"]): number {
|
|
163
497
|
switch (kind) {
|
|
164
498
|
case "object-override-upsert":
|
|
165
499
|
return 0
|
|
@@ -219,16 +553,6 @@ function planPhaseMatches(record: MaterializationPlanWorkRecord): boolean {
|
|
|
219
553
|
return record.applyPhase === materializationApplyPhase(record.item.kind)
|
|
220
554
|
}
|
|
221
555
|
|
|
222
|
-
export function assertPlanChunkCorrelations(
|
|
223
|
-
chunk: MaterializationPlanChunk,
|
|
224
|
-
commit: MaterializationPlanHeader["commit"]
|
|
225
|
-
): void {
|
|
226
|
-
// Physical writes correlate through the same per-item rule the work stream validates, so the two
|
|
227
|
-
// paths stay in lockstep. Outbox writes are not plan items and keep their dedicated correlation.
|
|
228
|
-
for (const item of materializationPlanItems(chunk)) assertPlanItemCorrelation(item, commit)
|
|
229
|
-
for (const value of chunk.outbox) assertOutboxCorrelation(value, commit)
|
|
230
|
-
}
|
|
231
|
-
|
|
232
556
|
function assertPlanItemCorrelation(
|
|
233
557
|
item: MaterializationPlanWorkItem,
|
|
234
558
|
commit: MaterializationPlanHeader["commit"]
|
|
@@ -300,27 +624,6 @@ function assertPointWriteCorrelation(
|
|
|
300
624
|
}
|
|
301
625
|
}
|
|
302
626
|
|
|
303
|
-
function assertOutboxCorrelation(
|
|
304
|
-
value: OntologyOutboxWrite,
|
|
305
|
-
commit: MaterializationPlanHeader["commit"]
|
|
306
|
-
): void {
|
|
307
|
-
const { envelope } = value
|
|
308
|
-
if (
|
|
309
|
-
envelope.projectId !== commit.projectId ||
|
|
310
|
-
envelope.commitId !== commit.id ||
|
|
311
|
-
envelope.occurredAt !== commit.committedAt ||
|
|
312
|
-
value.availableAt !== commit.committedAt ||
|
|
313
|
-
value.createdAt !== commit.committedAt ||
|
|
314
|
-
stableJsonStringify(envelope.origin) !== stableJsonStringify(commit.origin) ||
|
|
315
|
-
!sameAttribution(envelope, commit) ||
|
|
316
|
-
!Number.isSafeInteger(envelope.commitOrdinal) ||
|
|
317
|
-
envelope.commitOrdinal < 0 ||
|
|
318
|
-
envelope.id !== createEventId(commit.projectId, commit.id, envelope.commitOrdinal)
|
|
319
|
-
) {
|
|
320
|
-
invalidCorrelation("Outbox event does not correlate with its materialization commit.")
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
627
|
function assertCommitWriteCorrelation(
|
|
325
628
|
lastCommitId: string,
|
|
326
629
|
updatedAt: string,
|
|
@@ -347,15 +650,3 @@ function assertLinkRefEqual(left: OntologyLinkRef, right: OntologyLinkRef, label
|
|
|
347
650
|
invalidCorrelation(`${label} row and expected references differ.`)
|
|
348
651
|
}
|
|
349
652
|
}
|
|
350
|
-
|
|
351
|
-
/** Events carry exactly the attribution of the commit that produced them. */
|
|
352
|
-
function sameAttribution(
|
|
353
|
-
event: Pick<OntologyCommitWrite, "requestedBy" | "executor">,
|
|
354
|
-
commit: Pick<OntologyCommitWrite, "requestedBy" | "executor">
|
|
355
|
-
): boolean {
|
|
356
|
-
return (
|
|
357
|
-
stableJsonStringify(event.requestedBy ?? null) ===
|
|
358
|
-
stableJsonStringify(commit.requestedBy ?? null) &&
|
|
359
|
-
stableJsonStringify(event.executor) === stableJsonStringify(commit.executor)
|
|
360
|
-
)
|
|
361
|
-
}
|