@sixb/core 0.1.9 → 0.1.10
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 +8 -8
- package/dist/agents/index.js +16 -15
- package/dist/agents/index.js.map +1 -1
- package/dist/bootstrap/index.js +20 -19
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/broker/in-memory.d.ts +8 -2
- package/dist/broker/in-memory.d.ts.map +1 -1
- package/dist/broker/index.d.ts +4 -2
- package/dist/broker/index.d.ts.map +1 -1
- package/dist/broker/index.js +7 -3
- package/dist/broker/index.js.map +1 -1
- package/dist/broker/retention.d.ts +4 -0
- package/dist/broker/retention.d.ts.map +1 -0
- package/dist/broker/subscriber.d.ts +10 -0
- package/dist/broker/subscriber.d.ts.map +1 -0
- package/dist/broker/types.d.ts +14 -1
- package/dist/broker/types.d.ts.map +1 -1
- package/dist/{chunk-k3cqkkn2.js → chunk-1824gssz.js} +30 -65
- package/dist/chunk-1824gssz.js.map +12 -0
- package/dist/{chunk-h1gfhhbh.js → chunk-28ja2cjs.js} +1 -1
- package/dist/chunk-2c4j899j.js.map +1 -1
- package/dist/{chunk-ppytyr6w.js → chunk-358caqf5.js} +4 -4
- package/dist/chunk-358caqf5.js.map +12 -0
- package/dist/{chunk-kxwa347f.js → chunk-3qms4nax.js} +2 -2
- package/dist/{chunk-kxwa347f.js.map → chunk-3qms4nax.js.map} +3 -3
- package/dist/{chunk-emyyk7dx.js → chunk-5c7ga8zz.js} +22 -145
- package/dist/chunk-5c7ga8zz.js.map +12 -0
- package/dist/{chunk-hpr1r6av.js → chunk-5p1v802y.js} +46 -39
- package/dist/{chunk-hpr1r6av.js.map → chunk-5p1v802y.js.map} +4 -4
- package/dist/{chunk-zcnq6105.js → chunk-85cd7e8c.js} +2 -1
- package/dist/chunk-85cd7e8c.js.map +10 -0
- package/dist/{chunk-1enhpacz.js → chunk-976rxdpx.js} +5 -5
- package/dist/{chunk-3f7veca0.js → chunk-9x8dybsb.js} +3 -3
- package/dist/chunk-9x8dybsb.js.map +10 -0
- package/dist/{chunk-r29fxdhn.js → chunk-aa6z4a19.js} +160 -44
- package/dist/chunk-aa6z4a19.js.map +12 -0
- package/dist/{chunk-r4tfx1sf.js → chunk-agbbygvh.js} +4 -4
- package/dist/{chunk-jjy0fhrn.js → chunk-b0ec55a1.js} +20 -3
- package/dist/chunk-b0ec55a1.js.map +12 -0
- package/dist/{chunk-xfbydgzy.js → chunk-bn138h9w.js} +7 -8
- package/dist/{chunk-xfbydgzy.js.map → chunk-bn138h9w.js.map} +3 -3
- package/dist/{chunk-an5tt9y0.js → chunk-ftv470j8.js} +42 -4
- package/dist/{chunk-an5tt9y0.js.map → chunk-ftv470j8.js.map} +7 -7
- package/dist/{chunk-0w35wavj.js → chunk-g7knyczr.js} +1 -1
- package/dist/{chunk-x57ycxq0.js → chunk-gqh45d2n.js} +42 -3
- package/dist/{chunk-x57ycxq0.js.map → chunk-gqh45d2n.js.map} +3 -3
- package/dist/{chunk-0rdrecsb.js → chunk-kfee1h52.js} +116 -32
- package/dist/chunk-kfee1h52.js.map +13 -0
- package/dist/{chunk-ypbtykv6.js → chunk-nmbxcaqx.js} +1 -1
- package/dist/{chunk-3tgwrcyh.js → chunk-nt99sxd6.js} +2 -2
- package/dist/{chunk-3tgwrcyh.js.map → chunk-nt99sxd6.js.map} +3 -3
- package/dist/{chunk-vf691g1r.js → chunk-p5vcsw9c.js} +2 -2
- package/dist/{chunk-mjbk2djy.js → chunk-p6a4npdx.js} +211 -106
- package/dist/{chunk-mjbk2djy.js.map → chunk-p6a4npdx.js.map} +9 -8
- package/dist/{chunk-3frsnm7x.js → chunk-qma80ych.js} +4 -6
- package/dist/chunk-qma80ych.js.map +11 -0
- package/dist/{chunk-qhcpj9wc.js → chunk-qyeptdyv.js} +96 -2
- package/dist/chunk-qyeptdyv.js.map +15 -0
- package/dist/{chunk-52hbv0ak.js → chunk-r7fj830t.js} +101 -48
- package/dist/chunk-r7fj830t.js.map +36 -0
- package/dist/{chunk-xyr8kppc.js → chunk-rtk71jzp.js} +1 -1
- package/dist/{chunk-m3z3x9v0.js → chunk-t1f4f1ve.js} +1 -1
- package/dist/chunk-v2vcg0w6.js +151 -0
- package/dist/chunk-v2vcg0w6.js.map +11 -0
- package/dist/connectors/connections/authorizations.d.ts.map +1 -1
- package/dist/connectors/connections/contracts.d.ts +3 -0
- package/dist/connectors/connections/contracts.d.ts.map +1 -1
- package/dist/connectors/connections/internal.js +1 -1
- package/dist/connectors/connections/request.d.ts +3 -1
- package/dist/connectors/connections/request.d.ts.map +1 -1
- package/dist/connectors/connections/runs.d.ts.map +1 -1
- package/dist/connectors/connections/tokens.d.ts.map +1 -1
- package/dist/connectors/connections/validation.d.ts +5 -1
- package/dist/connectors/connections/validation.d.ts.map +1 -1
- package/dist/connectors/types.d.ts +19 -4
- package/dist/connectors/types.d.ts.map +1 -1
- package/dist/events/execution.d.ts +1 -1
- package/dist/events/execution.d.ts.map +1 -1
- package/dist/events/index.js +1 -1
- package/dist/events/service.d.ts +2 -2
- package/dist/events/service.d.ts.map +1 -1
- package/dist/execution/agent.js +16 -15
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/primitive.js +16 -15
- package/dist/execution/primitive.js.map +2 -2
- package/dist/execution/request.js +16 -15
- package/dist/execution/request.js.map +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -28
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/changes.d.ts +5 -0
- package/dist/lake-storage/changes.d.ts.map +1 -0
- package/dist/lake-storage/in-memory.d.ts +2 -1
- package/dist/lake-storage/in-memory.d.ts.map +1 -1
- package/dist/lake-storage/index.d.ts +2 -1
- package/dist/lake-storage/index.d.ts.map +1 -1
- package/dist/lake-storage/index.js +4 -2
- package/dist/lake-storage/index.js.map +1 -1
- package/dist/lake-storage/types.d.ts +36 -0
- package/dist/lake-storage/types.d.ts.map +1 -1
- package/dist/logging/internal.js +1 -1
- package/dist/materialization/index.d.ts +1 -1
- package/dist/materialization/index.d.ts.map +1 -1
- package/dist/materialization/model.d.ts +12 -1
- package/dist/materialization/model.d.ts.map +1 -1
- package/dist/materializer/index.d.ts +1 -1
- package/dist/materializer/index.d.ts.map +1 -1
- package/dist/materializer/index.js +5 -5
- package/dist/materializer/materializer.d.ts +5 -1
- package/dist/materializer/materializer.d.ts.map +1 -1
- package/dist/materializer/projections/entry-validator.d.ts +2 -1
- package/dist/materializer/projections/entry-validator.d.ts.map +1 -1
- package/dist/materializer/projections/replace.d.ts.map +1 -1
- package/dist/materializer/projections/source-materialization.d.ts +4 -3
- package/dist/materializer/projections/source-materialization.d.ts.map +1 -1
- package/dist/materializer/shared/normalize.d.ts +2 -1
- package/dist/materializer/shared/normalize.d.ts.map +1 -1
- package/dist/models/execution/index.js +5 -5
- package/dist/objects/index.js +9 -9
- package/dist/objects/query/index.js +5 -5
- package/dist/pipelines/index.js +6 -6
- package/dist/pipelines/run-dispatch.d.ts.map +1 -1
- package/dist/projections/internal.js +6 -8
- package/dist/projections/internal.js.map +1 -1
- package/dist/projections/run-dispatch.d.ts.map +1 -1
- package/dist/queues/in-memory.d.ts +7 -3
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/queues/index.js +1 -1
- package/dist/queues/indexed-heap.d.ts +15 -0
- package/dist/queues/indexed-heap.d.ts.map +1 -0
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/internal.js +1 -1
- package/dist/runtime/ontology-mutations.d.ts +3 -1
- package/dist/runtime/ontology-mutations.d.ts.map +1 -1
- package/dist/shares/internal.js +4 -4
- package/dist/storage/connector-connections/in-memory.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider/runs.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider.js +2 -2
- package/dist/storage/connector-connections/provider.js.map +3 -3
- package/dist/storage/connector-connections/types.d.ts +3 -2
- package/dist/storage/connector-connections/types.d.ts.map +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +4 -4
- package/dist/storage/internal.js +1 -1
- package/dist/storage/ontology/in-memory/materializations-state.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts +1 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/shared-state.d.ts +15 -2
- package/dist/storage/ontology/in-memory/shared-state.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/source-roots.d.ts +6 -0
- package/dist/storage/ontology/in-memory/source-roots.d.ts.map +1 -0
- package/dist/storage/ontology/in-memory/sources.d.ts.map +1 -1
- package/dist/storage/ontology/index.d.ts +1 -1
- package/dist/storage/ontology/index.d.ts.map +1 -1
- package/dist/storage/ontology/provider.d.ts +16 -0
- package/dist/storage/ontology/provider.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +4 -2
- package/dist/storage/ontology/provider.js.map +1 -1
- package/dist/storage/ontology/sources.d.ts +13 -4
- package/dist/storage/ontology/sources.d.ts.map +1 -1
- package/dist/storage/projection-runs/lifecycle.d.ts.map +1 -1
- package/dist/storage/projection-runs/provider.js +2 -2
- package/dist/storage/projection-runs/types.d.ts +2 -0
- package/dist/storage/projection-runs/types.d.ts.map +1 -1
- package/dist/syncs/index.js +8 -7
- package/dist/syncs/index.js.map +1 -1
- package/dist/syncs/run-dispatch.d.ts.map +1 -1
- package/dist/testing/broker-contract.d.ts.map +1 -1
- package/dist/testing/connector-connection-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 +1459 -951
- package/dist/testing/index.js.map +9 -8
- package/dist/testing/lake-changes-contract.d.ts +6 -0
- package/dist/testing/lake-changes-contract.d.ts.map +1 -0
- package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
- package/dist/testing/ontology-storage-contract.d.ts.map +1 -1
- package/dist/testing/projection-run-storage-contract.d.ts.map +1 -1
- package/dist/webhooks/connections.d.ts +6 -0
- package/dist/webhooks/connections.d.ts.map +1 -0
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.d.ts.map +1 -1
- package/dist/webhooks/internal.d.ts +2 -0
- package/dist/webhooks/internal.d.ts.map +1 -1
- package/dist/webhooks/internal.js +54 -9
- package/dist/webhooks/internal.js.map +4 -3
- package/dist/webhooks/registry.d.ts +1 -1
- package/dist/webhooks/registry.d.ts.map +1 -1
- package/dist/webhooks/types.d.ts +15 -4
- package/dist/webhooks/types.d.ts.map +1 -1
- package/dist/workflows/index.js +17 -16
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/run-dispatch.d.ts +3 -1
- package/dist/workflows/run-dispatch.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/broker/in-memory.ts +104 -39
- package/src/broker/index.ts +4 -1
- package/src/broker/retention.ts +28 -0
- package/src/broker/subscriber.ts +21 -0
- package/src/broker/types.ts +15 -1
- package/src/connectors/builders.ts +0 -6
- package/src/connectors/connections/authorizations.ts +11 -5
- package/src/connectors/connections/contracts.ts +3 -0
- package/src/connectors/connections/request.ts +56 -22
- package/src/connectors/connections/runs.ts +1 -0
- package/src/connectors/connections/tokens.ts +4 -0
- package/src/connectors/connections/validation.ts +91 -5
- package/src/connectors/types.ts +19 -4
- package/src/events/execution.ts +2 -2
- package/src/events/service.ts +3 -3
- package/src/index.ts +10 -2
- package/src/lake-storage/changes.ts +43 -0
- package/src/lake-storage/in-memory.ts +73 -0
- package/src/lake-storage/index.ts +4 -0
- package/src/lake-storage/types.ts +40 -0
- package/src/logging/service.ts +1 -1
- package/src/materialization/index.ts +2 -0
- package/src/materialization/model.ts +14 -1
- package/src/materializer/index.ts +2 -0
- package/src/materializer/materializer.ts +10 -0
- package/src/materializer/projections/entry-validator.ts +19 -1
- package/src/materializer/projections/replace.ts +36 -1
- package/src/materializer/projections/source-materialization.ts +26 -6
- package/src/materializer/shared/normalize.ts +1 -1
- package/src/pipelines/run-dispatch.ts +21 -1
- package/src/projections/run-dispatch.ts +30 -68
- package/src/queues/in-memory.ts +105 -62
- package/src/queues/indexed-heap.ts +74 -0
- package/src/runtime/host.ts +0 -14
- package/src/runtime/ontology-mutations.ts +4 -0
- package/src/storage/connector-connections/in-memory.ts +3 -1
- package/src/storage/connector-connections/provider/runs.ts +3 -1
- package/src/storage/connector-connections/types.ts +3 -2
- package/src/storage/index.ts +1 -0
- package/src/storage/ontology/in-memory/materializations-state.ts +5 -18
- package/src/storage/ontology/in-memory/materializations.ts +73 -92
- package/src/storage/ontology/in-memory/shared-state.ts +26 -1
- package/src/storage/ontology/in-memory/source-roots.ts +123 -0
- package/src/storage/ontology/in-memory/sources.ts +78 -23
- package/src/storage/ontology/index.ts +1 -0
- package/src/storage/ontology/provider.ts +70 -0
- package/src/storage/ontology/sources.ts +14 -3
- package/src/storage/projection-runs/lifecycle.ts +5 -2
- package/src/storage/projection-runs/types.ts +4 -3
- package/src/syncs/run-dispatch.ts +19 -1
- package/src/testing/broker-contract.ts +95 -0
- package/src/testing/connector-connection-storage-contract.ts +18 -1
- package/src/testing/index.ts +1 -0
- package/src/testing/lake-changes-contract.ts +240 -0
- package/src/testing/materializer-storage-contract.ts +172 -1
- package/src/testing/ontology-storage-contract.ts +7 -0
- package/src/testing/projection-run-storage-contract.ts +34 -0
- package/src/webhooks/connections.ts +56 -0
- package/src/webhooks/index.ts +2 -0
- package/src/webhooks/internal.ts +2 -0
- package/src/webhooks/registry.ts +3 -4
- package/src/webhooks/types.ts +17 -4
- package/src/workflows/run-dispatch.ts +42 -29
- package/dist/chunk-0rdrecsb.js.map +0 -11
- package/dist/chunk-3f7veca0.js.map +0 -10
- package/dist/chunk-3frsnm7x.js.map +0 -11
- package/dist/chunk-52hbv0ak.js.map +0 -36
- package/dist/chunk-emyyk7dx.js.map +0 -14
- package/dist/chunk-jjy0fhrn.js.map +0 -12
- package/dist/chunk-k3cqkkn2.js.map +0 -12
- package/dist/chunk-ppytyr6w.js.map +0 -12
- package/dist/chunk-qhcpj9wc.js.map +0 -14
- package/dist/chunk-r29fxdhn.js.map +0 -11
- package/dist/chunk-zcnq6105.js.map +0 -10
- /package/dist/{chunk-h1gfhhbh.js.map → chunk-28ja2cjs.js.map} +0 -0
- /package/dist/{chunk-1enhpacz.js.map → chunk-976rxdpx.js.map} +0 -0
- /package/dist/{chunk-r4tfx1sf.js.map → chunk-agbbygvh.js.map} +0 -0
- /package/dist/{chunk-0w35wavj.js.map → chunk-g7knyczr.js.map} +0 -0
- /package/dist/{chunk-ypbtykv6.js.map → chunk-nmbxcaqx.js.map} +0 -0
- /package/dist/{chunk-vf691g1r.js.map → chunk-p5vcsw9c.js.map} +0 -0
- /package/dist/{chunk-xyr8kppc.js.map → chunk-rtk71jzp.js.map} +0 -0
- /package/dist/{chunk-m3z3x9v0.js.map → chunk-t1f4f1ve.js.map} +0 -0
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
ProjectionRegistry2,
|
|
7
7
|
createOntologyMaterializer2
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ftv470j8.js";
|
|
9
9
|
import {
|
|
10
10
|
captureSixbFailure2,
|
|
11
11
|
isSixbError2
|
|
@@ -31,24 +31,24 @@ import {
|
|
|
31
31
|
import {
|
|
32
32
|
isMigrationCapableStorage2,
|
|
33
33
|
checkStorageSchema2
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-p6a4npdx.js";
|
|
35
35
|
import {
|
|
36
36
|
createAuthorizedObjectReader
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-nmbxcaqx.js";
|
|
38
38
|
import {
|
|
39
39
|
attachSixbErrorReporter2,
|
|
40
40
|
shareSixbErrorReporter2
|
|
41
41
|
} from "./chunk-7apz6hg4.js";
|
|
42
42
|
import {
|
|
43
43
|
ActionRegistry2
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-p5vcsw9c.js";
|
|
45
45
|
import {
|
|
46
46
|
assertDatasetDefinition2
|
|
47
47
|
} from "./chunk-860dwwy0.js";
|
|
48
48
|
import {
|
|
49
49
|
OntologyOutboxDispatcher2,
|
|
50
50
|
createDomainEventService2
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-nt99sxd6.js";
|
|
52
52
|
import {
|
|
53
53
|
validateSchedulesAtStartup2
|
|
54
54
|
} from "./chunk-e1c18xjx.js";
|
|
@@ -62,9 +62,8 @@ import {
|
|
|
62
62
|
providerBoundaryError,
|
|
63
63
|
isConnectorStorageError,
|
|
64
64
|
storageBoundaryError,
|
|
65
|
-
recoverConnectorFailure
|
|
66
|
-
|
|
67
|
-
} from "./chunk-emyyk7dx.js";
|
|
65
|
+
recoverConnectorFailure
|
|
66
|
+
} from "./chunk-v2vcg0w6.js";
|
|
68
67
|
import {
|
|
69
68
|
toolsFromProjectConfig
|
|
70
69
|
} from "./chunk-skz0hst3.js";
|
|
@@ -73,14 +72,14 @@ import {
|
|
|
73
72
|
validateWorkflowsAtStartup2,
|
|
74
73
|
validateWorkflowAgentStepGroupReferences2,
|
|
75
74
|
createBoundSixb
|
|
76
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-5p1v802y.js";
|
|
77
76
|
import {
|
|
78
77
|
registerConnectorConnectionCallbackProcess
|
|
79
78
|
} from "./chunk-5a4a52tq.js";
|
|
80
79
|
import {
|
|
81
80
|
registerOntologyMutationRuntime2,
|
|
82
81
|
createOntologyMutationRuntime2
|
|
83
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-85cd7e8c.js";
|
|
84
83
|
import {
|
|
85
84
|
SchedulerRuntime2
|
|
86
85
|
} from "./chunk-z5rnrmz1.js";
|
|
@@ -89,17 +88,19 @@ import {
|
|
|
89
88
|
validateSharesAtStartup,
|
|
90
89
|
discoverOntologySources2,
|
|
91
90
|
discoverProjectDefinitions2
|
|
92
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-agbbygvh.js";
|
|
93
92
|
import {
|
|
94
93
|
LoggingService2
|
|
95
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-3qms4nax.js";
|
|
96
95
|
import {
|
|
97
96
|
registerProjectionRegistry2
|
|
98
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-1824gssz.js";
|
|
98
|
+
import {
|
|
99
|
+
SyncValidationError2
|
|
100
|
+
} from "./chunk-5c7ga8zz.js";
|
|
99
101
|
import {
|
|
100
|
-
isOAuthConnectorDefinition2
|
|
101
|
-
|
|
102
|
-
} from "./chunk-3f7veca0.js";
|
|
102
|
+
isOAuthConnectorDefinition2
|
|
103
|
+
} from "./chunk-9x8dybsb.js";
|
|
103
104
|
import {
|
|
104
105
|
ensureExecutionRecord2
|
|
105
106
|
} from "./chunk-17kfctj6.js";
|
|
@@ -110,6 +111,9 @@ import {
|
|
|
110
111
|
import {
|
|
111
112
|
reportEventDeliveryFailure3
|
|
112
113
|
} from "./chunk-72w2pxk7.js";
|
|
114
|
+
import {
|
|
115
|
+
isJsonObject2
|
|
116
|
+
} from "./chunk-wy0qdqfm.js";
|
|
113
117
|
// src/webhooks/errors.ts
|
|
114
118
|
class WebhookValidationError2 extends Error {
|
|
115
119
|
name = "WebhookValidationError";
|
|
@@ -245,8 +249,6 @@ class WebhookRegistry {
|
|
|
245
249
|
constructor(options) {
|
|
246
250
|
const registered = [];
|
|
247
251
|
for (const connector of options.connectors) {
|
|
248
|
-
if (!isStaticConnectorDefinition(connector))
|
|
249
|
-
continue;
|
|
250
252
|
const webhooks = connector.adapter.webhooks ?? [];
|
|
251
253
|
if (!Array.isArray(webhooks)) {
|
|
252
254
|
throw new WebhookValidationError2(`[Sixb] Connector '${connector.id}' webhooks must be an array when provided.`);
|
|
@@ -467,6 +469,12 @@ function validateCredentials(credentials) {
|
|
|
467
469
|
}
|
|
468
470
|
normalized.expiresAt = new Date(credentials.expiresAt);
|
|
469
471
|
}
|
|
472
|
+
if (credentials.authorizationContext !== undefined) {
|
|
473
|
+
if (!isJsonObject2(credentials.authorizationContext)) {
|
|
474
|
+
throw createConnectorCodedError("connector.adapter_invalid", "OAuth connector adapter returned invalid authorization context; expected a JSON object.");
|
|
475
|
+
}
|
|
476
|
+
normalized.authorizationContext = structuredClone(credentials.authorizationContext);
|
|
477
|
+
}
|
|
470
478
|
return normalized;
|
|
471
479
|
}
|
|
472
480
|
function validateAccounts(accounts) {
|
|
@@ -500,7 +508,8 @@ function serializeCredentials(credentials) {
|
|
|
500
508
|
...credentials.refreshToken === undefined ? {} : { refreshToken: credentials.refreshToken },
|
|
501
509
|
...credentials.tokenType === undefined ? {} : { tokenType: credentials.tokenType },
|
|
502
510
|
...credentials.scopes === undefined ? {} : { scopes: credentials.scopes },
|
|
503
|
-
...credentials.expiresAt === undefined ? {} : { expiresAt: credentials.expiresAt.toISOString() }
|
|
511
|
+
...credentials.expiresAt === undefined ? {} : { expiresAt: credentials.expiresAt.toISOString() },
|
|
512
|
+
...credentials.authorizationContext === undefined ? {} : { authorizationContext: credentials.authorizationContext }
|
|
504
513
|
});
|
|
505
514
|
}
|
|
506
515
|
function parseCredentials(serialized) {
|
|
@@ -513,7 +522,7 @@ function parseCredentials(serialized) {
|
|
|
513
522
|
if (!isRecord2(value) || value.version !== 1 || typeof value.accessToken !== "string") {
|
|
514
523
|
throw createConnectorCodedError("connector.credentials_unavailable", "Stored connector credentials are invalid.");
|
|
515
524
|
}
|
|
516
|
-
if (value.refreshToken !== undefined && typeof value.refreshToken !== "string" || value.tokenType !== undefined && typeof value.tokenType !== "string" || value.scopes !== undefined && (!Array.isArray(value.scopes) || value.scopes.some((scope) => typeof scope !== "string")) || value.expiresAt !== undefined && typeof value.expiresAt !== "string") {
|
|
525
|
+
if (value.refreshToken !== undefined && typeof value.refreshToken !== "string" || value.tokenType !== undefined && typeof value.tokenType !== "string" || value.scopes !== undefined && (!Array.isArray(value.scopes) || value.scopes.some((scope) => typeof scope !== "string")) || value.expiresAt !== undefined && typeof value.expiresAt !== "string" || value.authorizationContext !== undefined && !isJsonObject2(value.authorizationContext)) {
|
|
517
526
|
throw createConnectorCodedError("connector.credentials_unavailable", "Stored connector credentials are invalid.");
|
|
518
527
|
}
|
|
519
528
|
const expiresAt = value.expiresAt === undefined ? undefined : new Date(value.expiresAt);
|
|
@@ -523,7 +532,8 @@ function parseCredentials(serialized) {
|
|
|
523
532
|
...value.refreshToken === undefined ? {} : { refreshToken: value.refreshToken },
|
|
524
533
|
...value.tokenType === undefined ? {} : { tokenType: value.tokenType },
|
|
525
534
|
...value.scopes === undefined ? {} : { scopes: value.scopes },
|
|
526
|
-
...expiresAt === undefined ? {} : { expiresAt }
|
|
535
|
+
...expiresAt === undefined ? {} : { expiresAt },
|
|
536
|
+
...value.authorizationContext === undefined ? {} : { authorizationContext: value.authorizationContext }
|
|
527
537
|
});
|
|
528
538
|
} catch (error) {
|
|
529
539
|
throw createConnectorCodedError("connector.credentials_unavailable", "Stored connector credentials are invalid.", { cause: error });
|
|
@@ -567,9 +577,44 @@ function normalizedHttpUrl(value, field, code = "connector.configuration_invalid
|
|
|
567
577
|
}
|
|
568
578
|
function assertAuthorizationUrlParameters(authorizationUrl, expected) {
|
|
569
579
|
const parameters = new URL(authorizationUrl).searchParams;
|
|
570
|
-
if (!sameSingleParameter(parameters, "state", expected.state) || !sameSingleParameter(parameters, "code_challenge", expected.codeChallenge) || !sameSingleParameter(parameters, "code_challenge_method", "S256")) {
|
|
571
|
-
throw createConnectorCodedError("connector.adapter_invalid", "OAuth connector authorization URL must preserve the framework-provided state and PKCE S256 parameters.");
|
|
572
|
-
}
|
|
580
|
+
if (!sameSingleParameter(parameters, "state", expected.state) || (expected.codeChallenge === undefined ? parameters.has("code_challenge") || parameters.has("code_challenge_method") : !sameSingleParameter(parameters, "code_challenge", expected.codeChallenge) || !sameSingleParameter(parameters, "code_challenge_method", "S256"))) {
|
|
581
|
+
throw createConnectorCodedError("connector.adapter_invalid", expected.codeChallenge === undefined ? "OAuth connector authorization URL must preserve the framework-provided state and omit disabled PKCE parameters." : "OAuth connector authorization URL must preserve the framework-provided state and PKCE S256 parameters.");
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
function connectorPkceEnabled(pkce) {
|
|
585
|
+
if (pkce === undefined || pkce === "S256")
|
|
586
|
+
return true;
|
|
587
|
+
if (pkce === "disabled")
|
|
588
|
+
return false;
|
|
589
|
+
throw createConnectorCodedError("connector.adapter_invalid", "OAuth connector PKCE must be S256 or disabled.");
|
|
590
|
+
}
|
|
591
|
+
var reservedCallbackParameters = new Set([
|
|
592
|
+
"state",
|
|
593
|
+
"code",
|
|
594
|
+
"auth_code",
|
|
595
|
+
"error",
|
|
596
|
+
"error_description",
|
|
597
|
+
"error_uri"
|
|
598
|
+
]);
|
|
599
|
+
function validateCallbackParameterNames(names = []) {
|
|
600
|
+
if (!Array.isArray(names) || names.some((name) => typeof name !== "string" || !/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(name) || reservedCallbackParameters.has(name)) || new Set(names).size !== names.length) {
|
|
601
|
+
throw createConnectorCodedError("connector.adapter_invalid", "OAuth callback parameter names must be unique, non-reserved parameter names.");
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
function selectCallbackParameters(names = [], parameters = {}) {
|
|
605
|
+
validateCallbackParameterNames(names);
|
|
606
|
+
if (!isRecord2(parameters)) {
|
|
607
|
+
throw createConnectorCodedError("connector.authorization_invalid", "OAuth provider callback parameters must be an object.");
|
|
608
|
+
}
|
|
609
|
+
return Object.fromEntries(names.flatMap((name) => {
|
|
610
|
+
if (!Object.hasOwn(parameters, name))
|
|
611
|
+
return [];
|
|
612
|
+
const value = parameters[name];
|
|
613
|
+
if (typeof value !== "string") {
|
|
614
|
+
throw createConnectorCodedError("connector.authorization_invalid", "OAuth provider callback parameters must have a single string value.");
|
|
615
|
+
}
|
|
616
|
+
return [[name, value]];
|
|
617
|
+
}));
|
|
573
618
|
}
|
|
574
619
|
function nonblank(value, field, code = "connector.configuration_invalid") {
|
|
575
620
|
if (typeof value !== "string" || !value.trim()) {
|
|
@@ -1069,7 +1114,8 @@ class ConnectorTokenAccess {
|
|
|
1069
1114
|
...refreshed,
|
|
1070
1115
|
...refreshed.refreshToken === undefined ? { refreshToken: current.refreshToken } : {},
|
|
1071
1116
|
...refreshed.tokenType === undefined && current.tokenType !== undefined ? { tokenType: current.tokenType } : {},
|
|
1072
|
-
scopes: refreshed.scopes ?? current.scopes ?? authorization.scopes
|
|
1117
|
+
scopes: refreshed.scopes ?? current.scopes ?? authorization.scopes,
|
|
1118
|
+
...refreshed.authorizationContext === undefined && current.authorizationContext !== undefined ? { authorizationContext: current.authorizationContext } : {}
|
|
1073
1119
|
};
|
|
1074
1120
|
const envelope = await this.credentials.seal(definition.id, authorization.id, normalized);
|
|
1075
1121
|
return this.mutations.stageCredentialMutationCredentials(executing, signal, {
|
|
@@ -1200,7 +1246,7 @@ class DefaultConnectorAuthorizationLifecycle {
|
|
|
1200
1246
|
async completeNewAuthorization(input) {
|
|
1201
1247
|
this.assertRegistered(input.definition);
|
|
1202
1248
|
const authorizationId = `cau_${randomUUID2()}`;
|
|
1203
|
-
const credentials = await this.exchangeAuthorizationCode(input.definition, input.code, input.codeVerifier, input.redirectUri);
|
|
1249
|
+
const credentials = await this.exchangeAuthorizationCode(input.definition, input.code, input.codeVerifier, input.redirectUri, input.callbackParameters);
|
|
1204
1250
|
const credentialsEnvelope = await this.credentials.seal(input.definition.id, authorizationId, credentials);
|
|
1205
1251
|
let pending;
|
|
1206
1252
|
try {
|
|
@@ -1358,7 +1404,11 @@ class DefaultConnectorAuthorizationLifecycle {
|
|
|
1358
1404
|
const { claim } = claimOutcome;
|
|
1359
1405
|
try {
|
|
1360
1406
|
await this.mutations.executeCredentialMutation(claim.authorization, async (executing, signal) => {
|
|
1361
|
-
const credentials = validateCredentials(await input.definition.adapter.authentication.exchangeCode(this.authorizationAdapterContext(input.definition.id, input.redirectUri, signal), {
|
|
1407
|
+
const credentials = validateCredentials(await input.definition.adapter.authentication.exchangeCode(this.authorizationAdapterContext(input.definition.id, input.redirectUri, signal), {
|
|
1408
|
+
code: input.code,
|
|
1409
|
+
...input.codeVerifier === undefined ? {} : { codeVerifier: input.codeVerifier },
|
|
1410
|
+
callbackParameters: input.callbackParameters
|
|
1411
|
+
}));
|
|
1362
1412
|
assertCredentialMutationOperationActive(signal);
|
|
1363
1413
|
const envelope = await this.credentials.seal(input.definition.id, input.authorizationId, credentials);
|
|
1364
1414
|
return this.mutations.stageCredentialMutationCredentials(executing, signal, {
|
|
@@ -1382,9 +1432,9 @@ class DefaultConnectorAuthorizationLifecycle {
|
|
|
1382
1432
|
const staged = await this.requireAuthorization(input.definition.id, input.authorizationId);
|
|
1383
1433
|
return this.mutations.finalizeStagedMutation(staged);
|
|
1384
1434
|
}
|
|
1385
|
-
async exchangeAuthorizationCode(definition, code, codeVerifier, redirectUri) {
|
|
1435
|
+
async exchangeAuthorizationCode(definition, code, codeVerifier, redirectUri, callbackParameters) {
|
|
1386
1436
|
try {
|
|
1387
|
-
return validateCredentials(await this.mutations.withBoundedProviderSignal((signal) => definition.adapter.authentication.exchangeCode(this.authorizationAdapterContext(definition.id, redirectUri, signal), { code, codeVerifier })));
|
|
1437
|
+
return validateCredentials(await this.mutations.withBoundedProviderSignal((signal) => definition.adapter.authentication.exchangeCode(this.authorizationAdapterContext(definition.id, redirectUri, signal), { code, ...codeVerifier === undefined ? {} : { codeVerifier }, callbackParameters })));
|
|
1388
1438
|
} catch (error) {
|
|
1389
1439
|
throw providerBoundaryError(error, "connector.provider_failed", "Connector authorization code exchange failed.");
|
|
1390
1440
|
}
|
|
@@ -1518,12 +1568,13 @@ class ConnectorAuthorizationRequestHandler {
|
|
|
1518
1568
|
const definition = this.resolveDefinition(nonblank(connectorId, "connector id"));
|
|
1519
1569
|
const actor = requireConnectorConnectionCommandActor(command.execution, this.projectId);
|
|
1520
1570
|
assertConnectorConnectionSelector(input);
|
|
1571
|
+
validateCallbackParameterNames(definition.adapter.authentication.callbackParameters);
|
|
1521
1572
|
const redirectUri = normalizedHttpUrl(input.redirectUri, "OAuth callback URL");
|
|
1522
1573
|
const reauthorization = await this.prepareReauthorization(definition, actor, input.reauthorizationId);
|
|
1523
1574
|
const attemptId = `cat_${randomUUID3()}`;
|
|
1524
1575
|
const state = `${attemptId}.${randomBytes2(32).toString("base64url")}`;
|
|
1525
|
-
const codeVerifier = randomBytes2(32).toString("base64url");
|
|
1526
|
-
const codeChallenge = createHash2("sha256").update(codeVerifier).digest("base64url");
|
|
1576
|
+
const codeVerifier = connectorPkceEnabled(definition.adapter.authentication.pkce) ? randomBytes2(32).toString("base64url") : undefined;
|
|
1577
|
+
const codeChallenge = codeVerifier === undefined ? undefined : createHash2("sha256").update(codeVerifier).digest("base64url");
|
|
1527
1578
|
let authorizationUrlInput;
|
|
1528
1579
|
try {
|
|
1529
1580
|
authorizationUrlInput = await runBoundedConnectorProviderOperation({
|
|
@@ -1534,13 +1585,16 @@ class ConnectorAuthorizationRequestHandler {
|
|
|
1534
1585
|
connectorId: definition.id,
|
|
1535
1586
|
redirectUri,
|
|
1536
1587
|
signal
|
|
1537
|
-
}, {
|
|
1588
|
+
}, {
|
|
1589
|
+
state,
|
|
1590
|
+
...codeChallenge === undefined ? {} : { codeChallenge, codeChallengeMethod: "S256" }
|
|
1591
|
+
}), () => createConnectorCodedError("connector.provider_unavailable", "Connector authorization URL generation did not complete."));
|
|
1538
1592
|
} catch (error) {
|
|
1539
1593
|
throw providerBoundaryError(error, providerFailureCode(error), "Connector authorization could not be started.");
|
|
1540
1594
|
}
|
|
1541
1595
|
const authorizationUrl = normalizedHttpUrl(authorizationUrlInput, "provider authorization URL", "connector.adapter_invalid");
|
|
1542
1596
|
assertAuthorizationUrlParameters(authorizationUrl, { state, codeChallenge });
|
|
1543
|
-
const codeVerifierEnvelope = await this.credentialProtector.seal(textEncoder2.encode(codeVerifier), {
|
|
1597
|
+
const codeVerifierEnvelope = codeVerifier === undefined ? undefined : await this.credentialProtector.seal(textEncoder2.encode(codeVerifier), {
|
|
1544
1598
|
projectId: this.projectId,
|
|
1545
1599
|
connectorId: definition.id,
|
|
1546
1600
|
recordId: attemptId,
|
|
@@ -1559,7 +1613,7 @@ class ConnectorAuthorizationRequestHandler {
|
|
|
1559
1613
|
slot: input.slot,
|
|
1560
1614
|
initiatedByExecutionId: command.execution.id,
|
|
1561
1615
|
stateHash: hashSecret(state),
|
|
1562
|
-
codeVerifier: codeVerifierEnvelope,
|
|
1616
|
+
...codeVerifierEnvelope === undefined ? {} : { codeVerifier: codeVerifierEnvelope },
|
|
1563
1617
|
redirectUri,
|
|
1564
1618
|
...reauthorization === undefined ? {} : {
|
|
1565
1619
|
reauthorizationId: reauthorization.authorization.id,
|
|
@@ -1583,7 +1637,8 @@ class ConnectorAuthorizationRequestHandler {
|
|
|
1583
1637
|
attempt,
|
|
1584
1638
|
principal: actor.principal,
|
|
1585
1639
|
code,
|
|
1586
|
-
redirectUri
|
|
1640
|
+
redirectUri,
|
|
1641
|
+
callbackParameters: input.callbackParameters
|
|
1587
1642
|
});
|
|
1588
1643
|
return {
|
|
1589
1644
|
authorizationId: completed.id,
|
|
@@ -1593,7 +1648,11 @@ class ConnectorAuthorizationRequestHandler {
|
|
|
1593
1648
|
};
|
|
1594
1649
|
}
|
|
1595
1650
|
async completeAuthorizationAttempt(input) {
|
|
1596
|
-
const
|
|
1651
|
+
const enabled = connectorPkceEnabled(input.definition.adapter.authentication.pkce);
|
|
1652
|
+
if (enabled !== (input.attempt.codeVerifier !== undefined)) {
|
|
1653
|
+
throw createConnectorCodedError("connector.authorization_invalid", "OAuth connector PKCE configuration changed; restart authorization.");
|
|
1654
|
+
}
|
|
1655
|
+
const verifierBytes = input.attempt.codeVerifier === undefined ? undefined : await this.credentialProtector.open(input.attempt.codeVerifier, {
|
|
1597
1656
|
projectId: this.projectId,
|
|
1598
1657
|
connectorId: input.definition.id,
|
|
1599
1658
|
recordId: input.attempt.id,
|
|
@@ -1601,7 +1660,8 @@ class ConnectorAuthorizationRequestHandler {
|
|
|
1601
1660
|
});
|
|
1602
1661
|
return this.completeGrant({
|
|
1603
1662
|
...input,
|
|
1604
|
-
|
|
1663
|
+
callbackParameters: selectCallbackParameters(input.definition.adapter.authentication.callbackParameters, input.callbackParameters),
|
|
1664
|
+
...verifierBytes === undefined ? {} : { codeVerifier: textDecoder2.decode(verifierBytes) }
|
|
1605
1665
|
});
|
|
1606
1666
|
}
|
|
1607
1667
|
async prepareReauthorization(definition, actor, reauthorizationId) {
|
|
@@ -1664,6 +1724,7 @@ class ConnectorAuthorizationRequestHandler {
|
|
|
1664
1724
|
principal: input.principal,
|
|
1665
1725
|
code: input.code,
|
|
1666
1726
|
codeVerifier: input.codeVerifier,
|
|
1727
|
+
callbackParameters: input.callbackParameters,
|
|
1667
1728
|
redirectUri: input.redirectUri,
|
|
1668
1729
|
...input.onAuthorizationPersisted === undefined ? {} : { onAuthorizationPersisted: input.onAuthorizationPersisted }
|
|
1669
1730
|
});
|
|
@@ -1680,6 +1741,7 @@ class ConnectorAuthorizationRequestHandler {
|
|
|
1680
1741
|
principal: input.principal,
|
|
1681
1742
|
code: input.code,
|
|
1682
1743
|
codeVerifier: input.codeVerifier,
|
|
1744
|
+
callbackParameters: input.callbackParameters,
|
|
1683
1745
|
redirectUri: input.redirectUri
|
|
1684
1746
|
});
|
|
1685
1747
|
}
|
|
@@ -1808,6 +1870,7 @@ class ConnectorConnectionRunService {
|
|
|
1808
1870
|
attempt,
|
|
1809
1871
|
principal,
|
|
1810
1872
|
code: nonblank(input.code, "OAuth authorization code", "connector.authorization_invalid"),
|
|
1873
|
+
callbackParameters: input.callbackParameters,
|
|
1811
1874
|
redirectUri,
|
|
1812
1875
|
onAuthorizationPersisted: async (persisted) => {
|
|
1813
1876
|
authorizationId = persisted.id;
|
|
@@ -3138,7 +3201,6 @@ class SixbHost2 {
|
|
|
3138
3201
|
});
|
|
3139
3202
|
validateAuthStrategySecurityReferences(this.auth.getStrategy(), definitions.security);
|
|
3140
3203
|
const connectors = definitions.connectors.list();
|
|
3141
|
-
assertConnectorConnectionSurfaces(connectors);
|
|
3142
3204
|
const hasOAuthConnectors = connectors.some(isOAuthConnectorDefinition2);
|
|
3143
3205
|
const credentialProtector = hasOAuthConnectors && options.connectorConnections?.encryptionKey !== undefined ? createConnectorCredentialProtectorFromKey(options.connectorConnections.encryptionKey) : undefined;
|
|
3144
3206
|
this.connectorService = new ConnectorService(this.projectId, connectors, {
|
|
@@ -3275,15 +3337,6 @@ function assertWebhookRunStorage(connectors, storage) {
|
|
|
3275
3337
|
}
|
|
3276
3338
|
}
|
|
3277
3339
|
}
|
|
3278
|
-
function assertConnectorConnectionSurfaces(connectors) {
|
|
3279
|
-
for (const connector of connectors) {
|
|
3280
|
-
if (!isOAuthConnectorDefinition2(connector))
|
|
3281
|
-
continue;
|
|
3282
|
-
if (connector.adapter.webhooks !== undefined) {
|
|
3283
|
-
throw createConnectorCodedError("connector.configuration_invalid", `OAuth connector '${connector.id}' cannot register webhooks until connection routing is defined.`);
|
|
3284
|
-
}
|
|
3285
|
-
}
|
|
3286
|
-
}
|
|
3287
3340
|
|
|
3288
3341
|
// src/runtime/create.ts
|
|
3289
3342
|
async function createSixb2(options) {
|
|
@@ -3330,4 +3383,4 @@ async function createSixb2(options) {
|
|
|
3330
3383
|
}
|
|
3331
3384
|
export { WebhookValidationError2, defineWebhook2, webhookConnector2, UnverifiedWebhookError2, resolveWebhookVerification2, warnUnverifiedWebhook2, SixbHost2, createSixb2 };
|
|
3332
3385
|
|
|
3333
|
-
//# debugId=
|
|
3386
|
+
//# debugId=4CB6C5C3405BADC164756E2164756E21
|