foldkit-surface 0.1.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.
@@ -0,0 +1,476 @@
1
+ import { Optic, Option, Schema } from "effect";
2
+ import { Html, HtmlBuilder } from "foldkit/html";
3
+ import { MessageUnion } from "foldkit/message";
4
+ import * as Update from "foldkit/update";
5
+ //#region src/index.d.ts
6
+ export interface ModelRef<Root, Value, Encoded = unknown> {
7
+ /** A pure codec: Foldkit Model fields carry no decoding or encoding services. */
8
+ readonly Schema: Schema.Codec<Value, Encoded, never, never>;
9
+ readonly optic: Optic.Optional<Root, Value>;
10
+ readonly dependency: readonly string[];
11
+ readonly get: (root: Root) => Value;
12
+ readonly set: (root: Root, value: Value) => Root;
13
+ }
14
+ /**
15
+ * A `ModelRef` generated for a named Model field. `key` is the literal field
16
+ * name, so a reference-based selection can infer its output keys without a
17
+ * parallel field registry or string paths.
18
+ */
19
+ export interface FieldRef<Root, Value, Key extends string = string, Encoded = unknown> extends ModelRef<Root, Value, Encoded> {
20
+ readonly key: Key;
21
+ /** The application definition this field was generated from. */
22
+ readonly owner: object;
23
+ }
24
+ /**
25
+ * Low-level escape hatch for a focus with no Model path of its own. Prefer the
26
+ * `App.model` tree; use this for an optic that is not part of the Model.
27
+ */
28
+ export declare const ModelRef: {
29
+ fromOptic: <Root, Value>(Schema: Schema.Schema<Value>, optic: Optic.Optional<Root, Value>, dependency?: readonly string[]) => ModelRef<Root, Value>;
30
+ };
31
+ export type RefTree<Root, F extends Schema.Struct.Fields> = { readonly [K in keyof F & string]: RefNode<Root, F[K], K>; };
32
+ type Selectable<Root, Value, Key extends string, Encoded = unknown> = [Value] extends [Option.Option<infer Inner>] ? FieldRef<Root, Value, Key, Encoded> & {
33
+ readonly select: <P>(projection: Projection<Inner, P>) => Projection<Root, Option.Option<P>>;
34
+ } : FieldRef<Root, Value, Key, Encoded> & {
35
+ readonly select: <P>(projection: Projection<Value, P>) => Projection<Root, P>;
36
+ };
37
+ /**
38
+ * A dynamic focus from `.at`/`.index`. Deliberately not a `FieldRef`: its key is
39
+ * a record key or index, not a Model field, so a static `Projection.pick` cannot
40
+ * infer a field name from it.
41
+ */
42
+ type OptionalRef<Root, Value> = [Value] extends [Option.Option<infer Inner>] ? ModelRef<Root, Value> & {
43
+ readonly select: <P>(projection: Projection<Inner, P>) => Projection<Root, Option.Option<P>>;
44
+ } : ModelRef<Root, Value> & {
45
+ readonly select: <P>(projection: Projection<Value, P>) => Projection<Root, P>;
46
+ };
47
+ type RefNode<Root, S, Key extends string> = S extends Schema.Codec<infer A, infer Encoded, any, any> ? S extends Schema.Struct<infer F> ? Selectable<Root, A, Key, Encoded> & RefTree<Root, F> : A extends ReadonlyArray<infer E> ? Selectable<Root, A, Key, Encoded> & {
48
+ readonly index: (index: number) => OptionalRef<Root, Option.Option<E>>;
49
+ } : A extends Readonly<Record<infer K extends string, infer V>> ? Selectable<Root, A, Key, Encoded> & {
50
+ readonly at: (key: K) => OptionalRef<Root, Option.Option<V>>;
51
+ } : Selectable<Root, A, Key, Encoded> : never;
52
+ export type DependencyTree = readonly (readonly string[])[];
53
+ /**
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.
60
+ */
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;
78
+ }
79
+ /**
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.
84
+ */
85
+ export interface ConnectionRequirement {
86
+ readonly identity: string;
87
+ readonly window: Window;
88
+ readonly select: RelationRequirement;
89
+ }
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;
108
+ };
109
+ export interface Projection<Root, Value> {
110
+ readonly Model: Schema.Schema<Value>;
111
+ readonly dependencies: DependencyTree;
112
+ readonly requirements: readonly Requirement[];
113
+ /** The query connections the projection reads; `[]` for most projections. */
114
+ readonly connections: readonly ConnectionRequirement[];
115
+ readonly read: (root: Root) => Value;
116
+ }
117
+ /**
118
+ * A projection Surface can install back into a Model. Public reads use the
119
+ * read-only `Projection`; only a writable selection carries installation.
120
+ * `set` writes exactly the declared fields, so an excess field in an untrusted
121
+ * value cannot reach local state.
122
+ */
123
+ export interface WritableProjection<Model, Fields extends Schema.Struct.Fields> {
124
+ readonly schema: Schema.Struct<Fields>;
125
+ readonly dependencies: DependencyTree;
126
+ readonly get: (model: Model) => Schema.Struct.Type<Fields>;
127
+ readonly set: (model: Model, shared: Schema.Struct.Type<Fields>) => Model;
128
+ }
129
+ type OfSelection<F extends Schema.Struct.Fields> = { readonly [K in keyof F]?: true | Projection<Schema.Schema.Type<F[K]>, unknown>; };
130
+ type OfValue<F extends Schema.Struct.Fields, Sel> = { readonly [K in keyof Sel & keyof F]: Sel[K] extends true ? Schema.Schema.Type<F[K]> : Sel[K] extends Projection<any, infer V> ? V : never; };
131
+ type EntryValue<E> = E extends Projection<any, infer V> ? V : E extends ModelRef<any, infer V> ? V : never;
132
+ type EntryRoot<E> = E extends Projection<infer R, any> ? R : E extends ModelRef<infer R, any> ? R : never;
133
+ type EntryRoots<Entries> = { readonly [K in keyof Entries]: EntryRoot<Entries[K]>; };
134
+ /** `true` when the union has more than one member. Used to reject mixed roots. */
135
+ type IsUnion<T, U = T> = [T] extends [never] ? false : T extends unknown ? [U] extends [T] ? false : true : never;
136
+ type StructValue<Entries> = { readonly [K in keyof Entries]: EntryValue<Entries[K]>; } extends (infer Value) ? { readonly [K in keyof Value]: Value[K]; } : never;
137
+ export declare const Projection: {
138
+ of: <F extends Schema.Struct.Fields>(schema: Schema.Struct<F>) => <const Sel extends OfSelection<F>>(selection: Sel) => Projection<Schema.Struct.Type<F>, OfValue<F, Sel>>;
139
+ struct: <const Entries extends Record<string, Projection<any, any> | ModelRef<any, any>>>(entries: Entries & (IsUnion<EntryRoots<Entries>[keyof Entries]> extends true ? never : unknown)) => Projection<EntryRoot<Entries[keyof Entries]>, StructValue<Entries>>;
140
+ /**
141
+ * Maps a Projection over an array: `array(p): Projection<ReadonlyArray<Root>,
142
+ * ReadonlyArray<Value>>`. Nesting is explicit (an array of arrays stays an
143
+ * array of arrays); there is no flatten or double-wrap.
144
+ */
145
+ array: <Root, Value>(projection: Projection<Root, Value>) => Projection<ReadonlyArray<Root>, ReadonlyArray<Value>>;
146
+ /** Maps a Projection inside an Option, preserving absence. */
147
+ option: <Root, Value>(projection: Projection<Root, Value>) => Projection<Option.Option<Root>, Option.Option<Value>>;
148
+ read: <Root, Value>(projection: Projection<Root, Value>, root: Root) => Value;
149
+ /**
150
+ * Low-level escape hatch: a Projection from a Schema and a reader, for
151
+ * projections not derived from ModelRefs (agent context, adapters). Prefer
152
+ * `of`/`struct`/`select`; dependencies default to empty.
153
+ */
154
+ fromReader: <Root, Value>(Model: Schema.Schema<Value>, read: (root: Root) => Value, options?: {
155
+ readonly dependencies?: DependencyTree;
156
+ readonly requirements?: readonly Requirement[];
157
+ readonly connections?: readonly ConnectionRequirement[];
158
+ }) => Projection<Root, Value>;
159
+ /**
160
+ * Derives a writable projection from generated Model field references:
161
+ * `Projection.pick(App.model.todos, App.model.selectedTodoId)` infers
162
+ * `{ todos, selectedTodoId }` and its codec. Every reference must share one
163
+ * Root; a raw optic or an unrelated application is rejected. Repeated
164
+ * identical members deduplicate; a conflicting definition throws.
165
+ */
166
+ pick: <const Refs extends readonly FieldRef<any, any, string>[]>(...refs: Refs & (IsUnion<RefRoots<Refs>[number]> extends true ? never : unknown)) => WritableProjection<RefRoots<Refs>[number], PickFields<Refs>>;
167
+ /**
168
+ * Merges disjoint writable projections into one: `Projection.compose(Todos,
169
+ * Selection)`. Every projection must own the same Model; a field defined twice
170
+ * with a different codec throws, while an identical definition deduplicates.
171
+ * `set` installs each part, so composed fields keep their own write behaviour.
172
+ */
173
+ compose: <const Ps extends readonly WritableProjection<any, any>[]>(...projections: Ps & (IsUnion<ProjectionModel<Ps[number]>> extends true ? never : unknown)) => WritableProjection<ProjectionModel<Ps[number]>, MergeFields<Ps>>;
174
+ };
175
+ export interface AppScope<Root, F extends Schema.Struct.Fields, Cases extends Record<string, Schema.Struct.Fields>> {
176
+ readonly Model: Schema.Struct<F>;
177
+ readonly Message: MessageUnion<Cases>;
178
+ readonly model: RefTree<Root, F>;
179
+ /** Identity token shared by this application's references and subsets. */
180
+ readonly owner: object;
181
+ }
182
+ export interface SurfaceInspection {
183
+ readonly name: string;
184
+ readonly dependencies: DependencyTree;
185
+ readonly requirements: readonly Requirement[];
186
+ readonly emits: readonly unknown[];
187
+ }
188
+ export interface Surface<Root, Model, Message, Params> {
189
+ readonly name: string;
190
+ /** Identity token of the application this Surface belongs to. */
191
+ readonly owner: object;
192
+ readonly Params: Schema.Schema<Params> | undefined;
193
+ readonly Message: Schema.Schema<Message>;
194
+ readonly messages: readonly unknown[];
195
+ readonly projection: (params: Params) => Projection<Root, Model>;
196
+ }
197
+ /**
198
+ * A Surface as the Model activates it: its params are a function of the Model
199
+ * (`undefined` while inactive), so its requirements are too. `Surface.at`
200
+ * builds one; a Subscription derives what to fetch, subscribe, and retain
201
+ * from a list of them.
202
+ */
203
+ export interface ActiveSurface<Root> {
204
+ readonly name: string;
205
+ /** Identity token of the application the Surface belongs to. */
206
+ readonly owner: object;
207
+ /** The projection for the params the Model gives, or `undefined` while inactive. */
208
+ readonly projectionOf: (model: Root) => Projection<Root, unknown> | undefined;
209
+ }
210
+ declare const invalid: unique symbol;
211
+ /**
212
+ * A compile-time failure that names its cause. Intersected onto a parameter
213
+ * type when a type-level check fails, so the error reads as one line
214
+ * (`Property '[invalid]' is missing … required in type 'Invalid<"…">'`)
215
+ * naming the descriptor, instead of a wall of structural mismatch.
216
+ */
217
+ export interface Invalid<Message extends string> {
218
+ readonly [invalid]: Message;
219
+ }
220
+ /** The fields of a `Schema.Struct`, or a schema, where params are declared. */
221
+ type ParamsShape = Schema.Struct.Fields | Schema.Top;
222
+ type ParamsOf<P> = P extends Schema.Top ? Schema.Schema.Type<P> : P extends Schema.Struct.Fields ? Schema.Struct.Type<P> : void;
223
+ /** What a Surface's `model` may return: a Projection, or an object of Projections and refs to lift. */
224
+ type ModelShape<Root> = Projection<Root, unknown> | Record<string, Projection<Root, any> | ModelRef<Root, any>>;
225
+ type ModelOf<Root, R> = R extends Projection<Root, infer M> ? M : StructValue<R>;
226
+ type MsgOf<Ms extends readonly unknown[]> = { readonly [K in keyof Ms]: Ms[K] extends ((...args: never[]) => infer M) ? M : never; }[number];
227
+ /** The union of Messages a tuple of constructors produces. */
228
+ type SubsetOf<Ms extends readonly unknown[]> = Ms[number] extends ((...args: never[]) => infer M) ? M : never;
229
+ type AppMessage<Cases extends Record<string, Schema.Struct.Fields>> = Schema.Schema.Type<MessageUnion<Cases>>;
230
+ /** A Message constructor whose produced Message belongs to the App's universe. */
231
+ type MessageConstructor<Cases extends Record<string, Schema.Struct.Fields>> = (...args: never[]) => AppMessage<Cases>;
232
+ /**
233
+ * The renderer's builder: the real `HtmlBuilder` with its private
234
+ * `MessageUniverse` phantom removed, so the renderer's `OnClick` accepts only
235
+ * the Surface's Message subset. `HtmlBuilder<M>` stays invariant even without
236
+ * the phantom (`OnClick` returns `{ message: M }`), so a superset builder is
237
+ * not assignable to this; `Surface.view` casts, which is sound because the
238
+ * renderer can only construct subset Messages and the real builder accepts the
239
+ * superset.
240
+ */
241
+ type ViewBuilder<Message> = Omit<HtmlBuilder<Message>, keyof HtmlBuilder<never> & symbol>;
242
+ /** A renderer for a Surface's projected Model, with its Message set narrowed. */
243
+ export type Renderer<Model, Message> = (model: Model, h: ViewBuilder<Message>) => Html;
244
+ /** `unknown` when `Sub` is a subtype of `Super`, `never` otherwise. */
245
+ type Subset<Sub, Super> = [Sub] extends [Super] ? unknown : never;
246
+ type RefRoot<R> = R extends ModelRef<infer Root, any> ? Root : never;
247
+ type RefRoots<Refs extends readonly unknown[]> = { readonly [K in keyof Refs]: RefRoot<Refs[K]>; };
248
+ /** The struct fields a reference selection produces, keyed by each ref's field. */
249
+ type PickFields<Refs extends readonly FieldRef<any, any, string>[]> = { readonly [R in Refs[number] as R['key']]: R['Schema']; };
250
+ type ProjectionModel<P> = P extends WritableProjection<infer M, any> ? M : never;
251
+ type ProjectionFields<P> = P extends WritableProjection<any, infer F> ? F : never;
252
+ type Merge2<A, B> = { readonly [K in keyof A | keyof B]: K extends keyof A ? A[K] : K extends keyof B ? B[K] : never; };
253
+ /** Merges the fields of several projections; an overlapping key is rejected at runtime. */
254
+ export type MergeFields<Ps extends readonly WritableProjection<any, any>[]> = Ps extends readonly [infer Head extends WritableProjection<any, any>, ...infer Tail extends readonly WritableProjection<any, any>[]] ? Merge2<ProjectionFields<Head>, MergeFields<Tail>> : {};
255
+ /**
256
+ * An application definition: the Model and Message schemas and the generated
257
+ * field references. It is data, not a running instance, so it can be inspected
258
+ * without mounting anything. Context, replication, and validation all read the
259
+ * same `App.fields` references.
260
+ */
261
+ export interface Application<Root, F extends Schema.Struct.Fields, Cases extends Record<string, Schema.Struct.Fields>> extends AppScope<Root, F, Cases> {
262
+ /** Reference-based field selection: `App.fields.todos`. */
263
+ readonly fields: RefTree<Root, F>;
264
+ /**
265
+ * `Surface.make` with the mechanical wrappers lifted: `params` are the
266
+ * fields of a `Schema.Struct` (or a schema), and `model` may return an
267
+ * object of Projections and refs, which becomes `Projection.struct`.
268
+ */
269
+ readonly surface: <const Params extends ParamsShape | undefined = undefined, Shape extends ModelShape<Root> = Projection<Root, unknown>, const Ms extends readonly MessageConstructor<Cases>[] = readonly []>(name: string, config: {
270
+ readonly params?: Params;
271
+ readonly model: (context: {
272
+ readonly model: RefTree<Root, F>;
273
+ readonly params: ParamsOf<Params>;
274
+ }) => Shape;
275
+ readonly messages?: Ms;
276
+ }) => Surface<Root, ModelOf<Root, Shape>, MsgOf<Ms>, ParamsOf<Params>>;
277
+ }
278
+ /**
279
+ * An `Application` that also carries the initial Model and the transition
280
+ * function, so a replicator can derive the initial shared value and replay.
281
+ * `Resources` is whatever `update`'s Commands need.
282
+ */
283
+ export interface RunnableApplication<Root, F extends Schema.Struct.Fields, Cases extends Record<string, Schema.Struct.Fields>, Resources = never> extends Application<Root, F, Cases> {
284
+ readonly initial: Root;
285
+ readonly update: (model: Root, message: Schema.Schema.Type<MessageUnion<Cases>>) => Update.Return<Root, Schema.Schema.Type<MessageUnion<Cases>>, Resources>;
286
+ }
287
+ declare const messageSubsetRoot: unique symbol;
288
+ /**
289
+ * A typed subset of one application's Messages: the selected constructors, a
290
+ * codec for exactly those variants, and a runtime membership test. Surface does
291
+ * not label a subset agent-visible, durable, or presence; `Agent` and `Sync`
292
+ * attach their own policy to the same value.
293
+ */
294
+ /** The union of encoded types a tuple of constructor schemas produces. */
295
+ type SubsetEncoded<Ms extends readonly unknown[]> = Ms[number] extends Schema.Codec<any, infer Encoded, any, any> ? Encoded : never;
296
+ export interface MessageSet<Root, Message, Subset extends Message, Ms extends readonly ((...args: never[]) => Message)[], Cases extends Record<string, Schema.Struct.Fields> = Record<string, Schema.Struct.Fields>, Encoded = unknown> {
297
+ /** Phantom owner, so a subset cannot be crossed between applications. */
298
+ readonly [messageSubsetRoot]?: Root;
299
+ /** The application identity token, checked when subsets compose. */
300
+ readonly owner: object;
301
+ readonly constructors: Ms;
302
+ /** A pure codec for exactly the selected variants. */
303
+ readonly schema: Schema.Codec<Subset, Encoded, never, never>;
304
+ readonly tags: ReadonlySet<string>;
305
+ readonly includes: (message: Message) => message is Subset;
306
+ }
307
+ /**
308
+ * Captures an application's pure references once. `initial` and `update` are
309
+ * optional: an agent needs only the Model, Message, and field references, while
310
+ * a replicator needs them to derive the initial shared value and replay. A
311
+ * `RunnableApplication` is returned when both are supplied.
312
+ */
313
+ declare function application<F extends Schema.Struct.Fields, Cases extends Record<string, Schema.Struct.Fields>, Resources = never, ManagedResourceServices = never>(config: {
314
+ readonly Model: Schema.Struct<F>;
315
+ readonly Message: MessageUnion<Cases>;
316
+ readonly initial: Schema.Struct.Type<F>;
317
+ readonly update: (model: Schema.Struct.Type<F>, message: Schema.Schema.Type<MessageUnion<Cases>>) => Update.Return<Schema.Struct.Type<F>, Schema.Schema.Type<MessageUnion<Cases>>, Resources | ManagedResourceServices>;
318
+ }): RunnableApplication<Schema.Struct.Type<F>, F, Cases, Resources | ManagedResourceServices>;
319
+ declare function application<F extends Schema.Struct.Fields, Cases extends Record<string, Schema.Struct.Fields>>(config: {
320
+ readonly Model: Schema.Struct<F>;
321
+ readonly Message: MessageUnion<Cases>;
322
+ }): Application<Schema.Struct.Type<F>, F, Cases>;
323
+ type ConstructorOfSubset<S> = S extends MessageSet<any, any, any, infer Ms, any> ? Ms : never;
324
+ type ValueOfSubset<S> = S extends MessageSet<any, any, infer V, any, any> ? V : never;
325
+ type RootOfSubset<S> = S extends MessageSet<infer R, any, any, any, any> ? R : never;
326
+ type MessageOfSubset<S> = S extends MessageSet<any, infer M, any, any, any> ? M : never;
327
+ type CasesOfSubset<S> = S extends MessageSet<any, any, any, any, infer C> ? C : never;
328
+ type Concat<A extends readonly unknown[], B extends readonly unknown[]> = [...A, ...B];
329
+ /** Concatenates the constructor tuples of several subsets, preserving each. */
330
+ export type MergeConstructors<Subs extends readonly MessageSet<any, any, any, any, any>[]> = Subs extends readonly [infer Head extends MessageSet<any, any, any, any, any>, ...infer Tail extends readonly MessageSet<any, any, any, any, any>[]] ? Concat<ConstructorOfSubset<Head>, MergeConstructors<Tail>> : [];
331
+ /** Typed Message subsets of one application, by constructor reference. */
332
+ export declare const MessageSet: {
333
+ /**
334
+ * Selects a typed Message subset by constructor reference:
335
+ * `MessageSet.make(App, [Message.CreatedTodo, Message.RenamedTodo])`. Each
336
+ * constructor must be this application's own variant; a duplicate or a variant
337
+ * from another union throws.
338
+ */
339
+ make: <Root, F extends Schema.Struct.Fields, Cases extends Record<string, Schema.Struct.Fields>, const Ms extends readonly MessageConstructor<Cases>[]>(app: AppScope<Root, F, Cases>, messages: Ms) => MessageSet<Root, Schema.Schema.Type<MessageUnion<Cases>>, SubsetOf<Ms> & Schema.Schema.Type<MessageUnion<Cases>>, Ms, Cases, SubsetEncoded<Ms>>;
340
+ /**
341
+ * Unions several Message subsets into one. Every subset must belong to the
342
+ * same application; a tag declared twice throws. Disjoint feature modules can
343
+ * each declare their own subset and compose them here.
344
+ */
345
+ union: <const Subs extends readonly MessageSet<any, any, any, any, any>[]>(...subsets: Subs) => MessageSet<RootOfSubset<Subs[number]>, MessageOfSubset<Subs[number]>, ValueOfSubset<Subs[number]>, MergeConstructors<Subs>, CasesOfSubset<Subs[number]>, SubsetEncoded<MergeConstructors<Subs>>>;
346
+ };
347
+ export declare const Surface: {
348
+ application: typeof application;
349
+ /**
350
+ * A Surface as the Model activates it. `params` is the value, or a function
351
+ * of the Model returning it (`undefined` while the Surface is inactive, e.g.
352
+ * on another route); the Surface's requirements then follow the Model.
353
+ */
354
+ at: <Root, Model, Message, Params>(surface: Surface<Root, Model, Message, Params>, params: Params | ((model: Root) => Params | undefined)) => ActiveSurface<Root>;
355
+ 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>;
357
+ readonly model: (context: {
358
+ readonly model: RefTree<Root, F>;
359
+ readonly params: Params;
360
+ }) => Projection<Root, Model>;
361
+ readonly messages?: Ms;
362
+ }) => Surface<Root, Model, MsgOf<Ms>, Params>;
363
+ read: <Root, Model, Message, Params>(surface: Surface<Root, Model, Message, Params>, root: Root, params?: Params) => Model;
364
+ /**
365
+ * Binds a renderer to a Surface's projected Model and Message set. A
366
+ * type-level binder: the renderer already has this shape, but `Model` and
367
+ * `Message` are derived from the Surface instead of written by hand.
368
+ */
369
+ view: <Root, Model, Message, Params>(_surface: Surface<Root, Model, Message, Params>, render: Renderer<Model, Message>) => Renderer<Model, Message>;
370
+ /**
371
+ * The application boundary: consume the Root Model, project it, and hand the
372
+ * projected Model to the renderer. `Subset` rejects a Surface whose Messages
373
+ * the application builder cannot route.
374
+ */
375
+ rootView: <Root, Model, Message, Params>(surface: Surface<Root, Model, Message, Params>, params: Params, render: Renderer<Model, Message>) => (<AppMessage>(root: Root, h: HtmlBuilder<AppMessage> & Subset<Message, AppMessage>) => Html);
376
+ /**
377
+ * Embeds a child renderer in a parent view. `ParentModel extends ChildModel`
378
+ * enforces "child Model requirement ⊆ parent projected Model"; `Subset`
379
+ * enforces "child Message set ⊆ parent Message set".
380
+ */
381
+ embed: <ChildModel, ChildMessage>(child: Renderer<ChildModel, ChildMessage>) => <ParentModel extends ChildModel, ParentMessage>(model: ParentModel, h: ViewBuilder<ParentMessage> & Subset<ChildMessage, ParentMessage>) => Html;
382
+ /**
383
+ * A Surface as a `Contract` for `Module`: what it observes, requires, and may
384
+ * emit. A parameterized Surface needs its `params` to build the projection.
385
+ */
386
+ contract: <Root, Model, Message, Params>(surface: Surface<Root, Model, Message, Params>, params: Params) => Contract;
387
+ /**
388
+ * Pure introspection for DevTools: what a Surface observes (dependencies,
389
+ * requirements) and what it may emit. No behavior change, no I/O.
390
+ */
391
+ inspect: <Root, Model, Message, Params>(surface: Surface<Root, Model, Message, Params>, params: Params) => SurfaceInspection;
392
+ };
393
+ /**
394
+ * What one contract claims about an application, as data. Sync, Remote, and
395
+ * Agent attach one to the values they produce; `Surface.contract` derives one
396
+ * from a Surface. `owns` are the Model paths the contract is the authority for
397
+ * (a replicated projection, a remote store); `observes` are the paths it reads.
398
+ */
399
+ export interface Contract {
400
+ readonly kind: string;
401
+ readonly name: string;
402
+ /** The application's identity token; absent when the value cannot know it. */
403
+ readonly owner?: object | undefined;
404
+ readonly owns: DependencyTree;
405
+ readonly observes: DependencyTree;
406
+ /** Message tags the contract may cause, expose, or record. */
407
+ readonly messages: readonly string[];
408
+ readonly requirements: readonly Requirement[];
409
+ }
410
+ /** Contracts of one application, in declaration order. Data, not a runtime. */
411
+ export interface Module<Root, F extends Schema.Struct.Fields, Cases extends Record<string, Schema.Struct.Fields>> {
412
+ readonly app: AppScope<Root, F, Cases>;
413
+ readonly contracts: readonly Contract[];
414
+ }
415
+ export interface Finding {
416
+ readonly rule: 'foreign-contract' | 'duplicate-name' | 'ownership-overlap' | 'message-claimed-twice' | 'unknown-path' | 'unknown-message';
417
+ /** `kind:name` of each contract involved. */
418
+ readonly contracts: readonly string[];
419
+ readonly message: string;
420
+ }
421
+ /** Who owns a Model path; `undefined` is local state. */
422
+ export interface Ownership {
423
+ readonly path: readonly string[];
424
+ readonly owner: {
425
+ readonly kind: string;
426
+ readonly name: string;
427
+ } | undefined;
428
+ }
429
+ export interface ModuleManifest {
430
+ readonly fields: readonly string[];
431
+ readonly messages: readonly string[];
432
+ readonly ownership: readonly Ownership[];
433
+ readonly contracts: readonly Omit<Contract, 'owner'>[];
434
+ readonly findings: readonly Finding[];
435
+ }
436
+ /** A value `Module.make` accepts: a contract, a value carrying one, or a Surface without params. */
437
+ export type ModuleItem<Root> = Contract | {
438
+ readonly contract: Contract;
439
+ } | Surface<Root, any, any, void>;
440
+ /**
441
+ * Collects an application's contracts as pure data so their relationships can
442
+ * be validated and inspected without starting a runtime.
443
+ *
444
+ * ```ts
445
+ * const Project = Module.make(App, [BoardSurface, ProjectSync, ProjectRemote, ProjectAgent])
446
+ * Module.validate(Project) // findings, or []
447
+ * Module.toMarkdown(Project)
448
+ * ```
449
+ */
450
+ export declare const Module: {
451
+ make: <Root, F extends Schema.Struct.Fields, Cases extends Record<string, Schema.Struct.Fields>>(app: AppScope<Root, F, Cases>, items?: readonly ModuleItem<Root>[]) => Module<Root, F, Cases>;
452
+ /** A new Module with more contracts; the input is unchanged. */
453
+ add: <Root, F extends Schema.Struct.Fields, Cases extends Record<string, Schema.Struct.Fields>>(module: Module<Root, F, Cases>, ...items: readonly ModuleItem<Root>[]) => Module<Root, F, Cases>;
454
+ /**
455
+ * Cross-contract invariants the types cannot express: a contract from another
456
+ * application, a duplicate `kind:name`, two owners of overlapping Model paths,
457
+ * a Message recorded by two replication contracts, and a path or Message the
458
+ * application does not declare.
459
+ */
460
+ validate: (module: Module<any, any, any>) => readonly Finding[];
461
+ /**
462
+ * The application's fields and Messages, who owns each Model path (local when
463
+ * no contract does), every contract, and the findings. Reproducible for a
464
+ * given Module, so it can be committed and diffed.
465
+ */
466
+ manifest: (module: Module<any, any, any>) => ModuleManifest;
467
+ /** The manifest as Markdown: the ownership tree, a table of contracts, and findings. */
468
+ toMarkdown: (module: Module<any, any, any>) => string;
469
+ /**
470
+ * The manifest as a Mermaid flowchart: Model fields in a subgraph, one node
471
+ * per contract, a solid edge for ownership and a dotted edge for observation.
472
+ */
473
+ toMermaid: (module: Module<any, any, any>) => string;
474
+ };
475
+ //#endregion
476
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +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,OAAO;IAE3F,SAAS,MAAM;WACJ,SAAS,GAAG,YAAY,WAAW,OAAO,OAAO,WAAW,MAAM;;KAG5E,QAAQ,MAAM,GAAG,sBACpB,UAAU,OAAO,YAAY,SAAS,qBAClC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