@sixb/core 0.1.13 → 0.1.15
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 +22 -22
- package/dist/agents/index.js +34 -34
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/streams/index.js +2 -2
- package/dist/agents/streams/internal.js +2 -2
- package/dist/auth/errors.d.ts +12 -0
- package/dist/auth/errors.d.ts.map +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +7 -5
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/runtime.d.ts.map +1 -1
- package/dist/auth/strategy.d.ts +2 -0
- package/dist/auth/strategy.d.ts.map +1 -1
- package/dist/auth/strategy.js +4 -2
- package/dist/auth/strategy.js.map +1 -1
- package/dist/auth/types.d.ts +8 -0
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/authorization/index.js +2 -2
- package/dist/bootstrap/index.js +37 -37
- package/dist/{chunk-693f3zn8.js → chunk-1jvq82rp.js} +3 -3
- package/dist/{chunk-0321g649.js → chunk-2jntasmh.js} +13 -2
- package/dist/{chunk-0321g649.js.map → chunk-2jntasmh.js.map} +3 -3
- package/dist/{chunk-cvrbhvtr.js → chunk-2tz5vnvz.js} +28 -28
- package/dist/{chunk-cvrbhvtr.js.map → chunk-2tz5vnvz.js.map} +1 -1
- package/dist/{chunk-898y24dd.js → chunk-3c90jvfj.js} +2 -2
- package/dist/{chunk-vn3yh259.js → chunk-4gmng3vf.js} +1 -1
- package/dist/{chunk-91wthfwe.js → chunk-4jph1t3v.js} +7 -7
- package/dist/{chunk-znw0zvy4.js → chunk-4wn7bxxa.js} +25 -7
- package/dist/chunk-4wn7bxxa.js.map +12 -0
- package/dist/{chunk-3qpcrcj8.js → chunk-6aawea28.js} +2 -4
- package/dist/chunk-6aawea28.js.map +10 -0
- package/dist/{chunk-rzkr70gr.js → chunk-6fsr7y93.js} +5 -1
- package/dist/{chunk-rzkr70gr.js.map → chunk-6fsr7y93.js.map} +3 -3
- package/dist/{chunk-y487ywrv.js → chunk-6q7c68yx.js} +4 -4
- package/dist/{chunk-ypj2wqtj.js → chunk-70jmg2zx.js} +2 -2
- package/dist/{chunk-s24qbp32.js → chunk-7jc21943.js} +3 -3
- package/dist/{chunk-rzcjp5m2.js → chunk-8fjmqjyx.js} +1 -1
- package/dist/{chunk-m8zkvep1.js → chunk-8w27xf9e.js} +1 -1
- package/dist/{chunk-z9h698s8.js → chunk-a4g5yjm0.js} +1 -1
- package/dist/{chunk-gmt22nxx.js → chunk-adbve9zt.js} +1 -1
- package/dist/{chunk-mf6hwpzh.js → chunk-dqkd3kdj.js} +41 -23
- package/dist/{chunk-mf6hwpzh.js.map → chunk-dqkd3kdj.js.map} +3 -3
- package/dist/{chunk-gbcrz0gr.js → chunk-ex8s8wsk.js} +6 -6
- package/dist/{chunk-4tnrzqqh.js → chunk-fj1dvp37.js} +1 -1
- package/dist/{chunk-gc226ten.js → chunk-fjw417jf.js} +127 -69
- package/dist/{chunk-gc226ten.js.map → chunk-fjw417jf.js.map} +4 -4
- package/dist/{chunk-ht4a7mjg.js → chunk-g4rbm4a6.js} +42 -8
- package/dist/{chunk-ht4a7mjg.js.map → chunk-g4rbm4a6.js.map} +3 -3
- package/dist/{chunk-qma80ych.js → chunk-hn2r7z41.js} +3 -2
- package/dist/chunk-hn2r7z41.js.map +11 -0
- package/dist/{chunk-bdhfn0ww.js → chunk-kkqwzy6h.js} +1 -1
- package/dist/{chunk-bep5rrdq.js → chunk-mmac1mp6.js} +2 -2
- package/dist/{chunk-w9bp61e7.js → chunk-n5t4mq6z.js} +5 -5
- package/dist/{chunk-n33e8dz8.js → chunk-p0nbkys4.js} +1 -1
- package/dist/{chunk-04h4t2b5.js → chunk-py2dw8cw.js} +3 -3
- package/dist/{chunk-jhyc777j.js → chunk-q3grgzp1.js} +2 -2
- package/dist/{chunk-9pfw47qx.js → chunk-qne45xqq.js} +53 -48
- package/dist/{chunk-9pfw47qx.js.map → chunk-qne45xqq.js.map} +7 -7
- package/dist/{chunk-cbn96bve.js → chunk-r5sc1d2b.js} +2 -2
- package/dist/{chunk-y6vnvayj.js → chunk-vjcd8d27.js} +1 -1
- package/dist/{chunk-jmwy25mf.js → chunk-wd34wnsy.js} +6 -6
- package/dist/{chunk-63fp9x3q.js → chunk-wem5vqjw.js} +7 -7
- package/dist/{chunk-darm7eeg.js → chunk-xr7y35yj.js} +3 -3
- package/dist/{chunk-a69fkrtr.js → chunk-y0zmae99.js} +5 -5
- package/dist/{chunk-xgptywp0.js → chunk-y2aq6ag9.js} +1 -1
- package/dist/{chunk-2hbhn1ff.js → chunk-yfppyaty.js} +1 -1
- package/dist/{chunk-rqtdtm43.js → chunk-z708gemf.js} +129 -70
- package/dist/{chunk-rqtdtm43.js.map → chunk-z708gemf.js.map} +5 -5
- package/dist/deploy/define.d.ts +4 -0
- package/dist/deploy/define.d.ts.map +1 -0
- package/dist/deploy/index.d.ts +3 -0
- package/dist/deploy/index.d.ts.map +1 -0
- package/dist/deploy/index.js +10 -0
- package/dist/deploy/index.js.map +10 -0
- package/dist/deploy/internal.d.ts +3 -0
- package/dist/deploy/internal.d.ts.map +1 -0
- package/dist/deploy/internal.js +244 -0
- package/dist/deploy/internal.js.map +11 -0
- package/dist/deploy/services.d.ts +8 -0
- package/dist/deploy/services.d.ts.map +1 -0
- package/dist/deploy/types.d.ts +309 -0
- package/dist/deploy/types.d.ts.map +1 -0
- package/dist/deploy/validation.d.ts +7 -0
- package/dist/deploy/validation.d.ts.map +1 -0
- package/dist/error-reporting/internal.js +3 -3
- package/dist/errors/catalog.d.ts +4 -0
- package/dist/errors/catalog.d.ts.map +1 -1
- package/dist/errors/internal.js +1 -1
- package/dist/events/index.js +3 -3
- package/dist/execution/agent.js +33 -33
- package/dist/execution/primitive.js +29 -29
- package/dist/execution/request.js +31 -31
- package/dist/execution/request.js.map +1 -1
- package/dist/index.js +49 -49
- package/dist/index.js.map +1 -1
- package/dist/maintenance/ontology-maintenance.d.ts +2 -0
- package/dist/maintenance/ontology-maintenance.d.ts.map +1 -1
- package/dist/maintenance/types.d.ts +8 -2
- package/dist/maintenance/types.d.ts.map +1 -1
- package/dist/materialization/dataset-watermark.d.ts +6 -1
- package/dist/materialization/dataset-watermark.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 +18 -18
- package/dist/materializer/index.js.map +1 -1
- package/dist/materializer/projections/finish-run.d.ts.map +1 -1
- package/dist/materializer/projections/replace.d.ts.map +1 -1
- package/dist/materializer/projections/source-materialization.d.ts +6 -2
- package/dist/materializer/projections/source-materialization.d.ts.map +1 -1
- package/dist/models/execution/index.js +14 -14
- package/dist/objects/index.js +21 -21
- package/dist/objects/query/index.js +15 -15
- package/dist/pipelines/index.js +19 -19
- package/dist/projections/internal.js +16 -16
- package/dist/projections/types.d.ts +1 -1
- package/dist/projections/types.d.ts.map +1 -1
- package/dist/queues/in-memory.d.ts +1 -1
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/runtime/internal.js +19 -19
- package/dist/shares/internal.js +14 -14
- package/dist/shares/internal.js.map +1 -1
- package/dist/storage/action-runs/failure.js +2 -2
- package/dist/storage/ai-limits/enforcement.js +2 -2
- package/dist/storage/auth/errors.d.ts +1 -1
- package/dist/storage/auth/errors.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/auth-storage.d.ts +2 -1
- package/dist/storage/auth/in-memory/auth-storage.d.ts.map +1 -1
- package/dist/storage/auth/types.d.ts +15 -7
- package/dist/storage/auth/types.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider.js +1 -1
- package/dist/storage/file-upload-sessions/provider.js +5 -5
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +29 -29
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.js +1 -1
- package/dist/storage/ontology/in-memory/sources.d.ts +6 -3
- 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 -3
- package/dist/storage/ontology/provider.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +8 -4
- package/dist/storage/ontology/provider.js.map +1 -1
- package/dist/storage/ontology/sources.d.ts +36 -8
- package/dist/storage/ontology/sources.d.ts.map +1 -1
- package/dist/storage/projection-runs/in-memory.d.ts +3 -1
- package/dist/storage/projection-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/projection-runs/index.d.ts +1 -1
- package/dist/storage/projection-runs/index.d.ts.map +1 -1
- package/dist/storage/projection-runs/lifecycle.d.ts +12 -0
- package/dist/storage/projection-runs/lifecycle.d.ts.map +1 -1
- package/dist/storage/projection-runs/provider.js +10 -4
- package/dist/storage/projection-runs/provider.js.map +1 -1
- package/dist/storage/projection-runs/types.d.ts +32 -1
- package/dist/storage/projection-runs/types.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.js +5 -5
- package/dist/syncs/index.js +20 -20
- package/dist/testing/auth-storage-contract.d.ts.map +1 -1
- package/dist/testing/index.js +381 -171
- package/dist/testing/index.js.map +5 -5
- 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/internal.js +15 -15
- package/dist/webhooks/internal.js.map +1 -1
- package/dist/workers/index.js +1 -1
- package/dist/workflows/index.js +34 -34
- package/package.json +13 -1
- package/src/auth/errors.ts +23 -0
- package/src/auth/index.ts +1 -1
- package/src/auth/runtime.ts +56 -22
- package/src/auth/strategy.ts +2 -0
- package/src/auth/types.ts +8 -0
- package/src/deploy/define.ts +6 -0
- package/src/deploy/index.ts +41 -0
- package/src/deploy/internal.ts +7 -0
- package/src/deploy/services.ts +51 -0
- package/src/deploy/types.ts +338 -0
- package/src/deploy/validation.ts +261 -0
- package/src/errors/catalog.ts +4 -0
- package/src/maintenance/ontology-maintenance.ts +32 -2
- package/src/maintenance/types.ts +8 -2
- package/src/materialization/dataset-watermark.ts +6 -4
- package/src/materialization/model.ts +7 -0
- package/src/materializer/README.md +26 -6
- package/src/materializer/projections/finish-run.ts +129 -26
- package/src/materializer/projections/replace.ts +67 -49
- package/src/materializer/projections/source-materialization.ts +11 -6
- package/src/projections/types.ts +1 -0
- package/src/storage/auth/errors.ts +0 -1
- package/src/storage/auth/in-memory/auth-storage.ts +44 -65
- package/src/storage/auth/types.ts +15 -7
- package/src/storage/index.ts +6 -1
- package/src/storage/ontology/in-memory/sources.ts +119 -55
- package/src/storage/ontology/index.ts +4 -1
- package/src/storage/ontology/provider.ts +64 -7
- package/src/storage/ontology/sources.ts +42 -8
- package/src/storage/projection-runs/in-memory.ts +41 -2
- package/src/storage/projection-runs/index.ts +2 -0
- package/src/storage/projection-runs/lifecycle.ts +61 -4
- package/src/storage/projection-runs/types.ts +41 -1
- package/src/testing/auth-storage-contract.ts +104 -130
- package/src/testing/ontology-storage-contract.ts +141 -15
- package/src/testing/projection-run-storage-contract.ts +174 -1
- package/dist/chunk-3qpcrcj8.js.map +0 -10
- package/dist/chunk-qma80ych.js.map +0 -11
- package/dist/chunk-znw0zvy4.js.map +0 -12
- /package/dist/{chunk-693f3zn8.js.map → chunk-1jvq82rp.js.map} +0 -0
- /package/dist/{chunk-898y24dd.js.map → chunk-3c90jvfj.js.map} +0 -0
- /package/dist/{chunk-vn3yh259.js.map → chunk-4gmng3vf.js.map} +0 -0
- /package/dist/{chunk-91wthfwe.js.map → chunk-4jph1t3v.js.map} +0 -0
- /package/dist/{chunk-y487ywrv.js.map → chunk-6q7c68yx.js.map} +0 -0
- /package/dist/{chunk-ypj2wqtj.js.map → chunk-70jmg2zx.js.map} +0 -0
- /package/dist/{chunk-s24qbp32.js.map → chunk-7jc21943.js.map} +0 -0
- /package/dist/{chunk-rzcjp5m2.js.map → chunk-8fjmqjyx.js.map} +0 -0
- /package/dist/{chunk-m8zkvep1.js.map → chunk-8w27xf9e.js.map} +0 -0
- /package/dist/{chunk-z9h698s8.js.map → chunk-a4g5yjm0.js.map} +0 -0
- /package/dist/{chunk-gmt22nxx.js.map → chunk-adbve9zt.js.map} +0 -0
- /package/dist/{chunk-gbcrz0gr.js.map → chunk-ex8s8wsk.js.map} +0 -0
- /package/dist/{chunk-4tnrzqqh.js.map → chunk-fj1dvp37.js.map} +0 -0
- /package/dist/{chunk-bdhfn0ww.js.map → chunk-kkqwzy6h.js.map} +0 -0
- /package/dist/{chunk-bep5rrdq.js.map → chunk-mmac1mp6.js.map} +0 -0
- /package/dist/{chunk-w9bp61e7.js.map → chunk-n5t4mq6z.js.map} +0 -0
- /package/dist/{chunk-n33e8dz8.js.map → chunk-p0nbkys4.js.map} +0 -0
- /package/dist/{chunk-04h4t2b5.js.map → chunk-py2dw8cw.js.map} +0 -0
- /package/dist/{chunk-jhyc777j.js.map → chunk-q3grgzp1.js.map} +0 -0
- /package/dist/{chunk-cbn96bve.js.map → chunk-r5sc1d2b.js.map} +0 -0
- /package/dist/{chunk-y6vnvayj.js.map → chunk-vjcd8d27.js.map} +0 -0
- /package/dist/{chunk-jmwy25mf.js.map → chunk-wd34wnsy.js.map} +0 -0
- /package/dist/{chunk-63fp9x3q.js.map → chunk-wem5vqjw.js.map} +0 -0
- /package/dist/{chunk-darm7eeg.js.map → chunk-xr7y35yj.js.map} +0 -0
- /package/dist/{chunk-a69fkrtr.js.map → chunk-y0zmae99.js.map} +0 -0
- /package/dist/{chunk-xgptywp0.js.map → chunk-y2aq6ag9.js.map} +0 -0
- /package/dist/{chunk-2hbhn1ff.js.map → chunk-yfppyaty.js.map} +0 -0
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createSixbError2,
|
|
4
4
|
toSixbFailure2
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-6fsr7y93.js";
|
|
6
6
|
import {
|
|
7
7
|
reportRunFailure2
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-vjcd8d27.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveExecutionScopeAuthorization,
|
|
11
11
|
assertAuthorized2
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-8fjmqjyx.js";
|
|
13
13
|
import {
|
|
14
14
|
PIPELINE_RUN_FAILURE_CODES2
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-fjw417jf.js";
|
|
16
16
|
import {
|
|
17
17
|
PipelineRunError2
|
|
18
18
|
} from "./chunk-mmagke4x.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
executionRecordInputFromRuntime,
|
|
21
21
|
ensureExecutionRecord2,
|
|
22
22
|
createPrimitiveExecutionRecord
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-8w27xf9e.js";
|
|
24
24
|
|
|
25
25
|
// src/pipelines/errors.ts
|
|
26
26
|
class PipelineError2 extends Error {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createSixbError2,
|
|
4
4
|
isSixbError2
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-6fsr7y93.js";
|
|
6
6
|
import {
|
|
7
7
|
AiLimitStorageError2
|
|
8
8
|
} from "./chunk-jgwb25gc.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
applicableAiLimitPolicies2,
|
|
12
12
|
aiUsageLimitExceededError2,
|
|
13
13
|
aiUsageLimitUnavailableError2
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-fj1dvp37.js";
|
|
15
15
|
import {
|
|
16
16
|
AiUsageStorageError2,
|
|
17
17
|
normalizeAiModelCallCostRecord2,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
} from "./chunk-xnx96gfy.js";
|
|
20
20
|
import {
|
|
21
21
|
AiCostStorageError2
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-fjw417jf.js";
|
|
23
23
|
import {
|
|
24
24
|
normalizeAiModelCallRecord2
|
|
25
25
|
} from "./chunk-s3csryxe.js";
|
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
ConnectorError2,
|
|
8
8
|
createConnectorCodedError,
|
|
9
9
|
getConnectorExecutionSourceResolver
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-r5sc1d2b.js";
|
|
11
11
|
import {
|
|
12
12
|
isDatasetDefinition2
|
|
13
13
|
} from "./chunk-cd234ba4.js";
|
|
14
14
|
import {
|
|
15
15
|
SyncValidationError2
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-y0zmae99.js";
|
|
17
17
|
import {
|
|
18
18
|
isOAuthConnectorAdapter,
|
|
19
19
|
isConnectorDefinition
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
canAccessApplication2,
|
|
6
6
|
resolveRoleGrants2,
|
|
7
7
|
resolveAuthorizationContext2
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-8fjmqjyx.js";
|
|
9
9
|
import {
|
|
10
10
|
AuthRuntimeError2,
|
|
11
11
|
DEFAULT_AUTH_SESSION_AUDIENCE2,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
assertNonEmpty3,
|
|
18
18
|
normalizePagination,
|
|
19
19
|
isInvitationDeliveryAuthStrategy2
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-2jntasmh.js";
|
|
21
21
|
import {
|
|
22
22
|
normalizeParams,
|
|
23
23
|
coerceParamsToTyped
|
|
@@ -2375,15 +2375,6 @@ class InMemoryAuthStorage2 {
|
|
|
2375
2375
|
});
|
|
2376
2376
|
throw new AuthStorageError2("user_creation_not_allowed", `[Sixb] Magic link '${input.magicLinkId}' cannot create a user for project '${projectId}'.`);
|
|
2377
2377
|
}
|
|
2378
|
-
if (shouldCreateUser && !activeInvitation && input.allowUserCreationWithoutInvitation && input.requireNoActiveUsersForUserCreation && hasActiveUsers(this.state, projectId)) {
|
|
2379
|
-
consumeMagicLinkRecord(this.state, {
|
|
2380
|
-
projectId,
|
|
2381
|
-
id: input.magicLinkId,
|
|
2382
|
-
tokenHash: input.tokenHash,
|
|
2383
|
-
consumedAt: completedAt
|
|
2384
|
-
});
|
|
2385
|
-
throw new AuthStorageError2("user_creation_not_allowed", `[Sixb] Magic link '${input.magicLinkId}' cannot create a user for project '${projectId}'.`);
|
|
2386
|
-
}
|
|
2387
2378
|
validateCompleteSessionInput(this.state, projectId, input.session);
|
|
2388
2379
|
assertSignInSessionAudience(projectId, input.session.audience, magicLink.audience);
|
|
2389
2380
|
let newUserId;
|
|
@@ -2419,8 +2410,9 @@ class InMemoryAuthStorage2 {
|
|
|
2419
2410
|
projectId,
|
|
2420
2411
|
user
|
|
2421
2412
|
});
|
|
2422
|
-
const memberships = this.
|
|
2413
|
+
const memberships = this.applyGroups({
|
|
2423
2414
|
completedAt,
|
|
2415
|
+
source: "manual",
|
|
2424
2416
|
groupIds: manualGroupIds,
|
|
2425
2417
|
projectId,
|
|
2426
2418
|
userId: user.id,
|
|
@@ -2464,26 +2456,14 @@ class InMemoryAuthStorage2 {
|
|
|
2464
2456
|
this.consumeOidcAttempt(input, completedAt, projectId);
|
|
2465
2457
|
throw new AuthStorageError2("missing_user", `[Sixb] User '${identity.userId}' not found for linked OIDC identity.`);
|
|
2466
2458
|
}
|
|
2467
|
-
if (!identity && user && (!input.autoLinkByVerifiedEmail || !input.emailVerified)) {
|
|
2468
|
-
this.consumeOidcAttempt(input, completedAt, projectId);
|
|
2469
|
-
throw new AuthStorageError2("email_link_not_allowed", `[Sixb] OIDC identity cannot auto-link to user '${user.id}' for project '${projectId}'.`);
|
|
2470
|
-
}
|
|
2471
2459
|
if (user?.status === "suspended") {
|
|
2472
2460
|
this.consumeOidcAttempt(input, completedAt, projectId);
|
|
2473
2461
|
throw new AuthStorageError2("suspended_user", `[Sixb] User '${user.id}' is suspended for project '${projectId}'.`);
|
|
2474
2462
|
}
|
|
2475
|
-
if (shouldCreateUser && !input.emailVerified) {
|
|
2476
|
-
this.consumeOidcAttempt(input, completedAt, projectId);
|
|
2477
|
-
throw new AuthStorageError2("user_creation_not_allowed", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' cannot create a user for project '${projectId}'.`);
|
|
2478
|
-
}
|
|
2479
2463
|
if (shouldCreateUser && !activeInvitation && !input.allowUserCreationWithoutInvitation) {
|
|
2480
2464
|
this.consumeOidcAttempt(input, completedAt, projectId);
|
|
2481
2465
|
throw new AuthStorageError2("user_creation_not_allowed", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' cannot create a user for project '${projectId}'.`);
|
|
2482
2466
|
}
|
|
2483
|
-
if (shouldCreateUser && !activeInvitation && input.allowUserCreationWithoutInvitation && input.requireNoActiveUsersForUserCreation && hasActiveUsers(this.state, projectId)) {
|
|
2484
|
-
this.consumeOidcAttempt(input, completedAt, projectId);
|
|
2485
|
-
throw new AuthStorageError2("user_creation_not_allowed", `[Sixb] OIDC authorization attempt '${input.oidcAuthorizationAttemptId}' cannot create a user for project '${projectId}'.`);
|
|
2486
|
-
}
|
|
2487
2467
|
validateCompleteSessionInput(this.state, projectId, input.session);
|
|
2488
2468
|
assertSignInSessionAudience(projectId, input.session.audience, attempt.audience);
|
|
2489
2469
|
let newUserId;
|
|
@@ -2513,12 +2493,19 @@ class InMemoryAuthStorage2 {
|
|
|
2513
2493
|
projectId,
|
|
2514
2494
|
user
|
|
2515
2495
|
});
|
|
2516
|
-
const memberships = this.
|
|
2496
|
+
const memberships = this.syncDirectoryGroups({
|
|
2517
2497
|
completedAt,
|
|
2518
|
-
groupIds:
|
|
2498
|
+
groupIds: input.directoryGroupIds,
|
|
2519
2499
|
projectId,
|
|
2520
2500
|
userId: user.id,
|
|
2521
|
-
existing:
|
|
2501
|
+
existing: this.applyGroups({
|
|
2502
|
+
completedAt,
|
|
2503
|
+
source: "manual",
|
|
2504
|
+
groupIds: manualGroupIds,
|
|
2505
|
+
projectId,
|
|
2506
|
+
userId: user.id,
|
|
2507
|
+
existing: invitation.memberships
|
|
2508
|
+
})
|
|
2522
2509
|
});
|
|
2523
2510
|
const nextIdentity = {
|
|
2524
2511
|
projectId,
|
|
@@ -2579,19 +2566,30 @@ class InMemoryAuthStorage2 {
|
|
|
2579
2566
|
}));
|
|
2580
2567
|
return { invitation, memberships };
|
|
2581
2568
|
}
|
|
2582
|
-
|
|
2569
|
+
applyGroups(input) {
|
|
2583
2570
|
const memberships = [...input.existing];
|
|
2584
2571
|
for (const groupId of input.groupIds) {
|
|
2585
2572
|
memberships.push(upsertGroupMembershipRecord(this.state, {
|
|
2586
2573
|
projectId: input.projectId,
|
|
2587
2574
|
userId: input.userId,
|
|
2588
2575
|
groupId,
|
|
2589
|
-
source:
|
|
2576
|
+
source: input.source,
|
|
2590
2577
|
createdAt: input.completedAt
|
|
2591
2578
|
}));
|
|
2592
2579
|
}
|
|
2593
2580
|
return memberships;
|
|
2594
2581
|
}
|
|
2582
|
+
syncDirectoryGroups(input) {
|
|
2583
|
+
if (!input.groupIds) {
|
|
2584
|
+
return input.existing;
|
|
2585
|
+
}
|
|
2586
|
+
const groupIds = normalizeGroupIds(input.groupIds);
|
|
2587
|
+
const stale = [...this.state.groupMemberships.values()].filter((membership) => membership.projectId === input.projectId && membership.userId === input.userId && membership.source === "directory" && !groupIds.includes(membership.groupId));
|
|
2588
|
+
for (const membership of stale) {
|
|
2589
|
+
removeGroupMembershipRecord(this.state, membership);
|
|
2590
|
+
}
|
|
2591
|
+
return this.applyGroups({ ...input, groupIds, source: "directory" });
|
|
2592
|
+
}
|
|
2595
2593
|
createSignInSession(input) {
|
|
2596
2594
|
return createSessionRecord(this.state, {
|
|
2597
2595
|
id: input.session.id,
|
|
@@ -2622,14 +2620,6 @@ function restoreMap(target, snapshot) {
|
|
|
2622
2620
|
target.set(key, value);
|
|
2623
2621
|
}
|
|
2624
2622
|
}
|
|
2625
|
-
function hasActiveUsers(state, projectId) {
|
|
2626
|
-
for (const user of state.users.values()) {
|
|
2627
|
-
if (user.projectId === projectId && user.status === "active") {
|
|
2628
|
-
return true;
|
|
2629
|
-
}
|
|
2630
|
-
}
|
|
2631
|
-
return false;
|
|
2632
|
-
}
|
|
2633
2623
|
function assertSignInSessionAudience(projectId, sessionAudience, storedAudience) {
|
|
2634
2624
|
if (sessionAudience === storedAudience) {
|
|
2635
2625
|
return;
|
|
@@ -3298,7 +3288,7 @@ class AuthRuntime2 {
|
|
|
3298
3288
|
const result = await storage.users.list({ projectId: this.projectId, order: input.order });
|
|
3299
3289
|
const members = [];
|
|
3300
3290
|
for (const user of result.users) {
|
|
3301
|
-
const groupIds = (await storage.groupMemberships.listForUser({ projectId: this.projectId, userId: user.id }))
|
|
3291
|
+
const { groupIds, managedGroupIds } = memberGroups(await storage.groupMemberships.listForUser({ projectId: this.projectId, userId: user.id }));
|
|
3302
3292
|
const canAssignGroups = canPerformMembershipOperation(scope, "assignGroups", groupIds);
|
|
3303
3293
|
const canSuspendScope = canPerformMembershipOperation(scope, "suspend", groupIds);
|
|
3304
3294
|
if (!canAssignGroups && !canSuspendScope) {
|
|
@@ -3308,6 +3298,7 @@ class AuthRuntime2 {
|
|
|
3308
3298
|
members.push({
|
|
3309
3299
|
user,
|
|
3310
3300
|
groupIds,
|
|
3301
|
+
managedGroupIds,
|
|
3311
3302
|
capabilities: {
|
|
3312
3303
|
assignGroups: canAssignGroups,
|
|
3313
3304
|
suspend: canSuspendScope && !isSelf && user.status === "active",
|
|
@@ -3322,7 +3313,11 @@ class AuthRuntime2 {
|
|
|
3322
3313
|
const storage = this.requireAuthStorage();
|
|
3323
3314
|
const scope = this.resolveMembershipPolicyScopeForUser(caller.groupIds);
|
|
3324
3315
|
const userId = assertNonEmpty3(input.userId, "User id");
|
|
3325
|
-
const {
|
|
3316
|
+
const {
|
|
3317
|
+
user,
|
|
3318
|
+
groupIds: currentGroupIds,
|
|
3319
|
+
managedGroupIds: currentManagedGroupIds
|
|
3320
|
+
} = await this.requireManageableMember(storage, scope, "assignGroups", userId);
|
|
3326
3321
|
const requestedGroupIds = this.resolveMemberGroupIds(input.groupIds);
|
|
3327
3322
|
const missing = missingMembershipGroupIds(scope, "assignGroups", requestedGroupIds);
|
|
3328
3323
|
if (missing.length > 0) {
|
|
@@ -3332,6 +3327,10 @@ class AuthRuntime2 {
|
|
|
3332
3327
|
const requested = new Set(requestedGroupIds);
|
|
3333
3328
|
const additions = requestedGroupIds.filter((groupId) => !current.has(groupId));
|
|
3334
3329
|
const removals = currentGroupIds.filter((groupId) => !requested.has(groupId));
|
|
3330
|
+
const managedRemovals = removals.filter((groupId) => currentManagedGroupIds.includes(groupId));
|
|
3331
|
+
if (managedRemovals.length > 0) {
|
|
3332
|
+
throw new AuthRuntimeError2("invalid_auth_input", `[Sixb] Group(s) ${managedRemovals.join(", ")} are managed by the identity provider. Change them there; they sync at the user's next sign-in.`);
|
|
3333
|
+
}
|
|
3335
3334
|
if (user.id === caller.user.id && removals.length > 0) {
|
|
3336
3335
|
throw new AuthRuntimeError2("authorization_denied", "[Sixb] The current user cannot remove their own groups.");
|
|
3337
3336
|
}
|
|
@@ -3353,14 +3352,14 @@ class AuthRuntime2 {
|
|
|
3353
3352
|
});
|
|
3354
3353
|
}
|
|
3355
3354
|
this.sessionCache?.invalidateUser(user.id);
|
|
3356
|
-
const groupIds = (await storage.groupMemberships.listForUser({ projectId: this.projectId, userId: user.id }))
|
|
3357
|
-
return { user, groupIds };
|
|
3355
|
+
const { groupIds, managedGroupIds } = memberGroups(await storage.groupMemberships.listForUser({ projectId: this.projectId, userId: user.id }));
|
|
3356
|
+
return { user, groupIds, managedGroupIds };
|
|
3358
3357
|
}
|
|
3359
3358
|
async suspendMember(caller, input) {
|
|
3360
3359
|
const storage = this.requireAuthStorage();
|
|
3361
3360
|
const scope = this.resolveMembershipPolicyScopeForUser(caller.groupIds);
|
|
3362
3361
|
const userId = assertNonEmpty3(input.userId, "User id");
|
|
3363
|
-
const { user, groupIds } = await this.requireManageableMember(storage, scope, "suspend", userId);
|
|
3362
|
+
const { user, groupIds, managedGroupIds } = await this.requireManageableMember(storage, scope, "suspend", userId);
|
|
3364
3363
|
if (user.id === caller.user.id) {
|
|
3365
3364
|
throw new AuthRuntimeError2("authorization_denied", "[Sixb] The current user cannot suspend themselves.");
|
|
3366
3365
|
}
|
|
@@ -3370,20 +3369,20 @@ class AuthRuntime2 {
|
|
|
3370
3369
|
suspendedAt: new Date
|
|
3371
3370
|
});
|
|
3372
3371
|
this.sessionCache?.invalidateUser(user.id);
|
|
3373
|
-
return { user: suspended, groupIds };
|
|
3372
|
+
return { user: suspended, groupIds, managedGroupIds };
|
|
3374
3373
|
}
|
|
3375
3374
|
async reactivateMember(caller, input) {
|
|
3376
3375
|
const storage = this.requireAuthStorage();
|
|
3377
3376
|
const scope = this.resolveMembershipPolicyScopeForUser(caller.groupIds);
|
|
3378
3377
|
const userId = assertNonEmpty3(input.userId, "User id");
|
|
3379
|
-
const { user, groupIds } = await this.requireManageableMember(storage, scope, "suspend", userId);
|
|
3378
|
+
const { user, groupIds, managedGroupIds } = await this.requireManageableMember(storage, scope, "suspend", userId);
|
|
3380
3379
|
const reactivated = await storage.users.updateStatus({
|
|
3381
3380
|
projectId: this.projectId,
|
|
3382
3381
|
id: user.id,
|
|
3383
3382
|
status: "active",
|
|
3384
3383
|
updatedAt: new Date
|
|
3385
3384
|
});
|
|
3386
|
-
return { user: reactivated, groupIds };
|
|
3385
|
+
return { user: reactivated, groupIds, managedGroupIds };
|
|
3387
3386
|
}
|
|
3388
3387
|
async listSessions(caller) {
|
|
3389
3388
|
return this.requireAuthStorage().sessions.listActiveByUserId({
|
|
@@ -3426,11 +3425,11 @@ class AuthRuntime2 {
|
|
|
3426
3425
|
}
|
|
3427
3426
|
async requireManageableMember(storage, scope, operation, userId) {
|
|
3428
3427
|
const user = await storage.users.getById({ projectId: this.projectId, id: userId });
|
|
3429
|
-
const groupIds = user ?
|
|
3428
|
+
const { groupIds, managedGroupIds } = memberGroups(user ? await storage.groupMemberships.listForUser({ projectId: this.projectId, userId }) : []);
|
|
3430
3429
|
if (!user || !canPerformMembershipOperation(scope, operation, groupIds)) {
|
|
3431
3430
|
throw new AuthStorageError2("missing_user", `[Sixb] User '${userId}' not found for project '${this.projectId}'.`);
|
|
3432
3431
|
}
|
|
3433
|
-
return { user, groupIds };
|
|
3432
|
+
return { user, groupIds, managedGroupIds };
|
|
3434
3433
|
}
|
|
3435
3434
|
resolveMemberGroupIds(input) {
|
|
3436
3435
|
const groupIds = [...new Set(input.map((groupId) => assertNonEmpty3(groupId, "Group id")))];
|
|
@@ -3617,6 +3616,12 @@ class AuthRuntime2 {
|
|
|
3617
3616
|
throw new AuthRuntimeError2("authorization_denied", `[Sixb] The current user is not allowed to create or manage invitations for group(s): ${missing.join(", ")}.`);
|
|
3618
3617
|
}
|
|
3619
3618
|
}
|
|
3619
|
+
function memberGroups(memberships) {
|
|
3620
|
+
return {
|
|
3621
|
+
groupIds: memberships.map((membership) => membership.groupId),
|
|
3622
|
+
managedGroupIds: memberships.filter((membership) => membership.source === "directory").map((membership) => membership.groupId)
|
|
3623
|
+
};
|
|
3624
|
+
}
|
|
3620
3625
|
function callerSessionId(caller) {
|
|
3621
3626
|
return caller.credentialSource === "session" ? caller.session.id : undefined;
|
|
3622
3627
|
}
|
|
@@ -3696,4 +3701,4 @@ function principalsEqual2(left, right) {
|
|
|
3696
3701
|
}
|
|
3697
3702
|
export { ActionDefinitionError2, ActionEditCommitError2, missingActionMutationMessage, effectsWithoutEditsMessage, assertNonEmpty2, isActionDefinition2, isGlobalActionDefinition2, isObjectActionDefinition2, normalizeActionParams, coerceActionParamsToTyped2, validateActionSubject, resolveObjectActionSubject, PERSONAL_ACCESS_TOKEN_PREFIX2, SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX2, generateAccessTokenSecret2, hashAccessTokenSecret2, formatAccessTokenValue2, parseAccessTokenValue2, getBearerAccessTokenValue2, createAccessTokenCredential2, setRequestClientAddress2, getRequestClientAddress2, CSRF_HEADER_NAME2, generateCsrfToken2, isCsrfExemptMethod2, verifyDoubleSubmitCsrf2, verifyCsrfToken2, applications2, SecurityValidationError2, isGroupDefinition, isMembershipPolicyDefinition, isRoleDefinition, defineGroup2, defineRole2, defineMembershipPolicy2, every2, ShareDefinitionError2, defineShare2, isShareDefinition, snapshotShareDefinition, can2, SecurityRegistry, AuthStorageError2, MAX_PENDING_DEVICE_AUTHORIZATIONS2, paginate, InMemoryAuthStorage2, generateSessionSecret2, hashSessionSecret2, formatSessionCookieValue2, parseSessionCookieValue2, createSessionCredential2, AuthRuntime2, SYSTEM_PRINCIPAL2, principalsEqual2 };
|
|
3698
3703
|
|
|
3699
|
-
//# debugId=
|
|
3704
|
+
//# debugId=73464FD9FDE5971364756E2164756E21
|