@moku-labs/worker 0.1.2 → 0.1.3

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/dist/cli.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_storage = require("./storage-BaQ6BBtl.cjs");
2
+ const require_storage = require("./storage-Sy--rX1T.cjs");
3
3
  let node_child_process = require("node:child_process");
4
4
  let node_fs_promises = require("node:fs/promises");
5
5
  let node_path = require("node:path");
package/dist/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { i as durableObjectsPlugin, n as queuesPlugin, o as d1Plugin, r as kvPlugin, t as storagePlugin, u as createPlugin } from "./storage-bL-U_fkA.mjs";
1
+ import { i as durableObjectsPlugin, n as queuesPlugin, o as d1Plugin, r as kvPlugin, t as storagePlugin, u as createPlugin } from "./storage-DCOQ4EAg.mjs";
2
2
  import { spawn } from "node:child_process";
3
3
  import { readdir, stat, writeFile } from "node:fs/promises";
4
4
  import path from "node:path";
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_storage = require("./storage-BaQ6BBtl.cjs");
2
+ const require_storage = require("./storage-Sy--rX1T.cjs");
3
3
  let _moku_labs_common = require("@moku-labs/common");
4
4
  //#region src/plugins/server/api.ts
5
5
  /**
@@ -472,52 +472,61 @@ const serverPlugin = require_storage.createPlugin("server", {
472
472
  helpers: { endpoint }
473
473
  });
474
474
  //#endregion
475
- //#region src/plugins/d1/types.ts
475
+ //#region src/plugins/bindings/types.ts
476
476
  var types_exports = /* @__PURE__ */ require_storage.__exportAll({});
477
477
  //#endregion
478
- //#region src/plugins/durable-objects/types.ts
478
+ //#region src/plugins/d1/types.ts
479
479
  var types_exports$1 = /* @__PURE__ */ require_storage.__exportAll({});
480
480
  //#endregion
481
- //#region src/plugins/queues/types.ts
481
+ //#region src/plugins/durable-objects/types.ts
482
482
  var types_exports$2 = /* @__PURE__ */ require_storage.__exportAll({});
483
483
  //#endregion
484
- //#region src/plugins/server/types.ts
484
+ //#region src/plugins/queues/types.ts
485
485
  var types_exports$3 = /* @__PURE__ */ require_storage.__exportAll({});
486
486
  //#endregion
487
- //#region src/plugins/storage/types.ts
487
+ //#region src/plugins/server/types.ts
488
488
  var types_exports$4 = /* @__PURE__ */ require_storage.__exportAll({});
489
+ //#endregion
490
+ //#region src/plugins/storage/types.ts
491
+ var types_exports$5 = /* @__PURE__ */ require_storage.__exportAll({});
489
492
  const { createApp, createPlugin } = require_storage.createCore(require_storage.coreConfig, { plugins: [require_storage.bindingsPlugin, serverPlugin] });
490
493
  //#endregion
