@cloudflare/config 0.0.0 → 0.2.1
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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as StreamBinding, A as AnalyticsEngineDatasetBinding, B as ImagesBinding, C as ScheduledTrigger, D as AiBinding, E as AgentMemoryBinding, F as D1Binding, G as MtlsCertificateBinding, H as KvBinding, I as DispatchNamespaceBinding, J as R2Binding, K as PipelineBinding, L as DurableObjectBinding, M as AssetsBinding, N as Bindings, O as AiSearchBinding, P as BrowserBinding, Q as SendEmailBinding, R as FlagshipBinding, S as QueueConsumerTrigger, T as triggers, U as LogfwdrBinding, V as JsonBinding, W as MediaBinding, X as SecretBinding, Y as RateLimitBinding, Z as SecretsStoreSecretBinding, _ as WorkerEntrypointExport, _t as bindings, a as ConfigContext, at as TypedQueueBinding, b as EmailTrigger, c as defineWorker, ct as UnsafeBinding, d as DurableObjectCreatedExport, dt as VpcNetworkBinding, et as TextBinding, f as DurableObjectDeletedExport, ft as VpcServiceBinding, g as Exports, gt as WorkflowBinding, h as DurableObjectTransferredExport, ht as WorkerLoaderBinding, i as UnwrapConfig, it as TypedPipelineBinding, j as ArtifactsBinding, k as AiSearchNamespaceBinding, l as resolveWorkerDefinition, lt as VectorizeBinding, m as DurableObjectRenamedExport, mt as WorkerBinding, n as InferEnv, nt as TypedDurableObjectBinding, o as TypedWorkerDefinition, ot as TypedWorkerBinding, p as DurableObjectExpectingTransferExport, pt as WebSearchBinding, q as QueueBinding, r as InferMainModule, rt as TypedKvBinding, s as UserConfigExport, st as TypedWorkflowBinding, t as InferDurableNamespaces, tt as TypedAiBinding, u as UserConfig, ut as VersionMetadataBinding, v as WorkerEntrypointExportOptions, w as Triggers, x as FetchTrigger, y as exports, z as HyperdriveBinding } from "./public-m7PNfSwY.mjs";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import { RawConfig } from "@cloudflare/workers-utils";
|
|
4
4
|
|
|
@@ -179,6 +179,9 @@ declare const InputWorkerSchema: z.ZodObject<{
|
|
|
179
179
|
}, z.core.$strict>>;
|
|
180
180
|
domains: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
181
181
|
triggers: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
182
|
+
type: z.ZodLiteral<"email">;
|
|
183
|
+
addresses: z.ZodArray<z.ZodString>;
|
|
184
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
182
185
|
type: z.ZodLiteral<"fetch">;
|
|
183
186
|
pattern: z.ZodString;
|
|
184
187
|
zone: z.ZodOptional<z.ZodString>;
|
|
@@ -339,6 +342,9 @@ declare const OutputWorkerSchema: z.ZodObject<{
|
|
|
339
342
|
}, z.core.$strict>>;
|
|
340
343
|
domains: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
341
344
|
triggers: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
345
|
+
type: z.ZodLiteral<"email">;
|
|
346
|
+
addresses: z.ZodArray<z.ZodString>;
|
|
347
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
342
348
|
type: z.ZodLiteral<"fetch">;
|
|
343
349
|
pattern: z.ZodString;
|
|
344
350
|
zone: z.ZodOptional<z.ZodString>;
|
|
@@ -617,4 +623,4 @@ interface LoadConfigResult {
|
|
|
617
623
|
*/
|
|
618
624
|
declare function registerConfigHooks(): () => void;
|
|
619
625
|
//#endregion
|
|
620
|
-
export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, BUILD_OUTPUT_ROOT, BUILD_OUTPUT_VERSION, Bindings, BrowserBinding, ConfigContext, D1Binding, DispatchNamespaceBinding, DurableObjectBinding, DurableObjectCreatedExport, DurableObjectDeletedExport, DurableObjectExpectingTransferExport, DurableObjectRenamedExport, DurableObjectTransferredExport, Exports, FetchTrigger, FlagshipBinding, HyperdriveBinding, ImagesBinding, InferDurableNamespaces, InferEnv, InferMainModule, InputWorkerSchema, JsonBinding, KvBinding, type LoadConfigResult, LogfwdrBinding, MediaBinding, type ModuleType, ModuleTypeSchema, MtlsCertificateBinding, OutputWorkerSchema, type ParsedInputWorkerConfig, type ParsedOutputWorkerConfig, PipelineBinding, QueueBinding, QueueConsumerTrigger, R2Binding, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, StreamBinding, TextBinding, Triggers, TypedAiBinding, TypedDurableObjectBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, TypedWorkerBinding, TypedWorkerDefinition, TypedWorkflowBinding, UnsafeBinding, UnwrapConfig, UserConfig, UserConfigExport, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WORKER_CONFIG_FILENAME, WebSearchBinding, WorkerBinding, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerLoaderBinding, WorkflowBinding, bindings, cleanBuildOutputDir, convertToWranglerConfig, defineWorker, exports, generateTypes, getWorkerAssetsDir, getWorkerBundleDir, getWorkerConfigPath, getWorkersDir, loadConfig, registerConfigHooks, resolveWorkerDefinition, triggers, writeOutputWorkerConfig };
|
|
626
|
+
export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, BUILD_OUTPUT_ROOT, BUILD_OUTPUT_VERSION, Bindings, BrowserBinding, ConfigContext, D1Binding, DispatchNamespaceBinding, DurableObjectBinding, DurableObjectCreatedExport, DurableObjectDeletedExport, DurableObjectExpectingTransferExport, DurableObjectRenamedExport, DurableObjectTransferredExport, EmailTrigger, Exports, FetchTrigger, FlagshipBinding, HyperdriveBinding, ImagesBinding, InferDurableNamespaces, InferEnv, InferMainModule, InputWorkerSchema, JsonBinding, KvBinding, type LoadConfigResult, LogfwdrBinding, MediaBinding, type ModuleType, ModuleTypeSchema, MtlsCertificateBinding, OutputWorkerSchema, type ParsedInputWorkerConfig, type ParsedOutputWorkerConfig, PipelineBinding, QueueBinding, QueueConsumerTrigger, R2Binding, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, StreamBinding, TextBinding, Triggers, TypedAiBinding, TypedDurableObjectBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, TypedWorkerBinding, TypedWorkerDefinition, TypedWorkflowBinding, UnsafeBinding, UnwrapConfig, UserConfig, UserConfigExport, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WORKER_CONFIG_FILENAME, WebSearchBinding, WorkerBinding, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerLoaderBinding, WorkflowBinding, bindings, cleanBuildOutputDir, convertToWranglerConfig, defineWorker, exports, generateTypes, getWorkerAssetsDir, getWorkerBundleDir, getWorkerConfigPath, getWorkersDir, loadConfig, registerConfigHooks, resolveWorkerDefinition, triggers, writeOutputWorkerConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as bindings, i as triggers, n as resolveWorkerDefinition, r as exports$1, t as defineWorker } from "./public-
|
|
1
|
+
import { a as bindings, i as triggers, n as resolveWorkerDefinition, r as exports$1, t as defineWorker } from "./public-mmLmXmLK.mjs";
|
|
2
2
|
import * as nodeModule from "node:module";
|
|
3
3
|
import * as fsp from "node:fs/promises";
|
|
4
4
|
import * as path from "node:path";
|
|
5
|
-
import
|
|
5
|
+
import path2__default, { dirname, isAbsolute, join, resolve } from "node:path";
|
|
6
6
|
import fs2, { existsSync, readFileSync, statSync } from "node:fs";
|
|
7
7
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
8
8
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -15,7 +15,7 @@ var __commonJS = (cb, mod) => function() {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
18
|
-
//#region ../workers-utils/dist/chunk-
|
|
18
|
+
//#region ../workers-utils/dist/chunk-Q72B4Q5Z.mjs
|
|
19
19
|
var __defProp = Object.defineProperty;
|
|
20
20
|
var __name = (target, value) => __defProp(target, "name", {
|
|
21
21
|
value,
|
|
@@ -23,7 +23,7 @@ var __name = (target, value) => __defProp(target, "name", {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
//#endregion
|
|
26
|
-
//#region ../workers-utils/dist/chunk-
|
|
26
|
+
//#region ../workers-utils/dist/chunk-53IMCORZ.mjs
|
|
27
27
|
function isDirectory(path$1) {
|
|
28
28
|
return fs2.statSync(path$1, { throwIfNoEntry: false })?.isDirectory() ?? false;
|
|
29
29
|
}
|
|
@@ -50,7 +50,7 @@ function removeDirSync(dirPath) {
|
|
|
50
50
|
__name(removeDirSync, "removeDirSync");
|
|
51
51
|
|
|
52
52
|
//#endregion
|
|
53
|
-
//#region ../workers-utils/dist/chunk-
|
|
53
|
+
//#region ../workers-utils/dist/chunk-Y3JVLYM6.mjs
|
|
54
54
|
function partitionExports(exports$2) {
|
|
55
55
|
const partitioned = {
|
|
56
56
|
"durable-object": {},
|
|
@@ -813,10 +813,10 @@ function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
813
813
|
return result;
|
|
814
814
|
}
|
|
815
815
|
__name(parseTree, "parseTree");
|
|
816
|
-
function findNodeAtLocation(root, path2
|
|
816
|
+
function findNodeAtLocation(root, path2) {
|
|
817
817
|
if (!root) return;
|
|
818
818
|
let node = root;
|
|
819
|
-
for (let segment of path2
|
|
819
|
+
for (let segment of path2) if (typeof segment === "string") {
|
|
820
820
|
if (node.type !== "object" || !Array.isArray(node.children)) return;
|
|
821
821
|
let found = false;
|
|
822
822
|
for (const propertyNode of node.children) if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment && propertyNode.children.length === 2) {
|
|
@@ -1043,13 +1043,13 @@ function getNodeType(value) {
|
|
|
1043
1043
|
}
|
|
1044
1044
|
__name(getNodeType, "getNodeType");
|
|
1045
1045
|
function setProperty(text, originalPath, value, options) {
|
|
1046
|
-
const path2
|
|
1046
|
+
const path2 = originalPath.slice();
|
|
1047
1047
|
const root = parseTree(text, []);
|
|
1048
1048
|
let parent = void 0;
|
|
1049
1049
|
let lastSegment = void 0;
|
|
1050
|
-
while (path2
|
|
1051
|
-
lastSegment = path2
|
|
1052
|
-
parent = findNodeAtLocation(root, path2
|
|
1050
|
+
while (path2.length > 0) {
|
|
1051
|
+
lastSegment = path2.pop();
|
|
1052
|
+
parent = findNodeAtLocation(root, path2);
|
|
1053
1053
|
if (parent === void 0 && value !== void 0) if (typeof lastSegment === "string") value = { [lastSegment]: value };
|
|
1054
1054
|
else value = [value];
|
|
1055
1055
|
else break;
|
|
@@ -1291,8 +1291,8 @@ function format2(documentText, range, options) {
|
|
|
1291
1291
|
return format(documentText, range, options);
|
|
1292
1292
|
}
|
|
1293
1293
|
__name(format2, "format");
|
|
1294
|
-
function modify(text, path2
|
|
1295
|
-
return setProperty(text, path2
|
|
1294
|
+
function modify(text, path2, value, options) {
|
|
1295
|
+
return setProperty(text, path2, value, options);
|
|
1296
1296
|
}
|
|
1297
1297
|
__name(modify, "modify");
|
|
1298
1298
|
function applyEdits(text, edits) {
|
|
@@ -2353,13 +2353,21 @@ function up(base, options) {
|
|
|
2353
2353
|
}
|
|
2354
2354
|
__name(up, "up");
|
|
2355
2355
|
function file(name, options) {
|
|
2356
|
-
let
|
|
2357
|
-
for (
|
|
2358
|
-
tmp = join(
|
|
2356
|
+
let dir2, tmp;
|
|
2357
|
+
for (dir2 of up(options && options.cwd || "", options)) try {
|
|
2358
|
+
tmp = join(dir2, name);
|
|
2359
2359
|
if (statSync(tmp).isFile()) return tmp;
|
|
2360
2360
|
} catch {}
|
|
2361
2361
|
}
|
|
2362
2362
|
__name(file, "file");
|
|
2363
|
+
function dir(name, options) {
|
|
2364
|
+
let dir2, tmp;
|
|
2365
|
+
for (dir2 of up(options && options.cwd || "", options)) try {
|
|
2366
|
+
tmp = join(dir2, name);
|
|
2367
|
+
if (statSync(tmp).isDirectory()) return tmp;
|
|
2368
|
+
} catch {}
|
|
2369
|
+
}
|
|
2370
|
+
__name(dir, "dir");
|
|
2363
2371
|
function dedent$2(templ) {
|
|
2364
2372
|
var values = [];
|
|
2365
2373
|
for (var _i = 1; _i < arguments.length; _i++) values[_i - 1] = arguments[_i];
|
|
@@ -2401,7 +2409,7 @@ function resolveWranglerConfigPath({ config, script }, options) {
|
|
|
2401
2409
|
deployConfigPath: void 0,
|
|
2402
2410
|
redirected: false
|
|
2403
2411
|
};
|
|
2404
|
-
return findWranglerConfig(script !== void 0 ?
|
|
2412
|
+
return findWranglerConfig(script !== void 0 ? path2__default.dirname(script) : process.cwd(), options);
|
|
2405
2413
|
}
|
|
2406
2414
|
__name(resolveWranglerConfigPath, "resolveWranglerConfigPath");
|
|
2407
2415
|
function findWranglerConfig(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
|
|
@@ -2432,15 +2440,15 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
|
|
|
2432
2440
|
const deployConfigFile = readFileSync$1(deployConfigPath);
|
|
2433
2441
|
try {
|
|
2434
2442
|
const deployConfig = parseJSONC(deployConfigFile, deployConfigPath);
|
|
2435
|
-
redirectedConfigPath = deployConfig.configPath &&
|
|
2443
|
+
redirectedConfigPath = deployConfig.configPath && path2__default.resolve(path2__default.dirname(deployConfigPath), deployConfig.configPath);
|
|
2436
2444
|
} catch (e) {
|
|
2437
|
-
throw new UserError(`Failed to parse the deploy configuration file at ${
|
|
2445
|
+
throw new UserError(`Failed to parse the deploy configuration file at ${path2__default.relative(".", deployConfigPath)}`, {
|
|
2438
2446
|
cause: e,
|
|
2439
2447
|
telemetryMessage: false
|
|
2440
2448
|
});
|
|
2441
2449
|
}
|
|
2442
2450
|
if (!redirectedConfigPath) throw new UserError(esm_default`
|
|
2443
|
-
A deploy configuration file was found at "${
|
|
2451
|
+
A deploy configuration file was found at "${path2__default.relative(".", deployConfigPath)}".
|
|
2444
2452
|
But this is not valid - the required "configPath" property was not found.
|
|
2445
2453
|
Instead this file contains:
|
|
2446
2454
|
\`\`\`
|
|
@@ -2448,13 +2456,13 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
|
|
|
2448
2456
|
\`\`\`
|
|
2449
2457
|
`, { telemetryMessage: false });
|
|
2450
2458
|
if (!existsSync(redirectedConfigPath)) throw new UserError(esm_default`
|
|
2451
|
-
There is a deploy configuration at "${
|
|
2452
|
-
But the redirected configuration path it points to, "${
|
|
2459
|
+
There is a deploy configuration at "${path2__default.relative(".", deployConfigPath)}".
|
|
2460
|
+
But the redirected configuration path it points to, "${path2__default.relative(".", redirectedConfigPath)}", does not exist.
|
|
2453
2461
|
`, { telemetryMessage: false });
|
|
2454
2462
|
if (userConfigPath) {
|
|
2455
|
-
if (
|
|
2456
|
-
Found both a user configuration file at "${
|
|
2457
|
-
and a deploy configuration file at "${
|
|
2463
|
+
if (path2__default.join(path2__default.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !== deployConfigPath) throw new UserError(esm_default`
|
|
2464
|
+
Found both a user configuration file at "${path2__default.relative(".", userConfigPath)}"
|
|
2465
|
+
and a deploy configuration file at "${path2__default.relative(".", deployConfigPath)}".
|
|
2458
2466
|
But these do not share the same base path so it is not clear which should be used.
|
|
2459
2467
|
`, { telemetryMessage: false });
|
|
2460
2468
|
}
|
|
@@ -2886,6 +2894,10 @@ const TailConsumerSchema = z.strictObject({
|
|
|
2886
2894
|
streaming: z.boolean().optional()
|
|
2887
2895
|
});
|
|
2888
2896
|
const TriggerSchema = z.discriminatedUnion("type", [
|
|
2897
|
+
z.strictObject({
|
|
2898
|
+
type: z.literal("email"),
|
|
2899
|
+
addresses: z.array(z.string())
|
|
2900
|
+
}),
|
|
2889
2901
|
z.strictObject({
|
|
2890
2902
|
type: z.literal("fetch"),
|
|
2891
2903
|
pattern: z.string(),
|
|
@@ -3512,7 +3524,11 @@ function convertTriggers(config, result) {
|
|
|
3512
3524
|
const crons = [];
|
|
3513
3525
|
const routes = result.routes ? [...result.routes] : [];
|
|
3514
3526
|
const queueConsumers = result.queues?.consumers ? [...result.queues.consumers] : [];
|
|
3527
|
+
const addresses = result.addresses ? [...result.addresses] : [];
|
|
3515
3528
|
for (const trigger of triggers$1) switch (trigger.type) {
|
|
3529
|
+
case "email":
|
|
3530
|
+
addresses.push(...trigger.addresses);
|
|
3531
|
+
break;
|
|
3516
3532
|
case "scheduled":
|
|
3517
3533
|
crons.push(trigger.schedule);
|
|
3518
3534
|
break;
|
|
@@ -3546,6 +3562,7 @@ function convertTriggers(config, result) {
|
|
|
3546
3562
|
...result.queues ?? {},
|
|
3547
3563
|
consumers: queueConsumers
|
|
3548
3564
|
};
|
|
3565
|
+
if (addresses.length) result.addresses = addresses;
|
|
3549
3566
|
}
|
|
3550
3567
|
function convertDomains(config, result) {
|
|
3551
3568
|
if (!config.domains || config.domains.length === 0) return;
|
|
@@ -788,10 +788,27 @@ interface ScheduledTriggerOptions {
|
|
|
788
788
|
interface ScheduledTrigger extends ScheduledTriggerOptions {
|
|
789
789
|
type: "scheduled";
|
|
790
790
|
}
|
|
791
|
+
interface EmailTriggerOptions {
|
|
792
|
+
/**
|
|
793
|
+
* Inbound Email Routing addresses handled by this Worker.
|
|
794
|
+
*
|
|
795
|
+
* Each entry is a literal recipient address (e.g. `"support@example.com"`)
|
|
796
|
+
* or a `*@domain` catch-all (e.g. `"*@example.com"`).
|
|
797
|
+
*/
|
|
798
|
+
addresses: string[];
|
|
799
|
+
}
|
|
791
800
|
/**
|
|
792
|
-
*
|
|
793
|
-
*
|
|
794
|
-
|
|
801
|
+
* Email trigger — invokes this Worker for the configured Email Routing
|
|
802
|
+
* addresses.
|
|
803
|
+
*/
|
|
804
|
+
interface EmailTrigger extends EmailTriggerOptions {
|
|
805
|
+
type: "email";
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Event triggers — fetch routes, queue consumers, cron schedules, and Email
|
|
809
|
+
* Routing addresses — that invoke this Worker. Construct entries with
|
|
810
|
+
* `triggers.fetch(...)`, `triggers.queue(...)`, `triggers.scheduled(...)`, or
|
|
811
|
+
* `triggers.email(...)`.
|
|
795
812
|
*
|
|
796
813
|
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers
|
|
797
814
|
*/
|
|
@@ -815,6 +832,11 @@ interface Triggers {
|
|
|
815
832
|
* More details here https://developers.cloudflare.com/workers/platform/cron-triggers
|
|
816
833
|
*/
|
|
817
834
|
scheduled(options: ScheduledTriggerOptions): ScheduledTrigger;
|
|
835
|
+
/**
|
|
836
|
+
* Email trigger — invokes this Worker for the configured Email Routing
|
|
837
|
+
* addresses.
|
|
838
|
+
*/
|
|
839
|
+
email(options: EmailTriggerOptions): EmailTrigger;
|
|
818
840
|
}
|
|
819
841
|
/**
|
|
820
842
|
* Triggers builder for configuring event triggers.
|
|
@@ -829,6 +851,7 @@ interface Triggers {
|
|
|
829
851
|
* triggers.queue({ name: "my-queue" }),
|
|
830
852
|
* triggers.scheduled({ schedule: "0 * * * *" }),
|
|
831
853
|
* triggers.scheduled({ schedule: "30 0 * * *" }),
|
|
854
|
+
* triggers.email({ addresses: ["support@example.com"] }),
|
|
832
855
|
* ],
|
|
833
856
|
* });
|
|
834
857
|
* ```
|
|
@@ -991,7 +1014,7 @@ type Binding = AgentMemoryBinding | AiBinding | AiSearchBinding | AiSearchNamesp
|
|
|
991
1014
|
/**
|
|
992
1015
|
* Union of all trigger definitions accepted in `triggers`.
|
|
993
1016
|
*/
|
|
994
|
-
type Trigger = FetchTrigger | QueueConsumerTrigger | ScheduledTrigger;
|
|
1017
|
+
type Trigger = EmailTrigger | FetchTrigger | QueueConsumerTrigger | ScheduledTrigger;
|
|
995
1018
|
/**
|
|
996
1019
|
* Union of all export definitions accepted in `exports`. Worker entries
|
|
997
1020
|
* configure WorkerEntrypoint exports. Durable Object entries configure live
|
|
@@ -1073,9 +1096,10 @@ interface UserConfig {
|
|
|
1073
1096
|
*/
|
|
1074
1097
|
domains?: string[];
|
|
1075
1098
|
/**
|
|
1076
|
-
* Event triggers — fetch routes, queue consumers,
|
|
1099
|
+
* Event triggers — fetch routes, queue consumers, cron schedules, and Email
|
|
1100
|
+
* Routing addresses
|
|
1077
1101
|
* — that invoke this Worker. Construct entries with `triggers.fetch(...)`,
|
|
1078
|
-
* `triggers.queue(...)`, or `triggers.
|
|
1102
|
+
* `triggers.queue(...)`, `triggers.scheduled(...)`, or `triggers.email(...)`.
|
|
1079
1103
|
*
|
|
1080
1104
|
* For reference, see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers
|
|
1081
1105
|
*/
|
|
@@ -1521,4 +1545,4 @@ type InferMainModule<TUnwrappedConfig$1> = TUnwrappedConfig$1 extends {
|
|
|
1521
1545
|
entrypoint: infer TModule extends WorkerModule;
|
|
1522
1546
|
} ? TModule : DefaultModule;
|
|
1523
1547
|
//#endregion
|
|
1524
|
-
export {
|
|
1548
|
+
export { StreamBinding$1 as $, AnalyticsEngineDatasetBinding as A, ImagesBinding$1 as B, ScheduledTrigger as C, AiBinding as D, AgentMemoryBinding as E, D1Binding as F, MtlsCertificateBinding as G, KvBinding as H, DispatchNamespaceBinding as I, R2Binding as J, PipelineBinding as K, DurableObjectBinding as L, AssetsBinding as M, Bindings as N, AiSearchBinding as O, BrowserBinding as P, SendEmailBinding as Q, FlagshipBinding as R, QueueConsumerTrigger as S, triggers as T, LogfwdrBinding as U, JsonBinding as V, MediaBinding$1 as W, SecretBinding as X, RateLimitBinding as Y, SecretsStoreSecretBinding as Z, WorkerEntrypointExport as _, bindings as _t, ConfigContext as a, TypedQueueBinding as at, EmailTrigger as b, defineWorker as c, UnsafeBinding as ct, DurableObjectCreatedExport as d, VpcNetworkBinding as dt, TextBinding as et, DurableObjectDeletedExport as f, VpcServiceBinding as ft, Exports as g, WorkflowBinding as gt, DurableObjectTransferredExport as h, WorkerLoaderBinding as ht, UnwrapConfig as i, TypedPipelineBinding as it, ArtifactsBinding as j, AiSearchNamespaceBinding as k, resolveWorkerDefinition as l, VectorizeBinding as lt, DurableObjectRenamedExport as m, WorkerBinding as mt, InferEnv as n, TypedDurableObjectBinding as nt, TypedWorkerDefinition as o, TypedWorkerBinding as ot, DurableObjectExpectingTransferExport as p, WebSearchBinding as pt, QueueBinding as q, InferMainModule as r, TypedKvBinding as rt, UserConfigExport as s, TypedWorkflowBinding as st, InferDurableNamespaces as t, TypedAiBinding as tt, UserConfig as u, VersionMetadataBinding as ut, WorkerEntrypointExportOptions as v, Triggers as w, FetchTrigger as x, exports as y, HyperdriveBinding as z };
|
|
@@ -145,6 +145,7 @@ const bindings = {
|
|
|
145
145
|
* triggers.queue({ name: "my-queue" }),
|
|
146
146
|
* triggers.scheduled({ schedule: "0 * * * *" }),
|
|
147
147
|
* triggers.scheduled({ schedule: "30 0 * * *" }),
|
|
148
|
+
* triggers.email({ addresses: ["support@example.com"] }),
|
|
148
149
|
* ],
|
|
149
150
|
* });
|
|
150
151
|
* ```
|
|
@@ -161,6 +162,10 @@ const triggers = {
|
|
|
161
162
|
scheduled: (options) => ({
|
|
162
163
|
type: "scheduled",
|
|
163
164
|
...options
|
|
165
|
+
}),
|
|
166
|
+
email: (options) => ({
|
|
167
|
+
type: "email",
|
|
168
|
+
...options
|
|
164
169
|
})
|
|
165
170
|
};
|
|
166
171
|
|
package/dist/public.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, Bindings, BrowserBinding, ConfigContext, D1Binding, DispatchNamespaceBinding, DurableObjectBinding, DurableObjectCreatedExport, DurableObjectDeletedExport, DurableObjectExpectingTransferExport, DurableObjectRenamedExport, DurableObjectTransferredExport, Exports, FetchTrigger, FlagshipBinding, HyperdriveBinding, ImagesBinding, InferDurableNamespaces, InferEnv, InferMainModule, JsonBinding, KvBinding, LogfwdrBinding, MediaBinding, MtlsCertificateBinding, PipelineBinding, QueueBinding, QueueConsumerTrigger, R2Binding, RateLimitBinding, ScheduledTrigger, SecretBinding, SecretsStoreSecretBinding, SendEmailBinding, StreamBinding, TextBinding, Triggers, TypedAiBinding, TypedDurableObjectBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, TypedWorkerBinding, TypedWorkerDefinition, TypedWorkflowBinding, UnsafeBinding, UnwrapConfig, UserConfig, UserConfigExport, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WebSearchBinding, WorkerBinding, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerLoaderBinding, WorkflowBinding, bindings, defineWorker, exports, triggers };
|
|
1
|
+
import { $ as StreamBinding, A as AnalyticsEngineDatasetBinding, B as ImagesBinding, C as ScheduledTrigger, D as AiBinding, E as AgentMemoryBinding, F as D1Binding, G as MtlsCertificateBinding, H as KvBinding, I as DispatchNamespaceBinding, J as R2Binding, K as PipelineBinding, L as DurableObjectBinding, M as AssetsBinding, N as Bindings, O as AiSearchBinding, P as BrowserBinding, Q as SendEmailBinding, R as FlagshipBinding, S as QueueConsumerTrigger, T as triggers, U as LogfwdrBinding, V as JsonBinding, W as MediaBinding, X as SecretBinding, Y as RateLimitBinding, Z as SecretsStoreSecretBinding, _ as WorkerEntrypointExport, _t as bindings, a as ConfigContext, at as TypedQueueBinding, b as EmailTrigger, c as defineWorker, ct as UnsafeBinding, d as DurableObjectCreatedExport, dt as VpcNetworkBinding, et as TextBinding, f as DurableObjectDeletedExport, ft as VpcServiceBinding, g as Exports, gt as WorkflowBinding, h as DurableObjectTransferredExport, ht as WorkerLoaderBinding, i as UnwrapConfig, it as TypedPipelineBinding, j as ArtifactsBinding, k as AiSearchNamespaceBinding, lt as VectorizeBinding, m as DurableObjectRenamedExport, mt as WorkerBinding, n as InferEnv, nt as TypedDurableObjectBinding, o as TypedWorkerDefinition, ot as TypedWorkerBinding, p as DurableObjectExpectingTransferExport, pt as WebSearchBinding, q as QueueBinding, r as InferMainModule, rt as TypedKvBinding, s as UserConfigExport, st as TypedWorkflowBinding, t as InferDurableNamespaces, tt as TypedAiBinding, u as UserConfig, ut as VersionMetadataBinding, v as WorkerEntrypointExportOptions, w as Triggers, x as FetchTrigger, y as exports, z as HyperdriveBinding } from "./public-m7PNfSwY.mjs";
|
|
2
|
+
export { AgentMemoryBinding, AiBinding, AiSearchBinding, AiSearchNamespaceBinding, AnalyticsEngineDatasetBinding, ArtifactsBinding, AssetsBinding, Bindings, BrowserBinding, ConfigContext, 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, StreamBinding, TextBinding, Triggers, TypedAiBinding, TypedDurableObjectBinding, TypedKvBinding, TypedPipelineBinding, TypedQueueBinding, TypedWorkerBinding, TypedWorkerDefinition, TypedWorkflowBinding, UnsafeBinding, UnwrapConfig, UserConfig, UserConfigExport, VectorizeBinding, VersionMetadataBinding, VpcNetworkBinding, VpcServiceBinding, WebSearchBinding, WorkerBinding, WorkerEntrypointExport, WorkerEntrypointExportOptions, WorkerLoaderBinding, WorkflowBinding, bindings, defineWorker, exports, triggers };
|
package/dist/public.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
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.20260714.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
|
-
"@cloudflare/workers-
|
|
40
|
-
"@cloudflare/workers-
|
|
39
|
+
"@cloudflare/workers-utils": "0.27.0",
|
|
40
|
+
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
41
41
|
},
|
|
42
42
|
"workers-sdk": {
|
|
43
43
|
"prerelease": true
|