foldkit-ssr 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.
- package/LICENSE +21 -0
- package/README.md +592 -0
- package/dist/index.d.mts +363 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1426 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +61 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { Cause, Effect, Layer, Result, Schema } from "effect";
|
|
2
|
+
import { EntryModule, RenderError, RenderedApplication } from "foldkit/experimental/server";
|
|
3
|
+
import { Attribute, Html, HtmlBuilder, KeyboardModifiers } from "foldkit/html";
|
|
4
|
+
import { ActiveSurface, Metadata, MetadataSummary, WritableProjection } from "foldkit-surface";
|
|
5
|
+
//#region src/resumable.d.ts
|
|
6
|
+
/** The attribute prefix of an element's binding marker. */
|
|
7
|
+
export declare const BINDING_ATTRIBUTE = "data-foldkit-plus-on-";
|
|
8
|
+
/** The posted field that carries a form's encoded Message, for the server fallback. */
|
|
9
|
+
export declare const FALLBACK_FIELD = "foldkit-plus-message";
|
|
10
|
+
/** The attribute on a placement's root naming its slot, while the server renders. */
|
|
11
|
+
export declare const SLOT_ATTRIBUTE = "data-foldkit-plus-slot";
|
|
12
|
+
declare const invalid: unique symbol;
|
|
13
|
+
/** A compile-time failure that names its cause. */
|
|
14
|
+
interface Invalid<Message extends string> {
|
|
15
|
+
readonly [invalid]: Message;
|
|
16
|
+
}
|
|
17
|
+
type IsUnion<T, U = T> = T extends unknown ? ([U] extends [T] ? false : true) : never;
|
|
18
|
+
/** A Message constructor from `defineMessageUnion`: a tagged Schema that can be called. */
|
|
19
|
+
type AnyMemberSchema = Schema.Top & {
|
|
20
|
+
readonly fields: Schema.Struct.Fields;
|
|
21
|
+
};
|
|
22
|
+
/** The Message a member makes. */
|
|
23
|
+
type Made<M> = M extends {
|
|
24
|
+
readonly Type: infer T;
|
|
25
|
+
} ? T : never;
|
|
26
|
+
/** The fields a member's event may be given fixed: all but `_tag`. */
|
|
27
|
+
type Fixable<M> = Partial<Omit<Made<M>, '_tag'>>;
|
|
28
|
+
/** The fields of a member the event fills: those neither `_tag` nor fixed. */
|
|
29
|
+
type Rest<M, Fixed> = Omit<Made<M>, '_tag' | keyof Fixed>;
|
|
30
|
+
type ProducesMessage<M, Message> = [Made<M>] extends [Message] ? unknown : Invalid<"the member is not one of this view's Messages">;
|
|
31
|
+
type TextHoleCheck<M, Fixed> = [keyof Rest<M, Fixed>] extends [never] ? Invalid<'the member has no field left for the event to fill'> : true extends IsUnion<keyof Rest<M, Fixed>> ? Invalid<'the member leaves more than one field for the event to fill: fix the others'> : Rest<M, Fixed>[keyof Rest<M, Fixed>] extends string ? string extends Rest<M, Fixed>[keyof Rest<M, Fixed>] ? unknown : Invalid<'the field the event fills must be a string'> : Invalid<'the field the event fills must be a string'>;
|
|
32
|
+
type KeyHoleCheck<M, Fixed> = [keyof Rest<M, Fixed>] extends ['key' | 'modifiers'] ? ['key' | 'modifiers'] extends [keyof Rest<M, Fixed>] ? unknown : Invalid<'the member must leave exactly key and modifiers for the event to fill'> : Invalid<'the member must leave exactly key and modifiers for the event to fill'>;
|
|
33
|
+
/** `OnInput` and `OnChange`: a closure, or a member whose one string field the event fills. */
|
|
34
|
+
interface TextHole<Message> {
|
|
35
|
+
(toMessage: (value: string) => Message): Attribute<Message>;
|
|
36
|
+
<M extends AnyMemberSchema, const Fixed extends Fixable<M> = {}>(member: M & ProducesMessage<M, Message> & TextHoleCheck<M, Fixed>, fixed?: Fixed): Attribute<Message>;
|
|
37
|
+
}
|
|
38
|
+
/** `OnKeyDown` and `OnKeyUp`: a closure, or a member whose `key` and `modifiers` the event fills. */
|
|
39
|
+
interface KeyHole<Message> {
|
|
40
|
+
(toMessage: (key: string, modifiers: KeyboardModifiers) => Message): Attribute<Message>;
|
|
41
|
+
<M extends AnyMemberSchema, const Fixed extends Fixable<M> = {}>(member: M & ProducesMessage<M, Message> & KeyHoleCheck<M, Fixed>, fixed?: Fixed): Attribute<Message>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A builder a view is given: Foldkit's `HtmlBuilder`, or a Surface renderer's,
|
|
45
|
+
* which leaves out Foldkit's phantom key. Its Message is what `OnClick` takes.
|
|
46
|
+
*/
|
|
47
|
+
type AnyBuilder = {
|
|
48
|
+
readonly OnClick: (message: never, ...rest: ReadonlyArray<never>) => unknown;
|
|
49
|
+
};
|
|
50
|
+
/** The Message a builder's handlers make. */
|
|
51
|
+
type MessageOf<Builder> = Builder extends {
|
|
52
|
+
readonly OnClick: (message: infer Message, ...rest: ReadonlyArray<never>) => unknown;
|
|
53
|
+
} ? Message : never;
|
|
54
|
+
/**
|
|
55
|
+
* The resumable builder for a view whose Messages are `Message`: its elements
|
|
56
|
+
* and attributes, and the hole forms of the four value events. One shape
|
|
57
|
+
* whether it wraps a view's `HtmlBuilder` or a Surface renderer's builder, so a
|
|
58
|
+
* helper typed with it takes either. It keeps Foldkit's phantom Message key,
|
|
59
|
+
* so a placement's view accepts it as the parent's builder.
|
|
60
|
+
*/
|
|
61
|
+
type ResumableBuilder<Message> = Omit<HtmlBuilder<Message>, 'OnInput' | 'OnChange' | 'OnKeyDown' | 'OnKeyUp'> & {
|
|
62
|
+
readonly OnInput: TextHole<Message>;
|
|
63
|
+
readonly OnChange: TextHole<Message>;
|
|
64
|
+
readonly OnKeyDown: KeyHole<Message>;
|
|
65
|
+
readonly OnKeyUp: KeyHole<Message>;
|
|
66
|
+
};
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/listen.d.ts
|
|
69
|
+
/**
|
|
70
|
+
* A binding as the envelope carries it: Foldkit's attribute (`OnSubmit`,
|
|
71
|
+
* `OnBlur`), whose tag says what its handler does beside dispatching; the
|
|
72
|
+
* Message, encoded through the application's Message Schema (for a hole, with
|
|
73
|
+
* the hole filled by a placeholder); the fields the event fills, `depth`
|
|
74
|
+
* placement wrappers down; and the attribute's options. Its ordinal is its
|
|
75
|
+
* index. The page is read through this Schema, so a tampered list is refused.
|
|
76
|
+
*/
|
|
77
|
+
declare const EncodedBinding: Schema.Struct<{
|
|
78
|
+
readonly attribute: Schema.String;
|
|
79
|
+
readonly message: Schema.Unknown;
|
|
80
|
+
readonly hole: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
81
|
+
readonly depth: Schema.optionalKey<Schema.Number>;
|
|
82
|
+
readonly options: Schema.optionalKey<Schema.Unknown>;
|
|
83
|
+
}>;
|
|
84
|
+
type EncodedBinding = typeof EncodedBinding.Type;
|
|
85
|
+
/** A binding decoded from the page: its Message is one of the application's. */
|
|
86
|
+
interface DecodedBinding {
|
|
87
|
+
readonly attribute: string;
|
|
88
|
+
readonly event: string;
|
|
89
|
+
readonly message: unknown;
|
|
90
|
+
readonly hole?: ReadonlyArray<string> | undefined;
|
|
91
|
+
readonly depth?: number | undefined;
|
|
92
|
+
readonly options?: unknown;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* What the markers make of one event: the Messages its bindings dispatch, in
|
|
96
|
+
* the order the live page would, and, when the walk met a handler the page
|
|
97
|
+
* could not name, that element. An answer with `unnamed` is incomplete: the
|
|
98
|
+
* live page would do more than its Messages say.
|
|
99
|
+
*/
|
|
100
|
+
interface Answer {
|
|
101
|
+
readonly event: Event;
|
|
102
|
+
readonly messages: ReadonlyArray<unknown>;
|
|
103
|
+
readonly unnamed?: Element | undefined;
|
|
104
|
+
}
|
|
105
|
+
interface ListenOptions {
|
|
106
|
+
readonly bindings: ReadonlyArray<DecodedBinding>;
|
|
107
|
+
readonly onAnswer: (answer: Answer) => void;
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/context.d.ts
|
|
111
|
+
type Region = ReadonlyArray<Html | string>;
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/index.d.ts
|
|
114
|
+
/** The attribute on the script that carries a page's resume envelope. */
|
|
115
|
+
export declare const RESUME_ATTRIBUTE = "data-foldkit-plus-resume";
|
|
116
|
+
export declare const serializeJsonScript: (value: unknown) => string;
|
|
117
|
+
/**
|
|
118
|
+
* Which part of the Model the browser owns, and what it starts from.
|
|
119
|
+
*
|
|
120
|
+
* `state` is a writable projection of that part, from `Projection.pick` or
|
|
121
|
+
* `Projection.compose`. `baseline` is the Model the browser sets it onto, by
|
|
122
|
+
* default the application's own initial Model. `boot` names the Commands the
|
|
123
|
+
* browser runs on load, since `init` does not run there.
|
|
124
|
+
*/
|
|
125
|
+
export interface ResumePlan<Model, Fields extends Schema.Struct.Fields, Commands = unknown> {
|
|
126
|
+
readonly id: string;
|
|
127
|
+
readonly state: WritableProjection<Model, Fields>;
|
|
128
|
+
readonly baseline: Model;
|
|
129
|
+
readonly boot?: ((model: Model) => Commands) | undefined;
|
|
130
|
+
/** Model paths allowed to start from the baseline, as `ModelRef.dependency` gives them. */
|
|
131
|
+
readonly local: ReadonlyArray<ReadonlyArray<string>>;
|
|
132
|
+
/** The Surfaces the browser may activate, which the plan must cover. */
|
|
133
|
+
readonly surfaces: ReadonlyArray<ActiveSurface<Model>>;
|
|
134
|
+
/** State another package owns, each captured and restored by that package. */
|
|
135
|
+
readonly parts: ReadonlyArray<ResumePart<Model>>;
|
|
136
|
+
/** The application's Message Schema, which encodes the page's bindings. */
|
|
137
|
+
readonly Message?: Schema.Top | undefined;
|
|
138
|
+
/**
|
|
139
|
+
* When the browser boots the runtime: `now` on load, `idle` when the browser
|
|
140
|
+
* is idle or on the first interaction, `on-interaction` on the first only.
|
|
141
|
+
* Until then the page answers events from its bindings and queues the
|
|
142
|
+
* Messages, which replay once the runtime has adopted the page.
|
|
143
|
+
*/
|
|
144
|
+
readonly start: Start;
|
|
145
|
+
/** Subscription and Managed Resource keys that may start late (decision 10). */
|
|
146
|
+
readonly deferrable: ReadonlyArray<string>;
|
|
147
|
+
/**
|
|
148
|
+
* `server`: a form whose `OnSubmit` names a Message also posts it to the
|
|
149
|
+
* page's own URL, and `SSR.handle` runs `update` there, so the form works
|
|
150
|
+
* with scripts off or not yet loaded.
|
|
151
|
+
*/
|
|
152
|
+
readonly fallback?: 'server' | undefined;
|
|
153
|
+
}
|
|
154
|
+
export type Start = 'now' | 'idle' | 'on-interaction';
|
|
155
|
+
/**
|
|
156
|
+
* A package's contribution to the envelope, for state the plan's slice cannot
|
|
157
|
+
* carry, such as Remote's normalized store. On the server `capture` takes what
|
|
158
|
+
* the active Surfaces' projections read and returns it as JSON; in the browser
|
|
159
|
+
* `restore` sets it onto the Model, or says why it cannot. A part owns its
|
|
160
|
+
* encoding: this package only carries the value.
|
|
161
|
+
*
|
|
162
|
+
* `covers` names the metadata keys whose reads the part resumes, so the
|
|
163
|
+
* coverage check counts those reads as sent. `Remote.resume(Data)` is one.
|
|
164
|
+
*/
|
|
165
|
+
export interface ResumePart<Model> {
|
|
166
|
+
readonly id: string;
|
|
167
|
+
readonly covers: ReadonlyArray<string>;
|
|
168
|
+
readonly capture: (model: Model, projections: ReadonlyArray<{
|
|
169
|
+
readonly metadata: Metadata;
|
|
170
|
+
}>) => unknown;
|
|
171
|
+
readonly restore: (model: Model, value: unknown) => Result.Result<Model, string>;
|
|
172
|
+
/**
|
|
173
|
+
* Whether a Subscription or Managed Resource entry of this part's package
|
|
174
|
+
* may start late, when a deferred boot is asked for. A part knows its own
|
|
175
|
+
* entries; nothing is deferrable by default.
|
|
176
|
+
*/
|
|
177
|
+
readonly deferrable?: ((key: string, entry: unknown) => boolean) | undefined;
|
|
178
|
+
}
|
|
179
|
+
declare const ResumeRefused_base: Schema.Class<ResumeRefused, Schema.TaggedStruct<"ResumeRefused", {
|
|
180
|
+
readonly reason: Schema.Literals<readonly ["Missing", "Duplicate", "Unreadable", "Protocol", "Plan", "Invalid", "Route"]>;
|
|
181
|
+
readonly message: Schema.String;
|
|
182
|
+
}>, Cause.YieldableError>;
|
|
183
|
+
/** Why a page's resume envelope was refused. */
|
|
184
|
+
export declare class ResumeRefused extends ResumeRefused_base {}
|
|
185
|
+
/**
|
|
186
|
+
* How a page's recorded route is compared with the browser's. `full` compares
|
|
187
|
+
* path and query. `path` compares the path alone, ignoring a trailing slash or
|
|
188
|
+
* `index.html`, for a page generated as a file: a static host serves one file
|
|
189
|
+
* for every query, and for `/about` and `/about/` alike.
|
|
190
|
+
*/
|
|
191
|
+
type RouteMatch = 'full' | 'path';
|
|
192
|
+
interface EnvelopeOptions {
|
|
193
|
+
readonly route?: string | undefined;
|
|
194
|
+
readonly match?: RouteMatch | undefined;
|
|
195
|
+
readonly bindings?: ReadonlyArray<EncodedBinding> | undefined;
|
|
196
|
+
}
|
|
197
|
+
/** Where the browser gets a Model path's value: the envelope, the baseline, or nowhere it may. */
|
|
198
|
+
export type Cover = 'state' | 'local' | 'missing';
|
|
199
|
+
/** One Surface as a plan covers it, for the server's Model. */
|
|
200
|
+
export interface SurfaceCoverage {
|
|
201
|
+
readonly name: string;
|
|
202
|
+
/** Whether the Surface is active for the server's Model. */
|
|
203
|
+
readonly active: boolean;
|
|
204
|
+
/** The place a `Surface.when` activation reads; absent for `Surface.at`. */
|
|
205
|
+
readonly activation?: {
|
|
206
|
+
readonly path: string;
|
|
207
|
+
readonly cover: Cover;
|
|
208
|
+
} | undefined;
|
|
209
|
+
/** The Model paths the active Surface reads. */
|
|
210
|
+
readonly reads: ReadonlyArray<{
|
|
211
|
+
readonly path: string;
|
|
212
|
+
readonly cover: Cover;
|
|
213
|
+
}>;
|
|
214
|
+
/**
|
|
215
|
+
* What the active Surface reads that no Model path names, such as Remote
|
|
216
|
+
* data, by its metadata. The slice cannot carry it.
|
|
217
|
+
*/
|
|
218
|
+
readonly unresumed: ReadonlyArray<MetadataSummary>;
|
|
219
|
+
/** Whether the browser's Model activates it the same way, with the same reads. */
|
|
220
|
+
readonly sameInBrowser: boolean;
|
|
221
|
+
}
|
|
222
|
+
/** What a plan sends, what it leaves local, and how it covers each Surface. */
|
|
223
|
+
export interface PlanInspection {
|
|
224
|
+
readonly id: string;
|
|
225
|
+
readonly state: ReadonlyArray<string>;
|
|
226
|
+
readonly local: ReadonlyArray<string>;
|
|
227
|
+
/** The ids of the parts that resume state the slice cannot carry. */
|
|
228
|
+
readonly parts: ReadonlyArray<string>;
|
|
229
|
+
readonly surfaces: ReadonlyArray<SurfaceCoverage>;
|
|
230
|
+
}
|
|
231
|
+
declare const ResumeUnsafe_base: Schema.Class<ResumeUnsafe, Schema.TaggedStruct<"ResumeUnsafe", {
|
|
232
|
+
readonly reason: Schema.Literals<readonly ["UndeclaredStartup", "Uncovered", "ViewDependsOnUnsentState", "DuplicateStaticRegion", "UngeneratablePath", "UnrestorablePart", "UnencodableBinding", "EagerStartRequired", "UndeclaredSurfaces", "BindingInStaticRegion"]>;
|
|
233
|
+
readonly message: Schema.String;
|
|
234
|
+
}>, Cause.YieldableError>;
|
|
235
|
+
/** Why a server refused to render a page against its plan. */
|
|
236
|
+
export declare class ResumeUnsafe extends ResumeUnsafe_base {}
|
|
237
|
+
/** The attribute on a static region's element, naming the region. */
|
|
238
|
+
export declare const STATIC_ATTRIBUTE = "data-foldkit-plus-static";
|
|
239
|
+
/**
|
|
240
|
+
* The part of a Foldkit application config a server render and a resumed
|
|
241
|
+
* client need. The full `makeApplication` config fits.
|
|
242
|
+
*/
|
|
243
|
+
export interface ResumableConfig<Model> {
|
|
244
|
+
readonly Model: Schema.Codec<Model, any, unknown, unknown>;
|
|
245
|
+
readonly init: (...args: ReadonlyArray<any>) => {
|
|
246
|
+
readonly model: Model;
|
|
247
|
+
readonly commands?: ReadonlyArray<{
|
|
248
|
+
readonly name: string;
|
|
249
|
+
}> | undefined;
|
|
250
|
+
};
|
|
251
|
+
readonly update: (model: Model, message: any) => {
|
|
252
|
+
readonly model: Model;
|
|
253
|
+
};
|
|
254
|
+
readonly view: (model: Model, h: any) => unknown;
|
|
255
|
+
readonly container: HTMLElement | null;
|
|
256
|
+
readonly Flags?: unknown;
|
|
257
|
+
readonly routing?: unknown;
|
|
258
|
+
readonly subscriptions?: Readonly<Record<string, unknown>> | undefined;
|
|
259
|
+
readonly managedResources?: Readonly<Record<string, unknown>> | undefined;
|
|
260
|
+
/** The services Commands need, as Foldkit's runtime provides them. */
|
|
261
|
+
readonly resources?: Layer.Layer<any, any, never> | undefined;
|
|
262
|
+
/**
|
|
263
|
+
* Bundles whose bodies load on demand (`Bundle.lazy`). The server loads
|
|
264
|
+
* them before it renders; the browser loads them before it boots, answering
|
|
265
|
+
* from the markers meanwhile, so a page never shows a bundle's placeholder.
|
|
266
|
+
*/
|
|
267
|
+
readonly lazy?: ReadonlyArray<Loadable> | undefined;
|
|
268
|
+
}
|
|
269
|
+
/** What `SSR` needs of a lazy bundle: `Bundle.lazy` gives it. */
|
|
270
|
+
export interface Loadable {
|
|
271
|
+
readonly name: string;
|
|
272
|
+
readonly load: () => Promise<void>;
|
|
273
|
+
readonly isLoaded: () => boolean;
|
|
274
|
+
}
|
|
275
|
+
/** A page generated at build time, and the file a static host serves it from. */
|
|
276
|
+
export interface GeneratedPage {
|
|
277
|
+
readonly path: string;
|
|
278
|
+
readonly file: string;
|
|
279
|
+
readonly html: string;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* One generated page per path, in the paths' order: a tuple when the paths
|
|
283
|
+
* are written out, so `const [home, about] = pages` needs no check.
|
|
284
|
+
*/
|
|
285
|
+
export type GeneratedPages<Paths extends ReadonlyArray<string>> = { readonly [K in keyof Paths]: GeneratedPage; };
|
|
286
|
+
declare const FallbackRefused_base: Schema.Class<FallbackRefused, Schema.TaggedStruct<"FallbackRefused", {
|
|
287
|
+
readonly reason: Schema.Literals<readonly ["Missing", "Unreadable", "Invalid", "Unlisted", "NoFallback"]>;
|
|
288
|
+
readonly message: Schema.String;
|
|
289
|
+
}>, Cause.YieldableError>;
|
|
290
|
+
/** Why a posted form was not handled: the request, not the page or the plan, is at fault. */
|
|
291
|
+
export declare class FallbackRefused extends FallbackRefused_base {}
|
|
292
|
+
/** The resumable track: bindings the server's markup names, so a page can answer before it boots. */
|
|
293
|
+
export declare const Resume: {
|
|
294
|
+
builder: <Builder extends AnyBuilder>(h: Builder) => ResumableBuilder<MessageOf<Builder>>;
|
|
295
|
+
view: <Model, Builder extends AnyBuilder, Out>(render: (model: Model, rh: ResumableBuilder<MessageOf<Builder>>) => Out) => (model: Model, h: Builder) => Out;
|
|
296
|
+
bindings: <Model, Fields extends Schema.Struct.Fields>(plan: ResumePlan<Model, Fields>, page: ParentNode, root: Element, model: Model) => Result.Result<ReadonlyArray<DecodedBinding>, ResumeRefused>;
|
|
297
|
+
listen: (root: Element, options: ListenOptions) => (() => void);
|
|
298
|
+
};
|
|
299
|
+
export declare const SSR: {
|
|
300
|
+
plan: <Model, Fields extends Schema.Struct.Fields, Commands = unknown>(application: {
|
|
301
|
+
readonly initial: Model;
|
|
302
|
+
readonly owner?: object;
|
|
303
|
+
readonly Message?: Schema.Top | undefined;
|
|
304
|
+
}, config: {
|
|
305
|
+
readonly id: string;
|
|
306
|
+
readonly state: WritableProjection<Model, Fields>;
|
|
307
|
+
readonly baseline?: Model | undefined;
|
|
308
|
+
readonly boot?: ((model: Model) => Commands) | undefined;
|
|
309
|
+
readonly local?: ReadonlyArray<{
|
|
310
|
+
readonly dependency: ReadonlyArray<string>;
|
|
311
|
+
}> | undefined;
|
|
312
|
+
readonly surfaces?: ReadonlyArray<ActiveSurface<Model>> | undefined;
|
|
313
|
+
readonly parts?: ReadonlyArray<ResumePart<Model>> | undefined;
|
|
314
|
+
readonly start?: Start | undefined;
|
|
315
|
+
readonly deferrable?: ReadonlyArray<string> | undefined;
|
|
316
|
+
readonly fallback?: "server" | undefined;
|
|
317
|
+
}) => ResumePlan<Model, Fields, Commands>;
|
|
318
|
+
envelope: <Model, Fields extends Schema.Struct.Fields>(resume: ResumePlan<Model, Fields>, model: Model, options?: EnvelopeOptions) => string;
|
|
319
|
+
resume: <Model, Fields extends Schema.Struct.Fields>(plan: ResumePlan<Model, Fields>, page: ParentNode, options?: {
|
|
320
|
+
readonly route?: string | undefined;
|
|
321
|
+
}) => Result.Result<Model, ResumeRefused>;
|
|
322
|
+
render: <Model, Fields extends Schema.Struct.Fields>(config: ResumableConfig<Model>, plan: ResumePlan<Model, Fields>, options: {
|
|
323
|
+
readonly buildId: string;
|
|
324
|
+
readonly url?: string | undefined;
|
|
325
|
+
readonly flags?: unknown;
|
|
326
|
+
}) => Effect.Effect<{
|
|
327
|
+
readonly rendered: RenderedApplication;
|
|
328
|
+
readonly envelope: string;
|
|
329
|
+
}, RenderError | ResumeUnsafe>;
|
|
330
|
+
page: (template: string, result: {
|
|
331
|
+
readonly rendered: RenderedApplication;
|
|
332
|
+
readonly envelope: string;
|
|
333
|
+
}) => string;
|
|
334
|
+
hydrate: <Model, Fields extends Schema.Struct.Fields>(config: ResumableConfig<Model>, plan: ResumePlan<Model, Fields>, options: {
|
|
335
|
+
readonly buildId: string;
|
|
336
|
+
}) => void;
|
|
337
|
+
inspect: <Model, Fields extends Schema.Struct.Fields>(plan: ResumePlan<Model, Fields>, model: Model) => PlanInspection;
|
|
338
|
+
static: (id: string, render: (ih: HtmlBuilder<never>) => Region) => Html;
|
|
339
|
+
generate: <Model, Fields extends Schema.Struct.Fields, const Paths extends ReadonlyArray<string>>(config: ResumableConfig<Model>, plan: ResumePlan<Model, Fields>, options: {
|
|
340
|
+
readonly buildId: string;
|
|
341
|
+
readonly template: string;
|
|
342
|
+
readonly origin: string;
|
|
343
|
+
readonly paths: Paths;
|
|
344
|
+
readonly flags?: ((path: string) => unknown) | undefined;
|
|
345
|
+
}) => Effect.Effect<GeneratedPages<Paths>, RenderError | ResumeUnsafe>;
|
|
346
|
+
entry: <Model, Fields extends Schema.Struct.Fields>(config: ResumableConfig<Model>, plan: ResumePlan<Model, Fields>, options: {
|
|
347
|
+
readonly buildId: string;
|
|
348
|
+
readonly template: string;
|
|
349
|
+
readonly containerId?: string | undefined;
|
|
350
|
+
readonly flags?: ((request: Request) => unknown | PromiseLike<unknown>) | undefined;
|
|
351
|
+
}) => EntryModule;
|
|
352
|
+
handle: <Model, Fields extends Schema.Struct.Fields>(request: Request, config: ResumableConfig<Model>, plan: ResumePlan<Model, Fields>, options: {
|
|
353
|
+
readonly buildId: string;
|
|
354
|
+
readonly flags?: unknown;
|
|
355
|
+
}) => Effect.Effect<{
|
|
356
|
+
readonly rendered: RenderedApplication;
|
|
357
|
+
readonly envelope: string;
|
|
358
|
+
}, RenderError | ResumeUnsafe | FallbackRefused>;
|
|
359
|
+
serializeJsonScript: (value: unknown) => string;
|
|
360
|
+
};
|
|
361
|
+
//#endregion
|
|
362
|
+
export type { DecodedBinding, ResumableBuilder };
|
|
363
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/resumable.ts","../src/listen.ts","../src/context.ts","../src/index.ts"],"mappings":";;;;;;qBAoBa;;qBA4GA;;qBAMA;cAEC;;UAGG,QAAQ;YACb,UAAU;;KAGjB,QAAQ,GAAG,IAAI,KAAK,sBAAsB,YAAY;;KAGtD,kBAAkB,OAAO;WAAiB,QAAQ,OAAO,OAAO;;;KAGhE,KAAK,KAAK;WAAqB,YAAY;IAAM;;KAGjD,QAAQ,KAAK,QAAQ,KAAK,KAAK;;KAG/B,KAAK,GAAG,SAAS,KAAK,KAAK,mBAAmB;KAE9C,gBAAgB,GAAG,YAAY,KAAK,aAAa,qBAElD;KAEC,cAAc,GAAG,gBAAgB,KAAK,GAAG,0BAC1C,6EACa,cAAc,KAAK,GAAG,UACjC,yFACA,KAAK,GAAG,aAAa,KAAK,GAAG,wCACZ,KAAK,GAAG,aAAa,KAAK,GAAG,oBAE1C,wDACF;KAEH,aAAa,GAAG,gBAAgB,KAAK,GAAG,6EACJ,KAAK,GAAG,oBAE3C,mFACF;;UAGa,SAAS;GACvB,YAAY,kBAAkB,UAAU,UAAU;GAClD,UAAU,uBAAuB,cAAc,QAAQ,SACtD,QAAQ,IAAI,gBAAgB,GAAG,WAAW,cAAc,GAA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