@owlmeans/server-planning 0.1.18-rc.9 → 0.1.18
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/README.md +92 -19
- package/agent-meta/manifest.json +105 -4
- package/agent-meta/skills/server-planning/SKILL.md +89 -138
- package/agent-meta/skills/server-planning/parts/auxiliary.md +54 -0
- package/agent-meta/skills/server-planning/parts/executor.md +82 -0
- package/agent-meta/skills/server-planning/parts/schemas.md +26 -0
- package/agent-meta/skills/server-planning/parts/serving.md +88 -0
- package/agent-meta/skills/server-planning/parts/stores.md +91 -0
- package/build/actions/apply-schema-request.d.ts +8 -0
- package/build/actions/apply-schema-request.d.ts.map +1 -0
- package/build/actions/apply-schema-request.js +33 -0
- package/build/actions/apply-schema-request.js.map +1 -0
- package/build/actions/commit.d.ts +3 -3
- package/build/actions/commit.d.ts.map +1 -1
- package/build/actions/commit.js +5 -4
- package/build/actions/commit.js.map +1 -1
- package/build/actions/define-schemas.d.ts +13 -0
- package/build/actions/define-schemas.d.ts.map +1 -0
- package/build/actions/define-schemas.js +28 -0
- package/build/actions/define-schemas.js.map +1 -0
- package/build/actions/execute.d.ts +11 -10
- package/build/actions/execute.d.ts.map +1 -1
- package/build/actions/execute.js +17 -27
- package/build/actions/execute.js.map +1 -1
- package/build/actions/execution/types.d.ts +34 -0
- package/build/actions/execution/types.d.ts.map +1 -0
- package/build/actions/execution/types.js +2 -0
- package/build/actions/execution/types.js.map +1 -0
- package/build/actions/execution.d.ts +4 -0
- package/build/actions/execution.d.ts.map +1 -0
- package/build/actions/execution.js +88 -0
- package/build/actions/execution.js.map +1 -0
- package/build/actions/get-card.d.ts +6 -0
- package/build/actions/get-card.d.ts.map +1 -0
- package/build/actions/get-card.js +9 -0
- package/build/actions/get-card.js.map +1 -0
- package/build/actions/get-specification.d.ts +6 -0
- package/build/actions/get-specification.d.ts.map +1 -0
- package/build/actions/get-specification.js +9 -0
- package/build/actions/get-specification.js.map +1 -0
- package/build/actions/index.d.ts +12 -3
- package/build/actions/index.d.ts.map +1 -1
- package/build/actions/index.js +11 -3
- package/build/actions/index.js.map +1 -1
- package/build/actions/links.d.ts +3 -3
- package/build/actions/links.d.ts.map +1 -1
- package/build/actions/links.js +6 -5
- package/build/actions/links.js.map +1 -1
- package/build/actions/list-card-specifications.d.ts +6 -0
- package/build/actions/list-card-specifications.d.ts.map +1 -0
- package/build/actions/list-card-specifications.js +11 -0
- package/build/actions/list-card-specifications.js.map +1 -0
- package/build/actions/list-card-transitions.d.ts +6 -0
- package/build/actions/list-card-transitions.d.ts.map +1 -0
- package/build/actions/list-card-transitions.js +11 -0
- package/build/actions/list-card-transitions.js.map +1 -0
- package/build/actions/list-cards.d.ts +6 -0
- package/build/actions/list-cards.d.ts.map +1 -0
- package/build/actions/list-cards.js +10 -0
- package/build/actions/list-cards.js.map +1 -0
- package/build/actions/list-schemas.d.ts +13 -0
- package/build/actions/list-schemas.d.ts.map +1 -0
- package/build/actions/list-schemas.js +20 -0
- package/build/actions/list-schemas.js.map +1 -0
- package/build/actions/list-specification-revisions.d.ts +6 -0
- package/build/actions/list-specification-revisions.d.ts.map +1 -0
- package/build/actions/list-specification-revisions.js +10 -0
- package/build/actions/list-specification-revisions.js.map +1 -0
- package/build/actions/resources.d.ts +5 -0
- package/build/actions/resources.d.ts.map +1 -0
- package/build/actions/resources.js +111 -0
- package/build/actions/resources.js.map +1 -0
- package/build/actions/summarize-cards.d.ts +6 -0
- package/build/actions/summarize-cards.d.ts.map +1 -0
- package/build/actions/summarize-cards.js +11 -0
- package/build/actions/summarize-cards.js.map +1 -0
- package/build/actions/transitions.d.ts +3 -3
- package/build/actions/transitions.d.ts.map +1 -1
- package/build/actions/transitions.js +4 -3
- package/build/actions/transitions.js.map +1 -1
- package/build/actions/types.d.ts +6 -0
- package/build/actions/types.d.ts.map +1 -0
- package/build/actions/types.js +2 -0
- package/build/actions/types.js.map +1 -0
- package/build/actions/watch.d.ts +2 -2
- package/build/actions/watch.d.ts.map +1 -1
- package/build/actions/watch.js +8 -6
- package/build/actions/watch.js.map +1 -1
- package/build/conformance/assert/types.d.ts +19 -0
- package/build/conformance/assert/types.d.ts.map +1 -0
- package/build/conformance/assert/types.js +2 -0
- package/build/conformance/assert/types.js.map +1 -0
- package/build/conformance/assert.d.ts +15 -0
- package/build/conformance/assert.d.ts.map +1 -0
- package/build/conformance/assert.js +52 -0
- package/build/conformance/assert.js.map +1 -0
- package/build/conformance/cases.d.ts +7 -0
- package/build/conformance/cases.d.ts.map +1 -0
- package/build/conformance/cases.js +544 -0
- package/build/conformance/cases.js.map +1 -0
- package/build/conformance/clock.d.ts +6 -0
- package/build/conformance/clock.d.ts.map +1 -0
- package/build/conformance/clock.js +12 -0
- package/build/conformance/clock.js.map +1 -0
- package/build/conformance/consts.d.ts +30 -0
- package/build/conformance/consts.d.ts.map +1 -0
- package/build/conformance/consts.js +159 -0
- package/build/conformance/consts.js.map +1 -0
- package/build/conformance/errors.d.ts +5 -0
- package/build/conformance/errors.d.ts.map +1 -0
- package/build/conformance/errors.js +8 -0
- package/build/conformance/errors.js.map +1 -0
- package/build/conformance/fixtures/types.d.ts +13 -0
- package/build/conformance/fixtures/types.d.ts.map +1 -0
- package/build/conformance/fixtures/types.js +2 -0
- package/build/conformance/fixtures/types.js.map +1 -0
- package/build/conformance/fixtures.d.ts +14 -0
- package/build/conformance/fixtures.d.ts.map +1 -0
- package/build/conformance/fixtures.js +26 -0
- package/build/conformance/fixtures.js.map +1 -0
- package/build/conformance/index.d.ts +15 -0
- package/build/conformance/index.d.ts.map +1 -0
- package/build/conformance/index.js +12 -0
- package/build/conformance/index.js.map +1 -0
- package/build/conformance/resources.d.ts +4 -0
- package/build/conformance/resources.d.ts.map +1 -0
- package/build/conformance/resources.js +228 -0
- package/build/conformance/resources.js.map +1 -0
- package/build/conformance/types.d.ts +18 -0
- package/build/conformance/types.d.ts.map +1 -0
- package/build/conformance/types.js +2 -0
- package/build/conformance/types.js.map +1 -0
- package/build/consts.d.ts +5 -0
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +5 -0
- package/build/consts.js.map +1 -1
- package/build/definitions.d.ts +18 -0
- package/build/definitions.d.ts.map +1 -0
- package/build/definitions.js +225 -0
- package/build/definitions.js.map +1 -0
- package/build/executor/changes/types.d.ts +36 -0
- package/build/executor/changes/types.d.ts.map +1 -0
- package/build/executor/changes/types.js +2 -0
- package/build/executor/changes/types.js.map +1 -0
- package/build/executor/changes.d.ts +3 -30
- package/build/executor/changes.d.ts.map +1 -1
- package/build/executor/changes.js +42 -51
- package/build/executor/changes.js.map +1 -1
- package/build/executor/code/types.d.ts +17 -0
- package/build/executor/code/types.d.ts.map +1 -0
- package/build/executor/code/types.js +2 -0
- package/build/executor/code/types.js.map +1 -0
- package/build/executor/code.d.ts +3 -14
- package/build/executor/code.d.ts.map +1 -1
- package/build/executor/code.js +50 -54
- package/build/executor/code.js.map +1 -1
- package/build/executor/consts.local.d.ts +5 -0
- package/build/executor/consts.local.d.ts.map +1 -0
- package/build/executor/consts.local.js +6 -0
- package/build/executor/consts.local.js.map +1 -0
- package/build/executor/creator/types.d.ts +33 -0
- package/build/executor/creator/types.d.ts.map +1 -0
- package/build/executor/creator/types.js +2 -0
- package/build/executor/creator/types.js.map +1 -0
- package/build/executor/creator.d.ts +11 -0
- package/build/executor/creator.d.ts.map +1 -0
- package/build/executor/creator.js +32 -0
- package/build/executor/creator.js.map +1 -0
- package/build/executor/resolve/types.d.ts +30 -0
- package/build/executor/resolve/types.d.ts.map +1 -0
- package/build/executor/resolve/types.js +2 -0
- package/build/executor/resolve/types.js.map +1 -0
- package/build/executor/resolve.d.ts +5 -34
- package/build/executor/resolve.d.ts.map +1 -1
- package/build/executor/resolve.js +169 -110
- package/build/executor/resolve.js.map +1 -1
- package/build/executor/types.d.ts +23 -0
- package/build/executor/types.d.ts.map +1 -0
- package/build/executor/types.js +2 -0
- package/build/executor/types.js.map +1 -0
- package/build/executor/validate.d.ts +6 -5
- package/build/executor/validate.d.ts.map +1 -1
- package/build/executor/validate.js +38 -27
- package/build/executor/validate.js.map +1 -1
- package/build/executor.d.ts +11 -7
- package/build/executor.d.ts.map +1 -1
- package/build/executor.js +27 -21
- package/build/executor.js.map +1 -1
- package/build/facade.d.ts +20 -2
- package/build/facade.d.ts.map +1 -1
- package/build/facade.js +144 -22
- package/build/facade.js.map +1 -1
- package/build/helper.d.ts +5 -9
- package/build/helper.d.ts.map +1 -1
- package/build/helper.js +12 -11
- package/build/helper.js.map +1 -1
- package/build/hierarchy/types.d.ts +20 -0
- package/build/hierarchy/types.d.ts.map +1 -0
- package/build/hierarchy/types.js +2 -0
- package/build/hierarchy/types.js.map +1 -0
- package/build/hierarchy.d.ts +5 -0
- package/build/hierarchy.d.ts.map +1 -0
- package/build/hierarchy.js +133 -0
- package/build/hierarchy.js.map +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/invariants/types.d.ts +6 -0
- package/build/invariants/types.d.ts.map +1 -0
- package/build/invariants/types.js +2 -0
- package/build/invariants/types.js.map +1 -0
- package/build/invariants.d.ts +5 -0
- package/build/invariants.d.ts.map +1 -0
- package/build/invariants.js +126 -0
- package/build/invariants.js.map +1 -0
- package/build/projection.d.ts +4 -10
- package/build/projection.d.ts.map +1 -1
- package/build/projection.js +7 -5
- package/build/projection.js.map +1 -1
- package/build/queue/consts.d.ts +5 -0
- package/build/queue/consts.d.ts.map +1 -0
- package/build/queue/consts.js +5 -0
- package/build/queue/consts.js.map +1 -0
- package/build/queue/declare.d.ts +5 -0
- package/build/queue/declare.d.ts.map +1 -0
- package/build/queue/declare.js +5 -0
- package/build/queue/declare.js.map +1 -0
- package/build/queue/index.d.ts +3 -18
- package/build/queue/index.d.ts.map +1 -1
- package/build/queue/index.js +2 -7
- package/build/queue/index.js.map +1 -1
- package/build/queue/types.d.ts +13 -0
- package/build/queue/types.d.ts.map +1 -0
- package/build/queue/types.js +2 -0
- package/build/queue/types.js.map +1 -0
- package/build/registry.d.ts +5 -22
- package/build/registry.d.ts.map +1 -1
- package/build/registry.js +16 -10
- package/build/registry.js.map +1 -1
- package/build/resources.d.ts +5 -0
- package/build/resources.d.ts.map +1 -0
- package/build/resources.js +287 -0
- package/build/resources.js.map +1 -0
- package/build/service.d.ts +3 -16
- package/build/service.d.ts.map +1 -1
- package/build/service.js +12 -0
- package/build/service.js.map +1 -1
- package/build/store/commits.d.ts.map +1 -1
- package/build/store/commits.js +3 -1
- package/build/store/commits.js.map +1 -1
- package/build/store/composite.d.ts +1 -0
- package/build/store/composite.d.ts.map +1 -1
- package/build/store/composite.js +7 -2
- package/build/store/composite.js.map +1 -1
- package/build/store/consts.local.d.ts +2 -0
- package/build/store/consts.local.d.ts.map +1 -0
- package/build/store/consts.local.js +2 -0
- package/build/store/consts.local.js.map +1 -0
- package/build/store/fold/types.d.ts +43 -0
- package/build/store/fold/types.d.ts.map +1 -0
- package/build/store/fold/types.js +2 -0
- package/build/store/fold/types.js.map +1 -0
- package/build/store/fold.d.ts +8 -30
- package/build/store/fold.d.ts.map +1 -1
- package/build/store/fold.js +190 -198
- package/build/store/fold.js.map +1 -1
- package/build/store/index.d.ts +1 -0
- package/build/store/index.d.ts.map +1 -1
- package/build/store/index.js.map +1 -1
- package/build/store/memory.d.ts +12 -0
- package/build/store/memory.d.ts.map +1 -1
- package/build/store/memory.js +0 -0
- package/build/store/memory.js.map +1 -1
- package/build/store/types.d.ts +15 -1
- package/build/store/types.d.ts.map +1 -1
- package/build/store/types.local.d.ts +5 -0
- package/build/store/types.local.d.ts.map +1 -0
- package/build/store/types.local.js +2 -0
- package/build/store/types.local.js.map +1 -0
- package/build/types.d.ts +126 -2
- package/build/types.d.ts.map +1 -1
- package/build/types.local.d.ts +7 -0
- package/build/types.local.d.ts.map +1 -0
- package/build/types.local.js +2 -0
- package/build/types.local.js.map +1 -0
- package/build/utils/access/types.d.ts +30 -0
- package/build/utils/access/types.d.ts.map +1 -0
- package/build/utils/access/types.js +2 -0
- package/build/utils/access/types.js.map +1 -0
- package/build/utils/access.d.ts +4 -0
- package/build/utils/access.d.ts.map +1 -0
- package/build/utils/access.js +28 -0
- package/build/utils/access.js.map +1 -0
- package/build/utils/guard/types.d.ts +23 -0
- package/build/utils/guard/types.d.ts.map +1 -0
- package/build/utils/guard/types.js +2 -0
- package/build/utils/guard/types.js.map +1 -0
- package/build/utils/guard.d.ts +7 -10
- package/build/utils/guard.d.ts.map +1 -1
- package/build/utils/guard.js +36 -32
- package/build/utils/guard.js.map +1 -1
- package/build/utils/handler/types.d.ts +26 -0
- package/build/utils/handler/types.d.ts.map +1 -0
- package/build/utils/handler/types.js +2 -0
- package/build/utils/handler/types.js.map +1 -0
- package/build/utils/handler.d.ts +6 -0
- package/build/utils/handler.d.ts.map +1 -0
- package/build/utils/handler.js +21 -0
- package/build/utils/handler.js.map +1 -0
- package/build/utils/index.d.ts +8 -0
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +3 -0
- package/build/utils/index.js.map +1 -1
- package/build/utils/request/types.d.ts +23 -0
- package/build/utils/request/types.d.ts.map +1 -0
- package/build/utils/request/types.js +2 -0
- package/build/utils/request/types.js.map +1 -0
- package/build/utils/request.d.ts +4 -0
- package/build/utils/request.d.ts.map +1 -0
- package/build/utils/request.js +27 -0
- package/build/utils/request.js.map +1 -0
- package/build/utils/scope.d.ts +17 -13
- package/build/utils/scope.d.ts.map +1 -1
- package/build/utils/scope.js +21 -35
- package/build/utils/scope.js.map +1 -1
- package/build/utils/types.d.ts +8 -0
- package/build/utils/types.d.ts.map +1 -0
- package/build/utils/types.js +2 -0
- package/build/utils/types.js.map +1 -0
- package/package.json +30 -22
- package/src/actions/apply-schema-request.ts +36 -0
- package/src/actions/commit.ts +7 -5
- package/src/actions/define-schemas.ts +34 -0
- package/src/actions/execute.ts +32 -34
- package/src/actions/execution/types.ts +34 -0
- package/src/actions/execution.ts +100 -0
- package/src/actions/get-card.ts +14 -0
- package/src/actions/get-specification.ts +14 -0
- package/src/actions/index.ts +13 -3
- package/src/actions/links.ts +8 -6
- package/src/actions/list-card-specifications.ts +15 -0
- package/src/actions/list-card-transitions.ts +15 -0
- package/src/actions/list-cards.ts +14 -0
- package/src/actions/list-schemas.ts +29 -0
- package/src/actions/list-specification-revisions.ts +15 -0
- package/src/actions/resources.ts +79 -0
- package/src/actions/summarize-cards.ts +15 -0
- package/src/actions/transitions.ts +6 -4
- package/src/actions/types.ts +5 -0
- package/src/actions/watch.ts +11 -7
- package/src/conformance/assert/types.ts +16 -0
- package/src/conformance/assert.ts +67 -0
- package/src/conformance/cases.ts +631 -0
- package/src/conformance/clock.ts +11 -0
- package/src/conformance/consts.ts +165 -0
- package/src/conformance/errors.ts +7 -0
- package/src/conformance/fixtures/types.ts +11 -0
- package/src/conformance/fixtures.ts +46 -0
- package/src/conformance/index.ts +14 -0
- package/src/conformance/resources.ts +227 -0
- package/src/conformance/types.ts +20 -0
- package/src/consts.ts +6 -0
- package/src/definitions.ts +264 -0
- package/src/executor/changes/types.ts +38 -0
- package/src/executor/changes.ts +49 -68
- package/src/executor/code/types.ts +23 -0
- package/src/executor/code.ts +62 -69
- package/src/executor/consts.local.ts +8 -0
- package/src/executor/creator/types.ts +33 -0
- package/src/executor/creator.ts +43 -0
- package/src/executor/resolve/types.ts +30 -0
- package/src/executor/resolve.ts +181 -139
- package/src/executor/types.ts +23 -0
- package/src/executor/validate.ts +40 -38
- package/src/executor.ts +33 -27
- package/src/facade.ts +132 -29
- package/src/helper.ts +12 -11
- package/src/hierarchy/types.ts +20 -0
- package/src/hierarchy.ts +113 -0
- package/src/index.ts +1 -0
- package/src/invariants/types.ts +6 -0
- package/src/invariants.ts +106 -0
- package/src/projection.ts +12 -18
- package/src/queue/consts.ts +5 -0
- package/src/queue/declare.ts +7 -0
- package/src/queue/index.ts +3 -25
- package/src/queue/types.ts +14 -0
- package/src/registry.ts +18 -36
- package/src/resources.ts +256 -0
- package/src/service.ts +16 -20
- package/src/store/commits.ts +5 -4
- package/src/store/composite.ts +7 -2
- package/src/store/consts.local.ts +1 -0
- package/src/store/fold/types.ts +44 -0
- package/src/store/fold.ts +214 -212
- package/src/store/index.ts +1 -0
- package/src/store/memory.ts +0 -0
- package/src/store/types.local.ts +3 -0
- package/src/store/types.ts +16 -1
- package/src/types.local.ts +7 -0
- package/src/types.ts +139 -6
- package/src/utils/access/types.ts +30 -0
- package/src/utils/access.ts +33 -0
- package/src/utils/guard/types.ts +21 -0
- package/src/utils/guard.ts +44 -31
- package/src/utils/handler/types.ts +28 -0
- package/src/utils/handler.ts +35 -0
- package/src/utils/index.ts +9 -0
- package/src/utils/request/types.ts +23 -0
- package/src/utils/request.ts +40 -0
- package/src/utils/scope.ts +39 -42
- package/src/utils/types.ts +8 -0
- package/tests/access.spec.ts +160 -0
- package/tests/app.spec.ts +112 -0
- package/tests/conformance.spec.ts +47 -0
- package/tests/create-example.spec.ts +202 -0
- package/tests/creator.spec.ts +257 -0
- package/tests/entrypoints.spec.ts +5 -0
- package/tests/memory-store.spec.ts +52 -0
- package/tests/narrowing.spec.ts +94 -0
- package/tests/plugins.spec.ts +4 -3
- package/tests/writes.spec.ts +140 -0
- package/build/actions/cards.d.ts +0 -16
- package/build/actions/cards.d.ts.map +0 -1
- package/build/actions/cards.js +0 -32
- package/build/actions/cards.js.map +0 -1
- package/build/actions/schemas.d.ts +0 -6
- package/build/actions/schemas.d.ts.map +0 -1
- package/build/actions/schemas.js +0 -9
- package/build/actions/schemas.js.map +0 -1
- package/build/actions/specs.d.ts +0 -10
- package/build/actions/specs.d.ts.map +0 -1
- package/build/actions/specs.js +0 -14
- package/build/actions/specs.js.map +0 -1
- package/src/actions/cards.ts +0 -52
- package/src/actions/schemas.ts +0 -15
- package/src/actions/specs.ts +0 -23
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { idHelper } from '@owlmeans/basic-ids';
|
|
2
|
+
import { AssigneeKind, FieldsInvalid, mentionHelper, ParentNotFound, PlanningError, PlanningForbidden, PlanningResourceKind, PlanningSchemaKind, PLANNING_ASSIGNEE, PLANNING_REPORTER, ProjectMode, RelationshipRefused, SchemaInvalid, TransitionAction, WorkcardConflict, WorkcardKind, WorkcardNotFound, } from '@owlmeans/planning';
|
|
3
|
+
import { assertHelper } from './assert.js';
|
|
4
|
+
import { LIBRARY } from './consts.js';
|
|
5
|
+
import { conformanceFixturesOf } from './fixtures.js';
|
|
6
|
+
const { same, sameSet, rejects, check } = assertHelper;
|
|
7
|
+
const organization = () => `resource-conformance-${idHelper.uuid()}`;
|
|
8
|
+
const human = async (planning, nickname = 'reader') => await planning.assignees.create({
|
|
9
|
+
nickname, type: LIBRARY.human, kind: AssigneeKind.Human, authentication: { provider: 'external-oidc', externalId: nickname }, fields: { department: 'Library' },
|
|
10
|
+
});
|
|
11
|
+
const section = async (planning, parent, extra = {}) => (await planning.execute({ action: TransitionAction.Create, card: { kind: WorkcardKind.Card, type: LIBRARY.section, parent, title: 'Section', ...extra } }, { wait: true })).card;
|
|
12
|
+
/** Shared durable-resource and hierarchy contract, run unchanged against every stock provider. */
|
|
13
|
+
export const resourceConformance = [
|
|
14
|
+
{
|
|
15
|
+
name: 'assignees use schema-validated fields, stable authentication subjects and scoped nicknames', needs: ['resources'],
|
|
16
|
+
run: async ({ facade }) => {
|
|
17
|
+
const org = organization(), p = facade(org), other = facade(organization());
|
|
18
|
+
await rejects(p.assignees.create({ nickname: 'missing-auth', type: LIBRARY.human, kind: AssigneeKind.Human }), FieldsInvalid, 'human requires authentication by default');
|
|
19
|
+
await rejects(p.assignees.create({ nickname: 'wrong-fields', type: LIBRARY.human, kind: AssigneeKind.Human, authentication: { provider: 'x', externalId: 'x' }, fields: { department: 42 } }), FieldsInvalid, 'assignee schema is enforced');
|
|
20
|
+
const actor = await human(p, 'Alice');
|
|
21
|
+
await rejects(human(p, 'aLiCe'), WorkcardConflict, 'nickname is case insensitive');
|
|
22
|
+
await rejects(p.assignees.create({ nickname: 'another', type: LIBRARY.human, kind: AssigneeKind.Human, authentication: actor.authentication }), WorkcardConflict, 'authentication subject is unique in organization');
|
|
23
|
+
await human(other, 'Alice');
|
|
24
|
+
same(await other.assignees.load(actor.id), null, 'another organization cannot read assignee');
|
|
25
|
+
const renamed = await p.assignees.update(actor.id, { nickname: 'Librarian' }, { version: 1 });
|
|
26
|
+
same([renamed.id, renamed.version, renamed.authentication], [actor.id, 2, actor.authentication], 'rename keeps stable identity');
|
|
27
|
+
await rejects(p.assignees.update(actor.id, { nickname: 'stale' }, { version: 1 }), WorkcardConflict, 'assignee CAS');
|
|
28
|
+
same((await p.assignees.list({ nickname: 'LIBRARIAN' })).items[0].id, actor.id, 'normalized query');
|
|
29
|
+
const bot = await p.assignees.create({ nickname: 'bot', type: LIBRARY.bot, kind: AssigneeKind.NonHuman });
|
|
30
|
+
const guest = await p.assignees.create({ nickname: 'guest', type: LIBRARY.guest, kind: AssigneeKind.Human });
|
|
31
|
+
same([bot.authentication, guest.authentication], [undefined, undefined], 'nonhuman and optional human schemas admit unlinked identities');
|
|
32
|
+
await rejects(p.assignees.create({ nickname: 'mismatch', type: LIBRARY.bot, kind: AssigneeKind.Human }), FieldsInvalid, 'fundamental kind follows schema');
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'active assignee queries include unset and false retirement flags', needs: ['resources'],
|
|
37
|
+
run: async ({ facade, store }) => {
|
|
38
|
+
const org = organization(), p = facade(org);
|
|
39
|
+
const unset = await human(p, 'unset'), explicit = await human(p, 'explicit'), retired = await human(p, 'retired');
|
|
40
|
+
await store.assignees.put({ ...explicit, retired: false, version: 2 });
|
|
41
|
+
await p.assignees.retire(retired.id, { version: 1 });
|
|
42
|
+
sameSet((await p.assignees.list({ retired: false })).items.map(row => row.id), [unset.id, explicit.id], 'active means not retired');
|
|
43
|
+
sameSet((await p.assignees.list({ retired: true })).items.map(row => row.id), [retired.id], 'only retired records');
|
|
44
|
+
same((await p.assignees.list()).total, 3, 'unfiltered retains historical identities');
|
|
45
|
+
same((await p.assignees.list({ retired: false, nickname: 'UNSET', kind: AssigneeKind.Human })).items[0]?.id, unset.id, 'active filter composes with identity queries');
|
|
46
|
+
same((await facade(organization()).assignees.list({ retired: false })).total, 0, 'active filter preserves organization scope');
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'concurrent nickname claims create one assignee and leave subsequent writes usable', needs: ['resources'],
|
|
51
|
+
run: async ({ facade }) => {
|
|
52
|
+
const p = facade(organization());
|
|
53
|
+
const attempts = await Promise.allSettled(Array.from({ length: 4 }, () => human(p, 'claimed')));
|
|
54
|
+
same(attempts.filter(row => row.status === 'fulfilled').length, 1, 'one nickname winner');
|
|
55
|
+
same((await p.assignees.list({ nickname: 'CLAIMED' })).total, 1, 'one persisted identity');
|
|
56
|
+
await human(p, 'after-conflict');
|
|
57
|
+
same((await p.assignees.list()).total, 2, 'rejected writes do not poison durable operation journal');
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'comments retain trusted authors and derived mentions follow edits and removal', needs: ['resources'],
|
|
62
|
+
run: async ({ facade, service, store }) => {
|
|
63
|
+
const org = organization(), p = facade(org), actor = await human(p), mentioned = await human(p, 'mentioned');
|
|
64
|
+
const branch = await conformanceFixturesOf(p).createBranch(), card = await conformanceFixturesOf(p).createBook(branch.id);
|
|
65
|
+
const authored = service.for({ ...p.scope, assigneeId: actor.id });
|
|
66
|
+
await rejects(p.comments.create({ card: card.id, body: 'no author' }), PlanningForbidden, 'comment requires trusted author');
|
|
67
|
+
const comment = await authored.comments.create({ card: card.id, body: `${mentionHelper.encode(mentioned.id, mentioned.nickname)} ${mentionHelper.encode(mentioned.id, mentioned.nickname)}` });
|
|
68
|
+
same([comment.author, comment.version], [actor.id, 1], 'trusted immutable author');
|
|
69
|
+
const mentions = await authored.mentions.list({ comment: comment.id });
|
|
70
|
+
same(mentions.items.map(row => [row.assignee, row.revision]), [[mentioned.id, 1]], 'stable-id mentions deduplicate');
|
|
71
|
+
// Remove the cache behind the facade; the next reader repairs it from the source revision.
|
|
72
|
+
await store.mentions.drop(mentions.items[0].id, org, mentions.items[0].version);
|
|
73
|
+
same((await authored.mentions.list({ comment: comment.id })).total, 1, 'cache self-heals after interrupted cache write');
|
|
74
|
+
const stranger = service.for({ ...p.scope, assigneeId: mentioned.id });
|
|
75
|
+
await rejects(stranger.comments.update(comment.id, { body: 'taken' }, { version: 1 }), PlanningForbidden, 'another author cannot edit');
|
|
76
|
+
await authored.comments.update(comment.id, { body: 'no mentions' }, { version: 1 });
|
|
77
|
+
same((await authored.mentions.list({ comment: comment.id })).total, 0, 'removed mention is removed from cache');
|
|
78
|
+
await rejects(authored.comments.update(comment.id, { body: 'stale' }, { version: 1 }), WorkcardConflict, 'comment CAS');
|
|
79
|
+
await authored.comments.remove(comment.id, { version: 2 });
|
|
80
|
+
same(await authored.comments.load(comment.id), null, 'comment removed');
|
|
81
|
+
same((await store.mentions.list({ entityId: org, comment: comment.id })).total, 0, 'no orphan cache records');
|
|
82
|
+
await rejects(authored.comments.create({ card: card.id, body: '[@foreign](assignee:missing)' }), WorkcardNotFound, 'mention of unknown assignee is refused');
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'teams are reusable canonical relationships with deduplicated project assignees', needs: ['resources'],
|
|
87
|
+
run: async ({ facade, store }) => {
|
|
88
|
+
const org = organization(), p = facade(org), actor = await human(p), fixtures = conformanceFixturesOf(p);
|
|
89
|
+
const first = await fixtures.createBranch('First'), second = await fixtures.createBranch('Second');
|
|
90
|
+
const a = await p.teams.create({ name: 'Editors', externalId: 'permission-group:editors' }), b = await p.teams.create({ name: 'Reviewers' });
|
|
91
|
+
await p.teams.addMember(a.id, actor.id);
|
|
92
|
+
await p.teams.addMember(a.id, actor.id);
|
|
93
|
+
await p.teams.addMember(b.id, actor.id);
|
|
94
|
+
await p.teams.attach(a.id, first.id);
|
|
95
|
+
await p.teams.attach(a.id, second.id);
|
|
96
|
+
await p.teams.attach(b.id, first.id);
|
|
97
|
+
sameSet((await p.teams.members(a.id)).map(row => row.id), [actor.id], 'membership is idempotent');
|
|
98
|
+
sameSet(await p.teams.projects(a.id), [first.id, second.id], 'one reusable team on two projects');
|
|
99
|
+
same((await p.teams.assignees(first.id)).map(row => row.id), [actor.id], 'union of team assignees');
|
|
100
|
+
check((await store.links.list({ entityId: org, from: a.id, fromKind: PlanningResourceKind.Team })).total === 1, 'native relationship store owns membership');
|
|
101
|
+
await rejects(p.teams.remove(a.id, { version: 1 }), WorkcardConflict, 'attached team cannot be removed');
|
|
102
|
+
await p.teams.detach(a.id, first.id);
|
|
103
|
+
await p.teams.detach(a.id, second.id);
|
|
104
|
+
await p.teams.remove(a.id, { version: 1 });
|
|
105
|
+
same(await p.teams.load(a.id), null, 'detached team removed');
|
|
106
|
+
same((await p.assignees.get(actor.id)).id, actor.id, 'team deletion preserves identity');
|
|
107
|
+
same(await facade(organization()).teams.load(b.id), null, 'team isolation');
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'card reporter, assignee and schema fields derive indexes and preserve retired references', needs: ['resources'],
|
|
112
|
+
run: async ({ facade, store }) => {
|
|
113
|
+
const org = organization(), p = facade(org), actor = await human(p), bot = await p.assignees.create({ nickname: 'bot', type: LIBRARY.bot, kind: AssigneeKind.NonHuman });
|
|
114
|
+
const branch = await conformanceFixturesOf(p).createBranch();
|
|
115
|
+
const card = await section(p, branch.id, { reporter: actor.id, assignee: bot.id, fields: { requester: actor.id, reviewers: [actor.id, bot.id] } });
|
|
116
|
+
const edges = await store.links.list({ entityId: org, from: card.id, toKind: PlanningResourceKind.Assignee }, { size: 0 });
|
|
117
|
+
sameSet(edges.items.map(row => [row.type, row.to]), [[PLANNING_REPORTER, actor.id], [PLANNING_ASSIGNEE, bot.id], ['requested-by', actor.id], ['reviewed-by', actor.id], ['reviewed-by', bot.id]], 'canonical indexes from top-level and typed fields');
|
|
118
|
+
same((await p.relationships.list({ from: actor.id, type: 'requests', fromKind: PlanningResourceKind.Assignee })).items.map(edge => edge.to), [card.id], 'inverse relationship is derived from canonical edge');
|
|
119
|
+
await rejects(section(p, branch.id, { reporter: 'missing' }), RelationshipRefused, 'unknown assignee reference');
|
|
120
|
+
await rejects(section(p, branch.id, { fields: { requester: bot.id } }), RelationshipRefused, 'assignee-type relationship restriction');
|
|
121
|
+
await rejects(p.execute({ card: card.id, action: TransitionAction.Link, link: { type: 'requested-by', to: bot.id } }), RelationshipRefused, 'field-derived link cannot be independently edited');
|
|
122
|
+
await rejects(p.assignees.update(actor.id, { type: LIBRARY.guest }, { version: 1 }), FieldsInvalid, 'assignee type change cannot invalidate existing typed references');
|
|
123
|
+
same((await p.assignees.get(actor.id)).version, 1, 'rejected type change leaves identity unchanged');
|
|
124
|
+
await p.assignees.retire(actor.id, { version: 1 });
|
|
125
|
+
await p.execute({ card: card.id, action: TransitionAction.Update, changes: { title: 'Kept after retirement' } }, { wait: true });
|
|
126
|
+
await rejects(section(p, branch.id, { reporter: actor.id }), RelationshipRefused, 'new references to retired assignee refused');
|
|
127
|
+
await p.execute({ card: card.id, action: TransitionAction.Update, unset: ['reporter', 'fields.requester', 'fields.reviewers'] }, { wait: true });
|
|
128
|
+
same((await store.links.list({ entityId: org, from: card.id }, { size: 0 })).items.map(row => row.type), [PLANNING_ASSIGNEE], 'cleared fields remove their derived indexes');
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: 'purging a former project preserves reparented descendant documents, links and full history', needs: ['resources'],
|
|
133
|
+
run: async ({ facade, store }) => {
|
|
134
|
+
const org = organization(), p = facade(org), fixtures = conformanceFixturesOf(p);
|
|
135
|
+
const old = await fixtures.createBranch('Former'), next = await fixtures.createBranch('Destination');
|
|
136
|
+
const parent = await section(p, old.id), leaf = await fixtures.createBook(parent.id);
|
|
137
|
+
const document = (await (await p.model(leaf)).write('summary', '{"lines":["kept"]}', { wait: true })).card;
|
|
138
|
+
await p.execute({ card: leaf.id, action: TransitionAction.Link, link: { type: 'shelved-near', to: parent.id } }, { wait: true });
|
|
139
|
+
const history = (await store.transitions.list({ entityId: org, card: leaf.id }, { size: 0 })).items.map(row => row.id);
|
|
140
|
+
await p.execute({ card: parent.id, action: TransitionAction.Update, changes: { parent: next.id, parents: [next.id] } }, { wait: true });
|
|
141
|
+
await p.execute({ card: old.id, action: TransitionAction.Delete }, { wait: true });
|
|
142
|
+
same((await p.cards.get(leaf.id)).id, leaf.id, 'reparented descendant survives');
|
|
143
|
+
same((await p.specifications.get(document.id)).body, '{"lines":["kept"]}', 'descendant document survives stale project cache');
|
|
144
|
+
sameSet((await store.transitions.list({ entityId: org, card: leaf.id }, { size: 0 })).items.map(row => row.id), history, 'complete history survives former project purge');
|
|
145
|
+
same((await p.relationships.list({ from: leaf.id })).items.length, 1, 'surviving edge kept');
|
|
146
|
+
await (await p.model(leaf.id)).update({ title: 'Still writable' }, { wait: true });
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: 'nested hierarchies derive primary parent type, refuse cycles and permit safe reparenting',
|
|
151
|
+
run: async ({ facade }) => {
|
|
152
|
+
const p = facade(organization()), fixtures = conformanceFixturesOf(p);
|
|
153
|
+
const a = await fixtures.createBranch('A'), b = await fixtures.createBranch('B'), parent = await section(p, a.id), child = await section(p, parent.id), leaf = await fixtures.createBook(child.id);
|
|
154
|
+
same([child.parent, child.parentType, child.parents, leaf.parentType], [parent.id, LIBRARY.section, [parent.id], LIBRARY.section], 'primary parent is direct and typed');
|
|
155
|
+
same((await p.model(leaf)).schema().type, LIBRARY.book, 'nested card resolves nearest project schemas');
|
|
156
|
+
await rejects(p.execute({ card: parent.id, action: TransitionAction.Update, changes: { parent: child.id, parents: [child.id] } }), PlanningError, 'cycle refused');
|
|
157
|
+
await rejects(p.execute({ card: parent.id, action: TransitionAction.Delete }), PlanningError, 'live children refuse ordinary deletion');
|
|
158
|
+
await rejects(p.execute({ card: child.id, action: TransitionAction.Update, changes: { parents: [] }, unset: ['parent'] }), ParentNotFound, 'required primary parent cannot orphan');
|
|
159
|
+
await p.execute({ card: parent.id, action: TransitionAction.Update, changes: { parent: b.id, parents: [b.id] } }, { wait: true });
|
|
160
|
+
same((await p.cards.get(parent.id)).parent, b.id, 'required hierarchy permits safe reparent');
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: 'recursive project scopes filter nested cards, comments and relationships before pagination', needs: ['resources'],
|
|
165
|
+
run: async ({ facade, service }) => {
|
|
166
|
+
const org = organization(), p = facade(org), fixtures = conformanceFixturesOf(p), actor = await human(p);
|
|
167
|
+
const a = await fixtures.createBranch('Allowed'), b = await fixtures.createBranch('Other'), nest = await section(p, a.id);
|
|
168
|
+
const visible = await fixtures.createBook(nest.id), hidden = await fixtures.createBook(b.id);
|
|
169
|
+
await p.execute({ card: visible.id, action: TransitionAction.Link, link: { type: 'shelved-near', to: hidden.id } }, { wait: true });
|
|
170
|
+
const author = service.for({ ...p.scope, assigneeId: actor.id });
|
|
171
|
+
await author.comments.create({ card: visible.id, body: 'visible' });
|
|
172
|
+
await author.comments.create({ card: hidden.id, body: 'hidden' });
|
|
173
|
+
const narrowed = service.for({ ...p.scope, projects: [a.id] });
|
|
174
|
+
same((await narrowed.cards.get(visible.id)).id, visible.id, 'recursive single read');
|
|
175
|
+
same(await narrowed.cards.load(hidden.id), null, 'outside scope absent');
|
|
176
|
+
const list = await narrowed.cards.list({ size: 1, page: 1 });
|
|
177
|
+
same(list.total, 3, 'recursive total includes project and nested cards');
|
|
178
|
+
same((await narrowed.comments.list({ size: 1 })).total, 1, 'comment total excludes inaccessible cards');
|
|
179
|
+
same((await narrowed.relationships.list({ from: visible.id, size: 1 })).total, 0, 'cross-scope target edge concealed');
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: 'project modes are validated metadata and project purge removes recursive auxiliaries only', needs: ['resources'],
|
|
184
|
+
run: async ({ facade, service, store }) => {
|
|
185
|
+
const org = organization(), p = facade(org), fixtures = conformanceFixturesOf(p), actor = await human(p);
|
|
186
|
+
const project = await fixtures.createBranch(), nest = await section(p, project.id), card = await fixtures.createBook(nest.id);
|
|
187
|
+
same(project.mode, ProjectMode.Opened, 'default open mode');
|
|
188
|
+
await p.execute({ card: project.id, action: TransitionAction.Update, changes: { mode: ProjectMode.Closed } }, { wait: true });
|
|
189
|
+
same((await p.cards.get(project.id)).mode, ProjectMode.Closed, 'closed mode persists independently of flow status');
|
|
190
|
+
await rejects(p.execute({ card: card.id, action: TransitionAction.Update, changes: { mode: ProjectMode.Closed } }), FieldsInvalid, 'mode belongs to projects');
|
|
191
|
+
const team = await p.teams.create({ name: 'Reusable' });
|
|
192
|
+
await p.teams.addMember(team.id, actor.id);
|
|
193
|
+
await p.teams.attach(team.id, project.id);
|
|
194
|
+
const author = service.for({ ...p.scope, assigneeId: actor.id });
|
|
195
|
+
const comment = await author.comments.create({ card: card.id, body: mentionHelper.encode(actor.id, actor.nickname) });
|
|
196
|
+
await p.execute({ card: project.id, action: TransitionAction.Delete }, { wait: true });
|
|
197
|
+
same(await p.cards.load(card.id), null, 'recursive child purged');
|
|
198
|
+
same(await p.comments.load(comment.id), null, 'comment purged');
|
|
199
|
+
same((await store.mentions.list({ entityId: org, comment: comment.id })).total, 0, 'mention purged');
|
|
200
|
+
same((await p.teams.get(team.id)).id, team.id, 'organization team survives project purge');
|
|
201
|
+
same((await p.assignees.get(actor.id)).id, actor.id, 'organization assignee survives project purge');
|
|
202
|
+
same(await p.teams.projects(team.id), [], 'project-team edge purged');
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: 'data-defined assignee schemas are organization-only, validated and revisioned', needs: ['schemas', 'resources'],
|
|
207
|
+
run: async ({ facade, service }) => {
|
|
208
|
+
const p = facade(organization()), defs = p.definitions, type = `agent:${idHelper.uuid()}`;
|
|
209
|
+
const schema = { type, version: 1, kind: AssigneeKind.NonHuman, fields: { type: 'object', properties: { model: { type: 'string' } }, required: ['model'], additionalProperties: false } };
|
|
210
|
+
await defs.putAssigneeType(schema);
|
|
211
|
+
await rejects(p.assignees.create({ nickname: 'agent', type, kind: AssigneeKind.NonHuman }), FieldsInvalid, 'data-defined fields enforced');
|
|
212
|
+
const actor = await p.assignees.create({ nickname: 'agent', type, kind: AssigneeKind.NonHuman, fields: { model: 'runner' } });
|
|
213
|
+
const bundle = await defs.bundle();
|
|
214
|
+
check(bundle.assigneeTypes?.some(row => row.type === type) === true, 'assignee definition roundtrips');
|
|
215
|
+
const root = await conformanceFixturesOf(p).createBranch('Schema root');
|
|
216
|
+
const nested = (await p.execute({ action: TransitionAction.Create, card: { kind: WorkcardKind.Project, type: LIBRARY.branch, title: 'Nested schema project', parent: root.id } }, { wait: true })).card;
|
|
217
|
+
const nestedType = `${type}:nested-card`;
|
|
218
|
+
await defs.putType({ type: nestedType, version: 1, kind: WorkcardKind.Card, fields: { type: 'object' }, flows: [LIBRARY.circulation], specifications: [] }, { project: nested.id });
|
|
219
|
+
const scoped = service.for({ ...p.scope, projects: [root.id] });
|
|
220
|
+
check((await scoped.definitions.records({ project: nested.id })).some(record => record.key === nestedType), 'ancestor project scope includes descendant schema records');
|
|
221
|
+
await rejects(defs.putAssigneeType({ ...schema, version: 2, fields: { type: 'invalid-json-schema' } }), SchemaInvalid, 'invalid assignee schema refused');
|
|
222
|
+
await defs.retire(PlanningSchemaKind.AssigneeType, type);
|
|
223
|
+
await rejects(p.assignees.create({ nickname: 'new-agent', type, kind: AssigneeKind.NonHuman, fields: actor.fields }), FieldsInvalid, 'retired type refuses new identities');
|
|
224
|
+
same((await p.assignees.get(actor.id)).id, actor.id, 'retirement keeps identity readable');
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
];
|
|
228
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources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AAE,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAA;YACnL,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAG,CAAC,EAAE,CAAC,CAAA;YAChE,KAAK,CAAC,CAAC,MAAM,MAAM,CAAC,WAAY,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,KAAK,UAAU,CAAC,EAAE,2DAA2D,CAAC,CAAA;YACzK,MAAM,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,EAAE,CAAC,EAAE,aAAa,EAAE,iCAAiC,CAAC,CAAA;YACzJ,MAAM,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;YACxD,MAAM,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,qCAAqC,CAAC,CAAA;YAC3K,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAG,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,oCAAoC,CAAC,CAAA;QAC7F,CAAC;KACF;CACF,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PlanningFacade, PlanningService, PlanningStore } from '@owlmeans/planning';
|
|
2
|
+
/** What a case runs against: a planning service over the store under test. */
|
|
3
|
+
export interface ConformanceSubject {
|
|
4
|
+
/** A service with `planningConformancePlugin` registered and a strictly increasing clock. */
|
|
5
|
+
service: PlanningService;
|
|
6
|
+
/** The store under test — the service's default store. */
|
|
7
|
+
store: PlanningStore;
|
|
8
|
+
/** A facade of one organization, acting as a signed-in person. */
|
|
9
|
+
facade: (entityId: string) => PlanningFacade;
|
|
10
|
+
}
|
|
11
|
+
/** A capability a store may implement; a case that needs one is skipped for a store without it. */
|
|
12
|
+
export type ConformanceCapability = 'schemas' | 'resources';
|
|
13
|
+
export interface ConformanceCase {
|
|
14
|
+
name: string;
|
|
15
|
+
needs?: ConformanceCapability[];
|
|
16
|
+
run: (subject: ConformanceSubject) => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/conformance/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAExF,8EAA8E;AAC9E,MAAM,WAAW,kBAAkB;IACjC,6FAA6F;IAC7F,OAAO,EAAE,eAAe,CAAA;IACxB,0DAA0D;IAC1D,KAAK,EAAE,aAAa,CAAA;IACpB,kEAAkE;IAClE,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,cAAc,CAAA;CAC7C;AAED,mGAAmG;AACnG,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,WAAW,CAAA;AAE3D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,qBAAqB,EAAE,CAAA;IAC/B,GAAG,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACpD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/conformance/types.ts"],"names":[],"mappings":""}
|
package/build/consts.d.ts
CHANGED
|
@@ -15,4 +15,9 @@ export declare const DEFAULT_COMMIT_MEMORY = 1000;
|
|
|
15
15
|
* ladder is what answers when it folded somewhere the hub does not.
|
|
16
16
|
*/
|
|
17
17
|
export declare const COMMIT_POLL_LADDER: readonly number[];
|
|
18
|
+
/**
|
|
19
|
+
* How many resolved schema layers (organization, project) a service keeps. A layer is re-resolved
|
|
20
|
+
* whenever its organization's schema revision moves, so the cap bounds memory, never staleness.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_SCHEMA_VIEWS = 500;
|
|
18
23
|
//# sourceMappingURL=consts.d.ts.map
|
package/build/consts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAEA,+FAA+F;AAC/F,eAAO,MAAM,aAAa,aAAmB,CAAA;AAE7C,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,oBAAoB,CAAA;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,OAAO,CAAA;AAEzC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAAqC,CAAA"}
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAEA,+FAA+F;AAC/F,eAAO,MAAM,aAAa,aAAmB,CAAA;AAE7C,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,oBAAoB,CAAA;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,OAAO,CAAA;AAEzC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAAqC,CAAA;AAErF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,MAAM,CAAA"}
|
package/build/consts.js
CHANGED
|
@@ -16,4 +16,9 @@ export const DEFAULT_COMMIT_MEMORY = 1000;
|
|
|
16
16
|
* ladder is what answers when it folded somewhere the hub does not.
|
|
17
17
|
*/
|
|
18
18
|
export const COMMIT_POLL_LADDER = Object.freeze([250, 1000, 2000]);
|
|
19
|
+
/**
|
|
20
|
+
* How many resolved schema layers (organization, project) a service keeps. A layer is re-resolved
|
|
21
|
+
* whenever its organization's schema revision moves, so the cap bounds memory, never staleness.
|
|
22
|
+
*/
|
|
23
|
+
export const DEFAULT_SCHEMA_VIEWS = 500;
|
|
19
24
|
//# sourceMappingURL=consts.js.map
|
package/build/consts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,+FAA+F;AAC/F,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAgB,CAAA;AAE7C,mEAAmE;AACnE,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAA;AAEnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAA;AAEzC;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAsB,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,+FAA+F;AAC/F,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAgB,CAAA;AAE7C,mEAAmE;AACnE,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAA;AAEnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAA;AAEzC;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAsB,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;AAErF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type PlanningDefinitions, type PlanningFacade } from '@owlmeans/planning';
|
|
2
|
+
import type { PlanningRuntime, SchemaViews, SchemaViewsOptions } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The resolved layers of one planning service, cached per (organization, project) and keyed by the
|
|
5
|
+
* organization's schema revision and the code registry's version — a write anywhere, in any
|
|
6
|
+
* process, moves the revision the next lookup reads, so a cached layer is never served stale. A
|
|
7
|
+
* store that can `watch` evicts an organization's layers as soon as it hears of a write.
|
|
8
|
+
*/
|
|
9
|
+
export declare const makeSchemaViews: (opts: SchemaViewsOptions) => SchemaViews;
|
|
10
|
+
/**
|
|
11
|
+
* The data-defined schema surface of one scoped facade. Every write checks, before anything is
|
|
12
|
+
* stored: the project (a project card this scope can see), the seal of the code registry, the
|
|
13
|
+
* declaration's closed-form checks (a type's flows must resolve in its layer, counting the flows
|
|
14
|
+
* written beside it; a type's and a flow's `app` bag against the application's declarations) — and
|
|
15
|
+
* then writes through the port's compare-and-set.
|
|
16
|
+
*/
|
|
17
|
+
export declare const makeDefinitions: (runtime: PlanningRuntime, facade: PlanningFacade) => PlanningDefinitions;
|
|
18
|
+
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../src/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2L,KAAK,mBAAmB,EAAE,KAAK,cAAc,EAAmP,MAAM,oBAAoB,CAAA;AAG5f,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAKlF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,SAAU,kBAAkB,KAAG,WA0D1D,CAAA;AAUD;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,YAAa,eAAe,UAAU,cAAc,KAAG,mBA8KlF,CAAA"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { cardHelper, PlanningSchemaKind, PlanningUnsupported, SchemaConflict, SchemaInUse, scopedSchemaHelper, UnknownStatusFlow, UnknownWorkcardType, WorkcardNotFound } from '@owlmeans/planning';
|
|
2
|
+
import { DEFAULT_SCHEMA_VIEWS } from './consts.js';
|
|
3
|
+
import { changesUtils } from './executor/changes.js';
|
|
4
|
+
const isoNow = () => new Date().toISOString();
|
|
5
|
+
/**
|
|
6
|
+
* The resolved layers of one planning service, cached per (organization, project) and keyed by the
|
|
7
|
+
* organization's schema revision and the code registry's version — a write anywhere, in any
|
|
8
|
+
* process, moves the revision the next lookup reads, so a cached layer is never served stale. A
|
|
9
|
+
* store that can `watch` evicts an organization's layers as soon as it hears of a write.
|
|
10
|
+
*/
|
|
11
|
+
export const makeSchemaViews = (opts) => {
|
|
12
|
+
const limit = opts.limit ?? DEFAULT_SCHEMA_VIEWS;
|
|
13
|
+
const cache = new Map();
|
|
14
|
+
let watching;
|
|
15
|
+
const keyOf = (entityId, project) => `${entityId}\u0000${project ?? ''}`;
|
|
16
|
+
const evict = (entityId) => {
|
|
17
|
+
const prefix = `${entityId}\u0000`;
|
|
18
|
+
for (const key of [...cache.keys()]) {
|
|
19
|
+
if (key.startsWith(prefix)) {
|
|
20
|
+
cache.delete(key);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const scoped = async (entityId, project) => {
|
|
25
|
+
const store = opts.port();
|
|
26
|
+
if (store == null) {
|
|
27
|
+
throw new PlanningUnsupported('schemas');
|
|
28
|
+
}
|
|
29
|
+
if (store.watch != null && watching?.store !== store) {
|
|
30
|
+
watching?.release();
|
|
31
|
+
watching = { store, release: store.watch(evict) };
|
|
32
|
+
}
|
|
33
|
+
const revision = await store.revision(entityId);
|
|
34
|
+
const version = opts.version();
|
|
35
|
+
const key = keyOf(entityId, project);
|
|
36
|
+
const hit = cache.get(key);
|
|
37
|
+
if (hit != null && hit.revision === revision && hit.version === version) {
|
|
38
|
+
cache.delete(key);
|
|
39
|
+
cache.set(key, hit);
|
|
40
|
+
return hit.view;
|
|
41
|
+
}
|
|
42
|
+
const records = [
|
|
43
|
+
...await store.list({ entityId, project: null }),
|
|
44
|
+
...(project != null ? await store.list({ entityId, project }) : []),
|
|
45
|
+
];
|
|
46
|
+
const view = scopedSchemaHelper.scopedRegistryOf(scopedSchemaHelper.resolveScopedBundle(opts.code().bundle(), records, { entityId, project, revision }));
|
|
47
|
+
cache.delete(key);
|
|
48
|
+
cache.set(key, { revision, version, view });
|
|
49
|
+
while (cache.size > limit) {
|
|
50
|
+
const oldest = cache.keys().next().value;
|
|
51
|
+
if (oldest == null) {
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
cache.delete(oldest);
|
|
55
|
+
}
|
|
56
|
+
return view;
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
of: async (entityId, project) => opts.port() == null ? opts.code() : await scoped(entityId, project),
|
|
60
|
+
scoped,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
const planOf = (declarations) => [
|
|
64
|
+
...(declarations.assigneeTypes ?? []).map(schema => ({ kind: PlanningSchemaKind.AssigneeType, key: schema.type, definition: schema })),
|
|
65
|
+
...(declarations.flows ?? []).map(flow => ({ kind: PlanningSchemaKind.Flow, key: flow.id, definition: flow })),
|
|
66
|
+
...(declarations.types ?? []).map(type => ({ kind: PlanningSchemaKind.Type, key: type.type, definition: type })),
|
|
67
|
+
];
|
|
68
|
+
const layerKey = (kind, key) => `${kind}:${key}`;
|
|
69
|
+
/**
|
|
70
|
+
* The data-defined schema surface of one scoped facade. Every write checks, before anything is
|
|
71
|
+
* stored: the project (a project card this scope can see), the seal of the code registry, the
|
|
72
|
+
* declaration's closed-form checks (a type's flows must resolve in its layer, counting the flows
|
|
73
|
+
* written beside it; a type's and a flow's `app` bag against the application's declarations) — and
|
|
74
|
+
* then writes through the port's compare-and-set.
|
|
75
|
+
*/
|
|
76
|
+
export const makeDefinitions = (runtime, facade) => {
|
|
77
|
+
const scope = facade.scope;
|
|
78
|
+
const entityId = scope.entityId;
|
|
79
|
+
const now = runtime.options.now ?? isoNow;
|
|
80
|
+
const port = () => {
|
|
81
|
+
const store = runtime.schemaStore();
|
|
82
|
+
if (store == null) {
|
|
83
|
+
throw new PlanningUnsupported('schemas');
|
|
84
|
+
}
|
|
85
|
+
return store;
|
|
86
|
+
};
|
|
87
|
+
const visible = async (project) => scope.projects == null || await facade.cards.load(project) != null;
|
|
88
|
+
/** @throws {WorkcardNotFound} for anything but a project card this scope can see */
|
|
89
|
+
const assertProject = async (project) => {
|
|
90
|
+
if (project == null) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const card = await facade.cards.load(project);
|
|
94
|
+
if (card == null || !cardHelper.isProject(card)) {
|
|
95
|
+
throw new WorkcardNotFound(project);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const layerOf = async (project) => new Map((await port().list({ entityId, project: project ?? null }))
|
|
99
|
+
.map(record => [layerKey(record.kind, record.key), record]));
|
|
100
|
+
/** Seal and closed-form checks for everything in the plan — nothing is written when one fails. */
|
|
101
|
+
const validate = async (plan, project) => {
|
|
102
|
+
const code = runtime.service().schemas;
|
|
103
|
+
const app = code.app();
|
|
104
|
+
const layer = await runtime.scopedSchemas(entityId, project);
|
|
105
|
+
const pending = new Map(plan.filter(entry => entry.kind === PlanningSchemaKind.Flow)
|
|
106
|
+
.map(entry => [entry.key, entry.definition]));
|
|
107
|
+
const flows = { flow: id => pending.get(id) ?? layer.flow(id) };
|
|
108
|
+
for (const entry of plan) {
|
|
109
|
+
scopedSchemaHelper.assertOverridable(code, entry.kind, entry.key);
|
|
110
|
+
if (entry.kind === PlanningSchemaKind.AssigneeType) {
|
|
111
|
+
if (project != null)
|
|
112
|
+
throw new PlanningUnsupported('assignee-schema:project-layer');
|
|
113
|
+
scopedSchemaHelper.assertAssigneeTypeSchema(entry.definition);
|
|
114
|
+
}
|
|
115
|
+
else if (entry.kind === PlanningSchemaKind.Flow) {
|
|
116
|
+
scopedSchemaHelper.assertFlowSchema(entry.definition, app);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
scopedSchemaHelper.assertTypeSchema(entry.definition, flows, app);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const recordOf = (entry, version, project, current, retired) => {
|
|
124
|
+
const at = now();
|
|
125
|
+
const by = changesUtils.actorOf(scope, {});
|
|
126
|
+
return Object.fromEntries(Object.entries({
|
|
127
|
+
entityId,
|
|
128
|
+
project,
|
|
129
|
+
kind: entry.kind,
|
|
130
|
+
key: entry.key,
|
|
131
|
+
version,
|
|
132
|
+
definition: { ...structuredClone(entry.definition), version },
|
|
133
|
+
retired: retired === true ? true : undefined,
|
|
134
|
+
createdAt: current?.createdAt ?? at,
|
|
135
|
+
updatedAt: current != null ? at : undefined,
|
|
136
|
+
by: Object.keys(by).length > 0 ? by : undefined,
|
|
137
|
+
}).filter(([, value]) => value !== undefined));
|
|
138
|
+
};
|
|
139
|
+
const unit = async (run) => {
|
|
140
|
+
const store = runtime.service().store();
|
|
141
|
+
return store.unit != null ? await store.unit(entityId, run) : await run();
|
|
142
|
+
};
|
|
143
|
+
const write = async (plan, opts, versionOf) => await unit(async () => {
|
|
144
|
+
await assertProject(opts?.project);
|
|
145
|
+
const layer = await layerOf(opts?.project);
|
|
146
|
+
const todo = plan
|
|
147
|
+
.map(entry => ({ entry, current: layer.get(layerKey(entry.kind, entry.key)) }))
|
|
148
|
+
.map(item => ({ ...item, version: versionOf(item.entry, item.current) }))
|
|
149
|
+
.filter((item) => item.version != null);
|
|
150
|
+
await validate(todo.map(item => item.entry), opts?.project);
|
|
151
|
+
const written = [];
|
|
152
|
+
for (const item of todo) {
|
|
153
|
+
written.push(await port().put(recordOf(item.entry, item.version, opts?.project, item.current)));
|
|
154
|
+
}
|
|
155
|
+
return written;
|
|
156
|
+
});
|
|
157
|
+
const put = async (entry, opts) => (await write([entry], opts, () => entry.definition.version))[0];
|
|
158
|
+
const definitions = {
|
|
159
|
+
bundle: async (project) => {
|
|
160
|
+
await assertProject(project);
|
|
161
|
+
return (await runtime.scopedSchemas(entityId, project)).bundle();
|
|
162
|
+
},
|
|
163
|
+
registry: async (project) => {
|
|
164
|
+
await assertProject(project);
|
|
165
|
+
return await runtime.scopedSchemas(entityId, project);
|
|
166
|
+
},
|
|
167
|
+
records: async (opts) => {
|
|
168
|
+
if (typeof opts?.project === 'string' && !await visible(opts.project)) {
|
|
169
|
+
return [];
|
|
170
|
+
}
|
|
171
|
+
const records = await port().list(Object.fromEntries(Object.entries({
|
|
172
|
+
entityId, project: opts?.project, kind: opts?.kind, retired: opts?.retired,
|
|
173
|
+
}).filter(([, value]) => value !== undefined)));
|
|
174
|
+
const allowed = await Promise.all(records.map(async (record) => record.project == null || await visible(record.project)));
|
|
175
|
+
return records.filter((_record, index) => allowed[index]);
|
|
176
|
+
},
|
|
177
|
+
putAssigneeType: async (schema) => await put({ kind: PlanningSchemaKind.AssigneeType, key: schema.type, definition: schema }),
|
|
178
|
+
putType: async (type, opts) => await put({ kind: PlanningSchemaKind.Type, key: type.type, definition: type }, opts),
|
|
179
|
+
putFlow: async (flow, opts) => await put({ kind: PlanningSchemaKind.Flow, key: flow.id, definition: flow }, opts),
|
|
180
|
+
define: async (declarations, opts) => await write(planOf(declarations), opts, (_, current) => (current?.version ?? 0) + 1),
|
|
181
|
+
seed: async (declarations, opts) => {
|
|
182
|
+
const written = [];
|
|
183
|
+
try {
|
|
184
|
+
written.push(...await write(planOf(declarations), opts, (_, current) => current == null ? 1 : null));
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
if (!(error instanceof SchemaConflict)) {
|
|
188
|
+
throw error;
|
|
189
|
+
}
|
|
190
|
+
// A concurrent seed wrote a key first; what is left is still only what the layer lacks.
|
|
191
|
+
written.push(...await write(planOf(declarations), opts, (_, current) => current == null ? 1 : null));
|
|
192
|
+
}
|
|
193
|
+
return written;
|
|
194
|
+
},
|
|
195
|
+
retire: async (kind, key, opts) => await unit(async () => {
|
|
196
|
+
await assertProject(opts?.project);
|
|
197
|
+
const current = (await layerOf(opts?.project)).get(layerKey(kind, key));
|
|
198
|
+
if (current == null) {
|
|
199
|
+
throw kind === PlanningSchemaKind.Type ? new UnknownWorkcardType(key) : new UnknownStatusFlow(key);
|
|
200
|
+
}
|
|
201
|
+
if (current.retired === true) {
|
|
202
|
+
return current;
|
|
203
|
+
}
|
|
204
|
+
const retiring = recordOf({ kind, key, definition: current.definition }, current.version + 1, opts?.project, current, true);
|
|
205
|
+
if (kind === PlanningSchemaKind.Flow) {
|
|
206
|
+
const code = runtime.service().schemas.bundle();
|
|
207
|
+
const all = (await port().list({ entityId }))
|
|
208
|
+
.map(record => record.kind === kind && record.key === key && record.project === current.project ? retiring : record);
|
|
209
|
+
// The organization's layer reaches every project; a project's reaches itself alone.
|
|
210
|
+
const projects = opts?.project != null
|
|
211
|
+
? [opts.project]
|
|
212
|
+
: [undefined, ...new Set(all.map(record => record.project).filter((id) => id != null))];
|
|
213
|
+
for (const project of projects) {
|
|
214
|
+
const user = scopedSchemaHelper.flowInUse(scopedSchemaHelper.resolveScopedBundle(code, all, { entityId, project }), key);
|
|
215
|
+
if (user != null) {
|
|
216
|
+
throw new SchemaInUse(`flow:${key}:type:${user}${project != null ? `:project:${project}` : ''}`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return await port().put(retiring);
|
|
221
|
+
}),
|
|
222
|
+
};
|
|
223
|
+
return definitions;
|
|
224
|
+
};
|
|
225
|
+
//# sourceMappingURL=definitions.js.map
|