@sixb/core 0.0.1
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/LICENSE +21 -0
- package/README.md +470 -0
- package/dist/actions/builders/define-action.d.ts +7 -0
- package/dist/actions/builders/define-action.d.ts.map +1 -0
- package/dist/actions/builders/params.d.ts +23 -0
- package/dist/actions/builders/params.d.ts.map +1 -0
- package/dist/actions/builders.d.ts +3 -0
- package/dist/actions/builders.d.ts.map +1 -0
- package/dist/actions/commit-edits.d.ts +54 -0
- package/dist/actions/commit-edits.d.ts.map +1 -0
- package/dist/actions/errors.d.ts +9 -0
- package/dist/actions/errors.d.ts.map +1 -0
- package/dist/actions/index.d.ts +14 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +73 -0
- package/dist/actions/index.js.map +9 -0
- package/dist/actions/read-facade.d.ts +56 -0
- package/dist/actions/read-facade.d.ts.map +1 -0
- package/dist/actions/registry.d.ts +17 -0
- package/dist/actions/registry.d.ts.map +1 -0
- package/dist/actions/request.d.ts +37 -0
- package/dist/actions/request.d.ts.map +1 -0
- package/dist/actions/run-id.d.ts +3 -0
- package/dist/actions/run-id.d.ts.map +1 -0
- package/dist/actions/runtime.d.ts +11 -0
- package/dist/actions/runtime.d.ts.map +1 -0
- package/dist/actions/types/context.d.ts +147 -0
- package/dist/actions/types/context.d.ts.map +1 -0
- package/dist/actions/types/definitions.d.ts +67 -0
- package/dist/actions/types/definitions.d.ts.map +1 -0
- package/dist/actions/types/handlers.d.ts +19 -0
- package/dist/actions/types/handlers.d.ts.map +1 -0
- package/dist/actions/types/params.d.ts +45 -0
- package/dist/actions/types/params.d.ts.map +1 -0
- package/dist/actions/types.d.ts +5 -0
- package/dist/actions/types.d.ts.map +1 -0
- package/dist/actions/validation.d.ts +33 -0
- package/dist/actions/validation.d.ts.map +1 -0
- package/dist/actions/validators.d.ts +8 -0
- package/dist/actions/validators.d.ts.map +1 -0
- package/dist/actions/worker.d.ts +3 -0
- package/dist/actions/worker.d.ts.map +1 -0
- package/dist/actions/worker.js +324 -0
- package/dist/actions/worker.js.map +11 -0
- package/dist/agents/adapters.d.ts +185 -0
- package/dist/agents/adapters.d.ts.map +1 -0
- package/dist/agents/api-gateway.d.ts +21 -0
- package/dist/agents/api-gateway.d.ts.map +1 -0
- package/dist/agents/builders.d.ts +10 -0
- package/dist/agents/builders.d.ts.map +1 -0
- package/dist/agents/context-model.d.ts +4 -0
- package/dist/agents/context-model.d.ts.map +1 -0
- package/dist/agents/context-resolution.d.ts +5 -0
- package/dist/agents/context-resolution.d.ts.map +1 -0
- package/dist/agents/context.d.ts +57 -0
- package/dist/agents/context.d.ts.map +1 -0
- package/dist/agents/context.js +23 -0
- package/dist/agents/context.js.map +9 -0
- package/dist/agents/dispatch.d.ts +36 -0
- package/dist/agents/dispatch.d.ts.map +1 -0
- package/dist/agents/errors.d.ts +27 -0
- package/dist/agents/errors.d.ts.map +1 -0
- package/dist/agents/ids.d.ts +11 -0
- package/dist/agents/ids.d.ts.map +1 -0
- package/dist/agents/index.d.ts +24 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +121 -0
- package/dist/agents/index.js.map +9 -0
- package/dist/agents/message.d.ts +78 -0
- package/dist/agents/message.d.ts.map +1 -0
- package/dist/agents/prompt.d.ts +15 -0
- package/dist/agents/prompt.d.ts.map +1 -0
- package/dist/agents/request.d.ts +42 -0
- package/dist/agents/request.d.ts.map +1 -0
- package/dist/agents/runtime.d.ts +41 -0
- package/dist/agents/runtime.d.ts.map +1 -0
- package/dist/agents/streams.d.ts +72 -0
- package/dist/agents/streams.d.ts.map +1 -0
- package/dist/agents/streams.js +32 -0
- package/dist/agents/streams.js.map +9 -0
- package/dist/agents/types.d.ts +52 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/validation.d.ts +10 -0
- package/dist/agents/validation.d.ts.map +1 -0
- package/dist/auth/access-tokens.d.ts +19 -0
- package/dist/auth/access-tokens.d.ts.map +1 -0
- package/dist/auth/audience.d.ts +8 -0
- package/dist/auth/audience.d.ts.map +1 -0
- package/dist/auth/cookies.d.ts +50 -0
- package/dist/auth/cookies.d.ts.map +1 -0
- package/dist/auth/csrf.d.ts +8 -0
- package/dist/auth/csrf.d.ts.map +1 -0
- package/dist/auth/errors.d.ts +7 -0
- package/dist/auth/errors.d.ts.map +1 -0
- package/dist/auth/index.d.ts +15 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +101 -0
- package/dist/auth/index.js.map +9 -0
- package/dist/auth/runtime.d.ts +129 -0
- package/dist/auth/runtime.d.ts.map +1 -0
- package/dist/auth/session-cache.d.ts +44 -0
- package/dist/auth/session-cache.d.ts.map +1 -0
- package/dist/auth/sessions.d.ts +16 -0
- package/dist/auth/sessions.d.ts.map +1 -0
- package/dist/auth/strategy.d.ts +11 -0
- package/dist/auth/strategy.d.ts.map +1 -0
- package/dist/auth/strategy.js +14 -0
- package/dist/auth/strategy.js.map +9 -0
- package/dist/auth/types.d.ts +460 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/validation.d.ts +26 -0
- package/dist/auth/validation.d.ts.map +1 -0
- package/dist/authorization/application-access.d.ts +18 -0
- package/dist/authorization/application-access.d.ts.map +1 -0
- package/dist/authorization/decision.d.ts +104 -0
- package/dist/authorization/decision.d.ts.map +1 -0
- package/dist/authorization/errors.d.ts +10 -0
- package/dist/authorization/errors.d.ts.map +1 -0
- package/dist/authorization/event-visibility.d.ts +16 -0
- package/dist/authorization/event-visibility.d.ts.map +1 -0
- package/dist/authorization/grant-kinds.d.ts +48 -0
- package/dist/authorization/grant-kinds.d.ts.map +1 -0
- package/dist/authorization/index.d.ts +11 -0
- package/dist/authorization/index.d.ts.map +1 -0
- package/dist/authorization/index.js +48 -0
- package/dist/authorization/index.js.map +9 -0
- package/dist/authorization/resolve.d.ts +28 -0
- package/dist/authorization/resolve.d.ts.map +1 -0
- package/dist/authorization/run-visibility.d.ts +15 -0
- package/dist/authorization/run-visibility.d.ts.map +1 -0
- package/dist/authorization/types.d.ts +46 -0
- package/dist/authorization/types.d.ts.map +1 -0
- package/dist/blob-storage/browser.d.ts +14 -0
- package/dist/blob-storage/browser.d.ts.map +1 -0
- package/dist/blob-storage/browser.js +22 -0
- package/dist/blob-storage/browser.js.map +9 -0
- package/dist/blob-storage/constants.d.ts +10 -0
- package/dist/blob-storage/constants.d.ts.map +1 -0
- package/dist/blob-storage/derive.d.ts +4 -0
- package/dist/blob-storage/derive.d.ts.map +1 -0
- package/dist/blob-storage/errors.d.ts +7 -0
- package/dist/blob-storage/errors.d.ts.map +1 -0
- package/dist/blob-storage/in-memory.d.ts +10 -0
- package/dist/blob-storage/in-memory.d.ts.map +1 -0
- package/dist/blob-storage/index.d.ts +8 -0
- package/dist/blob-storage/index.d.ts.map +1 -0
- package/dist/blob-storage/index.js +44 -0
- package/dist/blob-storage/index.js.map +9 -0
- package/dist/blob-storage/types.d.ts +126 -0
- package/dist/blob-storage/types.d.ts.map +1 -0
- package/dist/blob-storage/utils.d.ts +9 -0
- package/dist/blob-storage/utils.d.ts.map +1 -0
- package/dist/blob-storage/validation.d.ts +6 -0
- package/dist/blob-storage/validation.d.ts.map +1 -0
- package/dist/bootstrap/discovery.d.ts +34 -0
- package/dist/bootstrap/discovery.d.ts.map +1 -0
- package/dist/bootstrap/index.d.ts +4 -0
- package/dist/bootstrap/index.d.ts.map +1 -0
- package/dist/bootstrap/index.js +80 -0
- package/dist/bootstrap/index.js.map +9 -0
- package/dist/bootstrap/ontology-type-manifest.d.ts +22 -0
- package/dist/bootstrap/ontology-type-manifest.d.ts.map +1 -0
- package/dist/broker/errors.d.ts +12 -0
- package/dist/broker/errors.d.ts.map +1 -0
- package/dist/broker/in-memory.d.ts +53 -0
- package/dist/broker/in-memory.d.ts.map +1 -0
- package/dist/broker/index.d.ts +5 -0
- package/dist/broker/index.d.ts.map +1 -0
- package/dist/broker/index.js +15 -0
- package/dist/broker/index.js.map +9 -0
- package/dist/broker/types.d.ts +119 -0
- package/dist/broker/types.d.ts.map +1 -0
- package/dist/chunk-04b07a9q.js +89 -0
- package/dist/chunk-04b07a9q.js.map +10 -0
- package/dist/chunk-0fygrz37.js +354 -0
- package/dist/chunk-0fygrz37.js.map +17 -0
- package/dist/chunk-0psb6kdw.js +989 -0
- package/dist/chunk-0psb6kdw.js.map +15 -0
- package/dist/chunk-1evzqhks.js +76 -0
- package/dist/chunk-1evzqhks.js.map +10 -0
- package/dist/chunk-1vffvydj.js +109 -0
- package/dist/chunk-1vffvydj.js.map +10 -0
- package/dist/chunk-2ab72m2h.js +59 -0
- package/dist/chunk-2ab72m2h.js.map +10 -0
- package/dist/chunk-2gpr6jsz.js +1968 -0
- package/dist/chunk-2gpr6jsz.js.map +13 -0
- package/dist/chunk-2s6sydsh.js +368 -0
- package/dist/chunk-2s6sydsh.js.map +12 -0
- package/dist/chunk-45tw90k7.js +72 -0
- package/dist/chunk-45tw90k7.js.map +11 -0
- package/dist/chunk-4pycxcj3.js +35 -0
- package/dist/chunk-4pycxcj3.js.map +11 -0
- package/dist/chunk-50kv63vj.js +523 -0
- package/dist/chunk-50kv63vj.js.map +12 -0
- package/dist/chunk-51fjndv0.js +17 -0
- package/dist/chunk-51fjndv0.js.map +11 -0
- package/dist/chunk-590dejbp.js +49 -0
- package/dist/chunk-590dejbp.js.map +10 -0
- package/dist/chunk-5yny9z0e.js +60 -0
- package/dist/chunk-5yny9z0e.js.map +10 -0
- package/dist/chunk-6wetht33.js +89 -0
- package/dist/chunk-6wetht33.js.map +10 -0
- package/dist/chunk-74drx9gd.js +362 -0
- package/dist/chunk-74drx9gd.js.map +11 -0
- package/dist/chunk-867jxh7c.js +1156 -0
- package/dist/chunk-867jxh7c.js.map +19 -0
- package/dist/chunk-88ppkr54.js +257 -0
- package/dist/chunk-88ppkr54.js.map +12 -0
- package/dist/chunk-8r8cw2xw.js +373 -0
- package/dist/chunk-8r8cw2xw.js.map +11 -0
- package/dist/chunk-8ydjhh27.js +95 -0
- package/dist/chunk-8ydjhh27.js.map +11 -0
- package/dist/chunk-9dzba0f2.js +43 -0
- package/dist/chunk-9dzba0f2.js.map +10 -0
- package/dist/chunk-aebzcsxr.js +5272 -0
- package/dist/chunk-aebzcsxr.js.map +48 -0
- package/dist/chunk-b49dgvsj.js +49 -0
- package/dist/chunk-b49dgvsj.js.map +10 -0
- package/dist/chunk-btpe64e4.js +554 -0
- package/dist/chunk-btpe64e4.js.map +13 -0
- package/dist/chunk-c3zd880g.js +629 -0
- package/dist/chunk-c3zd880g.js.map +14 -0
- package/dist/chunk-dcgrzj1t.js +2954 -0
- package/dist/chunk-dcgrzj1t.js.map +36 -0
- package/dist/chunk-dhmj53mx.js +501 -0
- package/dist/chunk-dhmj53mx.js.map +16 -0
- package/dist/chunk-dktq02ne.js +16 -0
- package/dist/chunk-dktq02ne.js.map +10 -0
- package/dist/chunk-f2b5e2gf.js +141 -0
- package/dist/chunk-f2b5e2gf.js.map +11 -0
- package/dist/chunk-gqdd7508.js +273 -0
- package/dist/chunk-gqdd7508.js.map +11 -0
- package/dist/chunk-hsv43v58.js +1390 -0
- package/dist/chunk-hsv43v58.js.map +21 -0
- package/dist/chunk-jdwx7vzs.js +454 -0
- package/dist/chunk-jdwx7vzs.js.map +14 -0
- package/dist/chunk-k25jm1x5.js +102 -0
- package/dist/chunk-k25jm1x5.js.map +10 -0
- package/dist/chunk-k41ajtz7.js +352 -0
- package/dist/chunk-k41ajtz7.js.map +13 -0
- package/dist/chunk-k6j72mtt.js +9 -0
- package/dist/chunk-k6j72mtt.js.map +10 -0
- package/dist/chunk-mx84y05q.js +426 -0
- package/dist/chunk-mx84y05q.js.map +11 -0
- package/dist/chunk-nvamz5dv.js +819 -0
- package/dist/chunk-nvamz5dv.js.map +21 -0
- package/dist/chunk-p6r5g77m.js +113 -0
- package/dist/chunk-p6r5g77m.js.map +10 -0
- package/dist/chunk-pv1yad91.js +1165 -0
- package/dist/chunk-pv1yad91.js.map +27 -0
- package/dist/chunk-q4qzq0ea.js +832 -0
- package/dist/chunk-q4qzq0ea.js.map +14 -0
- package/dist/chunk-r65yscvk.js +187 -0
- package/dist/chunk-r65yscvk.js.map +11 -0
- package/dist/chunk-ry24jbr1.js +50 -0
- package/dist/chunk-ry24jbr1.js.map +10 -0
- package/dist/chunk-t358gywy.js +991 -0
- package/dist/chunk-t358gywy.js.map +34 -0
- package/dist/chunk-t72dvahb.js +167 -0
- package/dist/chunk-t72dvahb.js.map +12 -0
- package/dist/chunk-tsk2bxs3.js +1254 -0
- package/dist/chunk-tsk2bxs3.js.map +17 -0
- package/dist/chunk-v5c085yp.js +49 -0
- package/dist/chunk-v5c085yp.js.map +10 -0
- package/dist/chunk-vj723r3p.js +146 -0
- package/dist/chunk-vj723r3p.js.map +12 -0
- package/dist/chunk-wj01s5hr.js +363 -0
- package/dist/chunk-wj01s5hr.js.map +11 -0
- package/dist/chunk-wxhdnwh4.js +37 -0
- package/dist/chunk-wxhdnwh4.js.map +10 -0
- package/dist/chunk-xqbtf4wn.js +170 -0
- package/dist/chunk-xqbtf4wn.js.map +10 -0
- package/dist/chunk-xwnf87e1.js +324 -0
- package/dist/chunk-xwnf87e1.js.map +13 -0
- package/dist/chunk-xz5g49bp.js +239 -0
- package/dist/chunk-xz5g49bp.js.map +11 -0
- package/dist/chunk-y64skrwp.js +19 -0
- package/dist/chunk-y64skrwp.js.map +9 -0
- package/dist/chunk-ya6brh8a.js +136 -0
- package/dist/chunk-ya6brh8a.js.map +11 -0
- package/dist/chunk-yt8wphsx.js +12 -0
- package/dist/chunk-yt8wphsx.js.map +10 -0
- package/dist/chunk-yvef9xwc.js +3842 -0
- package/dist/chunk-yvef9xwc.js.map +44 -0
- package/dist/chunk-yxss87qa.js +821 -0
- package/dist/chunk-yxss87qa.js.map +14 -0
- package/dist/connectors/builders.d.ts +10 -0
- package/dist/connectors/builders.d.ts.map +1 -0
- package/dist/connectors/errors.d.ts +14 -0
- package/dist/connectors/errors.d.ts.map +1 -0
- package/dist/connectors/index.d.ts +5 -0
- package/dist/connectors/index.d.ts.map +1 -0
- package/dist/connectors/runtime.d.ts +13 -0
- package/dist/connectors/runtime.d.ts.map +1 -0
- package/dist/connectors/types.d.ts +39 -0
- package/dist/connectors/types.d.ts.map +1 -0
- package/dist/datasets/builders.d.ts +54 -0
- package/dist/datasets/builders.d.ts.map +1 -0
- package/dist/datasets/errors.d.ts +4 -0
- package/dist/datasets/errors.d.ts.map +1 -0
- package/dist/datasets/index.d.ts +5 -0
- package/dist/datasets/index.d.ts.map +1 -0
- package/dist/datasets/types.d.ts +23 -0
- package/dist/datasets/types.d.ts.map +1 -0
- package/dist/datasets/validation.d.ts +8 -0
- package/dist/datasets/validation.d.ts.map +1 -0
- package/dist/edits/errors.d.ts +4 -0
- package/dist/edits/errors.d.ts.map +1 -0
- package/dist/edits/index.d.ts +4 -0
- package/dist/edits/index.d.ts.map +1 -0
- package/dist/edits/index.js +14 -0
- package/dist/edits/index.js.map +9 -0
- package/dist/edits/normalize.d.ts +14 -0
- package/dist/edits/normalize.d.ts.map +1 -0
- package/dist/edits/properties.d.ts +25 -0
- package/dist/edits/properties.d.ts.map +1 -0
- package/dist/edits/recorder.d.ts +4 -0
- package/dist/edits/recorder.d.ts.map +1 -0
- package/dist/edits/types.d.ts +159 -0
- package/dist/edits/types.d.ts.map +1 -0
- package/dist/error-reporting/capability.d.ts +57 -0
- package/dist/error-reporting/capability.d.ts.map +1 -0
- package/dist/error-reporting/internal.d.ts +4 -0
- package/dist/error-reporting/internal.d.ts.map +1 -0
- package/dist/error-reporting/internal.js +24 -0
- package/dist/error-reporting/internal.js.map +9 -0
- package/dist/error-reporting/normalize.d.ts +3 -0
- package/dist/error-reporting/normalize.d.ts.map +1 -0
- package/dist/error-reporting/reporter.d.ts +10 -0
- package/dist/error-reporting/reporter.d.ts.map +1 -0
- package/dist/error-reporting/types.d.ts +112 -0
- package/dist/error-reporting/types.d.ts.map +1 -0
- package/dist/events/definitions.d.ts +76 -0
- package/dist/events/definitions.d.ts.map +1 -0
- package/dist/events/envelope.d.ts +56 -0
- package/dist/events/envelope.d.ts.map +1 -0
- package/dist/events/errors.d.ts +8 -0
- package/dist/events/errors.d.ts.map +1 -0
- package/dist/events/index.d.ts +11 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +68 -0
- package/dist/events/index.js.map +9 -0
- package/dist/events/outbox-dispatcher.d.ts +82 -0
- package/dist/events/outbox-dispatcher.d.ts.map +1 -0
- package/dist/events/property-changes.d.ts +16 -0
- package/dist/events/property-changes.d.ts.map +1 -0
- package/dist/events/runtime.d.ts +87 -0
- package/dist/events/runtime.d.ts.map +1 -0
- package/dist/events/scope.d.ts +25 -0
- package/dist/events/scope.d.ts.map +1 -0
- package/dist/events/scope.js +10 -0
- package/dist/events/scope.js.map +9 -0
- package/dist/events/selectors/builder.d.ts +64 -0
- package/dist/events/selectors/builder.d.ts.map +1 -0
- package/dist/events/selectors/index.d.ts +5 -0
- package/dist/events/selectors/index.d.ts.map +1 -0
- package/dist/events/selectors/index.js +15 -0
- package/dist/events/selectors/index.js.map +9 -0
- package/dist/events/selectors/predicate.d.ts +5 -0
- package/dist/events/selectors/predicate.d.ts.map +1 -0
- package/dist/events/selectors/types.d.ts +141 -0
- package/dist/events/selectors/types.d.ts.map +1 -0
- package/dist/events/toStoredEvent.d.ts +10 -0
- package/dist/events/toStoredEvent.d.ts.map +1 -0
- package/dist/events/types/actions.d.ts +39 -0
- package/dist/events/types/actions.d.ts.map +1 -0
- package/dist/events/types/datasets.d.ts +20 -0
- package/dist/events/types/datasets.d.ts.map +1 -0
- package/dist/events/types/index.d.ts +137 -0
- package/dist/events/types/index.d.ts.map +1 -0
- package/dist/events/types/links.d.ts +37 -0
- package/dist/events/types/links.d.ts.map +1 -0
- package/dist/events/types/objects.d.ts +33 -0
- package/dist/events/types/objects.d.ts.map +1 -0
- package/dist/events/types/pipelines.d.ts +59 -0
- package/dist/events/types/pipelines.d.ts.map +1 -0
- package/dist/events/types/rules.d.ts +28 -0
- package/dist/events/types/rules.d.ts.map +1 -0
- package/dist/events/types/schedules.d.ts +14 -0
- package/dist/events/types/schedules.d.ts.map +1 -0
- package/dist/events/types/syncs.d.ts +25 -0
- package/dist/events/types/syncs.d.ts.map +1 -0
- package/dist/events/types/telemetry.d.ts +17 -0
- package/dist/events/types/telemetry.d.ts.map +1 -0
- package/dist/events/types/workflows.d.ts +150 -0
- package/dist/events/types/workflows.d.ts.map +1 -0
- package/dist/http/api-routes.d.ts +24 -0
- package/dist/http/api-routes.d.ts.map +1 -0
- package/dist/http/index.d.ts +4 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +16 -0
- package/dist/http/index.js.map +9 -0
- package/dist/http/route-pattern.d.ts +14 -0
- package/dist/http/route-pattern.d.ts.map +1 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +430 -0
- package/dist/index.js.map +9 -0
- package/dist/json.d.ts +14 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/lake-storage/definition-updates.d.ts +40 -0
- package/dist/lake-storage/definition-updates.d.ts.map +1 -0
- package/dist/lake-storage/errors.d.ts +7 -0
- package/dist/lake-storage/errors.d.ts.map +1 -0
- package/dist/lake-storage/in-memory.d.ts +25 -0
- package/dist/lake-storage/in-memory.d.ts.map +1 -0
- package/dist/lake-storage/index.d.ts +9 -0
- package/dist/lake-storage/index.d.ts.map +1 -0
- package/dist/lake-storage/index.js +24 -0
- package/dist/lake-storage/index.js.map +9 -0
- package/dist/lake-storage/sql-transforms.d.ts +45 -0
- package/dist/lake-storage/sql-transforms.d.ts.map +1 -0
- package/dist/lake-storage/types.d.ts +114 -0
- package/dist/lake-storage/types.d.ts.map +1 -0
- package/dist/logging/console-logger.d.ts +17 -0
- package/dist/logging/console-logger.d.ts.map +1 -0
- package/dist/logging/index.d.ts +5 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +45 -0
- package/dist/logging/index.js.map +9 -0
- package/dist/logging/record.d.ts +10 -0
- package/dist/logging/record.d.ts.map +1 -0
- package/dist/logging/run-logger.d.ts +61 -0
- package/dist/logging/run-logger.d.ts.map +1 -0
- package/dist/logging/runtime.d.ts +87 -0
- package/dist/logging/runtime.d.ts.map +1 -0
- package/dist/logging/stream.d.ts +24 -0
- package/dist/logging/stream.d.ts.map +1 -0
- package/dist/logging/types.d.ts +82 -0
- package/dist/logging/types.d.ts.map +1 -0
- package/dist/logging/types.js +27 -0
- package/dist/logging/types.js.map +9 -0
- package/dist/maintenance/index.d.ts +3 -0
- package/dist/maintenance/index.d.ts.map +1 -0
- package/dist/maintenance/ontology-maintenance.d.ts +48 -0
- package/dist/maintenance/ontology-maintenance.d.ts.map +1 -0
- package/dist/maintenance/types.d.ts +53 -0
- package/dist/maintenance/types.d.ts.map +1 -0
- package/dist/materialization/dataset-watermark.d.ts +5 -0
- package/dist/materialization/dataset-watermark.d.ts.map +1 -0
- package/dist/materialization/errors.d.ts +37 -0
- package/dist/materialization/errors.d.ts.map +1 -0
- package/dist/materialization/events.d.ts +57 -0
- package/dist/materialization/events.d.ts.map +1 -0
- package/dist/materialization/identity.d.ts +8 -0
- package/dist/materialization/identity.d.ts.map +1 -0
- package/dist/materialization/index.d.ts +13 -0
- package/dist/materialization/index.d.ts.map +1 -0
- package/dist/materialization/index.js +56 -0
- package/dist/materialization/index.js.map +9 -0
- package/dist/materialization/model.d.ts +342 -0
- package/dist/materialization/model.d.ts.map +1 -0
- package/dist/materialization/refs.d.ts +24 -0
- package/dist/materialization/refs.d.ts.map +1 -0
- package/dist/materializer/context.d.ts +34 -0
- package/dist/materializer/context.d.ts.map +1 -0
- package/dist/materializer/edits/apply.d.ts +35 -0
- package/dist/materializer/edits/apply.d.ts.map +1 -0
- package/dist/materializer/edits/commit.d.ts +4 -0
- package/dist/materializer/edits/commit.d.ts.map +1 -0
- package/dist/materializer/edits/execution-units.d.ts +14 -0
- package/dist/materializer/edits/execution-units.d.ts.map +1 -0
- package/dist/materializer/edits/load-state.d.ts +6 -0
- package/dist/materializer/edits/load-state.d.ts.map +1 -0
- package/dist/materializer/edits/operations.d.ts +32 -0
- package/dist/materializer/edits/operations.d.ts.map +1 -0
- package/dist/materializer/edits/plan.d.ts +18 -0
- package/dist/materializer/edits/plan.d.ts.map +1 -0
- package/dist/materializer/edits/read-set.d.ts +8 -0
- package/dist/materializer/edits/read-set.d.ts.map +1 -0
- package/dist/materializer/edits/working-state.d.ts +30 -0
- package/dist/materializer/edits/working-state.d.ts.map +1 -0
- package/dist/materializer/effective/build-events.d.ts +26 -0
- package/dist/materializer/effective/build-events.d.ts.map +1 -0
- package/dist/materializer/effective/diff.d.ts +15 -0
- package/dist/materializer/effective/diff.d.ts.map +1 -0
- package/dist/materializer/effective/load-state.d.ts +7 -0
- package/dist/materializer/effective/load-state.d.ts.map +1 -0
- package/dist/materializer/effective/resolve.d.ts +26 -0
- package/dist/materializer/effective/resolve.d.ts.map +1 -0
- package/dist/materializer/effective/validate.d.ts +11 -0
- package/dist/materializer/effective/validate.d.ts.map +1 -0
- package/dist/materializer/execution/commit-lifecycle.d.ts +8 -0
- package/dist/materializer/execution/commit-lifecycle.d.ts.map +1 -0
- package/dist/materializer/execution/plan-stream.d.ts +8 -0
- package/dist/materializer/execution/plan-stream.d.ts.map +1 -0
- package/dist/materializer/execution/run-correlation.d.ts +19 -0
- package/dist/materializer/execution/run-correlation.d.ts.map +1 -0
- package/dist/materializer/execution/work-executor.d.ts +13 -0
- package/dist/materializer/execution/work-executor.d.ts.map +1 -0
- package/dist/materializer/execution/work-records.d.ts +15 -0
- package/dist/materializer/execution/work-records.d.ts.map +1 -0
- package/dist/materializer/index.d.ts +15 -0
- package/dist/materializer/index.d.ts.map +1 -0
- package/dist/materializer/index.js +134 -0
- package/dist/materializer/index.js.map +9 -0
- package/dist/materializer/materializer.d.ts +27 -0
- package/dist/materializer/materializer.d.ts.map +1 -0
- package/dist/materializer/projections/entry-validator.d.ts +8 -0
- package/dist/materializer/projections/entry-validator.d.ts.map +1 -0
- package/dist/materializer/projections/finish-run.d.ts +4 -0
- package/dist/materializer/projections/finish-run.d.ts.map +1 -0
- package/dist/materializer/projections/replace.d.ts +4 -0
- package/dist/materializer/projections/replace.d.ts.map +1 -0
- package/dist/materializer/projections/replacement-plan.d.ts +14 -0
- package/dist/materializer/projections/replacement-plan.d.ts.map +1 -0
- package/dist/materializer/projections/source-materialization.d.ts +27 -0
- package/dist/materializer/projections/source-materialization.d.ts.map +1 -0
- package/dist/materializer/shared/abort.d.ts +2 -0
- package/dist/materializer/shared/abort.d.ts.map +1 -0
- package/dist/materializer/shared/batching.d.ts +11 -0
- package/dist/materializer/shared/batching.d.ts.map +1 -0
- package/dist/materializer/shared/chunking.d.ts +6 -0
- package/dist/materializer/shared/chunking.d.ts.map +1 -0
- package/dist/materializer/shared/identity.d.ts +38 -0
- package/dist/materializer/shared/identity.d.ts.map +1 -0
- package/dist/materializer/shared/normalize.d.ts +10 -0
- package/dist/materializer/shared/normalize.d.ts.map +1 -0
- package/dist/materializer/shared/projection-run.d.ts +19 -0
- package/dist/materializer/shared/projection-run.d.ts.map +1 -0
- package/dist/materializer/telemetry/append.d.ts +4 -0
- package/dist/materializer/telemetry/append.d.ts.map +1 -0
- package/dist/materializer/telemetry/plan.d.ts +12 -0
- package/dist/materializer/telemetry/plan.d.ts.map +1 -0
- package/dist/objects/action/errors.d.ts +39 -0
- package/dist/objects/action/errors.d.ts.map +1 -0
- package/dist/objects/action/index.d.ts +4 -0
- package/dist/objects/action/index.d.ts.map +1 -0
- package/dist/objects/action/request.d.ts +23 -0
- package/dist/objects/action/request.d.ts.map +1 -0
- package/dist/objects/context/index.d.ts +3 -0
- package/dist/objects/context/index.d.ts.map +1 -0
- package/dist/objects/context/resolve.d.ts +27 -0
- package/dist/objects/context/resolve.d.ts.map +1 -0
- package/dist/objects/context/types.d.ts +28 -0
- package/dist/objects/context/types.d.ts.map +1 -0
- package/dist/objects/contexts.d.ts +45 -0
- package/dist/objects/contexts.d.ts.map +1 -0
- package/dist/objects/errors.d.ts +8 -0
- package/dist/objects/errors.d.ts.map +1 -0
- package/dist/objects/helpers.d.ts +7 -0
- package/dist/objects/helpers.d.ts.map +1 -0
- package/dist/objects/index.d.ts +18 -0
- package/dist/objects/index.d.ts.map +1 -0
- package/dist/objects/index.js +71 -0
- package/dist/objects/index.js.map +9 -0
- package/dist/objects/link/authorization.d.ts +25 -0
- package/dist/objects/link/authorization.d.ts.map +1 -0
- package/dist/objects/link/endpoints.d.ts +28 -0
- package/dist/objects/link/endpoints.d.ts.map +1 -0
- package/dist/objects/link/index.d.ts +4 -0
- package/dist/objects/link/index.d.ts.map +1 -0
- package/dist/objects/link/remove.d.ts +8 -0
- package/dist/objects/link/remove.d.ts.map +1 -0
- package/dist/objects/link/upsert-batch.d.ts +11 -0
- package/dist/objects/link/upsert-batch.d.ts.map +1 -0
- package/dist/objects/link/upsert.d.ts +12 -0
- package/dist/objects/link/upsert.d.ts.map +1 -0
- package/dist/objects/materializer-adapter.d.ts +114 -0
- package/dist/objects/materializer-adapter.d.ts.map +1 -0
- package/dist/objects/object/delete.d.ts +17 -0
- package/dist/objects/object/delete.d.ts.map +1 -0
- package/dist/objects/object/index.d.ts +4 -0
- package/dist/objects/object/index.d.ts.map +1 -0
- package/dist/objects/object/upsert-batch.d.ts +7 -0
- package/dist/objects/object/upsert-batch.d.ts.map +1 -0
- package/dist/objects/object/upsert.d.ts +7 -0
- package/dist/objects/object/upsert.d.ts.map +1 -0
- package/dist/objects/query/errors.d.ts +23 -0
- package/dist/objects/query/errors.d.ts.map +1 -0
- package/dist/objects/query/executor.d.ts +63 -0
- package/dist/objects/query/executor.d.ts.map +1 -0
- package/dist/objects/query/explain-format.d.ts +10 -0
- package/dist/objects/query/explain-format.d.ts.map +1 -0
- package/dist/objects/query/explain.d.ts +26 -0
- package/dist/objects/query/explain.d.ts.map +1 -0
- package/dist/objects/query/index.d.ts +14 -0
- package/dist/objects/query/index.d.ts.map +1 -0
- package/dist/objects/query/index.js +54 -0
- package/dist/objects/query/index.js.map +9 -0
- package/dist/objects/query/ir.d.ts +166 -0
- package/dist/objects/query/ir.d.ts.map +1 -0
- package/dist/objects/query/normalize.d.ts +12 -0
- package/dist/objects/query/normalize.d.ts.map +1 -0
- package/dist/objects/query/planner.d.ts +32 -0
- package/dist/objects/query/planner.d.ts.map +1 -0
- package/dist/objects/query/scalar-values.d.ts +6 -0
- package/dist/objects/query/scalar-values.d.ts.map +1 -0
- package/dist/objects/query/validate.d.ts +23 -0
- package/dist/objects/query/validate.d.ts.map +1 -0
- package/dist/objects/runtime-batch.d.ts +29 -0
- package/dist/objects/runtime-batch.d.ts.map +1 -0
- package/dist/objects/sdk/index.d.ts +3 -0
- package/dist/objects/sdk/index.d.ts.map +1 -0
- package/dist/objects/sdk/object-handle.d.ts +6 -0
- package/dist/objects/sdk/object-handle.d.ts.map +1 -0
- package/dist/objects/sdk/object-set.d.ts +14 -0
- package/dist/objects/sdk/object-set.d.ts.map +1 -0
- package/dist/objects/sdk/query-builder.d.ts +20 -0
- package/dist/objects/sdk/query-builder.d.ts.map +1 -0
- package/dist/objects/sdk/query-executor.d.ts +51 -0
- package/dist/objects/sdk/query-executor.d.ts.map +1 -0
- package/dist/objects/sdk/runtime-query-executor.d.ts +16 -0
- package/dist/objects/sdk/runtime-query-executor.d.ts.map +1 -0
- package/dist/objects/sdk/telemetry-channel.d.ts +6 -0
- package/dist/objects/sdk/telemetry-channel.d.ts.map +1 -0
- package/dist/objects/sdk/where.d.ts +15 -0
- package/dist/objects/sdk/where.d.ts.map +1 -0
- package/dist/objects/service/action-service.d.ts +12 -0
- package/dist/objects/service/action-service.d.ts.map +1 -0
- package/dist/objects/service/index.d.ts +7 -0
- package/dist/objects/service/index.d.ts.map +1 -0
- package/dist/objects/service/link-service.d.ts +26 -0
- package/dist/objects/service/link-service.d.ts.map +1 -0
- package/dist/objects/service/list-service.d.ts +24 -0
- package/dist/objects/service/list-service.d.ts.map +1 -0
- package/dist/objects/service/object-service.d.ts +12 -0
- package/dist/objects/service/object-service.d.ts.map +1 -0
- package/dist/objects/service/telemetry-service.d.ts +12 -0
- package/dist/objects/service/telemetry-service.d.ts.map +1 -0
- package/dist/objects/telemetry/append-batch.d.ts +10 -0
- package/dist/objects/telemetry/append-batch.d.ts.map +1 -0
- package/dist/objects/telemetry/history.d.ts +8 -0
- package/dist/objects/telemetry/history.d.ts.map +1 -0
- package/dist/objects/telemetry/index.d.ts +5 -0
- package/dist/objects/telemetry/index.d.ts.map +1 -0
- package/dist/objects/telemetry/write-batch.d.ts +8 -0
- package/dist/objects/telemetry/write-batch.d.ts.map +1 -0
- package/dist/ontology/builders.d.ts +323 -0
- package/dist/ontology/builders.d.ts.map +1 -0
- package/dist/ontology/decimal.d.ts +28 -0
- package/dist/ontology/decimal.d.ts.map +1 -0
- package/dist/ontology/errors.d.ts +20 -0
- package/dist/ontology/errors.d.ts.map +1 -0
- package/dist/ontology/index.d.ts +23 -0
- package/dist/ontology/index.d.ts.map +1 -0
- package/dist/ontology/index.js +120 -0
- package/dist/ontology/index.js.map +9 -0
- package/dist/ontology/inference/index.d.ts +112 -0
- package/dist/ontology/inference/index.d.ts.map +1 -0
- package/dist/ontology/internal.d.ts +4 -0
- package/dist/ontology/internal.d.ts.map +1 -0
- package/dist/ontology/internal.js +118 -0
- package/dist/ontology/internal.js.map +10 -0
- package/dist/ontology/json-schema.d.ts +9 -0
- package/dist/ontology/json-schema.d.ts.map +1 -0
- package/dist/ontology/refs.d.ts +16 -0
- package/dist/ontology/refs.d.ts.map +1 -0
- package/dist/ontology/registry.d.ts +82 -0
- package/dist/ontology/registry.d.ts.map +1 -0
- package/dist/ontology/tokens.d.ts +54 -0
- package/dist/ontology/tokens.d.ts.map +1 -0
- package/dist/ontology/types.d.ts +402 -0
- package/dist/ontology/types.d.ts.map +1 -0
- package/dist/ontology/units/index.d.ts +74 -0
- package/dist/ontology/units/index.d.ts.map +1 -0
- package/dist/ontology/units/quantitative-types.d.ts +1605 -0
- package/dist/ontology/units/quantitative-types.d.ts.map +1 -0
- package/dist/ontology/units/types.d.ts +26 -0
- package/dist/ontology/units/types.d.ts.map +1 -0
- package/dist/ontology/validation/index.d.ts +7 -0
- package/dist/ontology/validation/index.d.ts.map +1 -0
- package/dist/ontology/validation/links.d.ts +18 -0
- package/dist/ontology/validation/links.d.ts.map +1 -0
- package/dist/ontology/validation/normalize.d.ts +21 -0
- package/dist/ontology/validation/normalize.d.ts.map +1 -0
- package/dist/ontology/validation/properties.d.ts +19 -0
- package/dist/ontology/validation/properties.d.ts.map +1 -0
- package/dist/ontology/validation/query.d.ts +3 -0
- package/dist/ontology/validation/query.d.ts.map +1 -0
- package/dist/ontology/validation/schema.d.ts +7 -0
- package/dist/ontology/validation/schema.d.ts.map +1 -0
- package/dist/ontology/validation/telemetry.d.ts +7 -0
- package/dist/ontology/validation/telemetry.d.ts.map +1 -0
- package/dist/pipelines/builders.d.ts +14 -0
- package/dist/pipelines/builders.d.ts.map +1 -0
- package/dist/pipelines/errors.d.ts +4 -0
- package/dist/pipelines/errors.d.ts.map +1 -0
- package/dist/pipelines/index.d.ts +7 -0
- package/dist/pipelines/index.d.ts.map +1 -0
- package/dist/pipelines/request.d.ts +31 -0
- package/dist/pipelines/request.d.ts.map +1 -0
- package/dist/pipelines/types.d.ts +84 -0
- package/dist/pipelines/types.d.ts.map +1 -0
- package/dist/predicates/builders.d.ts +24 -0
- package/dist/predicates/builders.d.ts.map +1 -0
- package/dist/predicates/evaluate.d.ts +8 -0
- package/dist/predicates/evaluate.d.ts.map +1 -0
- package/dist/predicates/index.d.ts +5 -0
- package/dist/predicates/index.d.ts.map +1 -0
- package/dist/predicates/types.d.ts +69 -0
- package/dist/predicates/types.d.ts.map +1 -0
- package/dist/predicates/validation.d.ts +15 -0
- package/dist/predicates/validation.d.ts.map +1 -0
- package/dist/projections/builders.d.ts +212 -0
- package/dist/projections/builders.d.ts.map +1 -0
- package/dist/projections/errors.d.ts +4 -0
- package/dist/projections/errors.d.ts.map +1 -0
- package/dist/projections/index.d.ts +5 -0
- package/dist/projections/index.d.ts.map +1 -0
- package/dist/projections/internal.d.ts +24 -0
- package/dist/projections/internal.d.ts.map +1 -0
- package/dist/projections/internal.js +26 -0
- package/dist/projections/internal.js.map +9 -0
- package/dist/projections/ownership.d.ts +9 -0
- package/dist/projections/ownership.d.ts.map +1 -0
- package/dist/projections/registry.d.ts +30 -0
- package/dist/projections/registry.d.ts.map +1 -0
- package/dist/projections/revision.d.ts +7 -0
- package/dist/projections/revision.d.ts.map +1 -0
- package/dist/projections/types.d.ts +153 -0
- package/dist/projections/types.d.ts.map +1 -0
- package/dist/projections/validation.d.ts +97 -0
- package/dist/projections/validation.d.ts.map +1 -0
- package/dist/provider-scope.d.ts +12 -0
- package/dist/provider-scope.d.ts.map +1 -0
- package/dist/query.d.ts +17 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +21 -0
- package/dist/query.js.map +9 -0
- package/dist/queues/errors.d.ts +7 -0
- package/dist/queues/errors.d.ts.map +1 -0
- package/dist/queues/in-memory.d.ts +73 -0
- package/dist/queues/in-memory.d.ts.map +1 -0
- package/dist/queues/index.d.ts +5 -0
- package/dist/queues/index.d.ts.map +1 -0
- package/dist/queues/index.js +12 -0
- package/dist/queues/index.js.map +9 -0
- package/dist/queues/types.d.ts +182 -0
- package/dist/queues/types.d.ts.map +1 -0
- package/dist/rules/builders.d.ts +10 -0
- package/dist/rules/builders.d.ts.map +1 -0
- package/dist/rules/dependencies.d.ts +9 -0
- package/dist/rules/dependencies.d.ts.map +1 -0
- package/dist/rules/errors.d.ts +11 -0
- package/dist/rules/errors.d.ts.map +1 -0
- package/dist/rules/index.d.ts +6 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/internal.d.ts +9 -0
- package/dist/rules/internal.d.ts.map +1 -0
- package/dist/rules/internal.js +10 -0
- package/dist/rules/internal.js.map +9 -0
- package/dist/rules/types.d.ts +72 -0
- package/dist/rules/types.d.ts.map +1 -0
- package/dist/rules/validation.d.ts +23 -0
- package/dist/rules/validation.d.ts.map +1 -0
- package/dist/runtime/create.d.ts +68 -0
- package/dist/runtime/create.d.ts.map +1 -0
- package/dist/runtime/errors.d.ts +9 -0
- package/dist/runtime/errors.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +26 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/internal.d.ts +3 -0
- package/dist/runtime/internal.d.ts.map +1 -0
- package/dist/runtime/internal.js +16 -0
- package/dist/runtime/internal.js.map +9 -0
- package/dist/runtime/ontology-mutations.d.ts +16 -0
- package/dist/runtime/ontology-mutations.d.ts.map +1 -0
- package/dist/runtime/scoped.d.ts +158 -0
- package/dist/runtime/scoped.d.ts.map +1 -0
- package/dist/runtime/sixb.d.ts +226 -0
- package/dist/runtime/sixb.d.ts.map +1 -0
- package/dist/runtime/storage-readiness.d.ts +20 -0
- package/dist/runtime/storage-readiness.d.ts.map +1 -0
- package/dist/runtime/types.d.ts +840 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/sandboxes/errors.d.ts +20 -0
- package/dist/sandboxes/errors.d.ts.map +1 -0
- package/dist/sandboxes/exec.d.ts +17 -0
- package/dist/sandboxes/exec.d.ts.map +1 -0
- package/dist/sandboxes/index.d.ts +5 -0
- package/dist/sandboxes/index.d.ts.map +1 -0
- package/dist/sandboxes/index.js +18 -0
- package/dist/sandboxes/index.js.map +9 -0
- package/dist/sandboxes/sandbox.d.ts +110 -0
- package/dist/sandboxes/sandbox.d.ts.map +1 -0
- package/dist/scheduler/errors.d.ts +7 -0
- package/dist/scheduler/errors.d.ts.map +1 -0
- package/dist/scheduler/index.d.ts +4 -0
- package/dist/scheduler/index.d.ts.map +1 -0
- package/dist/scheduler/index.js +18 -0
- package/dist/scheduler/index.js.map +9 -0
- package/dist/scheduler/runtime.d.ts +32 -0
- package/dist/scheduler/runtime.d.ts.map +1 -0
- package/dist/schedules/builders.d.ts +4 -0
- package/dist/schedules/builders.d.ts.map +1 -0
- package/dist/schedules/cron.d.ts +14 -0
- package/dist/schedules/cron.d.ts.map +1 -0
- package/dist/schedules/errors.d.ts +7 -0
- package/dist/schedules/errors.d.ts.map +1 -0
- package/dist/schedules/index.d.ts +12 -0
- package/dist/schedules/index.d.ts.map +1 -0
- package/dist/schedules/index.js +37 -0
- package/dist/schedules/index.js.map +9 -0
- package/dist/schedules/next-occurrence.d.ts +11 -0
- package/dist/schedules/next-occurrence.d.ts.map +1 -0
- package/dist/schedules/runtime.d.ts +17 -0
- package/dist/schedules/runtime.d.ts.map +1 -0
- package/dist/schedules/types.d.ts +99 -0
- package/dist/schedules/types.d.ts.map +1 -0
- package/dist/schedules/validation.d.ts +13 -0
- package/dist/schedules/validation.d.ts.map +1 -0
- package/dist/security/applications.d.ts +15 -0
- package/dist/security/applications.d.ts.map +1 -0
- package/dist/security/builders.d.ts +20 -0
- package/dist/security/builders.d.ts.map +1 -0
- package/dist/security/errors.d.ts +4 -0
- package/dist/security/errors.d.ts.map +1 -0
- package/dist/security/every.d.ts +68 -0
- package/dist/security/every.d.ts.map +1 -0
- package/dist/security/grants.d.ts +40 -0
- package/dist/security/grants.d.ts.map +1 -0
- package/dist/security/index.d.ts +12 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/membership-policies.d.ts +17 -0
- package/dist/security/membership-policies.d.ts.map +1 -0
- package/dist/security/runtime.d.ts +16 -0
- package/dist/security/runtime.d.ts.map +1 -0
- package/dist/security/types.d.ts +133 -0
- package/dist/security/types.d.ts.map +1 -0
- package/dist/security/validation.d.ts +36 -0
- package/dist/security/validation.d.ts.map +1 -0
- package/dist/storage/action-runs/errors.d.ts +10 -0
- package/dist/storage/action-runs/errors.d.ts.map +1 -0
- package/dist/storage/action-runs/idempotency.d.ts +10 -0
- package/dist/storage/action-runs/idempotency.d.ts.map +1 -0
- package/dist/storage/action-runs/in-memory.d.ts +28 -0
- package/dist/storage/action-runs/in-memory.d.ts.map +1 -0
- package/dist/storage/action-runs/index.d.ts +6 -0
- package/dist/storage/action-runs/index.d.ts.map +1 -0
- package/dist/storage/action-runs/types.d.ts +138 -0
- package/dist/storage/action-runs/types.d.ts.map +1 -0
- package/dist/storage/agents/errors.d.ts +11 -0
- package/dist/storage/agents/errors.d.ts.map +1 -0
- package/dist/storage/agents/in-memory.d.ts +70 -0
- package/dist/storage/agents/in-memory.d.ts.map +1 -0
- package/dist/storage/agents/index.d.ts +7 -0
- package/dist/storage/agents/index.d.ts.map +1 -0
- package/dist/storage/agents/types.d.ts +295 -0
- package/dist/storage/agents/types.d.ts.map +1 -0
- package/dist/storage/auth/errors.d.ts +10 -0
- package/dist/storage/auth/errors.d.ts.map +1 -0
- package/dist/storage/auth/in-memory/access-tokens.d.ts +32 -0
- package/dist/storage/auth/in-memory/access-tokens.d.ts.map +1 -0
- package/dist/storage/auth/in-memory/auth-storage.d.ts +36 -0
- package/dist/storage/auth/in-memory/auth-storage.d.ts.map +1 -0
- package/dist/storage/auth/in-memory/group-memberships.d.ts +21 -0
- package/dist/storage/auth/in-memory/group-memberships.d.ts.map +1 -0
- package/dist/storage/auth/in-memory/identities.d.ts +17 -0
- package/dist/storage/auth/in-memory/identities.d.ts.map +1 -0
- package/dist/storage/auth/in-memory/index.d.ts +2 -0
- package/dist/storage/auth/in-memory/index.d.ts.map +1 -0
- package/dist/storage/auth/in-memory/invitations.d.ts +28 -0
- package/dist/storage/auth/in-memory/invitations.d.ts.map +1 -0
- package/dist/storage/auth/in-memory/magic-links.d.ts +28 -0
- package/dist/storage/auth/in-memory/magic-links.d.ts.map +1 -0
- package/dist/storage/auth/in-memory/oidc-attempts.d.ts +18 -0
- package/dist/storage/auth/in-memory/oidc-attempts.d.ts.map +1 -0
- package/dist/storage/auth/in-memory/service-account-group-memberships.d.ts +17 -0
- package/dist/storage/auth/in-memory/service-account-group-memberships.d.ts.map +1 -0
- package/dist/storage/auth/in-memory/service-accounts.d.ts +14 -0
- package/dist/storage/auth/in-memory/service-accounts.d.ts.map +1 -0
- package/dist/storage/auth/in-memory/sessions.d.ts +55 -0
- package/dist/storage/auth/in-memory/sessions.d.ts.map +1 -0
- package/dist/storage/auth/in-memory/shared.d.ts +71 -0
- package/dist/storage/auth/in-memory/shared.d.ts.map +1 -0
- package/dist/storage/auth/in-memory/users.d.ts +19 -0
- package/dist/storage/auth/in-memory/users.d.ts.map +1 -0
- package/dist/storage/auth/in-memory.d.ts +2 -0
- package/dist/storage/auth/in-memory.d.ts.map +1 -0
- package/dist/storage/auth/index.d.ts +5 -0
- package/dist/storage/auth/index.d.ts.map +1 -0
- package/dist/storage/auth/types.d.ts +584 -0
- package/dist/storage/auth/types.d.ts.map +1 -0
- package/dist/storage/errors.d.ts +27 -0
- package/dist/storage/errors.d.ts.map +1 -0
- package/dist/storage/file-upload-sessions/errors.d.ts +15 -0
- package/dist/storage/file-upload-sessions/errors.d.ts.map +1 -0
- package/dist/storage/file-upload-sessions/in-memory.d.ts +27 -0
- package/dist/storage/file-upload-sessions/in-memory.d.ts.map +1 -0
- package/dist/storage/file-upload-sessions/index.d.ts +6 -0
- package/dist/storage/file-upload-sessions/index.d.ts.map +1 -0
- package/dist/storage/file-upload-sessions/types.d.ts +53 -0
- package/dist/storage/file-upload-sessions/types.d.ts.map +1 -0
- package/dist/storage/file-upload-sessions/utils.d.ts +11 -0
- package/dist/storage/file-upload-sessions/utils.d.ts.map +1 -0
- package/dist/storage/in-memory/index.d.ts +105 -0
- package/dist/storage/in-memory/index.d.ts.map +1 -0
- package/dist/storage/in-memory/testing.d.ts +8 -0
- package/dist/storage/in-memory/testing.d.ts.map +1 -0
- package/dist/storage/index.d.ts +44 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +144 -0
- package/dist/storage/index.js.map +9 -0
- package/dist/storage/migrations/check-schema.d.ts +19 -0
- package/dist/storage/migrations/check-schema.d.ts.map +1 -0
- package/dist/storage/migrations/index.d.ts +5 -0
- package/dist/storage/migrations/index.d.ts.map +1 -0
- package/dist/storage/migrations/migrate-storage.d.ts +6 -0
- package/dist/storage/migrations/migrate-storage.d.ts.map +1 -0
- package/dist/storage/migrations/migration-set.d.ts +27 -0
- package/dist/storage/migrations/migration-set.d.ts.map +1 -0
- package/dist/storage/migrations/types.d.ts +115 -0
- package/dist/storage/migrations/types.d.ts.map +1 -0
- package/dist/storage/objects/in-memory.d.ts +126 -0
- package/dist/storage/objects/in-memory.d.ts.map +1 -0
- package/dist/storage/objects/index.d.ts +2 -0
- package/dist/storage/objects/index.d.ts.map +1 -0
- package/dist/storage/objects/types.d.ts +222 -0
- package/dist/storage/objects/types.d.ts.map +1 -0
- package/dist/storage/ontology/commits.d.ts +117 -0
- package/dist/storage/ontology/commits.d.ts.map +1 -0
- package/dist/storage/ontology/in-memory/commits.d.ts +12 -0
- package/dist/storage/ontology/in-memory/commits.d.ts.map +1 -0
- package/dist/storage/ontology/in-memory/index.d.ts +36 -0
- package/dist/storage/ontology/in-memory/index.d.ts.map +1 -0
- package/dist/storage/ontology/in-memory/materializations-finalization.d.ts +5 -0
- package/dist/storage/ontology/in-memory/materializations-finalization.d.ts.map +1 -0
- package/dist/storage/ontology/in-memory/materializations-state.d.ts +20 -0
- package/dist/storage/ontology/in-memory/materializations-state.d.ts.map +1 -0
- package/dist/storage/ontology/in-memory/materializations-work.d.ts +6 -0
- package/dist/storage/ontology/in-memory/materializations-work.d.ts.map +1 -0
- package/dist/storage/ontology/in-memory/materializations.d.ts +101 -0
- package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -0
- package/dist/storage/ontology/in-memory/outbox.d.ts +19 -0
- package/dist/storage/ontology/in-memory/outbox.d.ts.map +1 -0
- package/dist/storage/ontology/in-memory/shared-state.d.ts +48 -0
- package/dist/storage/ontology/in-memory/shared-state.d.ts.map +1 -0
- package/dist/storage/ontology/in-memory/sources.d.ts +23 -0
- package/dist/storage/ontology/in-memory/sources.d.ts.map +1 -0
- package/dist/storage/ontology/in-memory/testing.d.ts +11 -0
- package/dist/storage/ontology/in-memory/testing.d.ts.map +1 -0
- package/dist/storage/ontology/index.d.ts +16 -0
- package/dist/storage/ontology/index.d.ts.map +1 -0
- package/dist/storage/ontology/materializations.d.ts +333 -0
- package/dist/storage/ontology/materializations.d.ts.map +1 -0
- package/dist/storage/ontology/outbox.d.ts +66 -0
- package/dist/storage/ontology/outbox.d.ts.map +1 -0
- package/dist/storage/ontology/provider-header-validation.d.ts +4 -0
- package/dist/storage/ontology/provider-header-validation.d.ts.map +1 -0
- package/dist/storage/ontology/provider-validation.d.ts +6 -0
- package/dist/storage/ontology/provider-validation.d.ts.map +1 -0
- package/dist/storage/ontology/provider-work.d.ts +12 -0
- package/dist/storage/ontology/provider-work.d.ts.map +1 -0
- package/dist/storage/ontology/provider.d.ts +191 -0
- package/dist/storage/ontology/provider.d.ts.map +1 -0
- package/dist/storage/ontology/provider.js +115 -0
- package/dist/storage/ontology/provider.js.map +9 -0
- package/dist/storage/ontology/sources.d.ts +151 -0
- package/dist/storage/ontology/sources.d.ts.map +1 -0
- package/dist/storage/operation-scope.d.ts +32 -0
- package/dist/storage/operation-scope.d.ts.map +1 -0
- package/dist/storage/operation-scope.js +22 -0
- package/dist/storage/operation-scope.js.map +9 -0
- package/dist/storage/pagination.d.ts +11 -0
- package/dist/storage/pagination.d.ts.map +1 -0
- package/dist/storage/pipeline-runs/errors.d.ts +7 -0
- package/dist/storage/pipeline-runs/errors.d.ts.map +1 -0
- package/dist/storage/pipeline-runs/in-memory.d.ts +26 -0
- package/dist/storage/pipeline-runs/in-memory.d.ts.map +1 -0
- package/dist/storage/pipeline-runs/index.d.ts +4 -0
- package/dist/storage/pipeline-runs/index.d.ts.map +1 -0
- package/dist/storage/pipeline-runs/types.d.ts +133 -0
- package/dist/storage/pipeline-runs/types.d.ts.map +1 -0
- package/dist/storage/projection-runs/errors.d.ts +9 -0
- package/dist/storage/projection-runs/errors.d.ts.map +1 -0
- package/dist/storage/projection-runs/in-memory.d.ts +42 -0
- package/dist/storage/projection-runs/in-memory.d.ts.map +1 -0
- package/dist/storage/projection-runs/index.d.ts +5 -0
- package/dist/storage/projection-runs/index.d.ts.map +1 -0
- package/dist/storage/projection-runs/lifecycle.d.ts +93 -0
- package/dist/storage/projection-runs/lifecycle.d.ts.map +1 -0
- package/dist/storage/projection-runs/lifecycle.js +64 -0
- package/dist/storage/projection-runs/lifecycle.js.map +9 -0
- package/dist/storage/projection-runs/types.d.ts +175 -0
- package/dist/storage/projection-runs/types.d.ts.map +1 -0
- package/dist/storage/rules/in-memory.d.ts +26 -0
- package/dist/storage/rules/in-memory.d.ts.map +1 -0
- package/dist/storage/rules/index.d.ts +3 -0
- package/dist/storage/rules/index.d.ts.map +1 -0
- package/dist/storage/rules/types.d.ts +60 -0
- package/dist/storage/rules/types.d.ts.map +1 -0
- package/dist/storage/run-listing.d.ts +36 -0
- package/dist/storage/run-listing.d.ts.map +1 -0
- package/dist/storage/sync-runs/errors.d.ts +8 -0
- package/dist/storage/sync-runs/errors.d.ts.map +1 -0
- package/dist/storage/sync-runs/in-memory.d.ts +16 -0
- package/dist/storage/sync-runs/in-memory.d.ts.map +1 -0
- package/dist/storage/sync-runs/index.d.ts +4 -0
- package/dist/storage/sync-runs/index.d.ts.map +1 -0
- package/dist/storage/sync-runs/types.d.ts +85 -0
- package/dist/storage/sync-runs/types.d.ts.map +1 -0
- package/dist/storage/timeseries/index.d.ts +2 -0
- package/dist/storage/timeseries/index.d.ts.map +1 -0
- package/dist/storage/timeseries/store.d.ts +46 -0
- package/dist/storage/timeseries/store.d.ts.map +1 -0
- package/dist/storage/timeseries/types.d.ts +50 -0
- package/dist/storage/timeseries/types.d.ts.map +1 -0
- package/dist/storage/transaction.d.ts +4 -0
- package/dist/storage/transaction.d.ts.map +1 -0
- package/dist/storage/types.d.ts +78 -0
- package/dist/storage/types.d.ts.map +1 -0
- package/dist/storage/webhook-deliveries/in-memory.d.ts +18 -0
- package/dist/storage/webhook-deliveries/in-memory.d.ts.map +1 -0
- package/dist/storage/webhook-deliveries/index.d.ts +3 -0
- package/dist/storage/webhook-deliveries/index.d.ts.map +1 -0
- package/dist/storage/webhook-deliveries/types.d.ts +43 -0
- package/dist/storage/webhook-deliveries/types.d.ts.map +1 -0
- package/dist/storage/webhook-runs/errors.d.ts +7 -0
- package/dist/storage/webhook-runs/errors.d.ts.map +1 -0
- package/dist/storage/webhook-runs/in-memory.d.ts +16 -0
- package/dist/storage/webhook-runs/in-memory.d.ts.map +1 -0
- package/dist/storage/webhook-runs/index.d.ts +4 -0
- package/dist/storage/webhook-runs/index.d.ts.map +1 -0
- package/dist/storage/webhook-runs/types.d.ts +66 -0
- package/dist/storage/webhook-runs/types.d.ts.map +1 -0
- package/dist/storage/workflow-interventions/errors.d.ts +7 -0
- package/dist/storage/workflow-interventions/errors.d.ts.map +1 -0
- package/dist/storage/workflow-interventions/in-memory.d.ts +18 -0
- package/dist/storage/workflow-interventions/in-memory.d.ts.map +1 -0
- package/dist/storage/workflow-interventions/index.d.ts +4 -0
- package/dist/storage/workflow-interventions/index.d.ts.map +1 -0
- package/dist/storage/workflow-interventions/types.d.ts +94 -0
- package/dist/storage/workflow-interventions/types.d.ts.map +1 -0
- package/dist/storage/workflow-runs/errors.d.ts +7 -0
- package/dist/storage/workflow-runs/errors.d.ts.map +1 -0
- package/dist/storage/workflow-runs/in-memory.d.ts +83 -0
- package/dist/storage/workflow-runs/in-memory.d.ts.map +1 -0
- package/dist/storage/workflow-runs/index.d.ts +4 -0
- package/dist/storage/workflow-runs/index.d.ts.map +1 -0
- package/dist/storage/workflow-runs/types.d.ts +305 -0
- package/dist/storage/workflow-runs/types.d.ts.map +1 -0
- package/dist/syncs/builders.d.ts +9 -0
- package/dist/syncs/builders.d.ts.map +1 -0
- package/dist/syncs/errors.d.ts +4 -0
- package/dist/syncs/errors.d.ts.map +1 -0
- package/dist/syncs/index.d.ts +7 -0
- package/dist/syncs/index.d.ts.map +1 -0
- package/dist/syncs/request.d.ts +41 -0
- package/dist/syncs/request.d.ts.map +1 -0
- package/dist/syncs/types.d.ts +76 -0
- package/dist/syncs/types.d.ts.map +1 -0
- package/dist/testing/agent-storage-contract.d.ts +16 -0
- package/dist/testing/agent-storage-contract.d.ts.map +1 -0
- package/dist/testing/auth-storage-contract.d.ts +16 -0
- package/dist/testing/auth-storage-contract.d.ts.map +1 -0
- package/dist/testing/blob-storage-contract.d.ts +10 -0
- package/dist/testing/blob-storage-contract.d.ts.map +1 -0
- package/dist/testing/broker-contract.d.ts +39 -0
- package/dist/testing/broker-contract.d.ts.map +1 -0
- package/dist/testing/effective-storage-contract.d.ts +7 -0
- package/dist/testing/effective-storage-contract.d.ts.map +1 -0
- package/dist/testing/index.d.ts +15 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +7000 -0
- package/dist/testing/index.js.map +24 -0
- package/dist/testing/lake-storage-contract.d.ts +29 -0
- package/dist/testing/lake-storage-contract.d.ts.map +1 -0
- package/dist/testing/materialization-failure-contract.d.ts +26 -0
- package/dist/testing/materialization-failure-contract.d.ts.map +1 -0
- package/dist/testing/materializer-fixture.d.ts +35 -0
- package/dist/testing/materializer-fixture.d.ts.map +1 -0
- package/dist/testing/materializer-storage-contract.d.ts +7 -0
- package/dist/testing/materializer-storage-contract.d.ts.map +1 -0
- package/dist/testing/object-query-contract.d.ts +21 -0
- package/dist/testing/object-query-contract.d.ts.map +1 -0
- package/dist/testing/ontology-contract-fixture.d.ts +33 -0
- package/dist/testing/ontology-contract-fixture.d.ts.map +1 -0
- package/dist/testing/ontology-storage-contract.d.ts +21 -0
- package/dist/testing/ontology-storage-contract.d.ts.map +1 -0
- package/dist/testing/projection-run-storage-contract.d.ts +10 -0
- package/dist/testing/projection-run-storage-contract.d.ts.map +1 -0
- package/dist/testing/queues-contract.d.ts +31 -0
- package/dist/testing/queues-contract.d.ts.map +1 -0
- package/dist/testing/sandboxes-contract.d.ts +31 -0
- package/dist/testing/sandboxes-contract.d.ts.map +1 -0
- package/dist/tsconfig.json +5 -0
- package/dist/webhooks/builders.d.ts +41 -0
- package/dist/webhooks/builders.d.ts.map +1 -0
- package/dist/webhooks/connector.d.ts +10 -0
- package/dist/webhooks/connector.d.ts.map +1 -0
- package/dist/webhooks/errors.d.ts +4 -0
- package/dist/webhooks/errors.d.ts.map +1 -0
- package/dist/webhooks/index.d.ts +9 -0
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/registry.d.ts +7 -0
- package/dist/webhooks/registry.d.ts.map +1 -0
- package/dist/webhooks/types.d.ts +79 -0
- package/dist/webhooks/types.d.ts.map +1 -0
- package/dist/webhooks/unverified.d.ts +57 -0
- package/dist/webhooks/unverified.d.ts.map +1 -0
- package/dist/workers/errors.d.ts +17 -0
- package/dist/workers/errors.d.ts.map +1 -0
- package/dist/workers/index.d.ts +7 -0
- package/dist/workers/index.d.ts.map +1 -0
- package/dist/workers/index.js +506 -0
- package/dist/workers/index.js.map +13 -0
- package/dist/workers/queue-delivery.d.ts +38 -0
- package/dist/workers/queue-delivery.d.ts.map +1 -0
- package/dist/workers/queue-worker.d.ts +30 -0
- package/dist/workers/queue-worker.d.ts.map +1 -0
- package/dist/workers/worker.d.ts +14 -0
- package/dist/workers/worker.d.ts.map +1 -0
- package/dist/workflows/builders.d.ts +27 -0
- package/dist/workflows/builders.d.ts.map +1 -0
- package/dist/workflows/errors.d.ts +11 -0
- package/dist/workflows/errors.d.ts.map +1 -0
- package/dist/workflows/index.d.ts +9 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/index.js +108 -0
- package/dist/workflows/index.js.map +9 -0
- package/dist/workflows/request.d.ts +29 -0
- package/dist/workflows/request.d.ts.map +1 -0
- package/dist/workflows/runtime.d.ts +33 -0
- package/dist/workflows/runtime.d.ts.map +1 -0
- package/dist/workflows/snapshot.d.ts +55 -0
- package/dist/workflows/snapshot.d.ts.map +1 -0
- package/dist/workflows/types.d.ts +288 -0
- package/dist/workflows/types.d.ts.map +1 -0
- package/dist/workflows/validation.d.ts +66 -0
- package/dist/workflows/validation.d.ts.map +1 -0
- package/package.json +312 -0
- package/src/actions/builders/define-action.ts +243 -0
- package/src/actions/builders/params.ts +48 -0
- package/src/actions/builders.ts +2 -0
- package/src/actions/commit-edits.ts +110 -0
- package/src/actions/errors.ts +15 -0
- package/src/actions/index.ts +75 -0
- package/src/actions/read-facade.ts +224 -0
- package/src/actions/registry.ts +135 -0
- package/src/actions/request.ts +407 -0
- package/src/actions/run-id.ts +17 -0
- package/src/actions/runtime.ts +31 -0
- package/src/actions/types/context.ts +224 -0
- package/src/actions/types/definitions.ts +181 -0
- package/src/actions/types/handlers.ts +68 -0
- package/src/actions/types/params.ts +82 -0
- package/src/actions/types.ts +4 -0
- package/src/actions/validation.ts +186 -0
- package/src/actions/validators.ts +56 -0
- package/src/actions/worker.ts +2 -0
- package/src/agents/adapters.ts +647 -0
- package/src/agents/api-gateway.ts +57 -0
- package/src/agents/builders.ts +46 -0
- package/src/agents/context-model.ts +41 -0
- package/src/agents/context-resolution.ts +43 -0
- package/src/agents/context.ts +185 -0
- package/src/agents/dispatch.ts +107 -0
- package/src/agents/errors.ts +40 -0
- package/src/agents/ids.ts +24 -0
- package/src/agents/index.ts +122 -0
- package/src/agents/message.ts +91 -0
- package/src/agents/prompt.ts +45 -0
- package/src/agents/request.ts +198 -0
- package/src/agents/runtime.ts +124 -0
- package/src/agents/streams.ts +194 -0
- package/src/agents/types.ts +70 -0
- package/src/agents/validation.ts +151 -0
- package/src/auth/access-tokens.ts +125 -0
- package/src/auth/audience.ts +28 -0
- package/src/auth/cookies.ts +263 -0
- package/src/auth/csrf.ts +41 -0
- package/src/auth/errors.ts +19 -0
- package/src/auth/index.ts +149 -0
- package/src/auth/runtime.ts +1642 -0
- package/src/auth/session-cache.ts +112 -0
- package/src/auth/sessions.ts +55 -0
- package/src/auth/strategy.ts +46 -0
- package/src/auth/types.ts +573 -0
- package/src/auth/validation.ts +241 -0
- package/src/authorization/application-access.ts +34 -0
- package/src/authorization/decision.ts +215 -0
- package/src/authorization/errors.ts +12 -0
- package/src/authorization/event-visibility.ts +99 -0
- package/src/authorization/grant-kinds.ts +149 -0
- package/src/authorization/index.ts +24 -0
- package/src/authorization/resolve.ts +101 -0
- package/src/authorization/run-visibility.ts +78 -0
- package/src/authorization/types.ts +52 -0
- package/src/blob-storage/browser.ts +28 -0
- package/src/blob-storage/constants.ts +9 -0
- package/src/blob-storage/derive.ts +13 -0
- package/src/blob-storage/errors.ts +6 -0
- package/src/blob-storage/in-memory.ts +74 -0
- package/src/blob-storage/index.ts +37 -0
- package/src/blob-storage/types.ts +143 -0
- package/src/blob-storage/utils.ts +126 -0
- package/src/blob-storage/validation.ts +58 -0
- package/src/bootstrap/discovery.ts +507 -0
- package/src/bootstrap/index.ts +26 -0
- package/src/bootstrap/ontology-type-manifest.ts +316 -0
- package/src/broker/errors.ts +15 -0
- package/src/broker/in-memory.ts +511 -0
- package/src/broker/index.ts +12 -0
- package/src/broker/types.ts +129 -0
- package/src/connectors/builders.ts +33 -0
- package/src/connectors/errors.ts +15 -0
- package/src/connectors/index.ts +9 -0
- package/src/connectors/runtime.ts +100 -0
- package/src/connectors/types.ts +64 -0
- package/src/datasets/builders.ts +233 -0
- package/src/datasets/errors.ts +3 -0
- package/src/datasets/index.ts +13 -0
- package/src/datasets/types.ts +52 -0
- package/src/datasets/validation.ts +251 -0
- package/src/edits/errors.ts +6 -0
- package/src/edits/index.ts +24 -0
- package/src/edits/normalize.ts +87 -0
- package/src/edits/properties.ts +153 -0
- package/src/edits/recorder.ts +312 -0
- package/src/edits/types.ts +275 -0
- package/src/error-reporting/capability.ts +160 -0
- package/src/error-reporting/internal.ts +13 -0
- package/src/error-reporting/normalize.ts +35 -0
- package/src/error-reporting/reporter.ts +65 -0
- package/src/error-reporting/types.ts +125 -0
- package/src/events/definitions.ts +241 -0
- package/src/events/envelope.ts +68 -0
- package/src/events/errors.ts +7 -0
- package/src/events/index.ts +167 -0
- package/src/events/outbox-dispatcher.ts +534 -0
- package/src/events/property-changes.ts +9 -0
- package/src/events/runtime.ts +401 -0
- package/src/events/scope.ts +71 -0
- package/src/events/selectors/builder.ts +531 -0
- package/src/events/selectors/index.ts +42 -0
- package/src/events/selectors/predicate.ts +91 -0
- package/src/events/selectors/types.ts +258 -0
- package/src/events/toStoredEvent.ts +35 -0
- package/src/events/types/actions.ts +42 -0
- package/src/events/types/datasets.ts +21 -0
- package/src/events/types/index.ts +206 -0
- package/src/events/types/links.ts +42 -0
- package/src/events/types/objects.ts +38 -0
- package/src/events/types/pipelines.ts +67 -0
- package/src/events/types/rules.ts +31 -0
- package/src/events/types/schedules.ts +15 -0
- package/src/events/types/syncs.ts +27 -0
- package/src/events/types/telemetry.ts +19 -0
- package/src/events/types/workflows.ts +172 -0
- package/src/http/api-routes.ts +384 -0
- package/src/http/index.ts +3 -0
- package/src/http/route-pattern.ts +37 -0
- package/src/index.ts +916 -0
- package/src/json.ts +137 -0
- package/src/lake-storage/definition-updates.ts +263 -0
- package/src/lake-storage/errors.ts +6 -0
- package/src/lake-storage/in-memory.ts +348 -0
- package/src/lake-storage/index.ts +48 -0
- package/src/lake-storage/sql-transforms.ts +67 -0
- package/src/lake-storage/types.ts +135 -0
- package/src/logging/console-logger.ts +63 -0
- package/src/logging/index.ts +43 -0
- package/src/logging/record.ts +126 -0
- package/src/logging/run-logger.ts +350 -0
- package/src/logging/runtime.ts +341 -0
- package/src/logging/stream.ts +38 -0
- package/src/logging/types.ts +156 -0
- package/src/maintenance/index.ts +9 -0
- package/src/maintenance/ontology-maintenance.ts +351 -0
- package/src/maintenance/types.ts +57 -0
- package/src/materialization/dataset-watermark.ts +52 -0
- package/src/materialization/errors.ts +73 -0
- package/src/materialization/events.ts +92 -0
- package/src/materialization/identity.ts +36 -0
- package/src/materialization/index.ts +75 -0
- package/src/materialization/model.ts +394 -0
- package/src/materialization/refs.ts +134 -0
- package/src/materializer/README.md +130 -0
- package/src/materializer/context.ts +75 -0
- package/src/materializer/edits/apply.ts +241 -0
- package/src/materializer/edits/commit.ts +311 -0
- package/src/materializer/edits/execution-units.ts +32 -0
- package/src/materializer/edits/load-state.ts +148 -0
- package/src/materializer/edits/operations.ts +298 -0
- package/src/materializer/edits/plan.ts +192 -0
- package/src/materializer/edits/read-set.ts +79 -0
- package/src/materializer/edits/working-state.ts +171 -0
- package/src/materializer/effective/build-events.ts +197 -0
- package/src/materializer/effective/diff.ts +169 -0
- package/src/materializer/effective/load-state.ts +75 -0
- package/src/materializer/effective/resolve.ts +96 -0
- package/src/materializer/effective/validate.ts +180 -0
- package/src/materializer/execution/commit-lifecycle.ts +57 -0
- package/src/materializer/execution/plan-stream.ts +97 -0
- package/src/materializer/execution/run-correlation.ts +73 -0
- package/src/materializer/execution/work-executor.ts +143 -0
- package/src/materializer/execution/work-records.ts +186 -0
- package/src/materializer/index.ts +109 -0
- package/src/materializer/materializer.ts +64 -0
- package/src/materializer/projections/entry-validator.ts +162 -0
- package/src/materializer/projections/finish-run.ts +194 -0
- package/src/materializer/projections/replace.ts +447 -0
- package/src/materializer/projections/replacement-plan.ts +376 -0
- package/src/materializer/projections/source-materialization.ts +99 -0
- package/src/materializer/shared/abort.ts +7 -0
- package/src/materializer/shared/batching.ts +32 -0
- package/src/materializer/shared/chunking.ts +27 -0
- package/src/materializer/shared/identity.ts +141 -0
- package/src/materializer/shared/normalize.ts +527 -0
- package/src/materializer/shared/projection-run.ts +61 -0
- package/src/materializer/telemetry/append.ts +503 -0
- package/src/materializer/telemetry/plan.ts +363 -0
- package/src/objects/action/errors.ts +56 -0
- package/src/objects/action/index.ts +3 -0
- package/src/objects/action/request.ts +63 -0
- package/src/objects/context/index.ts +6 -0
- package/src/objects/context/resolve.ts +51 -0
- package/src/objects/context/types.ts +31 -0
- package/src/objects/contexts.ts +64 -0
- package/src/objects/errors.ts +7 -0
- package/src/objects/helpers.ts +18 -0
- package/src/objects/index.ts +26 -0
- package/src/objects/link/authorization.ts +26 -0
- package/src/objects/link/endpoints.ts +66 -0
- package/src/objects/link/index.ts +3 -0
- package/src/objects/link/remove.ts +42 -0
- package/src/objects/link/upsert-batch.ts +80 -0
- package/src/objects/link/upsert.ts +56 -0
- package/src/objects/materializer-adapter.ts +307 -0
- package/src/objects/object/delete.ts +47 -0
- package/src/objects/object/index.ts +3 -0
- package/src/objects/object/upsert-batch.ts +57 -0
- package/src/objects/object/upsert.ts +38 -0
- package/src/objects/query/errors.ts +55 -0
- package/src/objects/query/executor.ts +1345 -0
- package/src/objects/query/explain-format.ts +34 -0
- package/src/objects/query/explain.ts +215 -0
- package/src/objects/query/index.ts +77 -0
- package/src/objects/query/ir.ts +211 -0
- package/src/objects/query/normalize.ts +245 -0
- package/src/objects/query/planner.ts +538 -0
- package/src/objects/query/scalar-values.ts +100 -0
- package/src/objects/query/validate.ts +1276 -0
- package/src/objects/runtime-batch.ts +105 -0
- package/src/objects/sdk/index.ts +2 -0
- package/src/objects/sdk/object-handle.ts +139 -0
- package/src/objects/sdk/object-set.ts +224 -0
- package/src/objects/sdk/query-builder.ts +386 -0
- package/src/objects/sdk/query-executor.ts +62 -0
- package/src/objects/sdk/runtime-query-executor.ts +88 -0
- package/src/objects/sdk/telemetry-channel.ts +81 -0
- package/src/objects/sdk/where.ts +87 -0
- package/src/objects/service/action-service.ts +40 -0
- package/src/objects/service/index.ts +6 -0
- package/src/objects/service/link-service.ts +74 -0
- package/src/objects/service/list-service.ts +89 -0
- package/src/objects/service/object-service.ts +28 -0
- package/src/objects/service/telemetry-service.ts +17 -0
- package/src/objects/telemetry/append-batch.ts +74 -0
- package/src/objects/telemetry/history.ts +32 -0
- package/src/objects/telemetry/index.ts +4 -0
- package/src/objects/telemetry/write-batch.ts +52 -0
- package/src/ontology/builders.ts +695 -0
- package/src/ontology/decimal.ts +120 -0
- package/src/ontology/errors.ts +25 -0
- package/src/ontology/index.ts +80 -0
- package/src/ontology/inference/index.ts +215 -0
- package/src/ontology/internal.ts +3 -0
- package/src/ontology/json-schema.ts +123 -0
- package/src/ontology/refs.ts +80 -0
- package/src/ontology/registry.ts +417 -0
- package/src/ontology/tokens.ts +113 -0
- package/src/ontology/types.ts +436 -0
- package/src/ontology/units/index.ts +115 -0
- package/src/ontology/units/quantitative-types.ts +608 -0
- package/src/ontology/units/types.ts +27 -0
- package/src/ontology/validation/index.ts +36 -0
- package/src/ontology/validation/links.ts +126 -0
- package/src/ontology/validation/normalize.ts +215 -0
- package/src/ontology/validation/properties.ts +235 -0
- package/src/ontology/validation/query.ts +300 -0
- package/src/ontology/validation/schema.ts +174 -0
- package/src/ontology/validation/telemetry.ts +53 -0
- package/src/pipelines/builders.ts +155 -0
- package/src/pipelines/errors.ts +3 -0
- package/src/pipelines/index.ts +26 -0
- package/src/pipelines/request.ts +71 -0
- package/src/pipelines/types.ts +199 -0
- package/src/predicates/builders.ts +152 -0
- package/src/predicates/evaluate.ts +107 -0
- package/src/predicates/index.ts +28 -0
- package/src/predicates/types.ts +124 -0
- package/src/predicates/validation.ts +152 -0
- package/src/projections/builders.ts +770 -0
- package/src/projections/errors.ts +3 -0
- package/src/projections/index.ts +32 -0
- package/src/projections/internal.ts +75 -0
- package/src/projections/ownership.ts +134 -0
- package/src/projections/registry.ts +269 -0
- package/src/projections/revision.ts +245 -0
- package/src/projections/types.ts +165 -0
- package/src/projections/validation.ts +531 -0
- package/src/provider-scope.ts +11 -0
- package/src/query.ts +75 -0
- package/src/queues/errors.ts +6 -0
- package/src/queues/in-memory.ts +364 -0
- package/src/queues/index.ts +23 -0
- package/src/queues/types.ts +230 -0
- package/src/rules/builders.ts +126 -0
- package/src/rules/dependencies.ts +76 -0
- package/src/rules/errors.ts +11 -0
- package/src/rules/index.ts +30 -0
- package/src/rules/internal.ts +8 -0
- package/src/rules/types.ts +113 -0
- package/src/rules/validation.ts +153 -0
- package/src/runtime/create.ts +163 -0
- package/src/runtime/errors.ts +8 -0
- package/src/runtime/index.ts +67 -0
- package/src/runtime/internal.ts +7 -0
- package/src/runtime/ontology-mutations.ts +90 -0
- package/src/runtime/scoped.ts +436 -0
- package/src/runtime/sixb.ts +822 -0
- package/src/runtime/storage-readiness.ts +91 -0
- package/src/runtime/types.ts +1401 -0
- package/src/sandboxes/errors.ts +22 -0
- package/src/sandboxes/exec.ts +102 -0
- package/src/sandboxes/index.ts +19 -0
- package/src/sandboxes/sandbox.ts +124 -0
- package/src/scheduler/errors.ts +7 -0
- package/src/scheduler/index.ts +3 -0
- package/src/scheduler/runtime.ts +174 -0
- package/src/schedules/builders.ts +257 -0
- package/src/schedules/cron.ts +166 -0
- package/src/schedules/errors.ts +7 -0
- package/src/schedules/index.ts +44 -0
- package/src/schedules/next-occurrence.ts +217 -0
- package/src/schedules/runtime.ts +241 -0
- package/src/schedules/types.ts +212 -0
- package/src/schedules/validation.ts +398 -0
- package/src/security/applications.ts +11 -0
- package/src/security/builders.ts +128 -0
- package/src/security/errors.ts +3 -0
- package/src/security/every.ts +108 -0
- package/src/security/grants.ts +215 -0
- package/src/security/index.ts +51 -0
- package/src/security/membership-policies.ts +101 -0
- package/src/security/runtime.ts +101 -0
- package/src/security/types.ts +156 -0
- package/src/security/validation.ts +430 -0
- package/src/storage/action-runs/errors.ts +13 -0
- package/src/storage/action-runs/idempotency.ts +68 -0
- package/src/storage/action-runs/in-memory.ts +420 -0
- package/src/storage/action-runs/index.ts +31 -0
- package/src/storage/action-runs/types.ts +169 -0
- package/src/storage/agents/errors.ts +22 -0
- package/src/storage/agents/in-memory.ts +498 -0
- package/src/storage/agents/index.ts +42 -0
- package/src/storage/agents/types.ts +348 -0
- package/src/storage/auth/errors.ts +40 -0
- package/src/storage/auth/in-memory/access-tokens.ts +123 -0
- package/src/storage/auth/in-memory/auth-storage.ts +559 -0
- package/src/storage/auth/in-memory/group-memberships.ts +46 -0
- package/src/storage/auth/in-memory/identities.ts +66 -0
- package/src/storage/auth/in-memory/index.ts +1 -0
- package/src/storage/auth/in-memory/invitations.ts +165 -0
- package/src/storage/auth/in-memory/magic-links.ts +98 -0
- package/src/storage/auth/in-memory/oidc-attempts.ts +75 -0
- package/src/storage/auth/in-memory/service-account-group-memberships.ts +102 -0
- package/src/storage/auth/in-memory/service-accounts.ts +80 -0
- package/src/storage/auth/in-memory/sessions.ts +177 -0
- package/src/storage/auth/in-memory/shared.ts +602 -0
- package/src/storage/auth/in-memory/users.ts +139 -0
- package/src/storage/auth/in-memory.ts +1 -0
- package/src/storage/auth/index.ts +58 -0
- package/src/storage/auth/types.ts +639 -0
- package/src/storage/errors.ts +45 -0
- package/src/storage/file-upload-sessions/errors.ts +24 -0
- package/src/storage/file-upload-sessions/in-memory.ts +161 -0
- package/src/storage/file-upload-sessions/index.ts +19 -0
- package/src/storage/file-upload-sessions/types.ts +61 -0
- package/src/storage/file-upload-sessions/utils.ts +49 -0
- package/src/storage/in-memory/index.ts +297 -0
- package/src/storage/in-memory/testing.ts +21 -0
- package/src/storage/index.ts +489 -0
- package/src/storage/migrations/check-schema.ts +49 -0
- package/src/storage/migrations/index.ts +23 -0
- package/src/storage/migrations/migrate-storage.ts +24 -0
- package/src/storage/migrations/migration-set.ts +270 -0
- package/src/storage/migrations/types.ts +129 -0
- package/src/storage/objects/in-memory.ts +1154 -0
- package/src/storage/objects/index.ts +24 -0
- package/src/storage/objects/types.ts +244 -0
- package/src/storage/ontology/commits.ts +132 -0
- package/src/storage/ontology/in-memory/commits.ts +122 -0
- package/src/storage/ontology/in-memory/index.ts +94 -0
- package/src/storage/ontology/in-memory/materializations-finalization.ts +484 -0
- package/src/storage/ontology/in-memory/materializations-state.ts +183 -0
- package/src/storage/ontology/in-memory/materializations-work.ts +62 -0
- package/src/storage/ontology/in-memory/materializations.ts +1192 -0
- package/src/storage/ontology/in-memory/outbox.ts +227 -0
- package/src/storage/ontology/in-memory/shared-state.ts +161 -0
- package/src/storage/ontology/in-memory/sources.ts +566 -0
- package/src/storage/ontology/in-memory/testing.ts +29 -0
- package/src/storage/ontology/index.ts +119 -0
- package/src/storage/ontology/materializations.ts +414 -0
- package/src/storage/ontology/outbox.ts +79 -0
- package/src/storage/ontology/provider-header-validation.ts +173 -0
- package/src/storage/ontology/provider-validation.ts +36 -0
- package/src/storage/ontology/provider-work.ts +330 -0
- package/src/storage/ontology/provider.ts +852 -0
- package/src/storage/ontology/sources.ts +195 -0
- package/src/storage/operation-scope.ts +248 -0
- package/src/storage/pagination.ts +23 -0
- package/src/storage/pipeline-runs/errors.ts +6 -0
- package/src/storage/pipeline-runs/in-memory.ts +307 -0
- package/src/storage/pipeline-runs/index.ts +19 -0
- package/src/storage/pipeline-runs/types.ts +148 -0
- package/src/storage/projection-runs/errors.ts +15 -0
- package/src/storage/projection-runs/in-memory.ts +321 -0
- package/src/storage/projection-runs/index.ts +36 -0
- package/src/storage/projection-runs/lifecycle.ts +793 -0
- package/src/storage/projection-runs/types.ts +254 -0
- package/src/storage/rules/in-memory.ts +191 -0
- package/src/storage/rules/index.ts +12 -0
- package/src/storage/rules/types.ts +80 -0
- package/src/storage/run-listing.ts +107 -0
- package/src/storage/sync-runs/errors.ts +7 -0
- package/src/storage/sync-runs/in-memory.ts +181 -0
- package/src/storage/sync-runs/index.ts +14 -0
- package/src/storage/sync-runs/types.ts +93 -0
- package/src/storage/timeseries/index.ts +7 -0
- package/src/storage/timeseries/store.ts +214 -0
- package/src/storage/timeseries/types.ts +57 -0
- package/src/storage/transaction.ts +56 -0
- package/src/storage/types.ts +299 -0
- package/src/storage/webhook-deliveries/in-memory.ts +108 -0
- package/src/storage/webhook-deliveries/index.ts +9 -0
- package/src/storage/webhook-deliveries/types.ts +41 -0
- package/src/storage/webhook-runs/errors.ts +6 -0
- package/src/storage/webhook-runs/in-memory.ts +131 -0
- package/src/storage/webhook-runs/index.ts +12 -0
- package/src/storage/webhook-runs/types.ts +69 -0
- package/src/storage/workflow-interventions/errors.ts +6 -0
- package/src/storage/workflow-interventions/in-memory.ts +192 -0
- package/src/storage/workflow-interventions/index.ts +14 -0
- package/src/storage/workflow-interventions/types.ts +100 -0
- package/src/storage/workflow-runs/errors.ts +6 -0
- package/src/storage/workflow-runs/in-memory.ts +777 -0
- package/src/storage/workflow-runs/index.ts +45 -0
- package/src/storage/workflow-runs/types.ts +344 -0
- package/src/syncs/builders.ts +101 -0
- package/src/syncs/errors.ts +3 -0
- package/src/syncs/index.ts +22 -0
- package/src/syncs/request.ts +91 -0
- package/src/syncs/types.ts +136 -0
- package/src/testing/agent-storage-contract.ts +824 -0
- package/src/testing/auth-storage-contract.ts +1932 -0
- package/src/testing/blob-storage-contract.ts +108 -0
- package/src/testing/broker-contract.ts +819 -0
- package/src/testing/effective-storage-contract.ts +182 -0
- package/src/testing/index.ts +65 -0
- package/src/testing/lake-storage-contract.ts +699 -0
- package/src/testing/materialization-failure-contract.ts +66 -0
- package/src/testing/materializer-fixture.ts +119 -0
- package/src/testing/materializer-storage-contract.ts +389 -0
- package/src/testing/object-query-contract.ts +1205 -0
- package/src/testing/ontology-contract-fixture.ts +192 -0
- package/src/testing/ontology-storage-contract.ts +922 -0
- package/src/testing/projection-run-storage-contract.ts +372 -0
- package/src/testing/queues-contract.ts +634 -0
- package/src/testing/sandboxes-contract.ts +404 -0
- package/src/webhooks/builders.ts +154 -0
- package/src/webhooks/connector.ts +19 -0
- package/src/webhooks/errors.ts +3 -0
- package/src/webhooks/index.ts +25 -0
- package/src/webhooks/registry.ts +127 -0
- package/src/webhooks/types.ts +98 -0
- package/src/webhooks/unverified.ts +82 -0
- package/src/workers/errors.ts +25 -0
- package/src/workers/index.ts +6 -0
- package/src/workers/queue-delivery.ts +309 -0
- package/src/workers/queue-worker.ts +260 -0
- package/src/workers/worker.ts +87 -0
- package/src/workflows/builders.ts +471 -0
- package/src/workflows/errors.ts +13 -0
- package/src/workflows/index.ts +94 -0
- package/src/workflows/request.ts +161 -0
- package/src/workflows/runtime.ts +68 -0
- package/src/workflows/snapshot.ts +383 -0
- package/src/workflows/types.ts +781 -0
- package/src/workflows/validation.ts +572 -0
|
@@ -0,0 +1,1345 @@
|
|
|
1
|
+
import { type AuthorizationContext, assertAuthorized } from "../../authorization"
|
|
2
|
+
import type { OntologyRegistry } from "../../ontology"
|
|
3
|
+
import type {
|
|
4
|
+
CountObjectsResult,
|
|
5
|
+
ExistsObjectsResult,
|
|
6
|
+
ExpandedLinkValue,
|
|
7
|
+
ExpandedObjectRow,
|
|
8
|
+
FacetObjectsResult,
|
|
9
|
+
ObjectFacetRequest,
|
|
10
|
+
ObjectFacetResult,
|
|
11
|
+
ObjectLinkRow,
|
|
12
|
+
ObjectQueryCapabilities,
|
|
13
|
+
ObjectRow,
|
|
14
|
+
ObjectRowLinks,
|
|
15
|
+
ObjectStorage,
|
|
16
|
+
QueryObjectsResult,
|
|
17
|
+
} from "../../storage"
|
|
18
|
+
import {
|
|
19
|
+
ObjectQueryExecutionError,
|
|
20
|
+
ObjectQueryPlanningError,
|
|
21
|
+
ObjectQueryValidationError,
|
|
22
|
+
} from "./errors"
|
|
23
|
+
import type {
|
|
24
|
+
ObjectExpansion,
|
|
25
|
+
ObjectQuery,
|
|
26
|
+
ObjectQueryPredicate,
|
|
27
|
+
ObjectQueryResultShape,
|
|
28
|
+
ObjectQuerySortField,
|
|
29
|
+
} from "./ir"
|
|
30
|
+
import { normalizeObjectQuery } from "./normalize"
|
|
31
|
+
import { type ObjectQueryPlan, type ObjectQueryPlanningOptions, planObjectQuery } from "./planner"
|
|
32
|
+
import { compareQueryScalarValues, queryScalarValuesEqual } from "./scalar-values"
|
|
33
|
+
import {
|
|
34
|
+
type ObjectQueryValidationIssue,
|
|
35
|
+
resolveObjectQueryResultShape,
|
|
36
|
+
type ValidatedObjectQuery,
|
|
37
|
+
validateObjectQuery,
|
|
38
|
+
} from "./validate"
|
|
39
|
+
|
|
40
|
+
export interface QueryExecutorOptions
|
|
41
|
+
extends Omit<
|
|
42
|
+
ObjectQueryPlanningOptions,
|
|
43
|
+
| "capabilities"
|
|
44
|
+
| "operation"
|
|
45
|
+
| "hasQueryObjects"
|
|
46
|
+
| "hasCountObjects"
|
|
47
|
+
| "hasExistsObjects"
|
|
48
|
+
| "hasFacetObjects"
|
|
49
|
+
> {
|
|
50
|
+
ontology: OntologyRegistry
|
|
51
|
+
storage: ObjectStorage
|
|
52
|
+
maxLimit?: number
|
|
53
|
+
maxPageSize?: number
|
|
54
|
+
maxFacetLimit?: number
|
|
55
|
+
/**
|
|
56
|
+
* Per-parent cap on how many links a single `expand` hydrates, applied as a
|
|
57
|
+
* top-N trim after `orderBy` (mirrors `maxLimit` for the result set). An
|
|
58
|
+
* expansion's own `limit` narrows this further; the cap is the backstop.
|
|
59
|
+
*/
|
|
60
|
+
maxExpansionFanout?: number
|
|
61
|
+
/** When present, every object type the query touches must be viewable. */
|
|
62
|
+
authorization?: AuthorizationContext
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface ExecuteObjectQueryInput {
|
|
66
|
+
projectId: string
|
|
67
|
+
query: ObjectQuery
|
|
68
|
+
includeTotal?: boolean
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface ExecuteObjectQueryResult extends QueryObjectsResult {
|
|
72
|
+
plan: ObjectQueryPlan
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface ExecuteObjectCountInput {
|
|
76
|
+
projectId: string
|
|
77
|
+
query: ObjectQuery
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface ExecuteObjectCountResult extends CountObjectsResult {
|
|
81
|
+
plan: ObjectQueryPlan
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface ExecuteObjectExistsInput {
|
|
85
|
+
projectId: string
|
|
86
|
+
query: ObjectQuery
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface ExecuteObjectExistsResult extends ExistsObjectsResult {
|
|
90
|
+
plan: ObjectQueryPlan
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface ExecuteObjectFacetsInput {
|
|
94
|
+
projectId: string
|
|
95
|
+
query: ObjectQuery
|
|
96
|
+
facets: readonly ObjectFacetRequest[]
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface ExecuteObjectFacetsResult extends FacetObjectsResult {
|
|
100
|
+
plan: ObjectQueryPlan
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
type FallbackEntry = {
|
|
104
|
+
row: ObjectRow
|
|
105
|
+
order: number
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
type FallbackEvaluation = {
|
|
109
|
+
entries: FallbackEntry[]
|
|
110
|
+
total: number
|
|
111
|
+
hasMore: boolean
|
|
112
|
+
nextPageToken?: string
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const DEFAULT_MAX_FALLBACK_ROWS = 1_000
|
|
116
|
+
const DEFAULT_MAX_FACET_LIMIT = 1_000
|
|
117
|
+
const DEFAULT_MAX_EXPANSION_FANOUT = 1_000
|
|
118
|
+
|
|
119
|
+
// Fallback page tokens are local to the core executor. Provider page tokens are
|
|
120
|
+
// opaque and should only be interpreted by the provider that returned them.
|
|
121
|
+
const PAGE_TOKEN_PREFIX = "offset:"
|
|
122
|
+
|
|
123
|
+
export class QueryExecutor {
|
|
124
|
+
constructor(private readonly options: QueryExecutorOptions) {}
|
|
125
|
+
|
|
126
|
+
async execute(input: ExecuteObjectQueryInput): Promise<ExecuteObjectQueryResult> {
|
|
127
|
+
return executeObjectQuery(input, this.options)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
async count(input: ExecuteObjectCountInput): Promise<ExecuteObjectCountResult> {
|
|
131
|
+
return countObjects(input, this.options)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async exists(input: ExecuteObjectExistsInput): Promise<ExecuteObjectExistsResult> {
|
|
135
|
+
return existsObjects(input, this.options)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async facets(input: ExecuteObjectFacetsInput): Promise<ExecuteObjectFacetsResult> {
|
|
139
|
+
return facetObjects(input, this.options)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export async function executeObjectQuery(
|
|
144
|
+
input: ExecuteObjectQueryInput,
|
|
145
|
+
options: QueryExecutorOptions
|
|
146
|
+
): Promise<ExecuteObjectQueryResult> {
|
|
147
|
+
const normalized = normalizeObjectQuery(input.query)
|
|
148
|
+
const validated = validateObjectQuery(normalized, {
|
|
149
|
+
ontology: options.ontology,
|
|
150
|
+
maxLimit: options.maxLimit,
|
|
151
|
+
maxPageSize: options.maxPageSize,
|
|
152
|
+
normalize: false,
|
|
153
|
+
})
|
|
154
|
+
assertQueryViewable(validated, options.authorization)
|
|
155
|
+
const capabilities = options.storage.queryCapabilities()
|
|
156
|
+
const hasQueryObjects = typeof options.storage.queryObjects === "function"
|
|
157
|
+
const hasCountObjects = typeof options.storage.countObjects === "function"
|
|
158
|
+
const hasExistsObjects = typeof options.storage.existsObjects === "function"
|
|
159
|
+
const hasFacetObjects = typeof options.storage.facetObjects === "function"
|
|
160
|
+
const plannedQuery = expandPushdownQuery(
|
|
161
|
+
validated.query,
|
|
162
|
+
options.ontology,
|
|
163
|
+
capabilities,
|
|
164
|
+
{
|
|
165
|
+
hasQueryObjects,
|
|
166
|
+
hasCountObjects,
|
|
167
|
+
hasExistsObjects,
|
|
168
|
+
hasFacetObjects,
|
|
169
|
+
allowFallback: options.allowFallback,
|
|
170
|
+
maxFallbackRows: options.maxFallbackRows,
|
|
171
|
+
requiresExplicitFallbackBound: options.requiresExplicitFallbackBound,
|
|
172
|
+
},
|
|
173
|
+
options.maxExpansionFanout
|
|
174
|
+
)
|
|
175
|
+
const plan = planObjectQuery(plannedQuery, {
|
|
176
|
+
capabilities,
|
|
177
|
+
hasQueryObjects,
|
|
178
|
+
hasCountObjects,
|
|
179
|
+
hasExistsObjects,
|
|
180
|
+
hasFacetObjects,
|
|
181
|
+
allowFallback: options.allowFallback,
|
|
182
|
+
maxFallbackRows: options.maxFallbackRows,
|
|
183
|
+
requiresExplicitFallbackBound: options.requiresExplicitFallbackBound,
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
if (plan.mode === "rejected") {
|
|
187
|
+
throw new ObjectQueryPlanningError(plan.issues)
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (plan.mode === "pushdown") {
|
|
191
|
+
if (!options.storage.queryObjects) {
|
|
192
|
+
throw new ObjectQueryPlanningError(plan.providerIssues)
|
|
193
|
+
}
|
|
194
|
+
const result = await options.storage.queryObjects({
|
|
195
|
+
projectId: input.projectId,
|
|
196
|
+
query: plan.query,
|
|
197
|
+
includeTotal: input.includeTotal,
|
|
198
|
+
})
|
|
199
|
+
return { ...result, plan }
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// The planner admits only the small fallback subset; unsupported cases below
|
|
203
|
+
// remain as defensive guards against future planner drift.
|
|
204
|
+
const fallback = await executeFallbackQuery(input.projectId, validated.query, options, {
|
|
205
|
+
includeTotal: input.includeTotal,
|
|
206
|
+
})
|
|
207
|
+
return { ...fallback, plan }
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export async function countObjects(
|
|
211
|
+
input: ExecuteObjectCountInput,
|
|
212
|
+
options: QueryExecutorOptions
|
|
213
|
+
): Promise<ExecuteObjectCountResult> {
|
|
214
|
+
const normalized = normalizeObjectQuery(input.query)
|
|
215
|
+
const validated = validateObjectQuery(normalized, {
|
|
216
|
+
ontology: options.ontology,
|
|
217
|
+
maxLimit: options.maxLimit,
|
|
218
|
+
maxPageSize: options.maxPageSize,
|
|
219
|
+
normalize: false,
|
|
220
|
+
})
|
|
221
|
+
assertQueryViewable(validated, options.authorization)
|
|
222
|
+
const capabilities = options.storage.queryCapabilities()
|
|
223
|
+
const hasQueryObjects = typeof options.storage.queryObjects === "function"
|
|
224
|
+
const hasCountObjects = typeof options.storage.countObjects === "function"
|
|
225
|
+
const hasExistsObjects = typeof options.storage.existsObjects === "function"
|
|
226
|
+
const hasFacetObjects = typeof options.storage.facetObjects === "function"
|
|
227
|
+
const aggregateQuery = stripOuterRowShape(validated.query)
|
|
228
|
+
const plannedQuery = expandPushdownQuery(aggregateQuery, options.ontology, capabilities, {
|
|
229
|
+
operation: "countObjects",
|
|
230
|
+
hasQueryObjects,
|
|
231
|
+
hasCountObjects,
|
|
232
|
+
hasExistsObjects,
|
|
233
|
+
hasFacetObjects,
|
|
234
|
+
allowFallback: options.allowFallback,
|
|
235
|
+
maxFallbackRows: options.maxFallbackRows,
|
|
236
|
+
requiresExplicitFallbackBound: options.requiresExplicitFallbackBound,
|
|
237
|
+
})
|
|
238
|
+
const plan = planObjectQuery(plannedQuery, {
|
|
239
|
+
capabilities,
|
|
240
|
+
operation: "countObjects",
|
|
241
|
+
hasQueryObjects,
|
|
242
|
+
hasCountObjects,
|
|
243
|
+
hasExistsObjects,
|
|
244
|
+
hasFacetObjects,
|
|
245
|
+
allowFallback: options.allowFallback,
|
|
246
|
+
maxFallbackRows: options.maxFallbackRows,
|
|
247
|
+
requiresExplicitFallbackBound: options.requiresExplicitFallbackBound,
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
if (plan.mode === "rejected") {
|
|
251
|
+
throw new ObjectQueryPlanningError(plan.issues)
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (plan.mode === "pushdown") {
|
|
255
|
+
if (!options.storage.countObjects) {
|
|
256
|
+
throw new ObjectQueryPlanningError(plan.providerIssues)
|
|
257
|
+
}
|
|
258
|
+
const result = await options.storage.countObjects({
|
|
259
|
+
projectId: input.projectId,
|
|
260
|
+
query: plan.query,
|
|
261
|
+
})
|
|
262
|
+
return { ...result, plan }
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const maxRows = options.maxFallbackRows ?? DEFAULT_MAX_FALLBACK_ROWS
|
|
266
|
+
const evaluation = await evaluateFallbackQuery(input.projectId, aggregateQuery, options, maxRows)
|
|
267
|
+
return { count: evaluation.total, plan }
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export async function existsObjects(
|
|
271
|
+
input: ExecuteObjectExistsInput,
|
|
272
|
+
options: QueryExecutorOptions
|
|
273
|
+
): Promise<ExecuteObjectExistsResult> {
|
|
274
|
+
const normalized = normalizeObjectQuery(input.query)
|
|
275
|
+
const validated = validateObjectQuery(normalized, {
|
|
276
|
+
ontology: options.ontology,
|
|
277
|
+
maxLimit: options.maxLimit,
|
|
278
|
+
maxPageSize: options.maxPageSize,
|
|
279
|
+
normalize: false,
|
|
280
|
+
})
|
|
281
|
+
assertQueryViewable(validated, options.authorization)
|
|
282
|
+
const capabilities = options.storage.queryCapabilities()
|
|
283
|
+
const hasQueryObjects = typeof options.storage.queryObjects === "function"
|
|
284
|
+
const hasCountObjects = typeof options.storage.countObjects === "function"
|
|
285
|
+
const hasExistsObjects = typeof options.storage.existsObjects === "function"
|
|
286
|
+
const hasFacetObjects = typeof options.storage.facetObjects === "function"
|
|
287
|
+
const aggregateQuery = stripOuterRowShape(validated.query)
|
|
288
|
+
const plannedQuery = expandPushdownQuery(aggregateQuery, options.ontology, capabilities, {
|
|
289
|
+
operation: "existsObjects",
|
|
290
|
+
hasQueryObjects,
|
|
291
|
+
hasCountObjects,
|
|
292
|
+
hasExistsObjects,
|
|
293
|
+
hasFacetObjects,
|
|
294
|
+
allowFallback: options.allowFallback,
|
|
295
|
+
maxFallbackRows: options.maxFallbackRows,
|
|
296
|
+
requiresExplicitFallbackBound: options.requiresExplicitFallbackBound,
|
|
297
|
+
})
|
|
298
|
+
const plan = planObjectQuery(plannedQuery, {
|
|
299
|
+
capabilities,
|
|
300
|
+
operation: "existsObjects",
|
|
301
|
+
hasQueryObjects,
|
|
302
|
+
hasCountObjects,
|
|
303
|
+
hasExistsObjects,
|
|
304
|
+
hasFacetObjects,
|
|
305
|
+
allowFallback: options.allowFallback,
|
|
306
|
+
maxFallbackRows: options.maxFallbackRows,
|
|
307
|
+
requiresExplicitFallbackBound: options.requiresExplicitFallbackBound,
|
|
308
|
+
})
|
|
309
|
+
|
|
310
|
+
if (plan.mode === "rejected") {
|
|
311
|
+
throw new ObjectQueryPlanningError(plan.issues)
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (plan.mode === "pushdown") {
|
|
315
|
+
if (!options.storage.existsObjects) {
|
|
316
|
+
throw new ObjectQueryPlanningError(plan.providerIssues)
|
|
317
|
+
}
|
|
318
|
+
const result = await options.storage.existsObjects({
|
|
319
|
+
projectId: input.projectId,
|
|
320
|
+
query: plan.query,
|
|
321
|
+
})
|
|
322
|
+
return { ...result, plan }
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const maxRows = options.maxFallbackRows ?? DEFAULT_MAX_FALLBACK_ROWS
|
|
326
|
+
const evaluation = await evaluateFallbackQuery(input.projectId, aggregateQuery, options, maxRows)
|
|
327
|
+
return { exists: evaluation.total > 0, plan }
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export async function facetObjects(
|
|
331
|
+
input: ExecuteObjectFacetsInput,
|
|
332
|
+
options: QueryExecutorOptions
|
|
333
|
+
): Promise<ExecuteObjectFacetsResult> {
|
|
334
|
+
const normalized = normalizeObjectQuery(input.query)
|
|
335
|
+
const validated = validateObjectQuery(normalized, {
|
|
336
|
+
ontology: options.ontology,
|
|
337
|
+
maxLimit: options.maxLimit,
|
|
338
|
+
maxPageSize: options.maxPageSize,
|
|
339
|
+
normalize: false,
|
|
340
|
+
})
|
|
341
|
+
assertQueryViewable(validated, options.authorization)
|
|
342
|
+
const facets = validateFacetRequests(input.facets, validated.result.objectTypeIds, options)
|
|
343
|
+
const aggregateQuery = stripOuterRowShape(validated.query)
|
|
344
|
+
const capabilities = options.storage.queryCapabilities()
|
|
345
|
+
const hasQueryObjects = typeof options.storage.queryObjects === "function"
|
|
346
|
+
const hasCountObjects = typeof options.storage.countObjects === "function"
|
|
347
|
+
const hasExistsObjects = typeof options.storage.existsObjects === "function"
|
|
348
|
+
const hasFacetObjects = typeof options.storage.facetObjects === "function"
|
|
349
|
+
const plannedQuery = expandPushdownQuery(aggregateQuery, options.ontology, capabilities, {
|
|
350
|
+
operation: "facetObjects",
|
|
351
|
+
hasQueryObjects,
|
|
352
|
+
hasCountObjects,
|
|
353
|
+
hasExistsObjects,
|
|
354
|
+
hasFacetObjects,
|
|
355
|
+
allowFallback: options.allowFallback,
|
|
356
|
+
maxFallbackRows: options.maxFallbackRows,
|
|
357
|
+
requiresExplicitFallbackBound: options.requiresExplicitFallbackBound,
|
|
358
|
+
})
|
|
359
|
+
const plan = planObjectQuery(plannedQuery, {
|
|
360
|
+
capabilities,
|
|
361
|
+
operation: "facetObjects",
|
|
362
|
+
hasQueryObjects,
|
|
363
|
+
hasCountObjects,
|
|
364
|
+
hasExistsObjects,
|
|
365
|
+
hasFacetObjects,
|
|
366
|
+
allowFallback: options.allowFallback,
|
|
367
|
+
maxFallbackRows: options.maxFallbackRows,
|
|
368
|
+
requiresExplicitFallbackBound: options.requiresExplicitFallbackBound,
|
|
369
|
+
})
|
|
370
|
+
|
|
371
|
+
if (plan.mode === "rejected") {
|
|
372
|
+
throw new ObjectQueryPlanningError(plan.issues)
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
if (plan.mode === "pushdown") {
|
|
376
|
+
if (!options.storage.facetObjects) {
|
|
377
|
+
throw new ObjectQueryPlanningError(plan.providerIssues)
|
|
378
|
+
}
|
|
379
|
+
const result = await options.storage.facetObjects({
|
|
380
|
+
projectId: input.projectId,
|
|
381
|
+
query: plan.query,
|
|
382
|
+
facets,
|
|
383
|
+
})
|
|
384
|
+
return { ...result, plan }
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
const maxRows = options.maxFallbackRows ?? DEFAULT_MAX_FALLBACK_ROWS
|
|
388
|
+
const evaluation = await evaluateFallbackQuery(input.projectId, aggregateQuery, options, maxRows)
|
|
389
|
+
return {
|
|
390
|
+
facets: buildFacetResults(
|
|
391
|
+
evaluation.entries.map((entry) => entry.row),
|
|
392
|
+
facets
|
|
393
|
+
),
|
|
394
|
+
plan,
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// Authorization happens at planning time: a scoped query must hold a view
|
|
399
|
+
// grant for every object type it touches, before any storage call runs.
|
|
400
|
+
function assertQueryViewable(
|
|
401
|
+
validated: ValidatedObjectQuery,
|
|
402
|
+
authorization: AuthorizationContext | undefined
|
|
403
|
+
): void {
|
|
404
|
+
assertAuthorized(
|
|
405
|
+
{ authorization },
|
|
406
|
+
{ kind: "object.query", touchedObjectTypeIds: validated.touchedObjectTypeIds }
|
|
407
|
+
)
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
interface ExpansionResolutionContext {
|
|
411
|
+
ontology: OntologyRegistry
|
|
412
|
+
maxExpansionFanout: number | undefined
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
function expandPushdownQuery(
|
|
416
|
+
query: ObjectQuery,
|
|
417
|
+
ontology: OntologyRegistry,
|
|
418
|
+
capabilities: ObjectQueryCapabilities,
|
|
419
|
+
planning: Omit<ObjectQueryPlanningOptions, "capabilities">,
|
|
420
|
+
maxExpansionFanout?: number
|
|
421
|
+
): ObjectQuery {
|
|
422
|
+
// Resolve each expansion's cardinality and effective per-parent limit from the
|
|
423
|
+
// ontology so a provider can push the graph read down without one. The planner
|
|
424
|
+
// only admits expand pushdown once every expansion carries a cardinality, so a
|
|
425
|
+
// mixed/unresolved expansion (e.g. a polymorphic parent whose branches
|
|
426
|
+
// disagree) cleanly stays on the fallback.
|
|
427
|
+
const ctx: ExpansionResolutionContext = { ontology, maxExpansionFanout }
|
|
428
|
+
const annotated = resolveExpansions(query, ctx)
|
|
429
|
+
const expanded = expandIncludeSubtypes(annotated, ontology)
|
|
430
|
+
if (expanded === annotated) return annotated
|
|
431
|
+
|
|
432
|
+
const plan = planObjectQuery(expanded, { ...planning, capabilities, allowFallback: false })
|
|
433
|
+
return plan.mode === "pushdown" ? expanded : annotated
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// Walk to the (normalized, outermost) expand node and annotate every expansion
|
|
437
|
+
// with its resolved cardinality and bounded limit. Output-shaping only — never
|
|
438
|
+
// changes which objects match — so it composes with `expandIncludeSubtypes`.
|
|
439
|
+
function resolveExpansions(query: ObjectQuery, ctx: ExpansionResolutionContext): ObjectQuery {
|
|
440
|
+
switch (query.kind) {
|
|
441
|
+
case "expand": {
|
|
442
|
+
const parentShape = safeResultShape(query.input, ctx.ontology)
|
|
443
|
+
return {
|
|
444
|
+
...query,
|
|
445
|
+
input: resolveExpansions(query.input, ctx),
|
|
446
|
+
expansions: query.expansions.map((expansion) =>
|
|
447
|
+
annotateExpansion(expansion, parentShape, ctx)
|
|
448
|
+
),
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
case "start":
|
|
452
|
+
return query
|
|
453
|
+
case "set":
|
|
454
|
+
return {
|
|
455
|
+
...query,
|
|
456
|
+
inputs: query.inputs.map((input) => resolveExpansions(input, ctx)),
|
|
457
|
+
}
|
|
458
|
+
case "filter":
|
|
459
|
+
case "text":
|
|
460
|
+
case "vector":
|
|
461
|
+
case "traverse":
|
|
462
|
+
case "sort":
|
|
463
|
+
case "limit":
|
|
464
|
+
case "page":
|
|
465
|
+
case "project":
|
|
466
|
+
return { ...query, input: resolveExpansions(query.input, ctx) }
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function annotateExpansion(
|
|
471
|
+
expansion: ObjectExpansion,
|
|
472
|
+
parentShape: ObjectQueryResultShape,
|
|
473
|
+
ctx: ExpansionResolutionContext
|
|
474
|
+
): ObjectExpansion {
|
|
475
|
+
const cardinality = resolveUniformCardinality(expansion, parentShape, ctx.ontology)
|
|
476
|
+
// Bake the per-parent top-N the provider must apply: the authored limit clamped
|
|
477
|
+
// by the fanout backstop (the fallback computes the same via
|
|
478
|
+
// `effectiveExpansionFanout`). Always defined afterwards, so the compiler need
|
|
479
|
+
// not re-derive the cap.
|
|
480
|
+
const limit = effectiveExpansionFanout(expansion.limit, ctx.maxExpansionFanout)
|
|
481
|
+
const base: ObjectExpansion = cardinality
|
|
482
|
+
? { ...expansion, cardinality, limit }
|
|
483
|
+
: { ...expansion, limit }
|
|
484
|
+
|
|
485
|
+
if (!expansion.expand || expansion.expand.length === 0) return base
|
|
486
|
+
|
|
487
|
+
const targetShape = resolveExpansionTargetShape(expansion, parentShape, ctx.ontology)
|
|
488
|
+
return {
|
|
489
|
+
...base,
|
|
490
|
+
expand: expansion.expand.map((nested) => annotateExpansion(nested, targetShape, ctx)),
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// The attached value shape is uniform only when every parent type resolves the
|
|
495
|
+
// link to the same cardinality. A non-declaring parent type contributes "many"
|
|
496
|
+
// (matching the fallback's `link?.cardinality ?? "many"`); incoming is always
|
|
497
|
+
// many-to-one. A mixed result returns undefined, keeping the query on fallback.
|
|
498
|
+
function resolveUniformCardinality(
|
|
499
|
+
expansion: ObjectExpansion,
|
|
500
|
+
parentShape: ObjectQueryResultShape,
|
|
501
|
+
ontology: OntologyRegistry
|
|
502
|
+
): "one" | "many" | undefined {
|
|
503
|
+
if (expansion.direction === "incoming") return "many"
|
|
504
|
+
if (parentShape.objectTypeIds.length === 0) return undefined
|
|
505
|
+
|
|
506
|
+
const cardinalities = new Set<"one" | "many">()
|
|
507
|
+
for (const objectTypeId of parentShape.objectTypeIds) {
|
|
508
|
+
const objectType = ontology.getObjectTypeById(objectTypeId)
|
|
509
|
+
const link = objectType?.links.find((candidate) => candidate.id === expansion.linkId)
|
|
510
|
+
cardinalities.add(link?.cardinality ?? "many")
|
|
511
|
+
}
|
|
512
|
+
return cardinalities.size === 1 ? [...cardinalities][0] : undefined
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// The objects reached by an expansion are exactly the result of the equivalent
|
|
516
|
+
// traverse, so reuse the shared shape resolver instead of re-deriving link
|
|
517
|
+
// targets. Used to carry the parent context into nested expansions.
|
|
518
|
+
function resolveExpansionTargetShape(
|
|
519
|
+
expansion: ObjectExpansion,
|
|
520
|
+
parentShape: ObjectQueryResultShape,
|
|
521
|
+
ontology: OntologyRegistry
|
|
522
|
+
): ObjectQueryResultShape {
|
|
523
|
+
if (parentShape.objectTypeIds.length === 0) return { objectTypeIds: [] }
|
|
524
|
+
|
|
525
|
+
const input: ObjectQuery =
|
|
526
|
+
parentShape.objectTypeIds.length === 1
|
|
527
|
+
? { kind: "start", objectTypeId: parentShape.objectTypeIds[0] }
|
|
528
|
+
: {
|
|
529
|
+
kind: "set",
|
|
530
|
+
op: "union",
|
|
531
|
+
inputs: parentShape.objectTypeIds.map((objectTypeId) => ({
|
|
532
|
+
kind: "start",
|
|
533
|
+
objectTypeId,
|
|
534
|
+
})),
|
|
535
|
+
}
|
|
536
|
+
const traverse: ObjectQuery = {
|
|
537
|
+
kind: "traverse",
|
|
538
|
+
input,
|
|
539
|
+
linkId: expansion.linkId,
|
|
540
|
+
direction: expansion.direction,
|
|
541
|
+
...(expansion.sourceObjectTypeId === undefined
|
|
542
|
+
? {}
|
|
543
|
+
: { sourceObjectTypeId: expansion.sourceObjectTypeId }),
|
|
544
|
+
}
|
|
545
|
+
return safeResultShape(traverse, ontology)
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// Cardinality resolution is a pushdown optimization, never a correctness
|
|
549
|
+
// requirement: any failure to resolve a shape (the resolver throws on a query it
|
|
550
|
+
// considers invalid) must degrade to "unresolved", which the planner reads as
|
|
551
|
+
// "keep this on the fallback" rather than surfacing an error.
|
|
552
|
+
function safeResultShape(query: ObjectQuery, ontology: OntologyRegistry): ObjectQueryResultShape {
|
|
553
|
+
try {
|
|
554
|
+
return resolveObjectQueryResultShape(query, { ontology })
|
|
555
|
+
} catch {
|
|
556
|
+
return { objectTypeIds: [] }
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
function expandIncludeSubtypes(query: ObjectQuery, ontology: OntologyRegistry): ObjectQuery {
|
|
561
|
+
switch (query.kind) {
|
|
562
|
+
case "start": {
|
|
563
|
+
if (query.includeSubtypes !== true) return query
|
|
564
|
+
const objectTypeIds = [query.objectTypeId, ...ontology.listSubTypes(query.objectTypeId)]
|
|
565
|
+
if (objectTypeIds.length === 1) return { kind: "start", objectTypeId: query.objectTypeId }
|
|
566
|
+
return {
|
|
567
|
+
kind: "set",
|
|
568
|
+
op: "union",
|
|
569
|
+
inputs: objectTypeIds.map((objectTypeId) => ({ kind: "start", objectTypeId })),
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
case "filter":
|
|
573
|
+
case "text":
|
|
574
|
+
case "vector":
|
|
575
|
+
case "traverse":
|
|
576
|
+
case "sort":
|
|
577
|
+
case "limit":
|
|
578
|
+
case "page":
|
|
579
|
+
case "project":
|
|
580
|
+
case "expand":
|
|
581
|
+
return { ...query, input: expandIncludeSubtypes(query.input, ontology) }
|
|
582
|
+
case "set":
|
|
583
|
+
return {
|
|
584
|
+
...query,
|
|
585
|
+
inputs: query.inputs.map((input) => expandIncludeSubtypes(input, ontology)),
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
async function executeFallbackQuery(
|
|
591
|
+
projectId: string,
|
|
592
|
+
query: ObjectQuery,
|
|
593
|
+
options: QueryExecutorOptions,
|
|
594
|
+
resultOptions: { includeTotal?: boolean }
|
|
595
|
+
): Promise<QueryObjectsResult> {
|
|
596
|
+
const maxRows = options.maxFallbackRows ?? DEFAULT_MAX_FALLBACK_ROWS
|
|
597
|
+
const evaluation = await evaluateFallbackQuery(projectId, query, options, maxRows)
|
|
598
|
+
return {
|
|
599
|
+
objects: evaluation.entries.map((entry) => entry.row),
|
|
600
|
+
hasMore: evaluation.hasMore,
|
|
601
|
+
nextPageToken: evaluation.nextPageToken,
|
|
602
|
+
...(resultOptions.includeTotal === false ? {} : { total: evaluation.total }),
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
async function evaluateFallbackQuery(
|
|
607
|
+
projectId: string,
|
|
608
|
+
query: ObjectQuery,
|
|
609
|
+
options: QueryExecutorOptions,
|
|
610
|
+
maxRows: number
|
|
611
|
+
): Promise<FallbackEvaluation> {
|
|
612
|
+
switch (query.kind) {
|
|
613
|
+
case "start":
|
|
614
|
+
return evaluateFallbackStart(projectId, query, options, maxRows)
|
|
615
|
+
case "filter": {
|
|
616
|
+
const input = await evaluateFallbackQuery(projectId, query.input, options, maxRows)
|
|
617
|
+
return completeFallbackEvaluation(
|
|
618
|
+
input.entries.filter((entry) => matchesPredicate(entry.row, query.predicate))
|
|
619
|
+
)
|
|
620
|
+
}
|
|
621
|
+
case "sort": {
|
|
622
|
+
const input = await evaluateFallbackQuery(projectId, query.input, options, maxRows)
|
|
623
|
+
return {
|
|
624
|
+
...input,
|
|
625
|
+
entries: sortEntries(input.entries, query.fields),
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
case "limit": {
|
|
629
|
+
const input = await evaluateFallbackQuery(projectId, query.input, options, maxRows)
|
|
630
|
+
const limit = Math.max(0, query.limit)
|
|
631
|
+
return {
|
|
632
|
+
entries: input.entries.slice(0, limit),
|
|
633
|
+
total: input.entries.length,
|
|
634
|
+
hasMore: limit < input.entries.length,
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
case "page": {
|
|
638
|
+
const input = await evaluateFallbackQuery(projectId, query.input, options, maxRows)
|
|
639
|
+
const offset = decodePageOffset(query.pageToken)
|
|
640
|
+
const pageSize = Math.max(0, query.pageSize)
|
|
641
|
+
const nextOffset = offset + pageSize
|
|
642
|
+
const hasMore = pageSize > 0 && nextOffset < input.entries.length
|
|
643
|
+
return {
|
|
644
|
+
entries: input.entries.slice(offset, nextOffset),
|
|
645
|
+
total: input.entries.length,
|
|
646
|
+
hasMore,
|
|
647
|
+
nextPageToken: hasMore ? encodePageOffset(nextOffset) : undefined,
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
case "project": {
|
|
651
|
+
const input = await evaluateFallbackQuery(projectId, query.input, options, maxRows)
|
|
652
|
+
if (!query.properties) return input
|
|
653
|
+
const properties = query.properties
|
|
654
|
+
return {
|
|
655
|
+
...input,
|
|
656
|
+
entries: input.entries.map((entry) => ({
|
|
657
|
+
...entry,
|
|
658
|
+
row: projectRow(entry.row, properties),
|
|
659
|
+
})),
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
case "expand": {
|
|
663
|
+
// `expand` is output-shaping and normalized to the outermost layer: the
|
|
664
|
+
// input produces the bounded parent set, then we attach hydrated links
|
|
665
|
+
// without changing which objects match.
|
|
666
|
+
const input = await evaluateFallbackQuery(projectId, query.input, options, maxRows)
|
|
667
|
+
const enriched = await hydrateExpansions(
|
|
668
|
+
projectId,
|
|
669
|
+
input.entries.map((entry) => entry.row),
|
|
670
|
+
query.expansions,
|
|
671
|
+
options
|
|
672
|
+
)
|
|
673
|
+
return {
|
|
674
|
+
...input,
|
|
675
|
+
entries: input.entries.map((entry, index) => ({ ...entry, row: enriched[index] })),
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
case "text":
|
|
679
|
+
case "vector":
|
|
680
|
+
case "traverse":
|
|
681
|
+
case "set":
|
|
682
|
+
throw new ObjectQueryExecutionError(
|
|
683
|
+
"fallback_node_not_supported",
|
|
684
|
+
`Fallback execution does not support query node '${query.kind}'`
|
|
685
|
+
)
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* A candidate neighbour for one parent under a single expansion: the object to
|
|
691
|
+
* hydrate plus the metadata carried on the link edge. For outgoing expansions
|
|
692
|
+
* the neighbour is the link target; for incoming it is the link source.
|
|
693
|
+
*/
|
|
694
|
+
type ExpansionEdge = {
|
|
695
|
+
neighborTypeId: string
|
|
696
|
+
neighborId: string
|
|
697
|
+
edgeProperties?: Record<string, unknown>
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
// Attach `links` to each parent row by hydrating every expansion over the batch
|
|
701
|
+
// storage primitives. Returns fresh rows — stored rows are read by reference, so
|
|
702
|
+
// we never mutate them in place.
|
|
703
|
+
async function hydrateExpansions(
|
|
704
|
+
projectId: string,
|
|
705
|
+
parents: readonly ObjectRow[],
|
|
706
|
+
expansions: readonly ObjectExpansion[],
|
|
707
|
+
options: QueryExecutorOptions
|
|
708
|
+
): Promise<ObjectRow[]> {
|
|
709
|
+
if (expansions.length === 0) {
|
|
710
|
+
return parents.map((parent) => ({ ...parent }))
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
const linksByParent: ObjectRowLinks[] = parents.map(() => ({}))
|
|
714
|
+
for (const expansion of expansions) {
|
|
715
|
+
const values = await hydrateExpansion(projectId, parents, expansion, options)
|
|
716
|
+
values.forEach((value, index) => {
|
|
717
|
+
// Keyed by link id, matching the `row.links.<linkId>` authoring surface.
|
|
718
|
+
// Same-id expansions in opposing directions would collide here, but
|
|
719
|
+
// normalization keeps them distinct and that pairing is not yet exposed.
|
|
720
|
+
linksByParent[index][expansion.linkId] = value
|
|
721
|
+
})
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
return parents.map((parent, index) => ({ ...parent, links: linksByParent[index] }))
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
// Resolve one expansion for every parent, returning a value aligned to `parents`.
|
|
728
|
+
async function hydrateExpansion(
|
|
729
|
+
projectId: string,
|
|
730
|
+
parents: readonly ObjectRow[],
|
|
731
|
+
expansion: ObjectExpansion,
|
|
732
|
+
options: QueryExecutorOptions
|
|
733
|
+
): Promise<ExpandedLinkValue[]> {
|
|
734
|
+
const edgesByParent =
|
|
735
|
+
expansion.direction === "incoming"
|
|
736
|
+
? await collectIncomingEdges(projectId, parents, expansion, options)
|
|
737
|
+
: await collectOutgoingEdges(projectId, parents, expansion, options)
|
|
738
|
+
|
|
739
|
+
// Ordering is against target properties, so the target rows must be loaded
|
|
740
|
+
// before the per-parent top-N trim can run.
|
|
741
|
+
const baseTargets = await fetchExpansionTargets(projectId, edgesByParent, options)
|
|
742
|
+
const trimmedByParent = edgesByParent.map((edges) =>
|
|
743
|
+
trimExpansionEdges(edges, expansion, baseTargets, options)
|
|
744
|
+
)
|
|
745
|
+
|
|
746
|
+
const enrichedByKey = await enrichExpansionTargets(
|
|
747
|
+
projectId,
|
|
748
|
+
trimmedByParent,
|
|
749
|
+
baseTargets,
|
|
750
|
+
expansion,
|
|
751
|
+
options
|
|
752
|
+
)
|
|
753
|
+
|
|
754
|
+
return parents.map((parent, index) => {
|
|
755
|
+
const expanded: ExpandedObjectRow[] = []
|
|
756
|
+
for (const edge of trimmedByParent[index]) {
|
|
757
|
+
const target = enrichedByKey.get(targetKey(edge.neighborTypeId, edge.neighborId))
|
|
758
|
+
// A dangling link (target removed) hydrates to nothing.
|
|
759
|
+
if (!target) continue
|
|
760
|
+
expanded.push(
|
|
761
|
+
edge.edgeProperties && Object.keys(edge.edgeProperties).length > 0
|
|
762
|
+
? { ...target, linkProperties: edge.edgeProperties }
|
|
763
|
+
: { ...target }
|
|
764
|
+
)
|
|
765
|
+
}
|
|
766
|
+
return toLinkValue(expanded, expansionCardinality(parent, expansion, options))
|
|
767
|
+
})
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
async function collectOutgoingEdges(
|
|
771
|
+
projectId: string,
|
|
772
|
+
parents: readonly ObjectRow[],
|
|
773
|
+
expansion: ObjectExpansion,
|
|
774
|
+
options: QueryExecutorOptions
|
|
775
|
+
): Promise<ExpansionEdge[][]> {
|
|
776
|
+
const linksByKey = await options.storage.listLinksBatch({
|
|
777
|
+
projectId,
|
|
778
|
+
items: parents.map((parent) => ({
|
|
779
|
+
objectTypeId: parent.objectTypeId,
|
|
780
|
+
objectId: parent.primaryId,
|
|
781
|
+
linkId: expansion.linkId,
|
|
782
|
+
})),
|
|
783
|
+
})
|
|
784
|
+
|
|
785
|
+
return parents.map((parent) => {
|
|
786
|
+
const links = linksByKey.get(`${parent.objectTypeId}:${parent.primaryId}:${expansion.linkId}`)
|
|
787
|
+
if (!links) return []
|
|
788
|
+
return links.map((link) => ({
|
|
789
|
+
neighborTypeId: link.targetTypeId,
|
|
790
|
+
neighborId: link.targetId,
|
|
791
|
+
edgeProperties: link.properties,
|
|
792
|
+
}))
|
|
793
|
+
})
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
async function collectIncomingEdges(
|
|
797
|
+
projectId: string,
|
|
798
|
+
parents: readonly ObjectRow[],
|
|
799
|
+
expansion: ObjectExpansion,
|
|
800
|
+
options: QueryExecutorOptions
|
|
801
|
+
): Promise<ExpansionEdge[][]> {
|
|
802
|
+
const incident = await options.storage.listIncidentLinksBatch({
|
|
803
|
+
projectId,
|
|
804
|
+
items: parents.map((parent) => ({
|
|
805
|
+
objectTypeId: parent.objectTypeId,
|
|
806
|
+
objectId: parent.primaryId,
|
|
807
|
+
})),
|
|
808
|
+
})
|
|
809
|
+
|
|
810
|
+
// Index links that point AT a parent (incoming) by that parent. The incident
|
|
811
|
+
// batch also returns outgoing links, so filter on the parent being the target.
|
|
812
|
+
const byTarget = new Map<string, ObjectLinkRow[]>()
|
|
813
|
+
for (const link of incident) {
|
|
814
|
+
if (link.linkId !== expansion.linkId) continue
|
|
815
|
+
if (expansion.sourceObjectTypeId && link.sourceTypeId !== expansion.sourceObjectTypeId) continue
|
|
816
|
+
const key = targetKey(link.targetTypeId, link.targetId)
|
|
817
|
+
const bucket = byTarget.get(key)
|
|
818
|
+
if (bucket) bucket.push(link)
|
|
819
|
+
else byTarget.set(key, [link])
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
return parents.map((parent) => {
|
|
823
|
+
const links = byTarget.get(targetKey(parent.objectTypeId, parent.primaryId))
|
|
824
|
+
if (!links) return []
|
|
825
|
+
// For an incoming expansion the hydrated object is the link's source.
|
|
826
|
+
return links.map((link) => ({
|
|
827
|
+
neighborTypeId: link.sourceTypeId,
|
|
828
|
+
neighborId: link.sourceId,
|
|
829
|
+
edgeProperties: link.properties,
|
|
830
|
+
}))
|
|
831
|
+
})
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
async function fetchExpansionTargets(
|
|
835
|
+
projectId: string,
|
|
836
|
+
edgesByParent: readonly ExpansionEdge[][],
|
|
837
|
+
options: QueryExecutorOptions
|
|
838
|
+
): Promise<Map<string, ObjectRow>> {
|
|
839
|
+
const seen = new Set<string>()
|
|
840
|
+
const items: { objectTypeId: string; primaryId: string }[] = []
|
|
841
|
+
for (const edges of edgesByParent) {
|
|
842
|
+
for (const edge of edges) {
|
|
843
|
+
const key = targetKey(edge.neighborTypeId, edge.neighborId)
|
|
844
|
+
if (seen.has(key)) continue
|
|
845
|
+
seen.add(key)
|
|
846
|
+
items.push({ objectTypeId: edge.neighborTypeId, primaryId: edge.neighborId })
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
if (items.length === 0) return new Map()
|
|
850
|
+
return options.storage.getByPrimaryIdBatch({ projectId, items })
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
// Recurse nested expansions over the unique retained targets so each target is
|
|
854
|
+
// hydrated once even when shared across parents, then key them for lookup.
|
|
855
|
+
async function enrichExpansionTargets(
|
|
856
|
+
projectId: string,
|
|
857
|
+
trimmedByParent: readonly ExpansionEdge[][],
|
|
858
|
+
baseTargets: Map<string, ObjectRow>,
|
|
859
|
+
expansion: ObjectExpansion,
|
|
860
|
+
options: QueryExecutorOptions
|
|
861
|
+
): Promise<Map<string, ObjectRow>> {
|
|
862
|
+
if (!expansion.expand || expansion.expand.length === 0) {
|
|
863
|
+
return baseTargets
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
const uniqueTargets: ObjectRow[] = []
|
|
867
|
+
const seen = new Set<string>()
|
|
868
|
+
for (const edges of trimmedByParent) {
|
|
869
|
+
for (const edge of edges) {
|
|
870
|
+
const key = targetKey(edge.neighborTypeId, edge.neighborId)
|
|
871
|
+
if (seen.has(key)) continue
|
|
872
|
+
seen.add(key)
|
|
873
|
+
const base = baseTargets.get(key)
|
|
874
|
+
if (base) uniqueTargets.push(base)
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
const enriched = await hydrateExpansions(projectId, uniqueTargets, expansion.expand, options)
|
|
879
|
+
const enrichedByKey = new Map<string, ObjectRow>()
|
|
880
|
+
for (const row of enriched) {
|
|
881
|
+
enrichedByKey.set(targetKey(row.objectTypeId, row.primaryId), row)
|
|
882
|
+
}
|
|
883
|
+
return enrichedByKey
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
function trimExpansionEdges(
|
|
887
|
+
edges: readonly ExpansionEdge[],
|
|
888
|
+
expansion: ObjectExpansion,
|
|
889
|
+
baseTargets: Map<string, ObjectRow>,
|
|
890
|
+
options: QueryExecutorOptions
|
|
891
|
+
): ExpansionEdge[] {
|
|
892
|
+
let ordered = edges
|
|
893
|
+
if (expansion.orderBy && expansion.orderBy.length > 0) {
|
|
894
|
+
const fields = expansion.orderBy
|
|
895
|
+
ordered = [...edges].sort((left, right) =>
|
|
896
|
+
compareExpansionEdges(left, right, fields, baseTargets)
|
|
897
|
+
)
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
const limit = effectiveExpansionFanout(expansion.limit, options.maxExpansionFanout)
|
|
901
|
+
return ordered.length > limit ? ordered.slice(0, limit) : [...ordered]
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
function effectiveExpansionFanout(
|
|
905
|
+
limit: number | undefined,
|
|
906
|
+
maxExpansionFanout: number | undefined
|
|
907
|
+
): number {
|
|
908
|
+
const cap = maxExpansionFanout !== undefined ? maxExpansionFanout : DEFAULT_MAX_EXPANSION_FANOUT
|
|
909
|
+
return limit !== undefined ? Math.min(limit, cap) : cap
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
function compareExpansionEdges(
|
|
913
|
+
left: ExpansionEdge,
|
|
914
|
+
right: ExpansionEdge,
|
|
915
|
+
fields: readonly ObjectQuerySortField[],
|
|
916
|
+
baseTargets: Map<string, ObjectRow>
|
|
917
|
+
): number {
|
|
918
|
+
const leftRow = baseTargets.get(targetKey(left.neighborTypeId, left.neighborId))
|
|
919
|
+
const rightRow = baseTargets.get(targetKey(right.neighborTypeId, right.neighborId))
|
|
920
|
+
for (const field of fields) {
|
|
921
|
+
const comparison = compareRowsBySortField(leftRow, rightRow, field)
|
|
922
|
+
if (comparison !== 0) return comparison
|
|
923
|
+
}
|
|
924
|
+
// Identity tiebreak keeps the trim deterministic for equal sort keys.
|
|
925
|
+
return targetKey(left.neighborTypeId, left.neighborId).localeCompare(
|
|
926
|
+
targetKey(right.neighborTypeId, right.neighborId)
|
|
927
|
+
)
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
function compareRowsBySortField(
|
|
931
|
+
left: ObjectRow | undefined,
|
|
932
|
+
right: ObjectRow | undefined,
|
|
933
|
+
field: ObjectQuerySortField
|
|
934
|
+
): number {
|
|
935
|
+
if (field.kind === "relevance") return 0
|
|
936
|
+
|
|
937
|
+
const leftValue = left?.properties[field.propertyId]
|
|
938
|
+
const rightValue = right?.properties[field.propertyId]
|
|
939
|
+
const leftMissing = leftValue === undefined || leftValue === null
|
|
940
|
+
const rightMissing = rightValue === undefined || rightValue === null
|
|
941
|
+
if (leftMissing && rightMissing) return 0
|
|
942
|
+
if (leftMissing) return 1
|
|
943
|
+
if (rightMissing) return -1
|
|
944
|
+
|
|
945
|
+
const comparison = compareQueryScalarValues(leftValue, rightValue, field.scalarKind)
|
|
946
|
+
if (Number.isNaN(comparison)) return 0
|
|
947
|
+
return field.direction === "desc" ? -comparison : comparison
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
// Outgoing cardinality comes from the parent type's link; incoming is inherently
|
|
951
|
+
// many-to-one, so an incoming expansion always yields an array.
|
|
952
|
+
function expansionCardinality(
|
|
953
|
+
parent: ObjectRow,
|
|
954
|
+
expansion: ObjectExpansion,
|
|
955
|
+
options: QueryExecutorOptions
|
|
956
|
+
): "one" | "many" {
|
|
957
|
+
if (expansion.direction === "incoming") return "many"
|
|
958
|
+
const objectType = options.ontology.getObjectTypeById(parent.objectTypeId)
|
|
959
|
+
const link = objectType?.links.find((candidate) => candidate.id === expansion.linkId)
|
|
960
|
+
return link?.cardinality ?? "many"
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
function toLinkValue(
|
|
964
|
+
rows: readonly ExpandedObjectRow[],
|
|
965
|
+
cardinality: "one" | "many"
|
|
966
|
+
): ExpandedLinkValue {
|
|
967
|
+
if (cardinality === "one") return rows[0] ?? null
|
|
968
|
+
return rows
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
function targetKey(objectTypeId: string, id: string): string {
|
|
972
|
+
return `${objectTypeId}:${id}`
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
async function evaluateFallbackStart(
|
|
976
|
+
projectId: string,
|
|
977
|
+
query: Extract<ObjectQuery, { kind: "start" }>,
|
|
978
|
+
options: QueryExecutorOptions,
|
|
979
|
+
maxRows: number
|
|
980
|
+
): Promise<FallbackEvaluation> {
|
|
981
|
+
const objectTypeIds = query.includeSubtypes
|
|
982
|
+
? [query.objectTypeId, ...options.ontology.listSubTypes(query.objectTypeId)]
|
|
983
|
+
: [query.objectTypeId]
|
|
984
|
+
|
|
985
|
+
const result = await options.storage.list({
|
|
986
|
+
projectId,
|
|
987
|
+
objectTypeId: objectTypeIds,
|
|
988
|
+
limit: maxRows + 1,
|
|
989
|
+
orderBy: "primaryId",
|
|
990
|
+
order: "asc",
|
|
991
|
+
})
|
|
992
|
+
// Request one extra row so the executor can prove the source scan stayed
|
|
993
|
+
// within its bound even when the storage backend does not return total counts.
|
|
994
|
+
if (result.objects.length > maxRows || result.hasMore || result.total > maxRows) {
|
|
995
|
+
throw new ObjectQueryExecutionError(
|
|
996
|
+
"fallback_row_limit_exceeded",
|
|
997
|
+
`Fallback start '${query.objectTypeId}' exceeded maxFallbackRows=${maxRows}`,
|
|
998
|
+
"$.start"
|
|
999
|
+
)
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
return completeFallbackEvaluation(
|
|
1003
|
+
result.objects.map((row, index) => ({
|
|
1004
|
+
row,
|
|
1005
|
+
order: index,
|
|
1006
|
+
}))
|
|
1007
|
+
)
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
function completeFallbackEvaluation(entries: FallbackEntry[]): FallbackEvaluation {
|
|
1011
|
+
return {
|
|
1012
|
+
entries,
|
|
1013
|
+
total: entries.length,
|
|
1014
|
+
hasMore: false,
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
function matchesPredicate(row: ObjectRow, predicate: ObjectQueryPredicate): boolean {
|
|
1019
|
+
switch (predicate.op) {
|
|
1020
|
+
case "and":
|
|
1021
|
+
return predicate.items.every((item) => matchesPredicate(row, item))
|
|
1022
|
+
case "or":
|
|
1023
|
+
return predicate.items.some((item) => matchesPredicate(row, item))
|
|
1024
|
+
case "not":
|
|
1025
|
+
return !matchesPredicate(row, predicate.item)
|
|
1026
|
+
case "eq":
|
|
1027
|
+
return queryScalarValuesEqual(
|
|
1028
|
+
row.properties[predicate.propertyId],
|
|
1029
|
+
predicate.value,
|
|
1030
|
+
predicate.scalarKind
|
|
1031
|
+
)
|
|
1032
|
+
case "neq":
|
|
1033
|
+
return !queryScalarValuesEqual(
|
|
1034
|
+
row.properties[predicate.propertyId],
|
|
1035
|
+
predicate.value,
|
|
1036
|
+
predicate.scalarKind
|
|
1037
|
+
)
|
|
1038
|
+
case "lt":
|
|
1039
|
+
return (
|
|
1040
|
+
compareQueryScalarValues(
|
|
1041
|
+
row.properties[predicate.propertyId],
|
|
1042
|
+
predicate.value,
|
|
1043
|
+
predicate.scalarKind
|
|
1044
|
+
) < 0
|
|
1045
|
+
)
|
|
1046
|
+
case "lte":
|
|
1047
|
+
return (
|
|
1048
|
+
compareQueryScalarValues(
|
|
1049
|
+
row.properties[predicate.propertyId],
|
|
1050
|
+
predicate.value,
|
|
1051
|
+
predicate.scalarKind
|
|
1052
|
+
) <= 0
|
|
1053
|
+
)
|
|
1054
|
+
case "gt":
|
|
1055
|
+
return (
|
|
1056
|
+
compareQueryScalarValues(
|
|
1057
|
+
row.properties[predicate.propertyId],
|
|
1058
|
+
predicate.value,
|
|
1059
|
+
predicate.scalarKind
|
|
1060
|
+
) > 0
|
|
1061
|
+
)
|
|
1062
|
+
case "gte":
|
|
1063
|
+
return (
|
|
1064
|
+
compareQueryScalarValues(
|
|
1065
|
+
row.properties[predicate.propertyId],
|
|
1066
|
+
predicate.value,
|
|
1067
|
+
predicate.scalarKind
|
|
1068
|
+
) >= 0
|
|
1069
|
+
)
|
|
1070
|
+
case "in":
|
|
1071
|
+
return predicate.values.some((value) =>
|
|
1072
|
+
queryScalarValuesEqual(row.properties[predicate.propertyId], value, predicate.scalarKind)
|
|
1073
|
+
)
|
|
1074
|
+
case "exists": {
|
|
1075
|
+
const exists =
|
|
1076
|
+
Object.hasOwn(row.properties, predicate.propertyId) &&
|
|
1077
|
+
row.properties[predicate.propertyId] !== undefined
|
|
1078
|
+
return predicate.value ? exists : !exists
|
|
1079
|
+
}
|
|
1080
|
+
case "contains":
|
|
1081
|
+
return containsValue(row.properties[predicate.propertyId], predicate.value)
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
function containsValue(actual: unknown, expected: unknown): boolean {
|
|
1086
|
+
if (typeof actual === "string" && typeof expected === "string") {
|
|
1087
|
+
return actual.includes(expected)
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
if (Array.isArray(actual)) {
|
|
1091
|
+
return actual.some((item) => queryScalarValuesEqual(item, expected))
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
if (isPlainObject(actual) && typeof expected === "string") {
|
|
1095
|
+
return Object.hasOwn(actual, expected)
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
return false
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
function sortEntries(
|
|
1102
|
+
entries: readonly FallbackEntry[],
|
|
1103
|
+
fields: readonly ObjectQuerySortField[]
|
|
1104
|
+
): FallbackEntry[] {
|
|
1105
|
+
return [...entries].sort((left, right) => {
|
|
1106
|
+
for (const field of fields) {
|
|
1107
|
+
const comparison = compareSortField(left, right, field)
|
|
1108
|
+
if (comparison !== 0) return comparison
|
|
1109
|
+
}
|
|
1110
|
+
// Preserve storage order for true ties, then use identity as a deterministic
|
|
1111
|
+
// final fallback so tests and page tokens stay stable.
|
|
1112
|
+
return (
|
|
1113
|
+
left.order - right.order || rowIdentityKey(left.row).localeCompare(rowIdentityKey(right.row))
|
|
1114
|
+
)
|
|
1115
|
+
})
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
function compareSortField(
|
|
1119
|
+
left: FallbackEntry,
|
|
1120
|
+
right: FallbackEntry,
|
|
1121
|
+
field: ObjectQuerySortField
|
|
1122
|
+
): number {
|
|
1123
|
+
if (field.kind === "relevance") return 0
|
|
1124
|
+
|
|
1125
|
+
const leftValue = left.row.properties[field.propertyId]
|
|
1126
|
+
const rightValue = right.row.properties[field.propertyId]
|
|
1127
|
+
const leftMissing = leftValue === undefined || leftValue === null
|
|
1128
|
+
const rightMissing = rightValue === undefined || rightValue === null
|
|
1129
|
+
if (leftMissing && rightMissing) return 0
|
|
1130
|
+
if (leftMissing) return 1
|
|
1131
|
+
if (rightMissing) return -1
|
|
1132
|
+
|
|
1133
|
+
const comparison = compareQueryScalarValues(leftValue, rightValue, field.scalarKind)
|
|
1134
|
+
if (Number.isNaN(comparison)) return 0
|
|
1135
|
+
return field.direction === "desc" ? -comparison : comparison
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
function projectRow(row: ObjectRow, properties: readonly string[]): ObjectRow {
|
|
1139
|
+
const projected: Record<string, unknown> = {}
|
|
1140
|
+
for (const propertyId of properties) {
|
|
1141
|
+
if (Object.hasOwn(row.properties, propertyId)) {
|
|
1142
|
+
projected[propertyId] = row.properties[propertyId]
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
return { ...row, properties: projected }
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
function stripOuterRowShape(query: ObjectQuery): ObjectQuery {
|
|
1149
|
+
switch (query.kind) {
|
|
1150
|
+
case "limit":
|
|
1151
|
+
case "page":
|
|
1152
|
+
case "project":
|
|
1153
|
+
case "sort":
|
|
1154
|
+
// `expand` is output-shaping: it attaches links but does not change which
|
|
1155
|
+
// objects match, so aggregates (count/exists/facets) ignore it.
|
|
1156
|
+
case "expand":
|
|
1157
|
+
return stripOuterRowShape(query.input)
|
|
1158
|
+
default:
|
|
1159
|
+
return query
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
function validateFacetRequests(
|
|
1164
|
+
facets: readonly ObjectFacetRequest[],
|
|
1165
|
+
objectTypeIds: readonly string[],
|
|
1166
|
+
options: QueryExecutorOptions
|
|
1167
|
+
): ObjectFacetRequest[] {
|
|
1168
|
+
const issues: ObjectQueryValidationIssue[] = []
|
|
1169
|
+
const maxLimit = options.maxFacetLimit ?? DEFAULT_MAX_FACET_LIMIT
|
|
1170
|
+
|
|
1171
|
+
if (facets.length === 0) {
|
|
1172
|
+
addFacetIssue(issues, "$.facets", "empty_facets", "At least one facet is required")
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
if (!Number.isInteger(maxLimit) || maxLimit <= 0) {
|
|
1176
|
+
addFacetIssue(
|
|
1177
|
+
issues,
|
|
1178
|
+
"$.maxFacetLimit",
|
|
1179
|
+
"invalid_facet_bound",
|
|
1180
|
+
"maxFacetLimit must be positive"
|
|
1181
|
+
)
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
const seenPropertyIds = new Set<string>()
|
|
1185
|
+
const normalizedFacets: ObjectFacetRequest[] = []
|
|
1186
|
+
|
|
1187
|
+
facets.forEach((facet, index) => {
|
|
1188
|
+
const path = `$.facets[${index}]`
|
|
1189
|
+
const propertyId = typeof facet.propertyId === "string" ? facet.propertyId.trim() : ""
|
|
1190
|
+
|
|
1191
|
+
if (!propertyId) {
|
|
1192
|
+
addFacetIssue(
|
|
1193
|
+
issues,
|
|
1194
|
+
`${path}.propertyId`,
|
|
1195
|
+
"missing_facet_property",
|
|
1196
|
+
"Facet propertyId is required"
|
|
1197
|
+
)
|
|
1198
|
+
} else if (seenPropertyIds.has(propertyId)) {
|
|
1199
|
+
addFacetIssue(
|
|
1200
|
+
issues,
|
|
1201
|
+
`${path}.propertyId`,
|
|
1202
|
+
"duplicate_facet",
|
|
1203
|
+
`Facet property '${propertyId}' is requested more than once`
|
|
1204
|
+
)
|
|
1205
|
+
} else {
|
|
1206
|
+
seenPropertyIds.add(propertyId)
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
if (!Number.isInteger(facet.limit) || facet.limit <= 0) {
|
|
1210
|
+
addFacetIssue(
|
|
1211
|
+
issues,
|
|
1212
|
+
`${path}.limit`,
|
|
1213
|
+
"invalid_facet_limit",
|
|
1214
|
+
"Facet limit must be a positive integer"
|
|
1215
|
+
)
|
|
1216
|
+
} else if (facet.limit > maxLimit) {
|
|
1217
|
+
addFacetIssue(
|
|
1218
|
+
issues,
|
|
1219
|
+
`${path}.limit`,
|
|
1220
|
+
"facet_limit_too_large",
|
|
1221
|
+
`Facet limit must be less than or equal to ${maxLimit}`
|
|
1222
|
+
)
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
if (!propertyId) return
|
|
1226
|
+
|
|
1227
|
+
for (const objectTypeId of objectTypeIds) {
|
|
1228
|
+
const objectType = options.ontology.getObjectTypeById(objectTypeId)
|
|
1229
|
+
const property = objectType?.properties.find((candidate) => candidate.id === propertyId)
|
|
1230
|
+
|
|
1231
|
+
if (!objectType || !property) {
|
|
1232
|
+
addFacetIssue(
|
|
1233
|
+
issues,
|
|
1234
|
+
`${path}.propertyId`,
|
|
1235
|
+
"unknown_facet_property",
|
|
1236
|
+
`Property '${propertyId}' is not defined on '${objectTypeId}'`
|
|
1237
|
+
)
|
|
1238
|
+
continue
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
if (property.query?.searchable !== true || property.query.facet !== true) {
|
|
1242
|
+
addFacetIssue(
|
|
1243
|
+
issues,
|
|
1244
|
+
`${path}.propertyId`,
|
|
1245
|
+
"property_not_facetable",
|
|
1246
|
+
`Property '${propertyId}' on '${objectTypeId}' must set query.searchable: true and query.facet: true before it can be used as a facet`
|
|
1247
|
+
)
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
normalizedFacets.push({ propertyId, limit: facet.limit })
|
|
1252
|
+
})
|
|
1253
|
+
|
|
1254
|
+
if (issues.length > 0) {
|
|
1255
|
+
throw new ObjectQueryValidationError(issues)
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
return normalizedFacets
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
function addFacetIssue(
|
|
1262
|
+
issues: ObjectQueryValidationIssue[],
|
|
1263
|
+
path: string,
|
|
1264
|
+
code: string,
|
|
1265
|
+
message: string
|
|
1266
|
+
): void {
|
|
1267
|
+
issues.push({ path, code, message })
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
function buildFacetResults(
|
|
1271
|
+
rows: readonly ObjectRow[],
|
|
1272
|
+
facets: readonly ObjectFacetRequest[]
|
|
1273
|
+
): ObjectFacetResult[] {
|
|
1274
|
+
return facets.map((facet) => ({
|
|
1275
|
+
propertyId: facet.propertyId,
|
|
1276
|
+
buckets: buildFacetBuckets(rows, facet),
|
|
1277
|
+
}))
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
function buildFacetBuckets(
|
|
1281
|
+
rows: readonly ObjectRow[],
|
|
1282
|
+
facet: ObjectFacetRequest
|
|
1283
|
+
): ObjectFacetResult["buckets"] {
|
|
1284
|
+
const buckets = new Map<string, { value: unknown; count: number }>()
|
|
1285
|
+
|
|
1286
|
+
for (const row of rows) {
|
|
1287
|
+
if (!Object.hasOwn(row.properties, facet.propertyId)) continue
|
|
1288
|
+
const value = row.properties[facet.propertyId]
|
|
1289
|
+
if (value === undefined) continue
|
|
1290
|
+
const key = facetValueKey(value)
|
|
1291
|
+
const existing = buckets.get(key)
|
|
1292
|
+
if (existing) {
|
|
1293
|
+
existing.count += 1
|
|
1294
|
+
} else {
|
|
1295
|
+
buckets.set(key, { value, count: 1 })
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
return [...buckets.values()]
|
|
1300
|
+
.sort(
|
|
1301
|
+
(left, right) =>
|
|
1302
|
+
right.count - left.count ||
|
|
1303
|
+
facetValueSortKey(left.value).localeCompare(facetValueSortKey(right.value))
|
|
1304
|
+
)
|
|
1305
|
+
.slice(0, facet.limit)
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
function facetValueKey(value: unknown): string {
|
|
1309
|
+
return JSON.stringify(value) ?? String(value)
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
function facetValueSortKey(value: unknown): string {
|
|
1313
|
+
return JSON.stringify(value) ?? String(value)
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
function rowIdentityKey(row: ObjectRow): string {
|
|
1317
|
+
return `${row.objectTypeId}:${row.primaryId}`
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
function encodePageOffset(offset: number): string {
|
|
1321
|
+
return `${PAGE_TOKEN_PREFIX}${offset}`
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
function decodePageOffset(token: string | undefined): number {
|
|
1325
|
+
if (!token) return 0
|
|
1326
|
+
if (!token.startsWith(PAGE_TOKEN_PREFIX)) {
|
|
1327
|
+
throw new ObjectQueryExecutionError(
|
|
1328
|
+
"invalid_page_token",
|
|
1329
|
+
"Fallback page token must use the offset token format"
|
|
1330
|
+
)
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
const offset = Number(token.slice(PAGE_TOKEN_PREFIX.length))
|
|
1334
|
+
if (!Number.isInteger(offset) || offset < 0) {
|
|
1335
|
+
throw new ObjectQueryExecutionError(
|
|
1336
|
+
"invalid_page_token",
|
|
1337
|
+
"Fallback page token contains an invalid offset"
|
|
1338
|
+
)
|
|
1339
|
+
}
|
|
1340
|
+
return offset
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
function isPlainObject(value: unknown): value is Record<string, unknown> {
|
|
1344
|
+
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
1345
|
+
}
|