@sixb/core 0.2.3 → 0.2.5
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 +28 -28
- package/dist/agents/cancel.d.ts +1 -1
- package/dist/agents/cancel.d.ts.map +1 -1
- package/dist/agents/child-question.d.ts +35 -2
- package/dist/agents/child-question.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +35 -3
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/ids.d.ts +4 -0
- package/dist/agents/ids.d.ts.map +1 -1
- package/dist/agents/index.d.ts +9 -7
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +59 -33
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/model-loop.d.ts.map +1 -1
- package/dist/agents/queued-turn.d.ts +16 -0
- package/dist/agents/queued-turn.d.ts.map +1 -0
- package/dist/agents/request.d.ts +79 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/run-after-finish.d.ts +10 -0
- package/dist/agents/run-after-finish.d.ts.map +1 -1
- package/dist/agents/run-artifacts.d.ts +0 -38
- package/dist/agents/run-artifacts.d.ts.map +1 -1
- package/dist/agents/run-events.d.ts +6 -1
- package/dist/agents/run-events.d.ts.map +1 -1
- package/dist/agents/run-session-children.d.ts +9 -0
- package/dist/agents/run-session-children.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 -1
- package/dist/agents/run-session.d.ts.map +1 -1
- package/dist/agents/run-turn.d.ts.map +1 -1
- package/dist/agents/streams/index.d.ts +1 -1
- package/dist/agents/streams/index.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 +16 -0
- package/dist/agents/streams/protocol.d.ts.map +1 -1
- package/dist/agents/tool-files.d.ts +1 -1
- package/dist/agents/tool-files.d.ts.map +1 -1
- package/dist/agents/tool-input-coercion.d.ts +20 -0
- package/dist/agents/tool-input-coercion.d.ts.map +1 -0
- package/dist/agents/turn-answered.d.ts +7 -0
- package/dist/agents/turn-answered.d.ts.map +1 -0
- package/dist/agents/validation.d.ts +1 -1
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/artifacts/canvas-display.d.ts +3 -5
- package/dist/artifacts/canvas-display.d.ts.map +1 -1
- package/dist/artifacts/comments.d.ts +14 -3
- package/dist/artifacts/comments.d.ts.map +1 -1
- package/dist/artifacts/document-fill.d.ts +18 -0
- package/dist/artifacts/document-fill.d.ts.map +1 -0
- package/dist/artifacts/errors.d.ts +1 -1
- package/dist/artifacts/errors.d.ts.map +1 -1
- package/dist/artifacts/events.d.ts +3 -2
- package/dist/artifacts/events.d.ts.map +1 -1
- package/dist/artifacts/execution.d.ts +40 -4
- package/dist/artifacts/execution.d.ts.map +1 -1
- package/dist/artifacts/frames/assets.d.ts +8 -1
- package/dist/artifacts/frames/assets.d.ts.map +1 -1
- package/dist/artifacts/frames/document-data.d.ts +98 -0
- package/dist/artifacts/frames/document-data.d.ts.map +1 -0
- package/dist/artifacts/frames/entries.d.ts +12 -7
- package/dist/artifacts/frames/entries.d.ts.map +1 -1
- package/dist/artifacts/frames/index.d.ts +2 -1
- package/dist/artifacts/frames/index.d.ts.map +1 -1
- package/dist/artifacts/frames/index.js +22 -13
- package/dist/artifacts/frames/index.js.map +4 -4
- package/dist/artifacts/frames/kit.d.ts +15 -0
- package/dist/artifacts/frames/kit.d.ts.map +1 -1
- package/dist/artifacts/frames/protocol.d.ts +65 -3
- package/dist/artifacts/frames/protocol.d.ts.map +1 -1
- package/dist/artifacts/frames/runtime.d.ts +32 -5
- package/dist/artifacts/frames/runtime.d.ts.map +1 -1
- package/dist/artifacts/index.d.ts +4 -2
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/index.js +35 -3
- package/dist/artifacts/index.js.map +3 -3
- package/dist/artifacts/live/blocks.d.ts +62 -0
- package/dist/artifacts/live/blocks.d.ts.map +1 -0
- package/dist/artifacts/live/board.d.ts +6 -0
- package/dist/artifacts/live/board.d.ts.map +1 -1
- package/dist/artifacts/live/document.d.ts +12 -0
- package/dist/artifacts/live/document.d.ts.map +1 -1
- package/dist/artifacts/live/index.d.ts +2 -0
- package/dist/artifacts/live/index.d.ts.map +1 -1
- package/dist/artifacts/live/index.js +148 -44
- package/dist/artifacts/live/index.js.map +3 -3
- package/dist/artifacts/live/page.d.ts +49 -0
- package/dist/artifacts/live/page.d.ts.map +1 -0
- package/dist/artifacts/live/protocol.d.ts +5 -0
- package/dist/artifacts/live/protocol.d.ts.map +1 -1
- package/dist/artifacts/live/server.d.ts +2 -2
- package/dist/artifacts/live/server.d.ts.map +1 -1
- package/dist/artifacts/live/server.js +23 -19
- package/dist/artifacts/live/server.js.map +1 -1
- package/dist/artifacts/live/state.d.ts +4 -1
- package/dist/artifacts/live/state.d.ts.map +1 -1
- package/dist/artifacts/outline.d.ts +16 -0
- package/dist/artifacts/outline.d.ts.map +1 -1
- package/dist/artifacts/paper.d.ts +22 -0
- package/dist/artifacts/paper.d.ts.map +1 -0
- package/dist/artifacts/pdf-job.d.ts +9 -0
- package/dist/artifacts/pdf-job.d.ts.map +1 -0
- package/dist/artifacts/publish/fields.d.ts +25 -0
- package/dist/artifacts/publish/fields.d.ts.map +1 -0
- package/dist/artifacts/publish/index.d.ts +2 -1
- package/dist/artifacts/publish/index.d.ts.map +1 -1
- package/dist/artifacts/publish/index.js +26 -18
- package/dist/artifacts/publish/index.js.map +1 -1
- package/dist/artifacts/publish/merge.d.ts +5 -5
- package/dist/artifacts/publish/merge.d.ts.map +1 -1
- package/dist/artifacts/publish/pdf.d.ts +28 -0
- package/dist/artifacts/publish/pdf.d.ts.map +1 -0
- package/dist/artifacts/publish/previews.d.ts +12 -20
- package/dist/artifacts/publish/previews.d.ts.map +1 -1
- package/dist/artifacts/publish/publish.d.ts.map +1 -1
- package/dist/artifacts/publish/queries.d.ts +6 -1
- package/dist/artifacts/publish/queries.d.ts.map +1 -1
- package/dist/artifacts/publish/query-answers.d.ts +5 -2
- package/dist/artifacts/publish/query-answers.d.ts.map +1 -1
- package/dist/artifacts/publish/validate/document-html.d.ts +24 -0
- package/dist/artifacts/publish/validate/document-html.d.ts.map +1 -0
- package/dist/artifacts/publish/validate/document.d.ts +5 -3
- package/dist/artifacts/publish/validate/document.d.ts.map +1 -1
- package/dist/artifacts/queries.d.ts +16 -2
- package/dist/artifacts/queries.d.ts.map +1 -1
- package/dist/auth/index.js +2 -2
- package/dist/authorization/event-visibility.d.ts.map +1 -1
- package/dist/authorization/index.js +1 -1
- package/dist/blob-storage/index.js +1 -1
- package/dist/bootstrap/index.js +38 -38
- package/dist/{chunk-tqa68kj7.js → chunk-0hkdtwqk.js} +5 -5
- package/dist/{chunk-s5n9617r.js → chunk-0mvjpgvm.js} +5 -5
- package/dist/{chunk-k66rp2hr.js → chunk-1yh6jgtz.js} +1 -1
- package/dist/{chunk-26qet7wh.js → chunk-5t9gm5tt.js} +4 -4
- package/dist/{chunk-a6fjkcne.js → chunk-60662fyv.js} +54 -28
- package/dist/{chunk-a6fjkcne.js.map → chunk-60662fyv.js.map} +7 -6
- package/dist/{chunk-e0hnbb1m.js → chunk-61zptves.js} +1 -1
- package/dist/{chunk-hkaa807g.js → chunk-68hm50qh.js} +3 -3
- package/dist/{chunk-9nsjjd44.js → chunk-8tv3qd65.js} +2 -1
- package/dist/chunk-8tv3qd65.js.map +12 -0
- package/dist/{chunk-fe6r7yhg.js → chunk-92wrka15.js} +1 -1
- package/dist/{chunk-m7b9q5dk.js → chunk-aw1z0gre.js} +4 -4
- package/dist/chunk-az95tsh3.js.map +2 -2
- package/dist/{chunk-4j0sagwv.js → chunk-b4escq4c.js} +62 -14
- package/dist/{chunk-4j0sagwv.js.map → chunk-b4escq4c.js.map} +7 -7
- package/dist/chunk-bqr703h4.js +1799 -0
- package/dist/chunk-bqr703h4.js.map +13 -0
- package/dist/{chunk-eptrvnby.js → chunk-c29729me.js} +42 -3
- package/dist/chunk-c29729me.js.map +12 -0
- package/dist/{chunk-t24yktqr.js → chunk-dvgc56n2.js} +20 -4
- package/dist/{chunk-t24yktqr.js.map → chunk-dvgc56n2.js.map} +5 -5
- package/dist/{chunk-3014rfjz.js → chunk-ewqn51gr.js} +25 -7
- package/dist/{chunk-3014rfjz.js.map → chunk-ewqn51gr.js.map} +3 -3
- package/dist/{chunk-7z5rkf0m.js → chunk-ey1p8w68.js} +175 -5
- package/dist/chunk-ey1p8w68.js.map +13 -0
- package/dist/{chunk-z0t4p2sk.js → chunk-fpf57gca.js} +350 -61
- package/dist/chunk-fpf57gca.js.map +47 -0
- package/dist/{chunk-kv0kvknv.js → chunk-fzae1jpq.js} +7 -7
- package/dist/{chunk-b9qfh2ya.js → chunk-fzbhybya.js} +29 -2
- package/dist/chunk-fzbhybya.js.map +11 -0
- package/dist/{chunk-2by73sm2.js → chunk-gjhrz66x.js} +225 -17
- package/dist/{chunk-2by73sm2.js.map → chunk-gjhrz66x.js.map} +5 -5
- package/dist/chunk-hn2r7z41.js.map +1 -1
- package/dist/{chunk-6gtxshcc.js → chunk-k29n4176.js} +6 -6
- package/dist/{chunk-48c1z8nj.js → chunk-k3jh8gsg.js} +10 -2
- package/dist/chunk-k3jh8gsg.js.map +10 -0
- package/dist/{chunk-w9s23r24.js → chunk-m3qx2pns.js} +751 -93
- package/dist/chunk-m3qx2pns.js.map +34 -0
- package/dist/{chunk-smnt672s.js → chunk-m9ketb51.js} +20 -4
- package/dist/chunk-m9ketb51.js.map +10 -0
- package/dist/chunk-mbwsgjn7.js +40 -0
- package/dist/chunk-mbwsgjn7.js.map +11 -0
- package/dist/{chunk-sysnvjce.js → chunk-naxjka9v.js} +2 -2
- package/dist/{chunk-n4zzaf6q.js → chunk-nxysqbt0.js} +4 -2
- package/dist/chunk-nxysqbt0.js.map +10 -0
- package/dist/{chunk-vzkxqf8h.js → chunk-paxabbqd.js} +49 -5
- package/dist/chunk-paxabbqd.js.map +23 -0
- package/dist/{chunk-8tqnsx3q.js → chunk-pc7kra3k.js} +5 -3
- package/dist/{chunk-8tqnsx3q.js.map → chunk-pc7kra3k.js.map} +3 -3
- package/dist/{chunk-qafng88v.js → chunk-pqvvqc65.js} +4 -4
- package/dist/chunk-pvpq483h.js.map +2 -2
- package/dist/{chunk-mzx71snp.js → chunk-q7g9cqwt.js} +7 -2
- package/dist/{chunk-mzx71snp.js.map → chunk-q7g9cqwt.js.map} +3 -3
- package/dist/{chunk-8t2ynwg0.js → chunk-q8d9p0tb.js} +24 -1
- package/dist/{chunk-8t2ynwg0.js.map → chunk-q8d9p0tb.js.map} +3 -3
- package/dist/{chunk-wa05txmk.js → chunk-qavwr628.js} +49 -5
- package/dist/chunk-qavwr628.js.map +12 -0
- package/dist/{chunk-bkmnd7zq.js → chunk-rg725hry.js} +174 -30
- package/dist/{chunk-bkmnd7zq.js.map → chunk-rg725hry.js.map} +9 -8
- package/dist/{chunk-8p7bze4c.js → chunk-s1mqyqmm.js} +3 -3
- package/dist/{chunk-p351afzm.js → chunk-s5pj68fa.js} +2 -2
- package/dist/{chunk-855w9nvw.js → chunk-vehcr9eb.js} +1 -1
- package/dist/{chunk-qds484t8.js → chunk-vs2s3p8n.js} +932 -21
- package/dist/chunk-vs2s3p8n.js.map +20 -0
- package/dist/chunk-vtjzwymr.js.map +2 -2
- package/dist/{chunk-n68vz95m.js → chunk-wqe9shx2.js} +1 -1
- package/dist/{chunk-0k3r5kb3.js → chunk-xcrnrpfh.js} +1 -1
- package/dist/{chunk-cwdzcv37.js → chunk-xrmbhap8.js} +2 -2
- package/dist/{chunk-cwdzcv37.js.map → chunk-xrmbhap8.js.map} +2 -2
- package/dist/{chunk-f6ahf5gf.js → chunk-xxfj0rr2.js} +20 -5
- package/dist/chunk-xxfj0rr2.js.map +13 -0
- package/dist/{chunk-3hzhcfsv.js → chunk-y8fwm3z2.js} +2 -2
- package/dist/{chunk-3hzhcfsv.js.map → chunk-y8fwm3z2.js.map} +3 -3
- package/dist/{chunk-e9w4mgdh.js → chunk-z1njfqqs.js} +589 -53
- package/dist/{chunk-e9w4mgdh.js.map → chunk-z1njfqqs.js.map} +14 -11
- package/dist/{chunk-yv8hv4wq.js → chunk-z4jqb44a.js} +3 -1
- package/dist/chunk-z4jqb44a.js.map +10 -0
- package/dist/{chunk-s7xqfxs9.js → chunk-zft9bzbc.js} +2 -1
- package/dist/{chunk-s7xqfxs9.js.map → chunk-zft9bzbc.js.map} +3 -3
- package/dist/{chunk-38yvdqzd.js → chunk-zxhym8tr.js} +1 -1
- package/dist/connectors/connection-handles.d.ts +9 -0
- package/dist/connectors/connection-handles.d.ts.map +1 -0
- package/dist/connectors/connections/authorizations.d.ts +9 -0
- package/dist/connectors/connections/authorizations.d.ts.map +1 -1
- package/dist/connectors/connections/events.d.ts +17 -0
- package/dist/connectors/connections/events.d.ts.map +1 -0
- package/dist/connectors/connections/runs.d.ts +3 -0
- package/dist/connectors/connections/runs.d.ts.map +1 -1
- package/dist/connectors/connections/service.d.ts +4 -0
- package/dist/connectors/connections/service.d.ts.map +1 -1
- package/dist/connectors/execution.d.ts +7 -1
- package/dist/connectors/execution.d.ts.map +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/types.d.ts +22 -1
- package/dist/connectors/types.d.ts.map +1 -1
- package/dist/datasets/write.js +1 -1
- package/dist/deploy/index.d.ts +1 -1
- package/dist/deploy/index.d.ts.map +1 -1
- package/dist/deploy/internal.js +3 -2
- package/dist/deploy/internal.js.map +3 -3
- package/dist/deploy/services.d.ts.map +1 -1
- package/dist/deploy/types.d.ts +18 -1
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/events/definitions.d.ts +4 -0
- package/dist/events/definitions.d.ts.map +1 -1
- package/dist/events/execution.d.ts.map +1 -1
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +3 -3
- package/dist/events/outbox-dispatcher.d.ts +7 -0
- package/dist/events/outbox-dispatcher.d.ts.map +1 -1
- package/dist/events/scope.d.ts +1 -0
- package/dist/events/scope.d.ts.map +1 -1
- package/dist/events/scope.js +1 -1
- package/dist/events/selectors/builder.d.ts +9 -1
- package/dist/events/selectors/builder.d.ts.map +1 -1
- package/dist/events/selectors/index.d.ts +2 -2
- package/dist/events/selectors/index.d.ts.map +1 -1
- package/dist/events/selectors/index.js +2 -2
- package/dist/events/selectors/predicate.d.ts.map +1 -1
- package/dist/events/selectors/types.d.ts +18 -3
- package/dist/events/selectors/types.d.ts.map +1 -1
- package/dist/events/types/artifacts.d.ts +7 -1
- package/dist/events/types/artifacts.d.ts.map +1 -1
- package/dist/events/types/connectors.d.ts +32 -0
- package/dist/events/types/connectors.d.ts.map +1 -0
- package/dist/events/types/index.d.ts +3 -1
- package/dist/events/types/index.d.ts.map +1 -1
- package/dist/execution/agent.js +28 -28
- package/dist/execution/authorization.d.ts +5 -0
- package/dist/execution/authorization.d.ts.map +1 -1
- package/dist/execution/primitive.js +28 -28
- package/dist/execution/request.js +29 -29
- package/dist/execution/scopes.d.ts +8 -0
- package/dist/execution/scopes.d.ts.map +1 -1
- package/dist/execution/script.d.ts +7 -0
- package/dist/execution/script.d.ts.map +1 -0
- package/dist/execution/types.d.ts +16 -1
- package/dist/execution/types.d.ts.map +1 -1
- package/dist/http/api-routes.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +9 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -44
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/index.js +1 -1
- package/dist/lineage/executors.d.ts +1 -1
- package/dist/lineage/executors.d.ts.map +1 -1
- package/dist/maintenance/index.js +1 -1
- package/dist/materialization/event-envelopes.d.ts +3 -3
- package/dist/materialization/event-envelopes.d.ts.map +1 -1
- package/dist/materialization/events.d.ts +6 -0
- package/dist/materialization/events.d.ts.map +1 -1
- package/dist/materialization/index.js +1 -1
- package/dist/materialization/model.d.ts +6 -0
- package/dist/materialization/model.d.ts.map +1 -1
- package/dist/materializer/index.js +13 -13
- package/dist/materializer/projections/replace.d.ts.map +1 -1
- package/dist/materializer/projections/replacement-plan.d.ts +2 -0
- package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
- package/dist/materializer/shared/normalize.d.ts +1 -0
- package/dist/materializer/shared/normalize.d.ts.map +1 -1
- package/dist/models/execution/index.js +12 -12
- package/dist/models/language-model.d.ts +6 -0
- package/dist/models/language-model.d.ts.map +1 -1
- package/dist/models/tools.d.ts +2 -0
- package/dist/models/tools.d.ts.map +1 -1
- package/dist/objects/index.js +28 -28
- package/dist/objects/query/index.js +12 -12
- package/dist/pipelines/index.js +18 -18
- package/dist/projections/builders.d.ts +7 -1
- package/dist/projections/builders.d.ts.map +1 -1
- package/dist/projections/index.d.ts +1 -1
- package/dist/projections/index.d.ts.map +1 -1
- package/dist/projections/internal.js +13 -13
- package/dist/projections/types.d.ts +10 -0
- package/dist/projections/types.d.ts.map +1 -1
- package/dist/projections/validation.d.ts.map +1 -1
- package/dist/queues/in-memory.d.ts +2 -1
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/queues/index.d.ts +1 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/index.js +1 -1
- package/dist/queues/types.d.ts +40 -13
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +13 -0
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +1 -0
- package/dist/runtime/internal.d.ts.map +1 -1
- package/dist/runtime/internal.js +39 -18
- package/dist/runtime/internal.js.map +4 -3
- package/dist/runtime/resolve-definitions.d.ts +1 -1
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/runtime/script.d.ts +39 -0
- package/dist/runtime/script.d.ts.map +1 -0
- package/dist/runtime/sixb.d.ts +2 -2
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/schedules/builders.d.ts.map +1 -1
- package/dist/schedules/index.js +3 -3
- package/dist/schedules/runtime.d.ts.map +1 -1
- package/dist/schedules/validation.d.ts +2 -0
- package/dist/schedules/validation.d.ts.map +1 -1
- package/dist/shares/internal.js +12 -12
- package/dist/storage/agents/errors.d.ts +1 -1
- package/dist/storage/agents/errors.d.ts.map +1 -1
- package/dist/storage/agents/in-memory.d.ts +26 -1
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/index.d.ts +2 -2
- package/dist/storage/agents/index.d.ts.map +1 -1
- package/dist/storage/agents/provider.d.ts +12 -3
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +25 -5
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +156 -1
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/artifacts/in-memory.d.ts +7 -1
- package/dist/storage/artifacts/in-memory.d.ts.map +1 -1
- package/dist/storage/artifacts/index.d.ts +1 -1
- package/dist/storage/artifacts/index.d.ts.map +1 -1
- package/dist/storage/artifacts/record.d.ts +2 -1
- package/dist/storage/artifacts/record.d.ts.map +1 -1
- package/dist/storage/artifacts/types.d.ts +34 -0
- package/dist/storage/artifacts/types.d.ts.map +1 -1
- package/dist/storage/executions/provider.d.ts +3 -3
- package/dist/storage/executions/provider.d.ts.map +1 -1
- package/dist/storage/executions/provider.js +1 -1
- package/dist/storage/executions/types.d.ts +6 -0
- package/dist/storage/executions/types.d.ts.map +1 -1
- package/dist/storage/executions/validation.d.ts.map +1 -1
- package/dist/storage/file-upload-sessions/provider.js +3 -3
- package/dist/storage/index.d.ts +3 -3
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +18 -14
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.d.ts +1 -1
- package/dist/storage/internal.d.ts.map +1 -1
- package/dist/storage/internal.js +8 -6
- package/dist/storage/internal.js.map +2 -2
- package/dist/storage/ontology/in-memory/replacement-plans.d.ts +2 -0
- package/dist/storage/ontology/in-memory/replacement-plans.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +1 -1
- package/dist/storage/ontology/replacement-plans.d.ts +8 -0
- package/dist/storage/ontology/replacement-plans.d.ts.map +1 -1
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +1 -1
- package/dist/storage/workflow-runs/provider.js +3 -3
- package/dist/syncs/index.js +19 -19
- package/dist/testing/agent-execution.d.ts +3 -0
- package/dist/testing/agent-execution.d.ts.map +1 -1
- package/dist/testing/agent-inbox-storage-contract.d.ts +15 -0
- package/dist/testing/agent-inbox-storage-contract.d.ts.map +1 -0
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/artifact-storage-contract.d.ts.map +1 -1
- package/dist/testing/execution-storage-contract.d.ts.map +1 -1
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +5524 -4555
- package/dist/testing/index.js.map +10 -9
- package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
- package/dist/testing/queues-contract.d.ts.map +1 -1
- package/dist/webhooks/connections.d.ts +3 -4
- package/dist/webhooks/connections.d.ts.map +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.d.ts.map +1 -1
- package/dist/webhooks/internal.js +16 -49
- package/dist/webhooks/internal.js.map +3 -3
- package/dist/webhooks/types.d.ts +2 -11
- package/dist/webhooks/types.d.ts.map +1 -1
- package/dist/workers/queued-run-dispatch.d.ts.map +1 -1
- package/dist/workflows/index.js +35 -35
- package/package.json +6 -1
- package/src/agents/README.md +6 -2
- package/src/agents/approval-outcome.ts +2 -2
- package/src/agents/cancel.ts +2 -2
- package/src/agents/child-question.ts +76 -8
- package/src/agents/execution.ts +168 -30
- package/src/agents/ids.ts +9 -1
- package/src/agents/index.ts +27 -6
- package/src/agents/model-loop.ts +3 -1
- package/src/agents/queued-turn.ts +46 -0
- package/src/agents/request.ts +517 -2
- package/src/agents/run-after-finish.ts +259 -2
- package/src/agents/run-artifacts.ts +3 -93
- package/src/agents/run-events.ts +26 -1
- package/src/agents/run-session-children.ts +33 -0
- package/src/agents/run-session-http.ts +10 -2
- package/src/agents/run-session-serve.ts +3 -8
- package/src/agents/run-session.ts +142 -3
- package/src/agents/run-turn.ts +8 -0
- package/src/agents/streams/index.ts +1 -0
- package/src/agents/streams/protocol.ts +41 -1
- package/src/agents/tool-files.ts +1 -1
- package/src/agents/tool-input-coercion.ts +140 -0
- package/src/agents/turn-answered.ts +31 -0
- package/src/agents/validation.ts +13 -3
- package/src/artifacts/canvas-display.ts +4 -6
- package/src/artifacts/comments.ts +70 -17
- package/src/artifacts/document-fill.ts +103 -0
- package/src/artifacts/errors.ts +2 -0
- package/src/artifacts/events.ts +4 -1
- package/src/artifacts/execution.ts +265 -31
- package/src/artifacts/frames/assets.ts +42 -7
- package/src/artifacts/frames/document-data.ts +353 -0
- package/src/artifacts/frames/entries.ts +22 -16
- package/src/artifacts/frames/grants.ts +2 -2
- package/src/artifacts/frames/index.ts +3 -0
- package/src/artifacts/frames/kit.ts +102 -0
- package/src/artifacts/frames/protocol.ts +96 -3
- package/src/artifacts/frames/runtime.ts +709 -19
- package/src/artifacts/index.ts +6 -0
- package/src/artifacts/live/blocks.ts +889 -0
- package/src/artifacts/live/board.ts +195 -42
- package/src/artifacts/live/document.ts +170 -5
- package/src/artifacts/live/index.ts +7 -0
- package/src/artifacts/live/page.ts +807 -0
- package/src/artifacts/live/protocol.ts +5 -0
- package/src/artifacts/live/server.ts +2 -2
- package/src/artifacts/live/state.ts +9 -4
- package/src/artifacts/outline.ts +17 -0
- package/src/artifacts/paper.ts +173 -0
- package/src/artifacts/pdf-job.ts +11 -0
- package/src/artifacts/publish/fields.ts +177 -0
- package/src/artifacts/publish/index.ts +6 -1
- package/src/artifacts/publish/merge.ts +14 -12
- package/src/artifacts/publish/pdf.ts +82 -0
- package/src/artifacts/publish/previews.ts +24 -34
- package/src/artifacts/publish/publish.ts +26 -3
- package/src/artifacts/publish/queries.ts +20 -4
- package/src/artifacts/publish/query-answers.ts +14 -3
- package/src/artifacts/publish/validate/document-html.ts +245 -0
- package/src/artifacts/publish/validate/document.ts +34 -3
- package/src/artifacts/queries.ts +59 -13
- package/src/authorization/event-visibility.ts +13 -0
- package/src/connectors/connection-handles.ts +71 -0
- package/src/connectors/connections/authorizations.ts +50 -2
- package/src/connectors/connections/events.ts +57 -0
- package/src/connectors/connections/runs.ts +5 -0
- package/src/connectors/connections/service.ts +19 -1
- package/src/connectors/execution.ts +30 -2
- package/src/connectors/index.ts +3 -0
- package/src/connectors/types.ts +29 -1
- package/src/deploy/index.ts +1 -0
- package/src/deploy/services.ts +1 -0
- package/src/deploy/types.ts +26 -1
- package/src/events/definitions.ts +14 -0
- package/src/events/execution.ts +9 -2
- package/src/events/index.ts +8 -0
- package/src/events/outbox-dispatcher.ts +12 -2
- package/src/events/scope.ts +3 -0
- package/src/events/selectors/builder.ts +49 -0
- package/src/events/selectors/index.ts +5 -0
- package/src/events/selectors/predicate.ts +2 -0
- package/src/events/selectors/types.ts +30 -1
- package/src/events/types/artifacts.ts +7 -1
- package/src/events/types/connectors.ts +36 -0
- package/src/events/types/index.ts +7 -0
- package/src/execution/authorization.ts +45 -0
- package/src/execution/durable.ts +2 -0
- package/src/execution/scopes.ts +24 -0
- package/src/execution/script.ts +27 -0
- package/src/execution/types.ts +7 -1
- package/src/http/api-routes.ts +26 -1
- package/src/index.ts +21 -2
- package/src/lineage/executors.ts +3 -1
- package/src/materialization/event-envelopes.ts +10 -5
- package/src/materialization/events.ts +2 -0
- package/src/materialization/model.ts +6 -0
- package/src/materializer/README.md +10 -0
- package/src/materializer/projections/replace.ts +42 -1
- package/src/materializer/projections/replacement-plan.ts +44 -4
- package/src/materializer/shared/normalize.ts +4 -0
- package/src/models/language-model.ts +6 -0
- package/src/models/tools.ts +2 -0
- package/src/projections/builders.ts +20 -0
- package/src/projections/index.ts +1 -0
- package/src/projections/registry.ts +1 -0
- package/src/projections/revision.ts +2 -0
- package/src/projections/types.ts +11 -0
- package/src/projections/validation.ts +6 -0
- package/src/queues/in-memory.ts +5 -0
- package/src/queues/index.ts +3 -1
- package/src/queues/types.ts +45 -14
- package/src/runtime/host.ts +112 -4
- package/src/runtime/internal.ts +1 -0
- package/src/runtime/resolve-definitions.ts +4 -1
- package/src/runtime/script.ts +62 -0
- package/src/runtime/sixb.ts +3 -3
- package/src/schedules/builders.ts +4 -1
- package/src/schedules/runtime.ts +3 -0
- package/src/schedules/validation.ts +20 -2
- package/src/storage/agents/errors.ts +1 -0
- package/src/storage/agents/in-memory.ts +229 -1
- package/src/storage/agents/index.ts +16 -0
- package/src/storage/agents/provider.ts +284 -2
- package/src/storage/agents/types.ts +168 -1
- package/src/storage/artifacts/in-memory.ts +32 -1
- package/src/storage/artifacts/index.ts +2 -0
- package/src/storage/artifacts/record.ts +25 -2
- package/src/storage/artifacts/types.ts +37 -0
- package/src/storage/executions/provider.ts +22 -2
- package/src/storage/executions/types.ts +2 -0
- package/src/storage/executions/validation.ts +27 -0
- package/src/storage/index.ts +18 -0
- package/src/storage/internal.ts +1 -0
- package/src/storage/ontology/in-memory/replacement-plans.ts +22 -0
- package/src/storage/ontology/replacement-plans.ts +6 -0
- package/src/storage/operation-scope.ts +1 -0
- package/src/testing/agent-execution.ts +45 -2
- package/src/testing/agent-inbox-storage-contract.ts +815 -0
- package/src/testing/agent-storage-contract.ts +103 -0
- package/src/testing/artifact-storage-contract.ts +72 -4
- package/src/testing/execution-storage-contract.ts +31 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/materializer-storage-contract.ts +139 -1
- package/src/testing/queues-contract.ts +22 -0
- package/src/webhooks/connections.ts +9 -50
- package/src/webhooks/index.ts +0 -2
- package/src/webhooks/types.ts +2 -13
- package/src/workers/queued-run-dispatch.ts +8 -1
- package/dist/chunk-48c1z8nj.js.map +0 -10
- package/dist/chunk-58geavnf.js +0 -29
- package/dist/chunk-58geavnf.js.map +0 -10
- package/dist/chunk-7z5rkf0m.js.map +0 -13
- package/dist/chunk-9nsjjd44.js.map +0 -12
- package/dist/chunk-b9qfh2ya.js.map +0 -11
- package/dist/chunk-eptrvnby.js.map +0 -12
- package/dist/chunk-f6ahf5gf.js.map +0 -13
- package/dist/chunk-m2jerfef.js +0 -474
- package/dist/chunk-m2jerfef.js.map +0 -11
- package/dist/chunk-n4zzaf6q.js.map +0 -10
- package/dist/chunk-qds484t8.js.map +0 -18
- package/dist/chunk-smnt672s.js.map +0 -10
- package/dist/chunk-vzkxqf8h.js.map +0 -23
- package/dist/chunk-w9s23r24.js.map +0 -30
- package/dist/chunk-wa05txmk.js.map +0 -11
- package/dist/chunk-yv8hv4wq.js.map +0 -10
- package/dist/chunk-z0t4p2sk.js.map +0 -47
- /package/dist/{chunk-tqa68kj7.js.map → chunk-0hkdtwqk.js.map} +0 -0
- /package/dist/{chunk-s5n9617r.js.map → chunk-0mvjpgvm.js.map} +0 -0
- /package/dist/{chunk-k66rp2hr.js.map → chunk-1yh6jgtz.js.map} +0 -0
- /package/dist/{chunk-26qet7wh.js.map → chunk-5t9gm5tt.js.map} +0 -0
- /package/dist/{chunk-e0hnbb1m.js.map → chunk-61zptves.js.map} +0 -0
- /package/dist/{chunk-hkaa807g.js.map → chunk-68hm50qh.js.map} +0 -0
- /package/dist/{chunk-fe6r7yhg.js.map → chunk-92wrka15.js.map} +0 -0
- /package/dist/{chunk-m7b9q5dk.js.map → chunk-aw1z0gre.js.map} +0 -0
- /package/dist/{chunk-kv0kvknv.js.map → chunk-fzae1jpq.js.map} +0 -0
- /package/dist/{chunk-6gtxshcc.js.map → chunk-k29n4176.js.map} +0 -0
- /package/dist/{chunk-sysnvjce.js.map → chunk-naxjka9v.js.map} +0 -0
- /package/dist/{chunk-qafng88v.js.map → chunk-pqvvqc65.js.map} +0 -0
- /package/dist/{chunk-8p7bze4c.js.map → chunk-s1mqyqmm.js.map} +0 -0
- /package/dist/{chunk-p351afzm.js.map → chunk-s5pj68fa.js.map} +0 -0
- /package/dist/{chunk-855w9nvw.js.map → chunk-vehcr9eb.js.map} +0 -0
- /package/dist/{chunk-n68vz95m.js.map → chunk-wqe9shx2.js.map} +0 -0
- /package/dist/{chunk-0k3r5kb3.js.map → chunk-xcrnrpfh.js.map} +0 -0
- /package/dist/{chunk-38yvdqzd.js.map → chunk-zxhym8tr.js.map} +0 -0
package/src/artifacts/queries.ts
CHANGED
|
@@ -15,8 +15,23 @@ import type { ArtifactKind } from "./kinds"
|
|
|
15
15
|
*/
|
|
16
16
|
export const ARTIFACT_QUERIES_DIRECTORY = "queries/"
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The kinds that show live data: a designed document among them, never a Markdown one, which shows
|
|
20
|
+
* a live sheet instead. A file is as it is.
|
|
21
|
+
*/
|
|
22
|
+
export const ARTIFACT_QUERY_KINDS: readonly ArtifactKind[] = [
|
|
23
|
+
"sheet",
|
|
24
|
+
"page",
|
|
25
|
+
"slides",
|
|
26
|
+
"canvas",
|
|
27
|
+
"document",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* What a designed document's fields read of the object that holds it, a query of its own: the
|
|
32
|
+
* holder, with the links they read through. No query file may take its name.
|
|
33
|
+
*/
|
|
34
|
+
export const DOCUMENT_HOLDER_QUERY = "holder"
|
|
20
35
|
|
|
21
36
|
/** A query read from its file: rows, or the facets of the rows. */
|
|
22
37
|
export type ArtifactQuery =
|
|
@@ -125,11 +140,17 @@ class QueryShapeError extends Error {
|
|
|
125
140
|
*
|
|
126
141
|
* Only what an author writes is read: the fields core resolves itself are refused, as the API
|
|
127
142
|
* refuses them. `page`, `vector` and `rerank` are refused too, saying why.
|
|
143
|
+
*
|
|
144
|
+
* `{ "kind": "holder" }` starts from the object that holds a designed document, which `holder`
|
|
145
|
+
* stands for: refused without it. `usesHolder` says whether the query starts from it anywhere.
|
|
128
146
|
*/
|
|
129
147
|
export function parseArtifactQuery(
|
|
130
148
|
path: string,
|
|
131
|
-
text: string
|
|
132
|
-
|
|
149
|
+
text: string,
|
|
150
|
+
options: { readonly holder?: ObjectQuery } = {}
|
|
151
|
+
):
|
|
152
|
+
| { readonly query: ArtifactQuery; readonly at: "$" | "$.query"; readonly usesHolder: boolean }
|
|
153
|
+
| { readonly error: string } {
|
|
133
154
|
let value: unknown
|
|
134
155
|
try {
|
|
135
156
|
value = JSON.parse(text)
|
|
@@ -137,8 +158,9 @@ export function parseArtifactQuery(
|
|
|
137
158
|
return { error: `${path} is not valid JSON.` }
|
|
138
159
|
}
|
|
139
160
|
|
|
161
|
+
const context: ReadContext = { ...options, usesHolder: false }
|
|
140
162
|
try {
|
|
141
|
-
return readFile(value)
|
|
163
|
+
return { ...readFile(value, context), usesHolder: context.usesHolder }
|
|
142
164
|
} catch (error) {
|
|
143
165
|
if (error instanceof QueryShapeError)
|
|
144
166
|
return { error: `${path}: ${error.path}: ${error.message}` }
|
|
@@ -146,11 +168,20 @@ export function parseArtifactQuery(
|
|
|
146
168
|
}
|
|
147
169
|
}
|
|
148
170
|
|
|
149
|
-
|
|
171
|
+
/** What reading a file takes and learns: the holder's node, and whether it was used. */
|
|
172
|
+
interface ReadContext {
|
|
173
|
+
readonly holder?: ObjectQuery
|
|
174
|
+
usesHolder: boolean
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function readFile(
|
|
178
|
+
value: unknown,
|
|
179
|
+
context: ReadContext
|
|
180
|
+
): { query: ArtifactQuery; at: "$" | "$.query" } {
|
|
150
181
|
const file = record(value, "$")
|
|
151
182
|
|
|
152
183
|
if (Object.hasOwn(file, "kind")) {
|
|
153
|
-
return { query: { kind: "objects", query: readNode(file, "$") }, at: "$" }
|
|
184
|
+
return { query: { kind: "objects", query: readNode(file, "$", context) }, at: "$" }
|
|
154
185
|
}
|
|
155
186
|
|
|
156
187
|
if (!Object.hasOwn(file, "query")) {
|
|
@@ -165,11 +196,14 @@ function readFile(value: unknown): { query: ArtifactQuery; at: "$" | "$.query" }
|
|
|
165
196
|
// A file written for `sixb objects query` keeps its total: a reader always gets one.
|
|
166
197
|
if (file.includeTotal !== undefined) boolean(file, "includeTotal", "$")
|
|
167
198
|
|
|
168
|
-
return {
|
|
199
|
+
return {
|
|
200
|
+
query: { kind: "objects", query: readNode(file.query, "$.query", context) },
|
|
201
|
+
at: "$.query",
|
|
202
|
+
}
|
|
169
203
|
}
|
|
170
204
|
|
|
171
205
|
only(file, "$", ["query", "facets"], "a facets request")
|
|
172
|
-
const query = readNode(file.query, "$.query")
|
|
206
|
+
const query = readNode(file.query, "$.query", context)
|
|
173
207
|
const facets = list(file.facets, "$.facets").map((facet, index) =>
|
|
174
208
|
readFacet(facet, `$.facets[${index}]`)
|
|
175
209
|
)
|
|
@@ -210,10 +244,22 @@ const REFUSED_NODES: Readonly<Record<string, string>> = {
|
|
|
210
244
|
rerank: "each reader who opens the artifact would pay for a reranking call.",
|
|
211
245
|
}
|
|
212
246
|
|
|
213
|
-
function readNode(value: unknown, path: string): ObjectQuery {
|
|
247
|
+
function readNode(value: unknown, path: string, context: ReadContext): ObjectQuery {
|
|
214
248
|
const node = record(value, path)
|
|
215
249
|
const kind = node.kind
|
|
216
250
|
|
|
251
|
+
if (kind === "holder") {
|
|
252
|
+
only(node, path, ["kind"], 'a "holder" node')
|
|
253
|
+
if (!context.holder) {
|
|
254
|
+
throw new QueryShapeError(
|
|
255
|
+
`${path}.kind`,
|
|
256
|
+
'"holder" starts from the object that holds a designed document, which names its type with <meta name="sixb:object-type">.'
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
context.usesHolder = true
|
|
260
|
+
return context.holder
|
|
261
|
+
}
|
|
262
|
+
|
|
217
263
|
if (typeof kind === "string" && Object.hasOwn(REFUSED_NODES, kind)) {
|
|
218
264
|
throw new QueryShapeError(
|
|
219
265
|
`${path}.kind`,
|
|
@@ -223,13 +269,13 @@ function readNode(value: unknown, path: string): ObjectQuery {
|
|
|
223
269
|
if (typeof kind !== "string" || !Object.hasOwn(NODE_KEYS, kind)) {
|
|
224
270
|
throw new QueryShapeError(
|
|
225
271
|
`${path}.kind`,
|
|
226
|
-
`${JSON.stringify(kind)} is not a query node; use ${Object.keys(NODE_KEYS).join(", ")}.`
|
|
272
|
+
`${JSON.stringify(kind)} is not a query node; use ${Object.keys(NODE_KEYS).join(", ")}, or holder in a designed document.`
|
|
227
273
|
)
|
|
228
274
|
}
|
|
229
275
|
|
|
230
276
|
const known = kind as keyof typeof NODE_KEYS
|
|
231
277
|
only(node, path, ["kind", ...NODE_KEYS[known]], `a "${known}" node`)
|
|
232
|
-
const input = () => readNode(node.input, `${path}.input
|
|
278
|
+
const input = () => readNode(node.input, `${path}.input`, context)
|
|
233
279
|
|
|
234
280
|
switch (known) {
|
|
235
281
|
case "start":
|
|
@@ -286,7 +332,7 @@ function readNode(value: unknown, path: string): ObjectQuery {
|
|
|
286
332
|
kind: known,
|
|
287
333
|
op: oneOf(node, "op", path, ["union", "intersect", "subtract"] as const),
|
|
288
334
|
inputs: list(node.inputs, `${path}.inputs`).map((each, index) =>
|
|
289
|
-
readNode(each, `${path}.inputs[${index}]
|
|
335
|
+
readNode(each, `${path}.inputs[${index}]`, context)
|
|
290
336
|
),
|
|
291
337
|
}
|
|
292
338
|
|
|
@@ -81,6 +81,19 @@ export function canViewEvent(
|
|
|
81
81
|
case "users":
|
|
82
82
|
// Member events carry profiles and invitee emails: the member directory's grant.
|
|
83
83
|
return isAllowed(authorization, { kind: "users.view" })
|
|
84
|
+
case "connectors": {
|
|
85
|
+
// Whoever sees the connection: the connector's managers, and the owner of a personal one.
|
|
86
|
+
const owner = event.payload.connection.owner
|
|
87
|
+
return (
|
|
88
|
+
isAllowed(authorization, {
|
|
89
|
+
kind: "connector.manage",
|
|
90
|
+
connectorId: event.payload.connectorId,
|
|
91
|
+
}) ||
|
|
92
|
+
(owner.type === "user" &&
|
|
93
|
+
authorization.principal.type === "user" &&
|
|
94
|
+
authorization.principal.id === owner.id)
|
|
95
|
+
)
|
|
96
|
+
}
|
|
84
97
|
case "artifacts":
|
|
85
98
|
// No grant reads an artifact: its owner and the conversations that share it decide, which
|
|
86
99
|
// the events runtime asks per artifact. Grants alone show none.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createConnectorCodedError } from "./errors"
|
|
2
|
+
import type { ConnectorExecutionSourceResolver } from "./execution"
|
|
3
|
+
import {
|
|
4
|
+
type ConnectorConnectionHandle,
|
|
5
|
+
type ConnectorConnectionMetadata,
|
|
6
|
+
type ConnectorConnections,
|
|
7
|
+
type ConnectorDefinition,
|
|
8
|
+
isOAuthConnectorDefinition,
|
|
9
|
+
} from "./types"
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Handles on the connections of one connector, read through the run's connection resolver. Each
|
|
13
|
+
* call lists again, so a connection that went away since is not handed out. `mayUse` narrows the
|
|
14
|
+
* list to what the run may act with.
|
|
15
|
+
*/
|
|
16
|
+
export function createConnectorConnections<TClient>(
|
|
17
|
+
resolver: ConnectorExecutionSourceResolver,
|
|
18
|
+
definition: ConnectorDefinition,
|
|
19
|
+
mayUse: (connection: ConnectorConnectionMetadata) => boolean
|
|
20
|
+
): ConnectorConnections<TClient> {
|
|
21
|
+
const handles = async (
|
|
22
|
+
matches: (connection: ConnectorConnectionMetadata) => boolean
|
|
23
|
+
): Promise<readonly ConnectorConnectionHandle<TClient>[]> => {
|
|
24
|
+
if (!isOAuthConnectorDefinition(definition)) {
|
|
25
|
+
throw createConnectorCodedError(
|
|
26
|
+
"connector.configuration_invalid",
|
|
27
|
+
`Connector '${definition.id}' has no connections: it is not an OAuth connector.`
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
const sources = await resolver.list(definition)
|
|
31
|
+
return sources.flatMap(({ connection }) =>
|
|
32
|
+
connection && mayUse(connection) && matches(connection) ? [handle(connection)] : []
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const handle = (connection: ConnectorConnectionMetadata): ConnectorConnectionHandle<TClient> => {
|
|
37
|
+
let clientPromise: Promise<TClient> | undefined
|
|
38
|
+
return {
|
|
39
|
+
connection,
|
|
40
|
+
client() {
|
|
41
|
+
clientPromise ??= (async () => {
|
|
42
|
+
const current = (await resolver.list(definition)).find(
|
|
43
|
+
(candidate) =>
|
|
44
|
+
candidate.connection?.id === connection.id &&
|
|
45
|
+
candidate.connection.account.id === connection.account.id
|
|
46
|
+
)
|
|
47
|
+
if (!current)
|
|
48
|
+
throw createConnectorCodedError(
|
|
49
|
+
"connector.not_found",
|
|
50
|
+
"The connection is no longer active for this account."
|
|
51
|
+
)
|
|
52
|
+
return (await current.connect(new AbortController().signal)) as TClient
|
|
53
|
+
})()
|
|
54
|
+
return clientPromise
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
list: () => handles(() => true),
|
|
61
|
+
async forAccount(accountId) {
|
|
62
|
+
if (typeof accountId !== "string" || !accountId.trim()) {
|
|
63
|
+
throw createConnectorCodedError(
|
|
64
|
+
"connector.configuration_invalid",
|
|
65
|
+
"Account ID must be a non-empty string."
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
return handles((connection) => connection.account.id === accountId)
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
assertCredentialMutationOperationActive,
|
|
28
28
|
ConnectorCredentialMutationCoordinator,
|
|
29
29
|
} from "./credential-mutations"
|
|
30
|
+
import type { ConnectorConnectionEvents } from "./events"
|
|
30
31
|
import type {
|
|
31
32
|
CompleteConnectorReauthorizationInput,
|
|
32
33
|
CompleteNewConnectorAuthorizationInput,
|
|
@@ -51,6 +52,7 @@ export interface ConnectorAuthorizationLifecycleOptions {
|
|
|
51
52
|
readonly providerOperationTimeoutMs: number
|
|
52
53
|
readonly refreshSkewMs: number
|
|
53
54
|
readonly now: () => Date
|
|
55
|
+
readonly events: ConnectorConnectionEvents
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
export interface RevokeConnectorAuthorizationInput {
|
|
@@ -79,9 +81,11 @@ export class DefaultConnectorAuthorizationLifecycle implements ConnectorAuthoriz
|
|
|
79
81
|
private readonly mutations: ConnectorCredentialMutationCoordinator
|
|
80
82
|
private readonly credentials: ConnectorCredentialCodec
|
|
81
83
|
private readonly tokens: ConnectorTokenAccess
|
|
84
|
+
private readonly events: ConnectorConnectionEvents
|
|
82
85
|
|
|
83
86
|
constructor(options: ConnectorAuthorizationLifecycleOptions) {
|
|
84
87
|
this.projectId = options.projectId
|
|
88
|
+
this.events = options.events
|
|
85
89
|
this.storage = options.storage
|
|
86
90
|
this.resolveDefinition = options.resolveDefinition
|
|
87
91
|
this.accountSelectionTtlMs = positiveDuration(
|
|
@@ -243,9 +247,25 @@ export class DefaultConnectorAuthorizationLifecycle implements ConnectorAuthoriz
|
|
|
243
247
|
input: CompleteConnectorReauthorizationInput
|
|
244
248
|
): Promise<ConnectorAuthorizationRecord> {
|
|
245
249
|
this.assertRegistered(input.definition)
|
|
246
|
-
|
|
250
|
+
const authorization = await this.mutations.runLocallySerialized(input.authorizationId, () =>
|
|
247
251
|
this.completeReauthorizationMutation(input)
|
|
248
252
|
)
|
|
253
|
+
// The reauthorization has committed; failing to announce it must not report it as failed.
|
|
254
|
+
const connections = await this.storage
|
|
255
|
+
.listConnectionsByAuthorization({
|
|
256
|
+
projectId: this.projectId,
|
|
257
|
+
connectorId: input.definition.id,
|
|
258
|
+
authorizationId: authorization.id,
|
|
259
|
+
})
|
|
260
|
+
.catch((error: unknown) => {
|
|
261
|
+
console.warn("[Sixb] Reconnected connections could not be read to announce them.", error)
|
|
262
|
+
return []
|
|
263
|
+
})
|
|
264
|
+
await this.events.connected(
|
|
265
|
+
connections.filter((connection) => connection.status === "connected"),
|
|
266
|
+
"reconnected"
|
|
267
|
+
)
|
|
268
|
+
return authorization
|
|
249
269
|
}
|
|
250
270
|
|
|
251
271
|
async revokeAuthorization(
|
|
@@ -373,9 +393,15 @@ export class DefaultConnectorAuthorizationLifecycle implements ConnectorAuthoriz
|
|
|
373
393
|
claim.authorization,
|
|
374
394
|
async (executing, signal) => {
|
|
375
395
|
if (definition.adapter.authentication.revoke && credentials) {
|
|
396
|
+
const connectedAccountIds = await this.accountsConnectedElsewhere(
|
|
397
|
+
definition.id,
|
|
398
|
+
claim.authorization.id
|
|
399
|
+
)
|
|
400
|
+
|
|
376
401
|
await definition.adapter.authentication.revoke(
|
|
377
402
|
this.adapterContext(definition.id, signal),
|
|
378
|
-
credentials
|
|
403
|
+
credentials,
|
|
404
|
+
{ connectedAccountIds }
|
|
379
405
|
)
|
|
380
406
|
}
|
|
381
407
|
return this.mutations.stageCredentialMutationRevocation(executing, signal)
|
|
@@ -592,6 +618,28 @@ export class DefaultConnectorAuthorizationLifecycle implements ConnectorAuthoriz
|
|
|
592
618
|
)
|
|
593
619
|
}
|
|
594
620
|
|
|
621
|
+
/**
|
|
622
|
+
* The accounts another grant still keeps connected. A provider files some state under the
|
|
623
|
+
* account rather than the grant (a Graph subscription, for one), so the revoke hook leaves it
|
|
624
|
+
* to the connections still using it.
|
|
625
|
+
*/
|
|
626
|
+
private async accountsConnectedElsewhere(
|
|
627
|
+
connectorId: string,
|
|
628
|
+
authorizationId: string
|
|
629
|
+
): Promise<readonly string[]> {
|
|
630
|
+
const connections = await withConnectorStorageBoundary(
|
|
631
|
+
"Connector connections could not be read before revocation.",
|
|
632
|
+
() => this.storage.listConnections({ projectId: this.projectId, connectorId })
|
|
633
|
+
)
|
|
634
|
+
|
|
635
|
+
const accountIds = connections
|
|
636
|
+
.filter((connection) => connection.status === "connected")
|
|
637
|
+
.filter((connection) => connection.authorizationId !== authorizationId)
|
|
638
|
+
.map((connection) => connection.account.id)
|
|
639
|
+
|
|
640
|
+
return [...new Set(accountIds)].sort()
|
|
641
|
+
}
|
|
642
|
+
|
|
595
643
|
private adapterContext(connectorId: string, signal: AbortSignal) {
|
|
596
644
|
return { projectId: this.projectId, connectorId, signal }
|
|
597
645
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { DomainEventService } from "../../events"
|
|
2
|
+
import type {
|
|
3
|
+
ConnectorConnectionConnectedEvent,
|
|
4
|
+
ConnectorConnectionDisconnectedEvent,
|
|
5
|
+
EventDraft,
|
|
6
|
+
} from "../../events/types"
|
|
7
|
+
import type { ConnectorConnectionRecord } from "../../storage"
|
|
8
|
+
import type { ConnectorConnectionMetadata } from "../types"
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Announces connections becoming usable and unusable, after the write that changed them has
|
|
12
|
+
* committed. Connection storage keeps no outbox, so an event the broker refuses is reported
|
|
13
|
+
* through `onError` and lost: delivery is at most once, and code reacting to these events needs a
|
|
14
|
+
* periodic pass to catch up.
|
|
15
|
+
*/
|
|
16
|
+
export class ConnectorConnectionEvents {
|
|
17
|
+
constructor(private readonly events?: Pick<DomainEventService, "emit">) {}
|
|
18
|
+
|
|
19
|
+
connected(
|
|
20
|
+
connections: readonly ConnectorConnectionRecord[],
|
|
21
|
+
reason: ConnectorConnectionConnectedEvent["payload"]["reason"]
|
|
22
|
+
): Promise<void> {
|
|
23
|
+
return this.emit(
|
|
24
|
+
connections.map((connection) => ({
|
|
25
|
+
type: "connector.connection.connected",
|
|
26
|
+
payload: { connectorId: connection.connectorId, connection: metadata(connection), reason },
|
|
27
|
+
}))
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
disconnected(
|
|
32
|
+
connections: readonly ConnectorConnectionRecord[],
|
|
33
|
+
reason: ConnectorConnectionDisconnectedEvent["payload"]["reason"]
|
|
34
|
+
): Promise<void> {
|
|
35
|
+
return this.emit(
|
|
36
|
+
connections.map((connection) => ({
|
|
37
|
+
type: "connector.connection.disconnected",
|
|
38
|
+
payload: { connectorId: connection.connectorId, connection: metadata(connection), reason },
|
|
39
|
+
}))
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private async emit(events: readonly EventDraft[]): Promise<void> {
|
|
44
|
+
if (!this.events || events.length === 0) return
|
|
45
|
+
await this.events.emit({ events }, { source: "Sixb" })
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function metadata(connection: ConnectorConnectionRecord): ConnectorConnectionMetadata {
|
|
50
|
+
return {
|
|
51
|
+
id: connection.id,
|
|
52
|
+
connectorId: connection.connectorId,
|
|
53
|
+
owner: connection.owner,
|
|
54
|
+
slot: connection.slot,
|
|
55
|
+
account: connection.account,
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -30,6 +30,7 @@ import type {
|
|
|
30
30
|
StartConnectorConnectionRunInput,
|
|
31
31
|
StartConnectorConnectionRunResult,
|
|
32
32
|
} from "./contracts"
|
|
33
|
+
import type { ConnectorConnectionEvents } from "./events"
|
|
33
34
|
import type {
|
|
34
35
|
ConnectorAuthorizationRequestHandler,
|
|
35
36
|
ResolveOAuthConnectorDefinition,
|
|
@@ -56,6 +57,7 @@ export interface ConnectorConnectionRunServiceOptions {
|
|
|
56
57
|
readonly processingTtlMs: number
|
|
57
58
|
readonly selectionTtlMs: number
|
|
58
59
|
readonly now: () => Date
|
|
60
|
+
readonly events: ConnectorConnectionEvents
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
/** Durable orchestration for the user-visible connector connection flow. */
|
|
@@ -69,6 +71,7 @@ export class ConnectorConnectionRunService {
|
|
|
69
71
|
private readonly processingTtlMs: number
|
|
70
72
|
private readonly selectionTtlMs: number
|
|
71
73
|
private readonly now: () => Date
|
|
74
|
+
private readonly events: ConnectorConnectionEvents
|
|
72
75
|
private readonly maintenanceTimers = new Map<string, ReturnType<typeof setTimeout>>()
|
|
73
76
|
|
|
74
77
|
constructor(options: ConnectorConnectionRunServiceOptions) {
|
|
@@ -84,6 +87,7 @@ export class ConnectorConnectionRunService {
|
|
|
84
87
|
)
|
|
85
88
|
this.selectionTtlMs = positiveDuration(options.selectionTtlMs, "account selection TTL")
|
|
86
89
|
this.now = options.now
|
|
90
|
+
this.events = options.events
|
|
87
91
|
}
|
|
88
92
|
|
|
89
93
|
async startSelection(
|
|
@@ -384,6 +388,7 @@ export class ConnectorConnectionRunService {
|
|
|
384
388
|
}
|
|
385
389
|
throw storageBoundaryError(error, "Connector account selection could not be persisted.")
|
|
386
390
|
}
|
|
391
|
+
await this.events.connected([selected.connection], selected.replaced ? "replaced" : "connected")
|
|
387
392
|
const cleanupCompleted = selected.revocationPendingAuthorizationId
|
|
388
393
|
? await this.continuePendingRevocation(
|
|
389
394
|
run.connectorId,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto"
|
|
2
2
|
import { isSixbError } from "../../errors/internal"
|
|
3
|
+
import type { DomainEventService } from "../../events"
|
|
3
4
|
import type {
|
|
4
5
|
AuthUserStore,
|
|
5
6
|
ConnectorConnectionRecord,
|
|
@@ -62,6 +63,7 @@ import type {
|
|
|
62
63
|
StartConnectorConnectionRunResult,
|
|
63
64
|
} from "./contracts"
|
|
64
65
|
import { connectorAuthorizationStatusError } from "./credential-mutations"
|
|
66
|
+
import { ConnectorConnectionEvents } from "./events"
|
|
65
67
|
import { runBoundedConnectorProviderOperation } from "./provider-operation"
|
|
66
68
|
import { ConnectorAuthorizationRequestHandler } from "./request"
|
|
67
69
|
import { ConnectorConnectionRunService } from "./runs"
|
|
@@ -86,6 +88,8 @@ export interface ConnectorConnectionServiceOptions {
|
|
|
86
88
|
readonly connectionRunProcessingTtlMs?: number
|
|
87
89
|
readonly refreshSkewMs?: number
|
|
88
90
|
readonly now?: () => Date
|
|
91
|
+
/** Where connection events go. Without it, connecting and disconnecting announce nothing. */
|
|
92
|
+
readonly events?: Pick<DomainEventService, "emit">
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
/** Process-owned composition of connector connection lookup and OAuth lifecycle state. */
|
|
@@ -98,6 +102,7 @@ export class ConnectorConnectionService implements ConnectorConnectionProcess {
|
|
|
98
102
|
private readonly authorizations: DefaultConnectorAuthorizationLifecycle
|
|
99
103
|
private readonly requests: ConnectorAuthorizationRequestHandler
|
|
100
104
|
private readonly runs: ConnectorConnectionRunService
|
|
105
|
+
private readonly events: ConnectorConnectionEvents
|
|
101
106
|
readonly callbackProcess: ConnectorConnectionCallbackProcess
|
|
102
107
|
|
|
103
108
|
constructor(
|
|
@@ -119,6 +124,7 @@ export class ConnectorConnectionService implements ConnectorConnectionProcess {
|
|
|
119
124
|
"provider operation timeout"
|
|
120
125
|
)
|
|
121
126
|
this.providerOperationTimeoutMs = providerOperationTimeoutMs
|
|
127
|
+
this.events = new ConnectorConnectionEvents(options.events)
|
|
122
128
|
|
|
123
129
|
this.authorizations = new DefaultConnectorAuthorizationLifecycle({
|
|
124
130
|
projectId,
|
|
@@ -132,6 +138,7 @@ export class ConnectorConnectionService implements ConnectorConnectionProcess {
|
|
|
132
138
|
providerOperationTimeoutMs,
|
|
133
139
|
refreshSkewMs: options.refreshSkewMs ?? DEFAULT_REFRESH_SKEW_MS,
|
|
134
140
|
now,
|
|
141
|
+
events: this.events,
|
|
135
142
|
})
|
|
136
143
|
this.requests = new ConnectorAuthorizationRequestHandler({
|
|
137
144
|
projectId,
|
|
@@ -153,6 +160,7 @@ export class ConnectorConnectionService implements ConnectorConnectionProcess {
|
|
|
153
160
|
options.connectionRunProcessingTtlMs ?? providerOperationTimeoutMs * 2 + 30_000,
|
|
154
161
|
selectionTtlMs: accountSelectionTtlMs,
|
|
155
162
|
now,
|
|
163
|
+
events: this.events,
|
|
156
164
|
})
|
|
157
165
|
this.callbackProcess = Object.freeze({
|
|
158
166
|
completeConnectionRun: (input: CompleteConnectorConnectionRunInput) =>
|
|
@@ -221,6 +229,7 @@ export class ConnectorConnectionService implements ConnectorConnectionProcess {
|
|
|
221
229
|
async revokeUserConnections(userId: string): Promise<void> {
|
|
222
230
|
const principal = { type: "user", id: nonblank(userId, "user id") } as const
|
|
223
231
|
const failures: unknown[] = []
|
|
232
|
+
const suspended: ConnectorConnectionRecord[] = []
|
|
224
233
|
for (const definition of this.definitionsById.values()) {
|
|
225
234
|
if (!isOAuthConnectorDefinition(definition)) continue
|
|
226
235
|
if (!connectorConnectionOwners(definition).includes("user")) continue
|
|
@@ -240,12 +249,18 @@ export class ConnectorConnectionService implements ConnectorConnectionProcess {
|
|
|
240
249
|
)
|
|
241
250
|
for (const authorizationId of authorizationIds) {
|
|
242
251
|
try {
|
|
243
|
-
await this.authorizations.revokeAuthorization({
|
|
252
|
+
const revoked = await this.authorizations.revokeAuthorization({
|
|
253
|
+
definition,
|
|
254
|
+
authorizationId,
|
|
255
|
+
principal,
|
|
256
|
+
})
|
|
257
|
+
suspended.push(...revoked.disconnected)
|
|
244
258
|
} catch (error) {
|
|
245
259
|
failures.push(error)
|
|
246
260
|
}
|
|
247
261
|
}
|
|
248
262
|
}
|
|
263
|
+
await this.events.disconnected(suspended, "suspended")
|
|
249
264
|
if (failures.length > 0) {
|
|
250
265
|
throw new AggregateError(
|
|
251
266
|
failures,
|
|
@@ -559,6 +574,7 @@ export class ConnectorConnectionService implements ConnectorConnectionProcess {
|
|
|
559
574
|
}
|
|
560
575
|
throw storageBoundaryError(error, "Connector account selection could not be persisted.")
|
|
561
576
|
}
|
|
577
|
+
await this.events.connected([result.connection], result.replaced ? "replaced" : "connected")
|
|
562
578
|
if (result.revocationPendingAuthorizationId) {
|
|
563
579
|
await this.continuePendingRevocation(definition, result.revocationPendingAuthorizationId)
|
|
564
580
|
}
|
|
@@ -615,6 +631,7 @@ export class ConnectorConnectionService implements ConnectorConnectionProcess {
|
|
|
615
631
|
connectionId: normalizedConnectionId,
|
|
616
632
|
})
|
|
617
633
|
if (!disconnected) return null
|
|
634
|
+
await this.events.disconnected([disconnected.connection], "disconnected")
|
|
618
635
|
if (disconnected.revocationPendingAuthorizationId) {
|
|
619
636
|
await this.continuePendingRevocation(
|
|
620
637
|
definition,
|
|
@@ -649,6 +666,7 @@ export class ConnectorConnectionService implements ConnectorConnectionProcess {
|
|
|
649
666
|
),
|
|
650
667
|
principal: actor.principal,
|
|
651
668
|
})
|
|
669
|
+
await this.events.disconnected(revoked.disconnected, "revoked")
|
|
652
670
|
return {
|
|
653
671
|
affectedConnections: revoked.disconnected.map((connection) =>
|
|
654
672
|
connectorConnectionView(connection, "revoked")
|
|
@@ -2,6 +2,7 @@ import { AuthorizationError, assertProviderAccess } from "../authorization"
|
|
|
2
2
|
import type { ExecutionContext } from "../execution"
|
|
3
3
|
import { resolveExecutionScopeAuthorization } from "../execution/authorization"
|
|
4
4
|
import type { SixbRuntimeContext } from "../runtime/types"
|
|
5
|
+
import { createConnectorConnections } from "./connection-handles"
|
|
5
6
|
import { createConnectorCodedError } from "./errors"
|
|
6
7
|
import type { ConnectorService } from "./service"
|
|
7
8
|
import type {
|
|
@@ -10,6 +11,7 @@ import type {
|
|
|
10
11
|
ConnectorClient,
|
|
11
12
|
ConnectorConnectionMetadata,
|
|
12
13
|
ConnectorConnectionSelector,
|
|
14
|
+
ConnectorConnections,
|
|
13
15
|
ConnectorDefinition,
|
|
14
16
|
OAuthConnectorAdapter,
|
|
15
17
|
} from "./types"
|
|
@@ -24,6 +26,14 @@ export interface ConnectorRuntime {
|
|
|
24
26
|
definition: ConnectorDefinition<string, TAdapter>,
|
|
25
27
|
selector: ConnectorConnectionSelector
|
|
26
28
|
): Promise<ConnectorClient<TAdapter>>
|
|
29
|
+
/**
|
|
30
|
+
* The connections of an OAuth connector this run may use: a run someone requested gets the
|
|
31
|
+
* project's and their own, and a run no one requested, such as one a schedule started, gets
|
|
32
|
+
* every connected one whose owner isn't suspended.
|
|
33
|
+
*/
|
|
34
|
+
connections<TAdapter extends OAuthConnectorAdapter>(
|
|
35
|
+
definition: ConnectorDefinition<string, TAdapter>
|
|
36
|
+
): ConnectorConnections<ConnectorClient<TAdapter>>
|
|
27
37
|
}
|
|
28
38
|
|
|
29
39
|
export interface ConnectorExecutionSource<
|
|
@@ -68,7 +78,7 @@ export function createConnectorRuntime(
|
|
|
68
78
|
return service.connect(definition as ConnectorDefinition<string, ConnectorAdapter>)
|
|
69
79
|
}) as ConnectorRuntime
|
|
70
80
|
|
|
71
|
-
|
|
81
|
+
const resolver: ConnectorExecutionSourceResolver = {
|
|
72
82
|
async list<TAdapter extends AnyConnectorAdapter>(
|
|
73
83
|
definition: ConnectorDefinition<string, TAdapter>
|
|
74
84
|
): Promise<readonly ConnectorExecutionSource<TAdapter>[]> {
|
|
@@ -102,10 +112,28 @@ export function createConnectorRuntime(
|
|
|
102
112
|
},
|
|
103
113
|
}))
|
|
104
114
|
},
|
|
105
|
-
}
|
|
115
|
+
}
|
|
116
|
+
registerConnectorExecutionSourceResolver(connector, resolver)
|
|
117
|
+
connector.connections = <TAdapter extends OAuthConnectorAdapter>(
|
|
118
|
+
definition: ConnectorDefinition<string, TAdapter>
|
|
119
|
+
) =>
|
|
120
|
+
createConnectorConnections<ConnectorClient<TAdapter>>(resolver, definition, (connection) =>
|
|
121
|
+
mayUsePersonalConnection(execution, connection)
|
|
122
|
+
)
|
|
106
123
|
return connector
|
|
107
124
|
}
|
|
108
125
|
|
|
126
|
+
/** The rule `assertPersonalConnectionRequester` enforces, as a filter. */
|
|
127
|
+
function mayUsePersonalConnection(
|
|
128
|
+
execution: ExecutionContext,
|
|
129
|
+
connection: ConnectorConnectionMetadata
|
|
130
|
+
): boolean {
|
|
131
|
+
const owner = connection.owner
|
|
132
|
+
const requester = execution.requestedBy
|
|
133
|
+
if (owner.type !== "user" || requester === undefined) return true
|
|
134
|
+
return requester.type === "user" && requester.id === owner.id
|
|
135
|
+
}
|
|
136
|
+
|
|
109
137
|
function registerConnectorExecutionSourceResolver(
|
|
110
138
|
connector: ConnectorRuntime,
|
|
111
139
|
resolver: ConnectorExecutionSourceResolver
|
package/src/connectors/index.ts
CHANGED
|
@@ -9,15 +9,18 @@ export type {
|
|
|
9
9
|
ConnectorAdapter,
|
|
10
10
|
ConnectorClient,
|
|
11
11
|
ConnectorConnectionClientContext,
|
|
12
|
+
ConnectorConnectionHandle,
|
|
12
13
|
ConnectorConnectionMetadata,
|
|
13
14
|
ConnectorConnectionOptions,
|
|
14
15
|
ConnectorConnectionOwner,
|
|
15
16
|
ConnectorConnectionSelector,
|
|
17
|
+
ConnectorConnections,
|
|
16
18
|
ConnectorContext,
|
|
17
19
|
ConnectorDefinition,
|
|
18
20
|
ConnectorDefinitionOptions,
|
|
19
21
|
ConnectorOAuth2Authentication,
|
|
20
22
|
ConnectorOAuthCredentials,
|
|
23
|
+
ConnectorOAuthRevocation,
|
|
21
24
|
ConnectorTokenSource,
|
|
22
25
|
OAuthConnectorAdapter,
|
|
23
26
|
OAuthConnectorAuthorizationContext,
|
package/src/connectors/types.ts
CHANGED
|
@@ -90,6 +90,21 @@ export interface ConnectorConnectionMetadata extends ConnectorConnectionSelector
|
|
|
90
90
|
readonly account: ConnectorAccountCandidate
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
/** One connection a run may use, and the client that acts with its account. */
|
|
94
|
+
export interface ConnectorConnectionHandle<TClient = unknown> {
|
|
95
|
+
readonly connection: ConnectorConnectionMetadata
|
|
96
|
+
/** First call rechecks the connection and creates its client; later calls reuse that client. */
|
|
97
|
+
client(): Promise<TClient>
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** The connections of one OAuth connector that the current run may use. */
|
|
101
|
+
export interface ConnectorConnections<TClient = unknown> {
|
|
102
|
+
/** Every connection the run may use, ordered by id. */
|
|
103
|
+
list(): Promise<readonly ConnectorConnectionHandle<TClient>[]>
|
|
104
|
+
/** Those whose account has this id; an unknown account returns an empty array. */
|
|
105
|
+
forAccount(accountId: string): Promise<readonly ConnectorConnectionHandle<TClient>[]>
|
|
106
|
+
}
|
|
107
|
+
|
|
93
108
|
/** Credential protection required when an OAuth connector uses durable connection storage. */
|
|
94
109
|
export interface ConnectorConnectionOptions {
|
|
95
110
|
/** Canonical base64url encoding of exactly 32 random bytes, shared by storage replicas. */
|
|
@@ -169,7 +184,20 @@ export interface ConnectorOAuth2Authentication {
|
|
|
169
184
|
* Revokes the grant idempotently. An already revoked or invalid grant must resolve successfully
|
|
170
185
|
* so Sixb can converge after losing an earlier provider response.
|
|
171
186
|
*/
|
|
172
|
-
revoke?(
|
|
187
|
+
revoke?(
|
|
188
|
+
context: ConnectorContext,
|
|
189
|
+
credentials: ConnectorOAuthCredentials,
|
|
190
|
+
revocation?: ConnectorOAuthRevocation
|
|
191
|
+
): Promise<void> | void
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** What the connector still reaches once one grant is revoked. */
|
|
195
|
+
export interface ConnectorOAuthRevocation {
|
|
196
|
+
/**
|
|
197
|
+
* Accounts still connected through another grant, such as the same account in a second slot.
|
|
198
|
+
* Provider state those accounts share with the revoked grant is still in use.
|
|
199
|
+
*/
|
|
200
|
+
readonly connectedAccountIds: readonly string[]
|
|
173
201
|
}
|
|
174
202
|
|
|
175
203
|
export interface OAuthConnectorAdapter<TType extends string = string, TClient = unknown> {
|