@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
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { createHash, randomBytes, randomUUID } from "node:crypto"
|
|
2
|
+
import type { FileDownloadGrantRecord, FileDownloadGrantStorage, Storage } from "../storage"
|
|
3
|
+
import { BlobStorageError } from "./errors"
|
|
4
|
+
import type { BlobStorage, FileRef } from "./types"
|
|
5
|
+
import { isFileRef } from "./validation"
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Download URLs let a third party that cannot hold a Sixb session — a social network fetching
|
|
9
|
+
* media to publish, for instance — read one file for a bounded time.
|
|
10
|
+
*
|
|
11
|
+
* Each URL carries a random token. Storage keeps only its SHA-256, with the file, the expiry, and
|
|
12
|
+
* the execution that issued it. The API looks the token up on every request, so any process
|
|
13
|
+
* sharing the storage can issue a URL, and a URL can be revoked before it expires.
|
|
14
|
+
*
|
|
15
|
+
* The API serves the bytes itself rather than redirecting to the blob provider: fetchers such as
|
|
16
|
+
* TikTok refuse redirects and accept only hosts whose ownership the developer verified.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** Path prefix of the public route that serves download URLs. */
|
|
20
|
+
export const FILE_DOWNLOAD_ROUTE_PREFIX = "/api/files/downloads/"
|
|
21
|
+
|
|
22
|
+
const DEFAULT_EXPIRY_MS = 60 * 60 * 1000
|
|
23
|
+
// SQLite compares ISO timestamps as text, which orders them correctly only for four-digit years.
|
|
24
|
+
const LATEST_EXPIRY_MS = Date.UTC(9999, 11, 31, 23, 59, 59, 999)
|
|
25
|
+
/** 32 random bytes in base64url. */
|
|
26
|
+
const TOKEN_PATTERN = /^[A-Za-z0-9_-]{43}$/
|
|
27
|
+
|
|
28
|
+
export interface CreateFileDownloadUrlOptions {
|
|
29
|
+
/** How long the URL stays valid. Defaults to one hour. */
|
|
30
|
+
readonly expiresInMs?: number
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface FileDownloadUrl {
|
|
34
|
+
/** Pass to `blobs.revokeDownloadUrl()` to stop the URL before it expires. */
|
|
35
|
+
readonly id: string
|
|
36
|
+
readonly url: string
|
|
37
|
+
readonly expiresAt: Date
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** What issuing and revoking need from the execution that asks. */
|
|
41
|
+
export interface FileDownloadUrlContext {
|
|
42
|
+
readonly projectId: string
|
|
43
|
+
readonly storage: Storage
|
|
44
|
+
readonly blobStorage: BlobStorage
|
|
45
|
+
readonly executionId: string
|
|
46
|
+
readonly apiPublicOrigin: string | undefined
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function createFileDownloadUrl(
|
|
50
|
+
context: FileDownloadUrlContext,
|
|
51
|
+
file: FileRef,
|
|
52
|
+
options: CreateFileDownloadUrlOptions = {}
|
|
53
|
+
): Promise<FileDownloadUrl> {
|
|
54
|
+
if (!isFileRef(file)) {
|
|
55
|
+
throw new Error("[Sixb] blobs.createDownloadUrl() requires a valid file reference.")
|
|
56
|
+
}
|
|
57
|
+
const createdAt = new Date()
|
|
58
|
+
const expiresAt = expiryFrom(createdAt, options.expiresInMs ?? DEFAULT_EXPIRY_MS)
|
|
59
|
+
const grants = requireGrantStorage(context.storage)
|
|
60
|
+
if (context.apiPublicOrigin === undefined) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
"[Sixb] blobs.createDownloadUrl() needs the API's public origin. Set SIXB_API_PUBLIC_ORIGIN for the API and every worker."
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
// Fail here, not when a third party fetches the URL minutes later and gets a bare 404.
|
|
66
|
+
const stat = await context.blobStorage.stat(file.blobId)
|
|
67
|
+
if (!stat || stat.digest !== file.digest || stat.sizeBytes !== file.sizeBytes) {
|
|
68
|
+
throw new BlobStorageError(`[Sixb] No stored blob matches file '${file.blobId}'.`)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const token = randomBytes(32).toString("base64url")
|
|
72
|
+
const { logicalPath: _logicalPath, ...served } = file
|
|
73
|
+
const grant: FileDownloadGrantRecord = {
|
|
74
|
+
id: `filedownload_${randomUUID()}`,
|
|
75
|
+
projectId: context.projectId,
|
|
76
|
+
tokenHash: hashToken(token),
|
|
77
|
+
file: served,
|
|
78
|
+
executionId: context.executionId,
|
|
79
|
+
createdAt,
|
|
80
|
+
expiresAt,
|
|
81
|
+
}
|
|
82
|
+
await grants.create(grant)
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
id: grant.id,
|
|
86
|
+
url: new URL(`${FILE_DOWNLOAD_ROUTE_PREFIX}${token}`, context.apiPublicOrigin).toString(),
|
|
87
|
+
expiresAt: grant.expiresAt,
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export async function revokeFileDownloadUrl(
|
|
92
|
+
context: FileDownloadUrlContext,
|
|
93
|
+
id: string
|
|
94
|
+
): Promise<void> {
|
|
95
|
+
const revoked = await requireGrantStorage(context.storage).revoke({
|
|
96
|
+
projectId: context.projectId,
|
|
97
|
+
id,
|
|
98
|
+
revokedAt: new Date(),
|
|
99
|
+
})
|
|
100
|
+
if (!revoked) {
|
|
101
|
+
throw new Error(`[Sixb] Download URL '${id}' does not exist.`)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** The file a token serves, or `null` when the token is unknown, expired, or revoked. */
|
|
106
|
+
export async function resolveFileDownload(
|
|
107
|
+
host: { readonly id: string; readonly storage: Storage },
|
|
108
|
+
token: string
|
|
109
|
+
): Promise<FileRef | null> {
|
|
110
|
+
const grants = host.storage.fileDownloadGrants
|
|
111
|
+
if (!grants || !TOKEN_PATTERN.test(token)) return null
|
|
112
|
+
|
|
113
|
+
const grant = await grants.findByTokenHash({ projectId: host.id, tokenHash: hashToken(token) })
|
|
114
|
+
if (!grant || grant.revokedAt || grant.expiresAt.getTime() <= Date.now()) return null
|
|
115
|
+
return grant.file
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function hashToken(token: string): string {
|
|
119
|
+
return createHash("sha256").update(token).digest("hex")
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function requireGrantStorage(storage: Storage): FileDownloadGrantStorage {
|
|
123
|
+
if (!storage.fileDownloadGrants) {
|
|
124
|
+
throw new Error("[Sixb] Download URLs require storage.fileDownloadGrants.")
|
|
125
|
+
}
|
|
126
|
+
return storage.fileDownloadGrants
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function expiryFrom(createdAt: Date, expiresInMs: number): Date {
|
|
130
|
+
if (!Number.isSafeInteger(expiresInMs) || expiresInMs <= 0) {
|
|
131
|
+
throw new Error("[Sixb] expiresInMs must be a positive integer.")
|
|
132
|
+
}
|
|
133
|
+
const expiresAt = createdAt.getTime() + expiresInMs
|
|
134
|
+
if (expiresAt > LATEST_EXPIRY_MS) {
|
|
135
|
+
throw new Error("[Sixb] expiresInMs must end before the year 10000.")
|
|
136
|
+
}
|
|
137
|
+
return new Date(expiresAt)
|
|
138
|
+
}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { assertProviderAccess } from "../authorization"
|
|
2
2
|
import type { ExecutionContext } from "../execution"
|
|
3
3
|
import type { SixbRuntimeContext } from "../runtime/types"
|
|
4
|
+
import {
|
|
5
|
+
type CreateFileDownloadUrlOptions,
|
|
6
|
+
createFileDownloadUrl,
|
|
7
|
+
type FileDownloadUrl,
|
|
8
|
+
type FileDownloadUrlContext,
|
|
9
|
+
revokeFileDownloadUrl,
|
|
10
|
+
} from "./download-urls"
|
|
4
11
|
import type {
|
|
5
12
|
AbortBlobUploadInput,
|
|
6
13
|
BlobByteRange,
|
|
@@ -21,6 +28,13 @@ export interface BlobsRuntime {
|
|
|
21
28
|
put(input: PutBlobInput): Promise<FileRef>
|
|
22
29
|
open(blobId: string): Promise<ReadableStream<Uint8Array>>
|
|
23
30
|
stat(blobId: string): Promise<BlobInfo | null>
|
|
31
|
+
/**
|
|
32
|
+
* A URL anyone can use to read this file until it expires or is revoked, for services that
|
|
33
|
+
* fetch media themselves. Requires the API's public origin (`SIXB_API_PUBLIC_ORIGIN`).
|
|
34
|
+
*/
|
|
35
|
+
createDownloadUrl(file: FileRef, options?: CreateFileDownloadUrlOptions): Promise<FileDownloadUrl>
|
|
36
|
+
/** Stop a URL from `createDownloadUrl()` before it expires. */
|
|
37
|
+
revokeDownloadUrl(id: string): Promise<void>
|
|
24
38
|
openRange?(blobId: string, range: BlobByteRange): Promise<ReadableStream<Uint8Array>>
|
|
25
39
|
createUpload?(input: CreateBlobUploadInput): Promise<BlobUploadSession>
|
|
26
40
|
signUploadPart?(input: SignBlobUploadPartInput): Promise<SignedBlobUploadPart>
|
|
@@ -31,9 +45,18 @@ export interface BlobsRuntime {
|
|
|
31
45
|
export function createBlobsRuntime(
|
|
32
46
|
runtime: SixbRuntimeContext,
|
|
33
47
|
execution: ExecutionContext,
|
|
34
|
-
blobStorage: BlobStorage
|
|
48
|
+
blobStorage: BlobStorage,
|
|
49
|
+
apiPublicOrigin: () => string | undefined
|
|
35
50
|
): BlobsRuntime {
|
|
36
51
|
const assertAccess = () => assertProviderAccess(runtime, execution, "blobs.access")
|
|
52
|
+
// Read the origin per call: the server or CLI may record it after this SDK was bound.
|
|
53
|
+
const downloadUrlContext = (): FileDownloadUrlContext => ({
|
|
54
|
+
projectId: runtime.projectId,
|
|
55
|
+
storage: runtime.storage,
|
|
56
|
+
blobStorage,
|
|
57
|
+
executionId: execution.id,
|
|
58
|
+
apiPublicOrigin: apiPublicOrigin(),
|
|
59
|
+
})
|
|
37
60
|
const executionBlobs: BlobsRuntime = {
|
|
38
61
|
put: (input) => {
|
|
39
62
|
assertAccess()
|
|
@@ -47,6 +70,14 @@ export function createBlobsRuntime(
|
|
|
47
70
|
assertAccess()
|
|
48
71
|
return blobStorage.stat(blobId)
|
|
49
72
|
},
|
|
73
|
+
createDownloadUrl: async (file, options) => {
|
|
74
|
+
assertAccess()
|
|
75
|
+
return createFileDownloadUrl(downloadUrlContext(), file, options)
|
|
76
|
+
},
|
|
77
|
+
revokeDownloadUrl: async (id) => {
|
|
78
|
+
assertAccess()
|
|
79
|
+
return revokeFileDownloadUrl(downloadUrlContext(), id)
|
|
80
|
+
},
|
|
50
81
|
}
|
|
51
82
|
|
|
52
83
|
if (supportsRangeRead(blobStorage)) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FILE_DOWNLOAD_ROUTE_PREFIX, resolveFileDownload } from "./download-urls"
|
|
@@ -2,7 +2,7 @@ import { assertNever } from "../assert-never"
|
|
|
2
2
|
import { assertAuthorized, isAllowed } from "../authorization"
|
|
3
3
|
import { AuthorizationError } from "../authorization/errors"
|
|
4
4
|
import type { AuthorizationContext } from "../authorization/types"
|
|
5
|
-
import type { EmbeddingModelCatalog } from "../models/catalog"
|
|
5
|
+
import type { EmbeddingModelCatalog, RerankingModelCatalog } from "../models/catalog"
|
|
6
6
|
import {
|
|
7
7
|
type AuthorizedOntologySelection,
|
|
8
8
|
type AuthorizedOntologyView,
|
|
@@ -87,6 +87,7 @@ class AuthorizedObjectReaderImpl {
|
|
|
87
87
|
readonly #runtime: RuntimeReadAuthorization
|
|
88
88
|
readonly #ontology: OntologyRegistry
|
|
89
89
|
readonly #embeddingModels?: EmbeddingModelCatalog
|
|
90
|
+
readonly #rerankingModels?: RerankingModelCatalog
|
|
90
91
|
#ontologyView?: AuthorizedOntologyView
|
|
91
92
|
readonly #storage: ObjectReadStorage
|
|
92
93
|
readonly #delegatedObjectTypeIds?: ReadonlySet<string>
|
|
@@ -99,6 +100,7 @@ class AuthorizedObjectReaderImpl {
|
|
|
99
100
|
readonly scope: ExecutionScope
|
|
100
101
|
readonly ontology: OntologyRegistry
|
|
101
102
|
readonly embeddingModels?: EmbeddingModelCatalog
|
|
103
|
+
readonly rerankingModels?: RerankingModelCatalog
|
|
102
104
|
readonly storage: ObjectReadStorage
|
|
103
105
|
readonly authority: ResolvedExecutionAuthority
|
|
104
106
|
}
|
|
@@ -111,6 +113,7 @@ class AuthorizedObjectReaderImpl {
|
|
|
111
113
|
this.#authority = input.authority
|
|
112
114
|
this.#ontology = input.ontology
|
|
113
115
|
this.#embeddingModels = input.embeddingModels
|
|
116
|
+
this.#rerankingModels = input.rerankingModels
|
|
114
117
|
this.#storage = input.storage
|
|
115
118
|
this.#delegatedObjectTypeIds =
|
|
116
119
|
input.authority.type === "delegated"
|
|
@@ -469,11 +472,13 @@ class AuthorizedObjectReaderImpl {
|
|
|
469
472
|
ontology: this.#ontology,
|
|
470
473
|
storage: this.#storage,
|
|
471
474
|
embeddingModels: this.#embeddingModels,
|
|
475
|
+
rerankingModels: this.#rerankingModels,
|
|
472
476
|
}
|
|
473
477
|
}
|
|
474
478
|
return {
|
|
475
479
|
ontology: this.#ontology,
|
|
476
480
|
embeddingModels: this.#embeddingModels,
|
|
481
|
+
rerankingModels: this.#rerankingModels,
|
|
477
482
|
storage: this.#storage,
|
|
478
483
|
runtimeAuthorization: this.#runtime.runtimeAuthorization,
|
|
479
484
|
...(this.#runtime.authorization === undefined
|
|
@@ -558,6 +563,7 @@ export function createAuthorizedObjectReader(input: {
|
|
|
558
563
|
readonly scope: ExecutionScope
|
|
559
564
|
readonly ontology: OntologyRegistry
|
|
560
565
|
readonly embeddingModels?: EmbeddingModelCatalog
|
|
566
|
+
readonly rerankingModels?: RerankingModelCatalog
|
|
561
567
|
readonly objectStorage: ObjectStorage
|
|
562
568
|
}): AuthorizedObjectReader {
|
|
563
569
|
const scope = captureExecutionScope(input.scope)
|
|
@@ -568,6 +574,7 @@ export function createAuthorizedObjectReader(input: {
|
|
|
568
574
|
scope,
|
|
569
575
|
ontology: input.ontology,
|
|
570
576
|
embeddingModels: input.embeddingModels,
|
|
577
|
+
rerankingModels: input.rerankingModels,
|
|
571
578
|
storage,
|
|
572
579
|
authority,
|
|
573
580
|
})
|
package/src/index.ts
CHANGED
|
@@ -21,10 +21,12 @@ export type {
|
|
|
21
21
|
ObjectLinkTargetMetadata,
|
|
22
22
|
ObjectLinkTargetType,
|
|
23
23
|
ObjectPropertiesMetadata,
|
|
24
|
+
ObjectQueryIndexDefinition,
|
|
24
25
|
ObjectRef,
|
|
25
26
|
ObjectRefSchema,
|
|
26
27
|
ObjectSchema,
|
|
27
28
|
ObjectType,
|
|
29
|
+
ObjectTypeQueryMetadata,
|
|
28
30
|
ObjectTypeSearchMetadata,
|
|
29
31
|
ObjectTypeWithPropertyTokens,
|
|
30
32
|
ObjectTypeWithTokens,
|
|
@@ -536,6 +538,7 @@ export type {
|
|
|
536
538
|
MigrationState,
|
|
537
539
|
MigrationStatus,
|
|
538
540
|
Storage,
|
|
541
|
+
StorageMigrationOptions,
|
|
539
542
|
StorageMigrationResult,
|
|
540
543
|
StorageMigrator,
|
|
541
544
|
StorageSchemaCheck,
|
|
@@ -886,6 +889,7 @@ export type {
|
|
|
886
889
|
AgentThreadsRuntime,
|
|
887
890
|
ExecutionAgentRunResult,
|
|
888
891
|
} from "./agents/execution"
|
|
892
|
+
export type { CreateFileDownloadUrlOptions, FileDownloadUrl } from "./blob-storage/download-urls"
|
|
889
893
|
export type { BlobsRuntime } from "./blob-storage/execution"
|
|
890
894
|
export type { ConnectorRuntime } from "./connectors/execution"
|
|
891
895
|
export type { DatasetIngestInput, DatasetIngestResult, DatasetsRuntime } from "./datasets/execution"
|
|
@@ -949,6 +953,7 @@ export type {
|
|
|
949
953
|
ObjectQueryFacetBucket,
|
|
950
954
|
ObjectQueryFacetInput,
|
|
951
955
|
ObjectQueryFacetResult,
|
|
956
|
+
ObjectQueryFacetsResult,
|
|
952
957
|
ObjectQueryListOptions,
|
|
953
958
|
ObjectQueryRow,
|
|
954
959
|
ObjectReadByIdHandle,
|
|
@@ -1120,6 +1125,15 @@ export type {
|
|
|
1120
1125
|
ModelReportedCost,
|
|
1121
1126
|
ModelRoute,
|
|
1122
1127
|
ModelUsage,
|
|
1128
|
+
RerankingModel,
|
|
1129
|
+
RerankingModelCatalog,
|
|
1130
|
+
RerankingModelDefinition,
|
|
1131
|
+
RerankingModelEntry,
|
|
1132
|
+
RerankingModelRef,
|
|
1133
|
+
RerankingModelRequest,
|
|
1134
|
+
RerankingModelResponseMetadata,
|
|
1135
|
+
RerankingModelResult,
|
|
1136
|
+
RerankingResult,
|
|
1123
1137
|
} from "./models"
|
|
1124
1138
|
export type {
|
|
1125
1139
|
InferLanguageModelOutput,
|
|
@@ -1142,6 +1156,12 @@ export type {
|
|
|
1142
1156
|
ActionParamDescriptor,
|
|
1143
1157
|
ActionPhaseDescriptor,
|
|
1144
1158
|
} from "./actions/descriptor"
|
|
1159
|
+
export type {
|
|
1160
|
+
AudioModelsRuntime,
|
|
1161
|
+
AudioTranscribeInput,
|
|
1162
|
+
AudioTranscribeResult,
|
|
1163
|
+
TranscriptionOutput,
|
|
1164
|
+
} from "./models/audio/types"
|
|
1145
1165
|
export type { DecisionAnswerSchema, DecisionOutputShape } from "./models/decision/output"
|
|
1146
1166
|
export { decisionOutput } from "./models/decision/output"
|
|
1147
1167
|
export { question } from "./models/decision/questions"
|
|
@@ -1183,3 +1203,8 @@ export {
|
|
|
1183
1203
|
isProjectionDefinition,
|
|
1184
1204
|
isTelemetryProjectionDefinition,
|
|
1185
1205
|
} from "./projections"
|
|
1206
|
+
export type {
|
|
1207
|
+
ObjectQueryPreparationPlan,
|
|
1208
|
+
ObjectQueryPreparationResult,
|
|
1209
|
+
} from "./storage/objects/query-preparation"
|
|
1210
|
+
export { prepareObjectQueries } from "./storage/objects/query-preparation"
|
|
@@ -29,6 +29,7 @@ import type {
|
|
|
29
29
|
CommitDatasetWriteInput,
|
|
30
30
|
DatasetCatalogState,
|
|
31
31
|
DatasetChanges,
|
|
32
|
+
DatasetLatestVersionSummary,
|
|
32
33
|
DatasetRow,
|
|
33
34
|
DatasetRowChange,
|
|
34
35
|
DatasetVersion,
|
|
@@ -36,6 +37,8 @@ import type {
|
|
|
36
37
|
DatasetWriteMode,
|
|
37
38
|
LakeStorage,
|
|
38
39
|
LakeWriteSession,
|
|
40
|
+
LatestVersionsSince,
|
|
41
|
+
ListLatestVersionsSinceInput,
|
|
39
42
|
ReadDatasetChangesInput,
|
|
40
43
|
ReadDatasetRowsInput,
|
|
41
44
|
} from "./types"
|
|
@@ -52,6 +55,16 @@ function cloneDatasetVersion(version: DatasetVersion): DatasetVersion {
|
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
57
|
|
|
58
|
+
function latestVersionSummary(version: DatasetVersion): DatasetLatestVersionSummary {
|
|
59
|
+
return {
|
|
60
|
+
datasetId: version.datasetId,
|
|
61
|
+
versionId: version.versionId,
|
|
62
|
+
mode: version.mode,
|
|
63
|
+
createdAt: version.createdAt,
|
|
64
|
+
...(version.rowCount !== undefined ? { rowCount: version.rowCount } : {}),
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
55
68
|
function cloneRow(row: DatasetRow): DatasetRow {
|
|
56
69
|
return structuredClone(row)
|
|
57
70
|
}
|
|
@@ -223,6 +236,9 @@ export class InMemoryLakeStorage implements LakeStorage {
|
|
|
223
236
|
private readonly sequencesByVersionId = new Map<string, Map<string, DatasetSequenceState>>()
|
|
224
237
|
private readonly latestVersionIdByDataset = new Map<string, string>()
|
|
225
238
|
private readonly commitLocks = new Map<string, Promise<void>>()
|
|
239
|
+
/** Commit counter for listLatestVersionsSince; each dataset keeps the position of its latest. */
|
|
240
|
+
private commitPosition = 0
|
|
241
|
+
private readonly commitPositionByDataset = new Map<string, number>()
|
|
226
242
|
|
|
227
243
|
async createDataset(definition: DatasetDefinition): Promise<DatasetDefinition> {
|
|
228
244
|
assertDatasetId(definition.id)
|
|
@@ -287,15 +303,7 @@ export class InMemoryLakeStorage implements LakeStorage {
|
|
|
287
303
|
return {
|
|
288
304
|
datasetId,
|
|
289
305
|
materialized: true,
|
|
290
|
-
latestVersion: latest
|
|
291
|
-
? {
|
|
292
|
-
datasetId: latest.datasetId,
|
|
293
|
-
versionId: latest.versionId,
|
|
294
|
-
mode: latest.mode,
|
|
295
|
-
createdAt: latest.createdAt,
|
|
296
|
-
...(latest.rowCount !== undefined ? { rowCount: latest.rowCount } : {}),
|
|
297
|
-
}
|
|
298
|
-
: null,
|
|
306
|
+
latestVersion: latest ? latestVersionSummary(latest) : null,
|
|
299
307
|
}
|
|
300
308
|
})
|
|
301
309
|
)
|
|
@@ -362,6 +370,25 @@ export class InMemoryLakeStorage implements LakeStorage {
|
|
|
362
370
|
return this.getVersion(datasetId, latestVersionId)
|
|
363
371
|
}
|
|
364
372
|
|
|
373
|
+
async listLatestVersionsSince(
|
|
374
|
+
input: ListLatestVersionsSinceInput
|
|
375
|
+
): Promise<LatestVersionsSince | null> {
|
|
376
|
+
const cursor = String(this.commitPosition)
|
|
377
|
+
if (input.cursor === null) return { cursor, versions: [] }
|
|
378
|
+
if (!/^\d+$/.test(input.cursor) || Number(input.cursor) > this.commitPosition) return null
|
|
379
|
+
|
|
380
|
+
const after = Number(input.cursor)
|
|
381
|
+
const datasetIds = input.datasetIds ? new Set(input.datasetIds) : null
|
|
382
|
+
const versions: DatasetLatestVersionSummary[] = []
|
|
383
|
+
for (const [datasetId, position] of this.commitPositionByDataset) {
|
|
384
|
+
if (position <= after || (datasetIds && !datasetIds.has(datasetId))) continue
|
|
385
|
+
// This provider never commits schema-only versions, so the latest version carries data.
|
|
386
|
+
const latest = await this.getLatestVersion(datasetId)
|
|
387
|
+
if (latest) versions.push(latestVersionSummary(latest))
|
|
388
|
+
}
|
|
389
|
+
return { cursor, versions }
|
|
390
|
+
}
|
|
391
|
+
|
|
365
392
|
async getVersion(datasetId: string, versionId: string): Promise<DatasetVersion | null> {
|
|
366
393
|
const versions = this.versionsByDataset.get(datasetId) ?? []
|
|
367
394
|
const version = versions.find((candidate) => candidate.versionId === versionId)
|
|
@@ -564,6 +591,7 @@ export class InMemoryLakeStorage implements LakeStorage {
|
|
|
564
591
|
visibleRows.map((row) => cloneRow(row))
|
|
565
592
|
)
|
|
566
593
|
this.latestVersionIdByDataset.set(options.merge.dataset.id, versionId)
|
|
594
|
+
this.commitPositionByDataset.set(options.merge.dataset.id, ++this.commitPosition)
|
|
567
595
|
if (ordered) this.sequencesByVersionId.set(versionId, ordered.states)
|
|
568
596
|
|
|
569
597
|
return { outcome: "created", version: cloneDatasetVersion(version) }
|
|
@@ -636,6 +664,7 @@ export class InMemoryLakeStorage implements LakeStorage {
|
|
|
636
664
|
visibleRows.map((row) => cloneRow(row))
|
|
637
665
|
)
|
|
638
666
|
this.latestVersionIdByDataset.set(options.write.dataset.id, versionId)
|
|
667
|
+
this.commitPositionByDataset.set(options.write.dataset.id, ++this.commitPosition)
|
|
639
668
|
|
|
640
669
|
return { ...cloneDatasetVersion(version), outcome: "created" }
|
|
641
670
|
}
|
|
@@ -53,6 +53,24 @@ export interface DatasetCatalogState {
|
|
|
53
53
|
readonly latestVersion?: DatasetLatestVersionSummary | null
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
export interface ListLatestVersionsSinceInput {
|
|
57
|
+
/** A cursor returned by an earlier call, or null to start at the lake's current position. */
|
|
58
|
+
readonly cursor: string | null
|
|
59
|
+
/** Report only these datasets. Omit to report every dataset. */
|
|
60
|
+
readonly datasetIds?: readonly string[]
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface LatestVersionsSince {
|
|
64
|
+
/** Opaque position to pass to the next call. */
|
|
65
|
+
readonly cursor: string
|
|
66
|
+
/**
|
|
67
|
+
* The newest data-bearing (non-`schema`) version of each dataset that committed one after the
|
|
68
|
+
* input cursor and up to the returned one, in no particular order. A provider may stop short of
|
|
69
|
+
* its newest commit to bound one call; the next call continues. Empty for a null input cursor.
|
|
70
|
+
*/
|
|
71
|
+
readonly versions: readonly DatasetLatestVersionSummary[]
|
|
72
|
+
}
|
|
73
|
+
|
|
56
74
|
export interface BeginDatasetWriteInput {
|
|
57
75
|
readonly dataset: DatasetDefinition
|
|
58
76
|
readonly mode?: DatasetWriteMode
|
|
@@ -170,6 +188,18 @@ export interface LakeStorage {
|
|
|
170
188
|
|
|
171
189
|
getLatestVersion(datasetId: string): Promise<DatasetVersion | null>
|
|
172
190
|
getVersion(datasetId: string, versionId: string): Promise<DatasetVersion | null>
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Change feed: which datasets committed data since a cursor. Consumers that must not miss a
|
|
194
|
+
* commit, such as projection reconciliation, poll it instead of reading every dataset's latest
|
|
195
|
+
* version. Its cost must not grow with the lake's history: an idle read should be about as
|
|
196
|
+
* cheap as one metadata lookup.
|
|
197
|
+
*
|
|
198
|
+
* Null means the cursor is no longer a position in this lake (for example, the catalog was
|
|
199
|
+
* recreated or the cursor's commit expired): read current state, then restart from null.
|
|
200
|
+
*/
|
|
201
|
+
listLatestVersionsSince(input: ListLatestVersionsSinceInput): Promise<LatestVersionsSince | null>
|
|
202
|
+
|
|
173
203
|
/** Explicit immutable-version reads have stable physical order and stable offset semantics. */
|
|
174
204
|
readRows(input: ReadDatasetRowsInput): AsyncIterable<DatasetRow>
|
|
175
205
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type BlobStorage, supportsDirectUpload } from "../blob-storage"
|
|
2
2
|
import type { OntologyOutboxDispatcher } from "../events"
|
|
3
|
+
import type { VectorIndexingDispatcher } from "../objects/vectors/indexing-dispatch"
|
|
3
4
|
import {
|
|
4
5
|
type FileUploadSession,
|
|
5
6
|
FileUploadSessionError,
|
|
@@ -27,11 +28,15 @@ const ABANDONED_UPLOAD_ABORT_GRACE_MS = 15 * 60_000
|
|
|
27
28
|
// One abandoned candidate of a large projection holds hundreds of thousands of rows. Batches this
|
|
28
29
|
// size keep each delete short while clearing such a candidate within a pass.
|
|
29
30
|
const ABANDONED_SOURCE_PURGE_BATCH = 50_000
|
|
31
|
+
// An expired download URL serves nothing, but its grant records which execution exposed which
|
|
32
|
+
// file. It stays this long for that audit trail.
|
|
33
|
+
const EXPIRED_FILE_DOWNLOAD_RETENTION_MS = 7 * 24 * 60 * 60_000
|
|
30
34
|
|
|
31
35
|
interface OntologyMaintenanceDependencies {
|
|
32
36
|
readonly projectId: string
|
|
33
37
|
readonly storage: Storage
|
|
34
38
|
readonly dispatcher: OntologyOutboxDispatcher
|
|
39
|
+
readonly vectorIndexing?: VectorIndexingDispatcher
|
|
35
40
|
/** Aborts the provider side of abandoned staged uploads. */
|
|
36
41
|
readonly blobStorage?: BlobStorage
|
|
37
42
|
readonly options?: OntologyMaintenanceOptions
|
|
@@ -44,6 +49,7 @@ export class OntologyMaintenance {
|
|
|
44
49
|
private readonly projectId: string
|
|
45
50
|
private readonly storage: Storage
|
|
46
51
|
private readonly dispatcher: OntologyOutboxDispatcher
|
|
52
|
+
private readonly vectorIndexing: VectorIndexingDispatcher | undefined
|
|
47
53
|
private readonly blobStorage: BlobStorage | undefined
|
|
48
54
|
private readonly intervalMs: number
|
|
49
55
|
private readonly publishedOutboxRetentionMs: number
|
|
@@ -64,6 +70,7 @@ export class OntologyMaintenance {
|
|
|
64
70
|
this.projectId = dependencies.projectId
|
|
65
71
|
this.storage = dependencies.storage
|
|
66
72
|
this.dispatcher = dependencies.dispatcher
|
|
73
|
+
this.vectorIndexing = dependencies.vectorIndexing
|
|
67
74
|
this.blobStorage = dependencies.blobStorage
|
|
68
75
|
this.intervalMs = positiveInteger(options.intervalMs ?? DEFAULT_INTERVAL_MS, "intervalMs")
|
|
69
76
|
this.publishedOutboxRetentionMs = nonnegativeInteger(
|
|
@@ -158,9 +165,15 @@ export class OntologyMaintenance {
|
|
|
158
165
|
|
|
159
166
|
const failures: unknown[] = []
|
|
160
167
|
await captureFailure(() => this.dispatcher.drain(), failures)
|
|
168
|
+
const vectorIndexing = this.vectorIndexing
|
|
169
|
+
if (vectorIndexing) await captureFailure(() => vectorIndexing.drain(), failures)
|
|
161
170
|
const cleanup = await this.cleanupExpiredRows(started, failures)
|
|
162
|
-
const
|
|
163
|
-
|
|
171
|
+
const outbox = await captureFailure(
|
|
172
|
+
() => this.storage.ontology.outbox.summarize({ projectId: this.projectId }),
|
|
173
|
+
failures,
|
|
174
|
+
this.snapshot.outbox
|
|
175
|
+
)
|
|
176
|
+
this.completePass({ started, failures, cleanup, outbox })
|
|
164
177
|
}
|
|
165
178
|
|
|
166
179
|
private async cleanupExpiredRows(
|
|
@@ -179,6 +192,8 @@ export class OntologyMaintenance {
|
|
|
179
192
|
failures,
|
|
180
193
|
0
|
|
181
194
|
)
|
|
195
|
+
// Plans go first: a source version is cleaned only once its plan is gone.
|
|
196
|
+
const spentPlanRows = await captureFailure(() => this.purgeSpentPlans(started), failures, 0)
|
|
182
197
|
const terminalSources = await captureFailure(
|
|
183
198
|
() =>
|
|
184
199
|
this.storage.ontology.sources.cleanupTerminal({
|
|
@@ -202,10 +217,24 @@ export class OntologyMaintenance {
|
|
|
202
217
|
await captureFailure(() => this.retireAbandonedUploads(uploads, started, failures), failures)
|
|
203
218
|
await captureFailure(() => uploads.cleanupExpired(started), failures, 0)
|
|
204
219
|
}
|
|
220
|
+
const downloads = this.storage.fileDownloadGrants
|
|
221
|
+
if (downloads) {
|
|
222
|
+
await captureFailure(
|
|
223
|
+
() =>
|
|
224
|
+
downloads.deleteExpired({
|
|
225
|
+
projectId: this.projectId,
|
|
226
|
+
expiredBefore: new Date(started.getTime() - EXPIRED_FILE_DOWNLOAD_RETENTION_MS),
|
|
227
|
+
limit: this.cleanupLimit,
|
|
228
|
+
}),
|
|
229
|
+
failures,
|
|
230
|
+
0
|
|
231
|
+
)
|
|
232
|
+
}
|
|
205
233
|
|
|
206
234
|
return {
|
|
207
235
|
publishedOutboxRowsDeleted,
|
|
208
|
-
terminalSourceRowsDeleted:
|
|
236
|
+
terminalSourceRowsDeleted:
|
|
237
|
+
terminalSources.rowsDeleted + abandonedSources.rowsDeleted + spentPlanRows,
|
|
209
238
|
terminalSourceMaterializationsDeleted:
|
|
210
239
|
terminalSources.materializationsDeleted + abandonedSources.materializationsDeleted,
|
|
211
240
|
}
|
|
@@ -232,6 +261,24 @@ export class OntologyMaintenance {
|
|
|
232
261
|
}
|
|
233
262
|
}
|
|
234
263
|
|
|
264
|
+
/** Deletes the plans of candidates that left `ready`, batch after batch, like candidates. */
|
|
265
|
+
private async purgeSpentPlans(started: Date): Promise<number> {
|
|
266
|
+
let rowsDeleted = 0
|
|
267
|
+
while (true) {
|
|
268
|
+
const purged = await this.storage.ontology.replacementPlans.purge({
|
|
269
|
+
projectId: this.projectId,
|
|
270
|
+
limit: ABANDONED_SOURCE_PURGE_BATCH,
|
|
271
|
+
})
|
|
272
|
+
rowsDeleted += purged
|
|
273
|
+
if (
|
|
274
|
+
purged < ABANDONED_SOURCE_PURGE_BATCH ||
|
|
275
|
+
this.now().getTime() - started.getTime() >= this.intervalMs
|
|
276
|
+
) {
|
|
277
|
+
return rowsDeleted
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
235
282
|
private async retireAbandonedUploads(
|
|
236
283
|
uploads: FileUploadSessionStore,
|
|
237
284
|
now: Date,
|
|
@@ -288,29 +335,11 @@ export class OntologyMaintenance {
|
|
|
288
335
|
if (abortFailure !== undefined) throw abortFailure
|
|
289
336
|
}
|
|
290
337
|
|
|
291
|
-
private async readOperationalSummaries(failures: unknown[]): Promise<{
|
|
292
|
-
readonly outbox: OntologyMaintenanceSnapshot["outbox"]
|
|
293
|
-
readonly terminalSources: OntologyMaintenanceSnapshot["terminalSources"]
|
|
294
|
-
}> {
|
|
295
|
-
const outbox = await captureFailure(
|
|
296
|
-
() => this.storage.ontology.outbox.summarize({ projectId: this.projectId }),
|
|
297
|
-
failures,
|
|
298
|
-
this.snapshot.outbox
|
|
299
|
-
)
|
|
300
|
-
const terminalSummary = await captureFailure(
|
|
301
|
-
() => this.storage.ontology.sources.summarizeTerminal({ projectId: this.projectId }),
|
|
302
|
-
failures,
|
|
303
|
-
this.snapshot.terminalSources
|
|
304
|
-
)
|
|
305
|
-
return { outbox, terminalSources: terminalSummary }
|
|
306
|
-
}
|
|
307
|
-
|
|
308
338
|
private completePass(input: {
|
|
309
339
|
readonly started: Date
|
|
310
340
|
readonly failures: readonly unknown[]
|
|
311
341
|
readonly cleanup: OntologyMaintenanceCleanupSnapshot
|
|
312
342
|
readonly outbox: OntologyMaintenanceSnapshot["outbox"]
|
|
313
|
-
readonly terminalSources: OntologyMaintenanceSnapshot["terminalSources"]
|
|
314
343
|
}): void {
|
|
315
344
|
const completed = this.now()
|
|
316
345
|
const failure =
|
|
@@ -326,7 +355,6 @@ export class OntologyMaintenance {
|
|
|
326
355
|
consecutiveFailures: failure ? this.snapshot.consecutiveFailures + 1 : 0,
|
|
327
356
|
lastError: failure ? errorMessage(failure) : null,
|
|
328
357
|
outbox: input.outbox,
|
|
329
|
-
terminalSources: input.terminalSources,
|
|
330
358
|
cleanup: input.cleanup,
|
|
331
359
|
}
|
|
332
360
|
if (failure) this.reportError(failure)
|
|
@@ -386,7 +414,6 @@ function emptySnapshot(intervalMs: number): OntologyMaintenanceSnapshot {
|
|
|
386
414
|
consecutiveFailures: 0,
|
|
387
415
|
lastError: null,
|
|
388
416
|
outbox: null,
|
|
389
|
-
terminalSources: null,
|
|
390
417
|
cleanup: null,
|
|
391
418
|
}
|
|
392
419
|
}
|
package/src/maintenance/types.ts
CHANGED
|
@@ -19,6 +19,7 @@ export interface OntologyMaintenanceOptions {
|
|
|
19
19
|
|
|
20
20
|
export interface OntologyMaintenanceCleanupSnapshot {
|
|
21
21
|
readonly publishedOutboxRowsDeleted: number
|
|
22
|
+
/** Rows of candidates that will not be published again, their replacement plans included. */
|
|
22
23
|
readonly terminalSourceRowsDeleted: number
|
|
23
24
|
readonly terminalSourceMaterializationsDeleted: number
|
|
24
25
|
}
|
|
@@ -37,10 +38,6 @@ export interface OntologyMaintenanceSnapshot {
|
|
|
37
38
|
readonly retryingCount: number
|
|
38
39
|
readonly maxAttempts: number
|
|
39
40
|
} | null
|
|
40
|
-
readonly terminalSources: {
|
|
41
|
-
readonly count: number
|
|
42
|
-
readonly oldestTerminalAt: string | null
|
|
43
|
-
} | null
|
|
44
41
|
readonly cleanup: OntologyMaintenanceCleanupSnapshot | null
|
|
45
42
|
}
|
|
46
43
|
|