@owlmeans/server-planning 0.1.18-rc.16 → 0.1.18-rc.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/server-planning/SKILL.md +37 -40
- package/build/facade.d.ts +11 -6
- package/build/facade.d.ts.map +1 -1
- package/build/facade.js +47 -11
- package/build/facade.js.map +1 -1
- package/package.json +11 -11
- package/src/facade.ts +50 -12
- package/tests/narrowing.spec.ts +94 -0
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.18 @owlmeans/planning@^0.1.18-rc.15 ajv
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Concepts
|
|
@@ -169,7 +169,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
169
169
|
your project's skill store (`.agents/skills/`):
|
|
170
170
|
|
|
171
171
|
```sh
|
|
172
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
172
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.46
|
|
173
173
|
```
|
|
174
174
|
|
|
175
175
|
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.18",
|
|
5
|
+
"generatedAt": "2026-10-03T11:19:50.770Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -8,7 +8,7 @@ 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.18"` 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
|
|
@@ -31,8 +31,9 @@ reuses the `./store` subpath (`foldPending`, `makeCommitHub`) without pulling fa
|
|
|
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
|
| `scopeOf(req, extra?)`, `accessScopeOf(req, access, extra?)`, `handlerScopeOf`, `assertGranted`, `actorOf(req)`, `concealed(run)`, `clampSeconds` | Scope and security helpers |
|
|
34
|
-
| `makeDefinitions(runtime, facade)`, `makeSchemaViews(opts)`, `projectCriteriaOf(projects)` | Data-defined schemas and the project narrowing |
|
|
34
|
+
| `makeDefinitions(runtime, facade)`, `makeSchemaViews(opts)`, `projectCriteriaOf(projects, through?)` | Data-defined schemas and the project narrowing |
|
|
35
35
|
| `makeProjectionProcessor(ctx, opts?)`, `planningQueueHooks(ctx, opts?)` | A generic projection job body and its `onJobDead` |
|
|
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 |
|
|
36
37
|
| `./store`: `makeMemoryPlanningStore`, `foldPending`, `failPending`, `revisionsFromLog`, `commitEventOf`, `makeCommitHub`, `makeCompositeStore`, `wantsSpecifications` | What stores are built from |
|
|
37
38
|
| `./conformance`: `planningConformance`, `conformanceCasesFor`, `planningConformancePlugin`, `conformanceClock`, `ConformanceFailure` | The store conformance suite, runner-agnostic |
|
|
38
39
|
|
|
@@ -115,7 +116,7 @@ await planning.definitions!.define({
|
|
|
115
116
|
| Wrong | What happens | Right |
|
|
116
117
|
|---|---|---|
|
|
117
118
|
| `execute({ action, draft: { … } })` | refused: `planning:malformed:create-without-draft` | the draft goes under `card` |
|
|
118
|
-
| `execute({ …, wait: true })` | in process the key is ignored: the receipt returns before the commit, with no `card` | `execute({ … }, { wait: true })` — only the wire body (`ExecuteRequest`) carries `wait` inside |
|
|
119
|
+
| `execute({ …, wait: true })` | in process the key is ignored: the receipt returns before the commit, with no `card` — hidden while an inline-folding store (`planning-postgres`) lands at once, exposed the first time another process holds the card's fold | `execute({ … }, { wait: true })` — only the wire body (`ExecuteRequest`) carries `wait` inside |
|
|
119
120
|
| `ctx.planning().for(…)` in a target | `ctx.planning is not a function` | `ctx.service<PlanningHostService>(PLANNING_SERVICE).for(…)` |
|
|
120
121
|
| `{ id, name: 'Repair', … }` on a flow, `{ key, name, … }` on a type | `define` refuses with `SchemaInvalid` (closed schemas); a code plugin's registry does not validate, so the key is silently dropped | a flow's key is `id`, a type's is `type`, the display name is `label` on both |
|
|
121
122
|
| `action: 'create'` | a type error — `TransitionAction` is an enum | `action: TransitionAction.Create` |
|
|
@@ -141,8 +142,7 @@ Nothing is appended before step 11 — every refusal leaves the log untouched.
|
|
|
141
142
|
default store holds data-defined schemas, the card's project is found first and everything
|
|
142
143
|
after reads that project's resolved layer (`Resolved.schemas`): a data-defined type of a
|
|
143
144
|
project with `scopedCardTypes` is admitted, a retired type creates nothing
|
|
144
|
-
(`UnknownWorkcardType('retired:…')`). Without the port `Resolved.schemas` IS the code registry
|
|
145
|
-
and the order is unchanged.
|
|
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
148
|
(`planning:immutable:*`, `createdBy` among them — `assertCreatorFixed`), merged `fields` (`FieldsInvalid`), labels (`LabelNotAllowed`), a moved
|
|
@@ -164,22 +164,15 @@ Nothing is appended before step 11 — every refusal leaves the log untouched.
|
|
|
164
164
|
in-process caller may add `agent`/`runId` on the execution. A handler never passes a wire `actor`.
|
|
165
165
|
|
|
166
166
|
A create's `createdBy` is the scope's subject too — `creatorOf(scope)`: `profileId`, else `userId`,
|
|
167
|
-
else the same two of `scope.actor`. The executor stamps it on every path, so
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
refused with `planning:immutable:createdBy` on every action — a create's `changes` overlay too, since
|
|
177
|
-
the draft is its one source — whether it came over the wire, from an in-process caller, or from a
|
|
178
|
-
`before` plugin (validation runs after the chain), and nothing is appended. The executor holds this
|
|
179
|
-
check itself (`assertCreatorFixed`), beside `@owlmeans/planning`'s `assertMutable`, so it stands
|
|
180
|
-
whatever planning build a host resolves. `createdAt` is an identity key and refused the same way. A
|
|
181
|
-
row appended before the refusal existed still folds as written (the fold replays the log; guards
|
|
182
|
-
live at admission), and the conformance suite checks a store folds it like the pure fold does.
|
|
167
|
+
else the same two of `scope.actor`. The executor stamps it on every path, so an in-process facade
|
|
168
|
+
create and the HTTP `execute` produce the same owner. An in-process draft that names `createdBy`
|
|
169
|
+
keeps it (explicit wins — a manager creating on someone's behalf); a scope naming nobody (a service
|
|
170
|
+
or system scope) leaves it unset; the wire drops a draft's `createdBy` before the stamp.
|
|
171
|
+
|
|
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
|
|
174
|
+
in-process caller and a plugin are refused alike, whatever `@owlmeans/planning` build the host
|
|
175
|
+
resolves. The conformance suite checks a store folds a stored row naming it as the pure fold does.
|
|
183
176
|
|
|
184
177
|
## Idempotency and `expectSeq`
|
|
185
178
|
|
|
@@ -221,8 +214,8 @@ the store; `bind` replaces the listener, so a store has exactly one.
|
|
|
221
214
|
the criteria asks for `kind: specification` or a `category` (`wantsSpecifications`, the rule every
|
|
222
215
|
store routes by).
|
|
223
216
|
- `schemas: true` adds the data-defined schema port (records per layer, a revision per
|
|
224
|
-
organization, synchronous `watch`); off by default
|
|
225
|
-
|
|
217
|
+
organization, synchronous `watch`); off by default — without it every type and flow resolves
|
|
218
|
+
from code.
|
|
226
219
|
- `sync` (default) folds, publishes and runs `committed` inside `project()`, serialized per card.
|
|
227
220
|
`sync: false` folds nothing until `flush(card?)` — a queued store's shape, for tests that need a
|
|
228
221
|
commit to stay pending.
|
|
@@ -288,14 +281,13 @@ mapping external records (`mappers`) belongs to that plugin's own store adapter.
|
|
|
288
281
|
|
|
289
282
|
- Without `opts.access`: `entityId` is `requireEntityKey(req)`; `opts.scope(req, ctx)` adds a
|
|
290
283
|
`channel` or `service` and can never replace the entity. `actor` and a create's `createdBy` come
|
|
291
|
-
from the request, never the body (`wireExecution` drops a draft's claim
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
(`@owlmeans/server-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
the application's own), the same key for everybody. Take it from the request in the handler and
|
|
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. `requireEntityKey(req)` answers
|
|
287
|
+
`req.entity.id`, the stable record id (the token's `entitySlug` only where no entity resolver is
|
|
288
|
+
registered). Behind an OIDC relying party (`@owlmeans/server-oidc-rp`) the acting organization is
|
|
289
|
+
session state: the guard attaches `req.entity` with `id` = the organization claim's frozen
|
|
290
|
+
`entityKey`, so the tenant key survives a rename and follows a switch. Take it in the handler and
|
|
299
291
|
pass it down; never read it from the context or from a body.
|
|
300
292
|
- Another entity's card, specification or transition answers `WorkcardNotFound` — the same as an
|
|
301
293
|
absent id — on reads and writes alike (`concealed`).
|
|
@@ -308,15 +300,20 @@ mapping external records (`mappers`) belongs to that plugin's own store adapter.
|
|
|
308
300
|
decision per request; a throw is the request's answer (an `AuthForbidden` answers 403).
|
|
309
301
|
|
|
310
302
|
- `entityId` is the resolver's — never the token's, never `opts.scope`'s.
|
|
311
|
-
- `projects` becomes `PlanningScope.projects`, which the server facade enforces
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
list)
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
- A
|
|
319
|
-
|
|
303
|
+
- `projects` becomes `PlanningScope.projects`, which the server facade enforces on every read and
|
|
304
|
+
write. Visible are the projects, every card whose `parents` name one, and every specification
|
|
305
|
+
whose parent card is visible (its `parents` hold only that card). Anything else reads as absent
|
|
306
|
+
(`WorkcardNotFound`, `null`, an empty list); a create under an invisible parent is
|
|
307
|
+
`ParentNotFound`; links and transitions are filtered by `project` (and post-filtered, for a store
|
|
308
|
+
that ignores the field); commit subscriptions drop events outside the set and a status or wait
|
|
309
|
+
refuses them.
|
|
310
|
+
- **A narrowed list or count sees a specification whenever its parent card is visible** — exactly
|
|
311
|
+
what a single read admits. It is AND'd with `projectCriteriaOf(projects, through)`; when its
|
|
312
|
+
criteria ask for specifications (`wantsSpecifications`) the facade resolves `through` (the visible
|
|
313
|
+
parent cards) with ONE read per call: the query's `parent`, else the projects' own cards. A
|
|
314
|
+
summary counts no specification and pays nothing extra. `tests/narrowing.spec.ts` pins it.
|
|
315
|
+
- A person who may see only SOME projects of their organization (a tool-shed volunteer given one
|
|
316
|
+
shed) is expressed here: the resolver answers the project ids the person's grants list as
|
|
320
317
|
`projects`, and omits the key when a grant covers every project — never a hand-written filter in
|
|
321
318
|
each handler.
|
|
322
319
|
- `grants` gates the stock handlers' writes: `createProjects` (a project create — `true` for the
|
package/build/facade.d.ts
CHANGED
|
@@ -2,10 +2,12 @@ import type { PlanningFacade, PlanningScope, Workcard } from '@owlmeans/planning
|
|
|
2
2
|
import type { Criteria } from '@owlmeans/resource';
|
|
3
3
|
import type { PlanningRuntime } from './service.js';
|
|
4
4
|
/**
|
|
5
|
-
* The criteria a scope narrowed to `projects` adds to every card
|
|
6
|
-
* every card whose `parents` name one of them
|
|
5
|
+
* The criteria a scope narrowed to `projects` adds to every card list, count and summary: the
|
|
6
|
+
* projects themselves, every card whose `parents` name one of them, and the specifications whose
|
|
7
|
+
* parent card is one of `through` — the cards of those projects a specification is seen through,
|
|
8
|
+
* exactly as a single read sees it (a specification's `parents` hold only its own card).
|
|
7
9
|
*/
|
|
8
|
-
export declare const projectCriteriaOf: (projects: readonly string[]) => Criteria<Workcard>;
|
|
10
|
+
export declare const projectCriteriaOf: (projects: readonly string[], through?: readonly string[]) => Criteria<Workcard>;
|
|
9
11
|
/**
|
|
10
12
|
* The scoped facade over the service's stores.
|
|
11
13
|
*
|
|
@@ -14,9 +16,12 @@ export declare const projectCriteriaOf: (projects: readonly string[]) => Criteri
|
|
|
14
16
|
* `WorkcardNotFound`, exactly as for an id that never existed. Reads go through the composite
|
|
15
17
|
* store (the default store plus the stores plugins own); writes go through the executor.
|
|
16
18
|
*
|
|
17
|
-
* A scope naming `projects` sees those projects
|
|
18
|
-
*
|
|
19
|
-
*
|
|
19
|
+
* A scope naming `projects` sees those projects, the cards whose `parents` name one of them, and a
|
|
20
|
+
* specification whose parent card is one of those (a card's specification through its card);
|
|
21
|
+
* everything else reads as absent. Lists, counts and summaries are narrowed by an AND'd criteria
|
|
22
|
+
* that admits the same cards a single read does — the parent cards a specification is seen through
|
|
23
|
+
* are resolved once per call ({@link projectCriteriaOf}) — and commit events and transitions
|
|
24
|
+
* outside the set are dropped or refused.
|
|
20
25
|
*
|
|
21
26
|
* `definitions` is present when the default store holds data-defined schemas; a model is then
|
|
22
27
|
* built over the registry of the card's own project.
|
package/build/facade.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facade.d.ts","sourceRoot":"","sources":["../src/facade.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACiB,cAAc,EAAE,aAAa,EACxD,QAAQ,EACT,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAGlD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"facade.d.ts","sourceRoot":"","sources":["../src/facade.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACiB,cAAc,EAAE,aAAa,EACxD,QAAQ,EACT,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAGlD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAInD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,aAAc,SAAS,MAAM,EAAE,YAAW,SAAS,MAAM,EAAE,KAAQ,QAAQ,CAAC,QAAQ,CAM1F,CAAA;AAExB;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,eAAe,YAAa,eAAe,SAAS,aAAa,KAAG,cA+OhF,CAAA"}
|
package/build/facade.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { criteriaOf, currentSpecification, isProject, isSpecification, linkWhereOf, listOptionsOf, modelOf, projectOf, PlanningUnsupported, specCriteriaOf, transitionWhereOf, WorkcardKind, WorkcardNotFound, } from '@owlmeans/planning';
|
|
2
2
|
import { makeDefinitions } from './definitions.js';
|
|
3
3
|
import { executeTransition } from './executor.js';
|
|
4
|
+
import { wantsSpecifications } from './store/memory.js';
|
|
4
5
|
/**
|
|
5
|
-
* The criteria a scope narrowed to `projects` adds to every card
|
|
6
|
-
* every card whose `parents` name one of them
|
|
6
|
+
* The criteria a scope narrowed to `projects` adds to every card list, count and summary: the
|
|
7
|
+
* projects themselves, every card whose `parents` name one of them, and the specifications whose
|
|
8
|
+
* parent card is one of `through` — the cards of those projects a specification is seen through,
|
|
9
|
+
* exactly as a single read sees it (a specification's `parents` hold only its own card).
|
|
7
10
|
*/
|
|
8
|
-
export const projectCriteriaOf = (projects) => ({
|
|
9
|
-
$or: [
|
|
11
|
+
export const projectCriteriaOf = (projects, through = []) => ({
|
|
12
|
+
$or: [
|
|
13
|
+
{ id: { $in: [...projects] } },
|
|
14
|
+
{ parents: { $overlaps: [...projects] } },
|
|
15
|
+
...(through.length > 0 ? [{ kind: WorkcardKind.Specification, parent: { $in: [...through] } }] : []),
|
|
16
|
+
],
|
|
10
17
|
});
|
|
11
18
|
/**
|
|
12
19
|
* The scoped facade over the service's stores.
|
|
@@ -16,9 +23,12 @@ export const projectCriteriaOf = (projects) => ({
|
|
|
16
23
|
* `WorkcardNotFound`, exactly as for an id that never existed. Reads go through the composite
|
|
17
24
|
* store (the default store plus the stores plugins own); writes go through the executor.
|
|
18
25
|
*
|
|
19
|
-
* A scope naming `projects` sees those projects
|
|
20
|
-
*
|
|
21
|
-
*
|
|
26
|
+
* A scope naming `projects` sees those projects, the cards whose `parents` name one of them, and a
|
|
27
|
+
* specification whose parent card is one of those (a card's specification through its card);
|
|
28
|
+
* everything else reads as absent. Lists, counts and summaries are narrowed by an AND'd criteria
|
|
29
|
+
* that admits the same cards a single read does — the parent cards a specification is seen through
|
|
30
|
+
* are resolved once per call ({@link projectCriteriaOf}) — and commit events and transitions
|
|
31
|
+
* outside the set are dropped or refused.
|
|
22
32
|
*
|
|
23
33
|
* `definitions` is present when the default store holds data-defined schemas; a model is then
|
|
24
34
|
* built over the registry of the card's own project.
|
|
@@ -42,9 +52,35 @@ export const makeStoreFacade = (runtime, scope) => {
|
|
|
42
52
|
}
|
|
43
53
|
return null;
|
|
44
54
|
};
|
|
45
|
-
|
|
55
|
+
/**
|
|
56
|
+
* The cards a narrowed list or count may see specifications THROUGH — what {@link visible} admits
|
|
57
|
+
* one by: its parent card in the scope's projects. One read per call, and only for criteria that
|
|
58
|
+
* ask for specifications at all (`wantsSpecifications`, the rule every store routes a list by): the
|
|
59
|
+
* parent the query names, or else the projects' own cards. A summary counts no specification.
|
|
60
|
+
*/
|
|
61
|
+
const throughOf = async (where, parent) => {
|
|
62
|
+
if (projects == null || projects.length === 0 || !wantsSpecifications(where)) {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
if (parent != null) {
|
|
66
|
+
const card = mine(await reader().cards.get(parent, entityId));
|
|
67
|
+
return card != null && inProjects(card) ? [parent] : [];
|
|
68
|
+
}
|
|
69
|
+
const listed = await reader().cards.list({ entityId, parents: { $overlaps: projects } }, { size: 0 });
|
|
70
|
+
// A project's own specifications are matched by their `parents` already.
|
|
71
|
+
return listed.items.filter(card => card.id != null && !projects.includes(card.id) && inProjects(card)).map(card => card.id);
|
|
72
|
+
};
|
|
73
|
+
/** A narrowed list's or count's criteria — `through` as {@link throughOf} resolved it. */
|
|
74
|
+
const narrowed = async (query) => {
|
|
75
|
+
const where = criteriaOf(query, scope);
|
|
76
|
+
return narrow(where, await throughOf(where, query?.parent));
|
|
77
|
+
};
|
|
78
|
+
const narrow = (where, through = []) => projects == null
|
|
46
79
|
? where
|
|
47
|
-
: {
|
|
80
|
+
: {
|
|
81
|
+
...where,
|
|
82
|
+
$and: [...(where.$and ?? []), projectCriteriaOf(projects, through)],
|
|
83
|
+
};
|
|
48
84
|
const projectVisible = (project) => projects == null || (project != null && projects.includes(project));
|
|
49
85
|
const commitSource = () => {
|
|
50
86
|
const commits = reader().commits;
|
|
@@ -87,8 +123,8 @@ export const makeStoreFacade = (runtime, scope) => {
|
|
|
87
123
|
}
|
|
88
124
|
return card;
|
|
89
125
|
},
|
|
90
|
-
list: async (query) => await reader().cards.list(
|
|
91
|
-
count: async (query) => await reader().cards.count(
|
|
126
|
+
list: async (query) => await reader().cards.list(await narrowed(query), listOptionsOf(query)),
|
|
127
|
+
count: async (query) => await reader().cards.count(await narrowed(query)),
|
|
92
128
|
summary: async (parents, query) => parents.length === 0
|
|
93
129
|
? {}
|
|
94
130
|
: await reader().cards.summary(parents, narrow(criteriaOf({ kind: query?.kind, type: query?.type }, scope))),
|
package/build/facade.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facade.js","sourceRoot":"","sources":["../src/facade.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAAE,oBAAoB,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAC5G,mBAAmB,EAAE,cAAc,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,GACvF,MAAM,oBAAoB,CAAA;AAM3B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAIjD;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,QAA2B,EAAsB,EAAE,CAAC,CAAC;IACrF,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,CAAC,GAAG,QAAQ,CAAC,EAAE,EAAE,CAAC;CACjF,CAAuB,CAAA;AAExB;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAwB,EAAE,KAAoB,EAAkB,EAAE;IAChG,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAA;IAC/B,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC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MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAM,CAAC,CAAC,CAAC,IAAI,CAAA;YAClF,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBACjC,MAAM,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,CAAA;YAC5D,CAAC;YACD,IAAI,OAAO,CAAC,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC;gBAClC,OAAO,OAAO,CAAI,MAAM,EAAE,MAAM,CAAC,CAAA;YACnC,CAAC;YACD,2EAA2E;YAC3E,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA;YAC5E,OAAO,OAAO,CAAI,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,CAAA;QACnD,CAAC;KACF,CAAA;IAED,IAAI,OAAO,CAAC,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC;QAClC,MAAM,CAAC,WAAW,GAAG,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IACvD,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/server-planning",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.18",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The general planning implementation — the planning service and its plugin/middleware registry, the transition executor, the in-memory store, the protocol handlers and the commit feed.",
|
|
6
6
|
"type": "module",
|
|
@@ -44,21 +44,21 @@
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@owlmeans/auth": "^0.1.18-rc.
|
|
48
|
-
"@owlmeans/auth-common": "^0.1.18-rc.
|
|
47
|
+
"@owlmeans/auth": "^0.1.18-rc.38",
|
|
48
|
+
"@owlmeans/auth-common": "^0.1.18-rc.44",
|
|
49
49
|
"@owlmeans/basic-ids": "^0.1.18-rc.34",
|
|
50
50
|
"@owlmeans/context": "^0.1.18-rc.32",
|
|
51
|
-
"@owlmeans/entrypoint": "^0.1.18-rc.
|
|
51
|
+
"@owlmeans/entrypoint": "^0.1.18-rc.39",
|
|
52
52
|
"@owlmeans/error": "^0.1.18-rc.36",
|
|
53
|
-
"@owlmeans/planning": "^0.1.18-rc.
|
|
54
|
-
"@owlmeans/queue": "^0.1.18-rc.
|
|
53
|
+
"@owlmeans/planning": "^0.1.18-rc.15",
|
|
54
|
+
"@owlmeans/queue": "^0.1.18-rc.38",
|
|
55
55
|
"@owlmeans/resource": "^0.1.18-rc.37",
|
|
56
56
|
"@owlmeans/route": "^0.1.18-rc.33",
|
|
57
|
-
"@owlmeans/server-api": "^0.1.18-rc.
|
|
58
|
-
"@owlmeans/server-context": "^0.1.18-rc.
|
|
59
|
-
"@owlmeans/server-entrypoint": "^0.1.18-rc.
|
|
60
|
-
"@owlmeans/server-socket": "^0.1.18-rc.
|
|
61
|
-
"@owlmeans/socket": "^0.1.18-rc.
|
|
57
|
+
"@owlmeans/server-api": "^0.1.18-rc.48",
|
|
58
|
+
"@owlmeans/server-context": "^0.1.18-rc.40",
|
|
59
|
+
"@owlmeans/server-entrypoint": "^0.1.18-rc.38",
|
|
60
|
+
"@owlmeans/server-socket": "^0.1.18-rc.51",
|
|
61
|
+
"@owlmeans/socket": "^0.1.18-rc.37"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"ajv": "*",
|
package/src/facade.ts
CHANGED
|
@@ -4,20 +4,27 @@ import {
|
|
|
4
4
|
} from '@owlmeans/planning'
|
|
5
5
|
import type {
|
|
6
6
|
CommitEvent, CommitSource, PlanningFacade, PlanningScope, Relationship, Specification, Transition,
|
|
7
|
-
Workcard, WorkcardModel,
|
|
7
|
+
Workcard, WorkcardModel, WorkcardQuery,
|
|
8
8
|
} from '@owlmeans/planning'
|
|
9
9
|
import type { Criteria } from '@owlmeans/resource'
|
|
10
10
|
import { makeDefinitions } from './definitions.js'
|
|
11
11
|
import { executeTransition } from './executor.js'
|
|
12
12
|
import type { PlanningRuntime } from './service.js'
|
|
13
|
+
import { wantsSpecifications } from './store/memory.js'
|
|
13
14
|
import type { CommitHub } from './store/types.js'
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
|
-
* The criteria a scope narrowed to `projects` adds to every card
|
|
17
|
-
* every card whose `parents` name one of them
|
|
17
|
+
* The criteria a scope narrowed to `projects` adds to every card list, count and summary: the
|
|
18
|
+
* projects themselves, every card whose `parents` name one of them, and the specifications whose
|
|
19
|
+
* parent card is one of `through` — the cards of those projects a specification is seen through,
|
|
20
|
+
* exactly as a single read sees it (a specification's `parents` hold only its own card).
|
|
18
21
|
*/
|
|
19
|
-
export const projectCriteriaOf = (projects: readonly string[]): Criteria<Workcard> => ({
|
|
20
|
-
$or: [
|
|
22
|
+
export const projectCriteriaOf = (projects: readonly string[], through: readonly string[] = []): Criteria<Workcard> => ({
|
|
23
|
+
$or: [
|
|
24
|
+
{ id: { $in: [...projects] } },
|
|
25
|
+
{ parents: { $overlaps: [...projects] } },
|
|
26
|
+
...(through.length > 0 ? [{ kind: WorkcardKind.Specification, parent: { $in: [...through] } }] : []),
|
|
27
|
+
],
|
|
21
28
|
}) as Criteria<Workcard>
|
|
22
29
|
|
|
23
30
|
/**
|
|
@@ -28,9 +35,12 @@ export const projectCriteriaOf = (projects: readonly string[]): Criteria<Workcar
|
|
|
28
35
|
* `WorkcardNotFound`, exactly as for an id that never existed. Reads go through the composite
|
|
29
36
|
* store (the default store plus the stores plugins own); writes go through the executor.
|
|
30
37
|
*
|
|
31
|
-
* A scope naming `projects` sees those projects
|
|
32
|
-
*
|
|
33
|
-
*
|
|
38
|
+
* A scope naming `projects` sees those projects, the cards whose `parents` name one of them, and a
|
|
39
|
+
* specification whose parent card is one of those (a card's specification through its card);
|
|
40
|
+
* everything else reads as absent. Lists, counts and summaries are narrowed by an AND'd criteria
|
|
41
|
+
* that admits the same cards a single read does — the parent cards a specification is seen through
|
|
42
|
+
* are resolved once per call ({@link projectCriteriaOf}) — and commit events and transitions
|
|
43
|
+
* outside the set are dropped or refused.
|
|
34
44
|
*
|
|
35
45
|
* `definitions` is present when the default store holds data-defined schemas; a model is then
|
|
36
46
|
* built over the registry of the card's own project.
|
|
@@ -58,9 +68,37 @@ export const makeStoreFacade = (runtime: PlanningRuntime, scope: PlanningScope):
|
|
|
58
68
|
return null
|
|
59
69
|
}
|
|
60
70
|
|
|
61
|
-
|
|
71
|
+
/**
|
|
72
|
+
* The cards a narrowed list or count may see specifications THROUGH — what {@link visible} admits
|
|
73
|
+
* one by: its parent card in the scope's projects. One read per call, and only for criteria that
|
|
74
|
+
* ask for specifications at all (`wantsSpecifications`, the rule every store routes a list by): the
|
|
75
|
+
* parent the query names, or else the projects' own cards. A summary counts no specification.
|
|
76
|
+
*/
|
|
77
|
+
const throughOf = async (where: Criteria<Workcard>, parent?: string): Promise<string[]> => {
|
|
78
|
+
if (projects == null || projects.length === 0 || !wantsSpecifications(where)) {
|
|
79
|
+
return []
|
|
80
|
+
}
|
|
81
|
+
if (parent != null) {
|
|
82
|
+
const card = mine(await reader().cards.get(parent, entityId))
|
|
83
|
+
return card != null && inProjects(card) ? [parent] : []
|
|
84
|
+
}
|
|
85
|
+
const listed = await reader().cards.list({ entityId, parents: { $overlaps: projects } } as unknown as Criteria<Workcard>, { size: 0 })
|
|
86
|
+
// A project's own specifications are matched by their `parents` already.
|
|
87
|
+
return listed.items.filter(card => card.id != null && !projects.includes(card.id) && inProjects(card)).map(card => card.id!)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** A narrowed list's or count's criteria — `through` as {@link throughOf} resolved it. */
|
|
91
|
+
const narrowed = async (query?: WorkcardQuery | null): Promise<Criteria<Workcard>> => {
|
|
92
|
+
const where = criteriaOf(query, scope)
|
|
93
|
+
return narrow(where, await throughOf(where, query?.parent))
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const narrow = (where: Criteria<Workcard>, through: readonly string[] = []): Criteria<Workcard> => projects == null
|
|
62
97
|
? where
|
|
63
|
-
: {
|
|
98
|
+
: {
|
|
99
|
+
...where,
|
|
100
|
+
$and: [...((where as { $and?: Criteria<Workcard>[] }).$and ?? []), projectCriteriaOf(projects, through)],
|
|
101
|
+
} as Criteria<Workcard>
|
|
64
102
|
|
|
65
103
|
const projectVisible = (project?: string | null): boolean =>
|
|
66
104
|
projects == null || (project != null && projects.includes(project))
|
|
@@ -113,9 +151,9 @@ export const makeStoreFacade = (runtime: PlanningRuntime, scope: PlanningScope):
|
|
|
113
151
|
return card
|
|
114
152
|
},
|
|
115
153
|
|
|
116
|
-
list: async query => await reader().cards.list(
|
|
154
|
+
list: async query => await reader().cards.list(await narrowed(query), listOptionsOf(query)),
|
|
117
155
|
|
|
118
|
-
count: async query => await reader().cards.count(
|
|
156
|
+
count: async query => await reader().cards.count(await narrowed(query)),
|
|
119
157
|
|
|
120
158
|
summary: async (parents, query) => parents.length === 0
|
|
121
159
|
? {}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test'
|
|
2
|
+
import { WorkcardKind, WorkcardNotFound } from '@owlmeans/planning'
|
|
3
|
+
import type { PlanningFacade, Workcard } from '@owlmeans/planning'
|
|
4
|
+
import { createProject, createTask, ENTITY, makeTestPlanning, PROFILE } from './context.js'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Two projects with a task each, a design document on each task and a plan on the first project —
|
|
8
|
+
* a specification's `parents` hold only its own card, so a scope narrowed to one project sees the
|
|
9
|
+
* task's document through the task.
|
|
10
|
+
*/
|
|
11
|
+
const fixture = async () => {
|
|
12
|
+
const planning = await makeTestPlanning()
|
|
13
|
+
const owner = planning.facade()
|
|
14
|
+
const granted = await createProject(owner, 'Granted')
|
|
15
|
+
const hidden = await createProject(owner, 'Hidden')
|
|
16
|
+
const seen = (await createTask(owner, granted.id!, 'Seen')).card!
|
|
17
|
+
const unseen = (await createTask(owner, hidden.id!, 'Unseen')).card!
|
|
18
|
+
const write = async (card: Workcard, category: string, body: string): Promise<Workcard> =>
|
|
19
|
+
(await (await owner.model(card)).write(category, body, { wait: true })).card!
|
|
20
|
+
const design = await write(seen, 'design', '{"steps":[1]}')
|
|
21
|
+
const hiddenDesign = await write(unseen, 'design', '{"steps":[2]}')
|
|
22
|
+
const plan = await write(granted, 'plan', '{"steps":[3]}')
|
|
23
|
+
const scoped = (projects: string[]): PlanningFacade =>
|
|
24
|
+
planning.service.for({ entityId: ENTITY, profileId: PROFILE, channel: 'test', projects })
|
|
25
|
+
|
|
26
|
+
return { ...planning, owner, granted, hidden, seen, unseen, design, hiddenDesign, plan, scoped }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const ids = (items: Workcard[]): string[] => items.map(card => card.id!).sort()
|
|
30
|
+
|
|
31
|
+
describe('@owlmeans/server-planning — a narrowed scope lists what it reads', () => {
|
|
32
|
+
test('a granted card\'s specification is listed and counted as it is read', async () => {
|
|
33
|
+
const { seen, unseen, design, hiddenDesign, plan, granted, scoped } = await fixture()
|
|
34
|
+
const member = scoped([granted.id!])
|
|
35
|
+
|
|
36
|
+
expect((await member.cards.get(design.id!)).id).toBe(design.id!)
|
|
37
|
+
await expect(member.cards.get(hiddenDesign.id!)).rejects.toBeInstanceOf(WorkcardNotFound)
|
|
38
|
+
|
|
39
|
+
const underCard = await member.cards.list({ parent: seen.id!, kind: WorkcardKind.Specification })
|
|
40
|
+
expect(ids(underCard.items)).toEqual([design.id!])
|
|
41
|
+
expect(underCard.total).toBe(1)
|
|
42
|
+
expect(await member.cards.count({ parent: seen.id!, kind: WorkcardKind.Specification })).toBe(1)
|
|
43
|
+
expect((await member.cards.list({ parent: unseen.id!, kind: WorkcardKind.Specification })).items).toEqual([])
|
|
44
|
+
expect(await member.cards.count({ parent: unseen.id! })).toBe(0)
|
|
45
|
+
|
|
46
|
+
const everyDocument = await member.cards.list({ kind: WorkcardKind.Specification })
|
|
47
|
+
expect(ids(everyDocument.items)).toEqual([design.id!, plan.id!].sort())
|
|
48
|
+
expect(await member.cards.count({ kind: WorkcardKind.Specification })).toBe(2)
|
|
49
|
+
expect(ids((await member.cards.list({ kind: WorkcardKind.Card })).items)).toEqual([seen.id!])
|
|
50
|
+
|
|
51
|
+
expect(ids((await member.cards.list({ parent: seen.id!, category: 'design' })).items)).toEqual([design.id!])
|
|
52
|
+
expect((await member.specifications.list(seen.id!)).total).toBe(1)
|
|
53
|
+
// A summary counts a parent's cards, never its documents.
|
|
54
|
+
expect(Object.keys(await member.cards.summary([granted.id!, seen.id!, unseen.id!]))).toEqual([granted.id!])
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
test('every card the narrowed scope reads is the one it lists, and no other', async () => {
|
|
58
|
+
const { owner, granted, scoped } = await fixture()
|
|
59
|
+
const member = scoped([granted.id!])
|
|
60
|
+
const every = { size: 0, kind: [WorkcardKind.Project, WorkcardKind.Card, WorkcardKind.Specification] }
|
|
61
|
+
const everything = (await owner.cards.list(every)).items
|
|
62
|
+
const listed = new Set(ids((await member.cards.list(every)).items))
|
|
63
|
+
|
|
64
|
+
expect(everything.length).toBe(7)
|
|
65
|
+
for (const card of everything) {
|
|
66
|
+
expect([card.id, (await member.cards.load(card.id!)) != null]).toEqual([card.id, listed.has(card.id!)])
|
|
67
|
+
}
|
|
68
|
+
expect(listed.size).toBe(4)
|
|
69
|
+
expect(await member.cards.count(every)).toBe(listed.size)
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
test('a scope with no project, or another one, sees none of the granted project\'s documents', async () => {
|
|
73
|
+
const { seen, design, plan, hidden, scoped } = await fixture()
|
|
74
|
+
|
|
75
|
+
for (const outsider of [scoped([]), scoped([hidden.id!])]) {
|
|
76
|
+
await expect(outsider.cards.get(design.id!)).rejects.toBeInstanceOf(WorkcardNotFound)
|
|
77
|
+
expect((await outsider.cards.list({ parent: seen.id!, kind: WorkcardKind.Specification })).items).toEqual([])
|
|
78
|
+
expect(await outsider.cards.count({ parent: seen.id! })).toBe(0)
|
|
79
|
+
const documents = ids((await outsider.cards.list({ kind: WorkcardKind.Specification })).items)
|
|
80
|
+
expect(documents).not.toContain(design.id!)
|
|
81
|
+
expect(documents).not.toContain(plan.id!)
|
|
82
|
+
}
|
|
83
|
+
expect((await scoped([]).cards.list({ size: 0, kind: [WorkcardKind.Card, WorkcardKind.Specification] })).total).toBe(0)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
test('an unnarrowed scope sees every document of the organization', async () => {
|
|
87
|
+
const { owner, unseen, design, hiddenDesign, plan } = await fixture()
|
|
88
|
+
|
|
89
|
+
expect(ids((await owner.cards.list({ kind: WorkcardKind.Specification })).items))
|
|
90
|
+
.toEqual([design.id!, hiddenDesign.id!, plan.id!].sort())
|
|
91
|
+
expect(await owner.cards.count({ kind: WorkcardKind.Specification })).toBe(3)
|
|
92
|
+
expect(ids((await owner.cards.list({ parent: unseen.id!, kind: WorkcardKind.Specification })).items)).toEqual([hiddenDesign.id!])
|
|
93
|
+
})
|
|
94
|
+
})
|