@sixb/core 0.1.2 → 0.1.4
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 +19 -17
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/worker.js +4 -4
- package/dist/actions/worker.js.map +1 -1
- package/dist/agents/adapters.d.ts +11 -1
- package/dist/agents/adapters.d.ts.map +1 -1
- package/dist/agents/context-compaction.d.ts +40 -0
- package/dist/agents/context-compaction.d.ts.map +1 -0
- package/dist/agents/context.js +1 -1
- package/dist/agents/errors.d.ts +1 -1
- package/dist/agents/errors.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +3 -0
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/ids.d.ts +2 -0
- package/dist/agents/ids.d.ts.map +1 -1
- package/dist/agents/index.d.ts +10 -6
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +51 -35
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/streams.d.ts +17 -1
- package/dist/agents/streams.d.ts.map +1 -1
- package/dist/agents/streams.js +5 -3
- package/dist/agents/streams.js.map +1 -1
- package/dist/agents/thread-context-projection.d.ts +19 -0
- package/dist/agents/thread-context-projection.d.ts.map +1 -0
- package/dist/agents/tool-definition.d.ts.map +1 -1
- package/dist/agents/tool-result.d.ts +6 -0
- package/dist/agents/tool-result.d.ts.map +1 -0
- package/dist/agents/types.d.ts +46 -1
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/validation.d.ts +2 -2
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/auth/index.js +11 -5
- package/dist/auth/index.js.map +1 -1
- package/dist/authorization/index.js +6 -2
- package/dist/authorization/index.js.map +1 -1
- package/dist/bootstrap/index.js +33 -31
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/{chunk-ys1nse2v.js → chunk-1wk20wn3.js} +438 -246
- package/dist/{chunk-ys1nse2v.js.map → chunk-1wk20wn3.js.map} +11 -11
- package/dist/{chunk-sa4340y1.js → chunk-1yz3x65y.js} +7 -7
- package/dist/{chunk-gqdd7508.js → chunk-4rh2m6zg.js} +1 -1
- package/dist/{chunk-fmx1sz2h.js → chunk-72q2y8hn.js} +3 -3
- package/dist/{chunk-fmx1sz2h.js.map → chunk-72q2y8hn.js.map} +4 -4
- package/dist/{chunk-nnyp53zt.js → chunk-7gw7mepb.js} +259 -9
- package/dist/chunk-7gw7mepb.js.map +14 -0
- package/dist/{chunk-nten49ta.js → chunk-819wnjz8.js} +11 -5
- package/dist/chunk-819wnjz8.js.map +12 -0
- package/dist/chunk-96swp2wd.js +47 -0
- package/dist/chunk-96swp2wd.js.map +10 -0
- package/dist/{chunk-4x43bkbp.js → chunk-a09jx26t.js} +1 -1
- package/dist/{chunk-st4xgxey.js → chunk-afjpa2hs.js} +205 -48
- package/dist/chunk-afjpa2hs.js.map +45 -0
- package/dist/{chunk-0mbx247x.js → chunk-c43qr6s0.js} +427 -99
- package/dist/chunk-c43qr6s0.js.map +46 -0
- package/dist/{chunk-zg9yryhz.js → chunk-cbkm2vam.js} +3 -3
- package/dist/{chunk-57zpb99z.js → chunk-dm72y8wt.js} +26 -3
- package/dist/chunk-dm72y8wt.js.map +10 -0
- package/dist/chunk-drjqm1aa.js +913 -0
- package/dist/chunk-drjqm1aa.js.map +15 -0
- package/dist/chunk-dysw7nsm.js.map +1 -1
- package/dist/{chunk-8ryen3p3.js → chunk-f6erf2vv.js} +1 -1
- package/dist/{chunk-34bqh420.js → chunk-f83ka50g.js} +188 -44
- package/dist/chunk-f83ka50g.js.map +23 -0
- package/dist/{chunk-bct7hmfc.js → chunk-g13869yf.js} +3 -3
- package/dist/{chunk-0k4avqr2.js → chunk-hbeh8j9w.js} +2 -2
- package/dist/{chunk-qvybnnpe.js → chunk-nzw7sm3b.js} +2 -2
- package/dist/{chunk-k9pts48t.js → chunk-pn8n8sba.js} +16 -15
- package/dist/{chunk-k9pts48t.js.map → chunk-pn8n8sba.js.map} +3 -3
- package/dist/{chunk-63te770v.js → chunk-qewtks41.js} +8 -8
- package/dist/{chunk-63te770v.js.map → chunk-qewtks41.js.map} +2 -2
- package/dist/{chunk-85j5ybfj.js → chunk-rdeagz6b.js} +2 -2
- package/dist/{chunk-85j5ybfj.js.map → chunk-rdeagz6b.js.map} +3 -3
- package/dist/chunk-rhrbz7d4.js +36 -0
- package/dist/chunk-rhrbz7d4.js.map +10 -0
- package/dist/{chunk-bh6k3nc6.js → chunk-rs1wbvy6.js} +1 -1
- package/dist/{chunk-88ppkr54.js → chunk-rte5sm3z.js} +26 -2
- package/dist/chunk-rte5sm3z.js.map +12 -0
- package/dist/{chunk-n8herkry.js → chunk-s31d0qmq.js} +57 -20
- package/dist/{chunk-n8herkry.js.map → chunk-s31d0qmq.js.map} +8 -7
- package/dist/{chunk-7pc8b818.js → chunk-sxwk41qa.js} +1 -1
- package/dist/{chunk-663csy96.js → chunk-t0jjkep3.js} +2 -1
- package/dist/chunk-t0jjkep3.js.map +10 -0
- package/dist/{chunk-c6qd89g5.js → chunk-tek1qwgm.js} +6 -6
- package/dist/{chunk-c6qd89g5.js.map → chunk-tek1qwgm.js.map} +1 -1
- package/dist/{chunk-jaj13078.js → chunk-tkdscva6.js} +3 -33
- package/dist/{chunk-jaj13078.js.map → chunk-tkdscva6.js.map} +3 -4
- package/dist/{chunk-5egfka8j.js → chunk-tycbzedm.js} +2 -2
- package/dist/{chunk-g9t3kdtx.js → chunk-x2yw73hy.js} +1 -1
- package/dist/{chunk-57r1cpxx.js → chunk-xc7hq65b.js} +3 -2
- package/dist/{chunk-57r1cpxx.js.map → chunk-xc7hq65b.js.map} +3 -3
- package/dist/chunk-xdf9yswn.js +133 -0
- package/dist/chunk-xdf9yswn.js.map +11 -0
- package/dist/execution/agent.js +29 -27
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/primitive.js +29 -27
- package/dist/execution/primitive.js.map +2 -2
- package/dist/execution/request.js +30 -28
- package/dist/execution/request.js.map +2 -2
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +60 -58
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/types.d.ts +2 -1
- package/dist/lake-storage/types.d.ts.map +1 -1
- package/dist/materialization/model.d.ts +4 -0
- package/dist/materialization/model.d.ts.map +1 -1
- package/dist/materializer/edits/apply.d.ts +6 -1
- package/dist/materializer/edits/apply.d.ts.map +1 -1
- package/dist/materializer/edits/working-state.d.ts +2 -0
- package/dist/materializer/edits/working-state.d.ts.map +1 -1
- package/dist/materializer/effective/resolve.d.ts +3 -1
- package/dist/materializer/effective/resolve.d.ts.map +1 -1
- package/dist/materializer/execution/work-records.d.ts.map +1 -1
- package/dist/materializer/index.js +19 -17
- package/dist/materializer/index.js.map +1 -1
- package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
- package/dist/materializer/shared/normalize.d.ts.map +1 -1
- package/dist/models/index.d.ts +40 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/objects/execution.d.ts +6 -1
- package/dist/objects/execution.d.ts.map +1 -1
- package/dist/objects/index.js +21 -19
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/link/endpoints.d.ts.map +1 -1
- package/dist/objects/query/executor.d.ts +1 -0
- package/dist/objects/query/executor.d.ts.map +1 -1
- package/dist/objects/query/explain.d.ts +1 -0
- package/dist/objects/query/explain.d.ts.map +1 -1
- package/dist/objects/query/index.d.ts +3 -1
- package/dist/objects/query/index.d.ts.map +1 -1
- package/dist/objects/query/index.js +30 -5
- package/dist/objects/query/index.js.map +1 -1
- package/dist/objects/query/ir.d.ts +14 -1
- package/dist/objects/query/ir.d.ts.map +1 -1
- package/dist/objects/query/links.d.ts +25 -0
- package/dist/objects/query/links.d.ts.map +1 -0
- package/dist/objects/query/normalize.d.ts.map +1 -1
- package/dist/objects/query/planner.d.ts.map +1 -1
- package/dist/objects/query/validate.d.ts +1 -0
- package/dist/objects/query/validate.d.ts.map +1 -1
- package/dist/pipelines/index.js +16 -15
- package/dist/pipelines/index.js.map +1 -1
- package/dist/projections/builders.d.ts +52 -10
- package/dist/projections/builders.d.ts.map +1 -1
- package/dist/projections/index.d.ts +2 -1
- package/dist/projections/index.d.ts.map +1 -1
- package/dist/projections/internal.d.ts +4 -1
- package/dist/projections/internal.d.ts.map +1 -1
- package/dist/projections/internal.js +22 -17
- package/dist/projections/internal.js.map +1 -1
- package/dist/projections/run-dispatch.d.ts +1 -0
- package/dist/projections/run-dispatch.d.ts.map +1 -1
- package/dist/projections/timestamp.d.ts +3 -0
- package/dist/projections/timestamp.d.ts.map +1 -0
- package/dist/projections/types.d.ts +21 -9
- package/dist/projections/types.d.ts.map +1 -1
- package/dist/projections/validation.d.ts +6 -5
- package/dist/projections/validation.d.ts.map +1 -1
- package/dist/query.d.ts +2 -1
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +2 -2
- package/dist/queues/index.d.ts +1 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/types.d.ts +7 -0
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/runtime/ai-cost.d.ts +8 -0
- package/dist/runtime/ai-cost.d.ts.map +1 -0
- package/dist/runtime/create.d.ts +3 -0
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/definitions.d.ts +3 -0
- package/dist/runtime/definitions.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +2 -0
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/resolve-definitions.d.ts +2 -0
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/storage/agents/in-memory.d.ts +22 -4
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/index.d.ts +1 -1
- package/dist/storage/agents/index.d.ts.map +1 -1
- package/dist/storage/agents/provider.d.ts +31 -0
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +22 -7
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +75 -4
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/analytics.d.ts +61 -0
- package/dist/storage/ai-cost/analytics.d.ts.map +1 -0
- package/dist/storage/ai-cost/codec.d.ts +14 -0
- package/dist/storage/ai-cost/codec.d.ts.map +1 -0
- package/dist/storage/ai-cost/errors.d.ts +7 -0
- package/dist/storage/ai-cost/errors.d.ts.map +1 -0
- package/dist/storage/ai-cost/in-memory.d.ts +32 -0
- package/dist/storage/ai-cost/in-memory.d.ts.map +1 -0
- package/dist/storage/ai-cost/index.d.ts +6 -0
- package/dist/storage/ai-cost/index.d.ts.map +1 -0
- package/dist/storage/ai-cost/provider.d.ts +7 -0
- package/dist/storage/ai-cost/provider.d.ts.map +1 -0
- package/dist/storage/ai-cost/provider.js +132 -0
- package/dist/storage/ai-cost/provider.js.map +10 -0
- package/dist/storage/ai-cost/types.d.ts +154 -0
- package/dist/storage/ai-cost/types.d.ts.map +1 -0
- package/dist/storage/ai-cost/validation.d.ts +7 -0
- package/dist/storage/ai-cost/validation.d.ts.map +1 -0
- package/dist/storage/ai-usage/in-memory.d.ts +2 -1
- package/dist/storage/ai-usage/in-memory.d.ts.map +1 -1
- package/dist/storage/ai-usage/index.d.ts +1 -1
- package/dist/storage/ai-usage/index.d.ts.map +1 -1
- package/dist/storage/ai-usage/types.d.ts +6 -0
- package/dist/storage/ai-usage/types.d.ts.map +1 -1
- package/dist/storage/in-memory/index.d.ts +5 -0
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +6 -3
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +33 -21
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/objects/in-memory.d.ts +6 -3
- package/dist/storage/objects/in-memory.d.ts.map +1 -1
- package/dist/storage/objects/index.d.ts +3 -1
- package/dist/storage/objects/index.d.ts.map +1 -1
- package/dist/storage/objects/keys.d.ts +16 -0
- package/dist/storage/objects/keys.d.ts.map +1 -0
- package/dist/storage/objects/types.d.ts +33 -6
- package/dist/storage/objects/types.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/materializations.d.ts +3 -0
- package/dist/storage/ontology/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +1 -1
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +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 +10 -5
- package/dist/storage/workflow-runs/provider.js.map +1 -1
- package/dist/syncs/index.js +16 -15
- package/dist/syncs/index.js.map +1 -1
- package/dist/testing/agent-storage-contract.d.ts +3 -2
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-cost-storage-contract.d.ts +12 -0
- package/dist/testing/ai-cost-storage-contract.d.ts.map +1 -0
- package/dist/testing/ai-usage-storage-contract.d.ts.map +1 -1
- package/dist/testing/effective-storage-contract.d.ts +1 -1
- package/dist/testing/effective-storage-contract.d.ts.map +1 -1
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +2525 -1480
- package/dist/testing/index.js.map +10 -9
- package/dist/testing/lake-storage-contract.d.ts.map +1 -1
- package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
- package/dist/testing/object-query-contract.d.ts +1 -1
- package/dist/testing/object-query-contract.d.ts.map +1 -1
- package/dist/webhooks/internal.js +14 -13
- package/dist/webhooks/internal.js.map +2 -2
- package/dist/workers/index.js +12 -2
- package/dist/workers/index.js.map +3 -3
- package/dist/workers/queue-worker.d.ts +2 -0
- package/dist/workers/queue-worker.d.ts.map +1 -1
- package/dist/workflows/execution.d.ts +3 -0
- package/dist/workflows/execution.d.ts.map +1 -1
- package/dist/workflows/index.js +30 -28
- package/dist/workflows/index.js.map +1 -1
- package/package.json +7 -1
- package/src/agents/adapters.ts +64 -23
- package/src/agents/builders.ts +3 -3
- package/src/agents/context-compaction.ts +261 -0
- package/src/agents/errors.ts +2 -2
- package/src/agents/execution.ts +14 -2
- package/src/agents/ids.ts +5 -0
- package/src/agents/index.ts +32 -6
- package/src/agents/request.ts +5 -0
- package/src/agents/streams.ts +56 -0
- package/src/agents/thread-context-projection.ts +93 -0
- package/src/agents/tool-definition.ts +17 -2
- package/src/agents/tool-result.ts +61 -0
- package/src/agents/types.ts +57 -1
- package/src/agents/validation.ts +36 -6
- package/src/http/api-routes.ts +7 -7
- package/src/index.ts +27 -0
- package/src/lake-storage/types.ts +2 -1
- package/src/materialization/model.ts +4 -0
- package/src/materializer/edits/apply.ts +55 -2
- package/src/materializer/edits/operations.ts +8 -1
- package/src/materializer/edits/working-state.ts +7 -0
- package/src/materializer/effective/resolve.ts +78 -9
- package/src/materializer/execution/work-records.ts +3 -1
- package/src/materializer/projections/entry-validator.ts +23 -1
- package/src/materializer/projections/replacement-plan.ts +2 -0
- package/src/materializer/shared/normalize.ts +16 -0
- package/src/materializer/telemetry/append.ts +33 -16
- package/src/models/index.ts +71 -0
- package/src/objects/execution.ts +20 -0
- package/src/objects/link/endpoints.ts +2 -1
- package/src/objects/query/executor.ts +42 -11
- package/src/objects/query/explain.ts +11 -0
- package/src/objects/query/index.ts +6 -0
- package/src/objects/query/ir.ts +16 -0
- package/src/objects/query/links.ts +308 -0
- package/src/objects/query/normalize.ts +40 -1
- package/src/objects/query/planner.ts +5 -0
- package/src/objects/query/validate.ts +58 -2
- package/src/projections/builders.ts +320 -50
- package/src/projections/index.ts +7 -0
- package/src/projections/internal.ts +4 -1
- package/src/projections/ownership.ts +5 -5
- package/src/projections/registry.ts +16 -3
- package/src/projections/revision.ts +35 -5
- package/src/projections/run-dispatch.ts +10 -1
- package/src/projections/timestamp.ts +66 -0
- package/src/projections/types.ts +20 -9
- package/src/projections/validation.ts +85 -19
- package/src/query.ts +2 -0
- package/src/queues/index.ts +1 -0
- package/src/queues/types.ts +8 -0
- package/src/runtime/ai-cost.ts +15 -0
- package/src/runtime/create.ts +4 -0
- package/src/runtime/definitions.ts +3 -0
- package/src/runtime/host.ts +2 -0
- package/src/runtime/resolve-definitions.ts +28 -0
- package/src/storage/agents/in-memory.ts +186 -4
- package/src/storage/agents/index.ts +5 -0
- package/src/storage/agents/provider.ts +225 -0
- package/src/storage/agents/types.ts +82 -3
- package/src/storage/ai-cost/analytics.ts +602 -0
- package/src/storage/ai-cost/codec.ts +136 -0
- package/src/storage/ai-cost/errors.ts +12 -0
- package/src/storage/ai-cost/in-memory.ts +164 -0
- package/src/storage/ai-cost/index.ts +35 -0
- package/src/storage/ai-cost/provider.ts +20 -0
- package/src/storage/ai-cost/types.ts +193 -0
- package/src/storage/ai-cost/validation.ts +337 -0
- package/src/storage/ai-usage/in-memory.ts +23 -0
- package/src/storage/ai-usage/index.ts +1 -0
- package/src/storage/ai-usage/types.ts +10 -0
- package/src/storage/in-memory/index.ts +50 -0
- package/src/storage/index.ts +48 -0
- package/src/storage/objects/in-memory.ts +103 -16
- package/src/storage/objects/index.ts +9 -0
- package/src/storage/objects/keys.ts +36 -0
- package/src/storage/objects/types.ts +34 -6
- package/src/storage/ontology/in-memory/materializations.ts +1 -0
- package/src/storage/ontology/materializations.ts +3 -0
- package/src/storage/ontology/provider-header-validation.ts +2 -2
- package/src/storage/operation-scope.ts +1 -0
- package/src/storage/types.ts +2 -0
- package/src/testing/agent-storage-contract.ts +353 -2
- package/src/testing/ai-cost-storage-contract.ts +320 -0
- package/src/testing/ai-usage-storage-contract.ts +35 -0
- package/src/testing/effective-storage-contract.ts +194 -4
- package/src/testing/index.ts +5 -0
- package/src/testing/lake-storage-contract.ts +56 -0
- package/src/testing/materializer-storage-contract.ts +120 -2
- package/src/testing/object-query-contract.ts +208 -1
- package/src/workers/queue-worker.ts +14 -1
- package/src/workflows/execution.ts +31 -10
- package/dist/agents/prompt.d.ts +0 -15
- package/dist/agents/prompt.d.ts.map +0 -1
- package/dist/chunk-0mbx247x.js.map +0 -43
- package/dist/chunk-34bqh420.js.map +0 -23
- package/dist/chunk-57zpb99z.js.map +0 -10
- package/dist/chunk-663csy96.js.map +0 -10
- package/dist/chunk-6wetht33.js +0 -89
- package/dist/chunk-6wetht33.js.map +0 -10
- package/dist/chunk-88ppkr54.js.map +0 -12
- package/dist/chunk-nnyp53zt.js.map +0 -13
- package/dist/chunk-nten49ta.js.map +0 -12
- package/dist/chunk-st4xgxey.js.map +0 -45
- package/dist/chunk-vp1vc6ee.js +0 -35
- package/dist/chunk-vp1vc6ee.js.map +0 -11
- package/src/agents/prompt.ts +0 -57
- /package/dist/{chunk-sa4340y1.js.map → chunk-1yz3x65y.js.map} +0 -0
- /package/dist/{chunk-gqdd7508.js.map → chunk-4rh2m6zg.js.map} +0 -0
- /package/dist/{chunk-4x43bkbp.js.map → chunk-a09jx26t.js.map} +0 -0
- /package/dist/{chunk-zg9yryhz.js.map → chunk-cbkm2vam.js.map} +0 -0
- /package/dist/{chunk-8ryen3p3.js.map → chunk-f6erf2vv.js.map} +0 -0
- /package/dist/{chunk-bct7hmfc.js.map → chunk-g13869yf.js.map} +0 -0
- /package/dist/{chunk-0k4avqr2.js.map → chunk-hbeh8j9w.js.map} +0 -0
- /package/dist/{chunk-qvybnnpe.js.map → chunk-nzw7sm3b.js.map} +0 -0
- /package/dist/{chunk-bh6k3nc6.js.map → chunk-rs1wbvy6.js.map} +0 -0
- /package/dist/{chunk-7pc8b818.js.map → chunk-sxwk41qa.js.map} +0 -0
- /package/dist/{chunk-5egfka8j.js.map → chunk-tycbzedm.js.map} +0 -0
- /package/dist/{chunk-g9t3kdtx.js.map → chunk-x2yw73hy.js.map} +0 -0
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
resolveSemanticType
|
|
4
|
+
} from "./chunk-rnshztfq.js";
|
|
2
5
|
import {
|
|
3
6
|
createSixbError
|
|
4
7
|
} from "./chunk-0172wgm9.js";
|
|
@@ -615,12 +618,10 @@ function computeProjectionOwnership(projection, ontology) {
|
|
|
615
618
|
return freezeOwnership({
|
|
616
619
|
objects: [],
|
|
617
620
|
links: [],
|
|
618
|
-
telemetry:
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
}
|
|
623
|
-
]
|
|
621
|
+
telemetry: Object.keys(projection.properties).sort(compareStrings).map((propertyId) => ({
|
|
622
|
+
objectTypeId: projection.objectTypeId,
|
|
623
|
+
propertyId
|
|
624
|
+
}))
|
|
624
625
|
});
|
|
625
626
|
}
|
|
626
627
|
function validateProjectionOwnership(projections) {
|
|
@@ -735,26 +736,48 @@ function validateLinkProjectionTarget(linkToken) {
|
|
|
735
736
|
throw new ProjectionValidationError(`Link '${linkToken.id}' has a wildcard target. ` + `Link projection of wildcard links is not supported.`);
|
|
736
737
|
}
|
|
737
738
|
}
|
|
738
|
-
function validateTelemetryProjectionFieldMapping(projection, objectType, datasetColumnNames, prefix) {
|
|
739
|
-
const
|
|
740
|
-
if (
|
|
741
|
-
throw new ProjectionValidationError(`${prefix}:
|
|
742
|
-
}
|
|
743
|
-
if (property.mode !== "telemetry") {
|
|
744
|
-
throw new ProjectionValidationError(`${prefix}: property "${projection.propertyId}" on type "${projection.objectTypeId}" must be telemetry-enabled`);
|
|
739
|
+
function validateTelemetryProjectionFieldMapping(projection, objectType, datasetColumnNames, valueTypesById, prefix) {
|
|
740
|
+
const mappedProperties = Object.entries(projection.properties);
|
|
741
|
+
if (mappedProperties.length === 0) {
|
|
742
|
+
throw new ProjectionValidationError(`${prefix}: must map at least one telemetry property`);
|
|
745
743
|
}
|
|
746
744
|
const mappedFields = [
|
|
747
745
|
["objectId", projection.objectIdField],
|
|
748
|
-
["at", projection.atField]
|
|
749
|
-
["value", projection.valueField],
|
|
750
|
-
...projection.unitField !== undefined ? [["unit", projection.unitField]] : []
|
|
746
|
+
["at", projection.atField]
|
|
751
747
|
];
|
|
752
748
|
for (const [fieldRole, columnName] of mappedFields) {
|
|
753
749
|
if (!datasetColumnNames.has(columnName)) {
|
|
754
750
|
throw new ProjectionValidationError(`${prefix}: ${fieldRole} field "${columnName}" references unknown dataset column ` + `on dataset "${projection.datasetId}"`);
|
|
755
751
|
}
|
|
756
752
|
}
|
|
757
|
-
|
|
753
|
+
const propertiesById = new Map(objectType.properties.map((property) => [property.id, property]));
|
|
754
|
+
const resolvedProperties = new Map;
|
|
755
|
+
for (const [propertyId, mapping] of mappedProperties) {
|
|
756
|
+
const property = propertiesById.get(propertyId);
|
|
757
|
+
if (!property) {
|
|
758
|
+
throw new ProjectionValidationError(`${prefix}: unknown property "${propertyId}" on type "${projection.objectTypeId}"`);
|
|
759
|
+
}
|
|
760
|
+
if (property.mode !== "telemetry") {
|
|
761
|
+
throw new ProjectionValidationError(`${prefix}: property "${propertyId}" on type "${projection.objectTypeId}" must be telemetry-enabled`);
|
|
762
|
+
}
|
|
763
|
+
for (const [fieldRole, columnName] of [
|
|
764
|
+
["value", mapping.valueField],
|
|
765
|
+
...mapping.unitField !== undefined ? [["unit", mapping.unitField]] : []
|
|
766
|
+
]) {
|
|
767
|
+
if (!datasetColumnNames.has(columnName)) {
|
|
768
|
+
throw new ProjectionValidationError(`${prefix}: property "${propertyId}" ${fieldRole} field "${columnName}" references ` + `unknown dataset column on dataset "${projection.datasetId}"`);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
const semanticType = resolveSemanticType(property, valueTypesById);
|
|
772
|
+
if (semanticType !== undefined && mapping.unitField === undefined) {
|
|
773
|
+
throw new ProjectionValidationError(`${prefix}: property "${propertyId}" requires a unit field because it uses semantic type "${semanticType}"`);
|
|
774
|
+
}
|
|
775
|
+
if (semanticType === undefined && mapping.unitField !== undefined) {
|
|
776
|
+
throw new ProjectionValidationError(`${prefix}: property "${propertyId}" cannot map a unit field because it has no semantic type`);
|
|
777
|
+
}
|
|
778
|
+
resolvedProperties.set(propertyId, property);
|
|
779
|
+
}
|
|
780
|
+
return resolvedProperties;
|
|
758
781
|
}
|
|
759
782
|
function validateProjectionsAtStartup(projections, ontology, datasetsById) {
|
|
760
783
|
const { objectProjections, linkProjections, telemetryProjections } = projections;
|
|
@@ -775,6 +798,19 @@ function validateProjectionsAtStartup(projections, ontology, datasetsById) {
|
|
|
775
798
|
throw new ProjectionValidationError(`${prefix}: unknown object type "${projection.objectTypeId}"`);
|
|
776
799
|
}
|
|
777
800
|
const datasetColumnNames = new Set(dataset.schema.columns.map((column) => column.name));
|
|
801
|
+
const conflictResolution = projection.conflictResolution ?? { strategy: "editsWin" };
|
|
802
|
+
if (conflictResolution.strategy === "mostRecent") {
|
|
803
|
+
const sourceTimestamp = dataset.schema.columns.find((column) => column.name === conflictResolution.sourceTimestamp);
|
|
804
|
+
if (!sourceTimestamp) {
|
|
805
|
+
throw new ProjectionValidationError(`${prefix}: source timestamp "${conflictResolution.sourceTimestamp}" references unknown ` + `dataset column on dataset "${projection.datasetId}"`);
|
|
806
|
+
}
|
|
807
|
+
if (sourceTimestamp.type !== "timestamp") {
|
|
808
|
+
throw new ProjectionValidationError(`${prefix}: source timestamp "${conflictResolution.sourceTimestamp}" must reference a ` + `timestamp dataset column`);
|
|
809
|
+
}
|
|
810
|
+
if (sourceTimestamp.nullable === true) {
|
|
811
|
+
throw new ProjectionValidationError(`${prefix}: source timestamp "${conflictResolution.sourceTimestamp}" must reference a ` + `non-null timestamp dataset column`);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
778
814
|
const propertyIds = new Set(objectType.properties.map((p) => p.id));
|
|
779
815
|
for (const [propId, columnName] of Object.entries(projection.properties)) {
|
|
780
816
|
if (!propertyIds.has(propId)) {
|
|
@@ -884,7 +920,7 @@ function validateProjectionsAtStartup(projections, ontology, datasetsById) {
|
|
|
884
920
|
throw new ProjectionValidationError(`${prefix}: unknown object type "${projection.objectTypeId}"`);
|
|
885
921
|
}
|
|
886
922
|
const datasetColumnNames = new Set(dataset.schema.columns.map((column) => column.name));
|
|
887
|
-
validateTelemetryProjectionFieldMapping(projection, objectType, datasetColumnNames, prefix);
|
|
923
|
+
validateTelemetryProjectionFieldMapping(projection, objectType, datasetColumnNames, ontology.getValueTypesById(), prefix);
|
|
888
924
|
validatedTelemetryProjections.push({
|
|
889
925
|
definition: projection,
|
|
890
926
|
dataset,
|
|
@@ -952,9 +988,9 @@ function defineProjection(id, target) {
|
|
|
952
988
|
return buildLinkProjection(id, target);
|
|
953
989
|
if ("property" in target)
|
|
954
990
|
return buildTelemetryProjection(id, target);
|
|
955
|
-
return
|
|
991
|
+
return buildObjectTypeProjection(id, target);
|
|
956
992
|
}
|
|
957
|
-
function
|
|
993
|
+
function buildObjectTypeProjection(id, objectType) {
|
|
958
994
|
assertNonEmpty2(id, "id");
|
|
959
995
|
return {
|
|
960
996
|
fromDataset(dataset) {
|
|
@@ -964,33 +1000,61 @@ function buildObjectProjection(id, objectType) {
|
|
|
964
1000
|
properties(mapping) {
|
|
965
1001
|
const propertyMapping = mapping;
|
|
966
1002
|
validatePropertyMapping(objectType, propertyMapping);
|
|
967
|
-
|
|
968
|
-
|
|
1003
|
+
return objectProjectionBuilder({
|
|
1004
|
+
id,
|
|
1005
|
+
objectType,
|
|
1006
|
+
datasetId,
|
|
1007
|
+
propertyMapping,
|
|
1008
|
+
links: {},
|
|
1009
|
+
conflictResolution: { strategy: "editsWin" }
|
|
1010
|
+
});
|
|
1011
|
+
},
|
|
1012
|
+
points(mapping) {
|
|
1013
|
+
const pointMapping = lowerTelemetryPropertiesPointMapping(objectType, mapping);
|
|
1014
|
+
return {
|
|
1015
|
+
_tag: "TelemetryProjectionDefinition",
|
|
969
1016
|
id,
|
|
970
1017
|
objectTypeId: objectType.id,
|
|
971
1018
|
datasetId,
|
|
972
|
-
|
|
973
|
-
|
|
1019
|
+
objectIdField: pointMapping.objectId,
|
|
1020
|
+
atField: pointMapping.at,
|
|
1021
|
+
properties: pointMapping.properties
|
|
974
1022
|
};
|
|
975
|
-
return Object.assign(definition, {
|
|
976
|
-
withLinks(linkMapping) {
|
|
977
|
-
const loweredLinkMapping = lowerForeignKeyMapping(linkMapping);
|
|
978
|
-
const validatedLinks = validateAndLowerLinkMapping(objectType, loweredLinkMapping, propertyMapping);
|
|
979
|
-
return {
|
|
980
|
-
_tag: "ObjectProjectionDefinition",
|
|
981
|
-
id,
|
|
982
|
-
objectTypeId: objectType.id,
|
|
983
|
-
datasetId,
|
|
984
|
-
properties: { ...propertyMapping },
|
|
985
|
-
links: validatedLinks
|
|
986
|
-
};
|
|
987
|
-
}
|
|
988
|
-
});
|
|
989
1023
|
}
|
|
990
1024
|
};
|
|
991
1025
|
}
|
|
992
1026
|
};
|
|
993
1027
|
}
|
|
1028
|
+
function objectProjectionBuilder(input) {
|
|
1029
|
+
const definition = {
|
|
1030
|
+
_tag: "ObjectProjectionDefinition",
|
|
1031
|
+
id: input.id,
|
|
1032
|
+
objectTypeId: input.objectType.id,
|
|
1033
|
+
datasetId: input.datasetId,
|
|
1034
|
+
properties: { ...input.propertyMapping },
|
|
1035
|
+
links: { ...input.links },
|
|
1036
|
+
conflictResolution: { ...input.conflictResolution }
|
|
1037
|
+
};
|
|
1038
|
+
return Object.assign(definition, {
|
|
1039
|
+
withLinks(linkMapping) {
|
|
1040
|
+
const loweredLinkMapping = lowerForeignKeyMapping(linkMapping);
|
|
1041
|
+
const validatedLinks = validateAndLowerLinkMapping(input.objectType, loweredLinkMapping, input.propertyMapping);
|
|
1042
|
+
return objectProjectionBuilder({ ...input, links: validatedLinks });
|
|
1043
|
+
},
|
|
1044
|
+
resolveConflicts(resolution) {
|
|
1045
|
+
validateConflictResolution(resolution);
|
|
1046
|
+
return objectProjectionBuilder({
|
|
1047
|
+
...input,
|
|
1048
|
+
conflictResolution: resolution
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
function validateConflictResolution(resolution) {
|
|
1054
|
+
if (resolution.strategy === "editsWin")
|
|
1055
|
+
return;
|
|
1056
|
+
assertNonEmpty2(resolution.sourceTimestamp, "source timestamp field");
|
|
1057
|
+
}
|
|
994
1058
|
function buildTelemetryProjection(id, propertyToken) {
|
|
995
1059
|
assertNonEmpty2(id, "id");
|
|
996
1060
|
validateTelemetryProjectionProperty(propertyToken);
|
|
@@ -1005,12 +1069,15 @@ function buildTelemetryProjection(id, propertyToken) {
|
|
|
1005
1069
|
_tag: "TelemetryProjectionDefinition",
|
|
1006
1070
|
id,
|
|
1007
1071
|
objectTypeId: propertyToken.objectTypeId,
|
|
1008
|
-
propertyId: propertyToken.id,
|
|
1009
1072
|
datasetId,
|
|
1010
1073
|
objectIdField: pointMapping.objectId,
|
|
1011
1074
|
atField: pointMapping.at,
|
|
1012
|
-
|
|
1013
|
-
|
|
1075
|
+
properties: {
|
|
1076
|
+
[propertyToken.id]: {
|
|
1077
|
+
valueField: pointMapping.value,
|
|
1078
|
+
...pointMapping.unit !== undefined ? { unitField: pointMapping.unit } : {}
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1014
1081
|
};
|
|
1015
1082
|
}
|
|
1016
1083
|
};
|
|
@@ -1051,6 +1118,69 @@ function lowerTelemetryPointMapping(mapping) {
|
|
|
1051
1118
|
...mapping.unit !== undefined ? { unit: mapping.unit } : {}
|
|
1052
1119
|
};
|
|
1053
1120
|
}
|
|
1121
|
+
function lowerTelemetryPropertiesPointMapping(objectType, mapping) {
|
|
1122
|
+
const allowedKeys = new Set(["objectId", "at", "properties"]);
|
|
1123
|
+
for (const key of Object.keys(mapping)) {
|
|
1124
|
+
if (!allowedKeys.has(key)) {
|
|
1125
|
+
throw new ProjectionValidationError(`Telemetry projection point mapping contains unknown key '${key}'.`);
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
if (mapping.objectId === undefined) {
|
|
1129
|
+
throw new ProjectionValidationError("Telemetry projection point mapping requires objectId.");
|
|
1130
|
+
}
|
|
1131
|
+
if (mapping.at === undefined) {
|
|
1132
|
+
throw new ProjectionValidationError("Telemetry projection point mapping requires at.");
|
|
1133
|
+
}
|
|
1134
|
+
if (mapping.properties === undefined) {
|
|
1135
|
+
throw new ProjectionValidationError("Telemetry projection point mapping requires properties.");
|
|
1136
|
+
}
|
|
1137
|
+
if (!isRecord(mapping.properties)) {
|
|
1138
|
+
throw new ProjectionValidationError("Telemetry projection point mapping properties must be an object.");
|
|
1139
|
+
}
|
|
1140
|
+
assertNonEmpty2(mapping.objectId, "objectId field");
|
|
1141
|
+
assertNonEmpty2(mapping.at, "at field");
|
|
1142
|
+
const propertyEntries = Object.entries(mapping.properties);
|
|
1143
|
+
if (propertyEntries.length === 0) {
|
|
1144
|
+
throw new ProjectionValidationError("Telemetry projection point mapping requires at least one property.");
|
|
1145
|
+
}
|
|
1146
|
+
const propertiesById = new Map(objectType.properties.map((property) => [property.id, property]));
|
|
1147
|
+
const properties = {};
|
|
1148
|
+
for (const [propertyId, input] of propertyEntries) {
|
|
1149
|
+
const property = propertiesById.get(propertyId);
|
|
1150
|
+
if (!property) {
|
|
1151
|
+
throw new ProjectionValidationError(`Property '${propertyId}' does not exist on object type '${objectType.id}'.`);
|
|
1152
|
+
}
|
|
1153
|
+
if (property.mode !== "telemetry") {
|
|
1154
|
+
throw new ProjectionValidationError(`Projection property '${objectType.id}.${propertyId}' must be telemetry-enabled.`);
|
|
1155
|
+
}
|
|
1156
|
+
properties[propertyId] = lowerTelemetryPropertyMapping(propertyId, input);
|
|
1157
|
+
}
|
|
1158
|
+
return { objectId: mapping.objectId, at: mapping.at, properties };
|
|
1159
|
+
}
|
|
1160
|
+
function lowerTelemetryPropertyMapping(propertyId, input) {
|
|
1161
|
+
if (typeof input === "string") {
|
|
1162
|
+
assertNonEmpty2(input, `property '${propertyId}' value field`);
|
|
1163
|
+
return { valueField: input };
|
|
1164
|
+
}
|
|
1165
|
+
if (!isRecord(input)) {
|
|
1166
|
+
throw new ProjectionValidationError(`Telemetry projection property '${propertyId}' must map a value column or value/unit columns.`);
|
|
1167
|
+
}
|
|
1168
|
+
const allowedKeys = new Set(["value", "unit"]);
|
|
1169
|
+
for (const key of Object.keys(input)) {
|
|
1170
|
+
if (!allowedKeys.has(key)) {
|
|
1171
|
+
throw new ProjectionValidationError(`Telemetry projection property '${propertyId}' contains unknown key '${key}'.`);
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
if (typeof input.value !== "string") {
|
|
1175
|
+
throw new ProjectionValidationError(`Telemetry projection property '${propertyId}' requires a value field.`);
|
|
1176
|
+
}
|
|
1177
|
+
if (typeof input.unit !== "string") {
|
|
1178
|
+
throw new ProjectionValidationError(`Telemetry projection property '${propertyId}' requires a unit field.`);
|
|
1179
|
+
}
|
|
1180
|
+
assertNonEmpty2(input.value, `property '${propertyId}' value field`);
|
|
1181
|
+
assertNonEmpty2(input.unit, `property '${propertyId}' unit field`);
|
|
1182
|
+
return { valueField: input.value, unitField: input.unit };
|
|
1183
|
+
}
|
|
1054
1184
|
function fromForeignKey(input) {
|
|
1055
1185
|
validateLinkProjectionTarget(input.link);
|
|
1056
1186
|
if (input.sourceProperty) {
|
|
@@ -1103,7 +1233,16 @@ function buildLinkProjection(id, linkToken) {
|
|
|
1103
1233
|
function isObjectProjectionDefinition(value) {
|
|
1104
1234
|
if (!isRecord(value))
|
|
1105
1235
|
return false;
|
|
1106
|
-
return value._tag === "ObjectProjectionDefinition" && typeof value.id === "string" && typeof value.objectTypeId === "string" && typeof value.datasetId === "string" && isRecord(value.properties) && isRecord(value.links);
|
|
1236
|
+
return value._tag === "ObjectProjectionDefinition" && typeof value.id === "string" && typeof value.objectTypeId === "string" && typeof value.datasetId === "string" && isRecord(value.properties) && isRecord(value.links) && isSourceEditConflictResolution(value.conflictResolution);
|
|
1237
|
+
}
|
|
1238
|
+
function isSourceEditConflictResolution(value) {
|
|
1239
|
+
if (value === undefined)
|
|
1240
|
+
return true;
|
|
1241
|
+
if (!isRecord(value) || typeof value.strategy !== "string")
|
|
1242
|
+
return false;
|
|
1243
|
+
if (value.strategy === "editsWin")
|
|
1244
|
+
return value.sourceTimestamp === undefined;
|
|
1245
|
+
return value.strategy === "mostRecent" && typeof value.sourceTimestamp === "string";
|
|
1107
1246
|
}
|
|
1108
1247
|
function isLinkProjectionDefinition(value) {
|
|
1109
1248
|
if (!isRecord(value))
|
|
@@ -1113,7 +1252,12 @@ function isLinkProjectionDefinition(value) {
|
|
|
1113
1252
|
function isTelemetryProjectionDefinition(value) {
|
|
1114
1253
|
if (!isRecord(value))
|
|
1115
1254
|
return false;
|
|
1116
|
-
return value._tag === "TelemetryProjectionDefinition" && typeof value.id === "string" && typeof value.objectTypeId === "string" && typeof value.
|
|
1255
|
+
return value._tag === "TelemetryProjectionDefinition" && typeof value.id === "string" && typeof value.objectTypeId === "string" && typeof value.datasetId === "string" && typeof value.objectIdField === "string" && typeof value.atField === "string" && isTelemetryProjectionProperties(value.properties);
|
|
1256
|
+
}
|
|
1257
|
+
function isTelemetryProjectionProperties(value) {
|
|
1258
|
+
if (!isRecord(value) || Object.keys(value).length === 0)
|
|
1259
|
+
return false;
|
|
1260
|
+
return Object.values(value).every((mapping) => isRecord(mapping) && typeof mapping.valueField === "string" && (mapping.unitField === undefined || typeof mapping.unitField === "string"));
|
|
1117
1261
|
}
|
|
1118
1262
|
function isProjectionDefinition(value) {
|
|
1119
1263
|
return isObjectProjectionDefinition(value) || isLinkProjectionDefinition(value) || isTelemetryProjectionDefinition(value);
|
|
@@ -1165,4 +1309,4 @@ function emptyGrantIndex() {
|
|
|
1165
1309
|
}
|
|
1166
1310
|
export { ProjectionValidationError, computeProjectionOwnership, validateProjectionOwnership, validateTelemetryProjectionFieldMapping, validateProjectionsAtStartup, defineProjection, fromForeignKey, isObjectProjectionDefinition, isLinkProjectionDefinition, isTelemetryProjectionDefinition, isProjectionDefinition, projectionTargetOf, GRANT_KINDS, grantKindOf, createPrincipalRuntimeAuthorization, createAgentRuntimeAuthorization, createDisabledRuntimeAuthorization, createTrustedPrimitiveRuntimeAuthorization, getAuthorizationRef, resolveExecutionScopeAuthorization, AuthorizationError, evaluate, isAllowed, assertAuthorized, assertCanEdit, assertCanAppendTelemetry, assertCanManageConnector, assertPrivileged, assertProviderAccess, isApplicationAccessControlled, canAccessApplication, canViewEvent, resolveRoleGrants, resolveAuthorizationContext, canViewActionRun, canViewWorkflowRun, canViewWorkflowIntervention, canViewPipelineRun, canViewProjectionRun, canViewProjection, emptyGrantIndex };
|
|
1167
1311
|
|
|
1168
|
-
//# debugId=
|
|
1312
|
+
//# debugId=48D20BF42F9CD3F464756E2164756E21
|