@zeltjs/adapter-cloudflare-workers 0.9.1-canary.3 → 0.9.1-canary.4

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/index.cjs CHANGED
@@ -46,6 +46,7 @@ CloudflareWorkersEnvAdaptor = _ts_decorate([_zeltjs_core.Config], CloudflareWork
46
46
  //#region src/on-cloudflare-workers.ts
47
47
  const onCloudflareWorkers = async (app, options = {}) => {
48
48
  const readyApp = await app.createRuntime({
49
+ ...options.configs === void 0 ? {} : { configs: options.configs },
49
50
  fallbackConfigs: [CloudflareWorkersEnvAdaptor],
50
51
  warmup: options.warmup ?? false
51
52
  });
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { ConfiguredFeature, CreateRuntimeOptions, EnvAdaptor, HttpCapabilities, RuntimeApp } from "@zeltjs/core";
1
+ import { ConfigClass, ConfiguredFeature, CreateRuntimeOptions, EnvAdaptor, HttpCapabilities, RuntimeApp } from "@zeltjs/core";
2
2
 
3
3
  //#region src/cloudflare-bindings.service.d.ts
4
4
  declare class CloudflareBindingsService {
@@ -13,6 +13,7 @@ declare class CloudflareWorkersEnvAdaptor extends EnvAdaptor {
13
13
  //#endregion
14
14
  //#region src/on-cloudflare-workers.d.ts
15
15
  type CloudflareWorkersOptions = {
16
+ readonly configs?: readonly ConfigClass<object>[];
16
17
  readonly warmup?: boolean;
17
18
  };
18
19
  type HttpRuntimeApp = RuntimeApp<readonly ConfiguredFeature[]> & {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/cloudflare-bindings.service.ts","../src/cloudflare-workers-env.adaptor.ts","../src/on-cloudflare-workers.ts"],"mappings":";;;cAKa,yBAAA;;EAEX,GAAA,iBAAoB,GAAA,CAAA,CAAK,GAAA,EAAK,CAAA,GAAI,GAAA,CAAI,CAAA;AAAA;;;cCH3B,2BAAA,SAAoC,UAAA;EACtC,GAAA,CAAI,GAAA;AAAA;;;KCIH,wBAAA;EAAA,SACD,MAAA;AAAA;AAAA,KAGN,cAAA,GAAiB,UAAA,UAAoB,iBAAA;EAAA,SAC/B,IAAA,EAAM,gBAAA;AAAA;AAAA,KAGZ,OAAA;EAAA,SACM,aAAA,GAAgB,OAAA,GAAU,oBAAA,KAAyB,OAAA,CAAQ,cAAA;AAAA;AAAA,KAG1D,oBAAA;EAAA,SACD,GAAA,EAAK,cAAA;EAAA,SACL,KAAA,GAAQ,OAAA,EAAS,OAAA,EAAS,GAAA,EAAK,GAAA,EAAK,GAAA,EAAK,gBAAA,KAAqB,OAAA,CAAQ,QAAA;EAAA,SACtE,QAAA,QAAgB,OAAA;AAAA;AAAA,cAGd,mBAAA,GACX,GAAA,EAAK,OAAA,EACL,OAAA,GAAS,wBAAA,KACR,OAAA,CAAQ,oBAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/cloudflare-bindings.service.ts","../src/cloudflare-workers-env.adaptor.ts","../src/on-cloudflare-workers.ts"],"mappings":";;;cAKa,yBAAA;;EAEX,GAAA,iBAAoB,GAAA,CAAA,CAAK,GAAA,EAAK,CAAA,GAAI,GAAA,CAAI,CAAA;AAAA;;;cCH3B,2BAAA,SAAoC,UAAA;EACtC,GAAA,CAAI,GAAA;AAAA;;;KCKH,wBAAA;EAAA,SACD,OAAA,YAAmB,WAAA;EAAA,SACnB,MAAA;AAAA;AAAA,KAGN,cAAA,GAAiB,UAAA,UAAoB,iBAAA;EAAA,SAC/B,IAAA,EAAM,gBAAA;AAAA;AAAA,KAGZ,OAAA;EAAA,SACM,aAAA,GAAgB,OAAA,GAAU,oBAAA,KAAyB,OAAA,CAAQ,cAAA;AAAA;AAAA,KAG1D,oBAAA;EAAA,SACD,GAAA,EAAK,cAAA;EAAA,SACL,KAAA,GAAQ,OAAA,EAAS,OAAA,EAAS,GAAA,EAAK,GAAA,EAAK,GAAA,EAAK,gBAAA,KAAqB,OAAA,CAAQ,QAAA;EAAA,SACtE,QAAA,QAAgB,OAAA;AAAA;AAAA,cAGd,mBAAA,GACX,GAAA,EAAK,OAAA,EACL,OAAA,GAAS,wBAAA,KACR,OAAA,CAAQ,oBAAA"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ConfiguredFeature, CreateRuntimeOptions, EnvAdaptor, HttpCapabilities, RuntimeApp } from "@zeltjs/core";
1
+ import { ConfigClass, ConfiguredFeature, CreateRuntimeOptions, EnvAdaptor, HttpCapabilities, RuntimeApp } from "@zeltjs/core";
2
2
 
3
3
  //#region src/cloudflare-bindings.service.d.ts
4
4
  declare class CloudflareBindingsService {
@@ -13,6 +13,7 @@ declare class CloudflareWorkersEnvAdaptor extends EnvAdaptor {
13
13
  //#endregion
14
14
  //#region src/on-cloudflare-workers.d.ts
15
15
  type CloudflareWorkersOptions = {
16
+ readonly configs?: readonly ConfigClass<object>[];
16
17
  readonly warmup?: boolean;
17
18
  };
18
19
  type HttpRuntimeApp = RuntimeApp<readonly ConfiguredFeature[]> & {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/cloudflare-bindings.service.ts","../src/cloudflare-workers-env.adaptor.ts","../src/on-cloudflare-workers.ts"],"mappings":";;;cAKa,yBAAA;;EAEX,GAAA,iBAAoB,GAAA,CAAA,CAAK,GAAA,EAAK,CAAA,GAAI,GAAA,CAAI,CAAA;AAAA;;;cCH3B,2BAAA,SAAoC,UAAA;EACtC,GAAA,CAAI,GAAA;AAAA;;;KCIH,wBAAA;EAAA,SACD,MAAA;AAAA;AAAA,KAGN,cAAA,GAAiB,UAAA,UAAoB,iBAAA;EAAA,SAC/B,IAAA,EAAM,gBAAA;AAAA;AAAA,KAGZ,OAAA;EAAA,SACM,aAAA,GAAgB,OAAA,GAAU,oBAAA,KAAyB,OAAA,CAAQ,cAAA;AAAA;AAAA,KAG1D,oBAAA;EAAA,SACD,GAAA,EAAK,cAAA;EAAA,SACL,KAAA,GAAQ,OAAA,EAAS,OAAA,EAAS,GAAA,EAAK,GAAA,EAAK,GAAA,EAAK,gBAAA,KAAqB,OAAA,CAAQ,QAAA;EAAA,SACtE,QAAA,QAAgB,OAAA;AAAA;AAAA,cAGd,mBAAA,GACX,GAAA,EAAK,OAAA,EACL,OAAA,GAAS,wBAAA,KACR,OAAA,CAAQ,oBAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/cloudflare-bindings.service.ts","../src/cloudflare-workers-env.adaptor.ts","../src/on-cloudflare-workers.ts"],"mappings":";;;cAKa,yBAAA;;EAEX,GAAA,iBAAoB,GAAA,CAAA,CAAK,GAAA,EAAK,CAAA,GAAI,GAAA,CAAI,CAAA;AAAA;;;cCH3B,2BAAA,SAAoC,UAAA;EACtC,GAAA,CAAI,GAAA;AAAA;;;KCKH,wBAAA;EAAA,SACD,OAAA,YAAmB,WAAA;EAAA,SACnB,MAAA;AAAA;AAAA,KAGN,cAAA,GAAiB,UAAA,UAAoB,iBAAA;EAAA,SAC/B,IAAA,EAAM,gBAAA;AAAA;AAAA,KAGZ,OAAA;EAAA,SACM,aAAA,GAAgB,OAAA,GAAU,oBAAA,KAAyB,OAAA,CAAQ,cAAA;AAAA;AAAA,KAG1D,oBAAA;EAAA,SACD,GAAA,EAAK,cAAA;EAAA,SACL,KAAA,GAAQ,OAAA,EAAS,OAAA,EAAS,GAAA,EAAK,GAAA,EAAK,GAAA,EAAK,gBAAA,KAAqB,OAAA,CAAQ,QAAA;EAAA,SACtE,QAAA,QAAgB,OAAA;AAAA;AAAA,cAGd,mBAAA,GACX,GAAA,EAAK,OAAA,EACL,OAAA,GAAS,wBAAA,KACR,OAAA,CAAQ,oBAAA"}
package/dist/index.js CHANGED
@@ -45,6 +45,7 @@ CloudflareWorkersEnvAdaptor = _ts_decorate([Config], CloudflareWorkersEnvAdaptor
45
45
  //#region src/on-cloudflare-workers.ts
46
46
  const onCloudflareWorkers = async (app, options = {}) => {
47
47
  const readyApp = await app.createRuntime({
48
+ ...options.configs === void 0 ? {} : { configs: options.configs },
48
49
  fallbackConfigs: [CloudflareWorkersEnvAdaptor],
49
50
  warmup: options.warmup ?? false
50
51
  });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["AsyncLocalStorage","ZeltContextNotAvailableError","storage","getCloudflareRuntimeContext","context","getStore","primitive","requiredContext","runWithCloudflareRuntimeContext","fn","run","Injectable","getCloudflareRuntimeContext","CloudflareBindingsService","get","key","env","env","Config","EnvAdaptor","CloudflareWorkersEnvAdaptor","get","key","value","Reflect","undefined","runWithCloudflareRuntimeContext","CloudflareWorkersEnvAdaptor","onCloudflareWorkers","app","options","readyApp","createRuntime","fallbackConfigs","warmup","fetch","request","env","ctx","response","http","waitUntil","then","get","shutdown"],"sources":["../src/cloudflare-runtime-context.lib.ts","../src/cloudflare-bindings.service.ts","../src/cloudflare-workers-env.adaptor.ts","../src/on-cloudflare-workers.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks';\nimport { ZeltContextNotAvailableError } from '@zeltjs/core';\n\nexport type CloudflareRuntimeContext = {\n readonly env: Env;\n readonly ctx: ExecutionContext;\n};\n\nconst storage = new AsyncLocalStorage<CloudflareRuntimeContext>();\n\n/** @throws {ZeltContextNotAvailableError} */\nexport const getCloudflareRuntimeContext = (): CloudflareRuntimeContext => {\n const context = storage.getStore();\n if (!context) {\n throw new ZeltContextNotAvailableError({\n primitive: 'CloudflareBindings.get',\n requiredContext: 'entry',\n });\n }\n return context;\n};\n\nexport const runWithCloudflareRuntimeContext = <T>(\n context: CloudflareRuntimeContext,\n fn: () => T,\n): T => storage.run(context, fn);\n\ndeclare global {\n interface Env {}\n}\n","import { Injectable } from '@zeltjs/core';\n\nimport { getCloudflareRuntimeContext } from './cloudflare-runtime-context.lib';\n\n@Injectable()\nexport class CloudflareBindingsService {\n /** @throws {ZeltContextNotAvailableError} */\n get<K extends keyof Env>(key: K): Env[K] {\n return getCloudflareRuntimeContext().env[key];\n }\n}\n","import { env } from 'cloudflare:workers';\nimport { Config, EnvAdaptor } from '@zeltjs/core';\n\n@Config\nexport class CloudflareWorkersEnvAdaptor extends EnvAdaptor {\n override get(key: string): string | undefined {\n const value: unknown = Reflect.get(env, key);\n return typeof value === 'string' ? value : undefined;\n }\n}\n","import type {\n ConfiguredFeature,\n CreateRuntimeOptions,\n HttpCapabilities,\n RuntimeApp,\n} from '@zeltjs/core';\nimport { runWithCloudflareRuntimeContext } from './cloudflare-runtime-context.lib';\nimport { CloudflareWorkersEnvAdaptor } from './cloudflare-workers-env.adaptor';\n\nexport type CloudflareWorkersOptions = {\n readonly warmup?: boolean;\n};\n\ntype HttpRuntimeApp = RuntimeApp<readonly ConfiguredFeature[]> & {\n readonly http: HttpCapabilities;\n};\n\ntype HttpApp = {\n readonly createRuntime: (options?: CreateRuntimeOptions) => Promise<HttpRuntimeApp>;\n};\n\nexport type CloudflareWorkersApp = {\n readonly get: HttpRuntimeApp['get'];\n readonly fetch: (request: Request, env: Env, ctx: ExecutionContext) => Promise<Response>;\n readonly shutdown: () => Promise<void>;\n};\n\nexport const onCloudflareWorkers = async (\n app: HttpApp,\n options: CloudflareWorkersOptions = {},\n): Promise<CloudflareWorkersApp> => {\n const readyApp = await app.createRuntime({\n fallbackConfigs: [CloudflareWorkersEnvAdaptor],\n warmup: options.warmup ?? false,\n });\n\n const fetch = async (request: Request, env: Env, ctx: ExecutionContext): Promise<Response> => {\n const response = runWithCloudflareRuntimeContext({ env, ctx }, () =>\n readyApp.http.fetch(request),\n );\n ctx.waitUntil(response.then(() => {}));\n return response;\n };\n\n return { get: readyApp.get, fetch, shutdown: readyApp.shutdown };\n};\n"],"mappings":";;;;AAQA,MAAME,UAAU,IAAIF,mBAAAA;8CAGpB,MAAaG,oCAA8B;CACzC,MAAMC,UAAUF,QAAQG,UAAQ;AAChC,KAAI,CAACD,QACH,OAAM,IAAIH,6BAA6B;EACrCK,WAAW;EACXC,iBAAiB;EACnB,CAAA;AAEF,QAAOH;;AAGT,MAAaI,mCACXJ,SACAK,OACMP,QAAQQ,IAAIN,SAASK,GAAAA;;;;;;;;;ACpB7B,IAAaI,4BAAb,MAAaA;+CAEXC,IAAyBC,KAAgB;AACvC,SAAOH,6BAAAA,CAA8BI,IAAID;;;;;;;;;;;;ACJ7C,IAAaK,8BAAb,cAAiDD,WAAAA;CACtCE,IAAIC,KAAiC;EAC5C,MAAMC,QAAiBC,QAAQH,IAAIJ,KAAKK,IAAAA;AACxC,SAAO,OAAOC,UAAU,WAAWA,QAAQE,KAAAA;;;;;;ACoB/C,MAAaG,sBAAsB,OACjCC,KACAC,UAAoC,EAAE,KAAA;CAEtC,MAAMC,WAAW,MAAMF,IAAIG,cAAc;EACvCC,iBAAiB,CAACN,4BAA4B;EAC9CO,QAAQJ,QAAQI,UAAU;EAC5B,CAAA;CAEA,MAAMC,QAAQ,OAAOC,SAAkBC,KAAUC,QAAAA;EAC/C,MAAMC,WAAWb,gCAAgC;GAAEW;GAAKC;GAAI,QAC1DP,SAASS,KAAKL,MAAMC,QAAAA,CAAAA;AAEtBE,MAAIG,UAAUF,SAASG,WAAK,GAAO,CAAA;AACnC,SAAOH;;AAGT,QAAO;EAAEI,KAAKZ,SAASY;EAAKR;EAAOS,UAAUb,SAASa;EAAS"}
1
+ {"version":3,"file":"index.js","names":["AsyncLocalStorage","ZeltContextNotAvailableError","storage","getCloudflareRuntimeContext","context","getStore","primitive","requiredContext","runWithCloudflareRuntimeContext","fn","run","Injectable","getCloudflareRuntimeContext","CloudflareBindingsService","get","key","env","env","Config","EnvAdaptor","CloudflareWorkersEnvAdaptor","get","key","value","Reflect","undefined","runWithCloudflareRuntimeContext","CloudflareWorkersEnvAdaptor","onCloudflareWorkers","app","options","readyApp","createRuntime","configs","undefined","fallbackConfigs","warmup","fetch","request","env","ctx","response","http","waitUntil","then","get","shutdown"],"sources":["../src/cloudflare-runtime-context.lib.ts","../src/cloudflare-bindings.service.ts","../src/cloudflare-workers-env.adaptor.ts","../src/on-cloudflare-workers.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks';\nimport { ZeltContextNotAvailableError } from '@zeltjs/core';\n\nexport type CloudflareRuntimeContext = {\n readonly env: Env;\n readonly ctx: ExecutionContext;\n};\n\nconst storage = new AsyncLocalStorage<CloudflareRuntimeContext>();\n\n/** @throws {ZeltContextNotAvailableError} */\nexport const getCloudflareRuntimeContext = (): CloudflareRuntimeContext => {\n const context = storage.getStore();\n if (!context) {\n throw new ZeltContextNotAvailableError({\n primitive: 'CloudflareBindings.get',\n requiredContext: 'entry',\n });\n }\n return context;\n};\n\nexport const runWithCloudflareRuntimeContext = <T>(\n context: CloudflareRuntimeContext,\n fn: () => T,\n): T => storage.run(context, fn);\n\ndeclare global {\n interface Env {}\n}\n","import { Injectable } from '@zeltjs/core';\n\nimport { getCloudflareRuntimeContext } from './cloudflare-runtime-context.lib';\n\n@Injectable()\nexport class CloudflareBindingsService {\n /** @throws {ZeltContextNotAvailableError} */\n get<K extends keyof Env>(key: K): Env[K] {\n return getCloudflareRuntimeContext().env[key];\n }\n}\n","import { env } from 'cloudflare:workers';\nimport { Config, EnvAdaptor } from '@zeltjs/core';\n\n@Config\nexport class CloudflareWorkersEnvAdaptor extends EnvAdaptor {\n override get(key: string): string | undefined {\n const value: unknown = Reflect.get(env, key);\n return typeof value === 'string' ? value : undefined;\n }\n}\n","import type {\n ConfigClass,\n ConfiguredFeature,\n CreateRuntimeOptions,\n HttpCapabilities,\n RuntimeApp,\n} from '@zeltjs/core';\nimport { runWithCloudflareRuntimeContext } from './cloudflare-runtime-context.lib';\nimport { CloudflareWorkersEnvAdaptor } from './cloudflare-workers-env.adaptor';\n\nexport type CloudflareWorkersOptions = {\n readonly configs?: readonly ConfigClass<object>[];\n readonly warmup?: boolean;\n};\n\ntype HttpRuntimeApp = RuntimeApp<readonly ConfiguredFeature[]> & {\n readonly http: HttpCapabilities;\n};\n\ntype HttpApp = {\n readonly createRuntime: (options?: CreateRuntimeOptions) => Promise<HttpRuntimeApp>;\n};\n\nexport type CloudflareWorkersApp = {\n readonly get: HttpRuntimeApp['get'];\n readonly fetch: (request: Request, env: Env, ctx: ExecutionContext) => Promise<Response>;\n readonly shutdown: () => Promise<void>;\n};\n\nexport const onCloudflareWorkers = async (\n app: HttpApp,\n options: CloudflareWorkersOptions = {},\n): Promise<CloudflareWorkersApp> => {\n const readyApp = await app.createRuntime({\n ...(options.configs === undefined ? {} : { configs: options.configs }),\n fallbackConfigs: [CloudflareWorkersEnvAdaptor],\n warmup: options.warmup ?? false,\n });\n\n const fetch = async (request: Request, env: Env, ctx: ExecutionContext): Promise<Response> => {\n const response = runWithCloudflareRuntimeContext({ env, ctx }, () =>\n readyApp.http.fetch(request),\n );\n ctx.waitUntil(response.then(() => {}));\n return response;\n };\n\n return { get: readyApp.get, fetch, shutdown: readyApp.shutdown };\n};\n"],"mappings":";;;;AAQA,MAAME,UAAU,IAAIF,mBAAAA;8CAGpB,MAAaG,oCAA8B;CACzC,MAAMC,UAAUF,QAAQG,UAAQ;AAChC,KAAI,CAACD,QACH,OAAM,IAAIH,6BAA6B;EACrCK,WAAW;EACXC,iBAAiB;EACnB,CAAA;AAEF,QAAOH;;AAGT,MAAaI,mCACXJ,SACAK,OACMP,QAAQQ,IAAIN,SAASK,GAAAA;;;;;;;;;ACpB7B,IAAaI,4BAAb,MAAaA;+CAEXC,IAAyBC,KAAgB;AACvC,SAAOH,6BAAAA,CAA8BI,IAAID;;;;;;;;;;;;ACJ7C,IAAaK,8BAAb,cAAiDD,WAAAA;CACtCE,IAAIC,KAAiC;EAC5C,MAAMC,QAAiBC,QAAQH,IAAIJ,KAAKK,IAAAA;AACxC,SAAO,OAAOC,UAAU,WAAWA,QAAQE,KAAAA;;;;;;ACsB/C,MAAaG,sBAAsB,OACjCC,KACAC,UAAoC,EAAE,KAAA;CAEtC,MAAMC,WAAW,MAAMF,IAAIG,cAAc;EACvC,GAAIF,QAAQG,YAAYC,KAAAA,IAAY,EAAC,GAAI,EAAED,SAASH,QAAQG,SAAS;EACrEE,iBAAiB,CAACR,4BAA4B;EAC9CS,QAAQN,QAAQM,UAAU;EAC5B,CAAA;CAEA,MAAMC,QAAQ,OAAOC,SAAkBC,KAAUC,QAAAA;EAC/C,MAAMC,WAAWf,gCAAgC;GAAEa;GAAKC;GAAI,QAC1DT,SAASW,KAAKL,MAAMC,QAAAA,CAAAA;AAEtBE,MAAIG,UAAUF,SAASG,WAAK,GAAO,CAAA;AACnC,SAAOH;;AAGT,QAAO;EAAEI,KAAKd,SAASc;EAAKR;EAAOS,UAAUf,SAASe;EAAS"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeltjs/adapter-cloudflare-workers",
3
- "version": "0.9.1-canary.3",
3
+ "version": "0.9.1-canary.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -27,7 +27,7 @@
27
27
  "dist"
28
28
  ],
29
29
  "dependencies": {
30
- "@zeltjs/core": "0.9.1-canary.3"
30
+ "@zeltjs/core": "0.9.1-canary.4"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "22.19.17",