@moku-labs/worker 0.9.2 → 0.11.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.
@@ -1,531 +0,0 @@
1
- import { PluginCtx, PluginInstance } from "@moku-labs/core";
2
-
3
- //#region src/config.d.ts
4
- /** Per-request Cloudflare bindings object (env). Framework-level shared type. */
5
- type WorkerEnv = Record<string, unknown>;
6
- /** Global framework config — flat, with complete defaults. */
7
- type WorkerConfig = {
8
- stage: "production" | "development" | "test";
9
- name: string;
10
- compatibilityDate: string;
11
- };
12
- /** Global framework events — declared once, visible to every plugin. */
13
- type WorkerEvents = {
14
- "request:start": {
15
- method: string;
16
- path: string;
17
- requestId: string;
18
- };
19
- "request:end": {
20
- method: string;
21
- path: string;
22
- status: number;
23
- ms: number;
24
- };
25
- "deploy:phase": {
26
- phase: string;
27
- detail?: string;
28
- };
29
- "deploy:complete": {
30
- url: string;
31
- };
32
- "provision:resource": {
33
- kind: "kv" | "r2" | "d1" | "queue" | "do";
34
- name: string;
35
- };
36
- "provision:plan": {
37
- exists: number;
38
- missing: number;
39
- ships: number;
40
- account: string;
41
- };
42
- "provision:skip": {
43
- kind: "kv" | "r2" | "d1" | "queue" | "do";
44
- name: string;
45
- };
46
- "auth:verified": {
47
- account: string;
48
- accountId: string;
49
- scopes: string[];
50
- };
51
- "dev:phase": {
52
- phase: string;
53
- detail?: string;
54
- };
55
- "dev:rebuilt": {
56
- files: number;
57
- ms: number;
58
- };
59
- "dev:error": {
60
- message: string;
61
- };
62
- };
63
- /**
64
- * Worker-bound plugin context for Layer-3 consumer plugins. Aliases the core
65
- * {@link PluginCtx} with the global {@link WorkerEvents} pre-merged into the event
66
- * map, so a consumer plugin types its own `config`/`state`/`emit` by passing only
67
- * its OWN event map — never hand-merging `WorkerEvents`, and never importing from
68
- * `@moku-labs/core` (a Layer-1 boundary the spec validator flags for consumers).
69
- *
70
- * A plugin that resolves sibling plugins also needs a `require` field; intersect the
71
- * public `Server.RequireFn` for it, exactly as this framework's own plugins do. When
72
- * you need the unaliased shape (e.g. a different global event map), use the raw
73
- * re-exported {@link PluginCtx} instead.
74
- *
75
- * @template Config - This plugin's own flat configuration object.
76
- * @template State - This plugin's mutable state (use `Record<string, never>` when stateless).
77
- * @template Events - This plugin's own event map, merged on top of {@link WorkerEvents}; defaults to none.
78
- * @example
79
- * ```typescript
80
- * import type { Server, WorkerPluginCtx } from "@moku-labs/worker";
81
- * type MyEvents = { "my:done": { id: string } };
82
- * export type MyCtx = WorkerPluginCtx<MyConfig, Record<string, never>, MyEvents> & {
83
- * require: Server.RequireFn;
84
- * };
85
- * ```
86
- */
87
- type WorkerPluginCtx<Config, State, Events extends Record<string, unknown> = Record<never, never>> = PluginCtx<Config, State, WorkerEvents & Events>;
88
- //#endregion
89
- //#region src/plugins/deploy/types.d.ts
90
- /**
91
- * A web-site build hook wired in from the consumer's deploy/dev script — e.g.
92
- * `() => webApp.cli.build()`. This is the seam that lets one small app-side script compose a
93
- * Moku Web app with this Worker framework: `dev` / `deploy` invoke it to (re)build the site before
94
- * serving or deploying. The hook may resolve ANYTHING — `void`, the web app's own build summary, or
95
- * a `{ files }` count; when the resolved value carries a numeric `files` field it is surfaced in
96
- * `dev:rebuilt`, otherwise the count is reported as 0. Returning `Promise<unknown>` keeps the hook
97
- * assignable from any real build function (whose return type the worker framework cannot know).
98
- *
99
- * @returns Resolves when the web build completes (the value is read opportunistically for `files`).
100
- * @example
101
- * ```ts
102
- * await server.cli.dev({ webBuild: () => web.cli.build() });
103
- * ```
104
- */
105
- type WebBuild = () => Promise<unknown>;
106
- /**
107
- * A per-change INCREMENTAL rebuild hook wired in from the consumer's dev script — e.g.
108
- * `(changes) => webApp.cli.update(changes)`. The fast counterpart to {@link WebBuild}: `dev`
109
- * calls {@link WebBuild} ONCE for the cold build, then (when this hook is wired) calls `onChange`
110
- * with the set of paths changed in the debounce window so the web build can rebuild only what
111
- * changed instead of doing a full `webBuild()` every keystroke. Omit it and `dev` keeps doing a
112
- * full `webBuild()` per change (the prior behavior). Like {@link WebBuild} it may resolve ANYTHING
113
- * (the web build's own summary); the value is read opportunistically for a `files` count.
114
- *
115
- * @param changes - The paths changed since the last rebuild (the watcher's debounced set).
116
- * @returns Resolves when the incremental rebuild completes.
117
- * @example
118
- * ```ts
119
- * await server.cli.dev({ webBuild: () => web.cli.build(), onChange: changes => web.cli.update(changes) });
120
- * ```
121
- */
122
- type OnChange = (changes: readonly string[]) => Promise<unknown>;
123
- /**
124
- * The remote seed wired into `deploy({ seed: true })`: which SQL file to load into the REMOTE D1
125
- * AFTER a successful deploy (+ migration), and which cached KV keys to clear afterwards so the app
126
- * rebuilds them from the freshly-seeded rows. Declarative — the deploy plugin runs no app code, so
127
- * the app-specific seed lives in `pluginConfigs.deploy.seed` (config) rather than a deploy hook.
128
- *
129
- * @example
130
- * ```ts
131
- * deploy: { seed: { file: "db/seed.sql", resetKv: [{ binding: "BOARDS_KV", key: "boards:index" }] } }
132
- * ```
133
- */
134
- type SeedConfig = {
135
- /** SQL file executed against the remote D1 (e.g. "db/seed.sql"). */file: string; /** The d1 binding to target when more than one database is configured (e.g. "DB"); the sole one otherwise. */
136
- binding?: string; /** Cached KV keys to delete after seeding so reads rebuild from the freshly-seeded DB. */
137
- resetKv?: {
138
- binding: string;
139
- key: string;
140
- }[];
141
- };
142
- /** deploy plugin configuration. Flat; complete defaults so omission never yields undefined. */
143
- type Config$1 = {
144
- /**
145
- * Wrangler config file generated/updated and read by `wrangler deploy`. Default "wrangler.jsonc".
146
- * Also the file parsed in the universal/non-moku path.
147
- */
148
- configFile: string;
149
- /**
150
- * The Worker entry module → wrangler `main` (e.g. "src/cloudflare/worker.ts"). Required for any
151
- * real Worker deploy (its absence is wrangler's "Missing entry-point" error).
152
- */
153
- entry?: string;
154
- /**
155
- * Enable Node.js compat → `compatibility_flags: ["nodejs_compat"]`. Needed when the Worker bundle
156
- * pulls in Node-flavored code (e.g. composing the deploy/cli tooling into the runtime app).
157
- */
158
- nodeCompat?: boolean;
159
- /**
160
- * Static assets served via `env.<binding>` → the wrangler `assets` block. `spa: true` sets
161
- * `not_found_handling: "single-page-application"` so client-routed deep links resolve to index.html.
162
- */
163
- assets?: {
164
- binding: string;
165
- directory: string;
166
- spa?: boolean;
167
- };
168
- /**
169
- * Escape hatch — extra top-level wrangler keys merged into the generated config for anything the
170
- * typed fields above don't cover (`vars`, `routes`, `observability`, `triggers`, …). The
171
- * deploy-managed resource keys (name, compatibility_date, kv_namespaces, r2_buckets, d1_databases,
172
- * queues, durable_objects, and the auto-derived Durable Object `migrations`) always win over these.
173
- */
174
- wrangler?: Record<string, unknown>;
175
- /**
176
- * Standing CI/automated default for `run()`. When true (or when stdout is non-TTY) the deploy
177
- * never prompts and auto-confirms every gate; `run({ ci })` overrides it per call. CF credentials
178
- * are read from the env (CLOUDFLARE_API_TOKEN / CLOUDFLARE_ACCOUNT_ID) via `ctx.env`. Default false.
179
- */
180
- ci: boolean; /** Globs watched by `dev()` to trigger a Moku-site rebuild. */
181
- watch: string[];
182
- /**
183
- * Standing default web-site build hook (e.g. `() => webApp.cli.build()`). Usually passed
184
- * call-time to `dev` / `deploy` via `opts.webBuild` (the script-driven path); set here only for
185
- * a persistent default. When absent, dev() falls back to `buildCommand`, then auto-detects
186
- * `scripts/build.ts`.
187
- */
188
- webBuild?: WebBuild; /** Shell rebuild fallback (e.g. "bun run scripts/build.ts"); empty → auto-detect scripts/build.ts. */
189
- buildCommand: string; /** Apply local D1 migrations before serving when a d1 manifest is present. */
190
- migrateLocal: boolean; /** Debounce window (ms) coalescing rapid file changes into one rebuild. */
191
- debounceMs: number;
192
- /**
193
- * The remote seed `deploy({ seed: true })` loads AFTER a successful deploy (+ migration): the SQL
194
- * file and the cached KV keys to reset. Omit it and `deploy({ seed: true })` reports a clear
195
- * "no seed configured" error instead of silently doing nothing.
196
- */
197
- seed?: SeedConfig;
198
- };
199
- /**
200
- * Discriminated union of per-INSTANCE resource descriptors. Each resource plugin's `deployManifest()`
201
- * returns an ARRAY of these (one per configured instance). `name` is the base Cloudflare resource
202
- * name (stage-suffixed downstream via {@link stageName}); `binding` is the stable env var. Durable
203
- * Objects carry no provisioned `name` — they ship with the Worker script — and declare the exported
204
- * `className` instead.
205
- */
206
- type ResourceManifest = {
207
- kind: "r2";
208
- name: string;
209
- binding: string;
210
- upload?: string;
211
- } | {
212
- kind: "kv";
213
- name: string;
214
- binding: string;
215
- } | {
216
- kind: "d1";
217
- name: string;
218
- binding: string;
219
- migrations?: string;
220
- } | {
221
- kind: "queue";
222
- name: string;
223
- binding: string;
224
- consumer?: boolean;
225
- maxBatchTimeout?: number;
226
- } | {
227
- kind: "do";
228
- binding: string;
229
- className: string;
230
- };
231
- /**
232
- * The whole deploy manifest the pipeline consumes (assembled, or caller-supplied for the
233
- * universal path).
234
- */
235
- type ExternalManifest = {
236
- /** Worker name. */name: string; /** Cloudflare compatibility date. */
237
- compatibilityDate: string; /** Resource descriptors to provision. */
238
- resources: ResourceManifest[];
239
- };
240
- /**
241
- * A resource that already exists in the account (the infra preflight discovered it), with its
242
- * captured Cloudflare id when the kind has one (kv namespace id, d1 database id).
243
- */
244
- type ProvisionedRef = {
245
- /** The resource descriptor from the manifest. */resource: ResourceManifest; /** The existing resource's Cloudflare id (kv/d1 only). */
246
- id?: string;
247
- };
248
- /**
249
- * Read-only infra preflight result: which declared resources already exist in the Cloudflare
250
- * account, which are still missing and must be created, and which ship with the Worker. Produced by
251
- * `checkInfra()`. Durable Objects are neither "exists" nor "missing" — the planner never queries the
252
- * account for them and never API-provisions them; they are created by `wrangler deploy` (the
253
- * auto-derived DO migration), so they get their own `ships` bucket instead of masquerading as
254
- * already-existing.
255
- */
256
- type InfraPlan = {
257
- /** Resolved account display name (or id when the name is unknown). */account: string; /** Resolved Cloudflare account id used for the existence checks. */
258
- accountId: string; /** Declared resources the account listing confirmed already exist (with captured ids where applicable). */
259
- exists: ProvisionedRef[]; /** Declared resources that do not yet exist and must be created. */
260
- missing: ResourceManifest[]; /** Durable Objects that ship with the Worker — created by `wrangler deploy`, never API-provisioned. */
261
- ships: ResourceManifest[];
262
- };
263
- /**
264
- * A resource that failed to provision, with the (branded) error message captured so the guided flow
265
- * can show WHICH resource failed and why — instead of aborting the whole run on the first failure.
266
- */
267
- type ProvisionFailure = {
268
- /** The resource descriptor that failed to create. */resource: ResourceManifest; /** The captured error message (e.g. the branded wrangler failure). */
269
- error: string;
270
- };
271
- /**
272
- * Outcome of acting on an {@link InfraPlan}: the resources just created, those skipped because they
273
- * already existed, those that ship with the Worker (Durable Objects — not created here), those that
274
- * FAILED to create, and the merged id map (binding → Cloudflare id) for the config writer.
275
- * Provisioning is resilient — a single resource failure is captured here, not thrown, so the guided
276
- * flow can report a clear per-resource result.
277
- */
278
- type ProvisionResult = {
279
- /** Resources created during this run. */created: ProvisionedRef[]; /** Resources skipped because they already existed. */
280
- skipped: ProvisionedRef[]; /** Durable Objects that ship with the Worker — not created at the provision step (`wrangler deploy` does). */
281
- bundled: ResourceManifest[]; /** Resources that failed to create (captured, not thrown). */
282
- failed: ProvisionFailure[]; /** Merged binding → Cloudflare id map (existing + created) for writeWranglerConfig. */
283
- ids: Record<string, string>;
284
- };
285
- /**
286
- * Structured outcome of a deploy run (the value `run()` / `cli.deploy()` now resolve to, replacing
287
- * the old `void`) so a script can branch on the result instead of guessing from a thrown error. It
288
- * is also WHY the post-deploy migration + seed live inside `run()`: the report's `status` is the
289
- * single source of truth for whether the worker actually went live, so those remote-DB steps run
290
- * only on a successful deploy and never on an aborted one.
291
- *
292
- * `ok` is true only when the worker is live AND every requested post-step (migration, seed) also
293
- * succeeded. `status` is the coarse outcome: `"deployed"` (live, all post-steps ok), `"aborted"`
294
- * (a gate was declined or auth was never set up — nothing shipped), `"failed"` (a step errored).
295
- */
296
- type DeployReport = {
297
- /** True only when the worker is live and every requested post-step (migration, seed) succeeded. */ok: boolean; /** Coarse outcome: "deployed" (live + post-steps ok), "aborted" (a gate declined / auth not set up), "failed" (a step errored). */
298
- status: "deployed" | "aborted" | "failed"; /** The resolved deploy stage (resource-name suffix; "production" is bare). */
299
- stage: string; /** The live worker URL once `wrangler deploy` succeeded — set even if a later migration/seed failed. */
300
- url?: string; /** Provisioning tally: resources created, already-existing, shipped-with-the-Worker (DOs), and failed to create. */
301
- resources?: {
302
- created: number;
303
- exists: number;
304
- bundled: number;
305
- failed: number;
306
- }; /** Remote D1 migration outcome — "skipped" (not requested), "applied", or "failed". */
307
- migration: "skipped" | "applied" | "failed"; /** Remote seed outcome — "skipped" (not requested), "applied", or "failed". */
308
- seed: "skipped" | "applied" | "failed"; /** Wall-clock duration of the whole run (ms). */
309
- elapsedMs: number; /** Branded failure message(s) — empty when `ok`; one per failed step otherwise. */
310
- errors: string[];
311
- };
312
- /** Result of verifying the `.env` Cloudflare API token and resolving its account. */
313
- type AuthStatus = {
314
- /** Whether the token is present and active. */ok: boolean; /** Resolved account display name (or id when the name is unknown). */
315
- account: string; /** Resolved Cloudflare account id. */
316
- accountId: string; /** Token scopes, when discoverable (empty otherwise). */
317
- scopes: string[];
318
- };
319
- /** One Cloudflare API-token permission group the app's manifest requires. */
320
- type PermissionGroup = {
321
- /** Human-readable group label, e.g. "Account · D1". */group: string; /** Permission scope. */
322
- scope: "Edit" | "Read"; /** Why it is required, e.g. "d1", "queue", "deploy", "account". */
323
- reason: string; /** Whether Cloudflare's stock "Edit Cloudflare Workers" template already includes it. */
324
- inBaseTemplate: boolean;
325
- };
326
- /** The Cloudflare API token this app requires, derived from its manifest. */
327
- type TokenRequirement = {
328
- /** The recommended starting template. */base: "Edit Cloudflare Workers"; /** The full set of permission groups required. */
329
- required: PermissionGroup[]; /** Groups NOT in the base template that the user must add (e.g. D1, Queues). */
330
- toAdd: PermissionGroup[];
331
- };
332
- //#endregion
333
- //#region src/plugins/cli/types.d.ts
334
- /**
335
- * Resolved configuration for the cli plugin. The cli surface is configuration-free: the dev port is
336
- * NOT set here (it comes only from `dev({ port })`), so there are no keys to set under
337
- * `pluginConfigs.cli`.
338
- */
339
- type Config = Record<string, never>;
340
- /** Public api surface of the cli plugin, mounted at app.cli.*. */
341
- type Api = {
342
- /**
343
- * Run the Worker locally via Wrangler (delegates to deploy.dev). The dev port comes only from
344
- * `opts.port` — the consumer passes it (e.g. parsed from its own CLI flags); it defaults to 8787
345
- * when omitted. A failure renders a branded `✗` line and sets a non-zero exit code rather than
346
- * throwing a raw stack trace.
347
- *
348
- * @param opts - Optional port, stage, cold-build hook, and incremental change hook.
349
- * @param opts.port - Local dev port to bind. Defaults to 8787 when omitted.
350
- * @param opts.stage - Stage for the generated wrangler config's resource names. Falls back to the
351
- * `--stage` CLI flag, then the app's configured stage. Pass it explicitly from a script for a
352
- * self-documenting `dev({ stage })` instead of relying on the hidden flag.
353
- * @param opts.webBuild - Cold-build the web site (e.g. `() => webApp.cli.build()`); also the
354
- * per-change rebuild when `onChange` is omitted.
355
- * @param opts.onChange - Incremental per-change rebuild (e.g. `changes => webApp.cli.update(changes)`),
356
- * so each change rebuilds only the changed paths instead of a full `webBuild()` every keystroke.
357
- * @param opts.seed - Load the configured seed (`pluginConfigs.deploy.seed`) into the LOCAL D1 and
358
- * reset its cached KV keys before serving — the local analogue of `deploy({ seed: true })`.
359
- * @returns Resolves when the dev session ends.
360
- * @example
361
- * ```ts
362
- * await app.cli.dev({ stage: "dev", port: 7878, seed: true, webBuild: () => web.cli.build(), onChange: c => web.cli.update(c) });
363
- * ```
364
- */
365
- dev(opts?: {
366
- port?: number;
367
- stage?: string;
368
- webBuild?: WebBuild;
369
- onChange?: OnChange;
370
- seed?: boolean;
371
- }): Promise<void>;
372
- /**
373
- * One-command Cloudflare deploy (delegates to deploy.run), then — only on a successful deploy —
374
- * the requested post-deploy remote steps (migration, seed). Guided/interactive by default; pass
375
- * `{ ci: true }` for the automated/non-interactive path (CI). Unlike the other verbs this RETURNS
376
- * the structured {@link DeployReport} (so a script can branch on the outcome) AND, on a failure,
377
- * renders a branded `✗` line + sets a non-zero exit code rather than throwing a raw stack trace.
378
- *
379
- * @param opts - Optional ci flag, stage, a web build hook, and the post-deploy migration/seed flags.
380
- * @param opts.ci - Automated mode: never prompts, auto-confirms. Omit/false → guided on a TTY.
381
- * @param opts.stage - Stage for the generated wrangler config's resource names (e.g. "production",
382
- * "staging"). Falls back to the `--stage` CLI flag, then the app's configured stage. Pass it
383
- * explicitly from a script for a self-documenting `deploy({ stage })` instead of the hidden flag.
384
- * @param opts.webBuild - Build the web site first (e.g. `() => webApp.cli.build()`), before deploy.
385
- * @param opts.migration - Apply pending remote D1 migrations after a successful deploy (skipped on abort).
386
- * @param opts.seed - Load the configured remote seed (`pluginConfigs.deploy.seed`) after a
387
- * successful deploy (+ migration); skipped on an aborted deploy.
388
- * @returns The deploy report (status, url, resource tally, migration/seed outcome, errors).
389
- * @example
390
- * ```ts
391
- * const report = await app.cli.deploy({ webBuild: () => web.cli.build(), migration: true, seed: true });
392
- * if (report.status === "aborted") return; // creds not set up yet — nothing shipped
393
- * ```
394
- */
395
- deploy(opts?: {
396
- ci?: boolean;
397
- stage?: string;
398
- webBuild?: WebBuild;
399
- migration?: boolean;
400
- seed?: boolean;
401
- }): Promise<DeployReport>;
402
- /**
403
- * Seed a configured D1 database from a SQL file (delegates to deploy.seed). Local by default
404
- * (applies the database's migrations first so its tables exist, then executes the file);
405
- * `opts.remote` seeds Cloudflare. A failure renders a branded `✗` line and sets a non-zero exit
406
- * code rather than throwing.
407
- *
408
- * @param sqlFile - Path to the SQL file to execute (e.g. "db/seed.sql").
409
- * @param opts - Optional options.
410
- * @param opts.binding - The d1 binding to target when more than one is configured (e.g. "DB").
411
- * @param opts.remote - Seed the remote (Cloudflare) D1 instead of the local one.
412
- * @returns Resolves once the seed completes (or after a failure is rendered).
413
- * @example
414
- * ```ts
415
- * await app.cli.seed("db/seed.sql"); // local; --stage honored
416
- * ```
417
- */
418
- seed(sqlFile: string, opts?: {
419
- binding?: string;
420
- remote?: boolean;
421
- }): Promise<void>;
422
- /**
423
- * Verify the `.env` Cloudflare token (no sub), or print the config-derived token-creation
424
- * guidance (`"setup"`). Delegates to deploy.verifyAuth() / deploy.tokenInstructions().
425
- *
426
- * @param sub - Pass "setup" to print token guidance; omit to verify the current token.
427
- * @returns Resolves once the auth check or guidance render completes.
428
- * @example
429
- * ```ts
430
- * await app.cli.auth(); // verify the current token
431
- * await app.cli.auth("setup"); // print what token to create
432
- * ```
433
- */
434
- auth(sub?: "setup"): Promise<void>;
435
- /**
436
- * One-shot preflight report: token + account (verifyAuth) and infra drift (checkInfra),
437
- * each rendered as a branded check line.
438
- *
439
- * @returns Resolves once the report is printed.
440
- * @example
441
- * ```ts
442
- * await app.cli.doctor();
443
- * ```
444
- */
445
- doctor(): Promise<void>;
446
- /**
447
- * Print the resolved Cloudflare account for the current `.env` token (delegates to verifyAuth).
448
- *
449
- * @returns Resolves once the account summary is printed.
450
- * @example
451
- * ```ts
452
- * await app.cli.whoami();
453
- * ```
454
- */
455
- whoami(): Promise<void>;
456
- /**
457
- * Run an arbitrary `wrangler` command through the branded CLI — the escape hatch for subcommands
458
- * Moku does not wrap (kv / d1 / r2 / queues / secret / tail / …). Streams wrangler's output.
459
- *
460
- * @param args - The wrangler arguments (e.g. ["kv", "namespace", "list"]).
461
- * @returns Resolves once wrangler exits.
462
- * @example
463
- * ```ts
464
- * await app.cli.wrangler(["kv", "namespace", "list"]);
465
- * ```
466
- */
467
- wrangler(args: string[]): Promise<void>;
468
- };
469
- //#endregion
470
- //#region src/plugins/cli/index.d.ts
471
- /**
472
- * Standard tier (node-only) — developer-facing CLI surface.
473
- *
474
- * Mounts `app.cli.dev()` and `app.cli.deploy()` as thin passthroughs to deployPlugin.
475
- * Hooks subscribe to the global deploy:phase / provision:resource / deploy:complete events
476
- * and print a live progress TUI via the injected ctx.log core API.
477
- *
478
- * Inline lambdas on `api`/`hooks` preserve event-name inference so the hook map keys
479
- * are constrained to `WorkerEvents` keys (spec/15 §5).
480
- *
481
- * @see README.md
482
- */
483
- declare const cliPlugin: import("@moku-labs/core").PluginInstance<"cli", Config, Record<string, never>, Api, {}> & Record<never, never>;
484
- //#endregion
485
- //#region src/plugins/deploy/index.d.ts
486
- /**
487
- * Complex tier (node-only) — build-time deploy orchestrator over the five resource plugins.
488
- *
489
- * Assembles each resource plugin's deployManifest() via ctx.require, provisions resources,
490
- * generates/updates wrangler config, uploads the R2 upload dir, and runs wrangler deploy.
491
- * Also supports a universal path: run({ manifest }) uses a caller-supplied manifest verbatim.
492
- *
493
- * Emits only the global events `deploy:phase`, `deploy:complete`, and `provision:resource`
494
- * (declared in WorkerEvents — no per-plugin events block).
495
- *
496
- * @see README.md
497
- */
498
- declare const deployPlugin: import("@moku-labs/core").PluginInstance<"deploy", Config$1, Record<string, never>, {
499
- run(opts?: {
500
- ci?: boolean;
501
- stage?: string;
502
- webBuild?: WebBuild;
503
- manifest?: ExternalManifest;
504
- migration?: boolean;
505
- seed?: boolean;
506
- }): Promise<DeployReport>;
507
- dev(opts?: {
508
- port?: number;
509
- stage?: string;
510
- webBuild?: WebBuild;
511
- onChange?: OnChange;
512
- seed?: boolean;
513
- }): Promise<void>;
514
- seed(sqlFile: string, opts?: {
515
- stage?: string;
516
- binding?: string;
517
- remote?: boolean;
518
- }): Promise<void>;
519
- init: (opts?: {
520
- ci?: boolean;
521
- }) => Promise<void>;
522
- checkInfra: () => Promise<InfraPlan>;
523
- provisionInfra: (plan: InfraPlan) => Promise<ProvisionResult>;
524
- verifyAuth: () => Promise<AuthStatus>;
525
- requiredToken: () => TokenRequirement;
526
- ciToken: () => PermissionGroup[];
527
- tokenInstructions: () => string;
528
- wrangler: (args: string[]) => Promise<void>;
529
- }, {}> & Record<never, never>;
530
- //#endregion
531
- export { ResourceManifest as a, WorkerEnv as c, ExternalManifest as i, WorkerEvents as l, cliPlugin as n, SeedConfig as o, DeployReport as r, WorkerConfig as s, deployPlugin as t, WorkerPluginCtx as u };