@hollware/server 0.0.2 → 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 +3 -3
- package/dist/index.d.mts +387 -1
- package/dist/index.mjs +3844 -1
- package/migrations/0001_core.sql +132 -0
- package/migrations/0002_append_only.sql +70 -0
- package/migrations/0003_events_and_schedules.sql +57 -0
- package/migrations/meta/0000_snapshot.json +42 -0
- package/migrations/meta/0001_snapshot.json +992 -0
- package/migrations/meta/0002_snapshot.json +992 -0
- package/migrations/meta/0003_snapshot.json +1406 -0
- package/migrations/meta/_journal.json +34 -0
- package/package.json +21 -4
package/README.md
CHANGED
|
@@ -8,9 +8,9 @@ for the agent era, native to Cloudflare Workers.
|
|
|
8
8
|
|
|
9
9
|
## What it will be
|
|
10
10
|
|
|
11
|
-
The Hollware Worker: the
|
|
12
|
-
|
|
13
|
-
`migrations/`.
|
|
11
|
+
The Hollware Worker: the handlers of the operations that `@hollware/core` specifies, served
|
|
12
|
+
over MCP, Workers RPC and HTTP, authentication, and the D1 migrations that shape the
|
|
13
|
+
database. The migrations ship inside the package, in `migrations/`.
|
|
14
14
|
|
|
15
15
|
## Links
|
|
16
16
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,389 @@
|
|
|
1
|
+
import { AcknowledgedWarning, EntryDocument, EntryLookup, EntryRef, HollwareConfig, OperationByName, OperationName, ResolvedSite, Scope, Verdict, describeSite, getEntry, getTranslations, listEntries } from "@hollware/core";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
import { WorkerEntrypoint } from "cloudflare:workers";
|
|
4
|
+
//#region src/ports.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* The ports of the operation handlers: what they need from the world, as interfaces. The D1
|
|
7
|
+
* store implements `ContentStore` (`db/`); the handlers (`ops/`) only see this file, so their
|
|
8
|
+
* tests run on fakes. Every method takes the site first and never sees another site's rows.
|
|
9
|
+
*/
|
|
10
|
+
/** Which revision a read returns: the latest one (MCP) or the published one (RPC). */
|
|
11
|
+
type View = 'head' | 'published';
|
|
12
|
+
/** Who wrote a revision or a publication. */
|
|
13
|
+
interface Actor {
|
|
14
|
+
readonly kind: 'token' | 'user' | 'oauth_client';
|
|
15
|
+
readonly userId: string;
|
|
16
|
+
readonly tokenId: string | null;
|
|
17
|
+
/** What the client said about itself (the MCP client and, when it says, the model). */
|
|
18
|
+
readonly meta: Readonly<Record<string, unknown>> | null;
|
|
19
|
+
}
|
|
20
|
+
/** An entry as the store holds it. */
|
|
21
|
+
interface StoredEntry {
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly collection: string;
|
|
24
|
+
readonly locale: string;
|
|
25
|
+
readonly slug: string;
|
|
26
|
+
readonly translationGroup: string | null;
|
|
27
|
+
readonly status: 'draft' | 'scheduled' | 'published';
|
|
28
|
+
/** Moves on every change of the entry; a write against an older one is a conflict. */
|
|
29
|
+
readonly version: number;
|
|
30
|
+
readonly headRevision: string;
|
|
31
|
+
readonly publishedRevision: string | null;
|
|
32
|
+
/** When the entry was first published; republishing keeps it. */
|
|
33
|
+
readonly publishedAt: string | null;
|
|
34
|
+
readonly updatedAt: string;
|
|
35
|
+
}
|
|
36
|
+
/** A revision as the store holds it. */
|
|
37
|
+
interface StoredRevision {
|
|
38
|
+
readonly id: string;
|
|
39
|
+
readonly entryId: string;
|
|
40
|
+
/** The whole file, frontmatter included: the source of truth (ADR-001). */
|
|
41
|
+
readonly markdown: string;
|
|
42
|
+
readonly frontmatter: Readonly<Record<string, unknown>>;
|
|
43
|
+
readonly document: EntryDocument;
|
|
44
|
+
readonly comarkVersion: string;
|
|
45
|
+
readonly pipelineVersion: string;
|
|
46
|
+
readonly wordCount: number;
|
|
47
|
+
/** The verdict of the `write` phase when the revision was written. */
|
|
48
|
+
readonly verdict: Verdict;
|
|
49
|
+
readonly tags: readonly string[];
|
|
50
|
+
readonly actor: Actor;
|
|
51
|
+
readonly createdAt: string;
|
|
52
|
+
}
|
|
53
|
+
/** An entry with the revision of the view that was asked for. */
|
|
54
|
+
interface EntryView {
|
|
55
|
+
readonly entry: StoredEntry;
|
|
56
|
+
readonly revision: StoredRevision;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* What a listing needs of a revision: its frontmatter and tags, never the Markdown or the
|
|
60
|
+
* document, which can weigh megabytes on a page of a hundred entries.
|
|
61
|
+
*/
|
|
62
|
+
interface RevisionSummary {
|
|
63
|
+
readonly id: string;
|
|
64
|
+
readonly frontmatter: Readonly<Record<string, unknown>>;
|
|
65
|
+
readonly tags: readonly string[];
|
|
66
|
+
}
|
|
67
|
+
/** An entry with the summary of the revision of the view that was asked for. */
|
|
68
|
+
interface EntrySummaryView {
|
|
69
|
+
readonly entry: StoredEntry;
|
|
70
|
+
readonly revision: RevisionSummary;
|
|
71
|
+
}
|
|
72
|
+
/** A publish or an unpublish, as `publications` keeps it (ADR-021). */
|
|
73
|
+
interface StoredPublication {
|
|
74
|
+
readonly id: string;
|
|
75
|
+
readonly entryId: string;
|
|
76
|
+
readonly action: 'publish' | 'unpublish';
|
|
77
|
+
readonly revisionId: string | null;
|
|
78
|
+
readonly verdict: Verdict | null;
|
|
79
|
+
readonly acknowledged: readonly AcknowledgedWarning[];
|
|
80
|
+
readonly actor: Actor;
|
|
81
|
+
readonly createdAt: string;
|
|
82
|
+
}
|
|
83
|
+
/** A revision to append. The store adds its id and time. */
|
|
84
|
+
interface NewRevision {
|
|
85
|
+
readonly markdown: string;
|
|
86
|
+
readonly frontmatter: Readonly<Record<string, unknown>>;
|
|
87
|
+
readonly document: EntryDocument;
|
|
88
|
+
readonly comarkVersion: string;
|
|
89
|
+
readonly pipelineVersion: string;
|
|
90
|
+
readonly wordCount: number;
|
|
91
|
+
readonly verdict: Verdict;
|
|
92
|
+
readonly tags: readonly string[];
|
|
93
|
+
readonly actor: Actor;
|
|
94
|
+
}
|
|
95
|
+
interface ListQuery {
|
|
96
|
+
readonly collection: string;
|
|
97
|
+
readonly locale?: string;
|
|
98
|
+
readonly tag?: string;
|
|
99
|
+
readonly status?: StoredEntry['status'];
|
|
100
|
+
readonly view: View;
|
|
101
|
+
readonly limit: number;
|
|
102
|
+
/** The `nextCursor` of the previous page. */
|
|
103
|
+
readonly cursor?: string;
|
|
104
|
+
}
|
|
105
|
+
/** The answer to a write that the store could not make. */
|
|
106
|
+
type WriteRefusal = {
|
|
107
|
+
readonly outcome: 'conflict';
|
|
108
|
+
readonly currentVersion: number;
|
|
109
|
+
readonly headRevision: string;
|
|
110
|
+
} | {
|
|
111
|
+
readonly outcome: 'not_found';
|
|
112
|
+
} |
|
|
113
|
+
/** Another entry already has this slug, or this translation, in the collection and locale. */
|
|
114
|
+
{
|
|
115
|
+
readonly outcome: 'taken';
|
|
116
|
+
readonly field: 'slug' | 'translationGroup';
|
|
117
|
+
readonly by: string;
|
|
118
|
+
} |
|
|
119
|
+
/** The row would be over `MAX_ROW_BYTES` (`limits.ts`); nothing was written. */
|
|
120
|
+
{
|
|
121
|
+
readonly outcome: 'too_large';
|
|
122
|
+
readonly bytes: number;
|
|
123
|
+
readonly limit: number;
|
|
124
|
+
};
|
|
125
|
+
/** A scheduled publication, as the cron trigger reads it. */
|
|
126
|
+
interface StoredSchedule {
|
|
127
|
+
readonly entryId: string;
|
|
128
|
+
readonly scheduledAt: string;
|
|
129
|
+
/** The version the entry had once scheduled; another one means it changed since. */
|
|
130
|
+
readonly version: number;
|
|
131
|
+
readonly acknowledged: readonly AcknowledgedWarning[];
|
|
132
|
+
readonly actor: Actor;
|
|
133
|
+
}
|
|
134
|
+
/** One entry of a publication: what `publish` and `publishGroup` write for it. */
|
|
135
|
+
interface PublishWrite {
|
|
136
|
+
readonly entryId: string;
|
|
137
|
+
readonly expectedVersion: number;
|
|
138
|
+
readonly verdict: Verdict;
|
|
139
|
+
readonly acknowledged: readonly AcknowledgedWarning[];
|
|
140
|
+
readonly actor: Actor;
|
|
141
|
+
/** What orders the entry in published listings. */
|
|
142
|
+
readonly sortKey: string;
|
|
143
|
+
/** The event of the publication, written to the outbox in the same batch (ADR-025). */
|
|
144
|
+
readonly event?: OutboxEvent | null;
|
|
145
|
+
}
|
|
146
|
+
/** An event for the outbox: its id and what subscribers get, as JSON. */
|
|
147
|
+
interface OutboxEvent {
|
|
148
|
+
readonly id: string;
|
|
149
|
+
readonly payload: string;
|
|
150
|
+
}
|
|
151
|
+
interface ContentStore {
|
|
152
|
+
/** The entry with that collection, locale and slug, in the given view, or `null`. */
|
|
153
|
+
findEntry(site: string, ref: EntryRef, view: View): Promise<EntryView | null>;
|
|
154
|
+
/** The entry with that id, in the given view, or `null`. */
|
|
155
|
+
findEntryById(site: string, id: string, view: View): Promise<EntryView | null>;
|
|
156
|
+
/**
|
|
157
|
+
* A page of entries. The `head` view is ordered by the last change, the `published` view by
|
|
158
|
+
* the published sort key, newest first; ties go by id. The cursor is opaque.
|
|
159
|
+
*/
|
|
160
|
+
listEntries(site: string, query: ListQuery): Promise<{
|
|
161
|
+
readonly entries: readonly EntrySummaryView[];
|
|
162
|
+
readonly nextCursor: string | null;
|
|
163
|
+
}>;
|
|
164
|
+
/** The entries of a translation group, one per locale, in the given view. */
|
|
165
|
+
listTranslations(site: string, collection: string, translationGroup: string, view: View): Promise<readonly EntrySummaryView[]>;
|
|
166
|
+
/** What cross-entry contracts read, scoped to the site. */
|
|
167
|
+
lookup(site: string): EntryLookup;
|
|
168
|
+
/** The latest publish or unpublish of an entry, or `null`. */
|
|
169
|
+
lastPublication(site: string, entryId: string): Promise<StoredPublication | null>;
|
|
170
|
+
/** Creates an entry at version 1 with its first revision, as a draft. */
|
|
171
|
+
createEntry(site: string, entry: EntryRef & {
|
|
172
|
+
readonly translationGroup: string | null;
|
|
173
|
+
readonly revision: NewRevision;
|
|
174
|
+
}): Promise<{
|
|
175
|
+
readonly outcome: 'saved';
|
|
176
|
+
readonly view: EntryView;
|
|
177
|
+
} | WriteRefusal>;
|
|
178
|
+
/**
|
|
179
|
+
* Appends a revision and makes it the head, if the entry is still at `expectedVersion`. In
|
|
180
|
+
* one batch: the revision, its tags (only where the revision was inserted) and the entry.
|
|
181
|
+
*/
|
|
182
|
+
appendRevision(site: string, write: {
|
|
183
|
+
readonly entryId: string;
|
|
184
|
+
readonly expectedVersion: number;
|
|
185
|
+
readonly translationGroup: string | null;
|
|
186
|
+
readonly revision: NewRevision;
|
|
187
|
+
}): Promise<{
|
|
188
|
+
readonly outcome: 'saved';
|
|
189
|
+
readonly view: EntryView;
|
|
190
|
+
} | WriteRefusal>;
|
|
191
|
+
/**
|
|
192
|
+
* Publishes the head revision, if the entry is still at `expectedVersion`, and appends the
|
|
193
|
+
* publication with its verdict and acknowledged warnings.
|
|
194
|
+
*/
|
|
195
|
+
publish(site: string, write: PublishWrite): Promise<{
|
|
196
|
+
readonly outcome: 'published';
|
|
197
|
+
readonly view: EntryView;
|
|
198
|
+
} | WriteRefusal>;
|
|
199
|
+
/**
|
|
200
|
+
* Publishes the head revisions of a group of entries in one batch, all or none (ADR-024): every
|
|
201
|
+
* entry must still be at its `expectedVersion`. A refusal names the entry that caused it.
|
|
202
|
+
*/
|
|
203
|
+
publishGroup(site: string, writes: readonly PublishWrite[]): Promise<{
|
|
204
|
+
readonly outcome: 'published';
|
|
205
|
+
readonly views: readonly EntryView[];
|
|
206
|
+
} | (WriteRefusal & {
|
|
207
|
+
readonly entryId: string;
|
|
208
|
+
})>;
|
|
209
|
+
/**
|
|
210
|
+
* Schedules the publication of an entry that is not published, if it is still at
|
|
211
|
+
* `expectedVersion`: the entry becomes `scheduled` at the next version, and its schedule keeps
|
|
212
|
+
* the acknowledged warnings and the actor for the cron trigger (ADR-025).
|
|
213
|
+
*/
|
|
214
|
+
schedule(site: string, write: {
|
|
215
|
+
readonly entryId: string;
|
|
216
|
+
readonly expectedVersion: number;
|
|
217
|
+
readonly scheduledAt: string;
|
|
218
|
+
readonly acknowledged: readonly AcknowledgedWarning[];
|
|
219
|
+
readonly actor: Actor;
|
|
220
|
+
}): Promise<{
|
|
221
|
+
readonly outcome: 'scheduled';
|
|
222
|
+
readonly view: EntryView;
|
|
223
|
+
} | WriteRefusal>;
|
|
224
|
+
/** The schedules whose time has come, at most 50, oldest first. */
|
|
225
|
+
dueSchedules(site: string, now: string): Promise<readonly StoredSchedule[]>;
|
|
226
|
+
/** Takes a scheduled entry back to a draft and drops its schedule. */
|
|
227
|
+
cancelSchedule(site: string, entryId: string): Promise<void>;
|
|
228
|
+
/** Takes the entry off the public site and appends the unpublish. */
|
|
229
|
+
unpublish(site: string, write: {
|
|
230
|
+
readonly entryId: string;
|
|
231
|
+
readonly actor: Actor;
|
|
232
|
+
readonly event?: OutboxEvent | null;
|
|
233
|
+
}): Promise<{
|
|
234
|
+
readonly outcome: 'unpublished';
|
|
235
|
+
readonly view: EntryView;
|
|
236
|
+
} | WriteRefusal>;
|
|
237
|
+
}
|
|
238
|
+
/** The time, so that tests can fix it. */
|
|
239
|
+
interface Clock {
|
|
240
|
+
now(): Date;
|
|
241
|
+
}
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region src/events/run.d.ts
|
|
244
|
+
/** A message of the events Queue: the site and the id of an outbox row. */
|
|
245
|
+
interface EventMessage {
|
|
246
|
+
readonly site: string;
|
|
247
|
+
readonly id: string;
|
|
248
|
+
}
|
|
249
|
+
/** The part of a Queue binding that sends. */
|
|
250
|
+
interface EventQueue {
|
|
251
|
+
sendBatch(messages: Iterable<{
|
|
252
|
+
readonly body: EventMessage;
|
|
253
|
+
}>): Promise<unknown>;
|
|
254
|
+
}
|
|
255
|
+
/** The part of a Queue message the consumer uses; its body is checked before use. */
|
|
256
|
+
interface EventDelivery {
|
|
257
|
+
readonly body: unknown;
|
|
258
|
+
ack(): void;
|
|
259
|
+
retry(): void;
|
|
260
|
+
}
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/auth/types.d.ts
|
|
263
|
+
/**
|
|
264
|
+
* Who calls an operation. The gateway turns each request into a principal before any handler
|
|
265
|
+
* runs, and the handlers check their scopes against it at call time (ADR-019).
|
|
266
|
+
*/
|
|
267
|
+
type Principal = {
|
|
268
|
+
/** A personal token. */
|
|
269
|
+
readonly kind: 'token';
|
|
270
|
+
readonly userId: string;
|
|
271
|
+
readonly tokenId: string;
|
|
272
|
+
/** The site the token belongs to; it never reaches another one. */
|
|
273
|
+
readonly site: string;
|
|
274
|
+
/** The token's own scopes intersected with those of its user's role, as of now. */
|
|
275
|
+
readonly scopes: readonly Scope[];
|
|
276
|
+
} | {
|
|
277
|
+
/** A Worker of the same account, over the RPC binding: it reads published content. */
|
|
278
|
+
readonly kind: 'binding';
|
|
279
|
+
readonly scopes: readonly ['content:read'];
|
|
280
|
+
};
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/ops/types.d.ts
|
|
283
|
+
/**
|
|
284
|
+
* The handlers of the operations (ADR-017): one per spec of `@hollware/core`, paired by type,
|
|
285
|
+
* so that a missing handler or a handler for an unknown operation does not compile.
|
|
286
|
+
*/
|
|
287
|
+
/** What a handler gets besides its input. Adapters build it; handlers never see a request. */
|
|
288
|
+
interface OperationContext {
|
|
289
|
+
readonly site: ResolvedSite;
|
|
290
|
+
readonly principal: Principal;
|
|
291
|
+
/** `head` over MCP, `published` over RPC. */
|
|
292
|
+
readonly view: View;
|
|
293
|
+
readonly store: ContentStore;
|
|
294
|
+
readonly clock: Clock;
|
|
295
|
+
/** What the client said about itself; writes record it as the actor's meta. */
|
|
296
|
+
readonly client: Readonly<Record<string, unknown>> | null;
|
|
297
|
+
readonly requestId: string;
|
|
298
|
+
/**
|
|
299
|
+
* Called with the ids of the events that a write committed to the outbox, so that they reach
|
|
300
|
+
* the Queue now rather than at the next sweep of the cron trigger (ADR-025). Absent in tests.
|
|
301
|
+
*/
|
|
302
|
+
readonly notify?: (eventIds: readonly string[]) => void;
|
|
303
|
+
}
|
|
304
|
+
/** The handler of one operation: its parsed input in, its output out. */
|
|
305
|
+
type OperationHandler<Name extends OperationName> = (input: z.output<OperationByName<Name>['input']>, context: OperationContext) => Promise<z.output<OperationByName<Name>['output']>>;
|
|
306
|
+
/** One handler for every operation. */
|
|
307
|
+
type Handlers = { readonly [Name in OperationName]: OperationHandler<Name>; };
|
|
308
|
+
/** Declares the handlers; the type checks that they pair with the specs one to one. */
|
|
309
|
+
export declare function defineHandlers(handlers: Handlers): Handlers;
|
|
310
|
+
//#endregion
|
|
311
|
+
//#region src/limits.d.ts
|
|
312
|
+
/**
|
|
313
|
+
* The limits every operation runs under, pinned for the adapters and the store (the v0.1 plan).
|
|
314
|
+
*/
|
|
315
|
+
/**
|
|
316
|
+
* The largest answer of an operation, in UTF-8 bytes of its JSON. A larger one is the error
|
|
317
|
+
* `output_too_large`, with a fix that says how to ask for less; content is never truncated.
|
|
318
|
+
*/
|
|
319
|
+
export declare const OUTPUT_CAP_BYTES: number;
|
|
320
|
+
/** How long an operation may take before it answers the error `timeout`. */
|
|
321
|
+
export declare const OPERATION_TIMEOUT_MS = 10000;
|
|
322
|
+
/**
|
|
323
|
+
* The largest row the store writes, counted in UTF-8 bytes across all its columns. D1 refuses
|
|
324
|
+
* rows over 2 MB in production, and Miniflare does not enforce it, so the store checks first.
|
|
325
|
+
*/
|
|
326
|
+
export declare const MAX_ROW_BYTES = 1900000;
|
|
327
|
+
/** The most values bound in one statement: D1 allows 100, and lookups go in chunks of this. */
|
|
328
|
+
export declare const MAX_BOUND_PARAMETERS = 90;
|
|
329
|
+
//#endregion
|
|
1
330
|
//#region src/index.d.ts
|
|
2
331
|
export declare const name = "@hollware/server";
|
|
3
|
-
|
|
332
|
+
/** The bindings and variables of the Worker, as its `wrangler.jsonc` declares them. */
|
|
333
|
+
export interface HollwareEnv {
|
|
334
|
+
/** The D1 database, with the migrations of this package applied. */
|
|
335
|
+
readonly DB: D1Database;
|
|
336
|
+
/**
|
|
337
|
+
* The public URL of the Worker, such as `https://cms.example.com`. It is the only Host and
|
|
338
|
+
* Origin the Worker answers; without it, every request fails.
|
|
339
|
+
*/
|
|
340
|
+
readonly HOLLWARE_PUBLIC_URL: string;
|
|
341
|
+
/** The Queue of publication events (ADR-025); without it, the cron trigger delivers them. */
|
|
342
|
+
readonly EVENTS?: EventQueue;
|
|
343
|
+
}
|
|
344
|
+
type Output<Spec extends {
|
|
345
|
+
output: z.ZodType;
|
|
346
|
+
}> = z.output<Spec['output']>;
|
|
347
|
+
/**
|
|
348
|
+
* The read-only RPC surface that sites of the same account call over a service binding. It
|
|
349
|
+
* returns published content only; nothing in it writes.
|
|
350
|
+
*/
|
|
351
|
+
export interface HollwareRpc {
|
|
352
|
+
getEntry(site: string, collection: string, slug: string, locale: string, options?: {
|
|
353
|
+
readonly formats?: readonly ('markdown' | 'document' | 'html')[];
|
|
354
|
+
}): Promise<Output<typeof getEntry>>;
|
|
355
|
+
listEntries(site: string, collection: string, options?: {
|
|
356
|
+
readonly locale?: string;
|
|
357
|
+
readonly tag?: string;
|
|
358
|
+
readonly limit?: number;
|
|
359
|
+
readonly cursor?: string;
|
|
360
|
+
}): Promise<Output<typeof listEntries>>;
|
|
361
|
+
getTranslations(site: string, collection: string, translationGroup: string): Promise<Output<typeof getTranslations>>;
|
|
362
|
+
describeSite(site: string): Promise<Output<typeof describeSite>>;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* What `createHollware(config)` returns. The user's Worker is
|
|
366
|
+
* `export default { fetch }` and `export class Hollware extends hollware.Hollware {}`.
|
|
367
|
+
*/
|
|
368
|
+
export interface HollwareWorker {
|
|
369
|
+
/** MCP at `/mcp`, and the other routes of the gateway. */
|
|
370
|
+
readonly fetch: (request: Request, env: HollwareEnv, ctx: ExecutionContext) => Promise<Response>;
|
|
371
|
+
/** The consumer of the events Queue (`queues.consumers` in wrangler.jsonc). */
|
|
372
|
+
readonly queue: (batch: {
|
|
373
|
+
readonly messages: readonly EventDelivery[];
|
|
374
|
+
}, env: HollwareEnv, ctx: ExecutionContext) => Promise<void>;
|
|
375
|
+
/** The cron trigger of the project (`triggers.crons` in wrangler.jsonc, every minute). */
|
|
376
|
+
readonly scheduled: (controller: ScheduledController, env: HollwareEnv, ctx: ExecutionContext) => Promise<void>;
|
|
377
|
+
/** The RPC entrypoint, for the user's Worker to export under the name `Hollware`. */
|
|
378
|
+
readonly Hollware: new (ctx: ExecutionContext, env: HollwareEnv) => WorkerEntrypoint<HollwareEnv> & HollwareRpc;
|
|
379
|
+
}
|
|
380
|
+
/** Builds the Worker from the config. The config is resolved once, when the Worker starts. */
|
|
381
|
+
export type CreateHollware = (config: HollwareConfig) => HollwareWorker;
|
|
382
|
+
/**
|
|
383
|
+
* Builds the Worker from the config: `const hollware = createHollware(config)`, then
|
|
384
|
+
* `export default { fetch: hollware.fetch }` and `export class Hollware extends hollware.Hollware {}`.
|
|
385
|
+
* The config is resolved once, here; a broken one throws its `ConfigError`.
|
|
386
|
+
*/
|
|
387
|
+
export declare const createHollware: CreateHollware;
|
|
388
|
+
//#endregion
|
|
389
|
+
export type { Actor, Clock, ContentStore, EntrySummaryView, EntryView, EventMessage, Handlers, ListQuery, NewRevision, OperationContext, OperationHandler, OutboxEvent, Principal, PublishWrite, RevisionSummary, StoredEntry, StoredPublication, StoredRevision, StoredSchedule, View, WriteRefusal };
|