@cloudflare/vitest-plugin 1.1.8 → 1.1.10
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/pool/index.mjs +914 -97
- package/dist/pool/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/pool/index.mjs
CHANGED
|
@@ -325,7 +325,7 @@ function createFatalError$1(message, isJson, options) {
|
|
|
325
325
|
__name$3(createFatalError$1, "createFatalError");
|
|
326
326
|
|
|
327
327
|
//#endregion
|
|
328
|
-
//#region ../workers-utils/dist/chunk-
|
|
328
|
+
//#region ../workers-utils/dist/chunk-JGKSDUFK.mjs
|
|
329
329
|
function hasKnownExportType(entry) {
|
|
330
330
|
const type = entry?.type;
|
|
331
331
|
return type === "durable-object" || type === "worker";
|
|
@@ -361,6 +361,17 @@ function getDurableObjectContainerApps(containers) {
|
|
|
361
361
|
return Array.isArray(containers) ? containers.filter(isDurableObjectContainerApp) : [];
|
|
362
362
|
}
|
|
363
363
|
__name$3(getDurableObjectContainerApps, "getDurableObjectContainerApps");
|
|
364
|
+
function getResolvedDurableObjectContainerApps(containers, exports$1) {
|
|
365
|
+
return getDurableObjectContainerApps(containers).map((container) => {
|
|
366
|
+
const className = resolveContainerClassName(container, exports$1);
|
|
367
|
+
if (typeof className !== "string" || className.length === 0) throw new UserError$1(`The container "${container.name}" is not linked to a Durable Object. Either set "containers.class_name", or reference this container from a Durable Object's \`exports\` entry via its "container" field.`, { telemetryMessage: "durable object container class unresolved" });
|
|
368
|
+
return {
|
|
369
|
+
...container,
|
|
370
|
+
class_name: className
|
|
371
|
+
};
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
__name$3(getResolvedDurableObjectContainerApps, "getResolvedDurableObjectContainerApps");
|
|
364
375
|
function getContainerNameToClassNameMap(exports$1) {
|
|
365
376
|
const containerNameToClassName = /* @__PURE__ */ new Map();
|
|
366
377
|
for (const [className, entry] of Object.entries(getDurableObjectExports(exports$1))) if ("container" in entry && typeof entry.container === "string" && !containerNameToClassName.has(entry.container)) containerNameToClassName.set(entry.container, className);
|
|
@@ -413,9 +424,9 @@ function getDurableObjectClassNameToUseSQLiteMap(migrations, exports$1) {
|
|
|
413
424
|
return durableObjectClassNameToUseSQLiteMap;
|
|
414
425
|
}
|
|
415
426
|
__name$3(getDurableObjectClassNameToUseSQLiteMap, "getDurableObjectClassNameToUseSQLiteMap");
|
|
416
|
-
function validateDurableObjectContainerApplications(config$1) {
|
|
427
|
+
function validateDurableObjectContainerApplications(config$1, containers = getDurableObjectContainerApps(config$1.containers)) {
|
|
417
428
|
const allDOs = getDurableObjectClassNameToUseSQLiteMap(config$1.migrations, config$1.exports);
|
|
418
|
-
for (const container of
|
|
429
|
+
for (const container of getResolvedDurableObjectContainerApps(containers, config$1.exports)) {
|
|
419
430
|
const maybeBoundDO = config$1.durable_objects.bindings.find((durableObject) => durableObject.class_name === container.class_name);
|
|
420
431
|
const useSQLite = allDOs.get(container.class_name);
|
|
421
432
|
if (useSQLite === void 0 && maybeBoundDO === void 0) throw new UserError$1(`The container class_name ${container.class_name} does not match any durable object class_name defined in your Wrangler config file. Note that the durable object must be defined in the same script as the container.`, { telemetryMessage: "no DO defined that matches container class_name" });
|
|
@@ -2383,7 +2394,12 @@ var APIError = class extends ParseError {
|
|
|
2383
2394
|
return this.#status;
|
|
2384
2395
|
}
|
|
2385
2396
|
isGatewayError() {
|
|
2386
|
-
if (this.#status !== void 0) return [
|
|
2397
|
+
if (this.#status !== void 0) return [
|
|
2398
|
+
502,
|
|
2399
|
+
503,
|
|
2400
|
+
504,
|
|
2401
|
+
524
|
|
2402
|
+
].includes(this.#status);
|
|
2387
2403
|
return false;
|
|
2388
2404
|
}
|
|
2389
2405
|
isRetryable() {
|
|
@@ -2787,8 +2803,8 @@ function formatConfigSnippet(snippet, configPath, formatted = true) {
|
|
|
2787
2803
|
__name$3(formatConfigSnippet, "formatConfigSnippet");
|
|
2788
2804
|
|
|
2789
2805
|
//#endregion
|
|
2790
|
-
//#region ../workers-utils/dist/chunk-
|
|
2791
|
-
var DEFAULT_COMPAT_DATE = "2026-09-
|
|
2806
|
+
//#region ../workers-utils/dist/chunk-5H6GBNUC.mjs
|
|
2807
|
+
var DEFAULT_COMPAT_DATE = "2026-09-15";
|
|
2792
2808
|
function assertNever(_value) {}
|
|
2793
2809
|
__name$3(assertNever, "assertNever");
|
|
2794
2810
|
function mapWorkerMetadataBindings(bindings) {
|
|
@@ -2960,9 +2976,6 @@ function mapWorkerMetadataBindings(bindings) {
|
|
|
2960
2976
|
instance_name: binding.instance_name
|
|
2961
2977
|
}];
|
|
2962
2978
|
break;
|
|
2963
|
-
case "websearch":
|
|
2964
|
-
configObj.websearch = { binding: binding.name };
|
|
2965
|
-
break;
|
|
2966
2979
|
case "agent_memory":
|
|
2967
2980
|
configObj.agent_memory = [...configObj.agent_memory ?? [], {
|
|
2968
2981
|
binding: binding.name,
|
|
@@ -27489,7 +27502,6 @@ var defaultWranglerConfig = {
|
|
|
27489
27502
|
vectorize: [],
|
|
27490
27503
|
ai_search_namespaces: [],
|
|
27491
27504
|
ai_search: [],
|
|
27492
|
-
websearch: void 0,
|
|
27493
27505
|
agent_memory: [],
|
|
27494
27506
|
hyperdrive: [],
|
|
27495
27507
|
workflows: [],
|
|
@@ -41567,7 +41579,6 @@ var friendlyBindingNames = {
|
|
|
41567
41579
|
vectorize: "Vectorize Index",
|
|
41568
41580
|
ai_search_namespaces: "AI Search Namespace",
|
|
41569
41581
|
ai_search: "AI Search Instance",
|
|
41570
|
-
websearch: "Web Search",
|
|
41571
41582
|
agent_memory: "Agent Memory",
|
|
41572
41583
|
hyperdrive: "Hyperdrive Config",
|
|
41573
41584
|
r2_buckets: "R2 Bucket",
|
|
@@ -41620,7 +41631,6 @@ var bindingTypeFriendlyNames = {
|
|
|
41620
41631
|
vectorize: "Vectorize Index",
|
|
41621
41632
|
ai_search_namespace: "AI Search Namespace",
|
|
41622
41633
|
ai_search: "AI Search Instance",
|
|
41623
|
-
websearch: "Web Search",
|
|
41624
41634
|
agent_memory: "Agent Memory",
|
|
41625
41635
|
hyperdrive: "Hyperdrive Config",
|
|
41626
41636
|
service: "Worker",
|
|
@@ -42123,7 +42133,6 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
|
42123
42133
|
vectorize: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "vectorize", validateBindingArray(envName, validateVectorizeBinding), []),
|
|
42124
42134
|
ai_search_namespaces: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "ai_search_namespaces", validateBindingArray(envName, validateAISearchNamespaceBinding), []),
|
|
42125
42135
|
ai_search: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "ai_search", validateBindingArray(envName, validateAISearchBinding), []),
|
|
42126
|
-
websearch: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "websearch", validateNamedSimpleBinding(envName), void 0),
|
|
42127
42136
|
agent_memory: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "agent_memory", validateBindingArray(envName, validateAgentMemoryBinding), []),
|
|
42128
42137
|
hyperdrive: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "hyperdrive", validateBindingArray(envName, validateHyperdriveBinding), []),
|
|
42129
42138
|
services: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "services", validateBindingArray(envName, validateServiceBinding), []),
|
|
@@ -42165,7 +42174,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
|
42165
42174
|
warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, environment.durable_objects, environment.migrations, environment.exports, configPath);
|
|
42166
42175
|
errorIfMigrationsAndExportsBothSet(diagnostics, environment.migrations, environment.exports);
|
|
42167
42176
|
const containersDeclaredElsewhere = rawConfig !== void 0 ? rawConfig.containers !== void 0 : Object.values("env" in rawEnv ? rawEnv.env ?? {} : {}).some((rawNamedEnv) => rawNamedEnv?.containers !== void 0);
|
|
42168
|
-
validateContainerExportLinks(diagnostics, environment.containers, environment.exports, containersDeclaredElsewhere);
|
|
42177
|
+
validateContainerExportLinks$1(diagnostics, environment.containers, environment.exports, containersDeclaredElsewhere);
|
|
42169
42178
|
if (envName !== "top level") validateAdditionalProperties(diagnostics, "env." + envName, Object.keys(rawEnv), Object.keys(environment));
|
|
42170
42179
|
return environment;
|
|
42171
42180
|
}
|
|
@@ -42663,7 +42672,6 @@ var validateUnsafeBinding = /* @__PURE__ */ __name$3((diagnostics, field, value)
|
|
|
42663
42672
|
"ai",
|
|
42664
42673
|
"ai_search_namespace",
|
|
42665
42674
|
"ai_search",
|
|
42666
|
-
"websearch",
|
|
42667
42675
|
"agent_memory",
|
|
42668
42676
|
"kv_namespace",
|
|
42669
42677
|
"durable_object_namespace",
|
|
@@ -42809,7 +42817,18 @@ function validateDurableObjectContainerImages(diagnostics, field, images, compli
|
|
|
42809
42817
|
valid = false;
|
|
42810
42818
|
}
|
|
42811
42819
|
}
|
|
42812
|
-
const
|
|
42820
|
+
const isDockerfileBuild = hasDockerfile && !hasImage;
|
|
42821
|
+
if (isDockerfileBuild) {
|
|
42822
|
+
if (image.build_context !== void 0 && (typeof image.build_context !== "string" || image.build_context.length === 0)) {
|
|
42823
|
+
diagnostics.errors.push(`"${imageField}.build_context" must be a non-empty string.`);
|
|
42824
|
+
valid = false;
|
|
42825
|
+
}
|
|
42826
|
+
if (image.build_vars !== void 0 && (typeof image.build_vars !== "object" || image.build_vars === null || Array.isArray(image.build_vars) || Object.values(image.build_vars).some((value) => typeof value !== "string"))) {
|
|
42827
|
+
diagnostics.errors.push(`"${imageField}.build_vars" must be an object with string values.`);
|
|
42828
|
+
valid = false;
|
|
42829
|
+
}
|
|
42830
|
+
}
|
|
42831
|
+
const unsupportedFields = Object.keys(image).filter((property) => property !== "dockerfile" && property !== "image" && !(isDockerfileBuild && (property === "build_context" || property === "build_vars")));
|
|
42813
42832
|
if (unsupportedFields.length > 0) {
|
|
42814
42833
|
diagnostics.errors.push(`Unexpected fields found in ${imageField} field: ${unsupportedFields.map((property) => `"${property}"`).join(", ")}`);
|
|
42815
42834
|
valid = false;
|
|
@@ -42818,6 +42837,24 @@ function validateDurableObjectContainerImages(diagnostics, field, images, compli
|
|
|
42818
42837
|
return valid;
|
|
42819
42838
|
}
|
|
42820
42839
|
__name$3(validateDurableObjectContainerImages, "validateDurableObjectContainerImages");
|
|
42840
|
+
function validateDurableObjectContainerUnsafe(diagnostics, field, value) {
|
|
42841
|
+
if (value === void 0) return;
|
|
42842
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
42843
|
+
diagnostics.errors.push(`"${field}" should be an object.`);
|
|
42844
|
+
return;
|
|
42845
|
+
}
|
|
42846
|
+
const unsafe = value;
|
|
42847
|
+
const configuration = unsafe.configuration;
|
|
42848
|
+
if (Object.keys(unsafe).some((key) => key !== "configuration") || configuration !== void 0 && (typeof configuration !== "object" || configuration === null || Array.isArray(configuration) || Object.keys(configuration).some((key) => key !== "experimental_flags"))) {
|
|
42849
|
+
diagnostics.errors.push(`Only "${field}.configuration.experimental_flags" is supported for Durable Object-managed Containers.`);
|
|
42850
|
+
return;
|
|
42851
|
+
}
|
|
42852
|
+
if (configuration !== void 0) {
|
|
42853
|
+
const flags = configuration.experimental_flags;
|
|
42854
|
+
if (flags !== void 0 && (!Array.isArray(flags) || flags.some((flag) => typeof flag !== "string"))) diagnostics.errors.push(`"${field}.configuration.experimental_flags" should be an array of strings.`);
|
|
42855
|
+
}
|
|
42856
|
+
}
|
|
42857
|
+
__name$3(validateDurableObjectContainerUnsafe, "validateDurableObjectContainerUnsafe");
|
|
42821
42858
|
function validateContainerApp(envName, topLevelName, configPath, options = {}) {
|
|
42822
42859
|
const { generateDefaultName = true } = options;
|
|
42823
42860
|
return (diagnostics, field, value, config2) => {
|
|
@@ -42829,11 +42866,10 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
|
|
|
42829
42866
|
for (const containerAppOptional of value) {
|
|
42830
42867
|
const isDurableObjectManaged = containerAppOptional.scheduling_policy === "durable_object";
|
|
42831
42868
|
const hasValidDurableObjectClassName = typeof containerAppOptional.class_name === "string" && containerAppOptional.class_name.length > 0;
|
|
42832
|
-
|
|
42833
|
-
|
|
42834
|
-
} else validateOptionalProperty(diagnostics, field, "class_name", containerAppOptional.class_name, "string");
|
|
42869
|
+
validateOptionalProperty(diagnostics, field, "class_name", containerAppOptional.class_name, "string");
|
|
42870
|
+
if (isDurableObjectManaged && containerAppOptional.class_name === "") diagnostics.errors.push(`"containers.class_name" must be a non-empty string when specified for a Durable Object-managed Container.`);
|
|
42835
42871
|
validateOptionalProperty(diagnostics, field, "name", containerAppOptional.name, "string");
|
|
42836
|
-
if (generateDefaultName && !containerAppOptional.name && (!isDurableObjectManaged || hasValidDurableObjectClassName)) if (containerAppOptional.class_name === void 0) diagnostics.errors.push(`"containers.name" is required when "containers.class_name" is not defined, because there is no class name to derive a default name from. Either name this container and reference it from a Durable Object's \`exports\` entry, or set "containers.class_name".`);
|
|
42872
|
+
if (generateDefaultName && !containerAppOptional.name && (!isDurableObjectManaged || containerAppOptional.class_name === void 0 || hasValidDurableObjectClassName)) if (containerAppOptional.class_name === void 0) diagnostics.errors.push(`"containers.name" is required when "containers.class_name" is not defined, because there is no class name to derive a default name from. Either name this container and reference it from a Durable Object's \`exports\` entry, or set "containers.class_name".`);
|
|
42837
42873
|
else if (!topLevelName) diagnostics.errors.push(`Must have either a top level "name" and "containers.class_name" field defined, or have field "containers.name" defined.`);
|
|
42838
42874
|
else {
|
|
42839
42875
|
let name = `${topLevelName}-${containerAppOptional.class_name}`;
|
|
@@ -42842,13 +42878,18 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
|
|
|
42842
42878
|
}
|
|
42843
42879
|
if (isDurableObjectManaged) {
|
|
42844
42880
|
validateDurableObjectContainerImages(diagnostics, `${field}.images`, containerAppOptional.images, options.complianceConfig);
|
|
42881
|
+
validateContainerObservability(diagnostics, `${field}.observability`, containerAppOptional.observability, config2);
|
|
42882
|
+
if (containerAppOptional.observability?.target_instance_count !== void 0 || containerAppOptional.observability?.target_instance_percentage !== void 0) diagnostics.errors.push(`"${field}.observability" only supports enabling or disabling logs for Durable Object-managed Containers; instance targeting is not supported.`);
|
|
42883
|
+
validateDurableObjectContainerUnsafe(diagnostics, `${field}.unsafe`, containerAppOptional.unsafe);
|
|
42845
42884
|
const unsupportedFields = Object.keys(containerAppOptional).filter((key) => ![
|
|
42846
42885
|
"name",
|
|
42847
42886
|
"class_name",
|
|
42848
42887
|
"scheduling_policy",
|
|
42849
|
-
"images"
|
|
42888
|
+
"images",
|
|
42889
|
+
"observability",
|
|
42890
|
+
"unsafe"
|
|
42850
42891
|
].includes(key));
|
|
42851
|
-
if (unsupportedFields.length > 0) diagnostics.errors.push(`Unsupported fields for Durable Object-managed Containers in ${field}: ${unsupportedFields.map((key) => `"${key}"`).join(",")}. Only "name", "class_name", "scheduling_policy", and "
|
|
42892
|
+
if (unsupportedFields.length > 0) diagnostics.errors.push(`Unsupported fields for Durable Object-managed Containers in ${field}: ${unsupportedFields.map((key) => `"${key}"`).join(",")}. Only "name", "class_name", "scheduling_policy", "images", "observability", and restricted "unsafe" settings are supported.`);
|
|
42852
42893
|
continue;
|
|
42853
42894
|
}
|
|
42854
42895
|
if (!containerAppOptional.configuration?.image && !containerAppOptional.image) diagnostics.errors.push(`"containers.image" field must be defined for each container app. This should be the path to your Dockerfile or an image URI pointing to the Cloudflare registry.`);
|
|
@@ -43919,6 +43960,8 @@ var validatePreviewsConfig = /* @__PURE__ */ __name$3((envName, configPath) => (
|
|
|
43919
43960
|
"d1_databases",
|
|
43920
43961
|
"r2_buckets",
|
|
43921
43962
|
"vectorize",
|
|
43963
|
+
"ai_search_namespaces",
|
|
43964
|
+
"ai_search",
|
|
43922
43965
|
"hyperdrive",
|
|
43923
43966
|
"services",
|
|
43924
43967
|
"analytics_engine_datasets",
|
|
@@ -43957,6 +44000,8 @@ var validatePreviewsConfig = /* @__PURE__ */ __name$3((envName, configPath) => (
|
|
|
43957
44000
|
isValid = validateBindingArray(envName, validateD1Binding)(diagnostics, `${field}.d1_databases`, previews.d1_databases, void 0) && isValid;
|
|
43958
44001
|
isValid = validateBindingArray(envName, validateR2Binding)(diagnostics, `${field}.r2_buckets`, previews.r2_buckets, void 0) && isValid;
|
|
43959
44002
|
isValid = validateBindingArray(envName, validateVectorizeBinding)(diagnostics, `${field}.vectorize`, previews.vectorize, void 0) && isValid;
|
|
44003
|
+
isValid = validateBindingArray(envName, validateAISearchNamespaceBinding)(diagnostics, `${field}.ai_search_namespaces`, previews.ai_search_namespaces, void 0) && isValid;
|
|
44004
|
+
isValid = validateBindingArray(envName, validateAISearchBinding)(diagnostics, `${field}.ai_search`, previews.ai_search, void 0) && isValid;
|
|
43960
44005
|
isValid = validateBindingArray(envName, validateHyperdriveBinding)(diagnostics, `${field}.hyperdrive`, previews.hyperdrive, void 0) && isValid;
|
|
43961
44006
|
isValid = validateBindingArray(envName, validateServiceBinding)(diagnostics, `${field}.services`, previews.services, void 0) && isValid;
|
|
43962
44007
|
isValid = validateBindingArray(envName, validateAnalyticsEngineBinding)(diagnostics, `${field}.analytics_engine_datasets`, previews.analytics_engine_datasets, void 0) && isValid;
|
|
@@ -44375,7 +44420,7 @@ function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$1)
|
|
|
44375
44420
|
if (migrations.length > 0 && exports$1 !== void 0 && Object.values(exports$1).some((entry) => entry.type === "durable-object")) diagnostics.errors.push(`\`migrations\` and \`exports\` are mutually exclusive. Choose one or the other to declare your Durable Object lifecycle, but not both.`);
|
|
44376
44421
|
}
|
|
44377
44422
|
__name$3(errorIfMigrationsAndExportsBothSet, "errorIfMigrationsAndExportsBothSet");
|
|
44378
|
-
function validateContainerExportLinks(diagnostics, containers, exports$1, containersDeclaredElsewhere) {
|
|
44423
|
+
function validateContainerExportLinks$1(diagnostics, containers, exports$1, containersDeclaredElsewhere) {
|
|
44379
44424
|
if (containers !== void 0 && !Array.isArray(containers)) return;
|
|
44380
44425
|
if (containers === void 0 && containersDeclaredElsewhere) return;
|
|
44381
44426
|
const containersByName = /* @__PURE__ */ new Map();
|
|
@@ -44435,7 +44480,7 @@ function validateContainerExportLinks(diagnostics, containers, exports$1, contai
|
|
|
44435
44480
|
if (referencedContainerName === void 0 && exportEntry !== void 0 && "storage" in exportEntry && exportEntry.storage === "legacy-kv") diagnostics.errors.push(`The container "${container.name}" sets "class_name" to "${container.class_name}", but "exports.${container.class_name}.storage" is "legacy-kv". Containers are not supported on Durable Objects using the "legacy-kv" storage backend.`);
|
|
44436
44481
|
}
|
|
44437
44482
|
}
|
|
44438
|
-
__name$3(validateContainerExportLinks, "validateContainerExportLinks");
|
|
44483
|
+
__name$3(validateContainerExportLinks$1, "validateContainerExportLinks");
|
|
44439
44484
|
var validatePythonModules = /* @__PURE__ */ __name$3((diagnostics, field, value, topLevelEnv) => {
|
|
44440
44485
|
if (value === void 0) return true;
|
|
44441
44486
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
@@ -44517,7 +44562,6 @@ var BINDING_LOCAL_SUPPORT = {
|
|
|
44517
44562
|
flagship: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
44518
44563
|
vpc_service: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
44519
44564
|
vpc_network: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
44520
|
-
websearch: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator",
|
|
44521
44565
|
agent_memory: "DO-NOT-USE-this-resource-will-never-have-a-local-simulator"
|
|
44522
44566
|
};
|
|
44523
44567
|
function getBindingLocalSupport(type) {
|
|
@@ -44875,14 +44919,6 @@ function convertConfigToBindings(config2, options) {
|
|
|
44875
44919
|
...x
|
|
44876
44920
|
};
|
|
44877
44921
|
break;
|
|
44878
|
-
case "websearch": {
|
|
44879
|
-
const { binding,...x } = info;
|
|
44880
|
-
output[binding] = {
|
|
44881
|
-
type: "websearch",
|
|
44882
|
-
...x
|
|
44883
|
-
};
|
|
44884
|
-
break;
|
|
44885
|
-
}
|
|
44886
44922
|
case "agent_memory":
|
|
44887
44923
|
for (const { binding,...x } of info) output[binding] = {
|
|
44888
44924
|
type: "agent_memory",
|
|
@@ -45028,7 +45064,6 @@ function printBindings(bindings, options) {
|
|
|
45028
45064
|
const vectorize = extractBindingsOfType("vectorize", bindings);
|
|
45029
45065
|
const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings);
|
|
45030
45066
|
const ai_search = extractBindingsOfType("ai_search", bindings);
|
|
45031
|
-
const websearch = extractBindingsOfType("websearch", bindings);
|
|
45032
45067
|
const agent_memory = extractBindingsOfType("agent_memory", bindings);
|
|
45033
45068
|
const hyperdrive = extractBindingsOfType("hyperdrive", bindings);
|
|
45034
45069
|
const r2_buckets = extractBindingsOfType("r2_bucket", bindings);
|
|
@@ -45168,12 +45203,6 @@ function printBindings(bindings, options) {
|
|
|
45168
45203
|
value: instance_name ? String(instance_name) : void 0,
|
|
45169
45204
|
mode: getMode({ isSimulatedLocally: false })
|
|
45170
45205
|
})));
|
|
45171
|
-
if (websearch.length > 0) output.push(...websearch.map(({ binding }) => ({
|
|
45172
|
-
name: binding,
|
|
45173
|
-
type: getBindingTypeFriendlyName("websearch"),
|
|
45174
|
-
value: void 0,
|
|
45175
|
-
mode: getMode({ isSimulatedLocally: false })
|
|
45176
|
-
})));
|
|
45177
45206
|
if (agent_memory.length > 0) output.push(...agent_memory.map(({ binding, namespace }) => ({
|
|
45178
45207
|
name: binding,
|
|
45179
45208
|
type: getBindingTypeFriendlyName("agent_memory"),
|
|
@@ -45462,7 +45491,7 @@ ${allTailConsumers.map(({ service, streaming }) => {
|
|
|
45462
45491
|
let containersTitle = "The following containers are available:";
|
|
45463
45492
|
if (context.name && isMultiWorker) containersTitle = `The following containers are available from ${source_default.blue(context.name)}:`;
|
|
45464
45493
|
log$2(`${containersTitle}
|
|
45465
|
-
${containers.map((container) => container.scheduling_policy === "durable_object" ? `- ${container.class_name} (durable_object)` : `- ${container.name} (${container.image})`).join("\n")}`);
|
|
45494
|
+
${containers.map((container) => container.scheduling_policy === "durable_object" ? `- ${container.class_name ?? container.name} (durable_object)` : `- ${container.name} (${container.image})`).join("\n")}`);
|
|
45466
45495
|
log$2("");
|
|
45467
45496
|
}
|
|
45468
45497
|
if (context.unsafeMetadata) {
|
|
@@ -54836,7 +54865,7 @@ function scrubEncryptedCredentials(options) {
|
|
|
54836
54865
|
__name$2(scrubEncryptedCredentials, "scrubEncryptedCredentials");
|
|
54837
54866
|
|
|
54838
54867
|
//#endregion
|
|
54839
|
-
//#region ../workers-auth/dist/chunk-
|
|
54868
|
+
//#region ../workers-auth/dist/chunk-T63LVVAX.mjs
|
|
54840
54869
|
function createPreferences(getConfigPath) {
|
|
54841
54870
|
function getUserPreferencesPath() {
|
|
54842
54871
|
return path.resolve(getConfigPath(), "preferences.json");
|
|
@@ -55615,7 +55644,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
55615
55644
|
return oauthFlow.requireApiToken();
|
|
55616
55645
|
}
|
|
55617
55646
|
__name$2(requireApiToken$1, "requireApiToken");
|
|
55618
|
-
function
|
|
55647
|
+
function withLoginDefaults(complianceConfig, props) {
|
|
55619
55648
|
return {
|
|
55620
55649
|
complianceConfig,
|
|
55621
55650
|
scopes: props?.scopes ?? descriptor.getDefaultScopeKeys(),
|
|
@@ -55623,12 +55652,12 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
55623
55652
|
callbackHost: props?.callbackHost,
|
|
55624
55653
|
callbackPort: props?.callbackPort,
|
|
55625
55654
|
profile: props?.profile,
|
|
55626
|
-
device: props?.device
|
|
55655
|
+
device: props?.device ?? descriptor.useDeviceFlowByDefault ?? false
|
|
55627
55656
|
};
|
|
55628
55657
|
}
|
|
55629
|
-
__name$2(
|
|
55658
|
+
__name$2(withLoginDefaults, "withLoginDefaults");
|
|
55630
55659
|
async function login(complianceConfig, props) {
|
|
55631
|
-
return oauthFlow.login(
|
|
55660
|
+
return oauthFlow.login(withLoginDefaults(complianceConfig, props));
|
|
55632
55661
|
}
|
|
55633
55662
|
__name$2(login, "login");
|
|
55634
55663
|
async function logout(profile) {
|
|
@@ -55637,7 +55666,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
55637
55666
|
__name$2(logout, "logout");
|
|
55638
55667
|
async function loginOrRefreshIfRequired(complianceConfig, props) {
|
|
55639
55668
|
if (oauthFlow.getActiveTemporaryAccount()) return { loggedIn: true };
|
|
55640
|
-
return oauthFlow.loginOrRefreshIfRequired(
|
|
55669
|
+
return oauthFlow.loginOrRefreshIfRequired(withLoginDefaults(complianceConfig, props));
|
|
55641
55670
|
}
|
|
55642
55671
|
__name$2(loginOrRefreshIfRequired, "loginOrRefreshIfRequired");
|
|
55643
55672
|
async function getOAuthTokenFromLocalState() {
|
|
@@ -55670,10 +55699,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
55670
55699
|
return configCache.getConfigCache(getAccountCacheFileName()).account;
|
|
55671
55700
|
}
|
|
55672
55701
|
__name$2(getAccountFromCache, "getAccountFromCache");
|
|
55673
|
-
async function fetchAccountsPaged(complianceConfig, resource) {
|
|
55674
|
-
const result = await loginOrRefreshIfRequired(complianceConfig);
|
|
55675
|
-
if (!result.loggedIn) throw new UserError$1(`Not logged in. ${NOT_LOGGED_IN_ERROR_BODIES[result.reason]}${NOT_LOGGED_IN_WHOAMI_TIP}`, { telemetryMessage: "cfetch auth login required" });
|
|
55676
|
-
const credentials = requireApiToken$1();
|
|
55702
|
+
async function fetchAccountsPaged(complianceConfig, resource, credentials) {
|
|
55677
55703
|
const results = [];
|
|
55678
55704
|
let getMoreResults = true;
|
|
55679
55705
|
let page = 1;
|
|
@@ -55693,7 +55719,10 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
55693
55719
|
__name$2(fetchAccountsPaged, "fetchAccountsPaged");
|
|
55694
55720
|
async function fetchAllAccounts(complianceConfig, options = {}) {
|
|
55695
55721
|
const { throwOnEmpty = true } = options;
|
|
55696
|
-
const
|
|
55722
|
+
const loginResult = await loginOrRefreshIfRequired(complianceConfig);
|
|
55723
|
+
if (!loginResult.loggedIn) throw new UserError$1(`Not logged in. ${NOT_LOGGED_IN_ERROR_BODIES[loginResult.reason]}${NOT_LOGGED_IN_WHOAMI_TIP}`, { telemetryMessage: "cfetch auth login required" });
|
|
55724
|
+
const credentials = requireApiToken$1();
|
|
55725
|
+
const [accountsRes, membershipsRes] = await Promise.allSettled([fetchAccountsPaged(complianceConfig, `/accounts`, credentials), fetchAccountsPaged(complianceConfig, `/memberships`, credentials)]);
|
|
55697
55726
|
if (accountsRes.status === "rejected") throw accountsRes.reason;
|
|
55698
55727
|
if (membershipsRes.status === "rejected") if (isMembershipsInaccessible(membershipsRes.reason)) {
|
|
55699
55728
|
if (accountsRes.status === "fulfilled" && accountsRes.value.length > 0) return accountsRes.value;
|
|
@@ -55990,7 +56019,483 @@ function getCfConfigPath() {
|
|
|
55990
56019
|
});
|
|
55991
56020
|
}
|
|
55992
56021
|
__name$2(getCfConfigPath, "getCfConfigPath");
|
|
55993
|
-
var
|
|
56022
|
+
var CF_REGISTERED_SCOPES = [
|
|
56023
|
+
"access:read",
|
|
56024
|
+
"access:write",
|
|
56025
|
+
"account:read",
|
|
56026
|
+
"agw:read",
|
|
56027
|
+
"agw:run",
|
|
56028
|
+
"agw:write",
|
|
56029
|
+
"ai:read",
|
|
56030
|
+
"ai:write",
|
|
56031
|
+
"ai-search:read",
|
|
56032
|
+
"ai-search:run",
|
|
56033
|
+
"ai-search:write",
|
|
56034
|
+
"aiaudit:read",
|
|
56035
|
+
"aiaudit:write",
|
|
56036
|
+
"aig:read",
|
|
56037
|
+
"aig:write",
|
|
56038
|
+
"auditlogs:read",
|
|
56039
|
+
"billing:read",
|
|
56040
|
+
"billing:write",
|
|
56041
|
+
"browser:read",
|
|
56042
|
+
"browser:write",
|
|
56043
|
+
"cfone:read",
|
|
56044
|
+
"cfone:write",
|
|
56045
|
+
"cloudchamber:write",
|
|
56046
|
+
"connectivity:admin",
|
|
56047
|
+
"connectivity:bind",
|
|
56048
|
+
"connectivity:read",
|
|
56049
|
+
"constellation:write",
|
|
56050
|
+
"containers:write",
|
|
56051
|
+
"d1:write",
|
|
56052
|
+
"dex:read",
|
|
56053
|
+
"dex:write",
|
|
56054
|
+
"dns_analytics:read",
|
|
56055
|
+
"dns_records:edit",
|
|
56056
|
+
"dns_records:read",
|
|
56057
|
+
"dns_settings:read",
|
|
56058
|
+
"email_routing:read",
|
|
56059
|
+
"email_routing:write",
|
|
56060
|
+
"email_sending:read",
|
|
56061
|
+
"email_sending:write",
|
|
56062
|
+
"firstpartytags:write",
|
|
56063
|
+
"images:read",
|
|
56064
|
+
"images:write",
|
|
56065
|
+
"lb:edit",
|
|
56066
|
+
"lb:read",
|
|
56067
|
+
"logpush:read",
|
|
56068
|
+
"logpush:write",
|
|
56069
|
+
"mcp_portals:read",
|
|
56070
|
+
"mcp_portals:write",
|
|
56071
|
+
"notebook-examples:read",
|
|
56072
|
+
"notebook-managed:read",
|
|
56073
|
+
"notification:read",
|
|
56074
|
+
"notification:write",
|
|
56075
|
+
"oauth_account_ssl_and_certificates_write",
|
|
56076
|
+
"offline",
|
|
56077
|
+
"openid",
|
|
56078
|
+
"pages:read",
|
|
56079
|
+
"pages:write",
|
|
56080
|
+
"pipelines:read",
|
|
56081
|
+
"pipelines:setup",
|
|
56082
|
+
"pipelines:write",
|
|
56083
|
+
"query_cache:write",
|
|
56084
|
+
"queues:write",
|
|
56085
|
+
"r2_catalog:write",
|
|
56086
|
+
"radar:read",
|
|
56087
|
+
"rag:read",
|
|
56088
|
+
"rag:write",
|
|
56089
|
+
"registrar:read",
|
|
56090
|
+
"registrar:write",
|
|
56091
|
+
"secrets_store:read",
|
|
56092
|
+
"secrets_store:write",
|
|
56093
|
+
"sso-connector:read",
|
|
56094
|
+
"sso-connector:write",
|
|
56095
|
+
"ssl_certs:write",
|
|
56096
|
+
"teams:pii",
|
|
56097
|
+
"teams:read",
|
|
56098
|
+
"teams:secure_location",
|
|
56099
|
+
"teams:write",
|
|
56100
|
+
"url_scanner:read",
|
|
56101
|
+
"url_scanner:write",
|
|
56102
|
+
"user:read",
|
|
56103
|
+
"vectorize:write",
|
|
56104
|
+
"workers:read",
|
|
56105
|
+
"workers:write",
|
|
56106
|
+
"workers_builds:read",
|
|
56107
|
+
"workers_builds:write",
|
|
56108
|
+
"workers_deployments:read",
|
|
56109
|
+
"workers_kv:write",
|
|
56110
|
+
"workers_observability:read",
|
|
56111
|
+
"workers_observability:write",
|
|
56112
|
+
"workers_observability_telemetry:write",
|
|
56113
|
+
"workers_routes:write",
|
|
56114
|
+
"workers_scripts:write",
|
|
56115
|
+
"workers_tail:read",
|
|
56116
|
+
"zone:read",
|
|
56117
|
+
"account-analytics.read",
|
|
56118
|
+
"account-ssl-and-certificates.write",
|
|
56119
|
+
"ssl-and-certificates.read",
|
|
56120
|
+
"ssl-and-certificates.write",
|
|
56121
|
+
"registrar-domains.read",
|
|
56122
|
+
"registrar-domains.admin",
|
|
56123
|
+
"logs.read",
|
|
56124
|
+
"logs.write",
|
|
56125
|
+
"websearch.run",
|
|
56126
|
+
"snippets.read",
|
|
56127
|
+
"snippets.write",
|
|
56128
|
+
"access-acct.read",
|
|
56129
|
+
"access-acct.revoke",
|
|
56130
|
+
"access-acct.write",
|
|
56131
|
+
"access-app.read",
|
|
56132
|
+
"access-app.revoke",
|
|
56133
|
+
"access-app.write",
|
|
56134
|
+
"access-audit-log.read",
|
|
56135
|
+
"access-certificate.read",
|
|
56136
|
+
"access-certificate.write",
|
|
56137
|
+
"access-custom-page.read",
|
|
56138
|
+
"access-custom-page.write",
|
|
56139
|
+
"access-device-posture.read",
|
|
56140
|
+
"access-device-posture.write",
|
|
56141
|
+
"access-group.read",
|
|
56142
|
+
"access-group.write",
|
|
56143
|
+
"access-idp.read",
|
|
56144
|
+
"access-idp.write",
|
|
56145
|
+
"access-key.read",
|
|
56146
|
+
"access-key.write",
|
|
56147
|
+
"access-org.read",
|
|
56148
|
+
"access-org.revoke",
|
|
56149
|
+
"access-org.write",
|
|
56150
|
+
"access-policy-test.read",
|
|
56151
|
+
"access-policy-test.write",
|
|
56152
|
+
"access-policy.read",
|
|
56153
|
+
"access-policy.write",
|
|
56154
|
+
"access-population.read",
|
|
56155
|
+
"access-population.write",
|
|
56156
|
+
"access-saml-certificate.read",
|
|
56157
|
+
"access-saml-certificate.write",
|
|
56158
|
+
"access-scim-log.read",
|
|
56159
|
+
"access-seats.write",
|
|
56160
|
+
"access-service-token.read",
|
|
56161
|
+
"access-service-token.write",
|
|
56162
|
+
"access-ssh-auditing.read",
|
|
56163
|
+
"access-ssh-auditing.write",
|
|
56164
|
+
"access-tag.read",
|
|
56165
|
+
"access-tag.write",
|
|
56166
|
+
"access-users.read",
|
|
56167
|
+
"access-users.write",
|
|
56168
|
+
"access.read",
|
|
56169
|
+
"access.revoke",
|
|
56170
|
+
"access.write",
|
|
56171
|
+
"account-api-gateway.read",
|
|
56172
|
+
"account-api-gateway.write",
|
|
56173
|
+
"account-custom-asset.read",
|
|
56174
|
+
"account-custom-asset.write",
|
|
56175
|
+
"account-custom-error-rules.read",
|
|
56176
|
+
"account-custom-error-rules.write",
|
|
56177
|
+
"account-custom-pages.read",
|
|
56178
|
+
"account-custom-pages.write",
|
|
56179
|
+
"account-disable-esc.read",
|
|
56180
|
+
"account-disable-esc.write",
|
|
56181
|
+
"account-dns-settings.read",
|
|
56182
|
+
"account-dns-settings.write",
|
|
56183
|
+
"account-firewall-access-rules.read",
|
|
56184
|
+
"account-firewall-access-rules.write",
|
|
56185
|
+
"account-logs.read",
|
|
56186
|
+
"account-logs.write",
|
|
56187
|
+
"account-rule-lists.read",
|
|
56188
|
+
"account-rule-lists.write",
|
|
56189
|
+
"account-rulesets.read",
|
|
56190
|
+
"account-rulesets.write",
|
|
56191
|
+
"account-security-center-insights.read",
|
|
56192
|
+
"account-security-center-insights.write",
|
|
56193
|
+
"account-settings.read",
|
|
56194
|
+
"account-settings.write",
|
|
56195
|
+
"account-ssl-and-certificates.read",
|
|
56196
|
+
"account-waf.read",
|
|
56197
|
+
"account-waf.write",
|
|
56198
|
+
"account-waiting-rooms.read",
|
|
56199
|
+
"address-maps.read",
|
|
56200
|
+
"address-maps.write",
|
|
56201
|
+
"agent-memory.write",
|
|
56202
|
+
"agw.read",
|
|
56203
|
+
"agw.run",
|
|
56204
|
+
"agw.write",
|
|
56205
|
+
"ai-search.index",
|
|
56206
|
+
"ai-search.metadata_read",
|
|
56207
|
+
"ai-search.read",
|
|
56208
|
+
"ai-search.run",
|
|
56209
|
+
"ai-search.write",
|
|
56210
|
+
"ai.read",
|
|
56211
|
+
"ai.write",
|
|
56212
|
+
"aiaudit.read",
|
|
56213
|
+
"aiaudit.write",
|
|
56214
|
+
"aig.metadata_read",
|
|
56215
|
+
"aig.read",
|
|
56216
|
+
"aig.run",
|
|
56217
|
+
"aig.write",
|
|
56218
|
+
"analytics.read",
|
|
56219
|
+
"api-gateway.read",
|
|
56220
|
+
"api-gateway.write",
|
|
56221
|
+
"apps.write",
|
|
56222
|
+
"argotunnel.read",
|
|
56223
|
+
"argotunnel.write",
|
|
56224
|
+
"artifacts.read",
|
|
56225
|
+
"artifacts.write",
|
|
56226
|
+
"bot-management-feedback.read",
|
|
56227
|
+
"bot-management-feedback.write",
|
|
56228
|
+
"bot-management.read",
|
|
56229
|
+
"bot-management.write",
|
|
56230
|
+
"browser-rendering.read",
|
|
56231
|
+
"browser-rendering.write",
|
|
56232
|
+
"cache-settings.read",
|
|
56233
|
+
"cache-settings.write",
|
|
56234
|
+
"cache.purge",
|
|
56235
|
+
"calls.read",
|
|
56236
|
+
"calls.write",
|
|
56237
|
+
"casb.read",
|
|
56238
|
+
"casb.write",
|
|
56239
|
+
"cf-agents.read",
|
|
56240
|
+
"cf-agents.write",
|
|
56241
|
+
"challenge-widgets.read",
|
|
56242
|
+
"challenge-widgets.write",
|
|
56243
|
+
"chinanetwork-steering.read",
|
|
56244
|
+
"chinanetwork-steering.write",
|
|
56245
|
+
"cloud-connector.read",
|
|
56246
|
+
"cloud-connector.write",
|
|
56247
|
+
"cloud-email-security.read",
|
|
56248
|
+
"cloud-email-security.write",
|
|
56249
|
+
"cloudchamber.read",
|
|
56250
|
+
"cloudchamber.write",
|
|
56251
|
+
"cloudforce-one.read",
|
|
56252
|
+
"cloudforce-one.write",
|
|
56253
|
+
"config-settings.read",
|
|
56254
|
+
"config-settings.write",
|
|
56255
|
+
"connectivity-directory.admin",
|
|
56256
|
+
"connectivity-directory.bind",
|
|
56257
|
+
"connectivity-directory.read",
|
|
56258
|
+
"constellation.read",
|
|
56259
|
+
"constellation.write",
|
|
56260
|
+
"containers.read",
|
|
56261
|
+
"containers.write",
|
|
56262
|
+
"custom-errors.read",
|
|
56263
|
+
"custom-errors.write",
|
|
56264
|
+
"custom-pages.read",
|
|
56265
|
+
"custom-pages.write",
|
|
56266
|
+
"d1.metadata_read",
|
|
56267
|
+
"d1.read",
|
|
56268
|
+
"d1.write",
|
|
56269
|
+
"ddos-botnet-feed.read",
|
|
56270
|
+
"ddos-botnet-feed.write",
|
|
56271
|
+
"ddos-protection.read",
|
|
56272
|
+
"ddos-protection.write",
|
|
56273
|
+
"dls.read",
|
|
56274
|
+
"dls.write",
|
|
56275
|
+
"dns-firewall.read",
|
|
56276
|
+
"dns-firewall.write",
|
|
56277
|
+
"dns-view.read",
|
|
56278
|
+
"dns-view.write",
|
|
56279
|
+
"dns.read",
|
|
56280
|
+
"dns.write",
|
|
56281
|
+
"domain-page-shield.read",
|
|
56282
|
+
"domain-page.shield",
|
|
56283
|
+
"dynamic-redirect.read",
|
|
56284
|
+
"dynamic-redirect.write",
|
|
56285
|
+
"email-routing-account-rule.read",
|
|
56286
|
+
"email-routing-address.read",
|
|
56287
|
+
"email-routing-address.write",
|
|
56288
|
+
"email-routing-rule.read",
|
|
56289
|
+
"email-routing-rule.write",
|
|
56290
|
+
"email-routing-suppression.read",
|
|
56291
|
+
"email-routing-suppression.write",
|
|
56292
|
+
"email-security-dmarcreports.read",
|
|
56293
|
+
"email-security-dmarcreports.write",
|
|
56294
|
+
"email-sending.read",
|
|
56295
|
+
"email-sending.write",
|
|
56296
|
+
"fbm.admin",
|
|
56297
|
+
"fbm.read",
|
|
56298
|
+
"fbm.write",
|
|
56299
|
+
"field-extractor.read",
|
|
56300
|
+
"field-extractor.write",
|
|
56301
|
+
"firewall-for-ai.read",
|
|
56302
|
+
"firewall-for-ai.write",
|
|
56303
|
+
"firewall-services.read",
|
|
56304
|
+
"firewall-services.write",
|
|
56305
|
+
"flagship.evaluate",
|
|
56306
|
+
"flagship.read",
|
|
56307
|
+
"flagship.write",
|
|
56308
|
+
"fraud-detection-pii.read",
|
|
56309
|
+
"fraud-detection.read",
|
|
56310
|
+
"fraud-detection.write",
|
|
56311
|
+
"fraud-events.write",
|
|
56312
|
+
"fraud-feedback.read",
|
|
56313
|
+
"fraud-feedback.write",
|
|
56314
|
+
"healthcheck.read",
|
|
56315
|
+
"healthcheck.write",
|
|
56316
|
+
"http-applications.read",
|
|
56317
|
+
"http-applications.write",
|
|
56318
|
+
"http-ddos-managed-ruleset.read",
|
|
56319
|
+
"http-ddos-managed-ruleset.write",
|
|
56320
|
+
"images.metadata_read",
|
|
56321
|
+
"images.read",
|
|
56322
|
+
"images.write",
|
|
56323
|
+
"integration.write",
|
|
56324
|
+
"intel.read",
|
|
56325
|
+
"intel.write",
|
|
56326
|
+
"iot.read",
|
|
56327
|
+
"iot.write",
|
|
56328
|
+
"ip-prefix-bgp-on-demand.read",
|
|
56329
|
+
"ip-prefix-bgp-on-demand.write",
|
|
56330
|
+
"ip-prefix.read",
|
|
56331
|
+
"ip-prefix.write",
|
|
56332
|
+
"l4-ddos-managed-ruleset.read",
|
|
56333
|
+
"l4-ddos-managed-ruleset.write",
|
|
56334
|
+
"load-balancers-account.read",
|
|
56335
|
+
"load-balancers-account.write",
|
|
56336
|
+
"load-balancers.read",
|
|
56337
|
+
"load-balancers.write",
|
|
56338
|
+
"load-balancing-monitors-and-pools.read",
|
|
56339
|
+
"load-balancing-monitors-and-pools.write",
|
|
56340
|
+
"magic-firewall.read",
|
|
56341
|
+
"magic-firewall.write",
|
|
56342
|
+
"magic-transit.read",
|
|
56343
|
+
"magic-transit.write",
|
|
56344
|
+
"magic-wan.read",
|
|
56345
|
+
"magic-wan.write",
|
|
56346
|
+
"managed-headers.read",
|
|
56347
|
+
"managed-headers.write",
|
|
56348
|
+
"mass-url-redirects.read",
|
|
56349
|
+
"mass-url-redirects.write",
|
|
56350
|
+
"mcp-portals.read",
|
|
56351
|
+
"mcp-portals.write",
|
|
56352
|
+
"memberships.read",
|
|
56353
|
+
"memberships.write",
|
|
56354
|
+
"messaging.edit",
|
|
56355
|
+
"messaging.metadata_read",
|
|
56356
|
+
"messaging.read",
|
|
56357
|
+
"moq.read",
|
|
56358
|
+
"moq.write",
|
|
56359
|
+
"notifications.read",
|
|
56360
|
+
"notifications.write",
|
|
56361
|
+
"origin.read",
|
|
56362
|
+
"origin.write",
|
|
56363
|
+
"page-rules.read",
|
|
56364
|
+
"page-rules.write",
|
|
56365
|
+
"page-shield.read",
|
|
56366
|
+
"page.read",
|
|
56367
|
+
"page.shield",
|
|
56368
|
+
"page.write",
|
|
56369
|
+
"pages.metadata_read",
|
|
56370
|
+
"payments-gateway.read",
|
|
56371
|
+
"payments-gateway.write",
|
|
56372
|
+
"pcaps-api.read",
|
|
56373
|
+
"pcaps-api.write",
|
|
56374
|
+
"pipelines.read",
|
|
56375
|
+
"pipelines.send",
|
|
56376
|
+
"pipelines.write",
|
|
56377
|
+
"precursor.read",
|
|
56378
|
+
"precursor.write",
|
|
56379
|
+
"pubsub.read",
|
|
56380
|
+
"pubsub.write",
|
|
56381
|
+
"query-cache.read",
|
|
56382
|
+
"query-cache.write",
|
|
56383
|
+
"queues.metadata_read",
|
|
56384
|
+
"queues.read",
|
|
56385
|
+
"queues.write",
|
|
56386
|
+
"r2-catalog-sql.read",
|
|
56387
|
+
"r2-catalog.read",
|
|
56388
|
+
"r2-catalog.write",
|
|
56389
|
+
"radar.read",
|
|
56390
|
+
"rag.read",
|
|
56391
|
+
"rag.run",
|
|
56392
|
+
"rag.write",
|
|
56393
|
+
"realtime.admin",
|
|
56394
|
+
"realtime.read",
|
|
56395
|
+
"realtime.write",
|
|
56396
|
+
"registrar-sandbox-domains.admin",
|
|
56397
|
+
"registrar-sandbox-domains.read",
|
|
56398
|
+
"reports-application-security-report.read",
|
|
56399
|
+
"request-tracer.read",
|
|
56400
|
+
"resource-library.read",
|
|
56401
|
+
"resource-library.write",
|
|
56402
|
+
"resource-sharing.read",
|
|
56403
|
+
"response-compression.read",
|
|
56404
|
+
"response-compression.write",
|
|
56405
|
+
"sanitize.read",
|
|
56406
|
+
"sanitize.write",
|
|
56407
|
+
"secrets-store.read",
|
|
56408
|
+
"secrets-store.write",
|
|
56409
|
+
"select-configuration.read",
|
|
56410
|
+
"select-configuration.write",
|
|
56411
|
+
"stream.metadata_read",
|
|
56412
|
+
"stream.read",
|
|
56413
|
+
"stream.write",
|
|
56414
|
+
"tag.read",
|
|
56415
|
+
"tag.write",
|
|
56416
|
+
"teams-cds-compute-account.read",
|
|
56417
|
+
"teams-cds-compute-account.write",
|
|
56418
|
+
"teams-connector-cloudflared.monitoring",
|
|
56419
|
+
"teams-connector-cloudflared.read",
|
|
56420
|
+
"teams-connector-cloudflared.write",
|
|
56421
|
+
"teams-connector-warp.read",
|
|
56422
|
+
"teams-connector-warp.write",
|
|
56423
|
+
"teams-connectors.read",
|
|
56424
|
+
"teams-connectors.write",
|
|
56425
|
+
"teams-dex.read",
|
|
56426
|
+
"teams-dex.write",
|
|
56427
|
+
"teams-networks.read",
|
|
56428
|
+
"teams-networks.write",
|
|
56429
|
+
"teams-pii.read",
|
|
56430
|
+
"teams-resilience.read",
|
|
56431
|
+
"teams-resilience.write",
|
|
56432
|
+
"teams-secure.location",
|
|
56433
|
+
"teams.read",
|
|
56434
|
+
"teams.report",
|
|
56435
|
+
"teams.write",
|
|
56436
|
+
"transform-rules.read",
|
|
56437
|
+
"transform-rules.write",
|
|
56438
|
+
"trust-and-safety.read",
|
|
56439
|
+
"trust-and-safety.write",
|
|
56440
|
+
"url-scanner.read",
|
|
56441
|
+
"url-scanner.write",
|
|
56442
|
+
"user-details.read",
|
|
56443
|
+
"user-details.write",
|
|
56444
|
+
"vectorize.read",
|
|
56445
|
+
"vectorize.write",
|
|
56446
|
+
"waiting-rooms.read",
|
|
56447
|
+
"waiting-rooms.write",
|
|
56448
|
+
"web3-hostnames.read",
|
|
56449
|
+
"web3-hostnames.write",
|
|
56450
|
+
"websearch.metadata_read",
|
|
56451
|
+
"websearch.read",
|
|
56452
|
+
"websearch.write",
|
|
56453
|
+
"workers-ci.read",
|
|
56454
|
+
"workers-ci.write",
|
|
56455
|
+
"workers-kv-storage.metadata_read",
|
|
56456
|
+
"workers-kv-storage.read",
|
|
56457
|
+
"workers-kv-storage.write",
|
|
56458
|
+
"workers-observability-telemetry.write",
|
|
56459
|
+
"workers-observability.read",
|
|
56460
|
+
"workers-observability.write",
|
|
56461
|
+
"workers-r2-bucket-item.read",
|
|
56462
|
+
"workers-r2-bucket-item.write",
|
|
56463
|
+
"workers-r2.metadata_read",
|
|
56464
|
+
"workers-r2.read",
|
|
56465
|
+
"workers-r2.write",
|
|
56466
|
+
"workers-routes.read",
|
|
56467
|
+
"workers-routes.write",
|
|
56468
|
+
"workers-scripts.bind",
|
|
56469
|
+
"workers-scripts.read",
|
|
56470
|
+
"workers-scripts.write",
|
|
56471
|
+
"workers-tail.read",
|
|
56472
|
+
"workers_ai.metadata_read",
|
|
56473
|
+
"zaraz.edit",
|
|
56474
|
+
"zaraz.read",
|
|
56475
|
+
"zaraz.write",
|
|
56476
|
+
"zone-access.read",
|
|
56477
|
+
"zone-access.revoke",
|
|
56478
|
+
"zone-access.write",
|
|
56479
|
+
"zone-custom-asset.read",
|
|
56480
|
+
"zone-custom-asset.write",
|
|
56481
|
+
"zone-disable-esc.read",
|
|
56482
|
+
"zone-disable-esc.write",
|
|
56483
|
+
"zone-dns-settings.read",
|
|
56484
|
+
"zone-dns-settings.write",
|
|
56485
|
+
"zone-security-center-insights.read",
|
|
56486
|
+
"zone-security-center-insights.write",
|
|
56487
|
+
"zone-settings.read",
|
|
56488
|
+
"zone-settings.write",
|
|
56489
|
+
"zone-transform-rules.read",
|
|
56490
|
+
"zone-transform-rules.write",
|
|
56491
|
+
"zone-versioning.read",
|
|
56492
|
+
"zone-versioning.write",
|
|
56493
|
+
"zone-waf.read",
|
|
56494
|
+
"zone-waf.write",
|
|
56495
|
+
"zone.read",
|
|
56496
|
+
"zone.write"
|
|
56497
|
+
];
|
|
56498
|
+
var DefaultScopeKeys$1 = [...[
|
|
55994
56499
|
"openid",
|
|
55995
56500
|
"offline",
|
|
55996
56501
|
"user:read",
|
|
@@ -56079,13 +56584,12 @@ var CF_SCOPES = [
|
|
|
56079
56584
|
"workers_scripts:write",
|
|
56080
56585
|
"workers_tail:read",
|
|
56081
56586
|
"zone:read"
|
|
56082
|
-
];
|
|
56083
|
-
var DefaultScopeKeys$1 = [...CF_SCOPES];
|
|
56587
|
+
]];
|
|
56084
56588
|
function setLoginScopeKeys$1(scopes) {
|
|
56085
56589
|
DefaultScopeKeys$1 = scopes;
|
|
56086
56590
|
}
|
|
56087
56591
|
__name$2(setLoginScopeKeys$1, "setLoginScopeKeys");
|
|
56088
|
-
var CF_SCOPE_SET = new Set(
|
|
56592
|
+
var CF_SCOPE_SET = new Set(CF_REGISTERED_SCOPES);
|
|
56089
56593
|
function validateScopeKeys$1(scopes) {
|
|
56090
56594
|
return scopes.every((scope) => CF_SCOPE_SET.has(scope));
|
|
56091
56595
|
}
|
|
@@ -56114,12 +56618,13 @@ var CF_CLI = {
|
|
|
56114
56618
|
login: "cf auth login",
|
|
56115
56619
|
whoami: "cf auth whoami",
|
|
56116
56620
|
createProfile: "cf auth create",
|
|
56117
|
-
deviceLogin: "cf auth login
|
|
56621
|
+
deviceLogin: "cf auth login"
|
|
56118
56622
|
},
|
|
56119
56623
|
keyringServiceName: CF_KEYRING_SERVICE_NAME,
|
|
56120
56624
|
clientId: getClientIdFromEnv$1,
|
|
56121
56625
|
consent: CF_CONSENT_PAGES,
|
|
56122
56626
|
redirectUri: CF_OAUTH_CALLBACK_URL,
|
|
56627
|
+
useDeviceFlowByDefault: true,
|
|
56123
56628
|
allowGlobalAuthKey: false,
|
|
56124
56629
|
getConfigPath: getCfConfigPath,
|
|
56125
56630
|
getTemporaryAccountConfigPath: getCfTemporaryAccountConfigPath,
|
|
@@ -56174,7 +56679,6 @@ var DefaultScopes = {
|
|
|
56174
56679
|
"ai:write": "See and change Workers AI catalog and assets",
|
|
56175
56680
|
"ai-search:write": "See and change AI Search data",
|
|
56176
56681
|
"ai-search:run": "Run search queries on your AI Search instances",
|
|
56177
|
-
"websearch.run": "Run search queries against Cloudflare Web Search",
|
|
56178
56682
|
"agent-memory:write": "See and change Agent Memory data such as keys and namespaces.",
|
|
56179
56683
|
"queues:write": "See and change Cloudflare Queues settings and data",
|
|
56180
56684
|
"pipelines:write": "See and change Cloudflare Pipelines configurations and data",
|
|
@@ -59982,7 +60486,7 @@ var require_command_exists = /* @__PURE__ */ __commonJS$2({ "../../node_modules/
|
|
|
59982
60486
|
}) });
|
|
59983
60487
|
|
|
59984
60488
|
//#endregion
|
|
59985
|
-
//#region ../deploy-helpers/dist/chunk-
|
|
60489
|
+
//#region ../deploy-helpers/dist/chunk-QBZBEHZB.mjs
|
|
59986
60490
|
var import_undici$1 = require_undici();
|
|
59987
60491
|
var import_command_exists = require_command_exists();
|
|
59988
60492
|
function handleUnsafeCapnp(capnp) {
|
|
@@ -60059,7 +60563,6 @@ function createWorkerUploadForm(worker, bindings, options) {
|
|
|
60059
60563
|
const vectorize = extractBindingsOfType("vectorize", bindings);
|
|
60060
60564
|
const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings);
|
|
60061
60565
|
const ai_search = extractBindingsOfType("ai_search", bindings);
|
|
60062
|
-
const websearch = extractBindingsOfType("websearch", bindings)[0];
|
|
60063
60566
|
const agent_memory = extractBindingsOfType("agent_memory", bindings);
|
|
60064
60567
|
const hyperdrive = extractBindingsOfType("hyperdrive", bindings);
|
|
60065
60568
|
const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings);
|
|
@@ -60235,10 +60738,6 @@ function createWorkerUploadForm(worker, bindings, options) {
|
|
|
60235
60738
|
instance_name
|
|
60236
60739
|
});
|
|
60237
60740
|
});
|
|
60238
|
-
if (websearch !== void 0) metadataBindings.push({
|
|
60239
|
-
name: websearch.binding,
|
|
60240
|
-
type: "websearch"
|
|
60241
|
-
});
|
|
60242
60741
|
agent_memory.forEach(({ binding, namespace }) => {
|
|
60243
60742
|
if (options?.dryRun) namespace ??= INHERIT_SYMBOL;
|
|
60244
60743
|
if (namespace === void 0) throw new UserError$1(`${binding} bindings must have a "namespace" field. Add a "namespace" field to the binding in your Worker configuration specifying the namespace to bind to.`, { telemetryMessage: false });
|
|
@@ -60542,7 +61041,7 @@ __name$1(createWorkerUploadForm, "createWorkerUploadForm");
|
|
|
60542
61041
|
//#endregion
|
|
60543
61042
|
//#region ../remote-bindings/dist/index.mjs
|
|
60544
61043
|
var import_undici = require_undici();
|
|
60545
|
-
var version = "0.0.
|
|
61044
|
+
var version = "0.0.25";
|
|
60546
61045
|
var NoDefaultValueProvided = class extends UserError$1 {
|
|
60547
61046
|
constructor() {
|
|
60548
61047
|
super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
|
|
@@ -61647,10 +62146,6 @@ const KnownBindingSchema = z$1.discriminatedUnion("type", [
|
|
|
61647
62146
|
const value = input;
|
|
61648
62147
|
return value.tunnelId !== void 0 && value.networkId !== void 0 ? `"vpc-network" bindings must specify exactly one of "tunnelId" or "networkId", not both` : `"vpc-network" bindings must specify either "tunnelId" or "networkId"`;
|
|
61649
62148
|
} }),
|
|
61650
|
-
z$1.strictObject({
|
|
61651
|
-
type: z$1.literal("web-search"),
|
|
61652
|
-
dev: RemoteBindingDevSchema.optional()
|
|
61653
|
-
}),
|
|
61654
62149
|
WorkerBindingSchema,
|
|
61655
62150
|
z$1.strictObject({ type: z$1.literal("worker-loader") })
|
|
61656
62151
|
]);
|
|
@@ -61689,8 +62184,7 @@ const SINGLETON_BINDING_TYPES = new Set([
|
|
|
61689
62184
|
"images",
|
|
61690
62185
|
"media",
|
|
61691
62186
|
"stream",
|
|
61692
|
-
"version-metadata"
|
|
61693
|
-
"web-search"
|
|
62187
|
+
"version-metadata"
|
|
61694
62188
|
]);
|
|
61695
62189
|
const listFormatter = new Intl.ListFormat("en-US");
|
|
61696
62190
|
function validateSingletonBindings(env$2, ctx) {
|
|
@@ -61709,6 +62203,136 @@ function validateSingletonBindings(env$2, ctx) {
|
|
|
61709
62203
|
});
|
|
61710
62204
|
}
|
|
61711
62205
|
const EnvSchema = z$1.record(z$1.string(), BindingSchema).superRefine(validateSingletonBindings).optional();
|
|
62206
|
+
const ContainerImageDockerfileSchema = z$1.strictObject({
|
|
62207
|
+
dockerfile: z$1.string().min(1),
|
|
62208
|
+
buildContext: z$1.string().optional(),
|
|
62209
|
+
buildVars: z$1.record(z$1.string(), z$1.string()).optional()
|
|
62210
|
+
});
|
|
62211
|
+
const ContainerImageReferenceSchema = z$1.strictObject({ reference: z$1.string().min(1) });
|
|
62212
|
+
const ContainerImageLocalReferenceSchema = z$1.strictObject({ localReference: z$1.string().min(1) });
|
|
62213
|
+
const InputContainerImageSchema = z$1.union([ContainerImageDockerfileSchema, ContainerImageReferenceSchema]);
|
|
62214
|
+
const OutputContainerImageSchema = z$1.union([ContainerImageReferenceSchema, ContainerImageLocalReferenceSchema]);
|
|
62215
|
+
const VALID_ROLLOUT_STEP_PERCENTAGES = new Set([
|
|
62216
|
+
5,
|
|
62217
|
+
10,
|
|
62218
|
+
20,
|
|
62219
|
+
25,
|
|
62220
|
+
50,
|
|
62221
|
+
100
|
|
62222
|
+
]);
|
|
62223
|
+
const ContainerRolloutStepPercentageSchema = z$1.union([z$1.number(), z$1.array(z$1.number())]).superRefine((stepPercentage, ctx) => {
|
|
62224
|
+
if (typeof stepPercentage === "number") {
|
|
62225
|
+
if (!VALID_ROLLOUT_STEP_PERCENTAGES.has(stepPercentage)) ctx.addIssue({
|
|
62226
|
+
code: "custom",
|
|
62227
|
+
message: "A rollout step percentage must be one of 5, 10, 20, 25, 50, or 100"
|
|
62228
|
+
});
|
|
62229
|
+
return;
|
|
62230
|
+
}
|
|
62231
|
+
if (stepPercentage.length === 0) {
|
|
62232
|
+
ctx.addIssue({
|
|
62233
|
+
code: "custom",
|
|
62234
|
+
message: "A rollout must contain at least one step percentage"
|
|
62235
|
+
});
|
|
62236
|
+
return;
|
|
62237
|
+
}
|
|
62238
|
+
for (const [index, step] of stepPercentage.entries()) {
|
|
62239
|
+
if (step < 10 || step > 100) ctx.addIssue({
|
|
62240
|
+
code: "custom",
|
|
62241
|
+
path: [index],
|
|
62242
|
+
message: "Rollout step percentages must be between 10 and 100"
|
|
62243
|
+
});
|
|
62244
|
+
const previousStep = stepPercentage[index - 1];
|
|
62245
|
+
if (previousStep !== void 0 && step < previousStep) ctx.addIssue({
|
|
62246
|
+
code: "custom",
|
|
62247
|
+
path: [index],
|
|
62248
|
+
message: "Rollout step percentages must be in ascending order"
|
|
62249
|
+
});
|
|
62250
|
+
}
|
|
62251
|
+
const lastIndex = stepPercentage.length - 1;
|
|
62252
|
+
if (stepPercentage[lastIndex] !== 100) ctx.addIssue({
|
|
62253
|
+
code: "custom",
|
|
62254
|
+
path: [lastIndex],
|
|
62255
|
+
message: "The final rollout step percentage must be 100"
|
|
62256
|
+
});
|
|
62257
|
+
});
|
|
62258
|
+
function validateContainerRelationships(container, ctx) {
|
|
62259
|
+
const stepPercentage = container.rollout?.stepPercentage;
|
|
62260
|
+
if (Array.isArray(stepPercentage) && container.maxInstances !== void 0 && stepPercentage.length > container.maxInstances) ctx.addIssue({
|
|
62261
|
+
code: "custom",
|
|
62262
|
+
path: ["rollout", "stepPercentage"],
|
|
62263
|
+
message: "A rollout cannot contain more steps than the maximum number of instances"
|
|
62264
|
+
});
|
|
62265
|
+
}
|
|
62266
|
+
const ContainerObservabilityBaseSchema = z$1.strictObject({
|
|
62267
|
+
enabled: z$1.boolean().optional(),
|
|
62268
|
+
logs: z$1.strictObject({ enabled: z$1.boolean().optional() }).optional()
|
|
62269
|
+
});
|
|
62270
|
+
const ContainerObservabilitySchema = z$1.union([ContainerObservabilityBaseSchema.extend({ targetInstancePercentage: z$1.number().min(0).max(100).optional() }), ContainerObservabilityBaseSchema.extend({ targetInstanceCount: z$1.number().int().nonnegative().optional() })]);
|
|
62271
|
+
const BaseContainerSchema = z$1.strictObject({
|
|
62272
|
+
type: z$1.literal("container"),
|
|
62273
|
+
name: z$1.string().min(1),
|
|
62274
|
+
observability: ContainerObservabilitySchema.optional(),
|
|
62275
|
+
unsafe: z$1.record(z$1.string(), z$1.unknown()).optional()
|
|
62276
|
+
});
|
|
62277
|
+
const StandardContainerBaseSchema = BaseContainerSchema.extend({
|
|
62278
|
+
maxInstances: z$1.number().int().nonnegative().default(20),
|
|
62279
|
+
instanceType: z$1.union([z$1.enum([
|
|
62280
|
+
"basic",
|
|
62281
|
+
"lite",
|
|
62282
|
+
"standard-1",
|
|
62283
|
+
"standard-2",
|
|
62284
|
+
"standard-3",
|
|
62285
|
+
"standard-4"
|
|
62286
|
+
]), z$1.strictObject({
|
|
62287
|
+
vcpu: z$1.number().min(.0625).optional(),
|
|
62288
|
+
memoryMib: z$1.number().nonnegative().optional(),
|
|
62289
|
+
diskMb: z$1.number().nonnegative().optional()
|
|
62290
|
+
})]).optional(),
|
|
62291
|
+
schedulingPolicy: z$1.enum(["default", "regional"]).optional(),
|
|
62292
|
+
ssh: z$1.strictObject({
|
|
62293
|
+
enabled: z$1.boolean(),
|
|
62294
|
+
port: z$1.number().int().min(1).max(65535).optional()
|
|
62295
|
+
}).optional(),
|
|
62296
|
+
authorizedKeys: z$1.array(z$1.strictObject({
|
|
62297
|
+
name: z$1.string(),
|
|
62298
|
+
publicKey: z$1.string()
|
|
62299
|
+
})).optional(),
|
|
62300
|
+
constraints: z$1.strictObject({
|
|
62301
|
+
regions: z$1.array(z$1.enum([
|
|
62302
|
+
"ENAM",
|
|
62303
|
+
"WNAM",
|
|
62304
|
+
"EEUR",
|
|
62305
|
+
"WEUR",
|
|
62306
|
+
"APAC",
|
|
62307
|
+
"SAM",
|
|
62308
|
+
"ME",
|
|
62309
|
+
"OC",
|
|
62310
|
+
"AFR"
|
|
62311
|
+
])).optional(),
|
|
62312
|
+
jurisdiction: z$1.enum(["eu", "fedramp"]).optional()
|
|
62313
|
+
}).optional(),
|
|
62314
|
+
rollout: z$1.strictObject({
|
|
62315
|
+
kind: z$1.enum([
|
|
62316
|
+
"full-auto",
|
|
62317
|
+
"none",
|
|
62318
|
+
"full-manual"
|
|
62319
|
+
]).optional(),
|
|
62320
|
+
stepPercentage: ContainerRolloutStepPercentageSchema.optional(),
|
|
62321
|
+
activeGracePeriod: z$1.number().nonnegative().optional()
|
|
62322
|
+
}).optional()
|
|
62323
|
+
});
|
|
62324
|
+
const DurableObjectContainerBaseSchema = BaseContainerSchema.extend({ schedulingPolicy: z$1.literal("durable-object") });
|
|
62325
|
+
/**
|
|
62326
|
+
* Input Container schema — validates user-authored `cloudflare.config.ts`
|
|
62327
|
+
* Container exports. Dockerfiles are built by the consuming build tool.
|
|
62328
|
+
*/
|
|
62329
|
+
const InputContainerSchema = z$1.union([StandardContainerBaseSchema.extend({ image: InputContainerImageSchema }).superRefine(validateContainerRelationships), DurableObjectContainerBaseSchema.extend({ images: z$1.record(z$1.string(), InputContainerImageSchema).optional() })]);
|
|
62330
|
+
/**
|
|
62331
|
+
* Output Container schema — validates Container configs in the Build Output
|
|
62332
|
+
* Specification, after any Dockerfile has been built into a local or remote
|
|
62333
|
+
* image reference.
|
|
62334
|
+
*/
|
|
62335
|
+
const OutputContainerSchema = z$1.union([StandardContainerBaseSchema.extend({ image: OutputContainerImageSchema }).superRefine(validateContainerRelationships), DurableObjectContainerBaseSchema.extend({ images: z$1.record(z$1.string(), OutputContainerImageSchema).optional() })]);
|
|
61712
62336
|
const DurableObjectCreatedExportSchema = z$1.strictObject({
|
|
61713
62337
|
type: z$1.literal("durable-object"),
|
|
61714
62338
|
state: z$1.literal("created").optional(),
|
|
@@ -61887,8 +62511,13 @@ const InputSettingsSchema = z$1.strictObject({
|
|
|
61887
62511
|
* Build Output Specification. Adds the `mode` the build was produced in.
|
|
61888
62512
|
*/
|
|
61889
62513
|
const OutputSettingsSchema = InputSettingsSchema.extend({ mode: z$1.string().optional() });
|
|
62514
|
+
const DEFAULT_EXPORT_NAME = "default";
|
|
61890
62515
|
const SETTINGS_EXPORT_NAME = "settings";
|
|
61891
|
-
const SUPPORTED_EXPORT_TYPES = new Set([
|
|
62516
|
+
const SUPPORTED_EXPORT_TYPES = new Set([
|
|
62517
|
+
"container",
|
|
62518
|
+
"worker",
|
|
62519
|
+
"settings"
|
|
62520
|
+
]);
|
|
61892
62521
|
function invalidConfigExportMessage(exportName) {
|
|
61893
62522
|
return `The \`${exportName}\` export is not a supported export type. Move constants, helper functions, and other unsupported exports to a separate module.`;
|
|
61894
62523
|
}
|
|
@@ -61905,6 +62534,15 @@ const ConfigExportsTypeSchema = z$1.record(z$1.string(), z$1.unknown()).check((c
|
|
|
61905
62534
|
});
|
|
61906
62535
|
continue;
|
|
61907
62536
|
}
|
|
62537
|
+
if (key === DEFAULT_EXPORT_NAME && type !== "worker") {
|
|
62538
|
+
ctx.issues.push({
|
|
62539
|
+
code: "custom",
|
|
62540
|
+
input: value,
|
|
62541
|
+
path: [key],
|
|
62542
|
+
message: `The \`${DEFAULT_EXPORT_NAME}\` export is reserved for a \`worker\` config; found a \`${type}\` config.`
|
|
62543
|
+
});
|
|
62544
|
+
continue;
|
|
62545
|
+
}
|
|
61908
62546
|
const isSettingsName = key === SETTINGS_EXPORT_NAME;
|
|
61909
62547
|
const isSettingsType = type === "settings";
|
|
61910
62548
|
if (isSettingsType && !isSettingsName) ctx.issues.push({
|
|
@@ -62053,18 +62691,26 @@ function createFatalError(message, isJson, options) {
|
|
|
62053
62691
|
return new FatalError(`${message}`, options);
|
|
62054
62692
|
}
|
|
62055
62693
|
__name(createFatalError, "createFatalError");
|
|
62694
|
+
const ROLLOUT_KIND_MAP = {
|
|
62695
|
+
"full-auto": "full_auto",
|
|
62696
|
+
"full-manual": "full_manual",
|
|
62697
|
+
none: "none"
|
|
62698
|
+
};
|
|
62056
62699
|
/**
|
|
62057
62700
|
* Convert a parsed `@cloudflare/config` config into a Wrangler `RawConfig`.
|
|
62058
62701
|
*
|
|
62059
|
-
* The caller is responsible for unwrapping any function/promise
|
|
62060
|
-
* the
|
|
62702
|
+
* The caller is responsible for unwrapping any function/promise wrappers and
|
|
62703
|
+
* validating the configs against their corresponding input schemas before
|
|
62704
|
+
* passing them in.
|
|
62061
62705
|
*
|
|
62062
62706
|
* @param workerConfig The parsed (post-validation) Worker config.
|
|
62063
62707
|
* @param settingsConfig The optional parsed settings config, whose fields
|
|
62064
62708
|
* are merged onto the result.
|
|
62709
|
+
* @param containerExports The parsed Container exports to include in the
|
|
62710
|
+
* result.
|
|
62065
62711
|
* @returns The corresponding Wrangler `RawConfig`.
|
|
62066
62712
|
*/
|
|
62067
|
-
function convertToWranglerConfig(workerConfig, settingsConfig) {
|
|
62713
|
+
function convertToWranglerConfig(workerConfig, settingsConfig, containerExports = []) {
|
|
62068
62714
|
const result = {};
|
|
62069
62715
|
convertTopLevel(workerConfig, result);
|
|
62070
62716
|
convertBindingsAndAssets(workerConfig, result);
|
|
@@ -62073,8 +62719,50 @@ function convertToWranglerConfig(workerConfig, settingsConfig) {
|
|
|
62073
62719
|
convertTriggers(workerConfig, result);
|
|
62074
62720
|
convertTailConsumers(workerConfig, result);
|
|
62075
62721
|
if (settingsConfig !== void 0) convertSettings(settingsConfig, result);
|
|
62722
|
+
if (containerExports.length > 0) result.containers = containerExports.map((container) => convertContainer(container));
|
|
62076
62723
|
return result;
|
|
62077
62724
|
}
|
|
62725
|
+
function convertContainer(container) {
|
|
62726
|
+
if (container.schedulingPolicy === "durable-object") throw new UserError("Durable Object-managed Containers are not currently supported by `convertToWranglerConfig()`.", { telemetryMessage: false });
|
|
62727
|
+
const converted = { name: container.name };
|
|
62728
|
+
if (container.observability !== void 0) converted.observability = convertContainerObservability(container.observability);
|
|
62729
|
+
if (container.unsafe !== void 0) converted.unsafe = container.unsafe;
|
|
62730
|
+
converted.image = "dockerfile" in container.image ? container.image.dockerfile : container.image.reference;
|
|
62731
|
+
converted.max_instances = container.maxInstances;
|
|
62732
|
+
if ("dockerfile" in container.image) {
|
|
62733
|
+
if (container.image.buildContext !== void 0) converted.image_build_context = container.image.buildContext;
|
|
62734
|
+
if (container.image.buildVars !== void 0) converted.image_vars = container.image.buildVars;
|
|
62735
|
+
}
|
|
62736
|
+
if (container.instanceType !== void 0) if (typeof container.instanceType === "string") converted.instance_type = container.instanceType;
|
|
62737
|
+
else {
|
|
62738
|
+
const instanceType = {};
|
|
62739
|
+
if (container.instanceType.vcpu !== void 0) instanceType.vcpu = container.instanceType.vcpu;
|
|
62740
|
+
if (container.instanceType.memoryMib !== void 0) instanceType.memory_mib = container.instanceType.memoryMib;
|
|
62741
|
+
if (container.instanceType.diskMb !== void 0) instanceType.disk_mb = container.instanceType.diskMb;
|
|
62742
|
+
converted.instance_type = instanceType;
|
|
62743
|
+
}
|
|
62744
|
+
if (container.schedulingPolicy !== void 0) converted.scheduling_policy = container.schedulingPolicy;
|
|
62745
|
+
if (container.ssh !== void 0) converted.ssh = container.ssh;
|
|
62746
|
+
if (container.authorizedKeys !== void 0) converted.authorized_keys = container.authorizedKeys.map(({ name, publicKey }) => ({
|
|
62747
|
+
name,
|
|
62748
|
+
public_key: publicKey
|
|
62749
|
+
}));
|
|
62750
|
+
if (container.constraints !== void 0) converted.constraints = container.constraints;
|
|
62751
|
+
if (container.rollout !== void 0) {
|
|
62752
|
+
if (container.rollout.kind !== void 0) converted.rollout_kind = ROLLOUT_KIND_MAP[container.rollout.kind];
|
|
62753
|
+
if (container.rollout.stepPercentage !== void 0) converted.rollout_step_percentage = container.rollout.stepPercentage;
|
|
62754
|
+
if (container.rollout.activeGracePeriod !== void 0) converted.rollout_active_grace_period = container.rollout.activeGracePeriod;
|
|
62755
|
+
}
|
|
62756
|
+
return converted;
|
|
62757
|
+
}
|
|
62758
|
+
function convertContainerObservability(observability) {
|
|
62759
|
+
const converted = {};
|
|
62760
|
+
if (observability.enabled !== void 0) converted.enabled = observability.enabled;
|
|
62761
|
+
if (observability.logs !== void 0) converted.logs = observability.logs;
|
|
62762
|
+
if ("targetInstancePercentage" in observability && observability.targetInstancePercentage !== void 0) converted.target_instance_percentage = observability.targetInstancePercentage;
|
|
62763
|
+
if ("targetInstanceCount" in observability && observability.targetInstanceCount !== void 0) converted.target_instance_count = observability.targetInstanceCount;
|
|
62764
|
+
return converted;
|
|
62765
|
+
}
|
|
62078
62766
|
/**
|
|
62079
62767
|
* Merge a parsed settings config's fields (`account_id`, `compliance_region`)
|
|
62080
62768
|
* onto an existing Wrangler `RawConfig`.
|
|
@@ -62402,12 +63090,6 @@ function convertBindingsAndAssets(config$1, result) {
|
|
|
62402
63090
|
remote: binding.dev?.remote
|
|
62403
63091
|
}));
|
|
62404
63092
|
break;
|
|
62405
|
-
case "web-search":
|
|
62406
|
-
result.websearch = omitUndefined({
|
|
62407
|
-
binding: name,
|
|
62408
|
-
remote: binding.dev?.remote
|
|
62409
|
-
});
|
|
62410
|
-
break;
|
|
62411
63093
|
case "worker":
|
|
62412
63094
|
services.push(omitUndefined({
|
|
62413
63095
|
binding: name,
|
|
@@ -62742,6 +63424,9 @@ function isRecord(value) {
|
|
|
62742
63424
|
function isConfigReference(value) {
|
|
62743
63425
|
return typeof value === "function" || isRecord(value);
|
|
62744
63426
|
}
|
|
63427
|
+
function normalizeConfigReference(reference, resolved, expectedType) {
|
|
63428
|
+
return isRecord(resolved) && resolved.type === expectedType && typeof resolved.name === "string" ? resolved.name : reference;
|
|
63429
|
+
}
|
|
62745
63430
|
function createDefinitionResolver(ctx) {
|
|
62746
63431
|
const resolvedDefinitions = /* @__PURE__ */ new Map();
|
|
62747
63432
|
return (input) => {
|
|
@@ -62762,7 +63447,7 @@ async function normalizeWorkerReferences(resolved, resolveDefinition) {
|
|
|
62762
63447
|
const target = await resolveDefinition(binding.worker);
|
|
62763
63448
|
env$2[bindingName] = {
|
|
62764
63449
|
...binding,
|
|
62765
|
-
worker:
|
|
63450
|
+
worker: normalizeConfigReference(binding.worker, target, "worker")
|
|
62766
63451
|
};
|
|
62767
63452
|
}
|
|
62768
63453
|
return {
|
|
@@ -62770,22 +63455,151 @@ async function normalizeWorkerReferences(resolved, resolveDefinition) {
|
|
|
62770
63455
|
env: env$2
|
|
62771
63456
|
};
|
|
62772
63457
|
}
|
|
63458
|
+
async function normalizeContainerReferences(resolved, resolveDefinition, resolvedExports) {
|
|
63459
|
+
const issues = [];
|
|
63460
|
+
if (!isRecord(resolved) || !isRecord(resolved.exports)) return {
|
|
63461
|
+
value: resolved,
|
|
63462
|
+
issues
|
|
63463
|
+
};
|
|
63464
|
+
const workerExports = { ...resolved.exports };
|
|
63465
|
+
for (const [exportName, workerExport] of Object.entries(workerExports)) {
|
|
63466
|
+
if (!isRecord(workerExport) || workerExport.type !== "durable-object" || workerExport.container === void 0) continue;
|
|
63467
|
+
const reference = workerExport.container;
|
|
63468
|
+
if (typeof reference === "string") {
|
|
63469
|
+
issues.push({
|
|
63470
|
+
code: "custom",
|
|
63471
|
+
input: reference,
|
|
63472
|
+
path: [
|
|
63473
|
+
"exports",
|
|
63474
|
+
exportName,
|
|
63475
|
+
"container"
|
|
63476
|
+
],
|
|
63477
|
+
message: "Container provided as a string. Reference an exported Container definition instead."
|
|
63478
|
+
});
|
|
63479
|
+
workerExports[exportName] = {
|
|
63480
|
+
...workerExport,
|
|
63481
|
+
container: void 0
|
|
63482
|
+
};
|
|
63483
|
+
continue;
|
|
63484
|
+
}
|
|
63485
|
+
const target = await resolveDefinition(reference);
|
|
63486
|
+
if (isRecord(target) && target.type === "container" && typeof target.name === "string" && !Object.values(resolvedExports).includes(target)) {
|
|
63487
|
+
issues.push({
|
|
63488
|
+
code: "custom",
|
|
63489
|
+
input: reference,
|
|
63490
|
+
path: [
|
|
63491
|
+
"exports",
|
|
63492
|
+
exportName,
|
|
63493
|
+
"container"
|
|
63494
|
+
],
|
|
63495
|
+
message: `The referenced Container "${target.name}" is not exported.`
|
|
63496
|
+
});
|
|
63497
|
+
workerExports[exportName] = {
|
|
63498
|
+
...workerExport,
|
|
63499
|
+
container: void 0
|
|
63500
|
+
};
|
|
63501
|
+
continue;
|
|
63502
|
+
}
|
|
63503
|
+
workerExports[exportName] = {
|
|
63504
|
+
...workerExport,
|
|
63505
|
+
container: normalizeConfigReference(reference, target, "container")
|
|
63506
|
+
};
|
|
63507
|
+
}
|
|
63508
|
+
return {
|
|
63509
|
+
value: {
|
|
63510
|
+
...resolved,
|
|
63511
|
+
exports: workerExports
|
|
63512
|
+
},
|
|
63513
|
+
issues
|
|
63514
|
+
};
|
|
63515
|
+
}
|
|
63516
|
+
async function normalizeConfigReferences(resolved, resolveDefinition, resolvedExports) {
|
|
63517
|
+
return normalizeContainerReferences(await normalizeWorkerReferences(resolved, resolveDefinition), resolveDefinition, resolvedExports);
|
|
63518
|
+
}
|
|
62773
63519
|
function prefixIssues(issues, prefix) {
|
|
62774
63520
|
return issues.map((issue$1) => ({
|
|
62775
63521
|
...issue$1,
|
|
62776
63522
|
path: [prefix, ...issue$1.path]
|
|
62777
63523
|
}));
|
|
62778
63524
|
}
|
|
63525
|
+
function validateUniqueResourceNames(configExports) {
|
|
63526
|
+
const issues = [];
|
|
63527
|
+
const exportNameByResourceName = {
|
|
63528
|
+
container: /* @__PURE__ */ new Map(),
|
|
63529
|
+
worker: /* @__PURE__ */ new Map()
|
|
63530
|
+
};
|
|
63531
|
+
for (const [exportName, config$1] of Object.entries(configExports)) {
|
|
63532
|
+
if (config$1.type !== "container" && config$1.type !== "worker") continue;
|
|
63533
|
+
const resourceType = config$1.type === "container" ? "Container" : "Worker";
|
|
63534
|
+
const exportNames = exportNameByResourceName[config$1.type];
|
|
63535
|
+
const previousExportName = exportNames.get(config$1.name);
|
|
63536
|
+
if (previousExportName !== void 0) {
|
|
63537
|
+
issues.push({
|
|
63538
|
+
code: "custom",
|
|
63539
|
+
input: config$1.name,
|
|
63540
|
+
path: [exportName, "name"],
|
|
63541
|
+
message: `The ${resourceType} name "${config$1.name}" is also used by the "${previousExportName}" export. ${resourceType} names must be unique.`
|
|
63542
|
+
});
|
|
63543
|
+
continue;
|
|
63544
|
+
}
|
|
63545
|
+
exportNames.set(config$1.name, exportName);
|
|
63546
|
+
}
|
|
63547
|
+
return issues;
|
|
63548
|
+
}
|
|
63549
|
+
function validateContainerExportLinks(configExports) {
|
|
63550
|
+
const issues = [];
|
|
63551
|
+
const containerNames = /* @__PURE__ */ new Set();
|
|
63552
|
+
for (const config$1 of Object.values(configExports)) if (config$1.type === "container") containerNames.add(config$1.name);
|
|
63553
|
+
const firstReferenceByContainerName = /* @__PURE__ */ new Map();
|
|
63554
|
+
for (const [workerExportName, config$1] of Object.entries(configExports)) {
|
|
63555
|
+
if (config$1.type !== "worker") continue;
|
|
63556
|
+
for (const [durableObjectExportName, workerExport] of Object.entries(config$1.exports ?? {})) {
|
|
63557
|
+
if (workerExport.type !== "durable-object" || !("container" in workerExport) || workerExport.container === void 0) continue;
|
|
63558
|
+
const containerName = workerExport.container;
|
|
63559
|
+
const path$3 = [
|
|
63560
|
+
workerExportName,
|
|
63561
|
+
"exports",
|
|
63562
|
+
durableObjectExportName,
|
|
63563
|
+
"container"
|
|
63564
|
+
];
|
|
63565
|
+
if (!containerNames.has(containerName)) {
|
|
63566
|
+
issues.push({
|
|
63567
|
+
code: "custom",
|
|
63568
|
+
input: containerName,
|
|
63569
|
+
path: path$3,
|
|
63570
|
+
message: `The Container "${containerName}" is not exported from this configuration.`
|
|
63571
|
+
});
|
|
63572
|
+
continue;
|
|
63573
|
+
}
|
|
63574
|
+
const firstReference = firstReferenceByContainerName.get(containerName);
|
|
63575
|
+
if (firstReference !== void 0) {
|
|
63576
|
+
issues.push({
|
|
63577
|
+
code: "custom",
|
|
63578
|
+
input: containerName,
|
|
63579
|
+
path: path$3,
|
|
63580
|
+
message: `The Container "${containerName}" is already referenced by "${firstReference.workerExportName}.exports.${firstReference.durableObjectExportName}". A Container can only be linked to one Durable Object.`
|
|
63581
|
+
});
|
|
63582
|
+
continue;
|
|
63583
|
+
}
|
|
63584
|
+
firstReferenceByContainerName.set(containerName, {
|
|
63585
|
+
workerExportName,
|
|
63586
|
+
durableObjectExportName
|
|
63587
|
+
});
|
|
63588
|
+
}
|
|
63589
|
+
}
|
|
63590
|
+
return issues;
|
|
63591
|
+
}
|
|
62779
63592
|
/**
|
|
62780
63593
|
* Resolve and validate loaded `cloudflare.config.ts` exports.
|
|
62781
63594
|
*
|
|
62782
|
-
* Config inputs are resolved once by identity. Top-level Worker
|
|
62783
|
-
* also parsed once by identity
|
|
62784
|
-
* enough to replace
|
|
63595
|
+
* Config inputs are resolved once by identity. Top-level Worker and Container
|
|
63596
|
+
* exports are also parsed once by identity. References are resolved only far
|
|
63597
|
+
* enough to replace them with resource names, then Container links are
|
|
63598
|
+
* validated across the exported resources.
|
|
62785
63599
|
*/
|
|
62786
63600
|
async function resolveAndValidateConfigExports(exports$2, ctx) {
|
|
62787
63601
|
const resolveDefinition = createDefinitionResolver(ctx);
|
|
62788
|
-
const
|
|
63602
|
+
const parsedResources = /* @__PURE__ */ new Map();
|
|
62789
63603
|
const resolvedExports = {};
|
|
62790
63604
|
for (const [name, input] of Object.entries(exports$2)) resolvedExports[name] = await resolveDefinition(input);
|
|
62791
63605
|
const typeResult = ConfigExportsTypeSchema.safeParse(resolvedExports);
|
|
@@ -62799,17 +63613,20 @@ async function resolveAndValidateConfigExports(exports$2, ctx) {
|
|
|
62799
63613
|
for (const [name, input] of Object.entries(exports$2)) {
|
|
62800
63614
|
const resolved = resolvedExports[name];
|
|
62801
63615
|
if (!isRecord(resolved)) continue;
|
|
62802
|
-
if (resolved.type
|
|
62803
|
-
|
|
62804
|
-
|
|
62805
|
-
|
|
62806
|
-
|
|
62807
|
-
|
|
62808
|
-
|
|
62809
|
-
|
|
62810
|
-
|
|
62811
|
-
|
|
62812
|
-
|
|
63616
|
+
if (resolved.type !== "worker" && resolved.type !== "container") continue;
|
|
63617
|
+
let result = parsedResources.get(input);
|
|
63618
|
+
if (!result) {
|
|
63619
|
+
if (resolved.type === "worker") {
|
|
63620
|
+
const normalized = await normalizeConfigReferences(resolved, resolveDefinition, resolvedExports);
|
|
63621
|
+
issues.push(...prefixIssues(normalized.issues, name));
|
|
63622
|
+
result = InputWorkerSchema.safeParse(normalized.value);
|
|
63623
|
+
} else result = InputContainerSchema.safeParse(resolved);
|
|
63624
|
+
parsedResources.set(input, result);
|
|
63625
|
+
if (!result.success) issues.push(...prefixIssues(result.error.issues, name));
|
|
63626
|
+
}
|
|
63627
|
+
if (result.success) data[name] = result.data;
|
|
63628
|
+
}
|
|
63629
|
+
issues.push(...validateUniqueResourceNames(data), ...validateContainerExportLinks(data));
|
|
62813
63630
|
return issues.length > 0 ? {
|
|
62814
63631
|
success: false,
|
|
62815
63632
|
error: new z$1.ZodError(issues)
|