@sixb/core 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/index.js +30 -30
- package/dist/agents/cancel.d.ts.map +1 -1
- package/dist/agents/index.d.ts +5 -3
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +39 -33
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/run-plan.d.ts +15 -1
- package/dist/agents/run-plan.d.ts.map +1 -1
- package/dist/agents/run-session-http.d.ts.map +1 -1
- package/dist/agents/run-session-serve.d.ts.map +1 -1
- package/dist/agents/run-session.d.ts +14 -2
- package/dist/agents/run-session.d.ts.map +1 -1
- package/dist/agents/skills.d.ts +3 -0
- package/dist/agents/skills.d.ts.map +1 -1
- package/dist/agents/step-limits.d.ts +6 -0
- package/dist/agents/step-limits.d.ts.map +1 -1
- package/dist/agents/streams/index.js +1 -1
- package/dist/agents/streams/internal.js +1 -1
- package/dist/agents/streams/protocol.d.ts +8 -2
- package/dist/agents/streams/protocol.d.ts.map +1 -1
- package/dist/agents/tool-files.d.ts +3 -1
- package/dist/agents/tool-files.d.ts.map +1 -1
- package/dist/agents/validation.d.ts +1 -1
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/agents/web.d.ts +47 -0
- package/dist/agents/web.d.ts.map +1 -0
- package/dist/artifacts/publish/index.js +17 -17
- package/dist/auth/index.js +3 -3
- package/dist/authorization/index.js +2 -2
- package/dist/authorization/resolve.d.ts +4 -3
- package/dist/authorization/resolve.d.ts.map +1 -1
- package/dist/authorization/types.d.ts +5 -5
- package/dist/authorization/types.d.ts.map +1 -1
- package/dist/bootstrap/index.js +38 -38
- package/dist/{chunk-neftrg0n.js → chunk-0j3crh1w.js} +2 -2
- package/dist/{chunk-8dcfj58k.js → chunk-2ajw5rz0.js} +14 -10
- package/dist/chunk-2ajw5rz0.js.map +18 -0
- package/dist/{chunk-23s66j86.js → chunk-31kcqmhf.js} +1 -1
- package/dist/{chunk-nghc7eq0.js → chunk-3723kgba.js} +1 -1
- package/dist/{chunk-fdkpkkpw.js → chunk-3sqqhpr7.js} +5 -5
- package/dist/{chunk-m3qe54bb.js → chunk-4bm0caep.js} +1 -1
- package/dist/{chunk-ztf5vtmp.js → chunk-4s753g3k.js} +41 -10
- package/dist/chunk-4s753g3k.js.map +12 -0
- package/dist/{chunk-fntqb7qy.js → chunk-57g0215c.js} +1 -1
- package/dist/{chunk-8wsjr52f.js → chunk-5wtnmpze.js} +1 -1
- package/dist/{chunk-edx8xcsm.js → chunk-7z5rkf0m.js} +29 -6
- package/dist/chunk-7z5rkf0m.js.map +13 -0
- package/dist/{chunk-2pk5hjj9.js → chunk-80gym75n.js} +1 -1
- package/dist/{chunk-qbrmpgvv.js → chunk-9whfmsfk.js} +1 -1
- package/dist/{chunk-qya541bk.js → chunk-a5v4gjdx.js} +31 -28
- package/dist/{chunk-qya541bk.js.map → chunk-a5v4gjdx.js.map} +4 -4
- package/dist/{chunk-he7g39e5.js → chunk-a7aa0nzj.js} +7 -7
- package/dist/{chunk-tvefbgvw.js → chunk-az95tsh3.js} +4 -2
- package/dist/chunk-az95tsh3.js.map +11 -0
- package/dist/{chunk-7hd2ez3q.js → chunk-c4nrycdy.js} +1 -1
- package/dist/{chunk-ekkpzcka.js → chunk-c706qvyc.js} +36 -9
- package/dist/chunk-c706qvyc.js.map +11 -0
- package/dist/{chunk-n54k068r.js → chunk-c7cfe31p.js} +7 -7
- package/dist/{chunk-qsg8rw04.js → chunk-d04g36fw.js} +1 -1
- package/dist/{chunk-hjy3dsws.js → chunk-dsv783c3.js} +305 -32
- package/dist/{chunk-hjy3dsws.js.map → chunk-dsv783c3.js.map} +12 -10
- package/dist/{chunk-peggaard.js → chunk-e6xgz4h4.js} +20 -2
- package/dist/{chunk-peggaard.js.map → chunk-e6xgz4h4.js.map} +5 -3
- package/dist/{chunk-e99kp9jh.js → chunk-eqgr6nsa.js} +86 -30
- package/dist/{chunk-e99kp9jh.js.map → chunk-eqgr6nsa.js.map} +10 -9
- package/dist/{chunk-f2w6328x.js → chunk-f1h34y3r.js} +6 -6
- package/dist/{chunk-9rh8ncs5.js → chunk-fwsvshr5.js} +1 -1
- package/dist/{chunk-c78jjzhy.js → chunk-ga63a3dz.js} +6 -6
- package/dist/{chunk-c78jjzhy.js.map → chunk-ga63a3dz.js.map} +2 -2
- package/dist/{chunk-cgznz22f.js → chunk-gkv8r794.js} +2 -2
- package/dist/{chunk-d3t26vah.js → chunk-j1ny5fwh.js} +35 -11
- package/dist/chunk-j1ny5fwh.js.map +15 -0
- package/dist/{chunk-8hvfs0fr.js → chunk-j8thxj7w.js} +4 -4
- package/dist/{chunk-855n80en.js → chunk-jjmggm9a.js} +1 -1
- package/dist/{chunk-31khg3g0.js → chunk-kkjfve0t.js} +73 -2
- package/dist/{chunk-31khg3g0.js.map → chunk-kkjfve0t.js.map} +3 -3
- package/dist/{chunk-fb3m4sa1.js → chunk-m2vh8gh0.js} +8 -14
- package/dist/{chunk-fb3m4sa1.js.map → chunk-m2vh8gh0.js.map} +3 -3
- package/dist/{chunk-vkweppkw.js → chunk-mbc5hvnj.js} +3 -3
- package/dist/{chunk-jk97v21j.js → chunk-n4zzaf6q.js} +3 -2
- package/dist/chunk-n4zzaf6q.js.map +10 -0
- package/dist/{chunk-y2x2935j.js → chunk-nh26e7c5.js} +2 -2
- package/dist/{chunk-jhbk10wf.js → chunk-q9nkpr8k.js} +1 -1
- package/dist/{chunk-47e09r7z.js → chunk-qttqe1ah.js} +86 -6
- package/dist/{chunk-47e09r7z.js.map → chunk-qttqe1ah.js.map} +5 -4
- package/dist/{chunk-9mab3dvg.js → chunk-s038wa5v.js} +9 -1
- package/dist/{chunk-9mab3dvg.js.map → chunk-s038wa5v.js.map} +3 -3
- package/dist/{chunk-3x3bebz7.js → chunk-s7j8ewqv.js} +161 -62
- package/dist/{chunk-3x3bebz7.js.map → chunk-s7j8ewqv.js.map} +7 -6
- package/dist/{chunk-dz7a4t3a.js → chunk-twfreyxr.js} +5 -10
- package/dist/{chunk-dz7a4t3a.js.map → chunk-twfreyxr.js.map} +4 -4
- package/dist/{chunk-semf1yqn.js → chunk-w1btn96n.js} +51 -26
- package/dist/{chunk-semf1yqn.js.map → chunk-w1btn96n.js.map} +6 -6
- package/dist/{chunk-fg1db9xx.js → chunk-wkq3kvzd.js} +5 -5
- package/dist/chunk-wkq3kvzd.js.map +10 -0
- package/dist/{chunk-xj97s5js.js → chunk-wrjx1fqz.js} +6 -6
- package/dist/{chunk-agn8d8ys.js → chunk-xtztwpkh.js} +1 -1
- package/dist/{chunk-0g5nyx0k.js → chunk-zeykm8my.js} +2 -2
- package/dist/connectors/connections/runs.d.ts +7 -0
- package/dist/connectors/connections/runs.d.ts.map +1 -1
- package/dist/datasets/execution.d.ts.map +1 -1
- package/dist/events/index.js +1 -1
- package/dist/events/selectors/index.js +1 -1
- package/dist/events/selectors/predicate.d.ts.map +1 -1
- package/dist/events/types/datasets.d.ts +6 -0
- package/dist/events/types/datasets.d.ts.map +1 -1
- package/dist/execution/agent.js +30 -30
- package/dist/execution/object-reader-security.d.ts.map +1 -1
- package/dist/execution/primitive.js +30 -30
- package/dist/execution/request.js +31 -31
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -42
- package/dist/lake-storage/in-memory.d.ts.map +1 -1
- package/dist/lake-storage/index.d.ts +2 -2
- package/dist/lake-storage/index.d.ts.map +1 -1
- package/dist/lake-storage/index.js +6 -2
- package/dist/lake-storage/index.js.map +1 -1
- package/dist/lake-storage/source-ordering.d.ts +7 -0
- package/dist/lake-storage/source-ordering.d.ts.map +1 -1
- package/dist/lake-storage/types.d.ts +18 -0
- package/dist/lake-storage/types.d.ts.map +1 -1
- package/dist/lake-storage/version-inputs.d.ts +11 -3
- package/dist/lake-storage/version-inputs.d.ts.map +1 -1
- package/dist/materializer/index.js +16 -16
- package/dist/models/catalog.d.ts +16 -0
- package/dist/models/catalog.d.ts.map +1 -1
- package/dist/models/definitions.d.ts +1 -1
- package/dist/models/definitions.d.ts.map +1 -1
- package/dist/models/execution/index.js +18 -18
- package/dist/models/execution/model-call-recorder.d.ts +1 -1
- package/dist/models/execution/model-call-recorder.d.ts.map +1 -1
- package/dist/models/execution/web-search.d.ts +7 -0
- package/dist/models/execution/web-search.d.ts.map +1 -0
- package/dist/models/index.d.ts +3 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +5 -3
- package/dist/models/index.js.map +1 -1
- package/dist/models/language-model.d.ts +12 -0
- package/dist/models/language-model.d.ts.map +1 -1
- package/dist/models/web-search-model.d.ts +66 -0
- package/dist/models/web-search-model.d.ts.map +1 -0
- package/dist/objects/index.js +30 -30
- package/dist/objects/query/executor.d.ts.map +1 -1
- package/dist/objects/query/index.d.ts +1 -0
- package/dist/objects/query/index.d.ts.map +1 -1
- package/dist/objects/query/index.js +19 -16
- package/dist/objects/query/index.js.map +1 -1
- package/dist/objects/query/sort-ties.d.ts +11 -0
- package/dist/objects/query/sort-ties.d.ts.map +1 -0
- package/dist/pipelines/index.js +19 -19
- package/dist/pipelines/run-dispatch.d.ts +2 -0
- package/dist/pipelines/run-dispatch.d.ts.map +1 -1
- package/dist/projections/internal.js +16 -16
- package/dist/runtime/create.d.ts +1 -1
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/internal.js +22 -22
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/schedules/index.js +2 -2
- package/dist/security/index.d.ts +1 -0
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/registry.d.ts +2 -0
- package/dist/security/registry.d.ts.map +1 -1
- package/dist/security/view-conditions.d.ts.map +1 -1
- package/dist/security/visibility-keys.d.ts +19 -0
- package/dist/security/visibility-keys.d.ts.map +1 -0
- package/dist/shares/internal.js +16 -16
- package/dist/storage/agents/in-memory.d.ts +8 -2
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/index.d.ts +1 -1
- package/dist/storage/agents/index.d.ts.map +1 -1
- package/dist/storage/agents/provider.d.ts +8 -2
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +12 -6
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +42 -2
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.js +4 -4
- package/dist/storage/ai-limits/enforcement.js +3 -3
- package/dist/storage/ai-limits/provider.js +2 -2
- package/dist/storage/connector-connections/provider.js +3 -3
- package/dist/storage/connector-connections/provider.js.map +3 -3
- package/dist/storage/file-upload-sessions/provider.js +4 -4
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +15 -15
- package/dist/storage/internal.d.ts +2 -0
- package/dist/storage/internal.d.ts.map +1 -1
- package/dist/storage/internal.js +8 -4
- package/dist/storage/internal.js.map +1 -1
- package/dist/storage/migrations/types.d.ts +6 -0
- package/dist/storage/migrations/types.d.ts.map +1 -1
- package/dist/storage/objects/in-memory/query.d.ts.map +1 -1
- package/dist/storage/objects/index.d.ts +1 -1
- package/dist/storage/objects/index.d.ts.map +1 -1
- package/dist/storage/objects/query-preparation.d.ts +13 -0
- package/dist/storage/objects/query-preparation.d.ts.map +1 -1
- package/dist/storage/objects/read-scope.d.ts.map +1 -1
- package/dist/storage/objects/types.d.ts +52 -0
- package/dist/storage/objects/types.d.ts.map +1 -1
- package/dist/storage/pipeline-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/pipeline-runs/transitions.d.ts +7 -0
- package/dist/storage/pipeline-runs/transitions.d.ts.map +1 -0
- package/dist/storage/share-grants/provider.js +2 -2
- package/dist/storage/sync-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/sync-runs/transitions.d.ts +7 -0
- package/dist/storage/sync-runs/transitions.d.ts.map +1 -0
- package/dist/storage/workflow-runs/provider.js +4 -4
- package/dist/syncs/index.js +20 -20
- package/dist/syncs/run-dispatch.d.ts +2 -0
- package/dist/syncs/run-dispatch.d.ts.map +1 -1
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-limit-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-usage-storage-contract.d.ts.map +1 -1
- package/dist/testing/connector-connection-storage-contract.d.ts.map +1 -1
- package/dist/testing/dataset-sequence-contract.d.ts.map +1 -1
- package/dist/testing/index.js +552 -61
- package/dist/testing/index.js.map +11 -11
- package/dist/testing/lake-changes-contract.d.ts.map +1 -1
- package/dist/testing/lake-storage-contract.d.ts.map +1 -1
- package/dist/testing/object-conditional-read-scope-contract.d.ts.map +1 -1
- package/dist/testing/object-query-contract.d.ts.map +1 -1
- package/dist/webhooks/internal.js +16 -16
- package/dist/workers/index.d.ts +1 -0
- package/dist/workers/index.d.ts.map +1 -1
- package/dist/workers/index.js +12 -2
- package/dist/workers/index.js.map +5 -4
- package/dist/workers/unstarted-run.d.ts +10 -0
- package/dist/workers/unstarted-run.d.ts.map +1 -0
- package/dist/workflows/index.js +34 -34
- package/package.json +1 -1
- package/src/agents/README.md +2 -1
- package/src/agents/cancel.ts +7 -1
- package/src/agents/index.ts +9 -1
- package/src/agents/run-plan.ts +31 -0
- package/src/agents/run-session-http.ts +15 -12
- package/src/agents/run-session-serve.ts +8 -2
- package/src/agents/run-session.ts +31 -11
- package/src/agents/skills.ts +3 -0
- package/src/agents/step-limits.ts +6 -0
- package/src/agents/streams/protocol.ts +9 -4
- package/src/agents/tool-files.ts +11 -3
- package/src/agents/validation.ts +9 -0
- package/src/agents/web.ts +218 -0
- package/src/authorization/resolve.ts +9 -11
- package/src/authorization/types.ts +5 -5
- package/src/connectors/connections/runs.ts +42 -5
- package/src/datasets/execution.ts +2 -0
- package/src/events/selectors/predicate.ts +15 -0
- package/src/events/types/datasets.ts +6 -0
- package/src/execution/object-reader-security.ts +4 -9
- package/src/index.ts +2 -0
- package/src/lake-storage/in-memory.ts +30 -20
- package/src/lake-storage/index.ts +2 -1
- package/src/lake-storage/source-ordering.ts +31 -4
- package/src/lake-storage/types.ts +18 -0
- package/src/lake-storage/version-inputs.ts +21 -5
- package/src/models/catalog.ts +52 -3
- package/src/models/definitions.ts +2 -0
- package/src/models/execution/README.md +22 -2
- package/src/models/execution/model-call-recorder.ts +1 -1
- package/src/models/execution/web-search.ts +186 -0
- package/src/models/index.ts +12 -0
- package/src/models/language-model.ts +12 -0
- package/src/models/web-search-model.ts +152 -0
- package/src/objects/query/executor.ts +7 -3
- package/src/objects/query/index.ts +1 -0
- package/src/objects/query/sort-ties.ts +16 -0
- package/src/pipelines/run-dispatch.ts +53 -6
- package/src/runtime/create.ts +3 -2
- package/src/runtime/resolve-definitions.ts +4 -0
- package/src/security/index.ts +1 -0
- package/src/security/registry.ts +2 -0
- package/src/security/view-conditions.ts +4 -3
- package/src/security/visibility-keys.ts +144 -0
- package/src/storage/agents/in-memory.ts +29 -2
- package/src/storage/agents/index.ts +2 -0
- package/src/storage/agents/provider.ts +57 -1
- package/src/storage/agents/types.ts +45 -2
- package/src/storage/connector-connections/in-memory.ts +2 -2
- package/src/storage/connector-connections/provider/connections.ts +2 -2
- package/src/storage/index.ts +4 -0
- package/src/storage/internal.ts +2 -0
- package/src/storage/migrations/types.ts +6 -0
- package/src/storage/objects/in-memory/query.ts +5 -2
- package/src/storage/objects/index.ts +2 -0
- package/src/storage/objects/query-preparation.ts +59 -1
- package/src/storage/objects/read-scope.ts +108 -2
- package/src/storage/objects/types.ts +43 -0
- package/src/storage/pipeline-runs/in-memory.ts +2 -5
- package/src/storage/pipeline-runs/transitions.ts +14 -0
- package/src/storage/sync-runs/in-memory.ts +2 -5
- package/src/storage/sync-runs/transitions.ts +11 -0
- package/src/syncs/run-dispatch.ts +68 -13
- package/src/testing/agent-storage-contract.ts +70 -0
- package/src/testing/ai-limit-storage-contract.ts +11 -1
- package/src/testing/ai-usage-storage-contract.ts +15 -2
- package/src/testing/connector-connection-storage-contract.ts +23 -0
- package/src/testing/dataset-sequence-contract.ts +81 -0
- package/src/testing/lake-changes-contract.ts +2 -1
- package/src/testing/lake-storage-contract.ts +112 -0
- package/src/testing/object-conditional-read-scope-contract.ts +267 -5
- package/src/testing/object-query-contract.ts +75 -0
- package/src/workers/index.ts +1 -0
- package/src/workers/unstarted-run.ts +18 -0
- package/dist/chunk-8dcfj58k.js.map +0 -18
- package/dist/chunk-d3t26vah.js.map +0 -15
- package/dist/chunk-edx8xcsm.js.map +0 -13
- package/dist/chunk-ekkpzcka.js.map +0 -11
- package/dist/chunk-fg1db9xx.js.map +0 -10
- package/dist/chunk-jk97v21j.js.map +0 -10
- package/dist/chunk-tvefbgvw.js.map +0 -11
- package/dist/chunk-ztf5vtmp.js.map +0 -12
- /package/dist/{chunk-neftrg0n.js.map → chunk-0j3crh1w.js.map} +0 -0
- /package/dist/{chunk-23s66j86.js.map → chunk-31kcqmhf.js.map} +0 -0
- /package/dist/{chunk-nghc7eq0.js.map → chunk-3723kgba.js.map} +0 -0
- /package/dist/{chunk-fdkpkkpw.js.map → chunk-3sqqhpr7.js.map} +0 -0
- /package/dist/{chunk-m3qe54bb.js.map → chunk-4bm0caep.js.map} +0 -0
- /package/dist/{chunk-fntqb7qy.js.map → chunk-57g0215c.js.map} +0 -0
- /package/dist/{chunk-8wsjr52f.js.map → chunk-5wtnmpze.js.map} +0 -0
- /package/dist/{chunk-2pk5hjj9.js.map → chunk-80gym75n.js.map} +0 -0
- /package/dist/{chunk-qbrmpgvv.js.map → chunk-9whfmsfk.js.map} +0 -0
- /package/dist/{chunk-he7g39e5.js.map → chunk-a7aa0nzj.js.map} +0 -0
- /package/dist/{chunk-7hd2ez3q.js.map → chunk-c4nrycdy.js.map} +0 -0
- /package/dist/{chunk-n54k068r.js.map → chunk-c7cfe31p.js.map} +0 -0
- /package/dist/{chunk-qsg8rw04.js.map → chunk-d04g36fw.js.map} +0 -0
- /package/dist/{chunk-f2w6328x.js.map → chunk-f1h34y3r.js.map} +0 -0
- /package/dist/{chunk-9rh8ncs5.js.map → chunk-fwsvshr5.js.map} +0 -0
- /package/dist/{chunk-cgznz22f.js.map → chunk-gkv8r794.js.map} +0 -0
- /package/dist/{chunk-8hvfs0fr.js.map → chunk-j8thxj7w.js.map} +0 -0
- /package/dist/{chunk-855n80en.js.map → chunk-jjmggm9a.js.map} +0 -0
- /package/dist/{chunk-vkweppkw.js.map → chunk-mbc5hvnj.js.map} +0 -0
- /package/dist/{chunk-y2x2935j.js.map → chunk-nh26e7c5.js.map} +0 -0
- /package/dist/{chunk-jhbk10wf.js.map → chunk-q9nkpr8k.js.map} +0 -0
- /package/dist/{chunk-xj97s5js.js.map → chunk-wrjx1fqz.js.map} +0 -0
- /package/dist/{chunk-agn8d8ys.js.map → chunk-xtztwpkh.js.map} +0 -0
- /package/dist/{chunk-0g5nyx0k.js.map → chunk-zeykm8my.js.map} +0 -0
package/dist/testing/index.js
CHANGED
|
@@ -5,21 +5,23 @@ import"../chunk-6eqsgvxk.js";
|
|
|
5
5
|
import"../chunk-165c9wm6.js";
|
|
6
6
|
import {
|
|
7
7
|
validateObjectQuery2,
|
|
8
|
+
bindCurrentUserPredicate,
|
|
9
|
+
viewConditionReadCondition,
|
|
8
10
|
AuthStorageError2,
|
|
9
11
|
toUserProfile,
|
|
10
12
|
SYSTEM_PRINCIPAL2
|
|
11
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-s7j8ewqv.js";
|
|
12
14
|
import"../chunk-d7v97qxq.js";
|
|
13
15
|
import {
|
|
14
16
|
agentServiceAccountId2,
|
|
15
17
|
MAX_OBJECT_READ_FACETS2,
|
|
16
18
|
defineProjection2
|
|
17
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-twfreyxr.js";
|
|
18
20
|
import"../chunk-jspskey0.js";
|
|
19
21
|
import {
|
|
20
22
|
compileSelectedObjectReadScope2,
|
|
21
23
|
compileConditionalObjectReadScope2
|
|
22
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-kkjfve0t.js";
|
|
23
25
|
import {
|
|
24
26
|
blobIdFromDigest2
|
|
25
27
|
} from "../chunk-wkv3h3q7.js";
|
|
@@ -43,22 +45,22 @@ import {
|
|
|
43
45
|
createEventId2
|
|
44
46
|
} from "../chunk-zrvhsq7f.js";
|
|
45
47
|
import"../chunk-5grk14e5.js";
|
|
46
|
-
import"../chunk-
|
|
47
|
-
import"../chunk-
|
|
48
|
+
import"../chunk-az95tsh3.js";
|
|
49
|
+
import"../chunk-qttqe1ah.js";
|
|
48
50
|
import {
|
|
49
51
|
AgentStorageError2
|
|
50
|
-
} from "../chunk-
|
|
51
|
-
import"../chunk-
|
|
52
|
+
} from "../chunk-7z5rkf0m.js";
|
|
53
|
+
import"../chunk-zeykm8my.js";
|
|
52
54
|
import {
|
|
53
55
|
aiLimitCalendarMonth2
|
|
54
|
-
} from "../chunk-
|
|
56
|
+
} from "../chunk-c4nrycdy.js";
|
|
55
57
|
import {
|
|
56
58
|
DEFAULT_FILE_UPLOAD_TERMINAL_SESSION_TTL_MS2
|
|
57
59
|
} from "../chunk-h89wz928.js";
|
|
58
|
-
import"../chunk-
|
|
60
|
+
import"../chunk-31kcqmhf.js";
|
|
59
61
|
import {
|
|
60
62
|
ArtifactStorageError
|
|
61
|
-
} from "../chunk-
|
|
63
|
+
} from "../chunk-e6xgz4h4.js";
|
|
62
64
|
import {
|
|
63
65
|
ARTIFACT_STATE_LIMITS2
|
|
64
66
|
} from "../chunk-hz5d43gn.js";
|
|
@@ -82,7 +84,7 @@ import {
|
|
|
82
84
|
WorkflowInterventionError2,
|
|
83
85
|
InMemoryStorage2,
|
|
84
86
|
migrateStorage2
|
|
85
|
-
} from "../chunk-
|
|
87
|
+
} from "../chunk-eqgr6nsa.js";
|
|
86
88
|
import"../chunk-nz7815t3.js";
|
|
87
89
|
import"../chunk-s7xqfxs9.js";
|
|
88
90
|
import"../chunk-mmagke4x.js";
|
|
@@ -91,18 +93,18 @@ import"../chunk-scyq22td.js";
|
|
|
91
93
|
import"../chunk-jmfet9r4.js";
|
|
92
94
|
import"../chunk-qf954wje.js";
|
|
93
95
|
import"../chunk-x0v3jd47.js";
|
|
94
|
-
import"../chunk-
|
|
96
|
+
import"../chunk-0j3crh1w.js";
|
|
95
97
|
import {
|
|
96
98
|
ProjectionRegistry2,
|
|
97
99
|
createLinkScopeFingerprint2,
|
|
98
100
|
createOntologyMaterializer2
|
|
99
|
-
} from "../chunk-
|
|
101
|
+
} from "../chunk-3sqqhpr7.js";
|
|
100
102
|
import {
|
|
101
103
|
bindModelExecutionAttempt,
|
|
102
104
|
isBoundSixb
|
|
103
|
-
} from "../chunk-
|
|
105
|
+
} from "../chunk-a5v4gjdx.js";
|
|
104
106
|
import"../chunk-w976a4me.js";
|
|
105
|
-
import"../chunk-
|
|
107
|
+
import"../chunk-f1h34y3r.js";
|
|
106
108
|
import {
|
|
107
109
|
planObjectQuery2,
|
|
108
110
|
executeObjectQuery2,
|
|
@@ -110,18 +112,18 @@ import {
|
|
|
110
112
|
existsObjects2,
|
|
111
113
|
facetObjects2,
|
|
112
114
|
executeObjectQueryLinks2
|
|
113
|
-
} from "../chunk-
|
|
114
|
-
import"../chunk-
|
|
115
|
-
import"../chunk-
|
|
115
|
+
} from "../chunk-2ajw5rz0.js";
|
|
116
|
+
import"../chunk-m2vh8gh0.js";
|
|
117
|
+
import"../chunk-wkq3kvzd.js";
|
|
116
118
|
import"../chunk-3fqxbn31.js";
|
|
117
119
|
import"../chunk-waqk73p1.js";
|
|
118
120
|
import"../chunk-kwfhd1g0.js";
|
|
119
|
-
import"../chunk-
|
|
120
|
-
import"../chunk-
|
|
121
|
+
import"../chunk-j8thxj7w.js";
|
|
122
|
+
import"../chunk-d04g36fw.js";
|
|
121
123
|
import"../chunk-sgx82nnt.js";
|
|
122
124
|
import"../chunk-8ncg20rd.js";
|
|
123
125
|
import"../chunk-5a4a52tq.js";
|
|
124
|
-
import"../chunk-
|
|
126
|
+
import"../chunk-fwsvshr5.js";
|
|
125
127
|
import {
|
|
126
128
|
col2,
|
|
127
129
|
defineDataset2,
|
|
@@ -130,31 +132,31 @@ import {
|
|
|
130
132
|
import {
|
|
131
133
|
writeDataset2
|
|
132
134
|
} from "../chunk-jbw70d6t.js";
|
|
133
|
-
import"../chunk-
|
|
134
|
-
import"../chunk-
|
|
135
|
+
import"../chunk-ga63a3dz.js";
|
|
136
|
+
import"../chunk-q9nkpr8k.js";
|
|
135
137
|
import"../chunk-1vg43g9q.js";
|
|
136
138
|
import"../chunk-m427qgq0.js";
|
|
137
139
|
import {
|
|
138
140
|
SixbHost2
|
|
139
|
-
} from "../chunk-
|
|
141
|
+
} from "../chunk-w1btn96n.js";
|
|
140
142
|
import"../chunk-w122ymx4.js";
|
|
141
143
|
import"../chunk-t5608tkq.js";
|
|
142
|
-
import"../chunk-
|
|
143
|
-
import"../chunk-
|
|
144
|
-
import"../chunk-
|
|
144
|
+
import"../chunk-s038wa5v.js";
|
|
145
|
+
import"../chunk-wrjx1fqz.js";
|
|
146
|
+
import"../chunk-nh26e7c5.js";
|
|
145
147
|
import"../chunk-fb3feg1e.js";
|
|
146
148
|
import"../chunk-yw9pyg66.js";
|
|
147
149
|
import"../chunk-ytzcxtpt.js";
|
|
148
150
|
import {
|
|
149
151
|
projectAgentThreadModelContext2
|
|
150
|
-
} from "../chunk-
|
|
151
|
-
import"../chunk-
|
|
152
|
+
} from "../chunk-dsv783c3.js";
|
|
153
|
+
import"../chunk-57g0215c.js";
|
|
152
154
|
import"../chunk-de5sfbc3.js";
|
|
153
155
|
import"../chunk-5taem5aw.js";
|
|
154
156
|
import"../chunk-jftd33rc.js";
|
|
155
157
|
import {
|
|
156
158
|
workflowAgentStepActorId2
|
|
157
|
-
} from "../chunk-
|
|
159
|
+
} from "../chunk-c7cfe31p.js";
|
|
158
160
|
import {
|
|
159
161
|
BrokerError2,
|
|
160
162
|
InMemoryBroker2
|
|
@@ -163,38 +165,38 @@ import {
|
|
|
163
165
|
QueueError2,
|
|
164
166
|
InMemoryQueues2
|
|
165
167
|
} from "../chunk-s3we74h8.js";
|
|
166
|
-
import"../chunk-
|
|
168
|
+
import"../chunk-j1ny5fwh.js";
|
|
167
169
|
import"../chunk-4zm1k3xj.js";
|
|
168
|
-
import"../chunk-
|
|
169
|
-
import"../chunk-
|
|
170
|
+
import"../chunk-mbc5hvnj.js";
|
|
171
|
+
import"../chunk-jjmggm9a.js";
|
|
170
172
|
import"../chunk-c69nj7se.js";
|
|
171
|
-
import"../chunk-
|
|
173
|
+
import"../chunk-a7aa0nzj.js";
|
|
172
174
|
import {
|
|
173
175
|
createTestingScope
|
|
174
|
-
} from "../chunk-
|
|
175
|
-
import"../chunk-
|
|
176
|
-
import"../chunk-
|
|
176
|
+
} from "../chunk-4bm0caep.js";
|
|
177
|
+
import"../chunk-5wtnmpze.js";
|
|
178
|
+
import"../chunk-4s753g3k.js";
|
|
177
179
|
import {
|
|
178
180
|
SandboxNotRunningError2
|
|
179
181
|
} from "../chunk-r1cxq7vv.js";
|
|
180
|
-
import"../chunk-
|
|
181
|
-
import"../chunk-
|
|
182
|
+
import"../chunk-gkv8r794.js";
|
|
183
|
+
import"../chunk-c706qvyc.js";
|
|
182
184
|
import {
|
|
183
185
|
restoreTrustedPrimitiveExecutionScope
|
|
184
|
-
} from "../chunk-
|
|
185
|
-
import"../chunk-
|
|
186
|
+
} from "../chunk-9whfmsfk.js";
|
|
187
|
+
import"../chunk-3723kgba.js";
|
|
186
188
|
import"../chunk-6b61s40c.js";
|
|
187
189
|
import {
|
|
188
190
|
LakeStorageError2
|
|
189
191
|
} from "../chunk-65abf64x.js";
|
|
190
192
|
import"../chunk-5kyvrtjh.js";
|
|
191
|
-
import"../chunk-
|
|
193
|
+
import"../chunk-80gym75n.js";
|
|
192
194
|
import {
|
|
193
195
|
ActionRunError2
|
|
194
196
|
} from "../chunk-3gbefjg5.js";
|
|
195
197
|
import {
|
|
196
198
|
AiUsageStorageError2
|
|
197
|
-
} from "../chunk-
|
|
199
|
+
} from "../chunk-xtztwpkh.js";
|
|
198
200
|
import"../chunk-21q0j5f2.js";
|
|
199
201
|
import {
|
|
200
202
|
ObjectQueryPlanningError2
|
|
@@ -206,7 +208,7 @@ import {
|
|
|
206
208
|
} from "../chunk-y7dbmaqh.js";
|
|
207
209
|
import {
|
|
208
210
|
AGENT_TOKEN_RATE_SAMPLES2
|
|
209
|
-
} from "../chunk-
|
|
211
|
+
} from "../chunk-n4zzaf6q.js";
|
|
210
212
|
import"../chunk-a3faa34j.js";
|
|
211
213
|
|
|
212
214
|
// src/testing/action-execution.ts
|
|
@@ -3142,6 +3144,56 @@ function runAgentStorageContractSuite(label, options) {
|
|
|
3142
3144
|
await expectAgentError2(storage.computers.hold(session("s_5", { computer: { ...laptop, name: "a\x07b" } })), "invalid_input");
|
|
3143
3145
|
});
|
|
3144
3146
|
});
|
|
3147
|
+
test5("keeps what an open sixb reports of its background commands, and the stops asked", async () => {
|
|
3148
|
+
await withStorage(async (storage) => {
|
|
3149
|
+
const live = at2("2026-06-23T12:01:00.000Z");
|
|
3150
|
+
const session = (overrides = {}) => ({
|
|
3151
|
+
projectId: projectId5,
|
|
3152
|
+
id: "s_1",
|
|
3153
|
+
ownerPrincipal: owner,
|
|
3154
|
+
computer: laptop,
|
|
3155
|
+
expiresAt: live,
|
|
3156
|
+
...overrides
|
|
3157
|
+
});
|
|
3158
|
+
const running = {
|
|
3159
|
+
threadId: "thr_1",
|
|
3160
|
+
id: "bg_1",
|
|
3161
|
+
command: "bun dev",
|
|
3162
|
+
status: "running",
|
|
3163
|
+
startedAt: "2026-06-23T11:59:00.000Z"
|
|
3164
|
+
};
|
|
3165
|
+
const ref = { threadId: "thr_1", id: "bg_1", startedAt: running.startedAt };
|
|
3166
|
+
const stop = (command = ref, ownerPrincipal = owner) => storage.computers.requestStop({ projectId: projectId5, id: "s_1", ownerPrincipal, command });
|
|
3167
|
+
await storage.computers.hold(session({ backgroundCommands: [running] }));
|
|
3168
|
+
await expect5(stop()).resolves.toEqual(session({ backgroundCommands: [running], stopRequests: [ref] }));
|
|
3169
|
+
await expect5(stop()).resolves.toEqual(session({ backgroundCommands: [running], stopRequests: [ref] }));
|
|
3170
|
+
await expect5(stop(ref, otherUser)).resolves.toBeNull();
|
|
3171
|
+
const stopped = {
|
|
3172
|
+
...running,
|
|
3173
|
+
status: "stopped",
|
|
3174
|
+
exitCode: 143,
|
|
3175
|
+
endedAt: "2026-06-23T12:00:30.000Z"
|
|
3176
|
+
};
|
|
3177
|
+
await storage.computers.hold(session({ backgroundCommands: [stopped] }));
|
|
3178
|
+
await expect5(storage.computers.listLive({
|
|
3179
|
+
projectId: projectId5,
|
|
3180
|
+
ownerPrincipal: owner,
|
|
3181
|
+
now: at2(running.startedAt)
|
|
3182
|
+
})).resolves.toEqual([session({ backgroundCommands: [stopped], stopRequests: [ref] })]);
|
|
3183
|
+
for (let index = 2;index <= 65; index += 1)
|
|
3184
|
+
await stop({ ...ref, id: `bg_${index}` });
|
|
3185
|
+
const [kept] = await storage.computers.listLive({
|
|
3186
|
+
projectId: projectId5,
|
|
3187
|
+
ownerPrincipal: owner,
|
|
3188
|
+
now: at2(running.startedAt)
|
|
3189
|
+
});
|
|
3190
|
+
expect5(kept?.stopRequests?.length).toBe(64);
|
|
3191
|
+
expect5(kept?.stopRequests?.[0]?.id).toBe("bg_2");
|
|
3192
|
+
expect5(kept?.stopRequests?.at(-1)?.id).toBe("bg_65");
|
|
3193
|
+
await expectAgentError2(stop({ ...ref, id: "" }), "invalid_input");
|
|
3194
|
+
await expectAgentError2(storage.computers.hold(session({ backgroundCommands: [{ ...running, status: "lost" }] })), "invalid_input");
|
|
3195
|
+
});
|
|
3196
|
+
});
|
|
3145
3197
|
test5("reads several threads at once, in the order asked", async () => {
|
|
3146
3198
|
await withStorage(async (storage) => {
|
|
3147
3199
|
const first = await storage.threads.create(threadInput());
|
|
@@ -5913,7 +5965,7 @@ function runAiLimitStorageContractSuite(label, options) {
|
|
|
5913
5965
|
meter: "cost.catalogEstimated",
|
|
5914
5966
|
amount: { currency: "USD", amountNanos: "100" }
|
|
5915
5967
|
};
|
|
5916
|
-
for (const modelKind of ["reranking", "image", "speech"]) {
|
|
5968
|
+
for (const modelKind of ["reranking", "web-search", "image", "speech"]) {
|
|
5917
5969
|
await expect8(storage.aiLimits.reserveModelCall(reservation(modelKind, 0, { estimates: [cost], modelKind }))).resolves.toEqual({ status: "notRequired" });
|
|
5918
5970
|
}
|
|
5919
5971
|
await expect8(storage.aiLimits.reserveModelCall(reservation("language", 0, { estimates: [cost] }))).resolves.toMatchObject({ status: "unavailable", reasons: ["missingEstimate"] });
|
|
@@ -5927,6 +5979,16 @@ function runAiLimitStorageContractSuite(label, options) {
|
|
|
5927
5979
|
projectId: projectId8,
|
|
5928
5980
|
usageRecordId: "usage-reranking"
|
|
5929
5981
|
});
|
|
5982
|
+
await recordUsageInput(storage.aiUsage, {
|
|
5983
|
+
id: "usage-web-search",
|
|
5984
|
+
callId: "web-search",
|
|
5985
|
+
modelKind: "web-search",
|
|
5986
|
+
usage: {}
|
|
5987
|
+
});
|
|
5988
|
+
await storage.aiLimits.recordModelCallActuals({
|
|
5989
|
+
projectId: projectId8,
|
|
5990
|
+
usageRecordId: "usage-web-search"
|
|
5991
|
+
});
|
|
5930
5992
|
expect8(await status()).toMatchObject({
|
|
5931
5993
|
accountingStatus: "complete",
|
|
5932
5994
|
consumption: { actual: { amount: 4 } }
|
|
@@ -7180,7 +7242,7 @@ function runAiUsageStorageContractSuite(label, options) {
|
|
|
7180
7242
|
}
|
|
7181
7243
|
};
|
|
7182
7244
|
describe10(label, () => {
|
|
7183
|
-
test10("persists transcription and
|
|
7245
|
+
test10("persists transcription, reranking and web search usage kinds without invented token totals", async () => {
|
|
7184
7246
|
await withStorage(async (storage) => {
|
|
7185
7247
|
const latest = () => storage.getLatestForExecution({ projectId: projectId10, executionId: agentExecutionId });
|
|
7186
7248
|
const input = modelCallInput({
|
|
@@ -7204,6 +7266,15 @@ function runAiUsageStorageContractSuite(label, options) {
|
|
|
7204
7266
|
occurredAt: at5("2026-06-23T10:01:00.000Z")
|
|
7205
7267
|
}));
|
|
7206
7268
|
expect10((await latest())?.modelKind).toBe("reranking");
|
|
7269
|
+
await storage.recordModelCall(modelCallInput({
|
|
7270
|
+
id: "usage_web_search",
|
|
7271
|
+
callId: "call_web_search",
|
|
7272
|
+
responseId: "response_web_search",
|
|
7273
|
+
modelKind: "web-search",
|
|
7274
|
+
usage: {},
|
|
7275
|
+
occurredAt: at5("2026-06-23T10:02:00.000Z")
|
|
7276
|
+
}));
|
|
7277
|
+
expect10((await latest())?.modelKind).toBe("web-search");
|
|
7207
7278
|
});
|
|
7208
7279
|
});
|
|
7209
7280
|
test10("persists generated-media usage and the speech kind", async () => {
|
|
@@ -11387,6 +11458,26 @@ function runConnectorConnectionStorageContractSuite(label, options) {
|
|
|
11387
11458
|
});
|
|
11388
11459
|
});
|
|
11389
11460
|
});
|
|
11461
|
+
test15("connects another account to a disconnected slot without replacement", async () => {
|
|
11462
|
+
await withStorage(async (storage) => {
|
|
11463
|
+
const first = await createAuthorization(storage, "authorization-a", "account-a");
|
|
11464
|
+
const connected = await connect(storage, first, "connection-a", "account-a");
|
|
11465
|
+
await storage.disconnectConnection({
|
|
11466
|
+
projectId: projectId13,
|
|
11467
|
+
connectorId,
|
|
11468
|
+
connectionId: connected.connection.id
|
|
11469
|
+
});
|
|
11470
|
+
const second = await createAuthorization(storage, "authorization-b", "account-b");
|
|
11471
|
+
const reconnected = await connect(storage, second, "ignored-new-id", "account-b");
|
|
11472
|
+
expect15(reconnected.connection).toMatchObject({
|
|
11473
|
+
id: connected.connection.id,
|
|
11474
|
+
authorizationId: second.id,
|
|
11475
|
+
account: { id: "account-b" },
|
|
11476
|
+
status: "connected"
|
|
11477
|
+
});
|
|
11478
|
+
expect15(reconnected.replaced).toBe(false);
|
|
11479
|
+
});
|
|
11480
|
+
});
|
|
11390
11481
|
test15("keeps pending selection untouched when connection validation fails", async () => {
|
|
11391
11482
|
await withStorage(async (storage) => {
|
|
11392
11483
|
const active = await createAuthorization(storage, "authorization-a", "account-a");
|
|
@@ -13334,7 +13425,8 @@ function runLakeChangesContractSuite(name, harness) {
|
|
|
13334
13425
|
});
|
|
13335
13426
|
test20("refuses blank identities and invalid column requests", async () => {
|
|
13336
13427
|
const first = await write([row(" ", "one")]);
|
|
13337
|
-
|
|
13428
|
+
const second = await write([row(" ", "two")]);
|
|
13429
|
+
expect20(await read(first, second)).toBeNull();
|
|
13338
13430
|
await expect20(read(first, first, [])).rejects.toThrow("distinct columns");
|
|
13339
13431
|
await expect20(read(first, first, ["missing"])).rejects.toThrow("distinct columns");
|
|
13340
13432
|
});
|
|
@@ -13648,6 +13740,62 @@ function runDatasetSequenceContract(options) {
|
|
|
13648
13740
|
await merge(storage, [change2.delete({ id: "42" }, { sequence: 11 })]);
|
|
13649
13741
|
expect21(await rows(storage)).toEqual([]);
|
|
13650
13742
|
}));
|
|
13743
|
+
test21("records a merge that only advances source ordering as changing no rows", () => withStorage(async (storage) => {
|
|
13744
|
+
const changed = (result) => ({
|
|
13745
|
+
outcome: result.outcome,
|
|
13746
|
+
rowsChanged: result.version?.rowsChanged,
|
|
13747
|
+
lineageChanged: result.version?.lineageChanged
|
|
13748
|
+
});
|
|
13749
|
+
expect21(changed(await merge(storage, [upsert(1)]))).toEqual({
|
|
13750
|
+
outcome: "created",
|
|
13751
|
+
rowsChanged: true,
|
|
13752
|
+
lineageChanged: true
|
|
13753
|
+
});
|
|
13754
|
+
const orderingOnly = await merge(storage, [change2.delete({ id: "7" }, { sequence: 3 })]);
|
|
13755
|
+
expect21(changed(orderingOnly)).toEqual({
|
|
13756
|
+
outcome: "created",
|
|
13757
|
+
rowsChanged: false,
|
|
13758
|
+
lineageChanged: false
|
|
13759
|
+
});
|
|
13760
|
+
expect21((await storage.getVersion(dataset.id, orderingOnly.version.versionId))?.rowsChanged).toBe(false);
|
|
13761
|
+
expect21(changed(await merge(storage, [upsert(2, "Ada")]))).toEqual({
|
|
13762
|
+
outcome: "created",
|
|
13763
|
+
rowsChanged: true,
|
|
13764
|
+
lineageChanged: false
|
|
13765
|
+
});
|
|
13766
|
+
}));
|
|
13767
|
+
test21("keeps a stored row that a newer delivery repeats with only its sequence changed", () => withStorage(async (storage) => {
|
|
13768
|
+
const stored = async () => (await rows(storage)).map((row) => ({ id: row.id, revision: String(row.revision), name: row.name })).sort((left, right) => String(left.id).localeCompare(String(right.id)));
|
|
13769
|
+
const changed = (result) => ({
|
|
13770
|
+
outcome: result.outcome,
|
|
13771
|
+
rowsChanged: result.version?.rowsChanged
|
|
13772
|
+
});
|
|
13773
|
+
await merge(storage, [upsert(10), upsert(1, "Lin", "7")]);
|
|
13774
|
+
expect21(changed(await merge(storage, [upsert(12)]))).toEqual({
|
|
13775
|
+
outcome: "created",
|
|
13776
|
+
rowsChanged: false
|
|
13777
|
+
});
|
|
13778
|
+
expect21(await stored()).toEqual([
|
|
13779
|
+
{ id: "42", revision: "10", name: "Sam" },
|
|
13780
|
+
{ id: "7", revision: "1", name: "Lin" }
|
|
13781
|
+
]);
|
|
13782
|
+
expect21((await merge(storage, [upsert(11, "Late")])).outcome).toBe("unchanged");
|
|
13783
|
+
expect21((await merge(storage, [upsert(12)])).outcome).toBe("unchanged");
|
|
13784
|
+
await expect21(merge(storage, [upsert(12, "Tie")])).rejects.toThrow("conflicting content");
|
|
13785
|
+
expect21(changed(await merge(storage, [upsert(13), upsert(2, "Grace", "7")]))).toEqual({
|
|
13786
|
+
outcome: "created",
|
|
13787
|
+
rowsChanged: true
|
|
13788
|
+
});
|
|
13789
|
+
expect21(await stored()).toEqual([
|
|
13790
|
+
{ id: "42", revision: "10", name: "Sam" },
|
|
13791
|
+
{ id: "7", revision: "2", name: "Grace" }
|
|
13792
|
+
]);
|
|
13793
|
+
expect21(changed(await merge(storage, [upsert(14, "Ada")]))).toEqual({
|
|
13794
|
+
outcome: "created",
|
|
13795
|
+
rowsChanged: true
|
|
13796
|
+
});
|
|
13797
|
+
expect21((await stored())[0]).toEqual({ id: "42", revision: "14", name: "Ada" });
|
|
13798
|
+
}));
|
|
13651
13799
|
test21("compares canonical content across JSON order and nullable representations", () => withStorage(async (storage) => {
|
|
13652
13800
|
await merge(storage, [
|
|
13653
13801
|
change2.upsert({ id: "42", revision: 1, name: "Sam", details: { a: 1, b: 2 } })
|
|
@@ -14002,6 +14150,7 @@ async function collectRows(rows) {
|
|
|
14002
14150
|
}
|
|
14003
14151
|
// src/testing/lake-storage-contract.ts
|
|
14004
14152
|
import { describe as describe23, expect as expect23, test as test23 } from "bun:test";
|
|
14153
|
+
import { randomUUID } from "crypto";
|
|
14005
14154
|
var definitionDataset = defineDataset2("contract.definitions.orders", {
|
|
14006
14155
|
schema: [col2("orderId", "string"), col2("customerName", "string")],
|
|
14007
14156
|
description: "Contract orders"
|
|
@@ -14828,6 +14977,85 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
14828
14977
|
});
|
|
14829
14978
|
}));
|
|
14830
14979
|
});
|
|
14980
|
+
describe23("what a version changed", () => {
|
|
14981
|
+
const changed = (version) => ({
|
|
14982
|
+
rowsChanged: version?.rowsChanged,
|
|
14983
|
+
lineageChanged: version?.lineageChanged
|
|
14984
|
+
});
|
|
14985
|
+
test23("records whether a version changed rows or lineage, across reopening", async () => {
|
|
14986
|
+
let storage = await options.createStorage();
|
|
14987
|
+
try {
|
|
14988
|
+
await storage.createDataset(writeDataset);
|
|
14989
|
+
await storage.createDataset(definitionDataset);
|
|
14990
|
+
const inputVersion = async () => {
|
|
14991
|
+
const session = await storage.beginWrite({ dataset: definitionDataset });
|
|
14992
|
+
await session.writeRows([{ orderId: randomUUID(), customerName: "Input" }]);
|
|
14993
|
+
const version = await session.commit();
|
|
14994
|
+
return { datasetId: definitionDataset.id, versionId: version.versionId };
|
|
14995
|
+
};
|
|
14996
|
+
const rows = [{ orderId: "ord_1", customerName: "Ada" }];
|
|
14997
|
+
const commit = async (input, written = rows) => {
|
|
14998
|
+
const session = await storage.beginWrite({ dataset: writeDataset, ...input });
|
|
14999
|
+
await session.writeRows(written);
|
|
15000
|
+
const version = await session.commit();
|
|
15001
|
+
expect23(version.outcome).toBe("created");
|
|
15002
|
+
return version;
|
|
15003
|
+
};
|
|
15004
|
+
const first = await commit({ inputs: [await inputVersion()] });
|
|
15005
|
+
expect23(changed(first)).toEqual({ rowsChanged: true, lineageChanged: true });
|
|
15006
|
+
const provenanceOnly = await commit({ inputs: [await inputVersion()] });
|
|
15007
|
+
expect23(changed(provenanceOnly)).toEqual({ rowsChanged: false, lineageChanged: false });
|
|
15008
|
+
const lineageOnly = await commit({ producer: pipeline, lineage: copied });
|
|
15009
|
+
expect23(changed(lineageOnly)).toEqual({ rowsChanged: false, lineageChanged: true });
|
|
15010
|
+
const rowsOnly = await commit({ producer: pipeline, lineage: copied }, [
|
|
15011
|
+
{ orderId: "ord_2", customerName: "Grace" }
|
|
15012
|
+
]);
|
|
15013
|
+
expect23(changed(rowsOnly)).toEqual({ rowsChanged: true, lineageChanged: false });
|
|
15014
|
+
const emptyAppend = await commit({ producer: pipeline, lineage: copied, mode: "append", inputs: [await inputVersion()] }, []);
|
|
15015
|
+
expect23(changed(emptyAppend)).toEqual({ rowsChanged: false, lineageChanged: false });
|
|
15016
|
+
const append = await commit({ producer: pipeline, lineage: copied, mode: "append" }, [
|
|
15017
|
+
{ orderId: "ord_3", customerName: "Lin" }
|
|
15018
|
+
]);
|
|
15019
|
+
expect23(changed(append)).toEqual({ rowsChanged: true, lineageChanged: false });
|
|
15020
|
+
if (options.reopen)
|
|
15021
|
+
storage = await options.reopen(storage);
|
|
15022
|
+
const committed = [first, provenanceOnly, lineageOnly, rowsOnly, emptyAppend, append];
|
|
15023
|
+
const expected = Object.fromEntries(committed.map((v) => [v.versionId, changed(v)]));
|
|
15024
|
+
const listed = await storage.listVersions(writeDataset.id);
|
|
15025
|
+
expect23(Object.fromEntries(listed.map((v) => [v.versionId, changed(v)]))).toEqual(expected);
|
|
15026
|
+
for (const version of committed) {
|
|
15027
|
+
expect23(changed(await storage.getVersion(writeDataset.id, version.versionId))).toEqual(changed(version));
|
|
15028
|
+
}
|
|
15029
|
+
expect23(changed(await storage.getLatestVersion(writeDataset.id))).toEqual(changed(append));
|
|
15030
|
+
} finally {
|
|
15031
|
+
await options.teardown?.(storage);
|
|
15032
|
+
}
|
|
15033
|
+
});
|
|
15034
|
+
test23("a dataset's first version changes rows, even empty", () => withStorage(async (storage) => {
|
|
15035
|
+
await storage.createDataset(writeDataset);
|
|
15036
|
+
const session = await storage.beginWrite({ dataset: writeDataset });
|
|
15037
|
+
const first = await session.commit();
|
|
15038
|
+
expect23(changed(first)).toEqual({ rowsChanged: true, lineageChanged: true });
|
|
15039
|
+
}));
|
|
15040
|
+
test23("a schema change changes rows", () => withStorage(async (storage) => {
|
|
15041
|
+
if (schemaEvolution === "strict")
|
|
15042
|
+
return;
|
|
15043
|
+
const initial = defineDataset2("contract.changes.schema_evolution", {
|
|
15044
|
+
schema: [col2("invoiceId", "string")]
|
|
15045
|
+
});
|
|
15046
|
+
const widened = defineDataset2("contract.changes.schema_evolution", {
|
|
15047
|
+
schema: [col2("invoiceId", "string"), col2("currency", "string", { nullable: true })]
|
|
15048
|
+
});
|
|
15049
|
+
await storage.createDataset(initial);
|
|
15050
|
+
const session = await storage.beginWrite({ dataset: initial });
|
|
15051
|
+
await session.writeRows([{ invoiceId: "inv_1" }]);
|
|
15052
|
+
await session.commit();
|
|
15053
|
+
await storage.createDataset(widened);
|
|
15054
|
+
const [schemaVersion] = await storage.listVersions(initial.id, 1);
|
|
15055
|
+
expect23(schemaVersion?.mode).toBe("schema");
|
|
15056
|
+
expect23(changed(schemaVersion)).toEqual({ rowsChanged: true, lineageChanged: true });
|
|
15057
|
+
}));
|
|
15058
|
+
});
|
|
14831
15059
|
});
|
|
14832
15060
|
}
|
|
14833
15061
|
async function collectRows2(rows) {
|
|
@@ -17145,9 +17373,23 @@ var Customer = defineObjectType2({
|
|
|
17145
17373
|
id: "ConditionCustomer",
|
|
17146
17374
|
name: "Condition Customer",
|
|
17147
17375
|
properties: [prop2("id", "string", { required: true, primary: true }), prop2("name", "string")],
|
|
17148
|
-
links: [link2("invoices", Invoice)]
|
|
17376
|
+
links: [link2("invoices", Invoice), link2("primaryInvoice", Invoice, { cardinality: "one" })]
|
|
17377
|
+
});
|
|
17378
|
+
var Ticket = defineObjectType2({
|
|
17379
|
+
id: "ConditionTicket",
|
|
17380
|
+
name: "Condition Ticket",
|
|
17381
|
+
properties: [
|
|
17382
|
+
prop2("id", "string", {
|
|
17383
|
+
required: true,
|
|
17384
|
+
primary: true,
|
|
17385
|
+
query: { searchable: true, sortable: true }
|
|
17386
|
+
}),
|
|
17387
|
+
prop2("status", "string", { query: { searchable: true, filterable: true } }),
|
|
17388
|
+
prop2("owner", ref2.user(), { nullable: true, query: { searchable: true, filterable: true } }),
|
|
17389
|
+
prop2("watchers", { type: "array", items: ref2.user() }, { nullable: true, query: { searchable: true, filterable: true } })
|
|
17390
|
+
]
|
|
17149
17391
|
});
|
|
17150
|
-
var ontology3 = new OntologyRegistry2({ sources: [Invoice, CreditNote, Customer] });
|
|
17392
|
+
var ontology3 = new OntologyRegistry2({ sources: [Invoice, CreditNote, Customer, Ticket] });
|
|
17151
17393
|
function runConditionalObjectReadScopeContractSuite(label, options) {
|
|
17152
17394
|
const withHarness = async (body) => {
|
|
17153
17395
|
const harness = await options.createHarness();
|
|
@@ -17405,6 +17647,114 @@ function runConditionalObjectReadScopeContractSuite(label, options) {
|
|
|
17405
17647
|
expect26(invoices.map((row) => row.primaryId).sort()).toEqual(["inv-1", "inv-3"]);
|
|
17406
17648
|
});
|
|
17407
17649
|
});
|
|
17650
|
+
test26("never expands through a hidden object", async () => {
|
|
17651
|
+
await withHarness(async ({ harness }) => {
|
|
17652
|
+
const unconditioned = createReader(harness.objectReadScopeFactory, []);
|
|
17653
|
+
const conditioned = createReader(harness.objectReadScopeFactory, [noDrafts(Invoice.id)]);
|
|
17654
|
+
const customers = async (reader) => {
|
|
17655
|
+
const [customer] = await queryRows(reader, {
|
|
17656
|
+
kind: "expand",
|
|
17657
|
+
input: {
|
|
17658
|
+
kind: "limit",
|
|
17659
|
+
limit: 10,
|
|
17660
|
+
input: { kind: "start", objectTypeId: Customer.id }
|
|
17661
|
+
},
|
|
17662
|
+
expansions: [
|
|
17663
|
+
{ linkId: "primaryInvoice", direction: "outgoing" },
|
|
17664
|
+
{
|
|
17665
|
+
linkId: "invoices",
|
|
17666
|
+
direction: "outgoing",
|
|
17667
|
+
expand: [{ linkId: "related", direction: "outgoing" }]
|
|
17668
|
+
}
|
|
17669
|
+
]
|
|
17670
|
+
});
|
|
17671
|
+
return {
|
|
17672
|
+
primaryInvoice: linkedIds(customer?.links?.primaryInvoice),
|
|
17673
|
+
invoices: Object.fromEntries(linkedRows(customer?.links?.invoices).map((row) => [
|
|
17674
|
+
row.primaryId,
|
|
17675
|
+
linkedIds(row.links?.related)
|
|
17676
|
+
]))
|
|
17677
|
+
};
|
|
17678
|
+
};
|
|
17679
|
+
expect26(await customers(unconditioned)).toEqual({
|
|
17680
|
+
primaryInvoice: ["inv-2"],
|
|
17681
|
+
invoices: { "inv-1": ["inv-2", "inv-3"], "inv-2": ["inv-1"], "inv-3": [] }
|
|
17682
|
+
});
|
|
17683
|
+
expect26(await customers(conditioned)).toEqual({
|
|
17684
|
+
primaryInvoice: [],
|
|
17685
|
+
invoices: { "inv-1": ["inv-3"], "inv-3": [] }
|
|
17686
|
+
});
|
|
17687
|
+
const relatedFrom = async (reader) => {
|
|
17688
|
+
const invoices = await queryRows(reader, {
|
|
17689
|
+
kind: "expand",
|
|
17690
|
+
input: {
|
|
17691
|
+
kind: "limit",
|
|
17692
|
+
limit: 10,
|
|
17693
|
+
input: sorted({ kind: "start", objectTypeId: Invoice.id }, "amount")
|
|
17694
|
+
},
|
|
17695
|
+
expansions: [
|
|
17696
|
+
{ linkId: "related", direction: "incoming", sourceObjectTypeId: Invoice.id }
|
|
17697
|
+
]
|
|
17698
|
+
});
|
|
17699
|
+
return invoices.map((row) => linkedIds(row.links?.related));
|
|
17700
|
+
};
|
|
17701
|
+
expect26(await relatedFrom(unconditioned)).toEqual([["inv-2"], ["inv-1"], ["inv-1"]]);
|
|
17702
|
+
expect26(await relatedFrom(conditioned)).toEqual([[], ["inv-1"]]);
|
|
17703
|
+
});
|
|
17704
|
+
});
|
|
17705
|
+
test26("never traverses through a hidden object", async () => {
|
|
17706
|
+
await withHarness(async ({ harness }) => {
|
|
17707
|
+
const unconditioned = createReader(harness.objectReadScopeFactory, []);
|
|
17708
|
+
const conditioned = createReader(harness.objectReadScopeFactory, [noDrafts(Invoice.id)]);
|
|
17709
|
+
const reached = async (reader, query) => {
|
|
17710
|
+
const rows = await queryRows(reader, query);
|
|
17711
|
+
return rows.map((row) => row.primaryId).sort();
|
|
17712
|
+
};
|
|
17713
|
+
const relatedOf = (input) => ({
|
|
17714
|
+
kind: "traverse",
|
|
17715
|
+
direction: "outgoing",
|
|
17716
|
+
linkId: "related",
|
|
17717
|
+
input
|
|
17718
|
+
});
|
|
17719
|
+
const refs = (...primaryIds) => ({
|
|
17720
|
+
kind: "refs",
|
|
17721
|
+
refs: primaryIds.map((primaryId) => ({ objectTypeId: Invoice.id, primaryId }))
|
|
17722
|
+
});
|
|
17723
|
+
const twoHops = relatedOf({
|
|
17724
|
+
kind: "traverse",
|
|
17725
|
+
direction: "outgoing",
|
|
17726
|
+
linkId: "invoices",
|
|
17727
|
+
input: { kind: "start", objectTypeId: Customer.id }
|
|
17728
|
+
});
|
|
17729
|
+
expect26(await reached(unconditioned, twoHops)).toEqual(["inv-1", "inv-2", "inv-3"]);
|
|
17730
|
+
expect26(await reached(conditioned, twoHops)).toEqual(["inv-3"]);
|
|
17731
|
+
const fromRefs = relatedOf(refs("inv-1", "inv-2"));
|
|
17732
|
+
expect26(await reached(unconditioned, fromRefs)).toEqual(["inv-1", "inv-2", "inv-3"]);
|
|
17733
|
+
expect26(await reached(conditioned, fromRefs)).toEqual(["inv-3"]);
|
|
17734
|
+
const fromSet = relatedOf({
|
|
17735
|
+
kind: "set",
|
|
17736
|
+
op: "union",
|
|
17737
|
+
inputs: [refs("inv-2"), refs("inv-3")]
|
|
17738
|
+
});
|
|
17739
|
+
expect26(await reached(unconditioned, fromSet)).toEqual(["inv-1"]);
|
|
17740
|
+
expect26(await reached(conditioned, fromSet)).toEqual([]);
|
|
17741
|
+
const sourcesOf = {
|
|
17742
|
+
kind: "traverse",
|
|
17743
|
+
direction: "incoming",
|
|
17744
|
+
linkId: "related",
|
|
17745
|
+
sourceObjectTypeId: Invoice.id,
|
|
17746
|
+
input: refs("inv-1", "inv-3")
|
|
17747
|
+
};
|
|
17748
|
+
expect26(await reached(unconditioned, sourcesOf)).toEqual(["inv-1", "inv-2"]);
|
|
17749
|
+
expect26(await reached(conditioned, sourcesOf)).toEqual(["inv-1"]);
|
|
17750
|
+
expect26(await unconditioned.countObjects?.({ projectId: projectId18, query: sourcesOf })).toEqual({
|
|
17751
|
+
count: 2
|
|
17752
|
+
});
|
|
17753
|
+
expect26(await conditioned.countObjects?.({ projectId: projectId18, query: sourcesOf })).toEqual({
|
|
17754
|
+
count: 1
|
|
17755
|
+
});
|
|
17756
|
+
});
|
|
17757
|
+
});
|
|
17408
17758
|
test26("applies a condition to its concrete type only", async () => {
|
|
17409
17759
|
await withHarness(async ({ harness }) => {
|
|
17410
17760
|
const invoicesOnly = createReader(harness.objectReadScopeFactory, [noDrafts(Invoice.id)]);
|
|
@@ -17447,6 +17797,75 @@ function runConditionalObjectReadScopeContractSuite(label, options) {
|
|
|
17447
17797
|
})).toEqual([]);
|
|
17448
17798
|
});
|
|
17449
17799
|
});
|
|
17800
|
+
test26("shows a reader through its conditions' keys exactly what their predicate shows", async () => {
|
|
17801
|
+
await withHarness(async ({ harness, fixture }) => {
|
|
17802
|
+
const ids = ["usr_1", 'a"b', "a\\b", 'a", "b', "*", "u:usr_1"];
|
|
17803
|
+
const users = ids.map((id) => ({ type: "user", id }));
|
|
17804
|
+
const auth = harness.storage.auth;
|
|
17805
|
+
if (!auth)
|
|
17806
|
+
throw new Error("The conditional read contract requires auth storage.");
|
|
17807
|
+
for (const [index, id] of ids.entries()) {
|
|
17808
|
+
await auth.users.create({ projectId: projectId18, id, email: `reader-${index}@example.com` });
|
|
17809
|
+
}
|
|
17810
|
+
await fixture.seed({
|
|
17811
|
+
objects: users.flatMap((user, index) => [
|
|
17812
|
+
object(Ticket.id, `t-${index}-owned`, {
|
|
17813
|
+
id: `t-${index}-owned`,
|
|
17814
|
+
status: "open",
|
|
17815
|
+
owner: user
|
|
17816
|
+
}),
|
|
17817
|
+
object(Ticket.id, `t-${index}-watched`, {
|
|
17818
|
+
id: `t-${index}-watched`,
|
|
17819
|
+
status: index % 2 === 0 ? "open" : "closed",
|
|
17820
|
+
owner: users[(index + 1) % users.length],
|
|
17821
|
+
watchers: [user, users[(index + 2) % users.length]]
|
|
17822
|
+
})
|
|
17823
|
+
]),
|
|
17824
|
+
links: []
|
|
17825
|
+
});
|
|
17826
|
+
const me = { type: "currentUser" };
|
|
17827
|
+
const conditions = [
|
|
17828
|
+
{ op: "eq", propertyId: "owner", value: me },
|
|
17829
|
+
{ op: "contains", propertyId: "watchers", value: me },
|
|
17830
|
+
{
|
|
17831
|
+
op: "or",
|
|
17832
|
+
items: [
|
|
17833
|
+
{ op: "eq", propertyId: "status", value: "closed" },
|
|
17834
|
+
{ op: "in", propertyId: "owner", values: [me, users[0]] }
|
|
17835
|
+
]
|
|
17836
|
+
},
|
|
17837
|
+
{
|
|
17838
|
+
op: "and",
|
|
17839
|
+
items: [
|
|
17840
|
+
{ op: "eq", propertyId: "status", value: "open" },
|
|
17841
|
+
{ op: "contains", propertyId: "watchers", value: me }
|
|
17842
|
+
]
|
|
17843
|
+
},
|
|
17844
|
+
{ op: "neq", propertyId: "owner", value: me }
|
|
17845
|
+
];
|
|
17846
|
+
const visible = async (condition) => {
|
|
17847
|
+
const reader = createReader(harness.objectReadScopeFactory, [condition]);
|
|
17848
|
+
const rows = await queryRows(reader, {
|
|
17849
|
+
kind: "limit",
|
|
17850
|
+
limit: 100,
|
|
17851
|
+
input: sorted({ kind: "start", objectTypeId: Ticket.id }, "id")
|
|
17852
|
+
});
|
|
17853
|
+
return rows.map((row) => row.primaryId);
|
|
17854
|
+
};
|
|
17855
|
+
for (const [index, condition] of conditions.entries()) {
|
|
17856
|
+
const predicates = [ticketCondition(condition), ticketCondition(conditions[0])];
|
|
17857
|
+
for (const user of [undefined, ...users]) {
|
|
17858
|
+
const keyed = viewConditionReadCondition(Ticket.id, predicates, user);
|
|
17859
|
+
const bound = bindCurrentUserPredicate({ op: "or", items: predicates }, user);
|
|
17860
|
+
expect26({ index, user, ids: await visible(keyed) }).toEqual({
|
|
17861
|
+
index,
|
|
17862
|
+
user,
|
|
17863
|
+
ids: await visible({ objectTypeId: Ticket.id, predicate: bound })
|
|
17864
|
+
});
|
|
17865
|
+
}
|
|
17866
|
+
}
|
|
17867
|
+
});
|
|
17868
|
+
});
|
|
17450
17869
|
test26("never reads another project's objects or links", async () => {
|
|
17451
17870
|
await withHarness(async ({ harness }) => {
|
|
17452
17871
|
await migrateStorage2(harness.storage, { projectId: otherProjectId6, ontology: ontology3 });
|
|
@@ -17541,7 +17960,25 @@ function noDrafts(objectTypeId) {
|
|
|
17541
17960
|
const { query } = validateObjectQuery2({ kind: "filter", input: { kind: "start", objectTypeId }, predicate }, { ontology: ontology3 });
|
|
17542
17961
|
if (query.kind !== "filter")
|
|
17543
17962
|
throw new Error("expected a validated filter");
|
|
17544
|
-
return
|
|
17963
|
+
return viewConditionReadCondition(objectTypeId, [query.predicate], undefined);
|
|
17964
|
+
}
|
|
17965
|
+
function ticketCondition(predicate) {
|
|
17966
|
+
const { query } = validateObjectQuery2({ kind: "filter", input: { kind: "start", objectTypeId: Ticket.id }, predicate }, { ontology: ontology3 });
|
|
17967
|
+
if (query.kind !== "filter")
|
|
17968
|
+
throw new Error("expected a validated filter");
|
|
17969
|
+
return query.predicate;
|
|
17970
|
+
}
|
|
17971
|
+
async function queryRows(reader, query) {
|
|
17972
|
+
const result = await executeObjectQuery2({ projectId: projectId18, query }, { ontology: ontology3, storage: reader });
|
|
17973
|
+
return result.objects;
|
|
17974
|
+
}
|
|
17975
|
+
function linkedRows(value) {
|
|
17976
|
+
if (Array.isArray(value))
|
|
17977
|
+
return value;
|
|
17978
|
+
return value ? [value] : [];
|
|
17979
|
+
}
|
|
17980
|
+
function linkedIds(value) {
|
|
17981
|
+
return linkedRows(value).map((row) => row.primaryId).sort();
|
|
17545
17982
|
}
|
|
17546
17983
|
function sorted(input, propertyId, direction = "asc") {
|
|
17547
17984
|
return { kind: "sort", fields: [{ kind: "property", propertyId, direction }], input };
|
|
@@ -17564,6 +18001,7 @@ async function seed2(fixture) {
|
|
|
17564
18001
|
linkRow(Customer.id, "cust-1", "invoices", Invoice.id, "inv-1"),
|
|
17565
18002
|
linkRow(Customer.id, "cust-1", "invoices", Invoice.id, "inv-2"),
|
|
17566
18003
|
linkRow(Customer.id, "cust-1", "invoices", Invoice.id, "inv-3"),
|
|
18004
|
+
linkRow(Customer.id, "cust-1", "primaryInvoice", Invoice.id, "inv-2"),
|
|
17567
18005
|
linkRow(Invoice.id, "inv-1", "related", Invoice.id, "inv-2"),
|
|
17568
18006
|
linkRow(Invoice.id, "inv-2", "related", Invoice.id, "inv-1"),
|
|
17569
18007
|
linkRow(Invoice.id, "inv-1", "related", Invoice.id, "inv-3")
|
|
@@ -18116,6 +18554,59 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
18116
18554
|
expect27(codes(await where({ op: "gt", propertyId: "code", value: "\uFF21" }))).toEqual(["\uD83D\uDE00"]);
|
|
18117
18555
|
});
|
|
18118
18556
|
});
|
|
18557
|
+
test27("lists a descending sort as the ascending one backwards, ties included", async () => {
|
|
18558
|
+
await withStorage(async ({ objects: storage, fixture }) => {
|
|
18559
|
+
const labelCodes = ["b", null, "a", "b", "a", null, "b"];
|
|
18560
|
+
const deviceNames = ["dimmer", "sensor", "dimmer", "sensor"];
|
|
18561
|
+
await fixture.seed({
|
|
18562
|
+
objects: [
|
|
18563
|
+
...labelCodes.map((code, index) => objectSeed(Label.id, `tie-${index}`, { id: `tie-${index}`, code })),
|
|
18564
|
+
objectSeed(Room.id, "room-ties", { id: "room-ties" }),
|
|
18565
|
+
...deviceNames.map((name, index) => objectSeed(Device3.id, `device-tie-${index}`, { id: `device-tie-${index}`, name }))
|
|
18566
|
+
],
|
|
18567
|
+
links: deviceNames.map((_, index) => linkSeed(Room.id, "room-ties", "hasDevice", Device3.id, `device-tie-${index}`))
|
|
18568
|
+
});
|
|
18569
|
+
const run = (query) => executeObjectQuery2({ projectId: projectId19, query }, { ontology: objectQueryContractOntology, storage });
|
|
18570
|
+
const byCode = (direction) => ({
|
|
18571
|
+
kind: "sort",
|
|
18572
|
+
fields: [{ kind: "property", propertyId: "code", direction }],
|
|
18573
|
+
input: { kind: "start", objectTypeId: Label.id }
|
|
18574
|
+
});
|
|
18575
|
+
const ascending = ids(await run(byCode("asc")));
|
|
18576
|
+
const descending = ids(await run(byCode("desc")));
|
|
18577
|
+
const valued = ascending.slice(0, 5);
|
|
18578
|
+
const nulls = ascending.slice(5);
|
|
18579
|
+
expect27(descending).toEqual([...valued.reverse(), ...nulls.reverse()]);
|
|
18580
|
+
const paged = [];
|
|
18581
|
+
let pageToken;
|
|
18582
|
+
do {
|
|
18583
|
+
const page = await run({ kind: "page", pageSize: 2, pageToken, input: byCode("desc") });
|
|
18584
|
+
paged.push(...ids(page));
|
|
18585
|
+
pageToken = page.nextPageToken;
|
|
18586
|
+
} while (pageToken);
|
|
18587
|
+
expect27(paged).toEqual(descending);
|
|
18588
|
+
const devices = async (direction) => {
|
|
18589
|
+
const result = await run({
|
|
18590
|
+
kind: "expand",
|
|
18591
|
+
expansions: [
|
|
18592
|
+
{
|
|
18593
|
+
linkId: "hasDevice",
|
|
18594
|
+
direction: "outgoing",
|
|
18595
|
+
limit: deviceNames.length,
|
|
18596
|
+
orderBy: [{ kind: "property", propertyId: "name", direction }]
|
|
18597
|
+
}
|
|
18598
|
+
],
|
|
18599
|
+
input: { kind: "limit", limit: 10, input: { kind: "start", objectTypeId: Room.id } }
|
|
18600
|
+
});
|
|
18601
|
+
const room = result.objects.find((row) => row.primaryId === "room-ties");
|
|
18602
|
+
const linked = room?.links?.hasDevice;
|
|
18603
|
+
return Array.isArray(linked) ? linked.map((row) => row.primaryId) : [];
|
|
18604
|
+
};
|
|
18605
|
+
const ascendingDevices = await devices("asc");
|
|
18606
|
+
expect27(ascendingDevices).toHaveLength(deviceNames.length);
|
|
18607
|
+
expect27(await devices("desc")).toEqual([...ascendingDevices].reverse());
|
|
18608
|
+
});
|
|
18609
|
+
});
|
|
18119
18610
|
test27("keeps page tokens stable when projection hides sorted cursor fields", async () => {
|
|
18120
18611
|
await withStorage(async ({ objects: storage, fixture }) => {
|
|
18121
18612
|
await seedObjectQueryContractData(fixture);
|
|
@@ -22149,7 +22640,7 @@ function runQueueContractSuite(label, options) {
|
|
|
22149
22640
|
}
|
|
22150
22641
|
// src/testing/sandbox-credentials-contract.ts
|
|
22151
22642
|
import { afterAll, beforeAll, describe as describe31, expect as expect32, test as test32 } from "bun:test";
|
|
22152
|
-
import { randomUUID } from "crypto";
|
|
22643
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
22153
22644
|
function runSandboxCredentialsContractSuite(label, options) {
|
|
22154
22645
|
describe31(label, () => {
|
|
22155
22646
|
let server;
|
|
@@ -22208,7 +22699,7 @@ function runSandboxCredentialsContractSuite(label, options) {
|
|
|
22208
22699
|
}
|
|
22209
22700
|
}
|
|
22210
22701
|
test32("a command reaches the origin with the credential added", async () => {
|
|
22211
|
-
const secret = `suite-${
|
|
22702
|
+
const secret = `suite-${randomUUID2()}`;
|
|
22212
22703
|
await withSandbox([credential(secret)], async (sandbox) => {
|
|
22213
22704
|
const seen = await request(sandbox, origin, "/api/whoami");
|
|
22214
22705
|
expect32(seen).toEqual({
|
|
@@ -22219,7 +22710,7 @@ function runSandboxCredentialsContractSuite(label, options) {
|
|
|
22219
22710
|
});
|
|
22220
22711
|
});
|
|
22221
22712
|
test32("only a request the credential matches gets it, replacing the command's own", async () => {
|
|
22222
|
-
const secret = `suite-${
|
|
22713
|
+
const secret = `suite-${randomUUID2()}`;
|
|
22223
22714
|
await withSandbox([credential(secret)], async (sandbox) => {
|
|
22224
22715
|
expect32((await request(sandbox, origin, "/health")).authorization).toBeNull();
|
|
22225
22716
|
expect32((await request(sandbox, origin, "/api/x", { method: "DELETE" })).authorization).toBeNull();
|
|
@@ -22228,8 +22719,8 @@ function runSandboxCredentialsContractSuite(label, options) {
|
|
|
22228
22719
|
});
|
|
22229
22720
|
});
|
|
22230
22721
|
test32("a credential reaches its own origin alone, whatever the paths it shares", async () => {
|
|
22231
|
-
const secret = `suite-${
|
|
22232
|
-
const otherSecret = `suite-${
|
|
22722
|
+
const secret = `suite-${randomUUID2()}`;
|
|
22723
|
+
const otherSecret = `suite-${randomUUID2()}`;
|
|
22233
22724
|
const credentials = [
|
|
22234
22725
|
credential(secret),
|
|
22235
22726
|
credential(otherSecret, { origin: otherOrigin, path: { prefix: "/api/v2/" } })
|
|
@@ -22242,8 +22733,8 @@ function runSandboxCredentialsContractSuite(label, options) {
|
|
|
22242
22733
|
});
|
|
22243
22734
|
});
|
|
22244
22735
|
test32("setRequestCredentials replaces the credentials, and an empty list removes them", async () => {
|
|
22245
|
-
const first = `suite-${
|
|
22246
|
-
const second = `suite-${
|
|
22736
|
+
const first = `suite-${randomUUID2()}`;
|
|
22737
|
+
const second = `suite-${randomUUID2()}`;
|
|
22247
22738
|
await withSandbox([credential(first)], async (sandbox) => {
|
|
22248
22739
|
if (!sandbox.setRequestCredentials)
|
|
22249
22740
|
throw new Error("setRequestCredentials is missing");
|
|
@@ -22254,8 +22745,8 @@ function runSandboxCredentialsContractSuite(label, options) {
|
|
|
22254
22745
|
});
|
|
22255
22746
|
});
|
|
22256
22747
|
test32.skipIf(options.separatesSandboxes === false)("a sandbox's commands can't use another sandbox's credentials", async () => {
|
|
22257
|
-
const secretA = `suite-${
|
|
22258
|
-
const secretB = `suite-${
|
|
22748
|
+
const secretA = `suite-${randomUUID2()}`;
|
|
22749
|
+
const secretB = `suite-${randomUUID2()}`;
|
|
22259
22750
|
await withSandbox([credential(secretA)], async (a) => {
|
|
22260
22751
|
if (!a.credentialedUrl)
|
|
22261
22752
|
throw new Error("credentialedUrl is missing");
|
|
@@ -22269,7 +22760,7 @@ function runSandboxCredentialsContractSuite(label, options) {
|
|
|
22269
22760
|
expect32(received).not.toContain(`Bearer ${secretA}`);
|
|
22270
22761
|
});
|
|
22271
22762
|
test32("nothing a command can read holds the credential", async () => {
|
|
22272
|
-
const secret = `suite-${
|
|
22763
|
+
const secret = `suite-${randomUUID2()}`;
|
|
22273
22764
|
await withSandbox([credential(secret)], async (sandbox) => {
|
|
22274
22765
|
const looked = await sandbox.runCommand("bash", [
|
|
22275
22766
|
"-c",
|
|
@@ -24272,4 +24763,4 @@ export {
|
|
|
24272
24763
|
startTestWebhookRun
|
|
24273
24764
|
};
|
|
24274
24765
|
|
|
24275
|
-
//# debugId=
|
|
24766
|
+
//# debugId=652F34A1B34236CB64756E2164756E21
|