491
- Object.defineProperty(exports, "D1", {
494
+ Object.defineProperty(exports, "Bindings", {
492
495
  enumerable: true,
493
496
  get: function() {
494
497
  return types_exports;
495
498
  }
496
499
  });
497
- Object.defineProperty(exports, "DurableObjects", {
500
+ Object.defineProperty(exports, "D1", {
498
501
  enumerable: true,
499
502
  get: function() {
500
503
  return types_exports$1;
501
504
  }
502
505
  });
503
- Object.defineProperty(exports, "Queues", {
506
+ Object.defineProperty(exports, "DurableObjects", {
504
507
  enumerable: true,
505
508
  get: function() {
506
509
  return types_exports$2;
507
510
  }
508
511
  });
509
- Object.defineProperty(exports, "Server", {
512
+ Object.defineProperty(exports, "Queues", {
510
513
  enumerable: true,
511
514
  get: function() {
512
515
  return types_exports$3;
513
516
  }
514
517
  });
515
- Object.defineProperty(exports, "Storage", {
518
+ Object.defineProperty(exports, "Server", {
516
519
  enumerable: true,
517
520
  get: function() {
518
521
  return types_exports$4;
519
522
  }
520
523
  });
524
+ Object.defineProperty(exports, "Storage", {
525
+ enumerable: true,
526
+ get: function() {
527
+ return types_exports$5;
528
+ }
529
+ });
521
530
  exports.bindingsPlugin = require_storage.bindingsPlugin;
522
531
  exports.createApp = createApp;
523
532
  exports.createPlugin = createPlugin;
package/dist/index.d.cts CHANGED
@@ -3,8 +3,9 @@ import { PluginCtx, PluginInstance } from "@moku-labs/core";
3
3
  import { envPlugin, logPlugin } from "@moku-labs/common";
4
4
 
5
5
  //#region \0rolldown/runtime.js
6
- //#endregion
7
- //#region src/plugins/bindings/index.d.ts
6
+ declare namespace types_d_exports {
7
+ export { BindingsApi, Config$4 as Config, Context };
8
+ }
8
9
  /**
9
10
  * bindings config. Flat (spec/05 §3,§6) — a complete default so omission
10
11
  * never yields undefined.
@@ -46,7 +47,14 @@ type BindingsApi = {
46
47
  has(env: WorkerEnv, name: string): boolean;
47
48
  };
48
49
  /**
49
- * Micro-tier stateless resolverthe binding-family dependency root.
50
+ * api-factory context. State slot is Record<string, never> bindings holds NO
51
+ * state (F4). Type-argument order is PluginCtx<Config, State, Events>.
52
+ */
53
+ type Context = PluginCtx<Config$4, Record<string, never>, WorkerEvents>;
54
+ //#endregion
55
+ //#region src/plugins/bindings/index.d.ts
56
+ /**
57
+ * Standard-tier stateless resolver — the binding-family dependency root.
50
58
  *
51
59
  * Exposes `require<T>(env, name)` and `has(env, name)` off a per-request env
52
60
  * object. Regular plugin so downstream binding plugins can declare
@@ -55,7 +63,7 @@ type BindingsApi = {
55
63
  * @see README.md
56
64
  */
57
65
  declare const bindingsPlugin: import("@moku-labs/core").PluginInstance<"bindings", Config$4, Record<string, never>, BindingsApi, {}> & Record<never, never>;
58
- declare namespace types_d_exports$3 {
66
+ declare namespace types_d_exports$4 {
59
67
  export { Api$3 as Api, CompiledEndpoint, Endpoint, EndpointHandler, MatchResult, Method, PathSegment, RequestContext, RequireFn, ServerConfig, ServerCtx, ServerEvents, ServerState };
60
68
  }
61
69
  /** HTTP method an endpoint matches; "ALL" matches any verb. */
@@ -279,7 +287,7 @@ type EndpointBuilder = {
279
287
  * ```
280
288
  */
281
289
  declare const endpoint: (path: string) => EndpointBuilder;
282
- declare namespace types_d_exports {
290
+ declare namespace types_d_exports$1 {
283
291
  export { Api$2 as Api, Config$3 as Config, D1Ctx, DeployManifest$2 as DeployManifest };
284
292
  }
285
293
  /**
@@ -390,7 +398,7 @@ declare const d1Plugin: import("@moku-labs/core").PluginInstance<"d1", Config$3,
390
398
  prepare: (env: WorkerEnv) => D1Database;
391
399
  deployManifest: () => DeployManifest$2;
392
400
  }, {}> & Record<never, never>;
393
- declare namespace types_d_exports$1 {
401
+ declare namespace types_d_exports$2 {
394
402
  export { Api$1 as Api, Config$2 as Config, Ctx$1 as Ctx, DeployManifest$1 as DeployManifest };
395
403
  }
396
404
  /**
@@ -594,7 +602,7 @@ type KvApi = {
594
602
  declare const kvPlugin: import("@moku-labs/core").PluginInstance<"kv", {
595
603
  binding: string;
596
604
  }, Record<string, never>, KvApi, {}> & Record<never, never>;
597
- declare namespace types_d_exports$2 {
605
+ declare namespace types_d_exports$3 {
598
606
  export { Api, Config$1 as Config, Ctx, DeployManifest, QueueEvents };
599
607
  }
600
608
  /**
@@ -741,7 +749,7 @@ type StorageProvider = {
741
749
  delete(key: string | string[]): Promise<void>; /** List objects. */
742
750
  list(opts?: R2ListOptions): Promise<R2Objects>;
743
751
  };
744
- declare namespace types_d_exports$4 {
752
+ declare namespace types_d_exports$5 {
745
753
  export { StorageApi, StorageConfig, StorageCtx, StorageManifest, StorageProvider };
746
754
  }
747
755
  /**
@@ -960,4 +968,4 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
960
968
  current: () => "production" | "development" | "test";
961
969
  }>]>>;
962
970
  //#endregion
963
- export { types_d_exports as D1, types_d_exports$1 as DurableObjects, types_d_exports$2 as Queues, types_d_exports$3 as Server, type StageApi, types_d_exports$4 as Storage, type WorkerConfig, type WorkerEnv, type WorkerEvents, bindingsPlugin, createApp, createPlugin, d1Plugin, defineDurableObject, durableObjectsPlugin, endpoint, envPlugin, kvPlugin, logPlugin, queuesPlugin, serverPlugin, stagePlugin, storagePlugin };
971
+ export { types_d_exports as Bindings, types_d_exports$1 as D1, types_d_exports$2 as DurableObjects, types_d_exports$3 as Queues, types_d_exports$4 as Server, type StageApi, types_d_exports$5 as Storage, type WorkerConfig, type WorkerEnv, type WorkerEvents, bindingsPlugin, createApp, createPlugin, d1Plugin, defineDurableObject, durableObjectsPlugin, endpoint, envPlugin, kvPlugin, logPlugin, queuesPlugin, serverPlugin, stagePlugin, storagePlugin };
package/dist/index.d.mts CHANGED
@@ -2,7 +2,10 @@ import { n as WorkerEnv, r as WorkerEvents, t as WorkerConfig } from "./config-A
2
2
  import { envPlugin, logPlugin } from "@moku-labs/common";
3
3
  import { PluginCtx, PluginInstance } from "@moku-labs/core";
4
4
 
5
- //#region src/plugins/bindings/index.d.ts
5
+ //#region src/plugins/bindings/types.d.ts
6
+ declare namespace types_d_exports {
7
+ export { BindingsApi, Config$4 as Config, Context };
8
+ }
6
9
  /**
7
10
  * bindings config. Flat (spec/05 §3,§6) — a complete default so omission
8
11
  * never yields undefined.
@@ -44,7 +47,14 @@ type BindingsApi = {
44
47
  has(env: WorkerEnv, name: string): boolean;
45
48
  };
46
49
  /**
47
- * Micro-tier stateless resolverthe binding-family dependency root.
50
+ * api-factory context. State slot is Record<string, never> bindings holds NO
51
+ * state (F4). Type-argument order is PluginCtx<Config, State, Events>.
52
+ */
53
+ type Context = PluginCtx<Config$4, Record<string, never>, WorkerEvents>;
54
+ //#endregion
55
+ //#region src/plugins/bindings/index.d.ts
56
+ /**
57
+ * Standard-tier stateless resolver — the binding-family dependency root.
48
58
  *
49
59
  * Exposes `require<T>(env, name)` and `has(env, name)` off a per-request env
50
60
  * object. Regular plugin so downstream binding plugins can declare
@@ -53,7 +63,7 @@ type BindingsApi = {
53
63
  * @see README.md
54
64
  */
55
65
  declare const bindingsPlugin: import("@moku-labs/core").PluginInstance<"bindings", Config$4, Record<string, never>, BindingsApi, {}> & Record<never, never>;
56
- declare namespace types_d_exports$3 {
66
+ declare namespace types_d_exports$4 {
57
67
  export { Api$3 as Api, CompiledEndpoint, Endpoint, EndpointHandler, MatchResult, Method, PathSegment, RequestContext, RequireFn, ServerConfig, ServerCtx, ServerEvents, ServerState };
58
68
  }
59
69
  /** HTTP method an endpoint matches; "ALL" matches any verb. */
@@ -277,7 +287,7 @@ type EndpointBuilder = {
277
287
  * ```
278
288
  */
279
289
  declare const endpoint: (path: string) => EndpointBuilder;
280
- declare namespace types_d_exports {
290
+ declare namespace types_d_exports$1 {
281
291
  export { Api$2 as Api, Config$3 as Config, D1Ctx, DeployManifest$2 as DeployManifest };
282
292
  }
283
293
  /**
@@ -388,7 +398,7 @@ declare const d1Plugin: import("@moku-labs/core").PluginInstance<"d1", Config$3,
388
398
  prepare: (env: WorkerEnv) => D1Database;
389
399
  deployManifest: () => DeployManifest$2;
390
400
  }, {}> & Record<never, never>;
391
- declare namespace types_d_exports$1 {
401
+ declare namespace types_d_exports$2 {
392
402
  export { Api$1 as Api, Config$2 as Config, Ctx$1 as Ctx, DeployManifest$1 as DeployManifest };
393
403
  }
394
404
  /**
@@ -592,7 +602,7 @@ type KvApi = {
592
602
  declare const kvPlugin: import("@moku-labs/core").PluginInstance<"kv", {
593
603
  binding: string;
594
604
  }, Record<string, never>, KvApi, {}> & Record<never, never>;
595
- declare namespace types_d_exports$2 {
605
+ declare namespace types_d_exports$3 {
596
606
  export { Api, Config$1 as Config, Ctx, DeployManifest, QueueEvents };
597
607
  }
598
608
  /**
@@ -739,7 +749,7 @@ type StorageProvider = {
739
749
  delete(key: string | string[]): Promise<void>; /** List objects. */
740
750
  list(opts?: R2ListOptions): Promise<R2Objects>;
741
751
  };
742
- declare namespace types_d_exports$4 {
752
+ declare namespace types_d_exports$5 {
743
753
  export { StorageApi, StorageConfig, StorageCtx, StorageManifest, StorageProvider };
744
754
  }
745
755
  /**
@@ -958,4 +968,4 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
958
968
  current: () => "production" | "development" | "test";
959
969
  }>]>>;
960
970
  //#endregion
961
- export { types_d_exports as D1, types_d_exports$1 as DurableObjects, types_d_exports$2 as Queues, types_d_exports$3 as Server, type StageApi, types_d_exports$4 as Storage, type WorkerConfig, type WorkerEnv, type WorkerEvents, bindingsPlugin, createApp, createPlugin, d1Plugin, defineDurableObject, durableObjectsPlugin, endpoint, envPlugin, kvPlugin, logPlugin, queuesPlugin, serverPlugin, stagePlugin, storagePlugin };
971
+ export { types_d_exports as Bindings, types_d_exports$1 as D1, types_d_exports$2 as DurableObjects, types_d_exports$3 as Queues, types_d_exports$4 as Server, type StageApi, types_d_exports$5 as Storage, type WorkerConfig, type WorkerEnv, type WorkerEvents, bindingsPlugin, createApp, createPlugin, d1Plugin, defineDurableObject, durableObjectsPlugin, endpoint, envPlugin, kvPlugin, logPlugin, queuesPlugin, serverPlugin, stagePlugin, storagePlugin };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { a as defineDurableObject, c as coreConfig, d as stagePlugin, i as durableObjectsPlugin, l as createCore, n as queuesPlugin, o as d1Plugin, r as kvPlugin, s as bindingsPlugin, t as storagePlugin, u as createPlugin$1 } from "./storage-bL-U_fkA.mjs";
2
+ import { a as defineDurableObject, c as coreConfig, d as stagePlugin, i as durableObjectsPlugin, l as createCore, n as queuesPlugin, o as d1Plugin, r as kvPlugin, s as bindingsPlugin, t as storagePlugin, u as createPlugin$1 } from "./storage-DCOQ4EAg.mjs";
3
3
  import { envPlugin, logPlugin } from "@moku-labs/common";
4
4
  //#region src/plugins/server/api.ts
5
5
  /**
@@ -472,20 +472,23 @@ const serverPlugin = createPlugin$1("server", {
472
472
  helpers: { endpoint }
473
473
  });
474
474
  //#endregion
475
- //#region src/plugins/d1/types.ts
475
+ //#region src/plugins/bindings/types.ts
476
476
  var types_exports = /* @__PURE__ */ __exportAll({});
477
477
  //#endregion
478
- //#region src/plugins/durable-objects/types.ts
478
+ //#region src/plugins/d1/types.ts
479
479
  var types_exports$1 = /* @__PURE__ */ __exportAll({});
480
480
  //#endregion
481
- //#region src/plugins/queues/types.ts
481
+ //#region src/plugins/durable-objects/types.ts
482
482
  var types_exports$2 = /* @__PURE__ */ __exportAll({});
483
483
  //#endregion
484
- //#region src/plugins/server/types.ts
484
+ //#region src/plugins/queues/types.ts
485
485
  var types_exports$3 = /* @__PURE__ */ __exportAll({});
486
486
  //#endregion
487
- //#region src/plugins/storage/types.ts
487
+ //#region src/plugins/server/types.ts
488
488
  var types_exports$4 = /* @__PURE__ */ __exportAll({});
489
+ //#endregion
490
+ //#region src/plugins/storage/types.ts
491
+ var types_exports$5 = /* @__PURE__ */ __exportAll({});
489
492
  const { createApp, createPlugin } = createCore(coreConfig, { plugins: [bindingsPlugin, serverPlugin] });
490
493
  //#endregion
491
- export { types_exports as D1, types_exports$1 as DurableObjects, types_exports$2 as Queues, types_exports$3 as Server, types_exports$4 as Storage, bindingsPlugin, createApp, createPlugin, d1Plugin, defineDurableObject, durableObjectsPlugin, endpoint, envPlugin, kvPlugin, logPlugin, queuesPlugin, serverPlugin, stagePlugin, storagePlugin };
494
+ export { types_exports as Bindings, types_exports$1 as D1, types_exports$2 as DurableObjects, types_exports$3 as Queues, types_exports$4 as Server, types_exports$5 as Storage, bindingsPlugin, createApp, createPlugin, d1Plugin, defineDurableObject, durableObjectsPlugin, endpoint, envPlugin, kvPlugin, logPlugin, queuesPlugin, serverPlugin, stagePlugin, storagePlugin };
@@ -77,7 +77,7 @@ const coreConfig = createCoreConfig("moku-worker", {
77
77
  });
78
78
  const { createPlugin, createCore } = coreConfig;
79
79
  //#endregion
80
- //#region src/plugins/bindings/index.ts
80
+ //#region src/plugins/bindings/api.ts
81
81
  /**
82
82
  * Checks whether a value read from an env object is nullish (null or undefined).
83
83
  * Cloudflare supplies either form when a binding is absent, so both must be caught.
@@ -140,7 +140,7 @@ const createBindingsApi = (_ctx) => ({
140
140
  has: hasBinding
141
141
  });
142
142
  /**
143
- * Micro-tier stateless resolver — the binding-family dependency root.
143
+ * Standard-tier stateless resolver — the binding-family dependency root.
144
144
  *
145
145
  * Exposes `require<T>(env, name)` and `has(env, name)` off a per-request env
146
146
  * object. Regular plugin so downstream binding plugins can declare
@@ -108,7 +108,7 @@ const coreConfig = (0, _moku_labs_core.createCoreConfig)("moku-worker", {
108
108
  });
109
109
  const { createPlugin, createCore } = coreConfig;
110
110
  //#endregion
111
- //#region src/plugins/bindings/index.ts
111
+ //#region src/plugins/bindings/api.ts
112
112
  /**
113
113
  * Checks whether a value read from an env object is nullish (null or undefined).
114
114
  * Cloudflare supplies either form when a binding is absent, so both must be caught.
@@ -171,7 +171,7 @@ const createBindingsApi = (_ctx) => ({
171
171
  has: hasBinding
172
172
  });
173
173
  /**
174
- * Micro-tier stateless resolver — the binding-family dependency root.
174
+ * Standard-tier stateless resolver — the binding-family dependency root.
175
175
  *
176
176
  * Exposes `require<T>(env, name)` and `has(env, name)` off a per-request env
177
177
  * object. Regular plugin so downstream binding plugins can declare
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moku-labs/worker",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Cloudflare Worker framework for Moku — Durable Objects, Queues, R2, D1, and KV plugins that compose with Moku Web.",
5
5
  "repository": {
6
6
  "type": "git",