@cloudflare/config 0.9.0 → 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.
- package/dist/index.d.mts +23 -175
- package/dist/index.mjs +111 -2463
- package/dist/{public-CN_InYwn.d.mts → public-E85Be_2R.d.mts} +1298 -1365
- package/dist/{public-BwQqexwo.mjs → public-bN7EDGtD.mjs} +19 -48
- package/dist/public.d.mts +2 -2
- package/dist/public.mjs +1 -1
- package/package.json +3 -3
|
@@ -214,55 +214,31 @@ const exports = {
|
|
|
214
214
|
|
|
215
215
|
//#endregion
|
|
216
216
|
//#region src/definition.ts
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
* the result. A function config is invoked with {@link ConfigContext}.
|
|
221
|
-
*/
|
|
222
|
-
async function unwrap(config, ctx) {
|
|
223
|
-
return typeof config === "function" ? await config(ctx) : await config;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Resolve any `cloudflare.config.ts` export to its plain config value.
|
|
227
|
-
*
|
|
228
|
-
* A `define*` helper stores its authored config plus `type` under the
|
|
229
|
-
* {@link DEFINITION} symbol; here we unwrap the config and stamp `type` back on.
|
|
230
|
-
* Every other export — a raw object/promise/function — is unwrapped as-is and
|
|
231
|
-
* already carries its own `type`. Discrimination happens afterwards via `type`.
|
|
232
|
-
*/
|
|
233
|
-
async function resolveExportDefinition(def, ctx) {
|
|
234
|
-
if (typeof def === "object" && def !== null && DEFINITION in def) {
|
|
235
|
-
const { config, type } = def[DEFINITION];
|
|
217
|
+
/** Add a config type while preserving its value, promise, or function shape. */
|
|
218
|
+
function addConfigType(config, type) {
|
|
219
|
+
function addType(value) {
|
|
236
220
|
return {
|
|
237
|
-
...
|
|
221
|
+
...value,
|
|
238
222
|
type
|
|
239
223
|
};
|
|
240
224
|
}
|
|
241
|
-
return
|
|
225
|
+
if (typeof config === "function") return (ctx) => {
|
|
226
|
+
const result = config(ctx);
|
|
227
|
+
return result instanceof Promise ? result.then(addType) : addType(result);
|
|
228
|
+
};
|
|
229
|
+
return config instanceof Promise ? config.then(addType) : addType(config);
|
|
230
|
+
}
|
|
231
|
+
/** Create a type-safe config helper for a particular export type. */
|
|
232
|
+
function createConfigDefiner(type) {
|
|
233
|
+
function define(config) {
|
|
234
|
+
return addConfigType(config, type);
|
|
235
|
+
}
|
|
236
|
+
return define;
|
|
242
237
|
}
|
|
243
238
|
|
|
244
239
|
//#endregion
|
|
245
240
|
//#region src/worker-definition.ts
|
|
246
|
-
|
|
247
|
-
return {
|
|
248
|
-
[DEFINITION]: {
|
|
249
|
-
config,
|
|
250
|
-
type: "worker"
|
|
251
|
-
},
|
|
252
|
-
durableObject(options) {
|
|
253
|
-
return {
|
|
254
|
-
type: "durable-object",
|
|
255
|
-
...options
|
|
256
|
-
};
|
|
257
|
-
},
|
|
258
|
-
worker(options) {
|
|
259
|
-
return {
|
|
260
|
-
type: "worker",
|
|
261
|
-
...options
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
}
|
|
241
|
+
const defineWorker = createConfigDefiner("worker");
|
|
266
242
|
|
|
267
243
|
//#endregion
|
|
268
244
|
//#region src/settings-definition.ts
|
|
@@ -270,12 +246,7 @@ function defineWorker(config) {
|
|
|
270
246
|
* Declare shared settings.
|
|
271
247
|
* Authored as a named `settings` export.
|
|
272
248
|
*/
|
|
273
|
-
|
|
274
|
-
return { [DEFINITION]: {
|
|
275
|
-
config,
|
|
276
|
-
type: "settings"
|
|
277
|
-
} };
|
|
278
|
-
}
|
|
249
|
+
const defineSettings = createConfigDefiner("settings");
|
|
279
250
|
|
|
280
251
|
//#endregion
|
|
281
|
-
export {
|
|
252
|
+
export { bindings as a, triggers as i, defineWorker as n, exports as r, defineSettings as t };
|
package/dist/public.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, BindingDevOptions, Bindings, BrowserBinding, ConfigContext, ConnectTrigger, D1Binding, DispatchNamespaceBinding, DurableObjectBinding, DurableObjectCreatedExport, DurableObjectDeletedExport, DurableObjectExpectingTransferExport, DurableObjectRenamedExport, DurableObjectTransferredExport, EmailTrigger, Exports, FetchTrigger, FlagshipBinding, HyperdriveBinding, ImagesBinding, InferDurableNamespaces, InferEnv, InferMainModule, JsonBinding, KvBinding, LogfwdrBinding, MediaBinding, MtlsCertificateBinding, PipelineBinding, QueueBinding, QueueConsumerTrigger, R2Binding, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, SettingsConfig,
|
|
1
|
+
import { $ as WorkerConfig, A as SecretsStoreSecretBinding, B as VersionMetadataBinding, C as MediaBinding, D as R2Binding, E as QueueBinding, F as TypedKvBinding, G as WorkerLoaderBinding, H as VpcServiceBinding, I as TypedPipelineBinding, J as bindings, K as WorkerReference, L as TypedQueueBinding, M as StreamBinding, N as TextBinding, O as RateLimitBinding, P as TypedAiBinding, Q as SettingsConfig, R as UnsafeBinding, S as LogfwdrBinding, T as PipelineBinding, U as WebSearchBinding, V as VpcNetworkBinding, W as WorkerBinding, X as WorkerConfigInput, Y as WorkerConfigExport, Z as defineWorker, _ as FlagshipBinding, _t as InferDurableNamespaces, a as AiBinding, at as Triggers, b as JsonBinding, bt as UnwrapConfig, c as AnalyticsEngineDatasetBinding, ct as DurableObjectDeletedExport, d as BindingDevOptions, dt as DurableObjectTransferredExport, et as ConnectTrigger, f as Bindings, ft as Exports, g as DurableObjectBinding, gt as ConfigContext, h as DispatchNamespaceBinding, ht as exports, i as AgentMemoryBinding, it as ScheduledTrigger, j as SendEmailBinding, k as SecretBinding, l as ArtifactsBinding, lt as DurableObjectExpectingTransferExport, m as D1Binding, mt as WorkerEntrypointExportOptions, n as SettingsConfigInput, nt as FetchTrigger, o as AiSearchBinding, ot as triggers, p as BrowserBinding, pt as WorkerEntrypointExport, q as WorkflowBinding, r as defineSettings, rt as QueueConsumerTrigger, s as AiSearchNamespaceBinding, st as DurableObjectCreatedExport, t as SettingsConfigExport, tt as EmailTrigger, u as AssetsBinding, ut as DurableObjectRenamedExport, v as HyperdriveBinding, vt as InferEnv, w as MtlsCertificateBinding, x as KvBinding, y as ImagesBinding, yt as InferMainModule, z as VectorizeBinding } from "./public-E85Be_2R.mjs";
|
|
2
|
+
export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, BindingDevOptions, Bindings, BrowserBinding, ConfigContext, ConnectTrigger, D1Binding, DispatchNamespaceBinding, DurableObjectBinding, DurableObjectCreatedExport, DurableObjectDeletedExport, DurableObjectExpectingTransferExport, DurableObjectRenamedExport, DurableObjectTransferredExport, EmailTrigger, Exports, FetchTrigger, FlagshipBinding, HyperdriveBinding, ImagesBinding, InferDurableNamespaces, InferEnv, InferMainModule, JsonBinding, KvBinding, LogfwdrBinding, MediaBinding, MtlsCertificateBinding, PipelineBinding, QueueBinding, QueueConsumerTrigger, R2Binding, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, SettingsConfig, SettingsConfigExport, SettingsConfigInput, StreamBinding, TextBinding, Triggers, TypedAiBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, UnsafeBinding, UnwrapConfig, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WebSearchBinding, WorkerBinding, WorkerConfig, WorkerConfigExport, WorkerConfigInput, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerLoaderBinding, WorkerReference, WorkflowBinding, bindings, defineSettings, defineWorker, exports, triggers };
|
package/dist/public.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as bindings, i as triggers, n as defineWorker, r as exports, t as defineSettings } from "./public-bN7EDGtD.mjs";
|
|
2
2
|
|
|
3
3
|
export { bindings, defineSettings, defineWorker, exports, triggers };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Definitions and utilities for configuring Cloudflare Workers and related products. This is not yet stable enough for external use — APIs may change without notice.",
|
|
5
5
|
"homepage": "https://github.com/cloudflare/workers-sdk/tree/main/packages/config#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"zod": "4.4.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@cloudflare/workers-types": "^5.
|
|
34
|
+
"@cloudflare/workers-types": "^5.20260908.1",
|
|
35
35
|
"ts-dedent": "^2.2.0",
|
|
36
36
|
"tsdown": "0.16.3",
|
|
37
37
|
"typescript": "5.8.3",
|
|
38
38
|
"vitest": "4.1.0",
|
|
39
39
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
40
|
-
"@cloudflare/workers-utils": "0.
|
|
40
|
+
"@cloudflare/workers-utils": "0.37.0"
|
|
41
41
|
},
|
|
42
42
|
"workers-sdk": {
|
|
43
43
|
"prerelease": true
|