@owlmeans/server-planning 0.1.18-rc.21 → 0.1.18-rc.22
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 +24 -17
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/server-planning/SKILL.md +28 -28
- 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 +31 -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 +8 -28
- package/build/actions/execute.d.ts.map +1 -1
- package/build/actions/execute.js +17 -101
- 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 +79 -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/{specs.d.ts → list-specification-revisions.d.ts} +1 -3
- 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/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 +5 -3
- package/build/actions/types.d.ts.map +1 -1
- package/build/actions/watch.d.ts +2 -2
- package/build/actions/watch.d.ts.map +1 -1
- package/build/actions/watch.js +2 -2
- 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 +8 -13
- package/build/conformance/assert.d.ts.map +1 -1
- package/build/conformance/assert.js +41 -43
- package/build/conformance/assert.js.map +1 -1
- package/build/conformance/cases.d.ts.map +1 -1
- package/build/conformance/cases.js +86 -67
- package/build/conformance/cases.js.map +1 -1
- 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 +3 -1
- package/build/conformance/consts.d.ts.map +1 -1
- package/build/conformance/consts.js +84 -1
- package/build/conformance/consts.js.map +1 -1
- 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 +8 -8
- package/build/conformance/fixtures.d.ts.map +1 -1
- package/build/conformance/fixtures.js +24 -107
- package/build/conformance/fixtures.js.map +1 -1
- package/build/conformance/index.d.ts +3 -0
- package/build/conformance/index.d.ts.map +1 -1
- package/build/conformance/index.js +1 -0
- package/build/conformance/index.js.map +1 -1
- package/build/definitions.d.ts.map +1 -1
- package/build/definitions.js +9 -9
- package/build/definitions.js.map +1 -1
- 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/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 +6 -25
- package/build/executor/creator.d.ts.map +1 -1
- package/build/executor/creator.js +26 -41
- package/build/executor/creator.js.map +1 -1
- 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 +4 -41
- package/build/executor/resolve.d.ts.map +1 -1
- package/build/executor/resolve.js +142 -157
- package/build/executor/resolve.js.map +1 -1
- package/build/executor/types.d.ts +0 -2
- package/build/executor/types.d.ts.map +1 -1
- package/build/executor/validate.d.ts +1 -1
- package/build/executor/validate.d.ts.map +1 -1
- package/build/executor/validate.js +16 -15
- package/build/executor/validate.js.map +1 -1
- package/build/executor.d.ts +4 -3
- package/build/executor.d.ts.map +1 -1
- package/build/executor.js +18 -17
- package/build/executor.js.map +1 -1
- package/build/facade.d.ts.map +1 -1
- package/build/facade.js +16 -16
- package/build/facade.js.map +1 -1
- package/build/helper.d.ts +1 -6
- package/build/helper.d.ts.map +1 -1
- package/build/helper.js +3 -8
- package/build/helper.js.map +1 -1
- package/build/projection.d.ts +2 -0
- package/build/projection.d.ts.map +1 -1
- package/build/projection.js +6 -4
- package/build/projection.js.map +1 -1
- 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 +1 -4
- package/build/queue/index.d.ts.map +1 -1
- package/build/queue/index.js +1 -4
- package/build/queue/index.js.map +1 -1
- package/build/store/composite.d.ts.map +1 -1
- package/build/store/composite.js +2 -2
- package/build/store/composite.js.map +1 -1
- 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 +7 -30
- package/build/store/fold.d.ts.map +1 -1
- package/build/store/fold.js +185 -203
- 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.map +1 -1
- package/build/store/memory.js +0 -0
- package/build/store/memory.js.map +1 -1
- package/build/store/types.local.d.ts +3 -1
- package/build/store/types.local.d.ts.map +1 -1
- package/build/types.d.ts +2 -1
- package/build/types.d.ts.map +1 -1
- 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 +21 -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 +33 -31
- 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 -1
- 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 +10 -43
- package/build/utils/scope.d.ts.map +1 -1
- package/build/utils/scope.js +21 -99
- package/build/utils/scope.js.map +1 -1
- package/package.json +18 -18
- package/src/actions/apply-schema-request.ts +35 -0
- package/src/actions/commit.ts +7 -5
- package/src/actions/define-schemas.ts +34 -0
- package/src/actions/execute.ts +30 -115
- package/src/actions/execution/types.ts +34 -0
- package/src/actions/execution.ts +96 -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/{specs.ts → list-specification-revisions.ts} +4 -11
- package/src/actions/summarize-cards.ts +15 -0
- package/src/actions/transitions.ts +6 -4
- package/src/actions/types.ts +4 -3
- package/src/actions/watch.ts +4 -3
- package/src/conformance/assert/types.ts +16 -0
- package/src/conformance/assert.ts +49 -41
- package/src/conformance/cases.ts +88 -67
- package/src/conformance/clock.ts +11 -0
- package/src/conformance/consts.ts +87 -1
- package/src/conformance/errors.ts +7 -0
- package/src/conformance/fixtures/types.ts +11 -0
- package/src/conformance/fixtures.ts +32 -107
- package/src/conformance/index.ts +3 -0
- package/src/definitions.ts +9 -9
- package/src/executor/changes/types.ts +38 -0
- package/src/executor/changes.ts +48 -63
- package/src/executor/code/types.ts +23 -0
- package/src/executor/code.ts +60 -61
- package/src/executor/creator/types.ts +33 -0
- package/src/executor/creator.ts +33 -41
- package/src/executor/resolve/types.ts +30 -0
- package/src/executor/resolve.ts +153 -167
- package/src/executor/types.ts +0 -3
- package/src/executor/validate.ts +17 -16
- package/src/executor.ts +20 -17
- package/src/facade.ts +16 -16
- package/src/helper.ts +3 -8
- package/src/projection.ts +8 -4
- package/src/queue/declare.ts +7 -0
- package/src/queue/index.ts +1 -8
- package/src/store/composite.ts +2 -2
- package/src/store/fold/types.ts +44 -0
- package/src/store/fold.ts +209 -212
- package/src/store/index.ts +1 -0
- package/src/store/memory.ts +0 -0
- package/src/store/types.local.ts +1 -1
- package/src/types.ts +1 -1
- package/src/utils/access/types.ts +30 -0
- package/src/utils/access.ts +33 -0
- package/src/utils/guard/types.ts +19 -0
- package/src/utils/guard.ts +41 -30
- package/src/utils/handler/types.ts +28 -0
- package/src/utils/handler.ts +35 -0
- package/src/utils/index.ts +9 -1
- package/src/utils/request/types.ts +23 -0
- package/src/utils/request.ts +40 -0
- package/src/utils/scope.ts +25 -108
- package/tests/creator.spec.ts +18 -18
- package/build/actions/cards.d.ts +0 -14
- 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 -28
- package/build/actions/schemas.d.ts.map +0 -1
- package/build/actions/schemas.js +0 -69
- package/build/actions/schemas.js.map +0 -1
- 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 -48
- package/src/actions/schemas.ts +0 -87
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ the `@owlmeans/server-planning/store` subpath.
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
12
12
|
```sh
|
|
13
|
-
bun add @owlmeans/server-planning@^0.1.18-rc.
|
|
13
|
+
bun add @owlmeans/server-planning@^0.1.18-rc.22 @owlmeans/planning@^0.1.18-rc.19 ajv
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Concepts
|
|
@@ -93,39 +93,46 @@ ensurePlanningService(context).use({
|
|
|
93
93
|
Hand-written handler and the memory store in a test:
|
|
94
94
|
|
|
95
95
|
```ts
|
|
96
|
-
import { appendPlanningService,
|
|
96
|
+
import { appendPlanningService, planningHandlerOf } from '@owlmeans/server-planning'
|
|
97
97
|
import { makeMemoryPlanningStore } from '@owlmeans/server-planning/store'
|
|
98
98
|
|
|
99
99
|
appendPlanningService(testContext, { store: makeMemoryPlanningStore({ sync: false }), plugins: [fixtures] })
|
|
100
|
-
const cards = await planningFor(
|
|
100
|
+
const cards = await planningHandlerOf(ctx).planningFor(req, { channel: 'web' }).cards.list({ parent: projectId })
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
## API
|
|
104
104
|
|
|
105
105
|
- Service: `appendPlanningService`, `ensurePlanningService`, `makePlanningService`,
|
|
106
106
|
`planningServiceApi`, `makePluginRegistry`, `makeStoreFacade`, `executeTransition`,
|
|
107
|
-
`creatorOf`, `withCreator`, `assertCreatorFixed
|
|
107
|
+
`creatorHelper` (`creatorOf`, `withCreator`, `assertCreatorFixed`), `PlanningServiceOptions`, `PlanningHostService`,
|
|
108
108
|
`PlanningRuntime`, `PluginRegistry`
|
|
109
|
-
- Handlers: `servePlanningEntrypoints`, `
|
|
109
|
+
- Handlers (one per file under `actions/`): `servePlanningEntrypoints`, `listSchemas`, `listCards`,
|
|
110
110
|
`summarizeCards`, `getCard`, `listCardTransitions`, `listCardSpecifications`, `getSpecification`,
|
|
111
|
-
`listSpecificationRevisions`, `listLinks`, `getTransition`, `executePlanning`, `
|
|
112
|
-
`
|
|
113
|
-
`
|
|
114
|
-
`
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
`listSpecificationRevisions`, `listLinks`, `getTransition`, `executePlanning`, `getCommit`,
|
|
112
|
+
`watchCommits`, `defineSchemas`, `applySchemaRequest`; `executionHelper` (`wireExecution`,
|
|
113
|
+
`executeOptionsOf`, `assertExecutionWrites`, `assertExecutionGranted`); `PlanningHandlerOptions`,
|
|
114
|
+
`PlanningScopeExtractor`, `PlanningAccessResolver`, `PlanningAccess`, `PlanningAccessGrants`,
|
|
115
|
+
`PlanningGrant`
|
|
116
|
+
- Scope: `planningHandlerOf(ctx)` (`planningServiceOf`, `handlerScopeOf`, `handlerFacade`,
|
|
117
|
+
`planningFor`), `makeRequestScope(req)` (`scopeOf`, `accessScopeOf`, `actorOf`),
|
|
118
|
+
`makePlanningAccessModel(access)` (`assertGranted`, `writableIn`, `assertWrites`), `guardHelper`
|
|
119
|
+
(`concealed`, `assertScope`, `notFoundOf`, `clampSeconds`), `projectCriteriaOf`
|
|
117
120
|
- Data-defined schemas: `makeDefinitions`, `makeSchemaViews`, `SchemaViews`, `SchemaViewsOptions`
|
|
118
|
-
- Projection: `makeProjectionProcessor`, `
|
|
121
|
+
- Projection: `makeProjectionProcessor`, `makePlanningQueueHooks`, `ProjectionOptions`
|
|
119
122
|
- Constants: `DEFAULT_ALIAS`, `MEMORY_STORE_ALIAS`, `DEFAULT_COMMIT_MEMORY`, `COMMIT_POLL_LADDER`,
|
|
120
123
|
`DEFAULT_SCHEMA_VIEWS`
|
|
121
|
-
- `@owlmeans/server-planning/store`: `makeMemoryPlanningStore`, `
|
|
122
|
-
`revisionsFromLog`, `commitEventOf
|
|
124
|
+
- `@owlmeans/server-planning/store`: `makeMemoryPlanningStore`, `foldHelper` (`foldPending`,
|
|
125
|
+
`failPending`, `revisionsFromLog`, `commitEventOf`), `makeCommitHub`, `makeCompositeStore`,
|
|
126
|
+
`wantsSpecifications`,
|
|
123
127
|
and the types `BindablePlanningStore`, `CommitListener`, `CommitHub`, `CommitHubOptions`,
|
|
124
128
|
`FoldOptions`, `FoldResult`, `MemoryPlanningStore`, `MemoryPlanningStoreOptions`, `StoreRoute`
|
|
125
129
|
- `@owlmeans/server-planning/conformance`: `planningConformance`, `conformanceCasesFor`,
|
|
126
|
-
`planningConformancePlugin`, `conformanceClock`, `ConformanceFailure`, `
|
|
127
|
-
`sameSet`, `rejects
|
|
130
|
+
`planningConformancePlugin`, `conformanceClock`, `ConformanceFailure`, `assertHelper` (`check`,
|
|
131
|
+
`same`, `sameSet`, `rejects`), the library fixtures (`LIBRARY`, `conformanceFixturesOf(facade)` —
|
|
132
|
+
`createBranch`, `createBook`, `transit`)
|
|
128
133
|
and the types `ConformanceCase`, `ConformanceSubject`, `ConformanceCapability`
|
|
134
|
+
- The former plain functions (`planningFor`, `foldPending`, `creatorOf`, `scopeOf`, `concealed`,
|
|
135
|
+
`planningQueueHooks`, `check`, `createBranch`, …) remain as deprecated delegates.
|
|
129
136
|
|
|
130
137
|
## Common pitfalls
|
|
131
138
|
|
|
@@ -169,7 +176,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
169
176
|
your project's skill store (`.agents/skills/`):
|
|
170
177
|
|
|
171
178
|
```sh
|
|
172
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
179
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.49
|
|
173
180
|
```
|
|
174
181
|
|
|
175
182
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/server-planning",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-10-
|
|
4
|
+
"version": "0.1.18-rc.22",
|
|
5
|
+
"generatedAt": "2026-10-05T21:03:06.363Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -8,12 +8,12 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/server-planning
|
|
9
9
|
|
|
10
10
|
**Layer:** Server
|
|
11
|
-
**Install:** `"@owlmeans/server-planning": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/server-planning": "^0.1.18-rc.22"` in `dependencies` (`ajv` is a peer)
|
|
12
12
|
|
|
13
13
|
The general implementation of `@owlmeans/planning`: the planning service (a plugin host), the
|
|
14
14
|
scoped facade, the executor every write goes through, the in-memory reference store, the commit
|
|
15
15
|
hub and the protocol handlers. It holds no database code — a durable store implements the ports and
|
|
16
|
-
reuses the `./store` subpath (`foldPending`, `makeCommitHub`) without pulling fastify in.
|
|
16
|
+
reuses the `./store` subpath (`foldHelper.foldPending`, `makeCommitHub`) without pulling fastify in.
|
|
17
17
|
|
|
18
18
|
## Key exports
|
|
19
19
|
|
|
@@ -24,17 +24,17 @@ reuses the `./store` subpath (`foldPending`, `makeCommitHub`) without pulling fa
|
|
|
24
24
|
| `makePlanningService(opts?, alias?)`, `planningServiceApi(opts, self)` | The service, and its body for a specialised service |
|
|
25
25
|
| `PlanningServiceOptions` | `{ store?, plugins?, schemas?, hooks?, ids?, now? }` |
|
|
26
26
|
| `makePluginRegistry`, `makeStoreFacade`, `executeTransition` | The pieces the service is made of |
|
|
27
|
-
| `creatorOf(scope)`,
|
|
27
|
+
| `creatorHelper` — `.creatorOf(scope)`, `.withCreator(exec, scope)`, `.assertCreatorFixed(exec)` | The subject a create is stamped with as `createdBy`, the defaulting the executor applies, and its refusal of any later move |
|
|
28
28
|
| `servePlanningEntrypoints(protocols, opts?)` | One binding per protocol of a `makePlanningProtocols` tree (`schema.define` too when declared) |
|
|
29
|
-
| `planningFor(
|
|
29
|
+
| `planningHandlerOf(ctx).planningFor(req, extra?)` | The request-scoped facade for a hand-written handler |
|
|
30
30
|
| `PlanningHandlerOptions` | `{ service?, event?, maxPoll?, scope?(req, ctx), access?(req, ctx) }` |
|
|
31
31
|
| `PlanningAccessResolver`, `PlanningAccess`, `PlanningAccessGrants`, `PlanningGrant` | The optional access decision a hosting app supplies |
|
|
32
32
|
| `listCards` … `executePlanning`, `getCommit`, `watchCommits`, `listSchemas`, `defineSchemas`, `applySchemaRequest` | The handlers, to bind one by hand |
|
|
33
|
-
| `
|
|
33
|
+
| `makeRequestScope(req)` — `.scopeOf(extra?)`, `.accessScopeOf(access, extra?)`, `.actorOf()`; `planningHandlerOf(ctx).handlerScopeOf`; `makePlanningAccessModel(access)` — `.assertGranted`, `.assertWrites`, `.writableIn`; `executionHelper` — `.assertExecutionGranted`, `.assertExecutionWrites`; `guardHelper` — `.concealed(run)`, `.clampSeconds` | Scope and security helpers |
|
|
34
34
|
| `makeDefinitions(runtime, facade)`, `makeSchemaViews(opts)`, `projectCriteriaOf(projects, through?)` | Data-defined schemas and the project narrowing |
|
|
35
|
-
| `makeProjectionProcessor(ctx, opts?)`, `
|
|
35
|
+
| `makeProjectionProcessor(ctx, opts?)`, `makePlanningQueueHooks(ctx, opts?)` | A generic projection job body and its `onJobDead` |
|
|
36
36
|
| `./queue`: `declarePlanningQueue(cfg, opts?)`, `PLANNING_PROJECTION_QUEUE` (`planning-projection`), `PLANNING_PROJECT_JOB` (`planning:project`), `ProjectionRequest` | The projection queue's shared address; each process chooses separately whether to listen |
|
|
37
|
-
| `./store`: `makeMemoryPlanningStore`, `foldPending`,
|
|
37
|
+
| `./store`: `makeMemoryPlanningStore`, `foldHelper` (`.foldPending`, `.failPending`, `.revisionsFromLog`, `.commitEventOf`), `makeCommitHub`, `makeCompositeStore`, `wantsSpecifications` | What stores are built from |
|
|
38
38
|
| `./conformance`: `planningConformance`, `conformanceCasesFor`, `planningConformancePlugin`, `conformanceClock`, `ConformanceFailure` | The store conformance suite, runner-agnostic |
|
|
39
39
|
|
|
40
40
|
## Wiring
|
|
@@ -69,7 +69,7 @@ context.registerEntrypoints(servePlanningEntrypoints(planningProtocols, {
|
|
|
69
69
|
/ `appendPostgresPlanning` install (typed `WithPlanningService`); a context that registered
|
|
70
70
|
`makePlanningService()` / `makePostgresPlanningService()` as a plain service — a generated target's
|
|
71
71
|
`services/planning.ts` — has no `ctx.planning` at all. In a request handler use
|
|
72
|
-
`planningFor(
|
|
72
|
+
`planningHandlerOf(ctx).planningFor(req)`: the entity comes from `makeEntityScope(req).requireEntityKey()`, never the token.
|
|
73
73
|
|
|
74
74
|
## Creating and reading a card
|
|
75
75
|
|
|
@@ -131,7 +131,7 @@ wrong form as written.
|
|
|
131
131
|
Nothing is appended before step 11 — every refusal leaves the log untouched.
|
|
132
132
|
|
|
133
133
|
1. **Normalize** — deep copy, trimmed text, `parents ∋ parent` (first); a create's draft without
|
|
134
|
-
`createdBy` gets `creatorOf(scope)` (below).
|
|
134
|
+
`createdBy` gets `creatorHelper.creatorOf(scope)` (below).
|
|
135
135
|
2. **Scope** — `entityId` must be present.
|
|
136
136
|
3. **Idempotency** — a `key` already in the entity's log answers ITS receipt, before any
|
|
137
137
|
validation or middleware.
|
|
@@ -145,14 +145,14 @@ Nothing is appended before step 11 — every refusal leaves the log untouched.
|
|
|
145
145
|
(`UnknownWorkcardType('retired:…')`). Without the port `Resolved.schemas` IS the code registry.
|
|
146
146
|
5. **`before` chain** — in plugin order; re-resolved once when it changed the card, type or parent.
|
|
147
147
|
6. **Validate** — shape (`planning:malformed:*`), the flow rule (`IllegalTransition`), immutables
|
|
148
|
-
(`planning:immutable:*`, `createdBy` among them — `assertCreatorFixed`), merged `fields` (`FieldsInvalid`), labels (`LabelNotAllowed`), a moved
|
|
148
|
+
(`planning:immutable:*`, `createdBy` among them — `creatorHelper.assertCreatorFixed`), merged `fields` (`FieldsInvalid`), labels (`LabelNotAllowed`), a moved
|
|
149
149
|
parent, the slot (`SpecificationSlotUnknown`, `SpecificationRevisionConflict`, JSON body schema
|
|
150
150
|
→ `FieldsInvalid`), relationships (`RelationshipRefused`: undeclared type, `from` not the card,
|
|
151
151
|
missing target, type constraints, `single`, unlinking an absent edge).
|
|
152
|
-
7. **Card id** — `store.newId?.() ?? options.ids?.() ?? uuid()`. Ids are the store's.
|
|
152
|
+
7. **Card id** — `store.newId?.() ?? options.ids?.() ?? idHelper.uuid()`. Ids are the store's.
|
|
153
153
|
8. **Code** — a supplied code is checked; else the plugins' `mintCode` (first answer wins, checked);
|
|
154
154
|
else the type's `CodePolicy` (a slug policy derives from the title) → `CodeTaken`.
|
|
155
|
-
9. **Changes** — `computeChanges`. An `update` that changes nothing answers the card's latest
|
|
155
|
+
9. **Changes** — `changesHelper.computeChanges`. An `update` that changes nothing answers the card's latest
|
|
156
156
|
receipt and appends nothing.
|
|
157
157
|
10. **Seq** — `transitions.nextSeq(card, expectSeq)`, a CAS against `head` (`WorkcardConflict`).
|
|
158
158
|
11. **Append** — `commit: pending`. A lost race on the key answers the winner's receipt.
|
|
@@ -163,14 +163,14 @@ Nothing is appended before step 11 — every refusal leaves the log untouched.
|
|
|
163
163
|
`actor` is the SCOPE's: `profileId`/`userId`/`service`/`channel` come from the scope only; an
|
|
164
164
|
in-process caller may add `agent`/`runId` on the execution. A handler never passes a wire `actor`.
|
|
165
165
|
|
|
166
|
-
A create's `createdBy` is the scope's subject too — `creatorOf(scope)`: `profileId`, else `userId`,
|
|
166
|
+
A create's `createdBy` is the scope's subject too — `creatorHelper.creatorOf(scope)`: `profileId`, else `userId`,
|
|
167
167
|
else the same two of `scope.actor`. The executor stamps it on every path, so an in-process facade
|
|
168
168
|
create and the HTTP `execute` produce the same owner. An in-process draft that names `createdBy`
|
|
169
169
|
keeps it (explicit wins — a manager creating on someone's behalf); a scope naming nobody (a service
|
|
170
170
|
or system scope) leaves it unset; the wire drops a draft's `createdBy` before the stamp.
|
|
171
171
|
|
|
172
172
|
`createdBy` never moves after the create (the rule is `planning` → The record model). The executor
|
|
173
|
-
enforces it itself with `assertCreatorFixed` at step 6, after the `before` chain, so a wire body, an
|
|
173
|
+
enforces it itself with `creatorHelper.assertCreatorFixed` at step 6, after the `before` chain, so a wire body, an
|
|
174
174
|
in-process caller and a plugin are refused alike, whatever `@owlmeans/planning` build the host
|
|
175
175
|
resolves. The conformance suite checks a store folds a stored row naming it as the pure fold does.
|
|
176
176
|
|
|
@@ -230,8 +230,8 @@ the store; `bind` replaces the listener, so a store has exactly one.
|
|
|
230
230
|
answers the id format the host's references need (ObjectId hex for Mongo).
|
|
231
231
|
- `transitions.list` treats `sinceSeq` as `seq > sinceSeq`; `nextSeq` is the CAS against `head` and
|
|
232
232
|
answers 1 for a card that has no log.
|
|
233
|
-
- The projection body is `foldPending(store, cardId, entityId, { onCommitted, publish, touch, limit })`:
|
|
234
|
-
it applies pending transitions with `applyTransition` only, marks each committed or failed,
|
|
233
|
+
- The projection body is `foldHelper.foldPending(store, cardId, entityId, { onCommitted, publish, touch, limit })`:
|
|
234
|
+
it applies pending transitions with `applyHelper.applyTransition` only, marks each committed or failed,
|
|
235
235
|
publishes, then runs `onCommitted`. The caller owns single flight per card. Strip `record` from
|
|
236
236
|
the event before a cross-process bus.
|
|
237
237
|
- **A failed transition never blocks the card.** The fold marks it `failed`, publishes a failed
|
|
@@ -239,14 +239,14 @@ the store; `bind` replaces the listener, so a store has exactly one.
|
|
|
239
239
|
it was, and the next transition folds normally. Without that, every later transition fails as
|
|
240
240
|
out of order and the card is stuck for good. Only two cases stop short: a failed `create` leaves
|
|
241
241
|
no card to advance, and a store that refuses the advancing write stops the fold with `followUp`,
|
|
242
|
-
leaving the rest pending for a retry. `revisionsFromLog` replays past failed transitions the same
|
|
242
|
+
leaving the rest pending for a retry. `foldHelper.revisionsFromLog` replays past failed transitions the same
|
|
243
243
|
way.
|
|
244
244
|
- A transactional store passes `FoldOptions.unit` — it wraps each transition's writes (a
|
|
245
245
|
savepoint), so a write the database refuses is undone whole and the fold marks that transition
|
|
246
|
-
failed and goes past it. `foldPending` folds PAST a failure it produces; a row that is ALREADY
|
|
246
|
+
failed and goes past it. `foldHelper.foldPending` folds PAST a failure it produces; a row that is ALREADY
|
|
247
247
|
failed at the cursor, or a gap in the seqs, is the store's to step over before calling it
|
|
248
248
|
(`planning-postgres` does it in a prelude).
|
|
249
|
-
- `failPending` is what a dead projection job must do, or waiters hang to their timeout.
|
|
249
|
+
- `foldHelper.failPending` is what a dead projection job must do, or waiters hang to their timeout.
|
|
250
250
|
- The data-defined schema port (`schemas`) is optional; `makeCompositeStore` passes the default
|
|
251
251
|
store's through. A store that has it must purge a project's layer with the project.
|
|
252
252
|
- **Run the conformance suite.** `@owlmeans/server-planning/conformance` exports
|
|
@@ -257,8 +257,8 @@ the store; `bind` replaces the listener, so a store has exactly one.
|
|
|
257
257
|
boot serves them all.
|
|
258
258
|
- `makeCommitHub({ status, remember?, ladder? })` is the `CommitSource`: feed `publish` from the bus,
|
|
259
259
|
answer `status` from transition rows. `wait` subscribes first, polls once, then climbs the ladder.
|
|
260
|
-
- `revisionsFromLog(transitions, limit?)` answers `specs.revisions`.
|
|
261
|
-
- `makeProjectionProcessor(ctx)` + `
|
|
260
|
+
- `foldHelper.revisionsFromLog(transitions, limit?)` answers `specs.revisions`.
|
|
261
|
+
- `makeProjectionProcessor(ctx)` + `makePlanningQueueHooks(ctx)` are the store-agnostic job body and
|
|
262
262
|
`onJobDead`; a store with an admission CAS wraps its own around them.
|
|
263
263
|
|
|
264
264
|
## A foreign provider
|
|
@@ -279,19 +279,19 @@ mapping external records (`mappers`) belongs to that plugin's own store adapter.
|
|
|
279
279
|
|
|
280
280
|
## Scope and security
|
|
281
281
|
|
|
282
|
-
- Without `opts.access`: `entityId` is `
|
|
282
|
+
- Without `opts.access`: `entityId` is `makeEntityScope(req).requireEntityKey()`; `opts.scope(req, ctx)` adds a
|
|
283
283
|
`channel` or `service` and can never replace the entity. `actor` and a create's `createdBy` come
|
|
284
|
-
from the request, never the body (`wireExecution` drops a draft's claim, `withCreator` stamps the
|
|
285
|
-
subject, `assertCreatorFixed` refuses a body naming `createdBy` — an update never re-owns a card).
|
|
286
|
-
- The organization of a scope is the one the request ACTS IN. `
|
|
284
|
+
from the request, never the body (`executionHelper.wireExecution` drops a draft's claim, `creatorHelper.withCreator` stamps the
|
|
285
|
+
subject, `creatorHelper.assertCreatorFixed` refuses a body naming `createdBy` — an update never re-owns a card).
|
|
286
|
+
- The organization of a scope is the one the request ACTS IN. `makeEntityScope(req).requireEntityKey()` answers
|
|
287
287
|
`req.entity.id`, the stable record id (the token's `entitySlug` only where no entity resolver is
|
|
288
288
|
registered). Behind an OIDC relying party (`@owlmeans/server-oidc-rp`) the acting organization is
|
|
289
289
|
session state: the guard attaches `req.entity` with `id` = the organization claim's frozen
|
|
290
290
|
`entityKey`, so the tenant key survives a rename and follows a switch. Take it in the handler and
|
|
291
291
|
pass it down; never read it from the context or from a body.
|
|
292
292
|
- Another entity's card, specification or transition answers `WorkcardNotFound` — the same as an
|
|
293
|
-
absent id — on reads and writes alike (`concealed`).
|
|
294
|
-
- Queries arrive in their wire form and are decoded with `decode*Query` before `criteriaOf`, which
|
|
293
|
+
absent id — on reads and writes alike (`guardHelper.concealed`).
|
|
294
|
+
- Queries arrive in their wire form and are decoded with `wireHelper.decode*Query` before `queryHelper.criteriaOf`, which
|
|
295
295
|
always adds the scope's `entityId`.
|
|
296
296
|
|
|
297
297
|
### The access resolver
|
|
@@ -349,7 +349,7 @@ target).
|
|
|
349
349
|
## Data-defined types and flows
|
|
350
350
|
|
|
351
351
|
Where the default store has the schema port, `runtime.schemasFor(entityId, project?)` answers the
|
|
352
|
-
resolved layer (`resolveScopedBundle` over the code bundle and the organization's and project's
|
|
352
|
+
resolved layer (`scopedSchemaHelper.resolveScopedBundle` over the code bundle and the organization's and project's
|
|
353
353
|
records), cached per (organization, project) and keyed by the store's `revision()` and the plugin
|
|
354
354
|
registry's version — a write anywhere moves the revision the next lookup reads, so a cached layer is
|
|
355
355
|
never stale; a store's `watch` evicts early. Without the port it answers the code registry itself.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type PlanningDefinitions, type SchemaDefineReply, type SchemaDefineRequest } from '@owlmeans/planning';
|
|
2
|
+
/**
|
|
3
|
+
* Apply one `schema.define` request to a facade's definitions: the declarations in the request's
|
|
4
|
+
* mode (flows before types), then the retirements — answering what was written and the layer as it
|
|
5
|
+
* resolves afterwards.
|
|
6
|
+
*/
|
|
7
|
+
export declare const applySchemaRequest: (definitions: PlanningDefinitions, request: SchemaDefineRequest) => Promise<SchemaDefineReply>;
|
|
8
|
+
//# sourceMappingURL=apply-schema-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-schema-request.d.ts","sourceRoot":"","sources":["../../src/actions/apply-schema-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,KAAK,mBAAmB,EAA2B,MAAM,oBAAoB,CAAA;AAEzJ;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,gBAChB,mBAAmB,WAAW,mBAAmB,KAC7D,OAAO,CAAC,iBAAiB,CAyB3B,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SchemaWriteMode } from '@owlmeans/planning';
|
|
2
|
+
/**
|
|
3
|
+
* Apply one `schema.define` request to a facade's definitions: the declarations in the request's
|
|
4
|
+
* mode (flows before types), then the retirements — answering what was written and the layer as it
|
|
5
|
+
* resolves afterwards.
|
|
6
|
+
*/
|
|
7
|
+
export const applySchemaRequest = async (definitions, request) => {
|
|
8
|
+
const layer = request.project != null ? { project: request.project } : {};
|
|
9
|
+
const declarations = { types: request.types ?? [], flows: request.flows ?? [] };
|
|
10
|
+
const records = [];
|
|
11
|
+
switch (request.mode ?? SchemaWriteMode.Define) {
|
|
12
|
+
case SchemaWriteMode.Put:
|
|
13
|
+
for (const flow of declarations.flows) {
|
|
14
|
+
records.push(await definitions.putFlow(flow, layer));
|
|
15
|
+
}
|
|
16
|
+
for (const type of declarations.types) {
|
|
17
|
+
records.push(await definitions.putType(type, layer));
|
|
18
|
+
}
|
|
19
|
+
break;
|
|
20
|
+
case SchemaWriteMode.Seed:
|
|
21
|
+
records.push(...await definitions.seed(declarations, layer));
|
|
22
|
+
break;
|
|
23
|
+
default:
|
|
24
|
+
records.push(...await definitions.define(declarations, layer));
|
|
25
|
+
}
|
|
26
|
+
for (const key of request.retire ?? []) {
|
|
27
|
+
records.push(await definitions.retire(key.kind, key.key, layer));
|
|
28
|
+
}
|
|
29
|
+
return { records, bundle: await definitions.bundle(request.project) };
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=apply-schema-request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-schema-request.js","sourceRoot":"","sources":["../../src/actions/apply-schema-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAuG,MAAM,oBAAoB,CAAA;AAEzJ;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EACrC,WAAgC,EAAE,OAA4B,EAClC,EAAE;IAC9B,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IACzE,MAAM,YAAY,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,EAAE,CAAA;IAC/E,MAAM,OAAO,GAAyB,EAAE,CAAA;IAExC,QAAQ,OAAO,CAAC,IAAI,IAAI,eAAe,CAAC,MAAM,EAAE,CAAC;QAC/C,KAAK,eAAe,CAAC,GAAG;YACtB,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,KAAK,EAAE,CAAC;gBACtC,OAAO,CAAC,IAAI,CAAC,MAAM,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;YACtD,CAAC;YACD,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,KAAK,EAAE,CAAC;gBACtC,OAAO,CAAC,IAAI,CAAC,MAAM,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;YACtD,CAAC;YACD,MAAK;QACP,KAAK,eAAe,CAAC,IAAI;YACvB,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAA;YAC5D,MAAK;QACP;YACE,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAA;IAClE,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;QACvC,OAAO,CAAC,IAAI,CAAC,MAAM,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAA;IAClE,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAA;AACvE,CAAC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { handlers } from '@owlmeans/server-api';
|
|
2
1
|
import type { PlanningProtocols } from '@owlmeans/planning';
|
|
3
|
-
import type {
|
|
2
|
+
import type { PlanningHandlerOptions } from '../types.js';
|
|
3
|
+
import type { RequestHandler } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* The poll tool: a commit's status, held open up to `wait` seconds (clamped to `maxPoll`).
|
|
6
6
|
*
|
|
@@ -10,5 +10,5 @@ import type { Context, PlanningHandlerOptions } from '../types.js';
|
|
|
10
10
|
*
|
|
11
11
|
* @throws {WorkcardNotFound} for another entity's transition
|
|
12
12
|
*/
|
|
13
|
-
export declare const getCommit: (protocol: PlanningProtocols['commit']['get'], opts?: PlanningHandlerOptions) =>
|
|
13
|
+
export declare const getCommit: (protocol: PlanningProtocols['commit']['get'], opts?: PlanningHandlerOptions) => RequestHandler;
|
|
14
14
|
//# sourceMappingURL=commit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../../src/actions/commit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../../src/actions/commit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACzE,OAAO,KAAK,EAAW,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAGlE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,aACV,iBAAiB,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,SAAS,sBAAsB,KAC1E,cAqCE,CAAA"}
|
package/build/actions/commit.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { handlers } from '@owlmeans/server-api';
|
|
2
2
|
import { CommitState, MAX_COMMIT_POLL } from '@owlmeans/planning';
|
|
3
|
-
import {
|
|
3
|
+
import { guardHelper } from '../utils/guard.js';
|
|
4
|
+
import { planningHandlerOf } from '../utils/handler.js';
|
|
4
5
|
/**
|
|
5
6
|
* The poll tool: a commit's status, held open up to `wait` seconds (clamped to `maxPoll`).
|
|
6
7
|
*
|
|
@@ -10,11 +11,11 @@ import { clampSeconds, concealed, handlerFacade } from '../utils/index.js';
|
|
|
10
11
|
*
|
|
11
12
|
* @throws {WorkcardNotFound} for another entity's transition
|
|
12
13
|
*/
|
|
13
|
-
export const getCommit = (protocol, opts) => handlers().request(protocol, async (req, ctx) => concealed(async () => {
|
|
14
|
-
const facade = await handlerFacade(
|
|
14
|
+
export const getCommit = (protocol, opts) => handlers().request(protocol, async (req, ctx) => guardHelper.concealed(async () => {
|
|
15
|
+
const facade = await planningHandlerOf(ctx).handlerFacade(req, opts);
|
|
15
16
|
const transition = `${req.params.transition}`;
|
|
16
17
|
let status = await facade.commits.status(transition);
|
|
17
|
-
const wait = clampSeconds(req.query?.wait, opts?.maxPoll ?? MAX_COMMIT_POLL);
|
|
18
|
+
const wait = guardHelper.clampSeconds(req.query?.wait, opts?.maxPoll ?? MAX_COMMIT_POLL);
|
|
18
19
|
if (status.state !== CommitState.Pending || wait <= 0) {
|
|
19
20
|
return status;
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commit.js","sourceRoot":"","sources":["../../src/actions/commit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGjE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"commit.js","sourceRoot":"","sources":["../../src/actions/commit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGjE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAGvD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,QAA4C,EAAE,IAA6B,EAC3D,EAAE,CAClB,QAAQ,EAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,KAAK,IAA2B,EAAE;IAChH,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IACpE,MAAM,UAAU,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,EAAE,CAAA;IAE7C,IAAI,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IACpD,MAAM,IAAI,GAAG,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,IAAI,eAAe,CAAC,CAAA;IACxF,IAAI,MAAM,CAAC,KAAK,KAAK,WAAW,CAAC,OAAO,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;QACtD,OAAO,MAAM,CAAA;IACf,CAAC;IAED,IAAI,MAAM,GAAG,KAAK,CAAA;IAClB,IAAI,IAAI,GAAe,GAAG,EAAE,GAAG,MAAM,GAAG,IAAI,CAAA,CAAC,CAAC,CAAA;IAC9C,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;QACzD,IAAI,KAAK,CAAC,UAAU,KAAK,UAAU,IAAI,KAAK,CAAC,KAAK,KAAK,WAAW,CAAC,OAAO,EAAE,CAAC;YAC3E,IAAI,EAAE,CAAA;QACR,CAAC;IACH,CAAC,CAAC,CAAA;IACF,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;QAChD,IAAI,MAAM,CAAC,KAAK,KAAK,WAAW,CAAC,OAAO,EAAE,CAAC;YACzC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;oBAChC,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC,CAAA;oBAC9C,IAAI,GAAG,GAAG,EAAE;wBACV,YAAY,CAAC,KAAK,CAAC,CAAA;wBACnB,OAAO,EAAE,CAAA;oBACX,CAAC,CAAA;gBACH,CAAC,CAAC,CAAA;YACJ,CAAC;YACD,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;QAClD,CAAC;IACH,CAAC;YAAS,CAAC;QACT,WAAW,EAAE,CAAA;IACf,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type PlanningProtocols } from '@owlmeans/planning';
|
|
2
|
+
import type { PlanningHandlerOptions } from '../types.js';
|
|
3
|
+
import type { RequestHandler } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* The write of data-defined types and flows. A project layer needs the project in the access's
|
|
6
|
+
* `writes` when the resolver answers it; then `grants.defineSchemas` gates when the resolver answers
|
|
7
|
+
* grants (the organization-wide layer needs `true`, a project layer its id).
|
|
8
|
+
*
|
|
9
|
+
* @throws {PlanningUnsupported} where the store holds no data-defined schemas
|
|
10
|
+
* @throws {PlanningForbidden | SchemaConflict | SchemaSealed | SchemaInvalid | SchemaInUse | WorkcardNotFound}
|
|
11
|
+
*/
|
|
12
|
+
export declare const defineSchemas: (protocol: NonNullable<PlanningProtocols['schema']['define']>, opts?: PlanningHandlerOptions) => RequestHandler;
|
|
13
|
+
//# sourceMappingURL=define-schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-schemas.d.ts","sourceRoot":"","sources":["../../src/actions/define-schemas.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,iBAAiB,EAAoD,MAAM,oBAAoB,CAAA;AAClI,OAAO,KAAK,EAAW,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAKlE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,aACd,WAAW,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,SAAS,sBAAsB,KAC1F,cAcE,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { handlers } from '@owlmeans/server-api';
|
|
2
|
+
import { PlanningUnsupported } from '@owlmeans/planning';
|
|
3
|
+
import { makePlanningAccessModel } from '../utils/access.js';
|
|
4
|
+
import { guardHelper } from '../utils/guard.js';
|
|
5
|
+
import { planningHandlerOf } from '../utils/handler.js';
|
|
6
|
+
import { applySchemaRequest } from './apply-schema-request.js';
|
|
7
|
+
/**
|
|
8
|
+
* The write of data-defined types and flows. A project layer needs the project in the access's
|
|
9
|
+
* `writes` when the resolver answers it; then `grants.defineSchemas` gates when the resolver answers
|
|
10
|
+
* grants (the organization-wide layer needs `true`, a project layer its id).
|
|
11
|
+
*
|
|
12
|
+
* @throws {PlanningUnsupported} where the store holds no data-defined schemas
|
|
13
|
+
* @throws {PlanningForbidden | SchemaConflict | SchemaSealed | SchemaInvalid | SchemaInUse | WorkcardNotFound}
|
|
14
|
+
*/
|
|
15
|
+
export const defineSchemas = (protocol, opts) => handlers().request(protocol, async (req, ctx) => guardHelper.concealed(async () => {
|
|
16
|
+
const { facade, access } = await planningHandlerOf(ctx).handlerScopeOf(req, opts);
|
|
17
|
+
const request = (req.body ?? {});
|
|
18
|
+
if (facade.definitions == null) {
|
|
19
|
+
throw new PlanningUnsupported('definitions');
|
|
20
|
+
}
|
|
21
|
+
const model = makePlanningAccessModel(access);
|
|
22
|
+
if (request.project != null) {
|
|
23
|
+
model.assertWrites(request.project);
|
|
24
|
+
}
|
|
25
|
+
model.assertGranted('defineSchemas', request.project);
|
|
26
|
+
return await applySchemaRequest(facade.definitions, request);
|
|
27
|
+
}));
|
|
28
|
+
//# sourceMappingURL=define-schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-schemas.js","sourceRoot":"","sources":["../../src/actions/define-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,mBAAmB,EAA4E,MAAM,oBAAoB,CAAA;AAElI,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAG9D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,QAA4D,EAAE,IAA6B,EAC3E,EAAE,CAClB,QAAQ,EAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,KAAK,IAAgC,EAAE;IACrH,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IACjF,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAwB,CAAA;IACvD,IAAI,MAAM,CAAC,WAAW,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,IAAI,mBAAmB,CAAC,aAAa,CAAC,CAAA;IAC9C,CAAC;IACD,MAAM,KAAK,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAA;IAC7C,IAAI,OAAO,CAAC,OAAO,IAAI,IAAI,EAAE,CAAC;QAC5B,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACrC,CAAC;IACD,KAAK,CAAC,aAAa,CAAC,eAAe,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;IAErD,OAAO,MAAM,kBAAkB,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;AAC9D,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -1,34 +1,14 @@
|
|
|
1
|
-
import { handlers } from '@owlmeans/server-api';
|
|
2
1
|
import type { ExecuteOptions, ExecuteRequest, PlanningFacade, PlanningProtocols, PlanningScope, TransitionExecution } from '@owlmeans/planning';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* execution already carries it. A `createdBy` in `changes` or `unset` is not dropped: the executor
|
|
9
|
-
* refuses it on every action (`assertCreatorFixed`), so no body moves an owner.
|
|
10
|
-
*/
|
|
2
|
+
import type { PlanningAccess, PlanningHandlerOptions } from '../types.js';
|
|
3
|
+
import type { RequestHandler } from './types.js';
|
|
4
|
+
/** The one write route. */
|
|
5
|
+
export declare const executePlanning: (protocol: PlanningProtocols['execute'], opts?: PlanningHandlerOptions) => RequestHandler;
|
|
6
|
+
/** @deprecated compat:factory-refactor — use `executionHelper.wireExecution(…)` */
|
|
11
7
|
export declare const wireExecution: (body: ExecuteRequest, scope: PlanningScope) => TransitionExecution;
|
|
12
|
-
/**
|
|
8
|
+
/** @deprecated compat:factory-refactor — use `executionHelper.executeOptionsOf(…)` */
|
|
13
9
|
export declare const executeOptionsOf: (body: Pick<ExecuteRequest, 'wait' | 'timeout'>, maxPoll: number) => ExecuteOptions;
|
|
14
|
-
/**
|
|
15
|
-
* Refuse an execution outside the access's `writes`: the card it acts on (a specification through
|
|
16
|
-
* its parent card), or every parent a create names, must be one {@link writableIn} admits. A create
|
|
17
|
-
* of a project is `grants.createProjects`' alone. A card or parent this scope cannot see is left to
|
|
18
|
-
* the executor, which answers it as absent.
|
|
19
|
-
*
|
|
20
|
-
* @throws {PlanningForbidden}
|
|
21
|
-
*/
|
|
10
|
+
/** @deprecated compat:factory-refactor — use `executionHelper.assertExecutionWrites(…)` */
|
|
22
11
|
export declare const assertExecutionWrites: (facade: PlanningFacade, exec: TransitionExecution, access?: PlanningAccess) => Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* The access a wire execution needs. `writes` first ({@link assertExecutionWrites}); then the
|
|
25
|
-
* grants: `createProjects` for a project create (its primary parent, or the root),
|
|
26
|
-
* `deleteProjects` for the delete of a project card. A card this scope cannot see is left to the
|
|
27
|
-
* executor, which answers it as absent.
|
|
28
|
-
*
|
|
29
|
-
* @throws {PlanningForbidden}
|
|
30
|
-
*/
|
|
12
|
+
/** @deprecated compat:factory-refactor — use `executionHelper.assertExecutionGranted(…)` */
|
|
31
13
|
export declare const assertExecutionGranted: (facade: PlanningFacade, exec: TransitionExecution, access?: PlanningAccess) => Promise<void>;
|
|
32
|
-
/** The one write route. */
|
|
33
|
-
export declare const executePlanning: (protocol: PlanningProtocols['execute'], opts?: PlanningHandlerOptions) => ReturnType<ReturnType<typeof handlers<Context>>['request']>;
|
|
34
14
|
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/actions/execute.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/actions/execute.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,mBAAmB,EAEtG,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAW,cAAc,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIlF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD,2BAA2B;AAC3B,eAAO,MAAM,eAAe,aAChB,iBAAiB,CAAC,SAAS,CAAC,SAAS,sBAAsB,KACpE,cAWE,CAAA;AAEL,mFAAmF;AACnF,eAAO,MAAM,aAAa,SAAU,cAAc,SAAS,aAAa,KAAG,mBAC/B,CAAA;AAE5C,sFAAsF;AACtF,eAAO,MAAM,gBAAgB,SAAU,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC,WAAW,MAAM,KAAG,cAClD,CAAA;AAEjD,2FAA2F;AAC3F,eAAO,MAAM,qBAAqB,WACxB,cAAc,QAAQ,mBAAmB,WAAW,cAAc,KACzE,OAAO,CAAC,IAAI,CAAsE,CAAA;AAErF,4FAA4F;AAC5F,eAAO,MAAM,sBAAsB,WACzB,cAAc,QAAQ,mBAAmB,WAAW,cAAc,KACzE,OAAO,CAAC,IAAI,CAAuE,CAAA"}
|
package/build/actions/execute.js
CHANGED
|
@@ -1,109 +1,25 @@
|
|
|
1
1
|
import { handlers } from '@owlmeans/server-api';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
* What a wire execution may say. `actor` is dropped — the scope names the writer — and a create's
|
|
7
|
-
* `createdBy` claim is dropped too: the executor's {@link withCreator} stamps the authenticated
|
|
8
|
-
* subject, the same rule an in-process create follows. Applied here as well, so the returned
|
|
9
|
-
* execution already carries it. A `createdBy` in `changes` or `unset` is not dropped: the executor
|
|
10
|
-
* refuses it on every action (`assertCreatorFixed`), so no body moves an owner.
|
|
11
|
-
*/
|
|
12
|
-
export const wireExecution = (body, scope) => {
|
|
13
|
-
const { wait: _wait, timeout: _timeout, actor: _actor, ...exec } = body;
|
|
14
|
-
if (exec.action === TransitionAction.Create && exec.card != null && typeof exec.card === 'object') {
|
|
15
|
-
const { createdBy: _createdBy, ...draft } = exec.card;
|
|
16
|
-
exec.card = draft;
|
|
17
|
-
}
|
|
18
|
-
return withCreator(exec, scope);
|
|
19
|
-
};
|
|
20
|
-
/** `wait`/`timeout` as a server grants them: the timeout never holds a request past `maxPoll`. */
|
|
21
|
-
export const executeOptionsOf = (body, maxPoll) => {
|
|
22
|
-
const ceiling = maxPoll * 1000;
|
|
23
|
-
if (body.wait !== true) {
|
|
24
|
-
return {};
|
|
25
|
-
}
|
|
26
|
-
const asked = Number(body.timeout ?? DEFAULT_COMMIT_TIMEOUT);
|
|
27
|
-
return { wait: true, timeout: Math.min(Number.isFinite(asked) && asked > 0 ? asked : DEFAULT_COMMIT_TIMEOUT, ceiling) };
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Refuse an execution outside the access's `writes`: the card it acts on (a specification through
|
|
31
|
-
* its parent card), or every parent a create names, must be one {@link writableIn} admits. A create
|
|
32
|
-
* of a project is `grants.createProjects`' alone. A card or parent this scope cannot see is left to
|
|
33
|
-
* the executor, which answers it as absent.
|
|
34
|
-
*
|
|
35
|
-
* @throws {PlanningForbidden}
|
|
36
|
-
*/
|
|
37
|
-
export const assertExecutionWrites = async (facade, exec, access) => {
|
|
38
|
-
if (access?.writes == null) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const admitted = async (card) => {
|
|
42
|
-
if (writableIn(access, card)) {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
if (!isSpecification(card) || card.parent == null) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
const parent = await facade.cards.load(card.parent);
|
|
49
|
-
return parent == null || writableIn(access, parent);
|
|
50
|
-
};
|
|
51
|
-
if (exec.action === TransitionAction.Create && exec.card != null && typeof exec.card === 'object') {
|
|
52
|
-
if (exec.card.kind === WorkcardKind.Project) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const parents = normalizeParents(exec.card.parent, exec.card.parents);
|
|
56
|
-
if (parents.length === 0) {
|
|
57
|
-
throw new PlanningForbidden('writes:root');
|
|
58
|
-
}
|
|
59
|
-
for (const id of parents) {
|
|
60
|
-
const parent = await facade.cards.load(id);
|
|
61
|
-
if (parent != null && !await admitted(parent)) {
|
|
62
|
-
throw new PlanningForbidden(`writes:${id}`);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
if (typeof exec.card === 'string' && exec.card !== '') {
|
|
68
|
-
const card = await facade.cards.load(exec.card);
|
|
69
|
-
if (card != null && !await admitted(card)) {
|
|
70
|
-
throw new PlanningForbidden(`writes:${exec.card}`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* The access a wire execution needs. `writes` first ({@link assertExecutionWrites}); then the
|
|
76
|
-
* grants: `createProjects` for a project create (its primary parent, or the root),
|
|
77
|
-
* `deleteProjects` for the delete of a project card. A card this scope cannot see is left to the
|
|
78
|
-
* executor, which answers it as absent.
|
|
79
|
-
*
|
|
80
|
-
* @throws {PlanningForbidden}
|
|
81
|
-
*/
|
|
82
|
-
export const assertExecutionGranted = async (facade, exec, access) => {
|
|
83
|
-
await assertExecutionWrites(facade, exec, access);
|
|
84
|
-
if (access?.grants == null) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (exec.action === TransitionAction.Create && typeof exec.card === 'object' && exec.card?.kind === WorkcardKind.Project) {
|
|
88
|
-
assertGranted(access, 'createProjects', normalizeParents(exec.card.parent, exec.card.parents)[0]);
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
if (exec.action === TransitionAction.Delete && typeof exec.card === 'string') {
|
|
92
|
-
const card = await facade.cards.load(exec.card);
|
|
93
|
-
if (card != null && isProject(card)) {
|
|
94
|
-
assertGranted(access, 'deleteProjects', card.id);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
};
|
|
2
|
+
import { MAX_COMMIT_POLL } from '@owlmeans/planning';
|
|
3
|
+
import { guardHelper } from '../utils/guard.js';
|
|
4
|
+
import { planningHandlerOf } from '../utils/handler.js';
|
|
5
|
+
import { executionHelper } from './execution.js';
|
|
98
6
|
/** The one write route. */
|
|
99
|
-
export const executePlanning = (protocol, opts) => handlers().request(protocol, async (req, ctx) => concealed(async () => {
|
|
100
|
-
const { facade, access } = await handlerScopeOf(
|
|
7
|
+
export const executePlanning = (protocol, opts) => handlers().request(protocol, async (req, ctx) => guardHelper.concealed(async () => {
|
|
8
|
+
const { facade, access } = await planningHandlerOf(ctx).handlerScopeOf(req, opts);
|
|
101
9
|
const body = (req.body ?? {});
|
|
102
|
-
const exec = wireExecution(body, facade.scope);
|
|
103
|
-
await assertExecutionGranted(facade, exec, access);
|
|
104
|
-
const receipt = await facade.execute(exec, executeOptionsOf(body, opts?.maxPoll ?? MAX_COMMIT_POLL));
|
|
10
|
+
const exec = executionHelper.wireExecution(body, facade.scope);
|
|
11
|
+
await executionHelper.assertExecutionGranted(facade, exec, access);
|
|
12
|
+
const receipt = await facade.execute(exec, executionHelper.executeOptionsOf(body, opts?.maxPoll ?? MAX_COMMIT_POLL));
|
|
105
13
|
return receipt.card !== undefined
|
|
106
14
|
? { transition: receipt.transition, card: receipt.card }
|
|
107
15
|
: { transition: receipt.transition };
|
|
108
16
|
}));
|
|
17
|
+
/** @deprecated compat:factory-refactor — use `executionHelper.wireExecution(…)` */
|
|
18
|
+
export const wireExecution = (body, scope) => executionHelper.wireExecution(body, scope);
|
|
19
|
+
/** @deprecated compat:factory-refactor — use `executionHelper.executeOptionsOf(…)` */
|
|
20
|
+
export const executeOptionsOf = (body, maxPoll) => executionHelper.executeOptionsOf(body, maxPoll);
|
|
21
|
+
/** @deprecated compat:factory-refactor — use `executionHelper.assertExecutionWrites(…)` */
|
|
22
|
+
export const assertExecutionWrites = async (facade, exec, access) => await executionHelper.assertExecutionWrites(facade, exec, access);
|
|
23
|
+
/** @deprecated compat:factory-refactor — use `executionHelper.assertExecutionGranted(…)` */
|
|
24
|
+
export const assertExecutionGranted = async (facade, exec, access) => await executionHelper.assertExecutionGranted(facade, exec, access);
|
|
109
25
|
//# sourceMappingURL=execute.js.map
|