@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/build/actions/watch.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PlanningProtocols } from '@owlmeans/planning';
|
|
2
|
-
import { connection } from '@owlmeans/server-socket';
|
|
3
2
|
import type { PlanningHandlerOptions } from '../types.js';
|
|
3
|
+
import type { RequestHandler } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* The notify tool: push the caller's entity's commits down a socket as `planning-commit` frames.
|
|
6
6
|
*
|
|
@@ -8,5 +8,5 @@ import type { PlanningHandlerOptions } from '../types.js';
|
|
|
8
8
|
* `project`/`card`. A frame without `record` — what a cross-process bus delivers — gets the card as
|
|
9
9
|
* it reads now (`null` once deleted), so a subscriber never re-reads per frame.
|
|
10
10
|
*/
|
|
11
|
-
export declare const watchCommits: (protocol: PlanningProtocols['commit']['events'], opts?: PlanningHandlerOptions) =>
|
|
11
|
+
export declare const watchCommits: (protocol: PlanningProtocols['commit']['events'], opts?: PlanningHandlerOptions) => RequestHandler;
|
|
12
12
|
//# sourceMappingURL=watch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/actions/watch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgC,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/actions/watch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgC,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAIzF,OAAO,KAAK,EAAW,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAElE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAOhD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,aACb,iBAAiB,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,SAAS,sBAAsB,KAC7E,cA+BD,CAAA"}
|
package/build/actions/watch.js
CHANGED
|
@@ -2,7 +2,7 @@ import { logger } from '@owlmeans/log';
|
|
|
2
2
|
import { PLANNING_COMMIT_EVENT } from '@owlmeans/planning';
|
|
3
3
|
import { connection } from '@owlmeans/server-socket';
|
|
4
4
|
import { MessageType } from '@owlmeans/socket';
|
|
5
|
-
import {
|
|
5
|
+
import { planningHandlerOf } from '../utils/handler.js';
|
|
6
6
|
const log = logger('planning:watch');
|
|
7
7
|
const text = (value) => value == null || value === '' ? undefined : `${value}`;
|
|
8
8
|
/**
|
|
@@ -13,7 +13,7 @@ const text = (value) => value == null || value === '' ? undefined : `${value}`;
|
|
|
13
13
|
* it reads now (`null` once deleted), so a subscriber never re-reads per frame.
|
|
14
14
|
*/
|
|
15
15
|
export const watchCommits = (protocol, opts) => connection(protocol, async (conn, ctx, req) => {
|
|
16
|
-
const facade = await handlerFacade(
|
|
16
|
+
const facade = await planningHandlerOf(ctx).handlerFacade(req, opts);
|
|
17
17
|
const query = (req.query ?? {});
|
|
18
18
|
const frame = opts?.event ?? PLANNING_COMMIT_EVENT;
|
|
19
19
|
const filter = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/actions/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/actions/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAGvD,MAAM,GAAG,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAA;AAEpC,MAAM,IAAI,GAAG,CAAC,KAAc,EAAsB,EAAE,CAClD,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAA;AAExD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,QAA+C,EAAE,IAA6B,EAC9D,EAAE,CAAC,UAAU,CAA2B,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IAC3F,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IACpE,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAoB,CAAA;IAClD,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,IAAI,qBAAqB,CAAA;IAClD,MAAM,MAAM,GAAG;QACb,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChE,CAAA;IAED,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,EAAE,KAAkB,EAAE,EAAE;QAC9E,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAA;YAC/G,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;QACpC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,GAAG,CAAC,IAAI,CAAC,+BAA+B,EAAE,CAAC,CAAC,CAAA;QAC9C,CAAC;IACH,CAAC,EAAE,MAAM,CAAC,CAAA;IAEV,IAAI,CAAC,MAAM,CAAC,KAAK,EAAC,OAAO,EAAC,EAAE;QAC1B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,OAAM;QACR,CAAC;QACD,MAAM,GAAG,GAAG,OAA6B,CAAA;QACzC,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC,MAAM,IAAI,GAAG,CAAC,KAAK,KAAK,OAAO,EAAE,CAAC;YAC7D,IAAI,CAAC;gBACH,WAAW,EAAE,CAAA;YACf,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,GAAG,CAAC,IAAI,CAAC,oCAAoC,EAAE,CAAC,CAAC,CAAA;YACnD,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** The expectations a conformance case states — each throws `ConformanceFailure` when it does not hold. */
|
|
2
|
+
export interface AssertHelper {
|
|
3
|
+
/** @throws {ConformanceFailure} */
|
|
4
|
+
check: (condition: unknown, message: string) => void;
|
|
5
|
+
/** Structural equality over JSON values. @throws {ConformanceFailure} */
|
|
6
|
+
same: (actual: unknown, expected: unknown, message: string) => void;
|
|
7
|
+
/** The same members in any order. @throws {ConformanceFailure} */
|
|
8
|
+
sameSet: (actual: readonly unknown[], expected: readonly unknown[], message: string) => void;
|
|
9
|
+
/**
|
|
10
|
+
* The promise rejects with an error of the class (matched by instance or by its registered type
|
|
11
|
+
* name, so a duplicate module copy counts). Answers the error.
|
|
12
|
+
*
|
|
13
|
+
* @throws {ConformanceFailure}
|
|
14
|
+
*/
|
|
15
|
+
rejects: (run: Promise<unknown> | (() => Promise<unknown>), expected: {
|
|
16
|
+
typeName: string;
|
|
17
|
+
}, message: string) => Promise<Error>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/conformance/assert/types.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,KAAK,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACpD,yEAAyE;IACzE,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACnE,kEAAkE;IAClE,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,EAAE,QAAQ,EAAE,SAAS,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5F;;;;;OAKG;IACH,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,CAAC,CAAA;CAC/H"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/conformance/assert/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/** @
|
|
1
|
+
import type { AssertHelper } from './assert/types.js';
|
|
2
|
+
export { ConformanceFailure } from './errors.js';
|
|
3
|
+
export declare const createAssertHelper: () => AssertHelper;
|
|
4
|
+
export declare const assertHelper: AssertHelper;
|
|
5
|
+
/** @deprecated compat:factory-refactor — use `assertHelper.check(…)` */
|
|
6
6
|
export declare const check: (condition: unknown, message: string) => void;
|
|
7
|
-
/**
|
|
7
|
+
/** @deprecated compat:factory-refactor — use `assertHelper.same(…)` */
|
|
8
8
|
export declare const same: (actual: unknown, expected: unknown, message: string) => void;
|
|
9
|
-
/**
|
|
9
|
+
/** @deprecated compat:factory-refactor — use `assertHelper.sameSet(…)` */
|
|
10
10
|
export declare const sameSet: (actual: readonly unknown[], expected: readonly unknown[], message: string) => void;
|
|
11
|
-
/**
|
|
12
|
-
* The promise rejects with an error of the class (matched by instance or by its registered type
|
|
13
|
-
* name, so a duplicate module copy counts). Answers the error.
|
|
14
|
-
*
|
|
15
|
-
* @throws {ConformanceFailure}
|
|
16
|
-
*/
|
|
11
|
+
/** @deprecated compat:factory-refactor — use `assertHelper.rejects(…)` */
|
|
17
12
|
export declare const rejects: (run: Promise<unknown> | (() => Promise<unknown>), expected: {
|
|
18
13
|
typeName: string;
|
|
19
14
|
}, message: string) => Promise<Error>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/conformance/assert.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/conformance/assert.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAUhD,eAAO,MAAM,kBAAkB,QAAO,YAmCrC,CAAA;AAED,eAAO,MAAM,YAAY,cAAuB,CAAA;AAEhD,wEAAwE;AACxE,eAAO,MAAM,KAAK,cAAe,OAAO,WAAW,MAAM,KAAG,IAA8C,CAAA;AAE1G,uEAAuE;AACvE,eAAO,MAAM,IAAI,WAAY,OAAO,YAAY,OAAO,WAAW,MAAM,KAAG,IAAoD,CAAA;AAE/H,0EAA0E;AAC1E,eAAO,MAAM,OAAO,WAAY,SAAS,OAAO,EAAE,YAAY,SAAS,OAAO,EAAE,WAAW,MAAM,KAAG,IACnD,CAAA;AAEjD,0EAA0E;AAC1E,eAAO,MAAM,OAAO,QACb,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,YAAY;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,WAAW,MAAM,KAChG,OAAO,CAAC,KAAK,CAAuD,CAAA"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
constructor(message) {
|
|
5
|
-
super(`planning conformance: ${message}`);
|
|
6
|
-
this.name = 'ConformanceFailure';
|
|
7
|
-
}
|
|
8
|
-
}
|
|
1
|
+
import { changesHelper } from '@owlmeans/planning';
|
|
2
|
+
import { ConformanceFailure } from './errors.js';
|
|
3
|
+
export { ConformanceFailure } from './errors.js';
|
|
9
4
|
const show = (value) => {
|
|
10
5
|
try {
|
|
11
6
|
return JSON.stringify(value);
|
|
@@ -14,41 +9,44 @@ const show = (value) => {
|
|
|
14
9
|
return `${value}`;
|
|
15
10
|
}
|
|
16
11
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
/** Structural equality over JSON values. @throws {ConformanceFailure} */
|
|
24
|
-
export const same = (actual, expected, message) => {
|
|
25
|
-
if (!sameValue(actual, expected)) {
|
|
26
|
-
throw new ConformanceFailure(`${message}: expected ${show(expected)}, got ${show(actual)}`);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
/** The same members in any order. @throws {ConformanceFailure} */
|
|
30
|
-
export const sameSet = (actual, expected, message) => {
|
|
31
|
-
const sort = (values) => [...values].map(show).sort();
|
|
32
|
-
same(sort(actual), sort(expected), message);
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* The promise rejects with an error of the class (matched by instance or by its registered type
|
|
36
|
-
* name, so a duplicate module copy counts). Answers the error.
|
|
37
|
-
*
|
|
38
|
-
* @throws {ConformanceFailure}
|
|
39
|
-
*/
|
|
40
|
-
export const rejects = async (run, expected, message) => {
|
|
41
|
-
try {
|
|
42
|
-
await (typeof run === 'function' ? run() : run);
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
const type = error?.type;
|
|
46
|
-
if (error instanceof expected
|
|
47
|
-
|| (typeof type === 'string' && type === expected.typeName)) {
|
|
48
|
-
return error;
|
|
12
|
+
export const createAssertHelper = () => {
|
|
13
|
+
const check = (condition, message) => {
|
|
14
|
+
if (condition !== true) {
|
|
15
|
+
throw new ConformanceFailure(message);
|
|
49
16
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
17
|
+
};
|
|
18
|
+
const same = (actual, expected, message) => {
|
|
19
|
+
if (!changesHelper.sameValue(actual, expected)) {
|
|
20
|
+
throw new ConformanceFailure(`${message}: expected ${show(expected)}, got ${show(actual)}`);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const sameSet = (actual, expected, message) => {
|
|
24
|
+
const sort = (values) => [...values].map(show).sort();
|
|
25
|
+
same(sort(actual), sort(expected), message);
|
|
26
|
+
};
|
|
27
|
+
const rejects = async (run, expected, message) => {
|
|
28
|
+
try {
|
|
29
|
+
await (typeof run === 'function' ? run() : run);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
const type = error?.type;
|
|
33
|
+
if (error instanceof expected
|
|
34
|
+
|| (typeof type === 'string' && type === expected.typeName)) {
|
|
35
|
+
return error;
|
|
36
|
+
}
|
|
37
|
+
throw new ConformanceFailure(`${message}: expected ${expected.typeName}, got ${show(error?.message ?? error)}`);
|
|
38
|
+
}
|
|
39
|
+
throw new ConformanceFailure(`${message}: expected ${expected.typeName}, nothing was thrown`);
|
|
40
|
+
};
|
|
41
|
+
return { check, same, sameSet, rejects };
|
|
53
42
|
};
|
|
43
|
+
export const assertHelper = createAssertHelper();
|
|
44
|
+
/** @deprecated compat:factory-refactor — use `assertHelper.check(…)` */
|
|
45
|
+
export const check = (condition, message) => assertHelper.check(condition, message);
|
|
46
|
+
/** @deprecated compat:factory-refactor — use `assertHelper.same(…)` */
|
|
47
|
+
export const same = (actual, expected, message) => assertHelper.same(actual, expected, message);
|
|
48
|
+
/** @deprecated compat:factory-refactor — use `assertHelper.sameSet(…)` */
|
|
49
|
+
export const sameSet = (actual, expected, message) => assertHelper.sameSet(actual, expected, message);
|
|
50
|
+
/** @deprecated compat:factory-refactor — use `assertHelper.rejects(…)` */
|
|
51
|
+
export const rejects = async (run, expected, message) => await assertHelper.rejects(run, expected, message);
|
|
54
52
|
//# sourceMappingURL=assert.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.js","sourceRoot":"","sources":["../../src/conformance/assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"assert.js","sourceRoot":"","sources":["../../src/conformance/assert.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cases.d.ts","sourceRoot":"","sources":["../../src/conformance/cases.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"cases.d.ts","sourceRoot":"","sources":["../../src/conformance/cases.ts"],"names":[],"mappings":"AACA,OAAO,EAAsV,KAAK,aAAa,EAAkJ,MAAM,oBAAoB,CAAA;AAK3hB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAmhBjD,wCAAwC;AACxC,eAAO,MAAM,mBAAmB,EAAE,SAAS,eAAe,EAAyB,CAAA;AAEnF,kGAAkG;AAClG,eAAO,MAAM,mBAAmB,UAAW,aAAa,KAAG,eAAe,EAC2C,CAAA"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { createBook, createBranch, transit } from './fixtures.js';
|
|
1
|
+
import { applyHelper, CardTypeNotAllowed, CommitState, IntrinsicStatus, PlanningError, PlanningSchemaKind, RelationshipRefused, SchemaConflict, SchemaInUse, SchemaInvalid, SchemaOrigin, SchemaSealed, SpecificationFormat, TransitionAction, UnknownWorkcardType, WorkcardConflict, WorkcardKind, WorkcardNotFound } from '@owlmeans/planning';
|
|
2
|
+
import { creatorHelper } from '../executor/creator.js';
|
|
3
|
+
import { assertHelper } from './assert.js';
|
|
4
|
+
import { conformanceFixturesOf } from './fixtures.js';
|
|
6
5
|
import { BOOK_TYPE, LIBRARY, PERIODICAL_TYPE } from './consts.js';
|
|
6
|
+
import { idHelper } from '@owlmeans/basic-ids';
|
|
7
|
+
const { check, rejects, same, sameSet } = assertHelper;
|
|
7
8
|
/** A fresh organization per case, so cases never see each other's cards on a shared database. */
|
|
8
|
-
const organization = () => `conformance-${uuid()}`;
|
|
9
|
+
const organization = () => `conformance-${idHelper.uuid()}`;
|
|
9
10
|
const ids = async (planning, query) => (await planning.cards.list({ ...query, size: 0 })).items.map(card => card.id);
|
|
10
11
|
const execute = async (planning, exec) => (await planning.execute(exec, { wait: true })).card ?? null;
|
|
11
12
|
const cases = [
|
|
@@ -13,13 +14,14 @@ const cases = [
|
|
|
13
14
|
name: 'folds transitions in seq order and settles each one once',
|
|
14
15
|
run: async ({ facade }) => {
|
|
15
16
|
const planning = facade(organization());
|
|
17
|
+
const fixtures = conformanceFixturesOf(planning);
|
|
16
18
|
const events = [];
|
|
17
19
|
const unsubscribe = await planning.commits.subscribe(event => { events.push(event); });
|
|
18
20
|
try {
|
|
19
|
-
const branch = await createBranch(
|
|
20
|
-
const book = await createBook(
|
|
21
|
+
const branch = await fixtures.createBranch();
|
|
22
|
+
const book = await fixtures.createBook(branch.id, 'Winter poems');
|
|
21
23
|
await execute(planning, { card: book.id, action: TransitionAction.Update, changes: { title: 'Winter verses' } });
|
|
22
|
-
await transit(
|
|
24
|
+
await fixtures.transit(book.id, 'lend');
|
|
23
25
|
const card = await planning.cards.get(book.id);
|
|
24
26
|
same([card.seq, card.head, card.title, card.status, card.intrinsic], [3, 3, 'Winter verses', 'lent', IntrinsicStatus.InProgress], 'the folded card');
|
|
25
27
|
same(events.filter(event => event.card === book.id).map(event => [event.seq, event.state]), [[1, CommitState.Committed], [2, CommitState.Committed], [3, CommitState.Committed]], 'one committed event per transition');
|
|
@@ -33,11 +35,12 @@ const cases = [
|
|
|
33
35
|
name: 'allocates seq against the head and refuses a stale expectSeq',
|
|
34
36
|
run: async ({ facade, store }) => {
|
|
35
37
|
const planning = facade(organization());
|
|
36
|
-
const
|
|
38
|
+
const fixtures = conformanceFixturesOf(planning);
|
|
39
|
+
const book = await fixtures.createBook((await fixtures.createBranch()).id);
|
|
37
40
|
await execute(planning, { card: book.id, action: TransitionAction.Update, changes: { title: 'First' }, expectSeq: 1 });
|
|
38
41
|
await rejects(planning.execute({ card: book.id, action: TransitionAction.Update, changes: { title: 'Stale' }, expectSeq: 1 }), WorkcardConflict, 'a stale expectSeq');
|
|
39
42
|
same(await store.transitions.head(book.id), 2, 'the head after two transitions');
|
|
40
|
-
same(await store.transitions.nextSeq(`conformance-${uuid()}`, null), 1, 'a card with no log allocates 1');
|
|
43
|
+
same(await store.transitions.nextSeq(`conformance-${idHelper.uuid()}`, null), 1, 'a card with no log allocates 1');
|
|
41
44
|
same((await planning.cards.get(book.id)).title, 'First', 'the refused write left the card alone');
|
|
42
45
|
},
|
|
43
46
|
},
|
|
@@ -45,7 +48,8 @@ const cases = [
|
|
|
45
48
|
name: 'an idempotency key answers its first receipt',
|
|
46
49
|
run: async ({ facade }) => {
|
|
47
50
|
const planning = facade(organization());
|
|
48
|
-
const
|
|
51
|
+
const fixtures = conformanceFixturesOf(planning);
|
|
52
|
+
const book = await fixtures.createBook((await fixtures.createBranch()).id);
|
|
49
53
|
const first = await planning.execute({ card: book.id, action: TransitionAction.Update, changes: { title: 'Kept' }, key: 'import:1' }, { wait: true });
|
|
50
54
|
const again = await planning.execute({ card: book.id, action: TransitionAction.Update, changes: { title: 'Lost' }, key: 'import:1' }, { wait: true });
|
|
51
55
|
same(again.transition.id, first.transition.id, 'the retried key answers the first transition');
|
|
@@ -57,13 +61,14 @@ const cases = [
|
|
|
57
61
|
name: 'keeps a create\'s createdBy — the scope\'s subject, or the one the caller named — through later writes',
|
|
58
62
|
run: async ({ facade }) => {
|
|
59
63
|
const planning = facade(organization());
|
|
60
|
-
const
|
|
64
|
+
const fixtures = conformanceFixturesOf(planning);
|
|
65
|
+
const subject = creatorHelper.creatorOf(planning.scope);
|
|
61
66
|
check(subject != null, 'the conformance facade acts as a signed-in person');
|
|
62
|
-
const branch = await createBranch(
|
|
63
|
-
const stamped = await createBook(
|
|
64
|
-
const named = await createBook(
|
|
67
|
+
const branch = await fixtures.createBranch();
|
|
68
|
+
const stamped = await fixtures.createBook(branch.id, 'Stamped');
|
|
69
|
+
const named = await fixtures.createBook(branch.id, 'Named', { createdBy: 'conformance-donor' });
|
|
65
70
|
await execute(planning, { card: stamped.id, action: TransitionAction.Update, changes: { title: 'Stamped, revised' } });
|
|
66
|
-
await transit(
|
|
71
|
+
await fixtures.transit(stamped.id, 'lend');
|
|
67
72
|
same([branch.createdBy, (await planning.cards.get(stamped.id)).createdBy, (await planning.cards.get(named.id)).createdBy], [subject, subject, 'conformance-donor'], 'createdBy read back after later writes');
|
|
68
73
|
sameSet((await planning.cards.list({ parent: branch.id, size: 0 })).items.map(card => [card.title, card.createdBy]), [['Stamped, revised', subject], ['Named', 'conformance-donor']], 'createdBy in a list');
|
|
69
74
|
},
|
|
@@ -73,8 +78,9 @@ const cases = [
|
|
|
73
78
|
run: async ({ facade, store }) => {
|
|
74
79
|
const org = organization();
|
|
75
80
|
const planning = facade(org);
|
|
76
|
-
const
|
|
77
|
-
const
|
|
81
|
+
const fixtures = conformanceFixturesOf(planning);
|
|
82
|
+
const branch = await fixtures.createBranch();
|
|
83
|
+
const book = await fixtures.createBook(branch.id, 'Owned');
|
|
78
84
|
const moves = [
|
|
79
85
|
{ card: book.id, action: TransitionAction.Update, changes: { title: 'Taken', createdBy: 'conformance-intruder' } },
|
|
80
86
|
{ card: book.id, action: TransitionAction.Update, unset: ['createdBy'] },
|
|
@@ -84,7 +90,7 @@ const cases = [
|
|
|
84
90
|
check(error.message.includes('immutable:createdBy'), `refused as immutable, not ${error.message}`);
|
|
85
91
|
}
|
|
86
92
|
const kept = await planning.cards.get(book.id);
|
|
87
|
-
same([kept.createdBy, kept.title, kept.seq, (await planning.transitions.list({ card: book.id })).total], [creatorOf(planning.scope), 'Owned', 1, 1], 'the refused writes left the card and its log alone');
|
|
93
|
+
same([kept.createdBy, kept.title, kept.seq, (await planning.transitions.list({ card: book.id })).total], [creatorHelper.creatorOf(planning.scope), 'Owned', 1, 1], 'the refused writes left the card and its log alone');
|
|
88
94
|
// Rows appended before the refusal existed: the store folds them exactly as the pure fold does.
|
|
89
95
|
const legacy = [];
|
|
90
96
|
for (const patch of [{ changes: { title: 'Legacy', createdBy: 'conformance-intruder' } }, { changes: {}, unset: ['createdBy'] }]) {
|
|
@@ -99,7 +105,7 @@ const cases = [
|
|
|
99
105
|
for (const row of legacy) {
|
|
100
106
|
same((await planning.commits.status(row.id)).state, CommitState.Committed, `legacy row ${row.seq} settles committed`);
|
|
101
107
|
}
|
|
102
|
-
const expected = legacy.reduce((card, row) => applyTransition(card, row), kept);
|
|
108
|
+
const expected = legacy.reduce((card, row) => applyHelper.applyTransition(card, row), kept);
|
|
103
109
|
const folded = await planning.cards.get(book.id);
|
|
104
110
|
same([folded.title, folded.seq, folded.createdBy], [expected.title, expected.seq, expected.createdBy], 'the legacy rows folded');
|
|
105
111
|
await execute(planning, { card: book.id, action: TransitionAction.Update, changes: { title: 'After' } });
|
|
@@ -110,15 +116,16 @@ const cases = [
|
|
|
110
116
|
name: 'transit moves the intrinsic state and closedAt, and a second flow leaves the primary alone',
|
|
111
117
|
run: async ({ facade }) => {
|
|
112
118
|
const planning = facade(organization());
|
|
113
|
-
const
|
|
114
|
-
await
|
|
119
|
+
const fixtures = conformanceFixturesOf(planning);
|
|
120
|
+
const book = await fixtures.createBook((await fixtures.createBranch()).id);
|
|
121
|
+
await fixtures.transit(book.id, 'retire');
|
|
115
122
|
const retired = await planning.cards.get(book.id);
|
|
116
123
|
same([retired.status, retired.intrinsic], ['retired', IntrinsicStatus.Closed], 'retired');
|
|
117
124
|
check(typeof retired.closedAt === 'string', 'closedAt is set on entering closed');
|
|
118
|
-
await transit(
|
|
125
|
+
await fixtures.transit(book.id, 'restore');
|
|
119
126
|
const restored = await planning.cards.get(book.id);
|
|
120
127
|
same([restored.status, restored.intrinsic, restored.closedAt], ['shelved', IntrinsicStatus.Planned, undefined], 'closedAt cleared on leaving closed');
|
|
121
|
-
await transit(
|
|
128
|
+
await fixtures.transit(book.id, 'review', { flow: LIBRARY.review });
|
|
122
129
|
const reviewed = await planning.cards.get(book.id);
|
|
123
130
|
same([reviewed.status, reviewed.flows[LIBRARY.review], reviewed.intrinsic], ['shelved', 'reviewed', IntrinsicStatus.Planned], 'the second flow moved alone');
|
|
124
131
|
},
|
|
@@ -128,12 +135,13 @@ const cases = [
|
|
|
128
135
|
run: async ({ facade }) => {
|
|
129
136
|
const org = organization();
|
|
130
137
|
const planning = facade(org);
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
const
|
|
136
|
-
await
|
|
138
|
+
const fixtures = conformanceFixturesOf(planning);
|
|
139
|
+
const east = await fixtures.createBranch('East branch');
|
|
140
|
+
const west = await fixtures.createBranch('West branch');
|
|
141
|
+
const poems = await fixtures.createBook(east.id, 'Winter poems', { labels: ['rare'], fields: { genre: 'poetry', signed: true } });
|
|
142
|
+
const atlas = await fixtures.createBook(east.id, 'River atlas', { labels: ['new'], parents: [west.id], fields: { genre: 'history' } });
|
|
143
|
+
const harbour = await fixtures.createBook(east.id, 'Quiet harbour', { fields: { genre: 'fiction', signed: false } });
|
|
144
|
+
await fixtures.transit(atlas.id, 'lend');
|
|
137
145
|
const since = (await planning.cards.get(atlas.id)).updatedAt;
|
|
138
146
|
sameSet(await ids(planning, { within: west.id }), [atlas.id], 'within');
|
|
139
147
|
sameSet(await ids(planning, { parent: east.id, flow: { id: LIBRARY.circulation, status: ['lent', 'retired'] } }), [atlas.id], 'a multi-value flow status');
|
|
@@ -157,8 +165,9 @@ const cases = [
|
|
|
157
165
|
name: 'lists specifications only when the query asks for them',
|
|
158
166
|
run: async ({ facade }) => {
|
|
159
167
|
const planning = facade(organization());
|
|
160
|
-
const
|
|
161
|
-
const
|
|
168
|
+
const fixtures = conformanceFixturesOf(planning);
|
|
169
|
+
const branch = await fixtures.createBranch();
|
|
170
|
+
const book = await fixtures.createBook(branch.id);
|
|
162
171
|
const model = await planning.model(book);
|
|
163
172
|
const summary = (await model.write('summary', '{"lines":["a"]}', { wait: true })).card;
|
|
164
173
|
const charter = (await (await planning.model(branch)).write('charter', '# Charter', { wait: true })).card;
|
|
@@ -174,9 +183,10 @@ const cases = [
|
|
|
174
183
|
name: 'pages and sorts a list, counting the whole match',
|
|
175
184
|
run: async ({ facade }) => {
|
|
176
185
|
const planning = facade(organization());
|
|
177
|
-
const
|
|
186
|
+
const fixtures = conformanceFixturesOf(planning);
|
|
187
|
+
const branch = await fixtures.createBranch();
|
|
178
188
|
for (const order of [5, 3, 1, 4, 2]) {
|
|
179
|
-
await createBook(
|
|
189
|
+
await fixtures.createBook(branch.id, `Volume ${order}`, { order });
|
|
180
190
|
}
|
|
181
191
|
const page = await planning.cards.list({ parent: branch.id, sort: ['order'], size: 2, page: 1 });
|
|
182
192
|
same([page.total, page.page, page.size, page.items.map(card => card.order)], [5, 1, 2, [3, 4]], 'the second page');
|
|
@@ -189,15 +199,16 @@ const cases = [
|
|
|
189
199
|
name: 'summarizes direct children by intrinsic state',
|
|
190
200
|
run: async ({ facade }) => {
|
|
191
201
|
const planning = facade(organization());
|
|
192
|
-
const
|
|
193
|
-
const
|
|
194
|
-
const
|
|
195
|
-
const
|
|
196
|
-
await createBook(
|
|
197
|
-
await
|
|
198
|
-
await transit(
|
|
199
|
-
|
|
200
|
-
await
|
|
202
|
+
const fixtures = conformanceFixturesOf(planning);
|
|
203
|
+
const branch = await fixtures.createBranch();
|
|
204
|
+
const empty = await fixtures.createBranch('Empty branch');
|
|
205
|
+
const lent = await fixtures.createBook(branch.id, 'Lent');
|
|
206
|
+
const retired = await fixtures.createBook(branch.id, 'Retired');
|
|
207
|
+
await fixtures.createBook(branch.id, 'Shelved');
|
|
208
|
+
await fixtures.transit(lent.id, 'lend');
|
|
209
|
+
await fixtures.transit(retired.id, 'retire');
|
|
210
|
+
const annex = await fixtures.createBranch('Annex', { parent: branch.id });
|
|
211
|
+
await fixtures.createBook(annex.id, 'Deeper');
|
|
201
212
|
await (await planning.model(branch)).write('charter', '# Charter', { wait: true });
|
|
202
213
|
const summary = await planning.cards.summary([branch.id, empty.id]);
|
|
203
214
|
same(summary, {
|
|
@@ -210,8 +221,9 @@ const cases = [
|
|
|
210
221
|
name: 'answers a specification current, listed, every document and its revisions',
|
|
211
222
|
run: async ({ facade }) => {
|
|
212
223
|
const planning = facade(organization());
|
|
213
|
-
const
|
|
214
|
-
const
|
|
224
|
+
const fixtures = conformanceFixturesOf(planning);
|
|
225
|
+
const branch = await fixtures.createBranch();
|
|
226
|
+
const book = await fixtures.createBook(branch.id);
|
|
215
227
|
const model = await planning.model(book);
|
|
216
228
|
await model.write('summary', '{"lines":["first"]}', { wait: true });
|
|
217
229
|
await (await planning.model(book.id)).write('summary', '{"lines":["second"]}', { wait: true });
|
|
@@ -234,10 +246,11 @@ const cases = [
|
|
|
234
246
|
name: 'keeps links: both ends, the single constraint, unlink and a delete dropping edges',
|
|
235
247
|
run: async ({ facade }) => {
|
|
236
248
|
const planning = facade(organization());
|
|
237
|
-
const
|
|
238
|
-
const
|
|
239
|
-
const
|
|
240
|
-
const
|
|
249
|
+
const fixtures = conformanceFixturesOf(planning);
|
|
250
|
+
const branch = await fixtures.createBranch();
|
|
251
|
+
const first = await fixtures.createBook(branch.id, 'First');
|
|
252
|
+
const second = await fixtures.createBook(branch.id, 'Second');
|
|
253
|
+
const third = await fixtures.createBook(branch.id, 'Third');
|
|
241
254
|
await execute(planning, { card: second.id, action: TransitionAction.Link, link: { type: 'sequel-of', to: first.id } });
|
|
242
255
|
same((await planning.relationships.list({ from: second.id })).total, 1, 'from');
|
|
243
256
|
same((await planning.relationships.list({ to: first.id, type: 'sequel-of' })).items.map(link => link.from), [second.id], 'to and type');
|
|
@@ -255,9 +268,10 @@ const cases = [
|
|
|
255
268
|
name: 'isolates organizations on every read and write',
|
|
256
269
|
run: async ({ facade }) => {
|
|
257
270
|
const mine = facade(organization());
|
|
271
|
+
const fixtures = conformanceFixturesOf(mine);
|
|
258
272
|
const theirs = facade(organization());
|
|
259
|
-
const branch = await createBranch(
|
|
260
|
-
const book = await createBook(
|
|
273
|
+
const branch = await fixtures.createBranch();
|
|
274
|
+
const book = await fixtures.createBook(branch.id);
|
|
261
275
|
const receipt = await mine.execute({ card: book.id, action: TransitionAction.Update, changes: { title: 'Mine' } }, { wait: true });
|
|
262
276
|
same(await theirs.cards.load(book.id), null, 'load');
|
|
263
277
|
await rejects(theirs.cards.get(book.id), WorkcardNotFound, 'get');
|
|
@@ -274,15 +288,16 @@ const cases = [
|
|
|
274
288
|
name: 'purges everything under a deleted project, keeping at most its own delete as a tombstone',
|
|
275
289
|
run: async ({ facade }) => {
|
|
276
290
|
const planning = facade(organization());
|
|
277
|
-
const
|
|
278
|
-
const
|
|
279
|
-
const
|
|
280
|
-
const
|
|
291
|
+
const fixtures = conformanceFixturesOf(planning);
|
|
292
|
+
const doomed = await fixtures.createBranch('Doomed branch');
|
|
293
|
+
const kept = await fixtures.createBranch('Kept branch');
|
|
294
|
+
const first = await fixtures.createBook(doomed.id, 'First');
|
|
295
|
+
const second = await fixtures.createBook(doomed.id, 'Second');
|
|
281
296
|
await execute(planning, { card: second.id, action: TransitionAction.Link, link: { type: 'sequel-of', to: first.id } });
|
|
282
297
|
const summary = (await (await planning.model(first)).write('summary', '{}', { wait: true })).card;
|
|
283
|
-
const annex = await createBranch(
|
|
284
|
-
const deeper = await createBook(
|
|
285
|
-
const survivor = await createBook(
|
|
298
|
+
const annex = await fixtures.createBranch('Annex', { parent: doomed.id });
|
|
299
|
+
const deeper = await fixtures.createBook(annex.id, 'Deeper');
|
|
300
|
+
const survivor = await fixtures.createBook(kept.id, 'Survivor');
|
|
286
301
|
const deleted = await planning.execute({ card: doomed.id, action: TransitionAction.Delete }, { wait: true });
|
|
287
302
|
for (const id of [doomed.id, first.id, second.id, summary.id, annex.id, deeper.id]) {
|
|
288
303
|
same(await planning.cards.load(id), null, `purged ${id}`);
|
|
@@ -301,7 +316,8 @@ const cases = [
|
|
|
301
316
|
run: async ({ facade, store }) => {
|
|
302
317
|
const org = organization();
|
|
303
318
|
const planning = facade(org);
|
|
304
|
-
const
|
|
319
|
+
const fixtures = conformanceFixturesOf(planning);
|
|
320
|
+
const book = await fixtures.createBook((await fixtures.createBranch()).id);
|
|
305
321
|
// A row two past the card with nothing between — its allocation lost long ago.
|
|
306
322
|
const rogue = await store.transitions.append({
|
|
307
323
|
entityId: org, card: book.id, kind: WorkcardKind.Card, type: LIBRARY.book, seq: 3,
|
|
@@ -321,6 +337,7 @@ const cases = [
|
|
|
321
337
|
needs: ['schemas'],
|
|
322
338
|
run: async ({ facade }) => {
|
|
323
339
|
const planning = facade(organization());
|
|
340
|
+
const fixtures = conformanceFixturesOf(planning);
|
|
324
341
|
const pamphlets = {
|
|
325
342
|
id: 'library:pamphlet-life', version: 1,
|
|
326
343
|
statuses: [{ key: 'stacked', intrinsic: IntrinsicStatus.Planned, initial: true }, { key: 'taken', intrinsic: IntrinsicStatus.Closed }],
|
|
@@ -331,11 +348,11 @@ const cases = [
|
|
|
331
348
|
};
|
|
332
349
|
const written = await planning.definitions.define({ flows: [pamphlets], types: [pamphlet] });
|
|
333
350
|
same(written.map(record => [record.kind, record.key, record.version]), [[PlanningSchemaKind.Flow, pamphlets.id, 1], [PlanningSchemaKind.Type, pamphlet.type, 1]], 'flows first, then types');
|
|
334
|
-
const branch = await createBranch(
|
|
351
|
+
const branch = await fixtures.createBranch();
|
|
335
352
|
const card = await execute(planning, { card: { kind: WorkcardKind.Card, type: pamphlet.type, parent: branch.id, title: 'Opening hours' }, action: TransitionAction.Create });
|
|
336
353
|
same([card?.status, card?.intrinsic], ['stacked', IntrinsicStatus.Planned], 'the data-defined flow started it');
|
|
337
354
|
same((await planning.model(card)).available().map(rule => rule.name), ['take'], 'the model reads the layer');
|
|
338
|
-
await transit(
|
|
355
|
+
await fixtures.transit(card.id, 'take');
|
|
339
356
|
const room = await execute(planning, { card: { kind: WorkcardKind.Project, type: LIBRARY.room, title: 'Reading room' }, action: TransitionAction.Create });
|
|
340
357
|
await rejects(planning.execute({ card: { kind: WorkcardKind.Card, type: pamphlet.type, parent: room.id, title: 'Refused' }, action: TransitionAction.Create }), CardTypeNotAllowed, 'a project without scopedCardTypes');
|
|
341
358
|
const bundle = await planning.definitions.bundle();
|
|
@@ -348,8 +365,9 @@ const cases = [
|
|
|
348
365
|
needs: ['schemas'],
|
|
349
366
|
run: async ({ facade }) => {
|
|
350
367
|
const planning = facade(organization());
|
|
351
|
-
const
|
|
352
|
-
const
|
|
368
|
+
const fixtures = conformanceFixturesOf(planning);
|
|
369
|
+
const branch = await fixtures.createBranch();
|
|
370
|
+
const other = await fixtures.createBranch('Other branch');
|
|
353
371
|
await planning.definitions.define({ types: [{ ...PERIODICAL_TYPE, label: 'Magazine' }] });
|
|
354
372
|
await planning.definitions.define({ types: [{ ...PERIODICAL_TYPE, label: 'Zine' }] }, { project: branch.id });
|
|
355
373
|
const labelOf = async (project) => (await planning.definitions.registry(project)).type(LIBRARY.periodical).label;
|
|
@@ -383,6 +401,7 @@ const cases = [
|
|
|
383
401
|
needs: ['schemas'],
|
|
384
402
|
run: async ({ facade }) => {
|
|
385
403
|
const planning = facade(organization());
|
|
404
|
+
const fixtures = conformanceFixturesOf(planning);
|
|
386
405
|
const definitions = planning.definitions;
|
|
387
406
|
const repair = {
|
|
388
407
|
id: 'library:repair', version: 1,
|
|
@@ -397,13 +416,13 @@ const cases = [
|
|
|
397
416
|
type: 'library:folio', kind: WorkcardKind.Card, version: 1, fields: { type: 'object' }, flows: [repair.id], specifications: [],
|
|
398
417
|
};
|
|
399
418
|
await definitions.define({ flows: [repair], types: [folio] });
|
|
400
|
-
const branch = await createBranch(
|
|
419
|
+
const branch = await fixtures.createBranch();
|
|
401
420
|
const card = await execute(planning, { card: { kind: WorkcardKind.Card, type: folio.type, parent: branch.id, title: 'Old map' }, action: TransitionAction.Create });
|
|
402
|
-
await transit(
|
|
421
|
+
await fixtures.transit(card.id, 'mend');
|
|
403
422
|
await rejects(definitions.retire(PlanningSchemaKind.Flow, repair.id), SchemaInUse, 'a flow a live type runs');
|
|
404
423
|
// The flow changes under the card: `mending` is no longer declared, and the card still moves.
|
|
405
424
|
await definitions.define({ flows: [{ ...repair, statuses: [repair.statuses[0], repair.statuses[2]], transitions: [{ name: 'finish', from: ['queued'], to: 'done' }] }] });
|
|
406
|
-
await transit(
|
|
425
|
+
await fixtures.transit(card.id, 'finish');
|
|
407
426
|
same((await planning.cards.get(card.id)).status, 'done', 'an undeclared status follows the rule of the name');
|
|
408
427
|
await definitions.retire(PlanningSchemaKind.Type, folio.type);
|
|
409
428
|
await rejects(planning.execute({ card: { kind: WorkcardKind.Card, type: folio.type, parent: branch.id, title: 'New map' }, action: TransitionAction.Create }), UnknownWorkcardType, 'nothing new of a retired type');
|