foldkit-surface 0.1.0 → 0.2.0

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 CHANGED
@@ -1,14 +1,27 @@
1
1
  # `foldkit-surface`
2
2
 
3
- The observation boundary for a Foldkit application. A Surface is a **pure
4
- projection** of the Model: it declares exactly which fields a feature reads and
5
- which Messages it may construct, and it does so from the application's existing
6
- Schema, not a second hand-written interface.
3
+ Say once, in one value, which parts of a Foldkit Model a feature reads and which
4
+ Messages it may send. That value — a **Surface** — is derived from the Model's
5
+ own Schema rather than a second hand-written interface, so it cannot name a
6
+ field the Model does not have. It reads the Model purely, it binds a renderer,
7
+ and it can be inspected: given a Surface, a tool can answer "what does this
8
+ screen depend on?" without running anything.
9
+
10
+ Reach for it when something else needs that answer. `foldkit-remote` fetches
11
+ exactly the server fields the active Surfaces read; `foldkit-sync` replicates
12
+ exactly the Model slice a feature declares; `Module.validate` catches two
13
+ features claiming the same Model path before either runs. If nothing needs to
14
+ inspect a feature's data needs, a plain function of the Model is simpler — this
15
+ package performs no I/O, renders nothing itself, and adds no runtime behaviour
16
+ of its own.
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ pnpm add foldkit-surface
22
+ ```
7
23
 
8
- `foldkit-surface` is the foundation under
9
- [`foldkit-sync`](https://github.com/doeixd/foldkit-plus/tree/main/packages/sync)
10
- and [`foldkit-remote`](https://github.com/doeixd/foldkit-plus/tree/main/packages/remote):
11
- both consume the projection and Message-subset values this package produces.
24
+ `foldkit` and `effect` are peer dependencies.
12
25
 
13
26
  ## Quick start
14
27
 
@@ -17,8 +30,10 @@ import { Schema } from 'effect'
17
30
  import { defineMessageUnion } from 'foldkit/message'
18
31
  import { Projection, Surface } from 'foldkit-surface'
19
32
 
33
+ const Todo = Schema.Struct({ id: Schema.String, title: Schema.String, done: Schema.Boolean })
20
34
  const Model = Schema.Struct({
21
- todos: Schema.Array(Schema.Struct({ id: Schema.String, title: Schema.String, done: Schema.Boolean })),
35
+ todos: Schema.Array(Todo),
36
+ todosById: Schema.Record(Schema.String, Todo),
22
37
  selectedTodoId: Schema.NullOr(Schema.String),
23
38
  })
24
39
  const Message = defineMessageUnion({
@@ -43,7 +58,7 @@ const update = (model: typeof Model.Type, message: typeof Message.Type) => {
43
58
  const App = Surface.application({
44
59
  Model,
45
60
  Message,
46
- initial: { todos: [], selectedTodoId: null },
61
+ initial: { todos: [], todosById: {}, selectedTodoId: null },
47
62
  update,
48
63
  })
49
64
 
@@ -60,12 +75,183 @@ reads purely (`Surface.read(TodoList, model)`), binds a renderer
60
75
  `foldkit-agent` derive their work from. `Projection.pick(App.fields.todos)` is
61
76
  a writable projection of the same field for a replicator.
62
77
 
78
+ ## How this relates to Optics and Submodels
79
+
80
+ Surface sits near two existing ideas in Effect and Foldkit, so the overlap is
81
+ intentional. They operate at different levels:
82
+
83
+ | Concept | What it answers |
84
+ | --- | --- |
85
+ | **Effect Optic** | "How do I focus, read, or replace this value inside another value?" |
86
+ | **`ModelRef` / `Projection`** | "What application data is this focus or derived value made from?" |
87
+ | **Surface** | "What may this feature observe, and which application Messages may it cause?" |
88
+ | **Foldkit Submodel** | "Which state machine owns this state and these transitions?" |
89
+
90
+ A useful shorthand is:
91
+
92
+ ```text
93
+ Optic = structural focus
94
+ Surface = observation + capability contract
95
+ Submodel = state-machine ownership boundary
96
+ ```
97
+
98
+ They compose; none replaces the others.
99
+
100
+ ### Surface builds on Optics rather than replacing them
101
+
102
+ Every generated `ModelRef` contains an Effect `Optic.Optional` underneath it.
103
+ The optic supplies the structural focus. Surface enriches that focus with the
104
+ information the rest of an application architecture needs:
105
+
106
+ ```text
107
+ Effect Optic
108
+ + Schema
109
+ + dependency path
110
+ + application identity
111
+ + get / set
112
+ ↓
113
+ ModelRef
114
+ ↓
115
+ Projection
116
+ + metadata (Remote's requirements, …)
117
+ ↓
118
+ Surface
119
+ + name / params
120
+ + allowed Messages
121
+ ```
122
+
123
+ For example, `App.fields.todos` is not an alternative to an optic. It is an
124
+ optic-backed reference that also knows that the value is the `todos` field of
125
+ *this* application, how it is encoded, and that a consumer depending on it
126
+ depends on the `todos` Model path. `ModelRef.fromOptic` is the escape hatch when
127
+ you already have an optic and want to add that metadata yourself.
128
+
129
+ That extra metadata is the reason Surface exists. An optic can focus
130
+ `model.todos`; by itself it cannot tell `foldkit-sync` that `todos` is the slice
131
+ to replicate, `Module` that another contract claims the same path, or
132
+ `foldkit-remote` that a derived projection needs server data. Surface carries
133
+ that last fact as opaque metadata: `foldkit-remote` attaches its requirements
134
+ under its own `Metadata.key` and reads them back, and Surface only merges them.
135
+
136
+ A `Projection` also need not correspond to one structural focus. It can combine
137
+ several refs or derived values into one read model while preserving the
138
+ dependencies and metadata of every part.
139
+
140
+ ### Surface and Submodels solve different decompositions
141
+
142
+ A [Foldkit Submodel](https://foldkit.dev/core/submodel) is for a part of the
143
+ application that **owns a state machine**. It has its own Model, Message, update,
144
+ view, and Commands. The parent stores the child Model, routes child Messages,
145
+ and delegates transitions to the child's update.
146
+
147
+ A Surface owns none of those things. It has no private state, no child update,
148
+ no runtime boundary, no Message wrapping, and no Command lifting. It describes
149
+ a restricted interface to state and Messages that already belong to the
150
+ application.
151
+
152
+ ```text
153
+ Submodel
154
+ "This child owns how this state changes."
155
+
156
+ Surface
157
+ "This consumer may see these values and cause these application Messages."
158
+ ```
159
+
160
+ The most useful way to distinguish them is by the decomposition they create:
161
+
162
+ ```text
163
+ Submodels divide the application by ownership:
164
+ who owns this state and these transitions?
165
+
166
+ Surfaces divide the application by consumer needs:
167
+ what does this screen / agent / subsystem need to observe and cause?
168
+ ```
169
+
170
+ Those boundaries do not need to line up. In fact, a Surface can deliberately
171
+ span several Submodels because observation is not ownership. A page that reads
172
+ the route, a theme owned by `Settings`, and the signed-in user owned by
173
+ `Session` does not need to become a third state machine just to assemble those
174
+ values:
175
+
176
+ ```ts
177
+ const Model = Schema.Struct({
178
+ route: Route,
179
+ settings: Settings.Model,
180
+ session: Session.Model,
181
+ })
182
+
183
+ const App = Surface.application({ Model, Message, initial, update })
184
+
185
+ const AccountPage = App.surface('AccountPage', {
186
+ model: ({ model }) => ({
187
+ route: model.route, // parent-owned
188
+ theme: model.settings.theme, // Settings Submodel
189
+ user: model.session.user, // Session Submodel
190
+ }),
191
+ })
192
+ ```
193
+
194
+ Conceptually:
195
+
196
+ ```text
197
+ Root application
198
+ ├── route parent-owned
199
+ ├── settings: Settings.Model Settings owns transitions
200
+ └── session: Session.Model Session owns transitions
201
+ │ │
202
+ └───────┬───────┘
203
+ │ observed by
204
+ AccountPage Surface
205
+ (+ parent-owned route)
206
+ ```
207
+
208
+ This is a feature of the model, not a leak in it: **Submodels partition
209
+ transition ownership; Surfaces may cut across those partitions to describe a
210
+ consumer-facing read/capability boundary.** A screen, an agent context, or
211
+ another interpreter often needs a coherent read model assembled from several
212
+ owners.
213
+
214
+ The Surface does **not** weaken any of those Submodel boundaries. Reading
215
+ `model.settings.theme` through a `ModelRef` does not grant permission to change
216
+ it directly. If `Settings` owns that state, changes must still go through the
217
+ Settings state machine: its child Message and update, routed through the normal
218
+ parent/child path (`Update.foldChild`, an exported child helper, or the wrapped
219
+ Message path used by the application).
220
+
221
+ The same rule applies to Surface capabilities. If `AccountPage` may cause a
222
+ Settings transition, expose the **root application Message constructor that
223
+ routes to Settings** in the Surface's `messages`; do not use the underlying
224
+ optic/setter as a shortcut around the child update.
225
+
226
+ `FieldRef.set` and writable `Projection`s are structural/infrastructure tools.
227
+ Their existence does not imply ownership of the focused state. A Submodel's
228
+ invariants still belong to its update.
229
+
230
+ Likewise, Surface does not replace `h.submodel`: `h.submodel` creates the runtime
231
+ child boundary and routes child Messages. A Surface is pure, inspectable data
232
+ that may observe across those runtime boundaries without creating another one.
233
+
234
+ ### Which one should I reach for?
235
+
236
+ - **You need to focus or update nested immutable data:** start with an Effect
237
+ Optic; use `ModelRef.fromOptic` if that focus must participate in Surface
238
+ metadata.
239
+ - **A feature needs its own state, Message vocabulary, update logic, Commands,
240
+ or reusable stateful lifecycle:** use a Foldkit Submodel.
241
+ - **Something needs an inspectable declaration of what existing application
242
+ state a feature reads or which existing Messages it may cause:** use a
243
+ Surface.
244
+ - **A screen or subsystem reads across several Submodels:** use one Surface over
245
+ those child fields; do not invent a new Submodel merely to aggregate them.
246
+ - **You need both:** keep transition ownership in each Submodel and describe the
247
+ consumer-facing observation/capability boundary with Surface.
248
+
63
249
  ## Field references
64
250
 
65
251
  `Surface.application` generates a reference tree from the Model Schema, one node
66
- per field: `App.fields.todos`, `App.fields.someStruct.title`. Each `FieldRef`
67
- carries its optic, codec, `get`, and `set`, plus the field name as a literal type,
68
- so a selection can infer its own output keys without a parallel field registry.
252
+ per field. Each `FieldRef` carries its optic, codec, `get`, and `set`, plus the
253
+ field name as a literal type, so a selection can infer its own output keys
254
+ without a parallel field registry.
69
255
 
70
256
  ```ts
71
257
  App.fields.todos // FieldRef<Model, Todo[], 'todos'>
@@ -74,11 +260,11 @@ App.fields.todosById.at('t1') // OptionalRef<Model, Option<Todo>> (dynamic ke
74
260
  App.fields.todos.index(0) // OptionalRef<Model, Option<Todo>> (dynamic index)
75
261
  ```
76
262
 
77
- Struct fields recurse, so a nested reference such as `App.fields.todo.title` is a
78
- `FieldRef`. Array and record access is `.index(i)` / `.at(key)`, which returns an
79
- `OptionalRef` — a `ModelRef` with an `Option` value. Those are dynamic selections,
80
- so `Projection.pick` (which needs a static field name) rejects them; they are useful
81
- inside a `Projection`.
263
+ A Model field that is itself a `Schema.Struct` recurses, so each of its fields is
264
+ a `FieldRef` too. Array and record access is `.index(i)` / `.at(key)`, which
265
+ returns an `OptionalRef` — a `ModelRef` with an `Option` value. Those are dynamic
266
+ selections, so `Projection.pick` (which needs a static field name) rejects them;
267
+ they are useful inside a `Projection`.
82
268
 
83
269
  `App.model` is the same tree under its older name; prefer `App.fields`.
84
270
 
@@ -100,10 +286,10 @@ have.
100
286
 
101
287
  ## Projections
102
288
 
103
- A `Projection<Root, Value>` is three things: a `Model` codec for `Value`, a pure
104
- `read(root) => Value`, and what it needs: its `dependencies` (Model paths), its
105
- `requirements` (remote entity fields), and its `connections` (remote query
106
- connections, with what they select of each item). Reading never performs I/O.
289
+ A `Projection<Root, Value>` is a `Model` codec for `Value`, a pure
290
+ `read(root) => Value`, its `dependencies` (Model paths), and its `metadata`:
291
+ facts other packages attach and interpret, such as the server data a
292
+ `foldkit-remote` selection needs. Reading never performs I/O.
107
293
 
108
294
  ```ts
109
295
  Projection.struct({ todos: model.todos, selectedTodoId: model.selectedTodoId })
@@ -115,18 +301,41 @@ Projection.fromReader(codec, read) // escape hatch for a non-ModelRef value
115
301
 
116
302
  `Projection.struct` accepts `ModelRef`s and nested `Projection`s, so a Surface can
117
303
  mix local fields with remote or replicated values. A nested projection
118
- contributes its dependencies, requirements, and connections to the parent
119
- (`Requirement.merge` and `Requirement.mergeConnections` union them).
304
+ contributes its dependencies and metadata to the parent.
305
+
306
+ ### Metadata
307
+
308
+ A package declares its own slot once and reads back only its own entries:
309
+
310
+ ```ts
311
+ const Flags = Metadata.key<string>('flags', {
312
+ merge: flags => [...new Set(flags)],
313
+ summarize: flag => flag,
314
+ })
315
+
316
+ const beta = Projection.fromReader(Schema.Boolean, readBeta, { metadata: Flags.of('beta') })
317
+ Flags.get(Projection.struct({ beta, todos: model.todos }).metadata) // ['beta']
318
+ ```
319
+
320
+ Entries are combined per key with that key's `merge` as projections compose, and
321
+ looked up by the key object, never by its name, so two packages cannot collide.
322
+ The flip side: two copies of one package (a duplicated install, a reloaded
323
+ module) declare two keys and do not see each other's entries. `Metadata` is
324
+ opaque and its entries frozen; only a key's `of` and composition make one.
325
+ Surface never interprets them; `Surface.inspect` and `Module` show them through
326
+ `summarize`.
120
327
 
121
328
  ## Applications
122
329
 
123
- `Surface.application({ Model, Message })` captures the pure references (`App.model`,
124
- `App.Model`, `App.Message`, `App.owner`) with no transition. Use it when a
125
- consumer needs only the reference tree.
330
+ `Surface.application({ Model, Message })` returns an `Application`: the schemas
331
+ (`App.Model`, `App.Message`), the reference tree (`App.fields`, `App.model`), the
332
+ identity token (`App.owner`), and `App.surface`. No transition, so a consumer
333
+ that only inspects the Model needs nothing more.
126
334
 
127
- `Surface.application({ Model, Message, initial, update })` additionally captures
128
- the transition and returns a **Runnable** application. `update`'s Commands may
129
- carry resources; the resource set is threaded through the returned type.
335
+ `Surface.application({ Model, Message, initial, update })` adds `App.initial` and
336
+ `App.update` and returns a `RunnableApplication`, which a replicator needs to
337
+ derive the initial shared value and replay. `update`'s Commands may carry
338
+ resources; the resource set is threaded through the returned type.
130
339
 
131
340
  ## Message subsets
132
341
 
@@ -134,6 +343,8 @@ A subset selects typed variants of one application's Message union by constructo
134
343
  reference:
135
344
 
136
345
  ```ts
346
+ import { MessageSet } from 'foldkit-surface'
347
+
137
348
  const TodoChanges = MessageSet.make(App, [Message.CreatedTodo, Message.ToggledTodo])
138
349
  const SelectionChanges = MessageSet.make(App, [Message.SelectedTodo])
139
350
  const AllChanges = MessageSet.union(TodoChanges, SelectionChanges)
@@ -225,9 +436,9 @@ modules can contribute their contracts independently.
225
436
 
226
437
  - Reference-based Model selection (`App.fields`, `Projection.pick`,
227
438
  `Projection.compose`).
228
- - Pure `Projection` values with their codec, reader, dependencies, and remote
229
- requirements.
230
- - Application scopes (`make` / `application`) and their identity token.
439
+ - Pure `Projection` values with their codec, reader, dependencies, and opaque
440
+ interpreter metadata (`Metadata.key`).
441
+ - Application scopes (`Surface.application`) and their identity token.
231
442
  - Typed Message subsets (`MessageSet.make`, `MessageSet.union`).
232
443
  - Named Surfaces and their renderer binding.
233
444
 
@@ -239,4 +450,16 @@ modules can contribute their contracts independently.
239
450
  [`foldkit-sync`](https://github.com/doeixd/foldkit-plus/tree/main/packages/sync).
240
451
  - `Model` codecs are pure by construction: Foldkit Model fields carry no decoding
241
452
  or encoding services.
242
- - A projection declares dependencies and requirements but does not resolve them.
453
+ - A projection declares dependencies and carries metadata but does not act on
454
+ either; an interpreter such as `foldkit-remote` reads the metadata it owns.
455
+
456
+ ## See also
457
+
458
+ - The packages built on this boundary: [`foldkit-remote`](https://github.com/doeixd/foldkit-plus/tree/main/packages/remote) projects requirements
459
+ from it, [`foldkit-sync`](https://github.com/doeixd/foldkit-plus/tree/main/packages/sync) replicates a projection of it, [`foldkit-agent`](https://github.com/doeixd/foldkit-plus/tree/main/packages/agent) makes one
460
+ an agent's context, [`foldkit-mirror`](https://github.com/doeixd/foldkit-plus/tree/main/packages/mirror) keeps one in the URL or a store, and
461
+ [`foldkit-mixins-surface`](https://github.com/doeixd/foldkit-plus/tree/main/packages/mixins-surface) renders one.
462
+ - [Server-derived state](https://github.com/doeixd/foldkit-plus/blob/main/docs/remote.md) — the guide that covers
463
+ this boundary and the Remote Submodel above it.
464
+ - [`examples/todo-app`](https://github.com/doeixd/foldkit-plus/tree/main/examples/todo-app) — five feature Surfaces, a Module, and every contract in one
465
+ application.
package/dist/index.d.mts CHANGED
@@ -50,68 +50,56 @@ type RefNode<Root, S, Key extends string> = S extends Schema.Codec<infer A, infe
50
50
  readonly at: (key: K) => OptionalRef<Root, Option.Option<V>>;
51
51
  } : Selectable<Root, A, Key, Encoded> : never;
52
52
  export type DependencyTree = readonly (readonly string[])[];
53
+ /** Marks a `Metadata` value. Its entries are private to this module. */
54
+ export declare const MetadataTypeId: unique symbol;
55
+ export type MetadataTypeId = typeof MetadataTypeId;
53
56
  /**
54
- * A required slice of a remote entity, contributed by a remote `Projection`
55
- * node. This is dependency metadata, so it lives in Surface; Remote consumes it.
56
- * `windows` carries a pagination window per relation field (Remote's
57
- * `QueryWindow` is not visible here, so the shape is declared locally), and
58
- * `relations` carries the slice required of each relation's target, so one
59
- * requirement describes a whole selection graph.
57
+ * Declarative facts an interpreter attaches to a Projection node, such as the
58
+ * server data a Remote selection needs. Surface carries and combines them
59
+ * without knowing what they mean; a package reads only the key it owns.
60
+ *
61
+ * Opaque: only a key's `of` and Projection composition make one, so entries
62
+ * cannot be forged past a key's type or `merge`, and they are frozen.
60
63
  */
61
- export interface Window {
62
- readonly first?: number | undefined;
63
- readonly last?: number | undefined;
64
- readonly after?: string | undefined;
65
- readonly before?: string | undefined;
66
- }
67
- /** The slice required of a relation's target; its ids come from the refs. */
68
- export interface RelationRequirement {
69
- readonly entity: string;
70
- readonly fields: readonly string[];
71
- readonly windows?: Readonly<Record<string, Window>> | undefined;
72
- readonly relations?: Readonly<Record<string, RelationRequirement>> | undefined;
73
- }
74
- export interface Requirement extends RelationRequirement {
75
- readonly id: string;
76
- /** The projection also subscribes to changes of this entity (`Data.live`). */
77
- readonly live?: boolean | undefined;
64
+ export interface Metadata {
65
+ readonly [MetadataTypeId]: MetadataTypeId;
78
66
  }
79
67
  /**
80
- * A query connection a projection reads: the page it first asks for and the
81
- * slice it selects of each item. `identity` is the connection's (query plus
82
- * canonical input, excluding the window); the packages that run queries
83
- * carry what they need to run it on the same object.
68
+ * An interpreter's typed slot in `Metadata`. Lookup is by the key object, never
69
+ * its `name`, so two packages cannot collide by choosing the same string.
84
70
  */
85
- export interface ConnectionRequirement {
86
- readonly identity: string;
87
- readonly window: Window;
88
- readonly select: RelationRequirement;
71
+ export interface MetadataKey<A> {
72
+ /** For tooling output only. */
73
+ readonly name: string;
74
+ /** Normalizes the entries gathered from composed nodes, e.g. unioning duplicates. */
75
+ readonly merge: (values: ReadonlyArray<A>) => ReadonlyArray<A>;
76
+ /** One line per entry for `Module` and DevTools output. */
77
+ readonly summarize: (value: A) => string;
78
+ readonly of: (...values: ReadonlyArray<A>) => Metadata;
79
+ readonly get: (metadata: Metadata) => ReadonlyArray<A>;
89
80
  }
90
- /**
91
- * Merges connection requirements for the same connection and window into one,
92
- * unioning what they select of each item; the first keeps its other properties.
93
- */
94
- declare function mergeConnections(connections: readonly ConnectionRequirement[]): readonly ConnectionRequirement[];
95
- /** Unions two relation slices for the same target: fields, windows, and nested relations. */
96
- declare function mergeRelation(current: RelationRequirement, next: RelationRequirement): RelationRequirement;
97
- /** Unions requirements for the same entity + id, dropping duplicate fields. */
98
- declare function mergeRequirements(requirements: readonly Requirement[]): readonly Requirement[];
99
- /**
100
- * Requirement helpers, for the packages that plan and serve requirements.
101
- * `merge` unions same-entity+id requirements; `mergeRelation` unions two
102
- * slices of one target (fields, windows, nested relations).
103
- */
104
- export declare const Requirement: {
105
- merge: typeof mergeRequirements;
106
- mergeRelation: typeof mergeRelation;
107
- mergeConnections: typeof mergeConnections;
81
+ /** One key's entries as serializable text, named by the key. */
82
+ export interface MetadataSummary {
83
+ readonly name: string;
84
+ readonly entries: readonly string[];
85
+ }
86
+ export declare const Metadata: {
87
+ /**
88
+ * Declares an interpreter's slot. Call once per package, at module level:
89
+ * entries are found by the key object, so two copies of a package (a
90
+ * duplicated install, a reloaded module) do not see each other's entries.
91
+ */
92
+ key: <A>(name: string, options: {
93
+ readonly merge: (values: ReadonlyArray<A>) => ReadonlyArray<A>;
94
+ readonly summarize: (value: A) => string;
95
+ }) => MetadataKey<A>;
96
+ summarize: (metadata: Metadata) => readonly MetadataSummary[];
108
97
  };
109
98
  export interface Projection<Root, Value> {
110
- readonly Model: Schema.Schema<Value>;
99
+ readonly Model: Schema.Codec<Value, unknown>;
111
100
  readonly dependencies: DependencyTree;
112
- readonly requirements: readonly Requirement[];
113
- /** The query connections the projection reads; `[]` for most projections. */
114
- readonly connections: readonly ConnectionRequirement[];
101
+ /** Interpreter-owned facts about this node and everything it composes. */
102
+ readonly metadata: Metadata;
115
103
  readonly read: (root: Root) => Value;
116
104
  }
117
105
  /**
@@ -151,10 +139,9 @@ export declare const Projection: {
151
139
  * projections not derived from ModelRefs (agent context, adapters). Prefer
152
140
  * `of`/`struct`/`select`; dependencies default to empty.
153
141
  */
154
- fromReader: <Root, Value>(Model: Schema.Schema<Value>, read: (root: Root) => Value, options?: {
142
+ fromReader: <Root, Value>(Model: Schema.Codec<Value, unknown>, read: (root: Root) => Value, options?: {
155
143
  readonly dependencies?: DependencyTree;
156
- readonly requirements?: readonly Requirement[];
157
- readonly connections?: readonly ConnectionRequirement[];
144
+ readonly metadata?: Metadata;
158
145
  }) => Projection<Root, Value>;
159
146
  /**
160
147
  * Derives a writable projection from generated Model field references:
@@ -182,14 +169,22 @@ export interface AppScope<Root, F extends Schema.Struct.Fields, Cases extends Re
182
169
  export interface SurfaceInspection {
183
170
  readonly name: string;
184
171
  readonly dependencies: DependencyTree;
185
- readonly requirements: readonly Requirement[];
172
+ readonly metadata: readonly MetadataSummary[];
186
173
  readonly emits: readonly unknown[];
187
174
  }
175
+ /**
176
+ * A Surface's params codec: present when the Surface declares params, absent
177
+ * when `Params` is `void`, and possibly either when `Params` is `any`/`unknown`
178
+ * so a params Surface still fits a `Surface<…, any>` position.
179
+ */
180
+ export type ParamsSchema<Params> = unknown extends Params ? Schema.Codec<Params, unknown> | undefined : [Params] extends [void] ? [void] extends [Params] ? undefined // `undefined` also extends `void`, but a Surface may still declare its schema.
181
+ : Schema.Codec<Params, unknown> | undefined : [void] extends [Params] // `void | X`: the schema is optional.
182
+ ? Schema.Codec<Params, unknown> | undefined : Schema.Codec<Params, unknown>;
188
183
  export interface Surface<Root, Model, Message, Params> {
189
184
  readonly name: string;
190
185
  /** Identity token of the application this Surface belongs to. */
191
186
  readonly owner: object;
192
- readonly Params: Schema.Schema<Params> | undefined;
187
+ readonly Params: ParamsSchema<Params>;
193
188
  readonly Message: Schema.Schema<Message>;
194
189
  readonly messages: readonly unknown[];
195
190
  readonly projection: (params: Params) => Projection<Root, Model>;
@@ -353,7 +348,7 @@ export declare const Surface: {
353
348
  */
354
349
  at: <Root, Model, Message, Params>(surface: Surface<Root, Model, Message, Params>, params: Params | ((model: Root) => Params | undefined)) => ActiveSurface<Root>;
355
350
  make: <Root, F extends Schema.Struct.Fields, Cases extends Record<string, Schema.Struct.Fields>, Params = void, Model = unknown, const Ms extends readonly MessageConstructor<Cases>[] = readonly []>(app: AppScope<Root, F, Cases>, name: string, config: {
356
- readonly Params?: Schema.Schema<Params>;
351
+ readonly Params?: Schema.Codec<Params, unknown>;
357
352
  readonly model: (context: {
358
353
  readonly model: RefTree<Root, F>;
359
354
  readonly params: Params;
@@ -405,7 +400,8 @@ export interface Contract {
405
400
  readonly observes: DependencyTree;
406
401
  /** Message tags the contract may cause, expose, or record. */
407
402
  readonly messages: readonly string[];
408
- readonly requirements: readonly Requirement[];
403
+ /** What interpreters attached to the contract's reads, as text. */
404
+ readonly metadata: readonly MetadataSummary[];
409
405
  }
410
406
  /** Contracts of one application, in declaration order. Data, not a runtime. */
411
407
  export interface Module<Root, F extends Schema.Struct.Fields, Cases extends Record<string, Schema.Struct.Fields>> {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;iBAoBiB,SAAS,MAAM,OAAO;;WAE5B,QAAQ,OAAO,MAAM,OAAO;WAC5B,OAAO,MAAM,SAAS,MAAM;WAC5B;WACA,MAAM,MAAM,SAAS;WACrB,MAAM,MAAM,MAAM,OAAO,UAAU;;;;;;;iBAQ7B,SACf,MACA,OACA,6BACA,2BACQ,SAAS,MAAM,OAAO;WACrB,KAAK;;WAEL;;;;;;qBAOE;EACC,YAAA,MAAM,OAAK,QACb,OAAO,OAAO,QAAM,OACrB,MAAM,SAAS,MAAM,QAAM,mCAEjC,SAAS,MAAM;;YASR,QAAQ,MAAM,UAAU,OAAO,OAAO,sBACtC,WAAW,aAAa,QAAQ,MAAM,EAAE,IAAI;KAMnD,WAAW,MAAM,OAAO,oBAAoB,sBAAsB,gBACrE,OAAO,aAAa,UAElB,SAAS,MAAM,OAAO,KAAK;WAChB,SAAS,GAAG,YAAY,WAAW,OAAO,OAAO,WAAW,MAAM,OAAO,OAAO;IAE3F,SAAS,MAAM,OAAO,KAAK;WAChB,SAAS,GAAG,YAAY,WAAW,OAAO,OAAO,WAAW,MAAM;;;;;;;KAQ5E,YAAY,MAAM,UAAU,gBAAgB,OAAO,aAAa,UACjE,SAAS,MAAM;WACJ,SAAS,GAAG,YAAY,WAAW,OAAO,OAAO,WAAW,MAAM,OAAO,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