@milehimikey/em 1.22.0 → 1.22.2
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/.claude/skills/event-modeling/SKILL.md +1 -1
- package/.claude/skills/event-modeling-conform/SKILL.md +1 -1
- package/.claude/skills/event-modeling-design/SKILL.md +5 -2
- package/.claude/skills/event-modeling-discover/SKILL.md +1 -1
- package/.claude/skills/event-modeling-engagement/SKILL.md +1 -1
- package/.claude/skills/event-modeling-implement/SKILL.md +1 -1
- package/.claude/skills/event-modeling-review/SKILL.md +1 -1
- package/.claude/skills/event-modeling-shared/reference/em-dsl.md +41 -0
- package/.claude-plugin/marketplace.json +2 -2
- package/dist/cli/api.d.ts +60 -17
- package/dist/cli/api.js +154 -34
- package/dist/cli/api.js.map +1 -1
- package/dist/cli/scopeInputs.js +2 -2
- package/dist/cli/scopeInputs.js.map +1 -1
- package/dist/emit/api.d.ts +18 -0
- package/dist/emit/api.js +117 -3
- package/dist/emit/api.js.map +1 -1
- package/dist/emit/apiSurfaceJson.d.ts +1 -1
- package/dist/emit/apiSurfaceJson.js +18 -1
- package/dist/emit/apiSurfaceJson.js.map +1 -1
- package/dist/emit/diffJson.d.ts +1 -1
- package/dist/emit/diffJson.js +20 -1
- package/dist/emit/diffJson.js.map +1 -1
- package/dist/emit/json.d.ts +42 -1
- package/dist/emit/json.js +65 -6
- package/dist/emit/json.js.map +1 -1
- package/dist/mcp/server.js +7 -6
- package/dist/mcp/server.js.map +1 -1
- package/dist/model/diff.d.ts +19 -1
- package/dist/model/diff.js +99 -0
- package/dist/model/diff.js.map +1 -1
- package/dist/model/model.d.ts +88 -4
- package/dist/model/model.js +98 -3
- package/dist/model/model.js.map +1 -1
- package/dist/model/refs.d.ts +4 -0
- package/dist/model/refs.js +35 -1
- package/dist/model/refs.js.map +1 -1
- package/dist/model/rules.d.ts +61 -0
- package/dist/model/rules.js +72 -0
- package/dist/model/rules.js.map +1 -1
- package/dist/model/validate.js +137 -4
- package/dist/model/validate.js.map +1 -1
- package/dist/parser/ast.d.ts +30 -0
- package/dist/parser/parser.js +67 -1
- package/dist/parser/parser.js.map +1 -1
- package/dist/render/sliceDiagram.js +6 -0
- package/dist/render/sliceDiagram.js.map +1 -1
- package/dist/render/storylineDiagram.js +6 -0
- package/dist/render/storylineDiagram.js.map +1 -1
- package/dist/system/adaptation.d.ts +5 -2
- package/dist/system/adaptation.js +5 -3
- package/dist/system/adaptation.js.map +1 -1
- package/package.json +2 -1
- package/plugin/.claude-plugin/plugin.json +2 -2
- package/plugin/shared/reference/em-dsl.md +41 -0
- package/plugin/skills/conform/SKILL.md +1 -1
- package/plugin/skills/design/SKILL.md +5 -2
- package/plugin/skills/discover/SKILL.md +1 -1
- package/plugin/skills/engagement/SKILL.md +1 -1
- package/plugin/skills/event-modeling/SKILL.md +1 -1
- package/plugin/skills/implement/SKILL.md +1 -1
- package/plugin/skills/review/SKILL.md +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: event-modeling
|
|
3
|
-
em-version: 1.22.
|
|
3
|
+
em-version: 1.22.2
|
|
4
4
|
description: >-
|
|
5
5
|
Use when the user runs `/event-modeling` (with or without a phase name), or wants to resume an
|
|
6
6
|
event-modeling session without specifying which part of the process applies. Reads the model's
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: event-modeling-conform
|
|
3
|
-
em-version: 1.22.
|
|
3
|
+
em-version: 1.22.2
|
|
4
4
|
description: >-
|
|
5
5
|
Use when checking a ratified event model (and its slice docs) for drift against the codebase
|
|
6
6
|
that implements it — advisory only, never a gate, never an unprompted edit — or when walking
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: event-modeling-design
|
|
3
|
-
em-version: 1.22.
|
|
3
|
+
em-version: 1.22.2
|
|
4
4
|
description: >-
|
|
5
5
|
Use when structuring a draft event model into swimlanes and the four patterns (State Change,
|
|
6
6
|
State View, Automation, Translation), evaluating a model's structural completeness, or writing
|
|
@@ -234,7 +234,10 @@ For each slice:
|
|
|
234
234
|
1. Hold a Socratic deep-dive to fill every section of `../event-modeling-shared/templates/slice.md`:
|
|
235
235
|
intent, trigger/actor,
|
|
236
236
|
command fields (types & rules), event(s) + payload (mark immutable facts) — field names and
|
|
237
|
-
types go into the `.em`, the doc's tables are generated from it
|
|
237
|
+
types go into the `.em`, the doc's tables are generated from it (on a `public` element, a
|
|
238
|
+
field's type must be the fixed scalar table, a declared `type`, a declared identity `scalar`,
|
|
239
|
+
or a declared `enum` — see `em-dsl.md`'s Strict public types/Identity scalars/Enums
|
|
240
|
+
sections) — invariants
|
|
238
241
|
(give each a stable ID — see **Invariants live in the model** below), Given/When/Then scenarios (happy path + rule boundaries + edge cases),
|
|
239
242
|
alternate/error flows (retries, idempotency, compensations), non-functional requirements
|
|
240
243
|
(security/authz, PII/compliance, performance/SLA), read models affected, open questions. Park
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: event-modeling-discover
|
|
3
|
-
em-version: 1.22.
|
|
3
|
+
em-version: 1.22.2
|
|
4
4
|
description: >-
|
|
5
5
|
Use when starting a brand-new event model from scratch — greenfield discovery: brainstorming
|
|
6
6
|
past-tense events, storyboarding the happy path, finding the commands and read models — or when
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: event-modeling-engagement
|
|
3
|
-
em-version: 1.22.
|
|
3
|
+
em-version: 1.22.2
|
|
4
4
|
description: >-
|
|
5
5
|
Use when leading an engagement: building a named set of ratified event-modeling slices
|
|
6
6
|
(`em engagement`) into one independent PR per slice, each against main, by dispatching the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: event-modeling-implement
|
|
3
|
-
em-version: 1.22.
|
|
3
|
+
em-version: 1.22.2
|
|
4
4
|
description: >-
|
|
5
5
|
Use when building a single ratified event-modeling slice (status: ready-to-implement) into
|
|
6
6
|
merged, tested code — the one phase where the agent builds rather than facilitates. Gates on
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: event-modeling-review
|
|
3
|
-
em-version: 1.22.
|
|
3
|
+
em-version: 1.22.2
|
|
4
4
|
description: >-
|
|
5
5
|
Use when starting em's live browser viewer (`em watch --serve`) so a team can watch a model
|
|
6
6
|
update in real time, or facilitating a SCHEDULED stakeholder walkthrough that steps through
|
|
@@ -352,6 +352,8 @@ slice "Name" [source "url"] { # one vertical time step (a column); source is
|
|
|
352
352
|
arrow From Element -> To Element # explicit cross-slice edge (overrides inferred flow)
|
|
353
353
|
|
|
354
354
|
type Name { field: Type, ... } # named structured type, reusable from any field (see Named types)
|
|
355
|
+
scalar Name: base # identity alias over a public scalar table entry (see Named types)
|
|
356
|
+
enum Name { member, ... } # closed named value set, reusable from any field (see Named types)
|
|
355
357
|
```
|
|
356
358
|
|
|
357
359
|
### Element kinds (8 keywords, nothing else)
|
|
@@ -367,6 +369,11 @@ type Name { field: Type, ... } # named structured type, reusable from any f
|
|
|
367
369
|
- **Tags:** `@Persona` only on `ui`; `@Context` only on `event`. Undeclared tags auto-create a
|
|
368
370
|
row. Multi-word tags need no quoting — the tag captures everything after `@` to end of line
|
|
369
371
|
(`ui Ticket Queue @Customer Service` matches `persona Customer Service`).
|
|
372
|
+
- **Optional fields:** a trailing `?` on a field name marks it optional (it may be absent);
|
|
373
|
+
fields are required by default (MIL-237). `note?: text`, typeless `note?` and quoted
|
|
374
|
+
`"display name"?: text` all work, and the `?` is never part of the name. `em export` carries
|
|
375
|
+
`optional: true|false`, `em api generate` emits `name?: T`, the slice-doc table shows
|
|
376
|
+
Required `no`, and `em diff` / `em api check` report a required<->optional flip.
|
|
370
377
|
- **`from "X"`** on views/automations declares the source(s); names are quoted, comma-separated.
|
|
371
378
|
Matching is case-insensitive and whitespace-normalized. A `from` may never point at an event or
|
|
372
379
|
view that first appears in a LATER slice (forward-only timeline — validation error).
|
|
@@ -620,6 +627,31 @@ how tree/recursive data (categories, org charts, comment threads, BOMs) gets exp
|
|
|
620
627
|
fields and ordinary element fields alike) — `{ name, ref, array }` when resolved, `null`
|
|
621
628
|
otherwise. `em diff` tracks types added/removed and field changes on surviving types.
|
|
622
629
|
|
|
630
|
+
**Identity scalars** (GH #477): `scalar Name: base` declares an identity alias over one public
|
|
631
|
+
scalar table entry (`base`, case-insensitive) — so a `public` field can carry a domain name on
|
|
632
|
+
the wire (`orderId: OrderId`) instead of degrading to the bare table type (`uuid`) to satisfy
|
|
633
|
+
[Strict public types](#strict-public-types). Reference it bare or `Name[]`, same as a declared
|
|
634
|
+
`type`; on a `public` element it satisfies the strict table directly, on an internal element it
|
|
635
|
+
resolves opportunistically. `em validate` errors on an unknown `base`, a redeclared name, or a
|
|
636
|
+
name colliding with a declared `type` (either direction). `em api generate` declares a used
|
|
637
|
+
scalar once, after the table scalars, extending the formatted table scalar
|
|
638
|
+
(`scalar OrderId extends Uuid;`) or the core type (`scalar Sku extends string;`) — a model with
|
|
639
|
+
no `scalar` emits unchanged. `em export` adds `model.scalars[]` and an additive `scalarRef` field
|
|
640
|
+
key, mutually exclusive with `typeRef`.
|
|
641
|
+
|
|
642
|
+
**Enums** (GH #478): `enum Name { member, … }` declares a closed, named value set — members are
|
|
643
|
+
bare identifiers or quoted strings, in declaration order. Reference it bare or `Name[]`, same
|
|
644
|
+
as a declared `type`/`scalar`; on a `public` element it satisfies the strict table directly, on
|
|
645
|
+
an internal element it resolves opportunistically. `em validate` errors on an empty enum, a
|
|
646
|
+
case-insensitive duplicate member, a redeclared name, or a name colliding with a declared
|
|
647
|
+
`type`/`scalar` (either direction). `em api generate` declares a used enum once, members in
|
|
648
|
+
declaration order (`enum OrderStatus { placed, shipped }`), after the scalar declarations and
|
|
649
|
+
before type blocks — a member that isn't a bare TypeSpec identifier emits as a quoted string
|
|
650
|
+
literal; a model with no `enum` emits unchanged. `em export` adds `model.enums[]` and an
|
|
651
|
+
additive `enumRef` field key, mutually exclusive with both `typeRef` and `scalarRef`. `em api
|
|
652
|
+
check --base` judges a surviving enum's member changes by role: removed/renamed is breaking on
|
|
653
|
+
an output, added is breaking on an input, additive on a pure output.
|
|
654
|
+
|
|
623
655
|
### Swimlane band order (top → bottom)
|
|
624
656
|
Header row → **Automation** (only if used) → **persona** rows (in declared order) → **API**
|
|
625
657
|
(commands + views share this lane) → **context** rows (in declared order).
|
|
@@ -950,11 +982,17 @@ not the prose above has caught up yet. `--slice-ready <key>`-only codes are excl
|
|
|
950
982
|
| `doc-names-unfed-event` | warning | Doc names an event its view does not read | Add the event to the view's `from` in the model (if the edge is real), or fix the doc's Source column / scenario. |
|
|
951
983
|
| `doc-omits-fed-event` | warning | Doc omits an event its view reads | Mention the event in the view's Source column (run `em slice sync`), or drop it from the view's `from`. |
|
|
952
984
|
| `duplicate-element-ref` | warning | Duplicate element ref | Rename the element so its export ref is unique. |
|
|
985
|
+
| `duplicate-enum-ref` | warning | Duplicate enum ref | Rename the enum so its export ref is unique. |
|
|
953
986
|
| `duplicate-model-key` | warning | Duplicate model key | Give each model a unique `model "Name"` so its key (and every cross-model ref) is stable. |
|
|
954
987
|
| `duplicate-name` | warning | Duplicate name | Rename one of the duplicates. |
|
|
988
|
+
| `duplicate-scalar-ref` | warning | Duplicate scalar ref | Rename the scalar so its export ref is unique. |
|
|
955
989
|
| `duplicate-slice-name` | warning | Duplicate slice name | Rename the slice so its export key is unique. |
|
|
956
990
|
| `duplicate-type-name` | warning | Duplicate type name | Rename one of the duplicate `type` declarations. |
|
|
957
991
|
| `duplicate-type-ref` | warning | Duplicate type ref | Rename the type so its export ref is unique. |
|
|
992
|
+
| `enum-duplicate-member` | error | Enum duplicate member | Remove or rename the duplicate member — members are compared case-insensitively. |
|
|
993
|
+
| `enum-duplicate-name` | error | Enum duplicate name | Declare the enum once; rename or remove the duplicate `enum` block. |
|
|
994
|
+
| `enum-empty` | error | Empty enum | Give the enum at least one member, or remove the declaration. |
|
|
995
|
+
| `enum-name-collision` | error | Enum/type/scalar name collision | Rename the `enum` or the colliding `type`/`scalar` so the names no longer collide — a name can't mean both at once. |
|
|
958
996
|
| `fields-completeness/event-field-no-source` | warning | Event field not from a command | Add the field to a command that records the event (in any slice), mark it assigned if the handler sets it, or remove it from the event. |
|
|
959
997
|
| `fields-completeness/view-field-no-source` | warning | View field with no source | Add the field to a source event, or remove it from the view. |
|
|
960
998
|
| `frontmatter-coherence-implemented-without-link` | warning | Implemented without a link | Add `implementedIn` once the slice ships. |
|
|
@@ -987,6 +1025,9 @@ not the prose above has caught up yet. `--slice-ready <key>`-only codes are excl
|
|
|
987
1025
|
| `reaction-from-future-view` | error | Backward timeline (reaction reads a future view) | Declare the view in or before the reaction's slice. |
|
|
988
1026
|
| `reaction-from-unresolved` | error | Unknown read-model source | Project the event into a view first, or fix the `from` reference. |
|
|
989
1027
|
| `retry-slice-of` | warning | Slice only retries another command | Re-fire the same reaction via `view … again from` the retry-scheduled event; a different actor's override is its own slice with its own command (docs/patterns.md#automation). |
|
|
1028
|
+
| `scalar-duplicate-name` | error | Scalar duplicate name | Declare the scalar once; rename or remove the duplicate `scalar` line. |
|
|
1029
|
+
| `scalar-type-name-collision` | error | Scalar/type name collision | Rename the `scalar` or the `type` so the two names no longer collide — a name can't mean both at once. |
|
|
1030
|
+
| `scalar-unknown-base` | error | Scalar unknown base | Point `base` at one of the public scalar table's names (string, text, int, long, decimal, boolean, uuid, date, datetime, duration, bytes), case-insensitive. |
|
|
990
1031
|
| `scenario-then-not-outcome` | warning | Scenario's Then names no event or rejection | Make the Then bullets name the event(s) the command records, or the rejection/error it returns. |
|
|
991
1032
|
| `scenario-when-not-command` | warning | Scenario's When does not name the slice's command | Make the When bullet name the slice's command (for a reaction slice: the command, the reaction element, or a view of the slice) — each scenario exercises exactly one command. For a Translation, naming the translation element satisfies it. |
|
|
992
1033
|
| `seam-consumer-not-reaction` | error | Seam consumer is not a reaction | Point `to` at a translation/automation element (or a slice containing exactly one). |
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "em-1-22-
|
|
2
|
+
"name": "em-1-22-2",
|
|
3
3
|
"owner": {
|
|
4
4
|
"name": "Mike Key"
|
|
5
5
|
},
|
|
6
|
-
"description": "em v1.22.
|
|
6
|
+
"description": "em v1.22.2: the Event Modeling skill bundle and MCP server as a Claude Code plugin.",
|
|
7
7
|
"plugins": [
|
|
8
8
|
{
|
|
9
9
|
"name": "em",
|
package/dist/cli/api.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NormalizedModel } from "../model/model.js";
|
|
2
2
|
import { Diagnostic } from "../model/validate.js";
|
|
3
3
|
import { compile } from "../pipeline.js";
|
|
4
|
-
import { ElementExport, FieldExport, TypeExport } from "../emit/json.js";
|
|
4
|
+
import { ElementExport, EnumExport, FieldExport, TypeExport } from "../emit/json.js";
|
|
5
5
|
import { RefsResult } from "../model/refs.js";
|
|
6
6
|
import { GitRunner } from "./diff-inputs.js";
|
|
7
7
|
/** `<modelDir>/contracts/<modelKey>.tsp` (R6), built from the model path as given. */
|
|
@@ -30,7 +30,7 @@ export interface ApiCheckChange {
|
|
|
30
30
|
}
|
|
31
31
|
type Role = "input" | "output";
|
|
32
32
|
interface SurfaceEntry {
|
|
33
|
-
/** command | event | view | type */
|
|
33
|
+
/** command | event | view | type | enum */
|
|
34
34
|
kind: string;
|
|
35
35
|
name: string;
|
|
36
36
|
/** Normalized identity key: kind + normalizeName(name). */
|
|
@@ -38,11 +38,13 @@ interface SurfaceEntry {
|
|
|
38
38
|
fields: FieldExport[];
|
|
39
39
|
renamedFrom: string[];
|
|
40
40
|
roles: Set<Role>;
|
|
41
|
-
/** Model-declared invariants (MIL-265), declaration order; `[]` for a type. */
|
|
41
|
+
/** Model-declared invariants (MIL-265), declaration order; `[]` for a type/enum. */
|
|
42
42
|
invariants: {
|
|
43
43
|
id: string;
|
|
44
44
|
rule: string | null;
|
|
45
45
|
}[];
|
|
46
|
+
/** GH #478: an enum's own members, in declaration order — `[]` for every non-enum kind. */
|
|
47
|
+
members: string[];
|
|
46
48
|
}
|
|
47
49
|
interface Surface {
|
|
48
50
|
entries: SurfaceEntry[];
|
|
@@ -51,14 +53,29 @@ interface Surface {
|
|
|
51
53
|
allElements: Set<string>;
|
|
52
54
|
}
|
|
53
55
|
/** Build the public surface of one compiled model: public commands (input), events and views
|
|
54
|
-
* (output), and every declared type reachable from them (carrying the roles that reach
|
|
56
|
+
* (output), and every declared type/enum reachable from them (carrying the roles that reach
|
|
57
|
+
* it — GH #478 extends the existing type-reach walk to also track an `enumRef` field,
|
|
58
|
+
* directly or through a reachable type's own fields, the same way `reachableEnumRefs`
|
|
59
|
+
* (emit/api.ts) tracks it for `em api generate`). `enums` defaults to `[]` so every existing
|
|
60
|
+
* caller (and the one test helper that built a `Surface` before enums existed) keeps compiling
|
|
61
|
+
* without a required third argument at a call site that never has one. */
|
|
55
62
|
export declare function surfaceOf(slices: {
|
|
56
63
|
elements: ElementExport[];
|
|
57
|
-
}[], types: TypeExport[]): Surface;
|
|
58
|
-
/** A field's type as the contract sees it: a declared type's
|
|
59
|
-
* normalized, with its array arity. */
|
|
60
|
-
export declare function typeLabel(f: Pick<FieldExport, "type" | "typeRef">): string;
|
|
61
|
-
|
|
64
|
+
}[], types: TypeExport[], enums?: EnumExport[]): Surface;
|
|
65
|
+
/** A field's type as the contract sees it: a declared type's, identity scalar's or enum's
|
|
66
|
+
* name, or the raw string, normalized, with its array arity. */
|
|
67
|
+
export declare function typeLabel(f: Pick<FieldExport, "type" | "typeRef" | "scalarRef" | "enumRef">): string;
|
|
68
|
+
/**
|
|
69
|
+
* GH #477: a `scalarRef` folds its `base` into the identity string too, not just `ref`/`array` —
|
|
70
|
+
* so a surviving scalar DECLARATION's base changing (`OrderId: uuid` -> `OrderId: string`)
|
|
71
|
+
* registers as a type change on every field that uses it, even though the scalar's own ref and
|
|
72
|
+
* the field's array arity are unchanged. This reuses `diffFields`' existing per-field
|
|
73
|
+
* `compare()` rather than adding a second comparison path — see its `scalarRef`-aware branch
|
|
74
|
+
* below for the breaking-change message this produces. GH #478: `enumRef` needs no equivalent
|
|
75
|
+
* fold — an enum's MEMBER changes are diffed on the enum's own `SurfaceEntry` (`diffEnumMembers`
|
|
76
|
+
* below), not per using field, so `ref`/`array` alone identify a field's enum reference here.
|
|
77
|
+
*/
|
|
78
|
+
export declare function typeIdentity(f: Pick<FieldExport, "type" | "typeRef" | "scalarRef" | "enumRef">): string;
|
|
62
79
|
/** Diff two public surfaces. `base === null` means the model did not exist at the base
|
|
63
80
|
* revision: every HEAD element is an additive addition. */
|
|
64
81
|
export declare function diffSurfaces(base: Surface | null, head: Surface): ApiCheckChange[];
|
|
@@ -96,13 +113,21 @@ export type ApiCheckOutcome = {
|
|
|
96
113
|
export declare function runApiCheck(file: string, base: string | undefined, runGit?: GitRunner): ApiCheckOutcome;
|
|
97
114
|
/** The text report: one status line, then one `additive:`/`breaking:` line per change. */
|
|
98
115
|
export declare function formatApiCheckText(r: ApiCheckReport): string[];
|
|
99
|
-
/** A public field's resolved type (R7's fixed table
|
|
100
|
-
* `resolvePublicType` (model/model.ts) computes —
|
|
101
|
-
* key and the TypeSpec core scalar `em api
|
|
102
|
-
*
|
|
116
|
+
/** A public field's resolved type (R7's fixed table, a declared identity scalar, a declared
|
|
117
|
+
* enum, or a declared type), the same shape `resolvePublicType` (model/model.ts) computes —
|
|
118
|
+
* `scalar` carries the matched table entry's key and the TypeSpec core scalar `em api
|
|
119
|
+
* generate` emits for it; `declared` carries the reachable type's own name (see
|
|
120
|
+
* `ApiSurfaceType` below for its full field shape); `scalar-alias` (GH #477, schema 1.1)
|
|
121
|
+
* carries the declared identity scalar's own name in `tsType` (what actually appears in the
|
|
122
|
+
* generated contract, same convention `declared` already uses) and the table key it extends
|
|
123
|
+
* in `base` — `scalar`/`declared` leave `base` `null`; `enum` (GH #478, schema 1.2) carries
|
|
124
|
+
* the declared enum's own name in `tsType`, same convention — find its members under the
|
|
125
|
+
* report's own `enums` list. */
|
|
103
126
|
export interface ApiSurfaceFieldType {
|
|
104
|
-
kind: "scalar" | "declared";
|
|
127
|
+
kind: "scalar" | "declared" | "scalar-alias" | "enum";
|
|
105
128
|
scalar: string | null;
|
|
129
|
+
/** The `PUBLIC_SCALAR_TYPES` key a `scalar-alias` extends; `null` for every other kind. */
|
|
130
|
+
base: string | null;
|
|
106
131
|
tsType: string;
|
|
107
132
|
array: boolean;
|
|
108
133
|
}
|
|
@@ -133,6 +158,20 @@ export interface ApiSurfaceType {
|
|
|
133
158
|
slug: string;
|
|
134
159
|
fields: ApiSurfaceField[];
|
|
135
160
|
}
|
|
161
|
+
/** One declared `scalar Name: base` identity alias reachable from a public command/event/view's
|
|
162
|
+
* fields (GH #477, schema 1.1) — `base` is the `PUBLIC_SCALAR_TYPES` key it extends. */
|
|
163
|
+
export interface ApiSurfaceScalar {
|
|
164
|
+
name: string;
|
|
165
|
+
slug: string;
|
|
166
|
+
base: string;
|
|
167
|
+
}
|
|
168
|
+
/** One declared `enum Name { member, … }` reachable from a public command/event/view's fields
|
|
169
|
+
* (GH #478, schema 1.2) — `members` in declaration order, raw (unquoted). */
|
|
170
|
+
export interface ApiSurfaceEnum {
|
|
171
|
+
name: string;
|
|
172
|
+
slug: string;
|
|
173
|
+
members: string[];
|
|
174
|
+
}
|
|
136
175
|
export interface ApiSurfaceReport {
|
|
137
176
|
file: string;
|
|
138
177
|
modelKey: string;
|
|
@@ -140,6 +179,8 @@ export interface ApiSurfaceReport {
|
|
|
140
179
|
events: ApiSurfaceElement[];
|
|
141
180
|
views: ApiSurfaceElement[];
|
|
142
181
|
types: ApiSurfaceType[];
|
|
182
|
+
scalars: ApiSurfaceScalar[];
|
|
183
|
+
enums: ApiSurfaceEnum[];
|
|
143
184
|
}
|
|
144
185
|
export type ApiSurfaceOutcome = {
|
|
145
186
|
ok: true;
|
|
@@ -154,9 +195,11 @@ export type ApiSurfaceOutcome = {
|
|
|
154
195
|
* Build the `em api surface` report for an already-validated (error-free) model: the `public`
|
|
155
196
|
* commands/events/views (`publicSurfaceOf`, same as `em api generate`/`em api check`) plus every
|
|
156
197
|
* declared type reachable from their fields (`reachableTypeRefs`, same walk `em api generate`'s
|
|
157
|
-
* contract body uses),
|
|
158
|
-
*
|
|
159
|
-
* `
|
|
198
|
+
* contract body uses), every declared identity scalar reachable the same way
|
|
199
|
+
* (`reachableScalarRefs`, GH #477), and every declared enum reachable the same way
|
|
200
|
+
* (`reachableEnumRefs`, GH #478), each field's type resolved through `resolvePublicType` — the
|
|
201
|
+
* one notion of the public surface every em surface shares, so a companion tool never re-derives
|
|
202
|
+
* it from `em export --json` and risks drifting from it.
|
|
160
203
|
*/
|
|
161
204
|
export declare function buildApiSurfaceReport(model: NormalizedModel, refs: RefsResult, diagnostics: Diagnostic[], source: string, file: string): ApiSurfaceReport;
|
|
162
205
|
/**
|