@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
|
@@ -4,11 +4,18 @@ import {
|
|
|
4
4
|
ObjectQueryPlanningError,
|
|
5
5
|
ObjectQueryValidationError,
|
|
6
6
|
normalizeObjectQuery
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-rte5sm3z.js";
|
|
8
8
|
import {
|
|
9
9
|
compareQueryScalarValues,
|
|
10
|
+
linkBatchKey,
|
|
11
|
+
objectBatchKey,
|
|
12
|
+
objectLinkCursor,
|
|
10
13
|
queryScalarValuesEqual
|
|
11
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-1wk20wn3.js";
|
|
15
|
+
import {
|
|
16
|
+
assertAuthorized,
|
|
17
|
+
isAllowed
|
|
18
|
+
} from "./chunk-f83ka50g.js";
|
|
12
19
|
import {
|
|
13
20
|
validatePropertyValue,
|
|
14
21
|
validateSchemaValue
|
|
@@ -20,12 +27,13 @@ import {
|
|
|
20
27
|
formatUnknownObjectTypeMessage
|
|
21
28
|
} from "./chunk-dktq02ne.js";
|
|
22
29
|
import {
|
|
23
|
-
|
|
24
|
-
} from "./chunk-
|
|
30
|
+
stableJsonStringify
|
|
31
|
+
} from "./chunk-t8t39h7v.js";
|
|
25
32
|
// src/objects/query/planner.ts
|
|
26
33
|
var DEFAULT_MAX_FALLBACK_ROWS = 1000;
|
|
27
34
|
var fallbackNodeKinds = new Set([
|
|
28
35
|
"start",
|
|
36
|
+
"refs",
|
|
29
37
|
"filter",
|
|
30
38
|
"sort",
|
|
31
39
|
"limit",
|
|
@@ -122,6 +130,8 @@ function collectNodeProviderIssues(query, path, capabilities, issues) {
|
|
|
122
130
|
addIssue(issues, path, "include_subtypes_not_supported", "Provider does not support start.includeSubtypes expansion");
|
|
123
131
|
}
|
|
124
132
|
return;
|
|
133
|
+
case "refs":
|
|
134
|
+
return;
|
|
125
135
|
case "filter":
|
|
126
136
|
collectPredicateProviderIssues(query.predicate, `${path}.predicate`, capabilities, issues);
|
|
127
137
|
collectNodeProviderIssues(query.input, `${path}.input`, capabilities, issues);
|
|
@@ -269,6 +279,7 @@ function collectFallbackNodeIssues(query, path, issues) {
|
|
|
269
279
|
}
|
|
270
280
|
switch (query.kind) {
|
|
271
281
|
case "start":
|
|
282
|
+
case "refs":
|
|
272
283
|
return;
|
|
273
284
|
case "filter":
|
|
274
285
|
case "limit":
|
|
@@ -301,6 +312,7 @@ function hasExplicitResultBound(query) {
|
|
|
301
312
|
switch (query.kind) {
|
|
302
313
|
case "limit":
|
|
303
314
|
case "page":
|
|
315
|
+
case "refs":
|
|
304
316
|
return true;
|
|
305
317
|
case "start":
|
|
306
318
|
return false;
|
|
@@ -317,6 +329,7 @@ function addIssue(issues, path, code, message) {
|
|
|
317
329
|
// src/objects/query/validate.ts
|
|
318
330
|
var DEFAULT_MAX_LIMIT = 1000;
|
|
319
331
|
var DEFAULT_MAX_PAGE_SIZE = 1000;
|
|
332
|
+
var DEFAULT_MAX_REFS = 1000;
|
|
320
333
|
function validateObjectQuery(query, options) {
|
|
321
334
|
const normalized = options.normalize === false ? query : normalizeObjectQuery(query);
|
|
322
335
|
const ctx = createValidationContext(options);
|
|
@@ -345,6 +358,7 @@ function createValidationContext(options) {
|
|
|
345
358
|
valueTypesById: options.ontology.getValueTypesById(),
|
|
346
359
|
maxLimit: options.maxLimit ?? DEFAULT_MAX_LIMIT,
|
|
347
360
|
maxPageSize: options.maxPageSize ?? DEFAULT_MAX_PAGE_SIZE,
|
|
361
|
+
maxRefs: options.maxRefs ?? DEFAULT_MAX_REFS,
|
|
348
362
|
issues: [],
|
|
349
363
|
touchedObjectTypeIds: new Set
|
|
350
364
|
};
|
|
@@ -360,6 +374,8 @@ function dispatchQueryNode(query, path, ctx) {
|
|
|
360
374
|
switch (query.kind) {
|
|
361
375
|
case "start":
|
|
362
376
|
return validateStart(query.objectTypeId, query.includeSubtypes, path, ctx);
|
|
377
|
+
case "refs":
|
|
378
|
+
return validateRefs(query.refs, path, ctx);
|
|
363
379
|
case "filter": {
|
|
364
380
|
const input = validateQueryNode(query.input, `${path}.input`, ctx);
|
|
365
381
|
const predicate = validatePredicate(query.predicate, input.result, `${path}.predicate`, ctx);
|
|
@@ -419,6 +435,32 @@ function dispatchQueryNode(query, path, ctx) {
|
|
|
419
435
|
}
|
|
420
436
|
}
|
|
421
437
|
}
|
|
438
|
+
function validateRefs(refs, path, ctx) {
|
|
439
|
+
if (refs.length === 0) {
|
|
440
|
+
addIssue2(ctx, `${path}.refs`, "empty_refs", "refs must include at least one object reference");
|
|
441
|
+
}
|
|
442
|
+
if (refs.length > ctx.maxRefs) {
|
|
443
|
+
addIssue2(ctx, `${path}.refs`, "too_many_refs", `refs must include at most ${ctx.maxRefs} object references`);
|
|
444
|
+
}
|
|
445
|
+
const objectTypeIds = new Set;
|
|
446
|
+
refs.forEach((ref, index) => {
|
|
447
|
+
const refPath = `${path}.refs[${index}]`;
|
|
448
|
+
if (!ref.objectTypeId) {
|
|
449
|
+
addIssue2(ctx, `${refPath}.objectTypeId`, "missing_object_type", "objectTypeId is required");
|
|
450
|
+
} else if (!ctx.ontology.getObjectTypeById(ref.objectTypeId)) {
|
|
451
|
+
addIssue2(ctx, `${refPath}.objectTypeId`, "unknown_object_type", formatUnknownObjectTypeMessage(ref.objectTypeId));
|
|
452
|
+
} else {
|
|
453
|
+
objectTypeIds.add(ref.objectTypeId);
|
|
454
|
+
}
|
|
455
|
+
if (!ref.primaryId) {
|
|
456
|
+
addIssue2(ctx, `${refPath}.primaryId`, "missing_primary_id", "primaryId is required");
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
return {
|
|
460
|
+
result: { objectTypeIds: [...objectTypeIds] },
|
|
461
|
+
query: { kind: "refs", refs: refs.map((ref) => ({ ...ref })) }
|
|
462
|
+
};
|
|
463
|
+
}
|
|
422
464
|
function validateStart(objectTypeId, includeSubtypes, path, ctx) {
|
|
423
465
|
if (!objectTypeId) {
|
|
424
466
|
addIssue2(ctx, path, "missing_object_type", "start.objectTypeId is required");
|
|
@@ -984,6 +1026,7 @@ async function executeObjectQuery(input, options) {
|
|
|
984
1026
|
ontology: options.ontology,
|
|
985
1027
|
maxLimit: options.maxLimit,
|
|
986
1028
|
maxPageSize: options.maxPageSize,
|
|
1029
|
+
maxRefs: options.maxRefs,
|
|
987
1030
|
normalize: false
|
|
988
1031
|
});
|
|
989
1032
|
assertQueryViewable(validated, options);
|
|
@@ -1036,6 +1079,7 @@ async function countObjects(input, options) {
|
|
|
1036
1079
|
ontology: options.ontology,
|
|
1037
1080
|
maxLimit: options.maxLimit,
|
|
1038
1081
|
maxPageSize: options.maxPageSize,
|
|
1082
|
+
maxRefs: options.maxRefs,
|
|
1039
1083
|
normalize: false
|
|
1040
1084
|
});
|
|
1041
1085
|
assertQueryViewable(validated, options);
|
|
@@ -1089,6 +1133,7 @@ async function existsObjects(input, options) {
|
|
|
1089
1133
|
ontology: options.ontology,
|
|
1090
1134
|
maxLimit: options.maxLimit,
|
|
1091
1135
|
maxPageSize: options.maxPageSize,
|
|
1136
|
+
maxRefs: options.maxRefs,
|
|
1092
1137
|
normalize: false
|
|
1093
1138
|
});
|
|
1094
1139
|
assertQueryViewable(validated, options);
|
|
@@ -1142,6 +1187,7 @@ async function facetObjects(input, options) {
|
|
|
1142
1187
|
ontology: options.ontology,
|
|
1143
1188
|
maxLimit: options.maxLimit,
|
|
1144
1189
|
maxPageSize: options.maxPageSize,
|
|
1190
|
+
maxRefs: options.maxRefs,
|
|
1145
1191
|
normalize: false
|
|
1146
1192
|
});
|
|
1147
1193
|
assertQueryViewable(validated, options);
|
|
@@ -1222,6 +1268,7 @@ function resolveExpansions(query, ctx) {
|
|
|
1222
1268
|
};
|
|
1223
1269
|
}
|
|
1224
1270
|
case "start":
|
|
1271
|
+
case "refs":
|
|
1225
1272
|
return query;
|
|
1226
1273
|
case "set":
|
|
1227
1274
|
return {
|
|
@@ -1305,6 +1352,8 @@ function expandIncludeSubtypes(query, ontology) {
|
|
|
1305
1352
|
inputs: objectTypeIds.map((objectTypeId) => ({ kind: "start", objectTypeId }))
|
|
1306
1353
|
};
|
|
1307
1354
|
}
|
|
1355
|
+
case "refs":
|
|
1356
|
+
return query;
|
|
1308
1357
|
case "filter":
|
|
1309
1358
|
case "text":
|
|
1310
1359
|
case "vector":
|
|
@@ -1336,6 +1385,8 @@ async function evaluateFallbackQuery(projectId, query, options, maxRows) {
|
|
|
1336
1385
|
switch (query.kind) {
|
|
1337
1386
|
case "start":
|
|
1338
1387
|
return evaluateFallbackStart(projectId, query, options, maxRows);
|
|
1388
|
+
case "refs":
|
|
1389
|
+
return evaluateFallbackRefs(projectId, query, options);
|
|
1339
1390
|
case "filter": {
|
|
1340
1391
|
const input = await evaluateFallbackQuery(projectId, query.input, options, maxRows);
|
|
1341
1392
|
return completeFallbackEvaluation(input.entries.filter((entry) => matchesPredicate(entry.row, query.predicate)));
|
|
@@ -1397,6 +1448,16 @@ async function evaluateFallbackQuery(projectId, query, options, maxRows) {
|
|
|
1397
1448
|
throw new ObjectQueryExecutionError("fallback_node_not_supported", `Fallback execution does not support query node '${query.kind}'`);
|
|
1398
1449
|
}
|
|
1399
1450
|
}
|
|
1451
|
+
async function evaluateFallbackRefs(projectId, query, options) {
|
|
1452
|
+
const rows = await options.storage.getByPrimaryIdBatch({
|
|
1453
|
+
projectId,
|
|
1454
|
+
items: query.refs
|
|
1455
|
+
});
|
|
1456
|
+
return completeFallbackEvaluation(query.refs.flatMap((ref, order) => {
|
|
1457
|
+
const row = rows.get(objectBatchKey(ref.objectTypeId, ref.primaryId));
|
|
1458
|
+
return row ? [{ row, order }] : [];
|
|
1459
|
+
}));
|
|
1460
|
+
}
|
|
1400
1461
|
async function hydrateExpansions(projectId, parents, expansions, options) {
|
|
1401
1462
|
if (expansions.length === 0) {
|
|
1402
1463
|
return parents.map((parent) => ({ ...parent }));
|
|
@@ -1436,7 +1497,7 @@ async function collectOutgoingEdges(projectId, parents, expansion, options) {
|
|
|
1436
1497
|
}))
|
|
1437
1498
|
});
|
|
1438
1499
|
return parents.map((parent) => {
|
|
1439
|
-
const links = linksByKey.get(
|
|
1500
|
+
const links = linksByKey.get(linkBatchKey(parent.objectTypeId, parent.primaryId, expansion.linkId));
|
|
1440
1501
|
if (!links)
|
|
1441
1502
|
return [];
|
|
1442
1503
|
return links.map((link) => ({
|
|
@@ -1572,7 +1633,7 @@ function toLinkValue(rows, cardinality) {
|
|
|
1572
1633
|
return rows;
|
|
1573
1634
|
}
|
|
1574
1635
|
function targetKey(objectTypeId, id) {
|
|
1575
|
-
return
|
|
1636
|
+
return objectBatchKey(objectTypeId, id);
|
|
1576
1637
|
}
|
|
1577
1638
|
async function evaluateFallbackStart(projectId, query, options, maxRows) {
|
|
1578
1639
|
const objectTypeIds = query.includeSubtypes ? [query.objectTypeId, ...options.ontology.listSubTypes(query.objectTypeId)] : [query.objectTypeId];
|
|
@@ -1769,7 +1830,7 @@ function facetValueSortKey(value) {
|
|
|
1769
1830
|
return JSON.stringify(value) ?? String(value);
|
|
1770
1831
|
}
|
|
1771
1832
|
function rowIdentityKey(row) {
|
|
1772
|
-
return
|
|
1833
|
+
return objectBatchKey(row.objectTypeId, row.primaryId);
|
|
1773
1834
|
}
|
|
1774
1835
|
function encodePageOffset(offset) {
|
|
1775
1836
|
return `${PAGE_TOKEN_PREFIX}${offset}`;
|
|
@@ -1796,12 +1857,14 @@ function explainObjectQuery(query, options = {}) {
|
|
|
1796
1857
|
ontology: options.ontology,
|
|
1797
1858
|
maxLimit: options.maxLimit,
|
|
1798
1859
|
maxPageSize: options.maxPageSize,
|
|
1860
|
+
maxRefs: options.maxRefs,
|
|
1799
1861
|
normalize: false
|
|
1800
1862
|
}) : [];
|
|
1801
1863
|
const result = options.ontology && issues.length === 0 ? validateObjectQuery(normalizedQuery, {
|
|
1802
1864
|
ontology: options.ontology,
|
|
1803
1865
|
maxLimit: options.maxLimit,
|
|
1804
1866
|
maxPageSize: options.maxPageSize,
|
|
1867
|
+
maxRefs: options.maxRefs,
|
|
1805
1868
|
normalize: false
|
|
1806
1869
|
}).result : undefined;
|
|
1807
1870
|
return {
|
|
@@ -1826,6 +1889,14 @@ function buildExplainNode(query, path) {
|
|
|
1826
1889
|
},
|
|
1827
1890
|
children: []
|
|
1828
1891
|
};
|
|
1892
|
+
case "refs":
|
|
1893
|
+
return {
|
|
1894
|
+
path,
|
|
1895
|
+
kind: query.kind,
|
|
1896
|
+
summary: `refs ${query.refs.length}`,
|
|
1897
|
+
details: { refs: query.refs },
|
|
1898
|
+
children: []
|
|
1899
|
+
};
|
|
1829
1900
|
case "filter":
|
|
1830
1901
|
return {
|
|
1831
1902
|
path,
|
|
@@ -1943,6 +2014,185 @@ function summarizeSortField(field) {
|
|
|
1943
2014
|
return `relevance ${field.direction ?? "desc"}`;
|
|
1944
2015
|
return `${field.propertyId} ${field.direction ?? "asc"}`;
|
|
1945
2016
|
}
|
|
1946
|
-
|
|
2017
|
+
// src/objects/query/links.ts
|
|
2018
|
+
import { createHash } from "crypto";
|
|
2019
|
+
var MAX_LINK_QUERY_OBJECTS = 1000;
|
|
2020
|
+
var MAX_LINK_PAGE_SIZE = 1000;
|
|
2021
|
+
var DEFAULT_LINK_PAGE_SIZE = 100;
|
|
2022
|
+
var LINK_PAGE_TOKEN_PREFIX = "link:v1:";
|
|
2023
|
+
async function executeObjectQueryLinks(input, options) {
|
|
2024
|
+
const direction = input.direction ?? "both";
|
|
2025
|
+
if (direction !== "outgoing" && direction !== "incoming" && direction !== "both") {
|
|
2026
|
+
throw new ObjectQueryExecutionError("invalid_link_direction", "direction must be 'outgoing', 'incoming', or 'both'", "$.direction");
|
|
2027
|
+
}
|
|
2028
|
+
if (input.linkId !== undefined && input.linkId.length === 0) {
|
|
2029
|
+
throw new ObjectQueryExecutionError("invalid_link_id", "linkId must not be empty", "$.linkId");
|
|
2030
|
+
}
|
|
2031
|
+
const pageSize = input.pageSize ?? DEFAULT_LINK_PAGE_SIZE;
|
|
2032
|
+
if (!Number.isInteger(pageSize) || pageSize <= 0 || pageSize > MAX_LINK_PAGE_SIZE) {
|
|
2033
|
+
throw new ObjectQueryExecutionError("invalid_link_page_size", `pageSize must be an integer between 1 and ${MAX_LINK_PAGE_SIZE}`, "$.pageSize");
|
|
2034
|
+
}
|
|
2035
|
+
const validated = validateObjectQuery(normalizeObjectQuery(input.query), {
|
|
2036
|
+
ontology: options.ontology,
|
|
2037
|
+
maxLimit: options.maxLimit,
|
|
2038
|
+
maxPageSize: options.maxPageSize,
|
|
2039
|
+
maxRefs: options.maxRefs,
|
|
2040
|
+
normalize: false
|
|
2041
|
+
});
|
|
2042
|
+
assertLinkSelectorShape(validated.query);
|
|
2043
|
+
const selectorQuery = validated.query;
|
|
2044
|
+
const pageScope = linkPageScope(input.projectId, selectorQuery, direction, input.linkId);
|
|
2045
|
+
const cursor = decodeLinkPageToken(input.pageToken, pageScope);
|
|
2046
|
+
const boundedSelector = selectorQuery.kind === "page" ? selectorQuery : { kind: "limit", limit: MAX_LINK_QUERY_OBJECTS + 1, input: selectorQuery };
|
|
2047
|
+
const selection = await executeObjectQuery({
|
|
2048
|
+
projectId: input.projectId,
|
|
2049
|
+
query: boundedSelector,
|
|
2050
|
+
includeTotal: false
|
|
2051
|
+
}, {
|
|
2052
|
+
...options,
|
|
2053
|
+
maxLimit: Math.max(options.maxLimit ?? 1000, MAX_LINK_QUERY_OBJECTS + 1)
|
|
2054
|
+
});
|
|
2055
|
+
if (selection.objects.length > MAX_LINK_QUERY_OBJECTS) {
|
|
2056
|
+
throw new ObjectQueryExecutionError("link_query_object_limit_exceeded", `Link query selected more than ${MAX_LINK_QUERY_OBJECTS} objects; add a limit or page node`, "$.query");
|
|
2057
|
+
}
|
|
2058
|
+
const selected = selection.objects;
|
|
2059
|
+
if (selected.length === 0) {
|
|
2060
|
+
return { objects: [], links: [], hasMore: false };
|
|
2061
|
+
}
|
|
2062
|
+
const endpointObjectTypeIds = visibleEndpointTypeIds(options);
|
|
2063
|
+
const page = await options.storage.queryLinks({
|
|
2064
|
+
projectId: input.projectId,
|
|
2065
|
+
objectRefs: selected.map((row) => ({
|
|
2066
|
+
objectTypeId: row.objectTypeId,
|
|
2067
|
+
primaryId: row.primaryId
|
|
2068
|
+
})),
|
|
2069
|
+
direction,
|
|
2070
|
+
...input.linkId === undefined ? {} : { linkId: input.linkId },
|
|
2071
|
+
...endpointObjectTypeIds === undefined ? {} : { endpointObjectTypeIds },
|
|
2072
|
+
...cursor === undefined ? {} : { after: cursor },
|
|
2073
|
+
limit: pageSize
|
|
2074
|
+
});
|
|
2075
|
+
const lastLink = page.links.at(-1);
|
|
2076
|
+
let nextPageToken;
|
|
2077
|
+
if (page.hasMore) {
|
|
2078
|
+
if (!lastLink) {
|
|
2079
|
+
throw new Error("[Sixb] Object storage returned hasMore for an empty link page.");
|
|
2080
|
+
}
|
|
2081
|
+
nextPageToken = encodeLinkPageToken(objectLinkCursor(lastLink), pageScope);
|
|
2082
|
+
}
|
|
2083
|
+
const objects = input.includeObjects ? await hydrateLinkQueryObjects(input.projectId, selected, page.links, options.storage) : [];
|
|
2084
|
+
return {
|
|
2085
|
+
objects,
|
|
2086
|
+
links: page.links,
|
|
2087
|
+
hasMore: page.hasMore,
|
|
2088
|
+
...nextPageToken ? { nextPageToken } : {}
|
|
2089
|
+
};
|
|
2090
|
+
}
|
|
2091
|
+
function assertLinkSelectorShape(query, path = "$.query", root = true) {
|
|
2092
|
+
switch (query.kind) {
|
|
2093
|
+
case "project":
|
|
2094
|
+
case "expand":
|
|
2095
|
+
throw new ObjectQueryExecutionError("link_selector_output_shape_not_supported", `Link selectors do not support '${query.kind}' nodes; remove output shaping from the selector`, path);
|
|
2096
|
+
case "page":
|
|
2097
|
+
if (!root) {
|
|
2098
|
+
throw new ObjectQueryExecutionError("link_selector_page_must_be_root", "A page node in a link selector must be the outermost node", path);
|
|
2099
|
+
}
|
|
2100
|
+
assertLinkSelectorShape(query.input, `${path}.input`, false);
|
|
2101
|
+
return;
|
|
2102
|
+
case "start":
|
|
2103
|
+
case "refs":
|
|
2104
|
+
return;
|
|
2105
|
+
case "set": {
|
|
2106
|
+
for (const [index, input] of query.inputs.entries()) {
|
|
2107
|
+
assertLinkSelectorShape(input, `${path}.inputs[${index}]`, false);
|
|
2108
|
+
}
|
|
2109
|
+
return;
|
|
2110
|
+
}
|
|
2111
|
+
case "filter":
|
|
2112
|
+
case "text":
|
|
2113
|
+
case "vector":
|
|
2114
|
+
case "traverse":
|
|
2115
|
+
case "sort":
|
|
2116
|
+
case "limit":
|
|
2117
|
+
assertLinkSelectorShape(query.input, `${path}.input`, false);
|
|
2118
|
+
return;
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
function visibleEndpointTypeIds(options) {
|
|
2122
|
+
if (!options.authorization)
|
|
2123
|
+
return;
|
|
2124
|
+
return options.ontology.listObjectTypes().filter((objectType) => isAllowed(options.authorization, { kind: "object.view", objectTypeId: objectType.id })).map((objectType) => objectType.id);
|
|
2125
|
+
}
|
|
2126
|
+
function objectIdentity(objectTypeId, primaryId) {
|
|
2127
|
+
return objectBatchKey(objectTypeId, primaryId);
|
|
2128
|
+
}
|
|
2129
|
+
function linkPageScope(projectId, query, direction, linkId) {
|
|
2130
|
+
return createHash("sha256").update(stableJsonStringify({
|
|
2131
|
+
projectId,
|
|
2132
|
+
query,
|
|
2133
|
+
direction,
|
|
2134
|
+
linkId: linkId ?? null
|
|
2135
|
+
})).digest("base64url");
|
|
2136
|
+
}
|
|
2137
|
+
function encodeLinkPageToken(cursor, scope) {
|
|
2138
|
+
const payload = { version: 1, scope, cursor };
|
|
2139
|
+
return `${LINK_PAGE_TOKEN_PREFIX}${Buffer.from(JSON.stringify(payload)).toString("base64url")}`;
|
|
2140
|
+
}
|
|
2141
|
+
function decodeLinkPageToken(token, expectedScope) {
|
|
2142
|
+
if (token === undefined)
|
|
2143
|
+
return;
|
|
2144
|
+
try {
|
|
2145
|
+
if (!token.startsWith(LINK_PAGE_TOKEN_PREFIX))
|
|
2146
|
+
throw new Error("invalid prefix");
|
|
2147
|
+
const value = JSON.parse(Buffer.from(token.slice(LINK_PAGE_TOKEN_PREFIX.length), "base64url").toString("utf8"));
|
|
2148
|
+
if (!isPlainObject2(value) || value.version !== 1 || typeof value.scope !== "string" || !isObjectLinkCursor(value.cursor)) {
|
|
2149
|
+
throw new Error("invalid cursor");
|
|
2150
|
+
}
|
|
2151
|
+
if (value.scope !== expectedScope) {
|
|
2152
|
+
throw new Error("cursor scope mismatch");
|
|
2153
|
+
}
|
|
2154
|
+
return value.cursor;
|
|
2155
|
+
} catch {
|
|
2156
|
+
throw new ObjectQueryExecutionError("invalid_link_page_token", "pageToken is not a valid object-links cursor", "$.pageToken");
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
function isObjectLinkCursor(value) {
|
|
2160
|
+
return Array.isArray(value) && value.length === 5 && value.every((part) => typeof part === "string");
|
|
2161
|
+
}
|
|
2162
|
+
function isPlainObject2(value) {
|
|
2163
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2164
|
+
}
|
|
2165
|
+
async function hydrateLinkQueryObjects(projectId, selected, links, storage) {
|
|
2166
|
+
const byIdentity = new Map(selected.map((row) => [objectIdentity(row.objectTypeId, row.primaryId), row]));
|
|
2167
|
+
const orderedIdentities = selected.map((row) => objectIdentity(row.objectTypeId, row.primaryId));
|
|
2168
|
+
const seenIdentities = new Set(orderedIdentities);
|
|
2169
|
+
const missingRefs = [];
|
|
2170
|
+
for (const link of links) {
|
|
2171
|
+
for (const ref of [
|
|
2172
|
+
{ objectTypeId: link.sourceTypeId, primaryId: link.sourceId },
|
|
2173
|
+
{ objectTypeId: link.targetTypeId, primaryId: link.targetId }
|
|
2174
|
+
]) {
|
|
2175
|
+
const identity = objectIdentity(ref.objectTypeId, ref.primaryId);
|
|
2176
|
+
if (seenIdentities.has(identity))
|
|
2177
|
+
continue;
|
|
2178
|
+
seenIdentities.add(identity);
|
|
2179
|
+
orderedIdentities.push(identity);
|
|
2180
|
+
missingRefs.push(ref);
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
if (missingRefs.length > 0) {
|
|
2184
|
+
const hydrated = await storage.getByPrimaryIdBatch({ projectId, items: missingRefs });
|
|
2185
|
+
for (const ref of missingRefs) {
|
|
2186
|
+
const row = hydrated.get(objectBatchKey(ref.objectTypeId, ref.primaryId));
|
|
2187
|
+
if (row)
|
|
2188
|
+
byIdentity.set(objectIdentity(ref.objectTypeId, ref.primaryId), row);
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
return orderedIdentities.flatMap((identity) => {
|
|
2192
|
+
const row = byIdentity.get(identity);
|
|
2193
|
+
return row ? [row] : [];
|
|
2194
|
+
});
|
|
2195
|
+
}
|
|
2196
|
+
export { planObjectQuery, validateObjectQuery, collectObjectQueryValidationIssues, resolveObjectQueryResultShape, executeObjectQuery, countObjects, existsObjects, facetObjects, explainObjectQuery, executeObjectQueryLinks };
|
|
1947
2197
|
|
|
1948
|
-
//# debugId=
|
|
2198
|
+
//# debugId=6AF3162EF872D1D064756E2164756E21
|