@cloudflare/vitest-plugin 1.1.5 → 1.1.7
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 +799 -504
- package/dist/pool/index.mjs.map +1 -1
- package/dist/pool/{open-PBXRGS4R-Bd-FUZNf.mjs → open-PBXRGS4R-CzyP5HqI.mjs} +2 -2
- package/dist/pool/{open-PBXRGS4R-Bd-FUZNf.mjs.map → open-PBXRGS4R-CzyP5HqI.mjs.map} +1 -1
- package/dist/worker/index.mjs.map +1 -1
- package/package.json +10 -9
- package/types/cloudflare-test.d.ts +41 -13
package/dist/pool/index.mjs
CHANGED
|
@@ -11,13 +11,13 @@ import util, { TextEncoder as TextEncoder$1, inspect, stripVTControlCharacters,
|
|
|
11
11
|
import os, { arch } from "node:os";
|
|
12
12
|
import process5, { exit, stdin, stdout } from "node:process";
|
|
13
13
|
import tty from "node:tty";
|
|
14
|
-
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
15
14
|
import net from "node:net";
|
|
16
15
|
import http from "node:http";
|
|
17
16
|
import events, { EventEmitter } from "node:events";
|
|
18
17
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
19
18
|
import { assert as assert$1 } from "node:console";
|
|
20
19
|
import fs$1 from "node:fs/promises";
|
|
20
|
+
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
21
21
|
import * as timersPromises from "node:timers/promises";
|
|
22
22
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
23
23
|
import { DeferredPromise, Log, LogLevel, Miniflare, MiniflareCoreError, Mutex, Response, V4WorkerOptionsSchema, compileModuleRules, convertV4MiniflareOptions, getNodeCompat, kCurrentWorker, kUnsafeEphemeralUniqueKey, maybeApply, mergeWorkerOptions, parseModuleFallbackRequest, structuredSerializableReducers, structuredSerializableRevivers, testRegExps } from "miniflare";
|
|
@@ -75,10 +75,10 @@ function isAnnotation(value) {
|
|
|
75
75
|
return typeof value === "object" && value !== null && kMessages in value && kActual in value;
|
|
76
76
|
}
|
|
77
77
|
__name$3(isAnnotation, "isAnnotation");
|
|
78
|
-
function isRecord$
|
|
78
|
+
function isRecord$2(value) {
|
|
79
79
|
return typeof value === "object" && value !== null;
|
|
80
80
|
}
|
|
81
|
-
__name$3(isRecord$
|
|
81
|
+
__name$3(isRecord$2, "isRecord");
|
|
82
82
|
function arrayShallowEqual(a, b) {
|
|
83
83
|
if (a.length !== b.length) return false;
|
|
84
84
|
for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;
|
|
@@ -107,7 +107,7 @@ function annotate(groupCounts, annotated, input, issue$1, path$3, groupId) {
|
|
|
107
107
|
if (unionIssues.length > 0) {
|
|
108
108
|
const multipleDistinct = hasMultipleDistinctMessages(unionIssues, 1);
|
|
109
109
|
let newGroupId;
|
|
110
|
-
if (isRecord$
|
|
110
|
+
if (isRecord$2(input) && multipleDistinct) {
|
|
111
111
|
newGroupId = groupCounts.size;
|
|
112
112
|
groupCounts.set(newGroupId, 0);
|
|
113
113
|
}
|
|
@@ -136,13 +136,13 @@ function annotate(groupCounts, annotated, input, issue$1, path$3, groupId) {
|
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
const [head, ...tail$1] = path$3;
|
|
139
|
-
assert(isRecord$
|
|
139
|
+
assert(isRecord$2(input), "Expected object/array input for nested issue");
|
|
140
140
|
if (annotated === void 0) if (Array.isArray(input)) annotated = new Array(input.length);
|
|
141
141
|
else {
|
|
142
142
|
const entries = Object.keys(input).map((key) => [key, void 0]);
|
|
143
143
|
annotated = Object.fromEntries(entries);
|
|
144
144
|
}
|
|
145
|
-
assert(isRecord$
|
|
145
|
+
assert(isRecord$2(annotated), "Expected object/array for nested issue");
|
|
146
146
|
annotated[head] = annotate(groupCounts, annotated[head], input[head], issue$1, tail$1, groupId);
|
|
147
147
|
return annotated;
|
|
148
148
|
}
|
|
@@ -188,7 +188,7 @@ ${error$2}`;
|
|
|
188
188
|
}
|
|
189
189
|
result += `${indent}${dim$2(`]${suffix}`)}`;
|
|
190
190
|
return result;
|
|
191
|
-
} else if (isRecord$
|
|
191
|
+
} else if (isRecord$2(annotated)) {
|
|
192
192
|
let result = `${indent}${dim$2(`${prefix}{`)}
|
|
193
193
|
`;
|
|
194
194
|
const objectIndent = indent + " ";
|
|
@@ -325,49 +325,58 @@ 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-IQDQ5WRD.mjs
|
|
329
329
|
function hasKnownExportType(entry) {
|
|
330
330
|
const type = entry?.type;
|
|
331
331
|
return type === "durable-object" || type === "worker";
|
|
332
332
|
}
|
|
333
333
|
__name$3(hasKnownExportType, "hasKnownExportType");
|
|
334
|
-
function partitionExports(exports$1
|
|
334
|
+
function partitionExports(exports$1) {
|
|
335
335
|
const partitioned = {
|
|
336
336
|
"durable-object": {},
|
|
337
337
|
worker: {}
|
|
338
338
|
};
|
|
339
|
-
if (exports$1
|
|
340
|
-
for (const [name, entry] of Object.entries(exports$1
|
|
339
|
+
if (exports$1 === void 0) return partitioned;
|
|
340
|
+
for (const [name, entry] of Object.entries(exports$1)) {
|
|
341
341
|
if (!hasKnownExportType(entry)) continue;
|
|
342
342
|
partitioned[entry.type][name] = entry;
|
|
343
343
|
}
|
|
344
344
|
return partitioned;
|
|
345
345
|
}
|
|
346
346
|
__name$3(partitionExports, "partitionExports");
|
|
347
|
-
function getDurableObjectExports(exports$1
|
|
348
|
-
return partitionExports(exports$1
|
|
347
|
+
function getDurableObjectExports(exports$1) {
|
|
348
|
+
return partitionExports(exports$1)["durable-object"];
|
|
349
349
|
}
|
|
350
350
|
__name$3(getDurableObjectExports, "getDurableObjectExports");
|
|
351
|
-
function hasDurableObjectExports(exports$1
|
|
352
|
-
return Object.keys(getDurableObjectExports(exports$1
|
|
351
|
+
function hasDurableObjectExports(exports$1) {
|
|
352
|
+
return Object.keys(getDurableObjectExports(exports$1)).length > 0;
|
|
353
353
|
}
|
|
354
354
|
__name$3(hasDurableObjectExports, "hasDurableObjectExports");
|
|
355
|
-
|
|
355
|
+
var CONTAINER_IMAGES_BINDING = "EXPERIMENTAL_CLOUDFLARE_CONTAINER_IMAGES";
|
|
356
|
+
function isDurableObjectContainerApp(container) {
|
|
357
|
+
return container.scheduling_policy === "durable_object";
|
|
358
|
+
}
|
|
359
|
+
__name$3(isDurableObjectContainerApp, "isDurableObjectContainerApp");
|
|
360
|
+
function getDurableObjectContainerApps(containers) {
|
|
361
|
+
return Array.isArray(containers) ? containers.filter(isDurableObjectContainerApp) : [];
|
|
362
|
+
}
|
|
363
|
+
__name$3(getDurableObjectContainerApps, "getDurableObjectContainerApps");
|
|
364
|
+
function getContainerNameToClassNameMap(exports$1) {
|
|
356
365
|
const containerNameToClassName = /* @__PURE__ */ new Map();
|
|
357
|
-
for (const [className, entry] of Object.entries(getDurableObjectExports(exports$1
|
|
366
|
+
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);
|
|
358
367
|
return containerNameToClassName;
|
|
359
368
|
}
|
|
360
369
|
__name$3(getContainerNameToClassNameMap, "getContainerNameToClassNameMap");
|
|
361
|
-
function resolveContainerClassName(container, exports$1
|
|
370
|
+
function resolveContainerClassName(container, exports$1) {
|
|
362
371
|
if (container.class_name !== void 0) return container.class_name;
|
|
363
372
|
if (container.name === void 0) return;
|
|
364
|
-
return getContainerNameToClassNameMap(exports$1
|
|
373
|
+
return getContainerNameToClassNameMap(exports$1).get(container.name);
|
|
365
374
|
}
|
|
366
375
|
__name$3(resolveContainerClassName, "resolveContainerClassName");
|
|
367
|
-
function getContainerDurableObjectClassNames(containers, exports$1
|
|
376
|
+
function getContainerDurableObjectClassNames(containers, exports$1) {
|
|
368
377
|
const classNames = /* @__PURE__ */ new Set();
|
|
369
378
|
for (const container of containers ?? []) {
|
|
370
|
-
const className = resolveContainerClassName(container, exports$1
|
|
379
|
+
const className = resolveContainerClassName(container, exports$1);
|
|
371
380
|
if (className !== void 0) classNames.add(className);
|
|
372
381
|
}
|
|
373
382
|
return classNames;
|
|
@@ -2736,12 +2745,12 @@ function formatConfigSnippet(snippet, configPath, formatted = true) {
|
|
|
2736
2745
|
__name$3(formatConfigSnippet, "formatConfigSnippet");
|
|
2737
2746
|
|
|
2738
2747
|
//#endregion
|
|
2739
|
-
//#region ../workers-utils/dist/chunk-
|
|
2740
|
-
var DEFAULT_COMPAT_DATE = "2026-09-
|
|
2748
|
+
//#region ../workers-utils/dist/chunk-S3ANQ67D.mjs
|
|
2749
|
+
var DEFAULT_COMPAT_DATE = "2026-09-10";
|
|
2741
2750
|
function assertNever(_value) {}
|
|
2742
2751
|
__name$3(assertNever, "assertNever");
|
|
2743
|
-
function mapWorkerMetadataBindings(bindings
|
|
2744
|
-
return bindings
|
|
2752
|
+
function mapWorkerMetadataBindings(bindings) {
|
|
2753
|
+
return bindings.filter((binding) => binding.type !== "secret_text").reduce((configObj, binding) => {
|
|
2745
2754
|
switch (binding.type) {
|
|
2746
2755
|
case "plain_text":
|
|
2747
2756
|
configObj.vars = {
|
|
@@ -3268,7 +3277,7 @@ function getGlobalWranglerCachePath() {
|
|
|
3268
3277
|
__name$3(getGlobalWranglerCachePath, "getGlobalWranglerCachePath");
|
|
3269
3278
|
|
|
3270
3279
|
//#endregion
|
|
3271
|
-
//#region ../workers-utils/dist/chunk-
|
|
3280
|
+
//#region ../workers-utils/dist/chunk-IYSONYTF.mjs
|
|
3272
3281
|
var getC3CommandFromEnv = getEnvironmentVariableFactory({
|
|
3273
3282
|
variableName: "WRANGLER_C3_COMMAND",
|
|
3274
3283
|
defaultValue: /* @__PURE__ */ __name$3(() => "create cloudflare", "defaultValue")
|
|
@@ -3296,6 +3305,7 @@ var getCloudflareApiEnvironmentFromEnv = getEnvironmentVariableFactory({
|
|
|
3296
3305
|
choices: ["production", "staging"]
|
|
3297
3306
|
});
|
|
3298
3307
|
var COMPLIANCE_REGION_CONFIG_PUBLIC = { compliance_region: "public" };
|
|
3308
|
+
var COMPLIANCE_REGION_CONFIG_UNKNOWN = { compliance_region: void 0 };
|
|
3299
3309
|
var getCloudflareComplianceRegionFromEnv = getEnvironmentVariableFactory({
|
|
3300
3310
|
variableName: "CLOUDFLARE_COMPLIANCE_REGION",
|
|
3301
3311
|
choices: ["public", "fedramp_high"]
|
|
@@ -3318,6 +3328,11 @@ function getComplianceRegionSubdomain(complianceConfig) {
|
|
|
3318
3328
|
return getCloudflareComplianceRegion(complianceConfig) === "fedramp_high" ? ".fed" : "";
|
|
3319
3329
|
}
|
|
3320
3330
|
__name$3(getComplianceRegionSubdomain, "getComplianceRegionSubdomain");
|
|
3331
|
+
function getCloudflareContainerRegistry(complianceConfig = COMPLIANCE_REGION_CONFIG_UNKNOWN) {
|
|
3332
|
+
if (process.env.CLOUDFLARE_CONTAINER_REGISTRY) return process.env.CLOUDFLARE_CONTAINER_REGISTRY;
|
|
3333
|
+
return `${process.env.WRANGLER_API_ENVIRONMENT === "staging" ? "staging." : ""}registry${getComplianceRegionSubdomain(complianceConfig)}.cloudflare.com`;
|
|
3334
|
+
}
|
|
3335
|
+
__name$3(getCloudflareContainerRegistry, "getCloudflareContainerRegistry");
|
|
3321
3336
|
function getStagingSubdomain() {
|
|
3322
3337
|
return getCloudflareApiEnvironmentFromEnv() === "staging" ? ".staging" : "";
|
|
3323
3338
|
}
|
|
@@ -9991,8 +10006,8 @@ var require_client_h1 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
|
|
|
9991
10006
|
* @param {import('net').Socket} socket
|
|
9992
10007
|
* @param {*} llhttp
|
|
9993
10008
|
*/
|
|
9994
|
-
constructor(client, socket, { exports: exports$
|
|
9995
|
-
this.llhttp = exports$
|
|
10009
|
+
constructor(client, socket, { exports: exports$1 }) {
|
|
10010
|
+
this.llhttp = exports$1;
|
|
9996
10011
|
this.ptr = this.llhttp.llhttp_alloc(constants$3.TYPE.RESPONSE);
|
|
9997
10012
|
this.client = client;
|
|
9998
10013
|
/**
|
|
@@ -26109,7 +26124,7 @@ var require_undici = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
|
|
|
26109
26124
|
//#endregion
|
|
26110
26125
|
//#region ../workers-utils/dist/index.mjs
|
|
26111
26126
|
var import_undici$3 = require_undici();
|
|
26112
|
-
var require_vendors$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json"(exports$1
|
|
26127
|
+
var require_vendors$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json"(exports$1, module$1) {
|
|
26113
26128
|
module$1.exports = [
|
|
26114
26129
|
{
|
|
26115
26130
|
name: "Agola CI",
|
|
@@ -26435,26 +26450,26 @@ var require_vendors$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/n
|
|
|
26435
26450
|
}
|
|
26436
26451
|
];
|
|
26437
26452
|
} });
|
|
26438
|
-
var require_ci_info$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/index.js"(exports$1
|
|
26453
|
+
var require_ci_info$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/index.js"(exports$1) {
|
|
26439
26454
|
var vendors$1 = require_vendors$1();
|
|
26440
26455
|
var env$2 = process.env;
|
|
26441
|
-
Object.defineProperty(exports$1
|
|
26456
|
+
Object.defineProperty(exports$1, "_vendors", { value: vendors$1.map(function(v) {
|
|
26442
26457
|
return v.constant;
|
|
26443
26458
|
}) });
|
|
26444
|
-
exports$1
|
|
26445
|
-
exports$1
|
|
26446
|
-
exports$1
|
|
26459
|
+
exports$1.name = null;
|
|
26460
|
+
exports$1.isPR = null;
|
|
26461
|
+
exports$1.id = null;
|
|
26447
26462
|
if (env$2.CI !== "false") vendors$1.forEach(function(vendor) {
|
|
26448
26463
|
const isCI2 = (Array.isArray(vendor.env) ? vendor.env : [vendor.env]).every(function(obj) {
|
|
26449
26464
|
return checkEnv$1(obj);
|
|
26450
26465
|
});
|
|
26451
|
-
exports$1
|
|
26466
|
+
exports$1[vendor.constant] = isCI2;
|
|
26452
26467
|
if (!isCI2) return;
|
|
26453
|
-
exports$1
|
|
26454
|
-
exports$1
|
|
26455
|
-
exports$1
|
|
26468
|
+
exports$1.name = vendor.name;
|
|
26469
|
+
exports$1.isPR = checkPR$1(vendor);
|
|
26470
|
+
exports$1.id = vendor.constant;
|
|
26456
26471
|
});
|
|
26457
|
-
exports$1
|
|
26472
|
+
exports$1.isCI = !!(env$2.CI !== "false" && (env$2.BUILD_ID || env$2.BUILD_NUMBER || env$2.CI || env$2.CI_APP_ID || env$2.CI_BUILD_ID || env$2.CI_BUILD_NUMBER || env$2.CI_NAME || env$2.CONTINUOUS_INTEGRATION || env$2.RUN_ID || exports$1.name || false));
|
|
26458
26473
|
function checkEnv$1(obj) {
|
|
26459
26474
|
if (typeof obj === "string") return !!env$2[obj];
|
|
26460
26475
|
if ("env" in obj) return env$2[obj.env] && env$2[obj.env].includes(obj.includes);
|
|
@@ -26482,7 +26497,7 @@ var require_ci_info$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/n
|
|
|
26482
26497
|
}
|
|
26483
26498
|
__name$3(checkPR$1, "checkPR");
|
|
26484
26499
|
} });
|
|
26485
|
-
var require_command_exists$2 = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports$1
|
|
26500
|
+
var require_command_exists$2 = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports$1, module$1) {
|
|
26486
26501
|
var exec$3 = __require("child_process").exec;
|
|
26487
26502
|
var execSync$1 = __require("child_process").execSync;
|
|
26488
26503
|
var fs3 = __require("fs");
|
|
@@ -26586,14 +26601,14 @@ var require_command_exists$2 = __commonJS$1({ "../../node_modules/.pnpm/command-
|
|
|
26586
26601
|
else return commandExistsUnixSync$1(commandName, cleanedCommandName);
|
|
26587
26602
|
};
|
|
26588
26603
|
} });
|
|
26589
|
-
var require_command_exists2 = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/index.js"(exports$1
|
|
26604
|
+
var require_command_exists2 = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/index.js"(exports$1, module$1) {
|
|
26590
26605
|
module$1.exports = require_command_exists$2();
|
|
26591
26606
|
} });
|
|
26592
|
-
var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports$1
|
|
26593
|
-
exports$1
|
|
26594
|
-
exports$1
|
|
26595
|
-
exports$1
|
|
26596
|
-
exports$1
|
|
26607
|
+
var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports$1) {
|
|
26608
|
+
exports$1.parse = exports$1.decode = decode3;
|
|
26609
|
+
exports$1.stringify = exports$1.encode = encode3;
|
|
26610
|
+
exports$1.safe = safe;
|
|
26611
|
+
exports$1.unsafe = unsafe;
|
|
26597
26612
|
var eol = typeof process !== "undefined" && process.platform === "win32" ? "\r\n" : "\n";
|
|
26598
26613
|
function encode3(obj, opt) {
|
|
26599
26614
|
var children = [];
|
|
@@ -26725,7 +26740,7 @@ var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_module
|
|
|
26725
26740
|
}
|
|
26726
26741
|
__name$3(unsafe, "unsafe");
|
|
26727
26742
|
} });
|
|
26728
|
-
var require_strip_json_comments = __commonJS$1({ "../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js"(exports$1
|
|
26743
|
+
var require_strip_json_comments = __commonJS$1({ "../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js"(exports$1, module$1) {
|
|
26729
26744
|
var singleComment = 1;
|
|
26730
26745
|
var multiComment = 2;
|
|
26731
26746
|
function stripWithoutWhitespace() {
|
|
@@ -26784,16 +26799,16 @@ var require_strip_json_comments = __commonJS$1({ "../../node_modules/.pnpm/strip
|
|
|
26784
26799
|
return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset));
|
|
26785
26800
|
};
|
|
26786
26801
|
} });
|
|
26787
|
-
var require_utils = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports$1
|
|
26802
|
+
var require_utils = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports$1) {
|
|
26788
26803
|
var fs3 = __require("fs");
|
|
26789
26804
|
var ini = require_ini();
|
|
26790
26805
|
var path5 = __require("path");
|
|
26791
26806
|
var stripJsonComments = require_strip_json_comments();
|
|
26792
|
-
var parse3$1 = exports$1
|
|
26807
|
+
var parse3$1 = exports$1.parse = function(content) {
|
|
26793
26808
|
if (/^\s*{/.test(content)) return JSON.parse(stripJsonComments(content));
|
|
26794
26809
|
return ini.parse(content);
|
|
26795
26810
|
};
|
|
26796
|
-
var file2 = exports$1
|
|
26811
|
+
var file2 = exports$1.file = function() {
|
|
26797
26812
|
var args = [].slice.call(arguments).filter(function(arg) {
|
|
26798
26813
|
return arg != null;
|
|
26799
26814
|
});
|
|
@@ -26805,11 +26820,11 @@ var require_utils = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modul
|
|
|
26805
26820
|
return;
|
|
26806
26821
|
}
|
|
26807
26822
|
};
|
|
26808
|
-
exports$1
|
|
26823
|
+
exports$1.json = function() {
|
|
26809
26824
|
var content = file2.apply(null, arguments);
|
|
26810
26825
|
return content ? parse3$1(content) : null;
|
|
26811
26826
|
};
|
|
26812
|
-
exports$1
|
|
26827
|
+
exports$1.env = function(prefix, env2) {
|
|
26813
26828
|
env2 = env2 || process.env;
|
|
26814
26829
|
var obj = {};
|
|
26815
26830
|
var l = prefix.length;
|
|
@@ -26827,7 +26842,7 @@ var require_utils = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modul
|
|
|
26827
26842
|
}
|
|
26828
26843
|
return obj;
|
|
26829
26844
|
};
|
|
26830
|
-
exports$1
|
|
26845
|
+
exports$1.find = function() {
|
|
26831
26846
|
var rel = path5.join.apply(null, [].slice.call(arguments));
|
|
26832
26847
|
function find2(start, rel2) {
|
|
26833
26848
|
var file3 = path5.join(start, rel2);
|
|
@@ -26842,7 +26857,7 @@ var require_utils = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modul
|
|
|
26842
26857
|
return find2(process.cwd(), rel);
|
|
26843
26858
|
};
|
|
26844
26859
|
} });
|
|
26845
|
-
var require_deep_extend = __commonJS$1({ "../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js"(exports$1
|
|
26860
|
+
var require_deep_extend = __commonJS$1({ "../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js"(exports$1, module$1) {
|
|
26846
26861
|
function isSpecificValue(val) {
|
|
26847
26862
|
return val instanceof Buffer || val instanceof Date || val instanceof RegExp ? true : false;
|
|
26848
26863
|
}
|
|
@@ -26905,7 +26920,7 @@ var require_deep_extend = __commonJS$1({ "../../node_modules/.pnpm/deep-extend@0
|
|
|
26905
26920
|
return target;
|
|
26906
26921
|
};
|
|
26907
26922
|
} });
|
|
26908
|
-
var require_minimist = __commonJS$1({ "../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports$1
|
|
26923
|
+
var require_minimist = __commonJS$1({ "../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports$1, module$1) {
|
|
26909
26924
|
module$1.exports = function(args, opts) {
|
|
26910
26925
|
if (!opts) opts = {};
|
|
26911
26926
|
var flags = {
|
|
@@ -27080,7 +27095,7 @@ var require_minimist = __commonJS$1({ "../../node_modules/.pnpm/minimist@1.2.6/n
|
|
|
27080
27095
|
}
|
|
27081
27096
|
__name$3(isConstructorOrProto, "isConstructorOrProto");
|
|
27082
27097
|
} });
|
|
27083
|
-
var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports$1
|
|
27098
|
+
var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports$1, module$1) {
|
|
27084
27099
|
var cc = require_utils();
|
|
27085
27100
|
var join3 = __require("path").join;
|
|
27086
27101
|
var deepExtend = require_deep_extend();
|
|
@@ -27124,14 +27139,14 @@ var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/
|
|
|
27124
27139
|
]));
|
|
27125
27140
|
};
|
|
27126
27141
|
} });
|
|
27127
|
-
var require_registry_url = __commonJS$1({ "../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js"(exports$1
|
|
27142
|
+
var require_registry_url = __commonJS$1({ "../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js"(exports$1, module$1) {
|
|
27128
27143
|
module$1.exports = function(scope) {
|
|
27129
27144
|
var rc = require_rc()("npm", { registry: "https://registry.npmjs.org/" });
|
|
27130
27145
|
var url2 = rc[scope + ":registry"] || rc.registry;
|
|
27131
27146
|
return url2.slice(-1) === "/" ? url2 : url2 + "/";
|
|
27132
27147
|
};
|
|
27133
27148
|
} });
|
|
27134
|
-
var require_safe_buffer = __commonJS$1({ "../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(exports$1
|
|
27149
|
+
var require_safe_buffer = __commonJS$1({ "../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(exports$1, module$1) {
|
|
27135
27150
|
var buffer$1 = __require("buffer");
|
|
27136
27151
|
var Buffer2 = buffer$1.Buffer;
|
|
27137
27152
|
function copyProps(src$2, dst) {
|
|
@@ -27140,8 +27155,8 @@ var require_safe_buffer = __commonJS$1({ "../../node_modules/.pnpm/safe-buffer@5
|
|
|
27140
27155
|
__name$3(copyProps, "copyProps");
|
|
27141
27156
|
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) module$1.exports = buffer$1;
|
|
27142
27157
|
else {
|
|
27143
|
-
copyProps(buffer$1, exports$1
|
|
27144
|
-
exports$1
|
|
27158
|
+
copyProps(buffer$1, exports$1);
|
|
27159
|
+
exports$1.Buffer = SafeBuffer;
|
|
27145
27160
|
}
|
|
27146
27161
|
function SafeBuffer(arg, encodingOrOffset, length) {
|
|
27147
27162
|
return Buffer2(arg, encodingOrOffset, length);
|
|
@@ -27170,7 +27185,7 @@ var require_safe_buffer = __commonJS$1({ "../../node_modules/.pnpm/safe-buffer@5
|
|
|
27170
27185
|
return buffer$1.SlowBuffer(size);
|
|
27171
27186
|
};
|
|
27172
27187
|
} });
|
|
27173
|
-
var require_base64 = __commonJS$1({ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/base64.js"(exports$1
|
|
27188
|
+
var require_base64 = __commonJS$1({ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/base64.js"(exports$1, module$1) {
|
|
27174
27189
|
var safeBuffer = require_safe_buffer().Buffer;
|
|
27175
27190
|
function decodeBase64(base643) {
|
|
27176
27191
|
return safeBuffer.from(base643, "base64").toString("utf8");
|
|
@@ -27185,7 +27200,7 @@ var require_base64 = __commonJS$1({ "../../node_modules/.pnpm/registry-auth-toke
|
|
|
27185
27200
|
encodeBase64
|
|
27186
27201
|
};
|
|
27187
27202
|
} });
|
|
27188
|
-
var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/index.js"(exports$1
|
|
27203
|
+
var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/index.js"(exports$1, module$1) {
|
|
27189
27204
|
var url2 = __require("url");
|
|
27190
27205
|
var base643 = require_base64();
|
|
27191
27206
|
var decodeBase64 = base643.decodeBase64;
|
|
@@ -27260,7 +27275,7 @@ var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/regis
|
|
|
27260
27275
|
}
|
|
27261
27276
|
__name$3(getTokenForUsernameAndPassword, "getTokenForUsernameAndPassword");
|
|
27262
27277
|
} });
|
|
27263
|
-
var require_update_check = __commonJS$1({ "../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports$1
|
|
27278
|
+
var require_update_check = __commonJS$1({ "../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports$1, module$1) {
|
|
27264
27279
|
var { URL: URL2 } = __require("url");
|
|
27265
27280
|
var { join: join3 } = __require("path");
|
|
27266
27281
|
var fs3 = __require("fs");
|
|
@@ -28153,7 +28168,7 @@ __export(util_exports, {
|
|
|
28153
28168
|
parsedType: () => parsedType,
|
|
28154
28169
|
partial: () => partial,
|
|
28155
28170
|
pick: () => pick,
|
|
28156
|
-
prefixIssues: () => prefixIssues,
|
|
28171
|
+
prefixIssues: () => prefixIssues$1,
|
|
28157
28172
|
primitiveTypes: () => primitiveTypes,
|
|
28158
28173
|
promiseAllObject: () => promiseAllObject,
|
|
28159
28174
|
propertyKeyTypes: () => propertyKeyTypes,
|
|
@@ -28603,7 +28618,7 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
28603
28618
|
return false;
|
|
28604
28619
|
}
|
|
28605
28620
|
__name$3(explicitlyAborted, "explicitlyAborted");
|
|
28606
|
-
function prefixIssues(path5, issues) {
|
|
28621
|
+
function prefixIssues$1(path5, issues) {
|
|
28607
28622
|
return issues.map((iss) => {
|
|
28608
28623
|
var _a3;
|
|
28609
28624
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
@@ -28611,7 +28626,7 @@ function prefixIssues(path5, issues) {
|
|
|
28611
28626
|
return iss;
|
|
28612
28627
|
});
|
|
28613
28628
|
}
|
|
28614
|
-
__name$3(prefixIssues, "prefixIssues");
|
|
28629
|
+
__name$3(prefixIssues$1, "prefixIssues");
|
|
28615
28630
|
function unwrapMessage(message) {
|
|
28616
28631
|
return typeof message === "string" ? message : message?.message;
|
|
28617
28632
|
}
|
|
@@ -29576,7 +29591,7 @@ var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst,
|
|
|
29576
29591
|
};
|
|
29577
29592
|
});
|
|
29578
29593
|
function handleCheckPropertyResult(result, payload, property) {
|
|
29579
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(property, result.issues));
|
|
29594
|
+
if (result.issues.length) payload.issues.push(...prefixIssues$1(property, result.issues));
|
|
29580
29595
|
}
|
|
29581
29596
|
__name$3(handleCheckPropertyResult, "handleCheckPropertyResult");
|
|
29582
29597
|
var $ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (inst, def) => {
|
|
@@ -30199,7 +30214,7 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
30199
30214
|
};
|
|
30200
30215
|
});
|
|
30201
30216
|
function handleArrayResult(result, final, index) {
|
|
30202
|
-
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
30217
|
+
if (result.issues.length) final.issues.push(...prefixIssues$1(index, result.issues));
|
|
30203
30218
|
final.value[index] = result.value;
|
|
30204
30219
|
}
|
|
30205
30220
|
__name$3(handleArrayResult, "handleArrayResult");
|
|
@@ -30235,7 +30250,7 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
30235
30250
|
const isPresent = key in input;
|
|
30236
30251
|
if (result.issues.length) {
|
|
30237
30252
|
if (isOptionalIn && isOptionalOut && !isPresent) return;
|
|
30238
|
-
final.issues.push(...prefixIssues(key, result.issues));
|
|
30253
|
+
final.issues.push(...prefixIssues$1(key, result.issues));
|
|
30239
30254
|
}
|
|
30240
30255
|
if (!isPresent && !isOptionalIn) {
|
|
30241
30256
|
if (!result.issues.length) final.issues.push({
|
|
@@ -30807,7 +30822,7 @@ function getTupleOptStart(items, key) {
|
|
|
30807
30822
|
}
|
|
30808
30823
|
__name$3(getTupleOptStart, "getTupleOptStart");
|
|
30809
30824
|
function handleTupleResult(result, final, index) {
|
|
30810
|
-
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
30825
|
+
if (result.issues.length) final.issues.push(...prefixIssues$1(index, result.issues));
|
|
30811
30826
|
final.value[index] = result.value;
|
|
30812
30827
|
}
|
|
30813
30828
|
__name$3(handleTupleResult, "handleTupleResult");
|
|
@@ -30820,7 +30835,7 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
30820
30835
|
final.value.length = i;
|
|
30821
30836
|
break;
|
|
30822
30837
|
}
|
|
30823
|
-
final.issues.push(...prefixIssues(i, r2.issues));
|
|
30838
|
+
final.issues.push(...prefixIssues$1(i, r2.issues));
|
|
30824
30839
|
}
|
|
30825
30840
|
final.value[i] = r2.value;
|
|
30826
30841
|
}
|
|
@@ -30871,11 +30886,11 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
30871
30886
|
issues: []
|
|
30872
30887
|
}, ctx);
|
|
30873
30888
|
if (result instanceof Promise) proms.push(result.then((result2) => {
|
|
30874
|
-
if (result2.issues.length) payload.issues.push(...prefixIssues(key, result2.issues));
|
|
30889
|
+
if (result2.issues.length) payload.issues.push(...prefixIssues$1(key, result2.issues));
|
|
30875
30890
|
payload.value[outKey] = result2.value;
|
|
30876
30891
|
}));
|
|
30877
30892
|
else {
|
|
30878
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
30893
|
+
if (result.issues.length) payload.issues.push(...prefixIssues$1(key, result.issues));
|
|
30879
30894
|
payload.value[outKey] = result.value;
|
|
30880
30895
|
}
|
|
30881
30896
|
}
|
|
@@ -30925,11 +30940,11 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
30925
30940
|
issues: []
|
|
30926
30941
|
}, ctx);
|
|
30927
30942
|
if (result instanceof Promise) proms.push(result.then((result2) => {
|
|
30928
|
-
if (result2.issues.length) payload.issues.push(...prefixIssues(key, result2.issues));
|
|
30943
|
+
if (result2.issues.length) payload.issues.push(...prefixIssues$1(key, result2.issues));
|
|
30929
30944
|
payload.value[keyResult.value] = result2.value;
|
|
30930
30945
|
}));
|
|
30931
30946
|
else {
|
|
30932
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
30947
|
+
if (result.issues.length) payload.issues.push(...prefixIssues$1(key, result.issues));
|
|
30933
30948
|
payload.value[keyResult.value] = result.value;
|
|
30934
30949
|
}
|
|
30935
30950
|
}
|
|
@@ -30972,7 +30987,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
|
30972
30987
|
};
|
|
30973
30988
|
});
|
|
30974
30989
|
function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
30975
|
-
if (keyResult.issues.length) if (propertyKeyTypes.has(typeof key)) final.issues.push(...prefixIssues(key, keyResult.issues));
|
|
30990
|
+
if (keyResult.issues.length) if (propertyKeyTypes.has(typeof key)) final.issues.push(...prefixIssues$1(key, keyResult.issues));
|
|
30976
30991
|
else final.issues.push({
|
|
30977
30992
|
code: "invalid_key",
|
|
30978
30993
|
origin: "map",
|
|
@@ -30980,7 +30995,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
30980
30995
|
inst,
|
|
30981
30996
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
30982
30997
|
});
|
|
30983
|
-
if (valueResult.issues.length) if (propertyKeyTypes.has(typeof key)) final.issues.push(...prefixIssues(key, valueResult.issues));
|
|
30998
|
+
if (valueResult.issues.length) if (propertyKeyTypes.has(typeof key)) final.issues.push(...prefixIssues$1(key, valueResult.issues));
|
|
30984
30999
|
else final.issues.push({
|
|
30985
31000
|
origin: "map",
|
|
30986
31001
|
code: "invalid_element",
|
|
@@ -41472,14 +41487,14 @@ var getBindingNames = /* @__PURE__ */ __name$3((value) => {
|
|
|
41472
41487
|
if (typeof value !== "object" || value === null) return [];
|
|
41473
41488
|
if (isBindingList(value)) return value.bindings.map(({ name }) => name);
|
|
41474
41489
|
else if (isNamespaceList(value)) return value.map(({ binding }) => binding);
|
|
41475
|
-
else if (isRecord(value)) {
|
|
41490
|
+
else if (isRecord$1(value)) {
|
|
41476
41491
|
if (value["binding"] !== void 0) return [value["binding"]];
|
|
41477
41492
|
return Object.keys(value).filter((k) => value[k] !== void 0);
|
|
41478
41493
|
} else return [];
|
|
41479
41494
|
}, "getBindingNames");
|
|
41480
|
-
var isBindingList = /* @__PURE__ */ __name$3((value) => isRecord(value) && "bindings" in value && Array.isArray(value.bindings) && value.bindings.every((binding) => isRecord(binding) && "name" in binding && typeof binding.name === "string"), "isBindingList");
|
|
41481
|
-
var isNamespaceList = /* @__PURE__ */ __name$3((value) => Array.isArray(value) && value.every((entry) => isRecord(entry) && "binding" in entry && typeof entry.binding === "string"), "isNamespaceList");
|
|
41482
|
-
var isRecord = /* @__PURE__ */ __name$3((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRecord");
|
|
41495
|
+
var isBindingList = /* @__PURE__ */ __name$3((value) => isRecord$1(value) && "bindings" in value && Array.isArray(value.bindings) && value.bindings.every((binding) => isRecord$1(binding) && "name" in binding && typeof binding.name === "string"), "isBindingList");
|
|
41496
|
+
var isNamespaceList = /* @__PURE__ */ __name$3((value) => Array.isArray(value) && value.every((entry) => isRecord$1(entry) && "binding" in entry && typeof entry.binding === "string"), "isNamespaceList");
|
|
41497
|
+
var isRecord$1 = /* @__PURE__ */ __name$3((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRecord");
|
|
41483
41498
|
var validateUniqueNameProperty = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
|
|
41484
41499
|
if (Array.isArray(value)) {
|
|
41485
41500
|
const nameCount = /* @__PURE__ */ new Map();
|
|
@@ -42054,7 +42069,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
|
|
|
42054
42069
|
exports: inheritable(diagnostics, topLevelEnv, rawEnv, "exports", validateExports, {}),
|
|
42055
42070
|
kv_namespaces: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "kv_namespaces", validateBindingArray(envName, validateKVBinding), []),
|
|
42056
42071
|
cloudchamber: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "cloudchamber", validateCloudchamberConfig, {}),
|
|
42057
|
-
containers: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "containers", validateContainerApp(envName, rawEnv.name ?? rawConfig?.name, configPath), void 0),
|
|
42072
|
+
containers: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "containers", validateContainerApp(envName, rawEnv.name ?? rawConfig?.name, configPath, { complianceConfig: { compliance_region: rawEnv.compliance_region ?? topLevelEnv?.compliance_region } }), void 0),
|
|
42058
42073
|
send_email: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "send_email", validateBindingArray(envName, validateSendEmailBinding), []),
|
|
42059
42074
|
queues: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "queues", validateQueues(envName), {
|
|
42060
42075
|
producers: [],
|
|
@@ -42675,6 +42690,11 @@ function validatePreviewsContainers(envName, configPath) {
|
|
|
42675
42690
|
const innerValidator = validateContainerApp(envName, void 0, configPath, { generateDefaultName: false });
|
|
42676
42691
|
return (diagnostics, field, value, config2) => {
|
|
42677
42692
|
if (Array.isArray(value)) {
|
|
42693
|
+
const durableObjectPolicyFields = [...value.entries()].filter(([, entry]) => entry && typeof entry === "object" && entry.scheduling_policy === "durable_object").map(([index]) => `"${field}[${index}].scheduling_policy"`);
|
|
42694
|
+
if (durableObjectPolicyFields.length > 0) {
|
|
42695
|
+
diagnostics.errors.push(`${durableObjectPolicyFields.join(", ")} cannot be "durable_object". Durable Object-managed Containers are configured only in the top-level "containers" array.`);
|
|
42696
|
+
return false;
|
|
42697
|
+
}
|
|
42678
42698
|
const nameFields = [...value.entries()].filter(([, entry]) => entry && typeof entry === "object" && "name" in entry).map(([index]) => `"${field}[${index}].name"`);
|
|
42679
42699
|
if (nameFields.length > 0) {
|
|
42680
42700
|
diagnostics.errors.push(`${nameFields.join(", ")} cannot be set. A preview container's application name is generated from the worker name, preview slug, and Durable Object class name, so that separate previews of the same Worker do not collide. Remove it and identify the container with "class_name".`);
|
|
@@ -42699,6 +42719,63 @@ function validatePreviewsContainers(envName, configPath) {
|
|
|
42699
42719
|
};
|
|
42700
42720
|
}
|
|
42701
42721
|
__name$3(validatePreviewsContainers, "validatePreviewsContainers");
|
|
42722
|
+
function validateDurableObjectContainerImages(diagnostics, field, images, complianceConfig) {
|
|
42723
|
+
if (images === void 0) return true;
|
|
42724
|
+
if (typeof images !== "object" || images === null || Array.isArray(images) || Object.keys(images).length === 0) {
|
|
42725
|
+
diagnostics.errors.push(`"${field}" must be a non-empty object when present.`);
|
|
42726
|
+
return false;
|
|
42727
|
+
}
|
|
42728
|
+
let valid = true;
|
|
42729
|
+
const entries = Object.entries(images);
|
|
42730
|
+
if (entries.length > 100) {
|
|
42731
|
+
diagnostics.errors.push(`"${field}" must contain at most 100 images.`);
|
|
42732
|
+
valid = false;
|
|
42733
|
+
}
|
|
42734
|
+
for (const [imageName, imageValue] of entries) {
|
|
42735
|
+
const imageField = `${field}.${imageName}`;
|
|
42736
|
+
if (imageName.length === 0 || imageName.length > 128) {
|
|
42737
|
+
diagnostics.errors.push(`"${field}" image names must be between 1 and 128 characters.`);
|
|
42738
|
+
valid = false;
|
|
42739
|
+
}
|
|
42740
|
+
if (typeof imageValue !== "object" || imageValue === null || Array.isArray(imageValue)) {
|
|
42741
|
+
diagnostics.errors.push(`"${imageField}" must be an object with either a "dockerfile" or "image" field.`);
|
|
42742
|
+
valid = false;
|
|
42743
|
+
continue;
|
|
42744
|
+
}
|
|
42745
|
+
const image = imageValue;
|
|
42746
|
+
const hasDockerfile = image.dockerfile !== void 0;
|
|
42747
|
+
const hasImage = image.image !== void 0;
|
|
42748
|
+
if (hasDockerfile === hasImage) {
|
|
42749
|
+
diagnostics.errors.push(`"${imageField}" must specify exactly one of "dockerfile" or "image".`);
|
|
42750
|
+
valid = false;
|
|
42751
|
+
}
|
|
42752
|
+
if (hasDockerfile && (typeof image.dockerfile !== "string" || image.dockerfile.length === 0)) {
|
|
42753
|
+
diagnostics.errors.push(`"${imageField}.dockerfile" must be a non-empty string.`);
|
|
42754
|
+
valid = false;
|
|
42755
|
+
}
|
|
42756
|
+
if (hasImage && (typeof image.image !== "string" || image.image.length === 0)) {
|
|
42757
|
+
diagnostics.errors.push(`"${imageField}.image" must be a non-empty string.`);
|
|
42758
|
+
valid = false;
|
|
42759
|
+
}
|
|
42760
|
+
if (typeof image.image === "string" && image.image.length > 0) {
|
|
42761
|
+
const registry2 = getCloudflareContainerRegistry(complianceConfig);
|
|
42762
|
+
const prefix = `${registry2}/`;
|
|
42763
|
+
const reference = image.image.slice(prefix.length);
|
|
42764
|
+
const digestReference = reference.match(/^[a-z0-9]+(?:(?:[._]|__|-+)[a-z0-9]+)*(?:\/[a-z0-9]+(?:(?:[._]|__|-+)[a-z0-9]+)*)+@sha256:[a-f0-9]{64}$/);
|
|
42765
|
+
if (!image.image.startsWith(prefix) || digestReference?.[0] !== reference) {
|
|
42766
|
+
diagnostics.errors.push(`"${imageField}.image" must be a digest-pinned image in the managed registry, in the form "${registry2}/<account-id>/<repository>@sha256:<64 lowercase hex characters>".`);
|
|
42767
|
+
valid = false;
|
|
42768
|
+
}
|
|
42769
|
+
}
|
|
42770
|
+
const unsupportedFields = Object.keys(image).filter((property) => property !== "dockerfile" && property !== "image");
|
|
42771
|
+
if (unsupportedFields.length > 0) {
|
|
42772
|
+
diagnostics.errors.push(`Unexpected fields found in ${imageField} field: ${unsupportedFields.map((property) => `"${property}"`).join(", ")}`);
|
|
42773
|
+
valid = false;
|
|
42774
|
+
}
|
|
42775
|
+
}
|
|
42776
|
+
return valid;
|
|
42777
|
+
}
|
|
42778
|
+
__name$3(validateDurableObjectContainerImages, "validateDurableObjectContainerImages");
|
|
42702
42779
|
function validateContainerApp(envName, topLevelName, configPath, options = {}) {
|
|
42703
42780
|
const { generateDefaultName = true } = options;
|
|
42704
42781
|
return (diagnostics, field, value, config2) => {
|
|
@@ -42708,15 +42785,30 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
|
|
|
42708
42785
|
return false;
|
|
42709
42786
|
}
|
|
42710
42787
|
for (const containerAppOptional of value) {
|
|
42711
|
-
|
|
42788
|
+
const isDurableObjectManaged = containerAppOptional.scheduling_policy === "durable_object";
|
|
42789
|
+
const hasValidDurableObjectClassName = typeof containerAppOptional.class_name === "string" && containerAppOptional.class_name.length > 0;
|
|
42790
|
+
if (isDurableObjectManaged) {
|
|
42791
|
+
if (!hasValidDurableObjectClassName) diagnostics.errors.push(`"containers.class_name" must be a non-empty string when "containers.scheduling_policy" is "durable_object".`);
|
|
42792
|
+
} else validateOptionalProperty(diagnostics, field, "class_name", containerAppOptional.class_name, "string");
|
|
42712
42793
|
validateOptionalProperty(diagnostics, field, "name", containerAppOptional.name, "string");
|
|
42713
|
-
if (generateDefaultName && !containerAppOptional.name) 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".`);
|
|
42794
|
+
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".`);
|
|
42714
42795
|
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.`);
|
|
42715
42796
|
else {
|
|
42716
42797
|
let name = `${topLevelName}-${containerAppOptional.class_name}`;
|
|
42717
42798
|
name += config2 === void 0 ? "" : `-${envName}`;
|
|
42718
42799
|
containerAppOptional.name = name.toLowerCase().replace(/ /g, "-");
|
|
42719
42800
|
}
|
|
42801
|
+
if (isDurableObjectManaged) {
|
|
42802
|
+
validateDurableObjectContainerImages(diagnostics, `${field}.images`, containerAppOptional.images, options.complianceConfig);
|
|
42803
|
+
const unsupportedFields = Object.keys(containerAppOptional).filter((key) => ![
|
|
42804
|
+
"name",
|
|
42805
|
+
"class_name",
|
|
42806
|
+
"scheduling_policy",
|
|
42807
|
+
"images"
|
|
42808
|
+
].includes(key));
|
|
42809
|
+
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 "images" are supported.`);
|
|
42810
|
+
continue;
|
|
42811
|
+
}
|
|
42720
42812
|
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.`);
|
|
42721
42813
|
if ("configuration" in containerAppOptional) {
|
|
42722
42814
|
diagnostics.warnings.push(`"containers.configuration" is deprecated. Use top level "containers" fields instead. "configuration.image" should be "image", limits should be set via "instance_type".`);
|
|
@@ -42781,6 +42873,7 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
|
|
|
42781
42873
|
if (rolloutStepsCount > containerAppOptional.max_instances) diagnostics.errors.push(`"containers.rollout_step_percentage" cannot have more steps (${rolloutStepsCount}) than "max_instances" (${containerAppOptional.max_instances})`);
|
|
42782
42874
|
}
|
|
42783
42875
|
validateOptionalProperty(diagnostics, field, "image_vars", containerAppOptional.image_vars, "object");
|
|
42876
|
+
validateContainerObservability(diagnostics, `${field}.observability`, containerAppOptional.observability, config2);
|
|
42784
42877
|
validateOptionalProperty(diagnostics, field, "scheduling_policy", containerAppOptional.scheduling_policy, "string", [
|
|
42785
42878
|
"regional",
|
|
42786
42879
|
"moon",
|
|
@@ -42799,6 +42892,7 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
|
|
|
42799
42892
|
"image",
|
|
42800
42893
|
"image_build_context",
|
|
42801
42894
|
"image_vars",
|
|
42895
|
+
"observability",
|
|
42802
42896
|
"class_name",
|
|
42803
42897
|
"scheduling_policy",
|
|
42804
42898
|
"instance_type",
|
|
@@ -43289,6 +43383,7 @@ var validateBindingsHaveUniqueNames = /* @__PURE__ */ __name$3((diagnostics, con
|
|
|
43289
43383
|
const bindingNamesArray = Object.entries(friendlyBindingNames);
|
|
43290
43384
|
const bindingsGroupedByType = Object.fromEntries(bindingNamesArray.map(([bindingType, binding]) => [binding, getBindingNames(bindingType === "queues" ? config2[bindingType]?.producers : config2[bindingType])]));
|
|
43291
43385
|
bindingsGroupedByType["Secret"] = config2.secrets?.required ?? [];
|
|
43386
|
+
bindingsGroupedByType["Container images"] = [CONTAINER_IMAGES_BINDING];
|
|
43292
43387
|
const bindingsGroupedByName = {};
|
|
43293
43388
|
for (const bindingType in bindingsGroupedByType) {
|
|
43294
43389
|
const bindingNames = bindingsGroupedByType[bindingType];
|
|
@@ -44036,6 +44131,77 @@ var validateExports = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
|
|
|
44036
44131
|
}
|
|
44037
44132
|
return valid;
|
|
44038
44133
|
}, "validateExports");
|
|
44134
|
+
var CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MIN = 1;
|
|
44135
|
+
var CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MAX = 99;
|
|
44136
|
+
var CONTAINER_OBSERVABILITY_TARGET_INSTANCE_COUNT_MIN = 1;
|
|
44137
|
+
function isContainerObservabilityEnabled(observability) {
|
|
44138
|
+
return observability?.logs?.enabled === true || observability?.enabled === true;
|
|
44139
|
+
}
|
|
44140
|
+
__name$3(isContainerObservabilityEnabled, "isContainerObservabilityEnabled");
|
|
44141
|
+
function hasConflictingContainerObservabilityEnabledValues(observability) {
|
|
44142
|
+
return typeof observability.enabled === "boolean" && typeof observability.logs?.enabled === "boolean" && observability.enabled !== observability.logs.enabled;
|
|
44143
|
+
}
|
|
44144
|
+
__name$3(hasConflictingContainerObservabilityEnabledValues, "hasConflictingContainerObservabilityEnabledValues");
|
|
44145
|
+
var validateContainerObservability = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
|
|
44146
|
+
if (value === void 0) return true;
|
|
44147
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
44148
|
+
diagnostics.errors.push(`"${field}" should be an object but got ${JSON.stringify(value)}.`);
|
|
44149
|
+
return false;
|
|
44150
|
+
}
|
|
44151
|
+
const val = value;
|
|
44152
|
+
let isValid = true;
|
|
44153
|
+
isValid = validateOptionalProperty(diagnostics, field, "enabled", val.enabled, "boolean") && isValid;
|
|
44154
|
+
if (val.logs !== void 0) if (typeof val.logs !== "object" || val.logs === null || Array.isArray(val.logs)) {
|
|
44155
|
+
diagnostics.errors.push(`Expected "${field}.logs" to be of type object but got ${JSON.stringify(val.logs)}.`);
|
|
44156
|
+
isValid = false;
|
|
44157
|
+
} else {
|
|
44158
|
+
isValid = validateOptionalProperty(diagnostics, field, "logs.enabled", val.logs.enabled, "boolean") && isValid;
|
|
44159
|
+
isValid = validateAdditionalProperties(diagnostics, `${field}.logs`, Object.keys(val.logs), ["enabled"]) && isValid;
|
|
44160
|
+
}
|
|
44161
|
+
if (val.enabled === void 0 && val.target_instance_percentage === void 0 && val.target_instance_count === void 0 && (val.logs === void 0 || typeof val.logs === "object" && val.logs !== null && !Array.isArray(val.logs) && val.logs.enabled === void 0)) isValid = validateAtLeastOnePropertyRequired(diagnostics, field, [{
|
|
44162
|
+
key: "enabled",
|
|
44163
|
+
value: val.enabled,
|
|
44164
|
+
type: "boolean"
|
|
44165
|
+
}, {
|
|
44166
|
+
key: "logs.enabled",
|
|
44167
|
+
value: val.logs?.enabled,
|
|
44168
|
+
type: "boolean"
|
|
44169
|
+
}]) && isValid;
|
|
44170
|
+
isValid = validateOptionalProperty(diagnostics, field, "target_instance_percentage", val.target_instance_percentage, "number") && isValid;
|
|
44171
|
+
isValid = validateOptionalProperty(diagnostics, field, "target_instance_count", val.target_instance_count, "number") && isValid;
|
|
44172
|
+
isValid = validateAdditionalProperties(diagnostics, field, Object.keys(val), [
|
|
44173
|
+
"enabled",
|
|
44174
|
+
"logs",
|
|
44175
|
+
"target_instance_percentage",
|
|
44176
|
+
"target_instance_count"
|
|
44177
|
+
]) && isValid;
|
|
44178
|
+
if (hasConflictingContainerObservabilityEnabledValues(val)) {
|
|
44179
|
+
diagnostics.errors.push(`"${field}.enabled" and "${field}.logs.enabled" cannot be set to different values.`);
|
|
44180
|
+
isValid = false;
|
|
44181
|
+
}
|
|
44182
|
+
if (val.target_instance_percentage !== void 0 && val.target_instance_count !== void 0) {
|
|
44183
|
+
diagnostics.errors.push(`"${field}.target_instance_percentage" and "${field}.target_instance_count" cannot both be set.`);
|
|
44184
|
+
isValid = false;
|
|
44185
|
+
}
|
|
44186
|
+
if (typeof val.target_instance_percentage === "number" && (!Number.isInteger(val.target_instance_percentage) || val.target_instance_percentage < CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MIN || val.target_instance_percentage > CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MAX)) {
|
|
44187
|
+
diagnostics.errors.push(`"${field}.target_instance_percentage" must be an integer between ${CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MIN} and ${CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MAX} inclusive.`);
|
|
44188
|
+
isValid = false;
|
|
44189
|
+
}
|
|
44190
|
+
if (typeof val.target_instance_count === "number" && (!Number.isInteger(val.target_instance_count) || val.target_instance_count < CONTAINER_OBSERVABILITY_TARGET_INSTANCE_COUNT_MIN)) {
|
|
44191
|
+
diagnostics.errors.push(`"${field}.target_instance_count" must be a positive integer.`);
|
|
44192
|
+
isValid = false;
|
|
44193
|
+
}
|
|
44194
|
+
const observabilityEnabled = isContainerObservabilityEnabled(val);
|
|
44195
|
+
if (val.target_instance_percentage !== void 0 && !observabilityEnabled) {
|
|
44196
|
+
diagnostics.errors.push(`"${field}.target_instance_percentage" requires "${field}.enabled" or "${field}.logs.enabled" to be true because container observability overrides root observability.`);
|
|
44197
|
+
isValid = false;
|
|
44198
|
+
}
|
|
44199
|
+
if (val.target_instance_count !== void 0 && !observabilityEnabled) {
|
|
44200
|
+
diagnostics.errors.push(`"${field}.target_instance_count" requires "${field}.enabled" or "${field}.logs.enabled" to be true because container observability overrides root observability.`);
|
|
44201
|
+
isValid = false;
|
|
44202
|
+
}
|
|
44203
|
+
return isValid;
|
|
44204
|
+
}, "validateContainerObservability");
|
|
44039
44205
|
var validateObservability = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
|
|
44040
44206
|
if (value === void 0) return true;
|
|
44041
44207
|
if (typeof value !== "object" || value === null) {
|
|
@@ -44137,11 +44303,11 @@ var validateCache = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
|
|
|
44137
44303
|
isValid = validateAdditionalProperties(diagnostics, field, Object.keys(val), ["enabled", "cross_version_cache"]) && isValid;
|
|
44138
44304
|
return isValid;
|
|
44139
44305
|
}, "validateCache");
|
|
44140
|
-
function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects, migrations, exports$1
|
|
44306
|
+
function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects, migrations, exports$1, configPath) {
|
|
44141
44307
|
if (!Array.isArray(durableObjects.bindings) || durableObjects.bindings.length === 0) return;
|
|
44142
44308
|
const exportedDurableObjects = durableObjects.bindings.filter((binding) => !binding.script_name);
|
|
44143
44309
|
const exportsCovers = /* @__PURE__ */ __name$3((className) => {
|
|
44144
|
-
const entry = exports$1
|
|
44310
|
+
const entry = exports$1?.[className];
|
|
44145
44311
|
if (entry === void 0 || entry.type !== "durable-object") return false;
|
|
44146
44312
|
const state = entry.state ?? "created";
|
|
44147
44313
|
return state === "created" || state === "expecting-transfer";
|
|
@@ -44163,11 +44329,11 @@ function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects,
|
|
|
44163
44329
|
\`\`\``);
|
|
44164
44330
|
}
|
|
44165
44331
|
__name$3(warnIfDurableObjectsHaveNoLifecycleConfig, "warnIfDurableObjectsHaveNoLifecycleConfig");
|
|
44166
|
-
function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$1
|
|
44167
|
-
if (migrations.length > 0 && exports$1
|
|
44332
|
+
function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$1) {
|
|
44333
|
+
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.`);
|
|
44168
44334
|
}
|
|
44169
44335
|
__name$3(errorIfMigrationsAndExportsBothSet, "errorIfMigrationsAndExportsBothSet");
|
|
44170
|
-
function validateContainerExportLinks(diagnostics, containers, exports$1
|
|
44336
|
+
function validateContainerExportLinks(diagnostics, containers, exports$1, containersDeclaredElsewhere) {
|
|
44171
44337
|
if (containers !== void 0 && !Array.isArray(containers)) return;
|
|
44172
44338
|
if (containers === void 0 && containersDeclaredElsewhere) return;
|
|
44173
44339
|
const containersByName = /* @__PURE__ */ new Map();
|
|
@@ -44185,7 +44351,7 @@ function validateContainerExportLinks(diagnostics, containers, exports$1$1, cont
|
|
|
44185
44351
|
}
|
|
44186
44352
|
const overSubscribedClassNames = new Set([...containerCountByClassName].filter(([, count]) => count > 1).map(([className]) => className));
|
|
44187
44353
|
for (const className of [...overSubscribedClassNames].sort()) diagnostics.errors.push(`More than one container is attached to the Durable Object "${className}". A Durable Object can only have one container attached to it.`);
|
|
44188
|
-
const durableObjectExports = getDurableObjectExports(exports$1
|
|
44354
|
+
const durableObjectExports = getDurableObjectExports(exports$1);
|
|
44189
44355
|
const liveExportClassNames = /* @__PURE__ */ new Set();
|
|
44190
44356
|
const classNamesByContainerName = /* @__PURE__ */ new Map();
|
|
44191
44357
|
for (const [className, entry] of Object.entries(durableObjectExports)) {
|
|
@@ -44199,7 +44365,7 @@ function validateContainerExportLinks(diagnostics, containers, exports$1$1, cont
|
|
|
44199
44365
|
classNamesByContainerName.set(entry.container, [...classNamesByContainerName.get(entry.container) ?? [], className]);
|
|
44200
44366
|
}
|
|
44201
44367
|
for (const [containerName, classNames] of classNamesByContainerName) if (classNames.length > 1) diagnostics.errors.push(`The container "${containerName}" is referenced by more than one Durable Object export (${classNames.join(", ")}). A container can only back a single Durable Object.`);
|
|
44202
|
-
const containerNameToClassName = getContainerNameToClassNameMap(exports$1
|
|
44368
|
+
const containerNameToClassName = getContainerNameToClassNameMap(exports$1);
|
|
44203
44369
|
const usesDurableObjectExports = Object.keys(durableObjectExports).length > 0;
|
|
44204
44370
|
for (const container of containers ?? []) {
|
|
44205
44371
|
if (typeof container.name !== "string") continue;
|
|
@@ -44777,8 +44943,8 @@ function getBindingKey(type) {
|
|
|
44777
44943
|
return "binding";
|
|
44778
44944
|
}
|
|
44779
44945
|
__name$3(getBindingKey, "getBindingKey");
|
|
44780
|
-
function extractBindingsOfType(type, bindings
|
|
44781
|
-
return Object.entries(bindings
|
|
44946
|
+
function extractBindingsOfType(type, bindings) {
|
|
44947
|
+
return Object.entries(bindings ?? {}).filter((binding) => binding[1].type === type).map((binding) => ({
|
|
44782
44948
|
...binding[1],
|
|
44783
44949
|
[getBindingKey(type)]: binding[0]
|
|
44784
44950
|
}));
|
|
@@ -44795,7 +44961,7 @@ __name$3(getBindings, "getBindings");
|
|
|
44795
44961
|
var { dim: dim$1, white: white$1 } = source_default;
|
|
44796
44962
|
var brandColor$1 = source_default.hex("#BD5B08");
|
|
44797
44963
|
var isConnectedStatusExplained = false;
|
|
44798
|
-
function printBindings(bindings
|
|
44964
|
+
function printBindings(bindings, options) {
|
|
44799
44965
|
const { containers = [], log: log$2, streamingTailConsumers = [], tailConsumers = [] } = options;
|
|
44800
44966
|
const context = options;
|
|
44801
44967
|
let hasConnectionStatus = false;
|
|
@@ -44810,48 +44976,48 @@ function printBindings(bindings$1, options) {
|
|
|
44810
44976
|
return `${s.substring(0, maxLength - 3)}...`;
|
|
44811
44977
|
}, "truncate");
|
|
44812
44978
|
const output = [];
|
|
44813
|
-
const data_blobs = extractBindingsOfType("data_blob", bindings
|
|
44814
|
-
const durable_objects = extractBindingsOfType("durable_object_namespace", bindings
|
|
44815
|
-
const workflows = extractBindingsOfType("workflow", bindings
|
|
44816
|
-
const kv_namespaces = extractBindingsOfType("kv_namespace", bindings
|
|
44817
|
-
const send_email = extractBindingsOfType("send_email", bindings
|
|
44818
|
-
const queues = extractBindingsOfType("queue", bindings
|
|
44819
|
-
const d1_databases = extractBindingsOfType("d1", bindings
|
|
44820
|
-
const vectorize = extractBindingsOfType("vectorize", bindings
|
|
44821
|
-
const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings
|
|
44822
|
-
const ai_search = extractBindingsOfType("ai_search", bindings
|
|
44823
|
-
const websearch = extractBindingsOfType("websearch", bindings
|
|
44824
|
-
const agent_memory = extractBindingsOfType("agent_memory", bindings
|
|
44825
|
-
const hyperdrive = extractBindingsOfType("hyperdrive", bindings
|
|
44826
|
-
const r2_buckets = extractBindingsOfType("r2_bucket", bindings
|
|
44827
|
-
const logfwdr = extractBindingsOfType("logfwdr", bindings
|
|
44828
|
-
const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings
|
|
44829
|
-
const artifacts = extractBindingsOfType("artifacts", bindings
|
|
44830
|
-
const services = extractBindingsOfType("service", bindings
|
|
44831
|
-
const vpc_services = extractBindingsOfType("vpc_service", bindings
|
|
44832
|
-
const vpc_networks = extractBindingsOfType("vpc_network", bindings
|
|
44833
|
-
const analytics_engine_datasets = extractBindingsOfType("analytics_engine", bindings
|
|
44834
|
-
const text_blobs = extractBindingsOfType("text_blob", bindings
|
|
44835
|
-
const browser = extractBindingsOfType("browser", bindings
|
|
44836
|
-
const images = extractBindingsOfType("images", bindings
|
|
44837
|
-
const stream$2 = extractBindingsOfType("stream", bindings
|
|
44838
|
-
const ai = extractBindingsOfType("ai", bindings
|
|
44839
|
-
const version_metadata = extractBindingsOfType("version_metadata", bindings
|
|
44840
|
-
const vars = Object.entries(bindings
|
|
44979
|
+
const data_blobs = extractBindingsOfType("data_blob", bindings);
|
|
44980
|
+
const durable_objects = extractBindingsOfType("durable_object_namespace", bindings);
|
|
44981
|
+
const workflows = extractBindingsOfType("workflow", bindings);
|
|
44982
|
+
const kv_namespaces = extractBindingsOfType("kv_namespace", bindings);
|
|
44983
|
+
const send_email = extractBindingsOfType("send_email", bindings);
|
|
44984
|
+
const queues = extractBindingsOfType("queue", bindings);
|
|
44985
|
+
const d1_databases = extractBindingsOfType("d1", bindings);
|
|
44986
|
+
const vectorize = extractBindingsOfType("vectorize", bindings);
|
|
44987
|
+
const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings);
|
|
44988
|
+
const ai_search = extractBindingsOfType("ai_search", bindings);
|
|
44989
|
+
const websearch = extractBindingsOfType("websearch", bindings);
|
|
44990
|
+
const agent_memory = extractBindingsOfType("agent_memory", bindings);
|
|
44991
|
+
const hyperdrive = extractBindingsOfType("hyperdrive", bindings);
|
|
44992
|
+
const r2_buckets = extractBindingsOfType("r2_bucket", bindings);
|
|
44993
|
+
const logfwdr = extractBindingsOfType("logfwdr", bindings);
|
|
44994
|
+
const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings);
|
|
44995
|
+
const artifacts = extractBindingsOfType("artifacts", bindings);
|
|
44996
|
+
const services = extractBindingsOfType("service", bindings);
|
|
44997
|
+
const vpc_services = extractBindingsOfType("vpc_service", bindings);
|
|
44998
|
+
const vpc_networks = extractBindingsOfType("vpc_network", bindings);
|
|
44999
|
+
const analytics_engine_datasets = extractBindingsOfType("analytics_engine", bindings);
|
|
45000
|
+
const text_blobs = extractBindingsOfType("text_blob", bindings);
|
|
45001
|
+
const browser = extractBindingsOfType("browser", bindings);
|
|
45002
|
+
const images = extractBindingsOfType("images", bindings);
|
|
45003
|
+
const stream$2 = extractBindingsOfType("stream", bindings);
|
|
45004
|
+
const ai = extractBindingsOfType("ai", bindings);
|
|
45005
|
+
const version_metadata = extractBindingsOfType("version_metadata", bindings);
|
|
45006
|
+
const vars = Object.entries(bindings ?? {}).filter(([_, binding]) => binding.type === "plain_text" || binding.type === "json" || binding.type === "secret_text").map(([name, binding]) => ({
|
|
44841
45007
|
binding: name,
|
|
44842
45008
|
...binding
|
|
44843
45009
|
}));
|
|
44844
|
-
const wasm_modules = extractBindingsOfType("wasm_module", bindings
|
|
44845
|
-
const dispatch_namespaces = extractBindingsOfType("dispatch_namespace", bindings
|
|
44846
|
-
const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings
|
|
44847
|
-
const pipelines = extractBindingsOfType("pipeline", bindings
|
|
44848
|
-
const ratelimits = extractBindingsOfType("ratelimit", bindings
|
|
44849
|
-
const assets = extractBindingsOfType("assets", bindings
|
|
44850
|
-
const unsafe_hello_world = extractBindingsOfType("unsafe_hello_world", bindings
|
|
44851
|
-
const flagship = extractBindingsOfType("flagship", bindings
|
|
44852
|
-
const media = extractBindingsOfType("media", bindings
|
|
44853
|
-
const worker_loaders = extractBindingsOfType("worker_loader", bindings
|
|
44854
|
-
const unsafe_bindings = Object.entries(bindings
|
|
45010
|
+
const wasm_modules = extractBindingsOfType("wasm_module", bindings);
|
|
45011
|
+
const dispatch_namespaces = extractBindingsOfType("dispatch_namespace", bindings);
|
|
45012
|
+
const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings);
|
|
45013
|
+
const pipelines = extractBindingsOfType("pipeline", bindings);
|
|
45014
|
+
const ratelimits = extractBindingsOfType("ratelimit", bindings);
|
|
45015
|
+
const assets = extractBindingsOfType("assets", bindings);
|
|
45016
|
+
const unsafe_hello_world = extractBindingsOfType("unsafe_hello_world", bindings);
|
|
45017
|
+
const flagship = extractBindingsOfType("flagship", bindings);
|
|
45018
|
+
const media = extractBindingsOfType("media", bindings);
|
|
45019
|
+
const worker_loaders = extractBindingsOfType("worker_loader", bindings);
|
|
45020
|
+
const unsafe_bindings = Object.entries(bindings ?? {}).filter(([_, binding]) => isUnsafeBindingType(binding.type) && binding.type !== "unsafe_hello_world").map(([name, binding]) => ({
|
|
44855
45021
|
name,
|
|
44856
45022
|
...binding
|
|
44857
45023
|
}));
|
|
@@ -45254,7 +45420,7 @@ ${allTailConsumers.map(({ service, streaming }) => {
|
|
|
45254
45420
|
let containersTitle = "The following containers are available:";
|
|
45255
45421
|
if (context.name && isMultiWorker) containersTitle = `The following containers are available from ${source_default.blue(context.name)}:`;
|
|
45256
45422
|
log$2(`${containersTitle}
|
|
45257
|
-
${containers.map((
|
|
45423
|
+
${containers.map((container) => container.scheduling_policy === "durable_object" ? `- ${container.class_name} (durable_object)` : `- ${container.name} (${container.image})`).join("\n")}`);
|
|
45258
45424
|
log$2("");
|
|
45259
45425
|
}
|
|
45260
45426
|
if (context.unsafeMetadata) {
|
|
@@ -45586,6 +45752,267 @@ function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
|
|
|
45586
45752
|
};
|
|
45587
45753
|
}
|
|
45588
45754
|
__name$3(getWranglerTmpDir, "getWranglerTmpDir");
|
|
45755
|
+
function buildDetailedError(message, ...extra) {
|
|
45756
|
+
return new ParseError({
|
|
45757
|
+
text: message,
|
|
45758
|
+
notes: extra.map((text) => ({ text })),
|
|
45759
|
+
telemetryMessage: false
|
|
45760
|
+
});
|
|
45761
|
+
}
|
|
45762
|
+
__name$3(buildDetailedError, "buildDetailedError");
|
|
45763
|
+
function maybeThrowFriendlyError(error51) {
|
|
45764
|
+
if (error51.message === "workers.api.error.email_verification_required") throw buildDetailedError("Please verify your account's email address and try again.", "Check your email for a verification link, or login to https://dash.cloudflare.com and request a new one.");
|
|
45765
|
+
}
|
|
45766
|
+
__name$3(maybeThrowFriendlyError, "maybeThrowFriendlyError");
|
|
45767
|
+
function logHeaders(headers, logger$1) {
|
|
45768
|
+
const clone2 = cloneHeaders(headers);
|
|
45769
|
+
clone2.delete("Authorization");
|
|
45770
|
+
logger$1.debugWithSanitization?.("HEADERS:", JSON.stringify(Object.fromEntries(clone2), null, 2));
|
|
45771
|
+
}
|
|
45772
|
+
__name$3(logHeaders, "logHeaders");
|
|
45773
|
+
async function performApiFetchBase(complianceConfig, resource, init$2 = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
45774
|
+
assert(credentials, "credentials are required for performApiFetch");
|
|
45775
|
+
const method = init$2.method ?? "GET";
|
|
45776
|
+
assert(resource.startsWith("/"), `CF API fetch - resource path must start with a "/" but got "${resource}"`);
|
|
45777
|
+
const headers = cloneHeaders(new import_undici$3.Headers(init$2.headers));
|
|
45778
|
+
addAuthorizationHeader(headers, credentials);
|
|
45779
|
+
headers.set("User-Agent", userAgent);
|
|
45780
|
+
maybeAddTraceHeader(headers);
|
|
45781
|
+
const queryString = queryParams ? `?${queryParams.toString()}` : "";
|
|
45782
|
+
logger$1.debug(`-- START CF API REQUEST: ${method} ${getCloudflareApiBaseUrl(complianceConfig)}${resource}`);
|
|
45783
|
+
logger$1.debugWithSanitization?.("QUERY STRING:", queryString);
|
|
45784
|
+
logHeaders(headers, logger$1);
|
|
45785
|
+
logger$1.debugWithSanitization?.("INIT:", JSON.stringify({ ...init$2 }, null, 2));
|
|
45786
|
+
if (init$2.body instanceof import_undici$3.FormData) logger$1.debugWithSanitization?.("BODY:", await new import_undici$3.Response(init$2.body).text(), null, 2);
|
|
45787
|
+
logger$1.debug("-- END CF API REQUEST");
|
|
45788
|
+
return await (0, import_undici$3.fetch)(`${getCloudflareApiBaseUrl(complianceConfig)}${resource}${queryString}`, {
|
|
45789
|
+
method,
|
|
45790
|
+
...init$2,
|
|
45791
|
+
headers,
|
|
45792
|
+
signal: abortSignal
|
|
45793
|
+
});
|
|
45794
|
+
}
|
|
45795
|
+
__name$3(performApiFetchBase, "performApiFetchBase");
|
|
45796
|
+
async function fetchInternalBase(complianceConfig, resource, init$2 = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
45797
|
+
const method = init$2.method ?? "GET";
|
|
45798
|
+
const response = await performApiFetchBase(complianceConfig, resource, init$2, userAgent, logger$1, queryParams, abortSignal, credentials);
|
|
45799
|
+
const jsonText = await response.text();
|
|
45800
|
+
logger$1.debug("-- START CF API RESPONSE:", response.statusText, response.status);
|
|
45801
|
+
logHeaders(response.headers, logger$1);
|
|
45802
|
+
logger$1.debugWithSanitization?.("RESPONSE:", jsonText);
|
|
45803
|
+
logger$1.debug("-- END CF API RESPONSE");
|
|
45804
|
+
const retryAfterMs = parseRetryAfterMs(response.headers);
|
|
45805
|
+
if (!jsonText && (response.status === 204 || response.status === 205)) return {
|
|
45806
|
+
response: {
|
|
45807
|
+
result: {},
|
|
45808
|
+
success: true,
|
|
45809
|
+
errors: [],
|
|
45810
|
+
messages: []
|
|
45811
|
+
},
|
|
45812
|
+
status: response.status,
|
|
45813
|
+
retryAfterMs
|
|
45814
|
+
};
|
|
45815
|
+
if (isWAFBlockResponse(response.headers)) throwWAFBlockError(response.headers, method, resource, response.status, response.statusText, retryAfterMs);
|
|
45816
|
+
try {
|
|
45817
|
+
return {
|
|
45818
|
+
response: parseJSON(jsonText),
|
|
45819
|
+
status: response.status,
|
|
45820
|
+
retryAfterMs
|
|
45821
|
+
};
|
|
45822
|
+
} catch {
|
|
45823
|
+
const rayId = extractWAFBlockRayId(response.headers);
|
|
45824
|
+
throw new APIError({
|
|
45825
|
+
text: "Received a malformed response from the API",
|
|
45826
|
+
notes: [
|
|
45827
|
+
{ text: truncate(jsonText, 100) },
|
|
45828
|
+
{ text: `${method} ${resource} -> ${response.status} ${response.statusText}` },
|
|
45829
|
+
...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : []
|
|
45830
|
+
],
|
|
45831
|
+
status: response.status,
|
|
45832
|
+
retryAfterMs,
|
|
45833
|
+
telemetryMessage: false
|
|
45834
|
+
});
|
|
45835
|
+
}
|
|
45836
|
+
}
|
|
45837
|
+
__name$3(fetchInternalBase, "fetchInternalBase");
|
|
45838
|
+
async function fetchResultBase(complianceConfig, resource, init$2 = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
45839
|
+
const { response: json2, status: status$1, retryAfterMs } = await fetchInternalBase(complianceConfig, resource, init$2, userAgent, logger$1, queryParams, abortSignal, credentials);
|
|
45840
|
+
if (json2.success) return json2.result;
|
|
45841
|
+
else throwFetchError(resource, json2, status$1, retryAfterMs);
|
|
45842
|
+
}
|
|
45843
|
+
__name$3(fetchResultBase, "fetchResultBase");
|
|
45844
|
+
async function fetchListResultBase(complianceConfig, resource, init$2 = {}, userAgent, logger$1, queryParams, credentials) {
|
|
45845
|
+
const results = [];
|
|
45846
|
+
let getMoreResults = true;
|
|
45847
|
+
let cursor$1;
|
|
45848
|
+
while (getMoreResults) {
|
|
45849
|
+
if (cursor$1) {
|
|
45850
|
+
queryParams = new URLSearchParams$1(queryParams);
|
|
45851
|
+
queryParams.set("cursor", cursor$1);
|
|
45852
|
+
}
|
|
45853
|
+
const { response: json2, status: status$1, retryAfterMs } = await fetchInternalBase(complianceConfig, resource, init$2, userAgent, logger$1, queryParams, void 0, credentials);
|
|
45854
|
+
if (json2.success) {
|
|
45855
|
+
results.push(...json2.result);
|
|
45856
|
+
if (hasCursor(json2.result_info)) cursor$1 = json2.result_info?.cursor;
|
|
45857
|
+
else getMoreResults = false;
|
|
45858
|
+
} else throwFetchError(resource, json2, status$1, retryAfterMs);
|
|
45859
|
+
}
|
|
45860
|
+
return results;
|
|
45861
|
+
}
|
|
45862
|
+
__name$3(fetchListResultBase, "fetchListResultBase");
|
|
45863
|
+
function truncate(text, maxLength) {
|
|
45864
|
+
const { length } = text;
|
|
45865
|
+
if (length <= maxLength) return text;
|
|
45866
|
+
return `${text.substring(0, maxLength)}... (length = ${length})`;
|
|
45867
|
+
}
|
|
45868
|
+
__name$3(truncate, "truncate");
|
|
45869
|
+
function isWAFBlockResponse(headers) {
|
|
45870
|
+
return headers.get("cf-mitigated") === "challenge";
|
|
45871
|
+
}
|
|
45872
|
+
__name$3(isWAFBlockResponse, "isWAFBlockResponse");
|
|
45873
|
+
function parseRetryAfterValue(retryAfter) {
|
|
45874
|
+
if (!retryAfter) return;
|
|
45875
|
+
if (/^\d+$/.test(retryAfter.trim())) return Number(retryAfter) * 1e3;
|
|
45876
|
+
const retryAfterDate = new Date(retryAfter);
|
|
45877
|
+
if (!Number.isNaN(retryAfterDate.getTime())) return Math.max(0, retryAfterDate.getTime() - Date.now());
|
|
45878
|
+
}
|
|
45879
|
+
__name$3(parseRetryAfterValue, "parseRetryAfterValue");
|
|
45880
|
+
function parseRetryAfterMs(headers) {
|
|
45881
|
+
return parseRetryAfterValue(headers.get("Retry-After"));
|
|
45882
|
+
}
|
|
45883
|
+
__name$3(parseRetryAfterMs, "parseRetryAfterMs");
|
|
45884
|
+
function extractWAFBlockRayId(headers) {
|
|
45885
|
+
return headers.get("cf-ray") ?? void 0;
|
|
45886
|
+
}
|
|
45887
|
+
__name$3(extractWAFBlockRayId, "extractWAFBlockRayId");
|
|
45888
|
+
function extractAccountTag(resource) {
|
|
45889
|
+
return (/* @__PURE__ */ new RegExp("/accounts/([a-zA-Z0-9]+)/?")).exec(resource)?.[1];
|
|
45890
|
+
}
|
|
45891
|
+
__name$3(extractAccountTag, "extractAccountTag");
|
|
45892
|
+
function hasMorePages(result_info) {
|
|
45893
|
+
const page = result_info?.page;
|
|
45894
|
+
const per_page = result_info?.per_page;
|
|
45895
|
+
const total = result_info?.total_count;
|
|
45896
|
+
return page !== void 0 && per_page !== void 0 && total !== void 0 && page * per_page < total;
|
|
45897
|
+
}
|
|
45898
|
+
__name$3(hasMorePages, "hasMorePages");
|
|
45899
|
+
function renderError(err, level = 0) {
|
|
45900
|
+
const indent = " ".repeat(level);
|
|
45901
|
+
const message = err.message ?? "";
|
|
45902
|
+
const chainedMessages = "error_chain" in err ? err.error_chain?.map((chainedError) => `
|
|
45903
|
+
|
|
45904
|
+
${indent}- ${renderError(chainedError, level + 1)}`).join("\n") ?? "" : "";
|
|
45905
|
+
return (err.code ? `${message} [code: ${err.code}]` : message) + (err.documentation_url ? `
|
|
45906
|
+
${indent}To learn more about this error, visit: ${err.documentation_url}` : "") + chainedMessages;
|
|
45907
|
+
}
|
|
45908
|
+
__name$3(renderError, "renderError");
|
|
45909
|
+
function addAuthorizationHeader(headers, auth, overrideExisting = false) {
|
|
45910
|
+
if (!headers.has("Authorization") || overrideExisting) if ("apiToken" in auth) {
|
|
45911
|
+
const authorizationHeader = `Bearer ${auth.apiToken}`;
|
|
45912
|
+
validateAuthorizationHeaderValue(authorizationHeader);
|
|
45913
|
+
headers.set("Authorization", authorizationHeader);
|
|
45914
|
+
} else {
|
|
45915
|
+
headers.set("X-Auth-Key", auth.authKey);
|
|
45916
|
+
headers.set("X-Auth-Email", auth.authEmail);
|
|
45917
|
+
}
|
|
45918
|
+
}
|
|
45919
|
+
__name$3(addAuthorizationHeader, "addAuthorizationHeader");
|
|
45920
|
+
function validateAuthorizationHeaderValue(value) {
|
|
45921
|
+
for (const character of value) {
|
|
45922
|
+
const codePoint = character.codePointAt(0);
|
|
45923
|
+
if (codePoint === void 0 || codePoint > 255) throw new UserError$1(`The configured Cloudflare API token contains a character that cannot be used in an HTTP Authorization header: ${formatAuthorizationHeaderCharacter(character, codePoint)}. Recreate or copy the token again, making sure it does not include characters such as ellipses.`, { telemetryMessage: "cfetch auth invalid authorization header" });
|
|
45924
|
+
}
|
|
45925
|
+
}
|
|
45926
|
+
__name$3(validateAuthorizationHeaderValue, "validateAuthorizationHeaderValue");
|
|
45927
|
+
function formatAuthorizationHeaderCharacter(character, codePoint) {
|
|
45928
|
+
if (codePoint === void 0) return "\"\\u{unknown}\"";
|
|
45929
|
+
const codePointLabel = `U+${codePoint.toString(16).toUpperCase().padStart(4, "0")}`;
|
|
45930
|
+
return `${isPrintableCharacter(character) ? `"${character}"` : `"${escapeCharacter(character)}"`} (${codePointLabel})`;
|
|
45931
|
+
}
|
|
45932
|
+
__name$3(formatAuthorizationHeaderCharacter, "formatAuthorizationHeaderCharacter");
|
|
45933
|
+
function isPrintableCharacter(character) {
|
|
45934
|
+
return !/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(character);
|
|
45935
|
+
}
|
|
45936
|
+
__name$3(isPrintableCharacter, "isPrintableCharacter");
|
|
45937
|
+
function escapeCharacter(character) {
|
|
45938
|
+
return Array.from(character).map((c$1) => {
|
|
45939
|
+
const codePoint = c$1.codePointAt(0);
|
|
45940
|
+
if (codePoint === void 0) return "";
|
|
45941
|
+
return codePoint <= 65535 ? `\\u${codePoint.toString(16).toUpperCase().padStart(4, "0")}` : `\\u{${codePoint.toString(16).toUpperCase()}}`;
|
|
45942
|
+
}).join("");
|
|
45943
|
+
}
|
|
45944
|
+
__name$3(escapeCharacter, "escapeCharacter");
|
|
45945
|
+
function throwFetchError(resource, response, status$1, retryAfterMs) {
|
|
45946
|
+
const errors$1 = response.errors ?? [];
|
|
45947
|
+
for (const error52 of errors$1) maybeThrowFriendlyError(error52);
|
|
45948
|
+
const notes = [...errors$1.map((err) => ({ text: renderError(err) })), ...response.messages?.map((msg) => ({ text: typeof msg === "string" ? msg : msg.message ?? String(msg) })) ?? []];
|
|
45949
|
+
if (notes.length === 0) {
|
|
45950
|
+
const raw = response;
|
|
45951
|
+
const fallbackMessage = typeof raw.error === "string" ? `${raw.error}${raw.code ? ` [code: ${raw.code}]` : ""}` : void 0;
|
|
45952
|
+
if (fallbackMessage) notes.push({ text: fallbackMessage });
|
|
45953
|
+
}
|
|
45954
|
+
if (retryAfterMs !== void 0) notes.push({ text: `The API responded with a "Retry-After" header indicating you should wait ${Math.ceil(retryAfterMs / 1e3)} second(s) before retrying.` });
|
|
45955
|
+
const error51 = new APIError({
|
|
45956
|
+
text: `A request to the Cloudflare API (${resource}) failed.`,
|
|
45957
|
+
notes,
|
|
45958
|
+
status: status$1,
|
|
45959
|
+
retryAfterMs,
|
|
45960
|
+
telemetryMessage: false
|
|
45961
|
+
});
|
|
45962
|
+
const code = errors$1[0]?.code;
|
|
45963
|
+
if (code) error51.code = code;
|
|
45964
|
+
const meta3 = errors$1[0]?.meta;
|
|
45965
|
+
if (meta3) error51.meta = meta3;
|
|
45966
|
+
error51.accountTag = extractAccountTag(resource);
|
|
45967
|
+
throw error51;
|
|
45968
|
+
}
|
|
45969
|
+
__name$3(throwFetchError, "throwFetchError");
|
|
45970
|
+
function throwWAFBlockError(headers, method, resource, status$1, statusText, retryAfterMs) {
|
|
45971
|
+
const rayId = extractWAFBlockRayId(headers);
|
|
45972
|
+
throw new APIError({
|
|
45973
|
+
text: "The Cloudflare API responded with a WAF block page instead of the expected JSON response",
|
|
45974
|
+
notes: [
|
|
45975
|
+
{ text: "Cloudflare's firewall (WAF) blocked this API request. This is usually a false positive." },
|
|
45976
|
+
...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : [],
|
|
45977
|
+
{ text: rayId ? "If the issue persists, please open a Cloudflare Support ticket and include the Ray ID above." : "If the issue persists, please open a Cloudflare Support ticket. You can find the Cloudflare Ray ID on the block page in your browser." },
|
|
45978
|
+
{ text: `${method} ${resource} -> ${status$1} ${statusText}` }
|
|
45979
|
+
],
|
|
45980
|
+
status: status$1,
|
|
45981
|
+
retryAfterMs,
|
|
45982
|
+
telemetryMessage: false
|
|
45983
|
+
});
|
|
45984
|
+
}
|
|
45985
|
+
__name$3(throwWAFBlockError, "throwWAFBlockError");
|
|
45986
|
+
async function fetchKVGetValueBase(complianceConfig, accountId, namespaceId, key, userAgent, logger$1, credentials) {
|
|
45987
|
+
const headers = new import_undici$3.Headers();
|
|
45988
|
+
addAuthorizationHeader(headers, credentials);
|
|
45989
|
+
headers.set("User-Agent", userAgent);
|
|
45990
|
+
maybeAddTraceHeader(headers);
|
|
45991
|
+
const resource = `${getCloudflareApiBaseUrl(complianceConfig)}/accounts/${accountId}/storage/kv/namespaces/${namespaceId}/values/${key}`;
|
|
45992
|
+
logger$1.debug(`-- START CF API REQUEST: GET ${resource}`);
|
|
45993
|
+
logger$1.debug("-- END CF API REQUEST");
|
|
45994
|
+
const response = await (0, import_undici$3.fetch)(resource, {
|
|
45995
|
+
method: "GET",
|
|
45996
|
+
headers
|
|
45997
|
+
});
|
|
45998
|
+
if (response.ok) return await response.arrayBuffer();
|
|
45999
|
+
else throw new Error(`Failed to fetch ${resource} - ${response.status}: ${response.statusText}`);
|
|
46000
|
+
}
|
|
46001
|
+
__name$3(fetchKVGetValueBase, "fetchKVGetValueBase");
|
|
46002
|
+
function hasCursor(result_info) {
|
|
46003
|
+
const cursor$1 = result_info?.cursor;
|
|
46004
|
+
return cursor$1 !== void 0 && cursor$1 !== null && cursor$1 !== "";
|
|
46005
|
+
}
|
|
46006
|
+
__name$3(hasCursor, "hasCursor");
|
|
46007
|
+
function maybeAddTraceHeader(headers) {
|
|
46008
|
+
const traceHeader = getTraceHeader();
|
|
46009
|
+
if (traceHeader) headers.set("Cf-Trace-Id", traceHeader);
|
|
46010
|
+
}
|
|
46011
|
+
__name$3(maybeAddTraceHeader, "maybeAddTraceHeader");
|
|
46012
|
+
function cloneHeaders(headers) {
|
|
46013
|
+
return new import_undici$3.Headers(headers);
|
|
46014
|
+
}
|
|
46015
|
+
__name$3(cloneHeaders, "cloneHeaders");
|
|
45589
46016
|
var import_command_exists$1 = __toESM(require_command_exists2());
|
|
45590
46017
|
var UPDATE_SERVICE_URL = "https://update.argotunnel.com";
|
|
45591
46018
|
var CLOUDFLARED_VERSION_PATTERN = /^\d{4}\.\d+\.\d+$/;
|
|
@@ -45975,12 +46402,93 @@ function removeCloudflaredCache(version2) {
|
|
|
45975
46402
|
}
|
|
45976
46403
|
__name$3(removeCloudflaredCache, "removeCloudflaredCache");
|
|
45977
46404
|
var TUNNEL_STARTUP_TIMEOUT_MS = 3e4;
|
|
46405
|
+
var TUNNEL_API_TIMEOUT_MS = 6e4;
|
|
45978
46406
|
var TUNNEL_FORCE_KILL_TIMEOUT_MS = 5e3;
|
|
45979
46407
|
var DEFAULT_TUNNEL_EXPIRY_MS = 3600 * 1e3;
|
|
45980
46408
|
var DEFAULT_TUNNEL_EXTENSION_MS = 3600 * 1e3;
|
|
45981
46409
|
var DEFAULT_TUNNEL_MAX_REMAINING_MS = 10800 * 1e3;
|
|
45982
46410
|
var DEFAULT_TUNNEL_REMINDER_INTERVAL_MS = 600 * 1e3;
|
|
45983
46411
|
var QUICK_TUNNEL_URL_REGEX = /https:\/\/[a-z0-9-]+\.trycloudflare\.com/;
|
|
46412
|
+
var LOCAL_TUNNEL_HOSTNAMES = /* @__PURE__ */ new Set([
|
|
46413
|
+
"localhost",
|
|
46414
|
+
"127.0.0.1",
|
|
46415
|
+
"::1",
|
|
46416
|
+
"0.0.0.0",
|
|
46417
|
+
"::"
|
|
46418
|
+
]);
|
|
46419
|
+
async function resolveNamedTunnel(name, origin, options) {
|
|
46420
|
+
const { accountId, apiToken, complianceRegion, logger: logger$1, userAgent, abortSignal } = options;
|
|
46421
|
+
const complianceConfig = { compliance_region: complianceRegion };
|
|
46422
|
+
const resource = `/accounts/${accountId}/cfd_tunnel`;
|
|
46423
|
+
const tunnel = (await fetchResultBase(complianceConfig, resource, void 0, userAgent, logger$1, new URLSearchParams({
|
|
46424
|
+
name,
|
|
46425
|
+
is_deleted: "false"
|
|
46426
|
+
}), createApiAbortSignal(TUNNEL_API_TIMEOUT_MS, abortSignal), apiToken)).find((item) => item.name === name);
|
|
46427
|
+
if (!tunnel) throw new UserError$1(`No Cloudflare Tunnel named "${name}" was found in this account. Use "wrangler tunnel list" to see available tunnels.`, { telemetryMessage: "tunnel resolve named missing tunnel" });
|
|
46428
|
+
const tunnelId = tunnel.id;
|
|
46429
|
+
if (!tunnelId) throw new FatalError$1(`Tunnel "${name}" was found but has no ID. This is unexpected.`, { telemetryMessage: "tunnel resolve named missing tunnel id" });
|
|
46430
|
+
const ingress = (await fetchResultBase(complianceConfig, `${resource}/${tunnelId}/configurations`, void 0, userAgent, logger$1, void 0, createApiAbortSignal(TUNNEL_API_TIMEOUT_MS, abortSignal), apiToken)).config?.ingress ?? [];
|
|
46431
|
+
const hostnames = getMatchingIngressHostnames(origin, ingress);
|
|
46432
|
+
if (hostnames.length === 0) throw new UserError$1(createMissingIngressMessage(name, origin, {
|
|
46433
|
+
dashboardUrl: `https://dash.cloudflare.com/${accountId}/tunnels/${tunnelId}`,
|
|
46434
|
+
ingress
|
|
46435
|
+
}), { telemetryMessage: "tunnel resolve named ingress mismatch" });
|
|
46436
|
+
const token = await fetchResultBase(complianceConfig, `${resource}/${tunnelId}/token`, void 0, userAgent, logger$1, void 0, createApiAbortSignal(TUNNEL_API_TIMEOUT_MS, abortSignal), apiToken);
|
|
46437
|
+
return {
|
|
46438
|
+
hostnames,
|
|
46439
|
+
token: String(token)
|
|
46440
|
+
};
|
|
46441
|
+
}
|
|
46442
|
+
__name$3(resolveNamedTunnel, "resolveNamedTunnel");
|
|
46443
|
+
function getMatchingIngressHostnames(origin, ingressConfig) {
|
|
46444
|
+
const hostnames = /* @__PURE__ */ new Set();
|
|
46445
|
+
const originUrl = normalizeURL(origin);
|
|
46446
|
+
for (const ingress of ingressConfig) try {
|
|
46447
|
+
const serviceUrl = normalizeURL(ingress.service);
|
|
46448
|
+
if (ingress.hostname && serviceUrl.toString() === originUrl.toString()) hostnames.add(ingress.hostname);
|
|
46449
|
+
} catch {}
|
|
46450
|
+
return [...hostnames];
|
|
46451
|
+
}
|
|
46452
|
+
__name$3(getMatchingIngressHostnames, "getMatchingIngressHostnames");
|
|
46453
|
+
function normalizeURL(url2) {
|
|
46454
|
+
const normalizedUrl = new URL(url2);
|
|
46455
|
+
if (LOCAL_TUNNEL_HOSTNAMES.has(normalizedUrl.hostname)) normalizedUrl.hostname = "localhost";
|
|
46456
|
+
if (!normalizedUrl.port) switch (normalizedUrl.protocol) {
|
|
46457
|
+
case "http:":
|
|
46458
|
+
normalizedUrl.port = "80";
|
|
46459
|
+
break;
|
|
46460
|
+
case "https:":
|
|
46461
|
+
normalizedUrl.port = "443";
|
|
46462
|
+
break;
|
|
46463
|
+
}
|
|
46464
|
+
return normalizedUrl;
|
|
46465
|
+
}
|
|
46466
|
+
__name$3(normalizeURL, "normalizeURL");
|
|
46467
|
+
function createApiAbortSignal(timeoutMs, abortSignal) {
|
|
46468
|
+
const timeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
46469
|
+
return abortSignal ? AbortSignal.any([abortSignal, timeoutSignal]) : timeoutSignal;
|
|
46470
|
+
}
|
|
46471
|
+
__name$3(createApiAbortSignal, "createApiAbortSignal");
|
|
46472
|
+
function createMissingIngressMessage(name, origin, { dashboardUrl, ingress }) {
|
|
46473
|
+
if (ingress.length === 0) return [
|
|
46474
|
+
`Tunnel "${name}" has no routes configured.`,
|
|
46475
|
+
"",
|
|
46476
|
+
`Add a route for ${origin} in the Cloudflare dashboard:`,
|
|
46477
|
+
dashboardUrl,
|
|
46478
|
+
""
|
|
46479
|
+
].join("\n");
|
|
46480
|
+
return [
|
|
46481
|
+
`Tunnel "${name}" has no route for ${origin}`,
|
|
46482
|
+
"",
|
|
46483
|
+
"Resolved routes:",
|
|
46484
|
+
...ingress.map(({ hostname: hostname3, service }) => ` - ${hostname3 ?? "(no hostname)"} -> ${service}`),
|
|
46485
|
+
"",
|
|
46486
|
+
"Update your local server settings or the tunnel routes in the Cloudflare dashboard:",
|
|
46487
|
+
dashboardUrl,
|
|
46488
|
+
""
|
|
46489
|
+
].join("\n");
|
|
46490
|
+
}
|
|
46491
|
+
__name$3(createMissingIngressMessage, "createMissingIngressMessage");
|
|
45984
46492
|
function startTunnel(options) {
|
|
45985
46493
|
let disposed = false;
|
|
45986
46494
|
let reminderInterval;
|
|
@@ -46161,267 +46669,6 @@ The local dev server started at ${origin.href}
|
|
|
46161
46669
|
return new Error(errorMessage);
|
|
46162
46670
|
}
|
|
46163
46671
|
__name$3(createTunnelStartupError, "createTunnelStartupError");
|
|
46164
|
-
function buildDetailedError(message, ...extra) {
|
|
46165
|
-
return new ParseError({
|
|
46166
|
-
text: message,
|
|
46167
|
-
notes: extra.map((text) => ({ text })),
|
|
46168
|
-
telemetryMessage: false
|
|
46169
|
-
});
|
|
46170
|
-
}
|
|
46171
|
-
__name$3(buildDetailedError, "buildDetailedError");
|
|
46172
|
-
function maybeThrowFriendlyError(error51) {
|
|
46173
|
-
if (error51.message === "workers.api.error.email_verification_required") throw buildDetailedError("Please verify your account's email address and try again.", "Check your email for a verification link, or login to https://dash.cloudflare.com and request a new one.");
|
|
46174
|
-
}
|
|
46175
|
-
__name$3(maybeThrowFriendlyError, "maybeThrowFriendlyError");
|
|
46176
|
-
function logHeaders(headers, logger$1) {
|
|
46177
|
-
const clone2 = cloneHeaders(headers);
|
|
46178
|
-
clone2.delete("Authorization");
|
|
46179
|
-
logger$1.debugWithSanitization?.("HEADERS:", JSON.stringify(Object.fromEntries(clone2), null, 2));
|
|
46180
|
-
}
|
|
46181
|
-
__name$3(logHeaders, "logHeaders");
|
|
46182
|
-
async function performApiFetchBase(complianceConfig, resource, init$2 = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
46183
|
-
assert(credentials, "credentials are required for performApiFetch");
|
|
46184
|
-
const method = init$2.method ?? "GET";
|
|
46185
|
-
assert(resource.startsWith("/"), `CF API fetch - resource path must start with a "/" but got "${resource}"`);
|
|
46186
|
-
const headers = cloneHeaders(new import_undici$3.Headers(init$2.headers));
|
|
46187
|
-
addAuthorizationHeader(headers, credentials);
|
|
46188
|
-
headers.set("User-Agent", userAgent);
|
|
46189
|
-
maybeAddTraceHeader(headers);
|
|
46190
|
-
const queryString = queryParams ? `?${queryParams.toString()}` : "";
|
|
46191
|
-
logger$1.debug(`-- START CF API REQUEST: ${method} ${getCloudflareApiBaseUrl(complianceConfig)}${resource}`);
|
|
46192
|
-
logger$1.debugWithSanitization?.("QUERY STRING:", queryString);
|
|
46193
|
-
logHeaders(headers, logger$1);
|
|
46194
|
-
logger$1.debugWithSanitization?.("INIT:", JSON.stringify({ ...init$2 }, null, 2));
|
|
46195
|
-
if (init$2.body instanceof import_undici$3.FormData) logger$1.debugWithSanitization?.("BODY:", await new import_undici$3.Response(init$2.body).text(), null, 2);
|
|
46196
|
-
logger$1.debug("-- END CF API REQUEST");
|
|
46197
|
-
return await (0, import_undici$3.fetch)(`${getCloudflareApiBaseUrl(complianceConfig)}${resource}${queryString}`, {
|
|
46198
|
-
method,
|
|
46199
|
-
...init$2,
|
|
46200
|
-
headers,
|
|
46201
|
-
signal: abortSignal
|
|
46202
|
-
});
|
|
46203
|
-
}
|
|
46204
|
-
__name$3(performApiFetchBase, "performApiFetchBase");
|
|
46205
|
-
async function fetchInternalBase(complianceConfig, resource, init$2 = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
46206
|
-
const method = init$2.method ?? "GET";
|
|
46207
|
-
const response = await performApiFetchBase(complianceConfig, resource, init$2, userAgent, logger$1, queryParams, abortSignal, credentials);
|
|
46208
|
-
const jsonText = await response.text();
|
|
46209
|
-
logger$1.debug("-- START CF API RESPONSE:", response.statusText, response.status);
|
|
46210
|
-
logHeaders(response.headers, logger$1);
|
|
46211
|
-
logger$1.debugWithSanitization?.("RESPONSE:", jsonText);
|
|
46212
|
-
logger$1.debug("-- END CF API RESPONSE");
|
|
46213
|
-
const retryAfterMs = parseRetryAfterMs(response.headers);
|
|
46214
|
-
if (!jsonText && (response.status === 204 || response.status === 205)) return {
|
|
46215
|
-
response: {
|
|
46216
|
-
result: {},
|
|
46217
|
-
success: true,
|
|
46218
|
-
errors: [],
|
|
46219
|
-
messages: []
|
|
46220
|
-
},
|
|
46221
|
-
status: response.status,
|
|
46222
|
-
retryAfterMs
|
|
46223
|
-
};
|
|
46224
|
-
if (isWAFBlockResponse(response.headers)) throwWAFBlockError(response.headers, method, resource, response.status, response.statusText, retryAfterMs);
|
|
46225
|
-
try {
|
|
46226
|
-
return {
|
|
46227
|
-
response: parseJSON(jsonText),
|
|
46228
|
-
status: response.status,
|
|
46229
|
-
retryAfterMs
|
|
46230
|
-
};
|
|
46231
|
-
} catch {
|
|
46232
|
-
const rayId = extractWAFBlockRayId(response.headers);
|
|
46233
|
-
throw new APIError({
|
|
46234
|
-
text: "Received a malformed response from the API",
|
|
46235
|
-
notes: [
|
|
46236
|
-
{ text: truncate(jsonText, 100) },
|
|
46237
|
-
{ text: `${method} ${resource} -> ${response.status} ${response.statusText}` },
|
|
46238
|
-
...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : []
|
|
46239
|
-
],
|
|
46240
|
-
status: response.status,
|
|
46241
|
-
retryAfterMs,
|
|
46242
|
-
telemetryMessage: false
|
|
46243
|
-
});
|
|
46244
|
-
}
|
|
46245
|
-
}
|
|
46246
|
-
__name$3(fetchInternalBase, "fetchInternalBase");
|
|
46247
|
-
async function fetchResultBase(complianceConfig, resource, init$2 = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
46248
|
-
const { response: json2, status: status$1, retryAfterMs } = await fetchInternalBase(complianceConfig, resource, init$2, userAgent, logger$1, queryParams, abortSignal, credentials);
|
|
46249
|
-
if (json2.success) return json2.result;
|
|
46250
|
-
else throwFetchError(resource, json2, status$1, retryAfterMs);
|
|
46251
|
-
}
|
|
46252
|
-
__name$3(fetchResultBase, "fetchResultBase");
|
|
46253
|
-
async function fetchListResultBase(complianceConfig, resource, init$2 = {}, userAgent, logger$1, queryParams, credentials) {
|
|
46254
|
-
const results = [];
|
|
46255
|
-
let getMoreResults = true;
|
|
46256
|
-
let cursor$1;
|
|
46257
|
-
while (getMoreResults) {
|
|
46258
|
-
if (cursor$1) {
|
|
46259
|
-
queryParams = new URLSearchParams$1(queryParams);
|
|
46260
|
-
queryParams.set("cursor", cursor$1);
|
|
46261
|
-
}
|
|
46262
|
-
const { response: json2, status: status$1, retryAfterMs } = await fetchInternalBase(complianceConfig, resource, init$2, userAgent, logger$1, queryParams, void 0, credentials);
|
|
46263
|
-
if (json2.success) {
|
|
46264
|
-
results.push(...json2.result);
|
|
46265
|
-
if (hasCursor(json2.result_info)) cursor$1 = json2.result_info?.cursor;
|
|
46266
|
-
else getMoreResults = false;
|
|
46267
|
-
} else throwFetchError(resource, json2, status$1, retryAfterMs);
|
|
46268
|
-
}
|
|
46269
|
-
return results;
|
|
46270
|
-
}
|
|
46271
|
-
__name$3(fetchListResultBase, "fetchListResultBase");
|
|
46272
|
-
function truncate(text, maxLength) {
|
|
46273
|
-
const { length } = text;
|
|
46274
|
-
if (length <= maxLength) return text;
|
|
46275
|
-
return `${text.substring(0, maxLength)}... (length = ${length})`;
|
|
46276
|
-
}
|
|
46277
|
-
__name$3(truncate, "truncate");
|
|
46278
|
-
function isWAFBlockResponse(headers) {
|
|
46279
|
-
return headers.get("cf-mitigated") === "challenge";
|
|
46280
|
-
}
|
|
46281
|
-
__name$3(isWAFBlockResponse, "isWAFBlockResponse");
|
|
46282
|
-
function parseRetryAfterValue(retryAfter) {
|
|
46283
|
-
if (!retryAfter) return;
|
|
46284
|
-
if (/^\d+$/.test(retryAfter.trim())) return Number(retryAfter) * 1e3;
|
|
46285
|
-
const retryAfterDate = new Date(retryAfter);
|
|
46286
|
-
if (!Number.isNaN(retryAfterDate.getTime())) return Math.max(0, retryAfterDate.getTime() - Date.now());
|
|
46287
|
-
}
|
|
46288
|
-
__name$3(parseRetryAfterValue, "parseRetryAfterValue");
|
|
46289
|
-
function parseRetryAfterMs(headers) {
|
|
46290
|
-
return parseRetryAfterValue(headers.get("Retry-After"));
|
|
46291
|
-
}
|
|
46292
|
-
__name$3(parseRetryAfterMs, "parseRetryAfterMs");
|
|
46293
|
-
function extractWAFBlockRayId(headers) {
|
|
46294
|
-
return headers.get("cf-ray") ?? void 0;
|
|
46295
|
-
}
|
|
46296
|
-
__name$3(extractWAFBlockRayId, "extractWAFBlockRayId");
|
|
46297
|
-
function extractAccountTag(resource) {
|
|
46298
|
-
return (/* @__PURE__ */ new RegExp("/accounts/([a-zA-Z0-9]+)/?")).exec(resource)?.[1];
|
|
46299
|
-
}
|
|
46300
|
-
__name$3(extractAccountTag, "extractAccountTag");
|
|
46301
|
-
function hasMorePages(result_info) {
|
|
46302
|
-
const page = result_info?.page;
|
|
46303
|
-
const per_page = result_info?.per_page;
|
|
46304
|
-
const total = result_info?.total_count;
|
|
46305
|
-
return page !== void 0 && per_page !== void 0 && total !== void 0 && page * per_page < total;
|
|
46306
|
-
}
|
|
46307
|
-
__name$3(hasMorePages, "hasMorePages");
|
|
46308
|
-
function renderError(err, level = 0) {
|
|
46309
|
-
const indent = " ".repeat(level);
|
|
46310
|
-
const message = err.message ?? "";
|
|
46311
|
-
const chainedMessages = "error_chain" in err ? err.error_chain?.map((chainedError) => `
|
|
46312
|
-
|
|
46313
|
-
${indent}- ${renderError(chainedError, level + 1)}`).join("\n") ?? "" : "";
|
|
46314
|
-
return (err.code ? `${message} [code: ${err.code}]` : message) + (err.documentation_url ? `
|
|
46315
|
-
${indent}To learn more about this error, visit: ${err.documentation_url}` : "") + chainedMessages;
|
|
46316
|
-
}
|
|
46317
|
-
__name$3(renderError, "renderError");
|
|
46318
|
-
function addAuthorizationHeader(headers, auth, overrideExisting = false) {
|
|
46319
|
-
if (!headers.has("Authorization") || overrideExisting) if ("apiToken" in auth) {
|
|
46320
|
-
const authorizationHeader = `Bearer ${auth.apiToken}`;
|
|
46321
|
-
validateAuthorizationHeaderValue(authorizationHeader);
|
|
46322
|
-
headers.set("Authorization", authorizationHeader);
|
|
46323
|
-
} else {
|
|
46324
|
-
headers.set("X-Auth-Key", auth.authKey);
|
|
46325
|
-
headers.set("X-Auth-Email", auth.authEmail);
|
|
46326
|
-
}
|
|
46327
|
-
}
|
|
46328
|
-
__name$3(addAuthorizationHeader, "addAuthorizationHeader");
|
|
46329
|
-
function validateAuthorizationHeaderValue(value) {
|
|
46330
|
-
for (const character of value) {
|
|
46331
|
-
const codePoint = character.codePointAt(0);
|
|
46332
|
-
if (codePoint === void 0 || codePoint > 255) throw new UserError$1(`The configured Cloudflare API token contains a character that cannot be used in an HTTP Authorization header: ${formatAuthorizationHeaderCharacter(character, codePoint)}. Recreate or copy the token again, making sure it does not include characters such as ellipses.`, { telemetryMessage: "cfetch auth invalid authorization header" });
|
|
46333
|
-
}
|
|
46334
|
-
}
|
|
46335
|
-
__name$3(validateAuthorizationHeaderValue, "validateAuthorizationHeaderValue");
|
|
46336
|
-
function formatAuthorizationHeaderCharacter(character, codePoint) {
|
|
46337
|
-
if (codePoint === void 0) return "\"\\u{unknown}\"";
|
|
46338
|
-
const codePointLabel = `U+${codePoint.toString(16).toUpperCase().padStart(4, "0")}`;
|
|
46339
|
-
return `${isPrintableCharacter(character) ? `"${character}"` : `"${escapeCharacter(character)}"`} (${codePointLabel})`;
|
|
46340
|
-
}
|
|
46341
|
-
__name$3(formatAuthorizationHeaderCharacter, "formatAuthorizationHeaderCharacter");
|
|
46342
|
-
function isPrintableCharacter(character) {
|
|
46343
|
-
return !/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(character);
|
|
46344
|
-
}
|
|
46345
|
-
__name$3(isPrintableCharacter, "isPrintableCharacter");
|
|
46346
|
-
function escapeCharacter(character) {
|
|
46347
|
-
return Array.from(character).map((c$1) => {
|
|
46348
|
-
const codePoint = c$1.codePointAt(0);
|
|
46349
|
-
if (codePoint === void 0) return "";
|
|
46350
|
-
return codePoint <= 65535 ? `\\u${codePoint.toString(16).toUpperCase().padStart(4, "0")}` : `\\u{${codePoint.toString(16).toUpperCase()}}`;
|
|
46351
|
-
}).join("");
|
|
46352
|
-
}
|
|
46353
|
-
__name$3(escapeCharacter, "escapeCharacter");
|
|
46354
|
-
function throwFetchError(resource, response, status$1, retryAfterMs) {
|
|
46355
|
-
const errors$1 = response.errors ?? [];
|
|
46356
|
-
for (const error52 of errors$1) maybeThrowFriendlyError(error52);
|
|
46357
|
-
const notes = [...errors$1.map((err) => ({ text: renderError(err) })), ...response.messages?.map((msg) => ({ text: typeof msg === "string" ? msg : msg.message ?? String(msg) })) ?? []];
|
|
46358
|
-
if (notes.length === 0) {
|
|
46359
|
-
const raw = response;
|
|
46360
|
-
const fallbackMessage = typeof raw.error === "string" ? `${raw.error}${raw.code ? ` [code: ${raw.code}]` : ""}` : void 0;
|
|
46361
|
-
if (fallbackMessage) notes.push({ text: fallbackMessage });
|
|
46362
|
-
}
|
|
46363
|
-
if (retryAfterMs !== void 0) notes.push({ text: `The API responded with a "Retry-After" header indicating you should wait ${Math.ceil(retryAfterMs / 1e3)} second(s) before retrying.` });
|
|
46364
|
-
const error51 = new APIError({
|
|
46365
|
-
text: `A request to the Cloudflare API (${resource}) failed.`,
|
|
46366
|
-
notes,
|
|
46367
|
-
status: status$1,
|
|
46368
|
-
retryAfterMs,
|
|
46369
|
-
telemetryMessage: false
|
|
46370
|
-
});
|
|
46371
|
-
const code = errors$1[0]?.code;
|
|
46372
|
-
if (code) error51.code = code;
|
|
46373
|
-
const meta3 = errors$1[0]?.meta;
|
|
46374
|
-
if (meta3) error51.meta = meta3;
|
|
46375
|
-
error51.accountTag = extractAccountTag(resource);
|
|
46376
|
-
throw error51;
|
|
46377
|
-
}
|
|
46378
|
-
__name$3(throwFetchError, "throwFetchError");
|
|
46379
|
-
function throwWAFBlockError(headers, method, resource, status$1, statusText, retryAfterMs) {
|
|
46380
|
-
const rayId = extractWAFBlockRayId(headers);
|
|
46381
|
-
throw new APIError({
|
|
46382
|
-
text: "The Cloudflare API responded with a WAF block page instead of the expected JSON response",
|
|
46383
|
-
notes: [
|
|
46384
|
-
{ text: "Cloudflare's firewall (WAF) blocked this API request. This is usually a false positive." },
|
|
46385
|
-
...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : [],
|
|
46386
|
-
{ text: rayId ? "If the issue persists, please open a Cloudflare Support ticket and include the Ray ID above." : "If the issue persists, please open a Cloudflare Support ticket. You can find the Cloudflare Ray ID on the block page in your browser." },
|
|
46387
|
-
{ text: `${method} ${resource} -> ${status$1} ${statusText}` }
|
|
46388
|
-
],
|
|
46389
|
-
status: status$1,
|
|
46390
|
-
retryAfterMs,
|
|
46391
|
-
telemetryMessage: false
|
|
46392
|
-
});
|
|
46393
|
-
}
|
|
46394
|
-
__name$3(throwWAFBlockError, "throwWAFBlockError");
|
|
46395
|
-
async function fetchKVGetValueBase(complianceConfig, accountId, namespaceId, key, userAgent, logger$1, credentials) {
|
|
46396
|
-
const headers = new import_undici$3.Headers();
|
|
46397
|
-
addAuthorizationHeader(headers, credentials);
|
|
46398
|
-
headers.set("User-Agent", userAgent);
|
|
46399
|
-
maybeAddTraceHeader(headers);
|
|
46400
|
-
const resource = `${getCloudflareApiBaseUrl(complianceConfig)}/accounts/${accountId}/storage/kv/namespaces/${namespaceId}/values/${key}`;
|
|
46401
|
-
logger$1.debug(`-- START CF API REQUEST: GET ${resource}`);
|
|
46402
|
-
logger$1.debug("-- END CF API REQUEST");
|
|
46403
|
-
const response = await (0, import_undici$3.fetch)(resource, {
|
|
46404
|
-
method: "GET",
|
|
46405
|
-
headers
|
|
46406
|
-
});
|
|
46407
|
-
if (response.ok) return await response.arrayBuffer();
|
|
46408
|
-
else throw new Error(`Failed to fetch ${resource} - ${response.status}: ${response.statusText}`);
|
|
46409
|
-
}
|
|
46410
|
-
__name$3(fetchKVGetValueBase, "fetchKVGetValueBase");
|
|
46411
|
-
function hasCursor(result_info) {
|
|
46412
|
-
const cursor$1 = result_info?.cursor;
|
|
46413
|
-
return cursor$1 !== void 0 && cursor$1 !== null && cursor$1 !== "";
|
|
46414
|
-
}
|
|
46415
|
-
__name$3(hasCursor, "hasCursor");
|
|
46416
|
-
function maybeAddTraceHeader(headers) {
|
|
46417
|
-
const traceHeader = getTraceHeader();
|
|
46418
|
-
if (traceHeader) headers.set("Cf-Trace-Id", traceHeader);
|
|
46419
|
-
}
|
|
46420
|
-
__name$3(maybeAddTraceHeader, "maybeAddTraceHeader");
|
|
46421
|
-
function cloneHeaders(headers) {
|
|
46422
|
-
return new import_undici$3.Headers(headers);
|
|
46423
|
-
}
|
|
46424
|
-
__name$3(cloneHeaders, "cloneHeaders");
|
|
46425
46672
|
var import_update_check = __toESM(require_update_check());
|
|
46426
46673
|
var UPDATE_CHECK_TIMEOUT_MS = 3e3;
|
|
46427
46674
|
var TIMED_OUT = Symbol("timed_out");
|
|
@@ -46445,7 +46692,7 @@ async function fetchLatestNpmVersion(name, version2) {
|
|
|
46445
46692
|
__name$3(fetchLatestNpmVersion, "fetchLatestNpmVersion");
|
|
46446
46693
|
async function openInBrowser(url2, logger$1) {
|
|
46447
46694
|
try {
|
|
46448
|
-
const { default: open } = await import("./open-PBXRGS4R-
|
|
46695
|
+
const { default: open } = await import("./open-PBXRGS4R-CzyP5HqI.mjs");
|
|
46449
46696
|
(await open(url2)).on("error", (err) => {
|
|
46450
46697
|
handleBrowserOpenError(url2, err, logger$1);
|
|
46451
46698
|
});
|
|
@@ -48660,8 +48907,8 @@ await cjsModuleLexer.init();
|
|
|
48660
48907
|
* using the same package as Node.
|
|
48661
48908
|
*/
|
|
48662
48909
|
async function getCjsNamedExports(vite, filePath, contents, seen = /* @__PURE__ */ new Set()) {
|
|
48663
|
-
const { exports: exports$
|
|
48664
|
-
const result = new Set(exports$
|
|
48910
|
+
const { exports: exports$1, reexports } = cjsModuleLexer.parse(contents);
|
|
48911
|
+
const result = new Set(exports$1);
|
|
48665
48912
|
for (const reexport of reexports) {
|
|
48666
48913
|
const resolved = await viteResolve(vite, reexport, filePath, true);
|
|
48667
48914
|
if (seen.has(resolved)) continue;
|
|
@@ -52976,7 +53223,7 @@ function createOAuthFlow(ctx) {
|
|
|
52976
53223
|
__name$2(createOAuthFlow, "createOAuthFlow");
|
|
52977
53224
|
var RESERVED_PROFILE_NAMES = ["default", "staging"];
|
|
52978
53225
|
function createProfileStore(args) {
|
|
52979
|
-
const bindings
|
|
53226
|
+
const bindings = {
|
|
52980
53227
|
read() {
|
|
52981
53228
|
return args.bindings.read();
|
|
52982
53229
|
},
|
|
@@ -53042,14 +53289,14 @@ function createProfileStore(args) {
|
|
|
53042
53289
|
};
|
|
53043
53290
|
return {
|
|
53044
53291
|
configs: args.configs,
|
|
53045
|
-
bindings
|
|
53292
|
+
bindings,
|
|
53046
53293
|
resolve(resolveArgs) {
|
|
53047
53294
|
if (resolveArgs.profile) {
|
|
53048
53295
|
if (resolveArgs.profile === "default") return "default";
|
|
53049
53296
|
validateProfileName(resolveArgs.profile);
|
|
53050
53297
|
return resolveArgs.profile;
|
|
53051
53298
|
}
|
|
53052
|
-
const dirProfile = bindings
|
|
53299
|
+
const dirProfile = bindings.getProfileForDirectory(resolveArgs.cwd);
|
|
53053
53300
|
if (dirProfile) return dirProfile;
|
|
53054
53301
|
return "default";
|
|
53055
53302
|
}
|
|
@@ -53065,9 +53312,9 @@ function formatDirectoryForUserError(dir$1) {
|
|
|
53065
53312
|
return path.relative(process.cwd(), dir$1) || ".";
|
|
53066
53313
|
}
|
|
53067
53314
|
__name$2(formatDirectoryForUserError, "formatDirectoryForUserError");
|
|
53068
|
-
function getProfileForDirectoryFromBindings(startDir, bindings
|
|
53315
|
+
function getProfileForDirectoryFromBindings(startDir, bindings) {
|
|
53069
53316
|
const normalizedDir = path.resolve(startDir);
|
|
53070
|
-
const sortedEntries = Object.entries(bindings
|
|
53317
|
+
const sortedEntries = Object.entries(bindings).sort(([a], [b]) => b.length - a.length);
|
|
53071
53318
|
for (const [boundDir, profile] of sortedEntries) {
|
|
53072
53319
|
if (normalizedDir === boundDir) return {
|
|
53073
53320
|
profile,
|
|
@@ -59693,7 +59940,7 @@ var require_command_exists = /* @__PURE__ */ __commonJS$2({ "../../node_modules/
|
|
|
59693
59940
|
}) });
|
|
59694
59941
|
|
|
59695
59942
|
//#endregion
|
|
59696
|
-
//#region ../deploy-helpers/dist/chunk-
|
|
59943
|
+
//#region ../deploy-helpers/dist/chunk-3G6JZQDH.mjs
|
|
59697
59944
|
var import_undici$1 = require_undici();
|
|
59698
59945
|
var import_command_exists = require_command_exists();
|
|
59699
59946
|
function handleUnsafeCapnp(capnp) {
|
|
@@ -59733,7 +59980,7 @@ function fromMimeType(mimeType) {
|
|
|
59733
59980
|
return moduleType;
|
|
59734
59981
|
}
|
|
59735
59982
|
__name$1(fromMimeType, "fromMimeType");
|
|
59736
|
-
function createWorkerUploadForm(worker, bindings
|
|
59983
|
+
function createWorkerUploadForm(worker, bindings, options) {
|
|
59737
59984
|
const formData = new import_undici$1.FormData();
|
|
59738
59985
|
const { main, sourceMaps, migrations, exports: configuredExports, compatibility_date, compatibility_flags, keepVars, keepSecrets, keepBindings, logpush, placement, tail_consumers, streaming_tail_consumers, limits, annotations, keep_assets, assets, observability, cache: cache$1, package_dependencies } = worker;
|
|
59739
59986
|
const assetConfig = {
|
|
@@ -59757,47 +60004,47 @@ function createWorkerUploadForm(worker, bindings$1, options) {
|
|
|
59757
60004
|
}
|
|
59758
60005
|
let { modules } = worker;
|
|
59759
60006
|
const metadataBindings = [];
|
|
59760
|
-
const plain_text = extractBindingsOfType("plain_text", bindings
|
|
59761
|
-
const json_bindings = extractBindingsOfType("json", bindings
|
|
59762
|
-
const secret_text = extractBindingsOfType("secret_text", bindings
|
|
59763
|
-
const kv_namespaces = extractBindingsOfType("kv_namespace", bindings
|
|
59764
|
-
const send_email = extractBindingsOfType("send_email", bindings
|
|
59765
|
-
const durable_objects = extractBindingsOfType("durable_object_namespace", bindings
|
|
59766
|
-
const workflows = extractBindingsOfType("workflow", bindings
|
|
59767
|
-
const queues = extractBindingsOfType("queue", bindings
|
|
59768
|
-
const r2_buckets = extractBindingsOfType("r2_bucket", bindings
|
|
59769
|
-
const d1_databases = extractBindingsOfType("d1", bindings
|
|
59770
|
-
const vectorize = extractBindingsOfType("vectorize", bindings
|
|
59771
|
-
const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings
|
|
59772
|
-
const ai_search = extractBindingsOfType("ai_search", bindings
|
|
59773
|
-
const websearch = extractBindingsOfType("websearch", bindings
|
|
59774
|
-
const agent_memory = extractBindingsOfType("agent_memory", bindings
|
|
59775
|
-
const hyperdrive = extractBindingsOfType("hyperdrive", bindings
|
|
59776
|
-
const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings
|
|
59777
|
-
const artifacts = extractBindingsOfType("artifacts", bindings
|
|
59778
|
-
const unsafe_hello_world = extractBindingsOfType("unsafe_hello_world", bindings
|
|
59779
|
-
const flagship = extractBindingsOfType("flagship", bindings
|
|
59780
|
-
const ratelimits = extractBindingsOfType("ratelimit", bindings
|
|
59781
|
-
const vpc_services = extractBindingsOfType("vpc_service", bindings
|
|
59782
|
-
const vpc_networks = extractBindingsOfType("vpc_network", bindings
|
|
59783
|
-
const services = extractBindingsOfType("service", bindings
|
|
59784
|
-
const analytics_engine_datasets = extractBindingsOfType("analytics_engine", bindings
|
|
59785
|
-
const dispatch_namespaces = extractBindingsOfType("dispatch_namespace", bindings
|
|
59786
|
-
const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings
|
|
59787
|
-
const pipelines = extractBindingsOfType("pipeline", bindings
|
|
59788
|
-
const worker_loaders = extractBindingsOfType("worker_loader", bindings
|
|
59789
|
-
const logfwdr = extractBindingsOfType("logfwdr", bindings
|
|
59790
|
-
const wasm_modules = extractBindingsOfType("wasm_module", bindings
|
|
59791
|
-
const browser = extractBindingsOfType("browser", bindings
|
|
59792
|
-
const ai = extractBindingsOfType("ai", bindings
|
|
59793
|
-
const images = extractBindingsOfType("images", bindings
|
|
59794
|
-
const stream$2 = extractBindingsOfType("stream", bindings
|
|
59795
|
-
const media = extractBindingsOfType("media", bindings
|
|
59796
|
-
const version_metadata = extractBindingsOfType("version_metadata", bindings
|
|
59797
|
-
const assetsBinding = extractBindingsOfType("assets", bindings
|
|
59798
|
-
const text_blobs = extractBindingsOfType("text_blob", bindings
|
|
59799
|
-
const data_blobs = extractBindingsOfType("data_blob", bindings
|
|
59800
|
-
extractBindingsOfType("inherit", bindings
|
|
60007
|
+
const plain_text = extractBindingsOfType("plain_text", bindings);
|
|
60008
|
+
const json_bindings = extractBindingsOfType("json", bindings);
|
|
60009
|
+
const secret_text = extractBindingsOfType("secret_text", bindings);
|
|
60010
|
+
const kv_namespaces = extractBindingsOfType("kv_namespace", bindings);
|
|
60011
|
+
const send_email = extractBindingsOfType("send_email", bindings);
|
|
60012
|
+
const durable_objects = extractBindingsOfType("durable_object_namespace", bindings);
|
|
60013
|
+
const workflows = extractBindingsOfType("workflow", bindings);
|
|
60014
|
+
const queues = extractBindingsOfType("queue", bindings);
|
|
60015
|
+
const r2_buckets = extractBindingsOfType("r2_bucket", bindings);
|
|
60016
|
+
const d1_databases = extractBindingsOfType("d1", bindings);
|
|
60017
|
+
const vectorize = extractBindingsOfType("vectorize", bindings);
|
|
60018
|
+
const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings);
|
|
60019
|
+
const ai_search = extractBindingsOfType("ai_search", bindings);
|
|
60020
|
+
const websearch = extractBindingsOfType("websearch", bindings)[0];
|
|
60021
|
+
const agent_memory = extractBindingsOfType("agent_memory", bindings);
|
|
60022
|
+
const hyperdrive = extractBindingsOfType("hyperdrive", bindings);
|
|
60023
|
+
const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings);
|
|
60024
|
+
const artifacts = extractBindingsOfType("artifacts", bindings);
|
|
60025
|
+
const unsafe_hello_world = extractBindingsOfType("unsafe_hello_world", bindings);
|
|
60026
|
+
const flagship = extractBindingsOfType("flagship", bindings);
|
|
60027
|
+
const ratelimits = extractBindingsOfType("ratelimit", bindings);
|
|
60028
|
+
const vpc_services = extractBindingsOfType("vpc_service", bindings);
|
|
60029
|
+
const vpc_networks = extractBindingsOfType("vpc_network", bindings);
|
|
60030
|
+
const services = extractBindingsOfType("service", bindings);
|
|
60031
|
+
const analytics_engine_datasets = extractBindingsOfType("analytics_engine", bindings);
|
|
60032
|
+
const dispatch_namespaces = extractBindingsOfType("dispatch_namespace", bindings);
|
|
60033
|
+
const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings);
|
|
60034
|
+
const pipelines = extractBindingsOfType("pipeline", bindings);
|
|
60035
|
+
const worker_loaders = extractBindingsOfType("worker_loader", bindings);
|
|
60036
|
+
const logfwdr = extractBindingsOfType("logfwdr", bindings);
|
|
60037
|
+
const wasm_modules = extractBindingsOfType("wasm_module", bindings);
|
|
60038
|
+
const browser = extractBindingsOfType("browser", bindings)[0];
|
|
60039
|
+
const ai = extractBindingsOfType("ai", bindings)[0];
|
|
60040
|
+
const images = extractBindingsOfType("images", bindings)[0];
|
|
60041
|
+
const stream$2 = extractBindingsOfType("stream", bindings)[0];
|
|
60042
|
+
const media = extractBindingsOfType("media", bindings)[0];
|
|
60043
|
+
const version_metadata = extractBindingsOfType("version_metadata", bindings)[0];
|
|
60044
|
+
const assetsBinding = extractBindingsOfType("assets", bindings)[0];
|
|
60045
|
+
const text_blobs = extractBindingsOfType("text_blob", bindings);
|
|
60046
|
+
const data_blobs = extractBindingsOfType("data_blob", bindings);
|
|
60047
|
+
extractBindingsOfType("inherit", bindings).forEach(({ binding }) => {
|
|
59801
60048
|
metadataBindings.push({
|
|
59802
60049
|
name: binding,
|
|
59803
60050
|
type: "inherit"
|
|
@@ -60154,7 +60401,7 @@ function createWorkerUploadForm(worker, bindings$1, options) {
|
|
|
60154
60401
|
});
|
|
60155
60402
|
formData.set(name, new File(["contents" in source ? source.contents : readFileSync(source.path)], "path" in source ? source.path ?? name : name, { type: "application/octet-stream" }));
|
|
60156
60403
|
});
|
|
60157
|
-
for (const [bindingName, config$1] of Object.entries(bindings
|
|
60404
|
+
for (const [bindingName, config$1] of Object.entries(bindings ?? {})) if (isUnsafeBindingType(config$1.type) && config$1.type !== "unsafe_hello_world") {
|
|
60158
60405
|
const { type,...data } = config$1;
|
|
60159
60406
|
metadataBindings.push({
|
|
60160
60407
|
name: bindingName,
|
|
@@ -60217,7 +60464,8 @@ function createWorkerUploadForm(worker, bindings$1, options) {
|
|
|
60217
60464
|
bindings: metadataBindings,
|
|
60218
60465
|
containers: worker.containers === void 0 ? void 0 : worker.containers.map((c$1) => ({
|
|
60219
60466
|
...c$1.name !== void 0 && { name: c$1.name },
|
|
60220
|
-
...c$1.class_name !== void 0 && { class_name: c$1.class_name }
|
|
60467
|
+
...c$1.class_name !== void 0 && { class_name: c$1.class_name },
|
|
60468
|
+
...c$1.images !== void 0 && { images: c$1.images }
|
|
60221
60469
|
})),
|
|
60222
60470
|
...compatibility_date && { compatibility_date },
|
|
60223
60471
|
...compatibility_flags && { compatibility_flags },
|
|
@@ -60252,7 +60500,7 @@ __name$1(createWorkerUploadForm, "createWorkerUploadForm");
|
|
|
60252
60500
|
//#endregion
|
|
60253
60501
|
//#region ../remote-bindings/dist/index.mjs
|
|
60254
60502
|
var import_undici = require_undici();
|
|
60255
|
-
var version = "0.0.
|
|
60503
|
+
var version = "0.0.22";
|
|
60256
60504
|
var NoDefaultValueProvided = class extends UserError$1 {
|
|
60257
60505
|
constructor() {
|
|
60258
60506
|
super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
|
|
@@ -60693,7 +60941,7 @@ function handlePreviewSessionCreationError(err, accountId) {
|
|
|
60693
60941
|
* (flat Record<string, Binding>).
|
|
60694
60942
|
*/
|
|
60695
60943
|
function createRemoteWorkerInit(props) {
|
|
60696
|
-
const bindings
|
|
60944
|
+
const bindings = { ...props.bindings };
|
|
60697
60945
|
return {
|
|
60698
60946
|
name: props.name,
|
|
60699
60947
|
main: {
|
|
@@ -60703,7 +60951,7 @@ function createRemoteWorkerInit(props) {
|
|
|
60703
60951
|
content: props.bundle.entrypointSource
|
|
60704
60952
|
},
|
|
60705
60953
|
modules: props.bundle.modules,
|
|
60706
|
-
bindings
|
|
60954
|
+
bindings,
|
|
60707
60955
|
migrations: void 0,
|
|
60708
60956
|
exports: void 0,
|
|
60709
60957
|
compatibility_date: props.compatibilityDate,
|
|
@@ -61026,11 +61274,11 @@ function findRemoteSessionAuthError(error$2) {
|
|
|
61026
61274
|
if (isErrorEvent(error$2)) return findRemoteSessionAuthError(error$2.cause);
|
|
61027
61275
|
if (error$2 instanceof Error) return findRemoteSessionAuthError(error$2.cause);
|
|
61028
61276
|
}
|
|
61029
|
-
async function startRemoteProxySession(bindings
|
|
61030
|
-
for (const [name, binding] of Object.entries(bindings
|
|
61277
|
+
async function startRemoteProxySession(bindings, options) {
|
|
61278
|
+
for (const [name, binding] of Object.entries(bindings ?? {})) if (binding.type === "flagship" && binding.app_id === void 0) throw new UserError$1(`Flagship binding "${name}" has no \`app_id\` and has not been created, but needs to run remotely. Run \`wrangler flagship apps create\` to create an app.`, { telemetryMessage: "flagship remote binding missing app_id" });
|
|
61031
61279
|
options.logger.log(source_default.dim("⎔ Establishing remote connection..."));
|
|
61032
61280
|
initLogger(getInternalLogger(options.logger));
|
|
61033
|
-
const rawBindings = toRawBindings(bindings
|
|
61281
|
+
const rawBindings = toRawBindings(bindings);
|
|
61034
61282
|
const workerConfig = {
|
|
61035
61283
|
name: options.workerName ?? randomUUID(),
|
|
61036
61284
|
entrypointSource: ProxyServerWorker_default,
|
|
@@ -61097,8 +61345,8 @@ async function startRemoteProxySession(bindings$1, options) {
|
|
|
61097
61345
|
dispose: () => devEnv.teardown()
|
|
61098
61346
|
};
|
|
61099
61347
|
}
|
|
61100
|
-
function toRawBindings(bindings
|
|
61101
|
-
return Object.fromEntries(Object.entries(bindings
|
|
61348
|
+
function toRawBindings(bindings) {
|
|
61349
|
+
return Object.fromEntries(Object.entries(bindings ?? {}).map(([key, binding]) => [key, {
|
|
61102
61350
|
...binding,
|
|
61103
61351
|
raw: true
|
|
61104
61352
|
}]));
|
|
@@ -61117,8 +61365,8 @@ function getInternalLogger(logger$1) {
|
|
|
61117
61365
|
console: disabled
|
|
61118
61366
|
};
|
|
61119
61367
|
}
|
|
61120
|
-
function pickRemoteBindings(bindings
|
|
61121
|
-
return Object.fromEntries(Object.entries(bindings
|
|
61368
|
+
function pickRemoteBindings(bindings) {
|
|
61369
|
+
return Object.fromEntries(Object.entries(bindings ?? {}).filter(([, binding]) => {
|
|
61122
61370
|
if (getBindingLocalSupport(binding.type) === "DO-NOT-USE-this-resource-will-never-have-a-local-simulator") return true;
|
|
61123
61371
|
return "remote" in binding && binding.remote;
|
|
61124
61372
|
}));
|
|
@@ -61162,35 +61410,6 @@ function deepStrictEqual(source, target) {
|
|
|
61162
61410
|
}
|
|
61163
61411
|
}
|
|
61164
61412
|
|
|
61165
|
-
//#endregion
|
|
61166
|
-
//#region ../config/dist/public-BwQqexwo.mjs
|
|
61167
|
-
const DEFINITION = Symbol.for("@cloudflare/config:definition");
|
|
61168
|
-
/**
|
|
61169
|
-
* Unwrap an authored config from its value / promise / function shape, awaiting
|
|
61170
|
-
* the result. A function config is invoked with {@link ConfigContext}.
|
|
61171
|
-
*/
|
|
61172
|
-
async function unwrap(config$1, ctx) {
|
|
61173
|
-
return typeof config$1 === "function" ? await config$1(ctx) : await config$1;
|
|
61174
|
-
}
|
|
61175
|
-
/**
|
|
61176
|
-
* Resolve any `cloudflare.config.ts` export to its plain config value.
|
|
61177
|
-
*
|
|
61178
|
-
* A `define*` helper stores its authored config plus `type` under the
|
|
61179
|
-
* {@link DEFINITION} symbol; here we unwrap the config and stamp `type` back on.
|
|
61180
|
-
* Every other export — a raw object/promise/function — is unwrapped as-is and
|
|
61181
|
-
* already carries its own `type`. Discrimination happens afterwards via `type`.
|
|
61182
|
-
*/
|
|
61183
|
-
async function resolveExportDefinition(def, ctx) {
|
|
61184
|
-
if (typeof def === "object" && def !== null && DEFINITION in def) {
|
|
61185
|
-
const { config: config$1, type } = def[DEFINITION];
|
|
61186
|
-
return {
|
|
61187
|
-
...await unwrap(config$1, ctx),
|
|
61188
|
-
type
|
|
61189
|
-
};
|
|
61190
|
-
}
|
|
61191
|
-
return await unwrap(def, ctx);
|
|
61192
|
-
}
|
|
61193
|
-
|
|
61194
61413
|
//#endregion
|
|
61195
61414
|
//#region ../config/dist/index.mjs
|
|
61196
61415
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -61660,15 +61879,6 @@ const ConfigExportsTypeSchema = z$1.record(z$1.string(), z$1.unknown()).check((c
|
|
|
61660
61879
|
});
|
|
61661
61880
|
}
|
|
61662
61881
|
});
|
|
61663
|
-
const ConfigExportsObjectSchema = z$1.object({ settings: InputSettingsSchema.optional() }).catchall(InputWorkerSchema);
|
|
61664
|
-
/**
|
|
61665
|
-
* Schema for the resolved config exports, keyed by export
|
|
61666
|
-
* name. Each value is discriminated on its `type` field. Reserves the
|
|
61667
|
-
* `settings` export name exclusively for settings configs: a `settings`
|
|
61668
|
-
* config must live on the `settings` export, and the `settings` export
|
|
61669
|
-
* may only hold a `settings` config.
|
|
61670
|
-
*/
|
|
61671
|
-
const ConfigExportsSchema = ConfigExportsTypeSchema.pipe(ConfigExportsObjectSchema);
|
|
61672
61882
|
const ModuleTypeSchema = z$1.enum([
|
|
61673
61883
|
"esm",
|
|
61674
61884
|
"cjs",
|
|
@@ -61704,9 +61914,9 @@ const ManifestSchema = z$1.strictObject({
|
|
|
61704
61914
|
* base schema.
|
|
61705
61915
|
*/
|
|
61706
61916
|
const OutputWorkerSchema = BaseWorkerSchema.extend({ manifest: ManifestSchema.optional() });
|
|
61707
|
-
var import_dist = (/* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/dist/index.js": ((exports$
|
|
61708
|
-
Object.defineProperty(exports$
|
|
61709
|
-
exports$
|
|
61917
|
+
var import_dist = (/* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/dist/index.js": ((exports$1) => {
|
|
61918
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
61919
|
+
exports$1.dedent = void 0;
|
|
61710
61920
|
function dedent$1$1(templ) {
|
|
61711
61921
|
var values = [];
|
|
61712
61922
|
for (var _i = 1; _i < arguments.length; _i++) values[_i - 1] = arguments[_i];
|
|
@@ -61739,7 +61949,7 @@ var import_dist = (/* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ts-ded
|
|
|
61739
61949
|
});
|
|
61740
61950
|
return string$1;
|
|
61741
61951
|
}
|
|
61742
|
-
exports$
|
|
61952
|
+
exports$1.dedent = dedent$1$1;
|
|
61743
61953
|
}) }))();
|
|
61744
61954
|
var __defProp = Object.defineProperty;
|
|
61745
61955
|
var __name = (target, value) => __defProp(target, "name", {
|
|
@@ -62479,15 +62689,100 @@ function cleanupImportAttributes(context) {
|
|
|
62479
62689
|
context.importAttributes = attrs;
|
|
62480
62690
|
Object.freeze(context.importAttributes);
|
|
62481
62691
|
}
|
|
62692
|
+
const CROSS_WORKER_BINDING_TYPES = new Set([
|
|
62693
|
+
"durable-object",
|
|
62694
|
+
"worker",
|
|
62695
|
+
"workflow"
|
|
62696
|
+
]);
|
|
62697
|
+
function isRecord(value) {
|
|
62698
|
+
return typeof value === "object" && value !== null;
|
|
62699
|
+
}
|
|
62700
|
+
function isConfigReference(value) {
|
|
62701
|
+
return typeof value === "function" || isRecord(value);
|
|
62702
|
+
}
|
|
62703
|
+
function createDefinitionResolver(ctx) {
|
|
62704
|
+
const resolvedDefinitions = /* @__PURE__ */ new Map();
|
|
62705
|
+
return (input) => {
|
|
62706
|
+
const cached$1 = resolvedDefinitions.get(input);
|
|
62707
|
+
if (cached$1) return cached$1;
|
|
62708
|
+
const resolved = (async () => {
|
|
62709
|
+
return await (typeof input === "function" ? input(ctx) : input);
|
|
62710
|
+
})();
|
|
62711
|
+
resolvedDefinitions.set(input, resolved);
|
|
62712
|
+
return resolved;
|
|
62713
|
+
};
|
|
62714
|
+
}
|
|
62715
|
+
async function normalizeWorkerReferences(resolved, resolveDefinition) {
|
|
62716
|
+
if (!isRecord(resolved) || !isRecord(resolved.env)) return resolved;
|
|
62717
|
+
const env$2 = { ...resolved.env };
|
|
62718
|
+
for (const [bindingName, binding] of Object.entries(env$2)) {
|
|
62719
|
+
if (!isRecord(binding) || typeof binding.type !== "string" || !CROSS_WORKER_BINDING_TYPES.has(binding.type) || !isConfigReference(binding.worker)) continue;
|
|
62720
|
+
const target = await resolveDefinition(binding.worker);
|
|
62721
|
+
env$2[bindingName] = {
|
|
62722
|
+
...binding,
|
|
62723
|
+
worker: isRecord(target) ? target.name : void 0
|
|
62724
|
+
};
|
|
62725
|
+
}
|
|
62726
|
+
return {
|
|
62727
|
+
...resolved,
|
|
62728
|
+
env: env$2
|
|
62729
|
+
};
|
|
62730
|
+
}
|
|
62731
|
+
function prefixIssues(issues, prefix) {
|
|
62732
|
+
return issues.map((issue$1) => ({
|
|
62733
|
+
...issue$1,
|
|
62734
|
+
path: [prefix, ...issue$1.path]
|
|
62735
|
+
}));
|
|
62736
|
+
}
|
|
62737
|
+
/**
|
|
62738
|
+
* Resolve and validate loaded `cloudflare.config.ts` exports.
|
|
62739
|
+
*
|
|
62740
|
+
* Config inputs are resolved once by identity. Top-level Worker exports are
|
|
62741
|
+
* also parsed once by identity; unexported references are resolved only far
|
|
62742
|
+
* enough to replace the reference with the Worker's name.
|
|
62743
|
+
*/
|
|
62744
|
+
async function resolveAndValidateConfigExports(exports$2, ctx) {
|
|
62745
|
+
const resolveDefinition = createDefinitionResolver(ctx);
|
|
62746
|
+
const parsedWorkers = /* @__PURE__ */ new Map();
|
|
62747
|
+
const resolvedExports = {};
|
|
62748
|
+
for (const [name, input] of Object.entries(exports$2)) resolvedExports[name] = await resolveDefinition(input);
|
|
62749
|
+
const typeResult = ConfigExportsTypeSchema.safeParse(resolvedExports);
|
|
62750
|
+
if (!typeResult.success) return typeResult;
|
|
62751
|
+
const issues = [];
|
|
62752
|
+
const data = {};
|
|
62753
|
+
const resolvedSettings = resolvedExports.settings;
|
|
62754
|
+
const settingsResult = resolvedSettings ? InputSettingsSchema.safeParse(resolvedSettings) : void 0;
|
|
62755
|
+
if (settingsResult) if (settingsResult.success) data.settings = settingsResult.data;
|
|
62756
|
+
else issues.push(...prefixIssues(settingsResult.error.issues, "settings"));
|
|
62757
|
+
for (const [name, input] of Object.entries(exports$2)) {
|
|
62758
|
+
const resolved = resolvedExports[name];
|
|
62759
|
+
if (!isRecord(resolved)) continue;
|
|
62760
|
+
if (resolved.type === "worker") {
|
|
62761
|
+
let result = parsedWorkers.get(input);
|
|
62762
|
+
if (!result) {
|
|
62763
|
+
result = InputWorkerSchema.safeParse(await normalizeWorkerReferences(resolved, resolveDefinition));
|
|
62764
|
+
parsedWorkers.set(input, result);
|
|
62765
|
+
if (!result.success) issues.push(...prefixIssues(result.error.issues, name));
|
|
62766
|
+
}
|
|
62767
|
+
if (result.success) data[name] = result.data;
|
|
62768
|
+
continue;
|
|
62769
|
+
}
|
|
62770
|
+
}
|
|
62771
|
+
return issues.length > 0 ? {
|
|
62772
|
+
success: false,
|
|
62773
|
+
error: new z$1.ZodError(issues)
|
|
62774
|
+
} : {
|
|
62775
|
+
success: true,
|
|
62776
|
+
data
|
|
62777
|
+
};
|
|
62778
|
+
}
|
|
62482
62779
|
/**
|
|
62483
|
-
* Load a `cloudflare.config.ts`, resolve all exports, and validate
|
|
62780
|
+
* Load a `cloudflare.config.ts`, resolve all exports, and validate them.
|
|
62484
62781
|
*/
|
|
62485
62782
|
async function loadAndValidateConfig(configPath, ctx, options) {
|
|
62486
62783
|
const { exports: exports$2, dependencies } = await loadConfig(configPath, options);
|
|
62487
|
-
const resolved = {};
|
|
62488
|
-
for (const [name, value] of Object.entries(exports$2)) resolved[name] = await resolveExportDefinition(value, ctx);
|
|
62489
62784
|
return {
|
|
62490
|
-
result:
|
|
62785
|
+
result: await resolveAndValidateConfigExports(exports$2, ctx),
|
|
62491
62786
|
dependencies
|
|
62492
62787
|
};
|
|
62493
62788
|
}
|