@cloudflare/vite-plugin 1.54.5 → 1.54.6
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/experimental-config.d.mts +1309 -1383
- package/dist/experimental-config.d.mts.map +1 -1
- package/dist/experimental-config.mjs +22 -26
- package/dist/experimental-config.mjs.map +1 -1
- package/dist/index.mjs +749 -547
- package/dist/index.mjs.map +1 -1
- package/dist/{open-PBXRGS4R-HMkvHv1N.mjs → open-PBXRGS4R-DFtj97wF.mjs} +3 -3
- package/dist/{open-PBXRGS4R-HMkvHv1N.mjs.map → open-PBXRGS4R-DFtj97wF.mjs.map} +1 -1
- package/dist/{package-BUBRX7k4.mjs → package-CsWrn9PH.mjs} +2 -2
- package/dist/{package-BUBRX7k4.mjs.map → package-CsWrn9PH.mjs.map} +1 -1
- package/package.json +12 -12
package/dist/index.mjs
CHANGED
|
@@ -11,17 +11,17 @@ import path__default, { basename, dirname, isAbsolute, join, relative, resolve }
|
|
|
11
11
|
import os, { arch } from "node:os";
|
|
12
12
|
import process$1, { exit, stdin, stdout } from "node:process";
|
|
13
13
|
import tty from "node:tty";
|
|
14
|
-
import
|
|
15
|
-
import crypto$1, { createCipheriv, createDecipheriv, createHash, randomBytes, randomUUID, webcrypto } from "node:crypto";
|
|
14
|
+
import url, { URL as URL$1, URLSearchParams as URLSearchParams$1, fileURLToPath, pathToFileURL } from "node:url";
|
|
16
15
|
import net from "node:net";
|
|
17
16
|
import http from "node:http";
|
|
18
17
|
import events, { EventEmitter } from "node:events";
|
|
19
18
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
20
|
-
import
|
|
19
|
+
import crypto$1, { createCipheriv, createDecipheriv, createHash, randomBytes, randomUUID, webcrypto } from "node:crypto";
|
|
21
20
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
22
21
|
import { assert } from "node:console";
|
|
23
22
|
import * as fsp from "node:fs/promises";
|
|
24
23
|
import fs, { constants as constants$1 } from "node:fs/promises";
|
|
24
|
+
import childProcess, { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
|
|
25
25
|
import * as timersPromises from "node:timers/promises";
|
|
26
26
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
27
27
|
import { CoreHeaders, CorePaths, DeferredPromise, Log, LogLevel, Miniflare, MiniflareCoreError, Mutex, Request as Request$1, Response as Response$1, buildPublicUrl, convertV4MiniflareOptions, coupleWebSocket, getDefaultDevRegistryPath, getNodeCompat, getWorkerRegistry, kUnsafeEphemeralUniqueKey, parseModuleFallbackRequest } from "miniflare";
|
|
@@ -143,43 +143,43 @@ function hasKnownExportType(entry) {
|
|
|
143
143
|
return type === "durable-object" || type === "worker";
|
|
144
144
|
}
|
|
145
145
|
__name$5(hasKnownExportType, "hasKnownExportType");
|
|
146
|
-
function partitionExports(exports$1
|
|
146
|
+
function partitionExports(exports$1) {
|
|
147
147
|
const partitioned = {
|
|
148
148
|
"durable-object": {},
|
|
149
149
|
worker: {}
|
|
150
150
|
};
|
|
151
|
-
if (exports$1
|
|
152
|
-
for (const [name, entry] of Object.entries(exports$1
|
|
151
|
+
if (exports$1 === void 0) return partitioned;
|
|
152
|
+
for (const [name, entry] of Object.entries(exports$1)) {
|
|
153
153
|
if (!hasKnownExportType(entry)) continue;
|
|
154
154
|
partitioned[entry.type][name] = entry;
|
|
155
155
|
}
|
|
156
156
|
return partitioned;
|
|
157
157
|
}
|
|
158
158
|
__name$5(partitionExports, "partitionExports");
|
|
159
|
-
function getDurableObjectExports(exports$1
|
|
160
|
-
return partitionExports(exports$1
|
|
159
|
+
function getDurableObjectExports(exports$1) {
|
|
160
|
+
return partitionExports(exports$1)["durable-object"];
|
|
161
161
|
}
|
|
162
162
|
__name$5(getDurableObjectExports, "getDurableObjectExports");
|
|
163
|
-
function hasDurableObjectExports(exports$1
|
|
164
|
-
return Object.keys(getDurableObjectExports(exports$1
|
|
163
|
+
function hasDurableObjectExports(exports$1) {
|
|
164
|
+
return Object.keys(getDurableObjectExports(exports$1)).length > 0;
|
|
165
165
|
}
|
|
166
166
|
__name$5(hasDurableObjectExports, "hasDurableObjectExports");
|
|
167
|
-
function getContainerNameToClassNameMap(exports$1
|
|
167
|
+
function getContainerNameToClassNameMap(exports$1) {
|
|
168
168
|
const containerNameToClassName = /* @__PURE__ */ new Map();
|
|
169
|
-
for (const [className, entry] of Object.entries(getDurableObjectExports(exports$1
|
|
169
|
+
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);
|
|
170
170
|
return containerNameToClassName;
|
|
171
171
|
}
|
|
172
172
|
__name$5(getContainerNameToClassNameMap, "getContainerNameToClassNameMap");
|
|
173
|
-
function resolveContainerClassName(container, exports$1
|
|
173
|
+
function resolveContainerClassName(container, exports$1) {
|
|
174
174
|
if (container.class_name !== void 0) return container.class_name;
|
|
175
175
|
if (container.name === void 0) return;
|
|
176
|
-
return getContainerNameToClassNameMap(exports$1
|
|
176
|
+
return getContainerNameToClassNameMap(exports$1).get(container.name);
|
|
177
177
|
}
|
|
178
178
|
__name$5(resolveContainerClassName, "resolveContainerClassName");
|
|
179
|
-
function getContainerDurableObjectClassNames(containers, exports$1
|
|
179
|
+
function getContainerDurableObjectClassNames(containers, exports$1) {
|
|
180
180
|
const classNames = /* @__PURE__ */ new Set();
|
|
181
181
|
for (const container of containers ?? []) {
|
|
182
|
-
const className = resolveContainerClassName(container, exports$1
|
|
182
|
+
const className = resolveContainerClassName(container, exports$1);
|
|
183
183
|
if (className !== void 0) classNames.add(className);
|
|
184
184
|
}
|
|
185
185
|
return classNames;
|
|
@@ -2548,12 +2548,12 @@ function formatConfigSnippet(snippet, configPath, formatted = true) {
|
|
|
2548
2548
|
__name$5(formatConfigSnippet, "formatConfigSnippet");
|
|
2549
2549
|
|
|
2550
2550
|
//#endregion
|
|
2551
|
-
//#region ../workers-utils/dist/chunk-
|
|
2552
|
-
var DEFAULT_COMPAT_DATE = "2026-09-
|
|
2551
|
+
//#region ../workers-utils/dist/chunk-CDB2RWUW.mjs
|
|
2552
|
+
var DEFAULT_COMPAT_DATE = "2026-09-08";
|
|
2553
2553
|
function assertNever(_value) {}
|
|
2554
2554
|
__name$5(assertNever, "assertNever");
|
|
2555
|
-
function mapWorkerMetadataBindings(bindings
|
|
2556
|
-
return bindings
|
|
2555
|
+
function mapWorkerMetadataBindings(bindings) {
|
|
2556
|
+
return bindings.filter((binding) => binding.type !== "secret_text").reduce((configObj, binding) => {
|
|
2557
2557
|
switch (binding.type) {
|
|
2558
2558
|
case "plain_text":
|
|
2559
2559
|
configObj.vars = {
|
|
@@ -9766,8 +9766,8 @@ var require_client_h1 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
|
|
|
9766
9766
|
* @param {import('net').Socket} socket
|
|
9767
9767
|
* @param {*} llhttp
|
|
9768
9768
|
*/
|
|
9769
|
-
constructor(client, socket, { exports: exports$
|
|
9770
|
-
this.llhttp = exports$
|
|
9769
|
+
constructor(client, socket, { exports: exports$1 }) {
|
|
9770
|
+
this.llhttp = exports$1;
|
|
9771
9771
|
this.ptr = this.llhttp.llhttp_alloc(constants$6.TYPE.RESPONSE);
|
|
9772
9772
|
this.client = client;
|
|
9773
9773
|
/**
|
|
@@ -25884,7 +25884,7 @@ var require_undici = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
|
|
|
25884
25884
|
//#endregion
|
|
25885
25885
|
//#region ../workers-utils/dist/index.mjs
|
|
25886
25886
|
var import_undici$3 = require_undici();
|
|
25887
|
-
var require_vendors$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json"(exports$1
|
|
25887
|
+
var require_vendors$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json"(exports$1, module$1) {
|
|
25888
25888
|
module$1.exports = [
|
|
25889
25889
|
{
|
|
25890
25890
|
name: "Agola CI",
|
|
@@ -26210,26 +26210,26 @@ var require_vendors$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/n
|
|
|
26210
26210
|
}
|
|
26211
26211
|
];
|
|
26212
26212
|
} });
|
|
26213
|
-
var require_ci_info$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/index.js"(exports$1
|
|
26213
|
+
var require_ci_info$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/index.js"(exports$1) {
|
|
26214
26214
|
var vendors$1 = require_vendors$1();
|
|
26215
26215
|
var env$3 = process.env;
|
|
26216
|
-
Object.defineProperty(exports$1
|
|
26216
|
+
Object.defineProperty(exports$1, "_vendors", { value: vendors$1.map(function(v) {
|
|
26217
26217
|
return v.constant;
|
|
26218
26218
|
}) });
|
|
26219
|
-
exports$1
|
|
26220
|
-
exports$1
|
|
26221
|
-
exports$1
|
|
26219
|
+
exports$1.name = null;
|
|
26220
|
+
exports$1.isPR = null;
|
|
26221
|
+
exports$1.id = null;
|
|
26222
26222
|
if (env$3.CI !== "false") vendors$1.forEach(function(vendor) {
|
|
26223
26223
|
const isCI2 = (Array.isArray(vendor.env) ? vendor.env : [vendor.env]).every(function(obj) {
|
|
26224
26224
|
return checkEnv$1(obj);
|
|
26225
26225
|
});
|
|
26226
|
-
exports$1
|
|
26226
|
+
exports$1[vendor.constant] = isCI2;
|
|
26227
26227
|
if (!isCI2) return;
|
|
26228
|
-
exports$1
|
|
26229
|
-
exports$1
|
|
26230
|
-
exports$1
|
|
26228
|
+
exports$1.name = vendor.name;
|
|
26229
|
+
exports$1.isPR = checkPR$1(vendor);
|
|
26230
|
+
exports$1.id = vendor.constant;
|
|
26231
26231
|
});
|
|
26232
|
-
exports$1
|
|
26232
|
+
exports$1.isCI = !!(env$3.CI !== "false" && (env$3.BUILD_ID || env$3.BUILD_NUMBER || env$3.CI || env$3.CI_APP_ID || env$3.CI_BUILD_ID || env$3.CI_BUILD_NUMBER || env$3.CI_NAME || env$3.CONTINUOUS_INTEGRATION || env$3.RUN_ID || exports$1.name || false));
|
|
26233
26233
|
function checkEnv$1(obj) {
|
|
26234
26234
|
if (typeof obj === "string") return !!env$3[obj];
|
|
26235
26235
|
if ("env" in obj) return env$3[obj.env] && env$3[obj.env].includes(obj.includes);
|
|
@@ -26257,7 +26257,7 @@ var require_ci_info$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/n
|
|
|
26257
26257
|
}
|
|
26258
26258
|
__name$5(checkPR$1, "checkPR");
|
|
26259
26259
|
} });
|
|
26260
|
-
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
|
|
26260
|
+
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) {
|
|
26261
26261
|
var exec$3 = __require$1("child_process").exec;
|
|
26262
26262
|
var execSync$2 = __require$1("child_process").execSync;
|
|
26263
26263
|
var fs3 = __require$1("fs");
|
|
@@ -26361,14 +26361,14 @@ var require_command_exists$2 = __commonJS$1({ "../../node_modules/.pnpm/command-
|
|
|
26361
26361
|
else return commandExistsUnixSync$1(commandName, cleanedCommandName);
|
|
26362
26362
|
};
|
|
26363
26363
|
} });
|
|
26364
|
-
var require_command_exists2 = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/index.js"(exports$1
|
|
26364
|
+
var require_command_exists2 = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/index.js"(exports$1, module$1) {
|
|
26365
26365
|
module$1.exports = require_command_exists$2();
|
|
26366
26366
|
} });
|
|
26367
|
-
var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports$1
|
|
26368
|
-
exports$1
|
|
26369
|
-
exports$1
|
|
26370
|
-
exports$1
|
|
26371
|
-
exports$1
|
|
26367
|
+
var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports$1) {
|
|
26368
|
+
exports$1.parse = exports$1.decode = decode3;
|
|
26369
|
+
exports$1.stringify = exports$1.encode = encode3;
|
|
26370
|
+
exports$1.safe = safe;
|
|
26371
|
+
exports$1.unsafe = unsafe;
|
|
26372
26372
|
var eol = typeof process !== "undefined" && process.platform === "win32" ? "\r\n" : "\n";
|
|
26373
26373
|
function encode3(obj, opt) {
|
|
26374
26374
|
var children = [];
|
|
@@ -26500,7 +26500,7 @@ var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_module
|
|
|
26500
26500
|
}
|
|
26501
26501
|
__name$5(unsafe, "unsafe");
|
|
26502
26502
|
} });
|
|
26503
|
-
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
|
|
26503
|
+
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) {
|
|
26504
26504
|
var singleComment = 1;
|
|
26505
26505
|
var multiComment = 2;
|
|
26506
26506
|
function stripWithoutWhitespace() {
|
|
@@ -26559,16 +26559,16 @@ var require_strip_json_comments = __commonJS$1({ "../../node_modules/.pnpm/strip
|
|
|
26559
26559
|
return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset));
|
|
26560
26560
|
};
|
|
26561
26561
|
} });
|
|
26562
|
-
var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports$1
|
|
26562
|
+
var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports$1) {
|
|
26563
26563
|
var fs3 = __require$1("fs");
|
|
26564
26564
|
var ini = require_ini();
|
|
26565
26565
|
var path5 = __require$1("path");
|
|
26566
26566
|
var stripJsonComments = require_strip_json_comments();
|
|
26567
|
-
var parse3$1 = exports$1
|
|
26567
|
+
var parse3$1 = exports$1.parse = function(content) {
|
|
26568
26568
|
if (/^\s*{/.test(content)) return JSON.parse(stripJsonComments(content));
|
|
26569
26569
|
return ini.parse(content);
|
|
26570
26570
|
};
|
|
26571
|
-
var file2 = exports$1
|
|
26571
|
+
var file2 = exports$1.file = function() {
|
|
26572
26572
|
var args = [].slice.call(arguments).filter(function(arg) {
|
|
26573
26573
|
return arg != null;
|
|
26574
26574
|
});
|
|
@@ -26580,11 +26580,11 @@ var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_mod
|
|
|
26580
26580
|
return;
|
|
26581
26581
|
}
|
|
26582
26582
|
};
|
|
26583
|
-
exports$1
|
|
26583
|
+
exports$1.json = function() {
|
|
26584
26584
|
var content = file2.apply(null, arguments);
|
|
26585
26585
|
return content ? parse3$1(content) : null;
|
|
26586
26586
|
};
|
|
26587
|
-
exports$1
|
|
26587
|
+
exports$1.env = function(prefix, env2) {
|
|
26588
26588
|
env2 = env2 || process.env;
|
|
26589
26589
|
var obj = {};
|
|
26590
26590
|
var l = prefix.length;
|
|
@@ -26602,7 +26602,7 @@ var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_mod
|
|
|
26602
26602
|
}
|
|
26603
26603
|
return obj;
|
|
26604
26604
|
};
|
|
26605
|
-
exports$1
|
|
26605
|
+
exports$1.find = function() {
|
|
26606
26606
|
var rel = path5.join.apply(null, [].slice.call(arguments));
|
|
26607
26607
|
function find2(start, rel2) {
|
|
26608
26608
|
var file3 = path5.join(start, rel2);
|
|
@@ -26617,7 +26617,7 @@ var require_utils$1 = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_mod
|
|
|
26617
26617
|
return find2(process.cwd(), rel);
|
|
26618
26618
|
};
|
|
26619
26619
|
} });
|
|
26620
|
-
var require_deep_extend = __commonJS$1({ "../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js"(exports$1
|
|
26620
|
+
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) {
|
|
26621
26621
|
function isSpecificValue(val) {
|
|
26622
26622
|
return val instanceof Buffer || val instanceof Date || val instanceof RegExp ? true : false;
|
|
26623
26623
|
}
|
|
@@ -26680,7 +26680,7 @@ var require_deep_extend = __commonJS$1({ "../../node_modules/.pnpm/deep-extend@0
|
|
|
26680
26680
|
return target$1;
|
|
26681
26681
|
};
|
|
26682
26682
|
} });
|
|
26683
|
-
var require_minimist = __commonJS$1({ "../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports$1
|
|
26683
|
+
var require_minimist = __commonJS$1({ "../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports$1, module$1) {
|
|
26684
26684
|
module$1.exports = function(args, opts) {
|
|
26685
26685
|
if (!opts) opts = {};
|
|
26686
26686
|
var flags = {
|
|
@@ -26855,7 +26855,7 @@ var require_minimist = __commonJS$1({ "../../node_modules/.pnpm/minimist@1.2.6/n
|
|
|
26855
26855
|
}
|
|
26856
26856
|
__name$5(isConstructorOrProto, "isConstructorOrProto");
|
|
26857
26857
|
} });
|
|
26858
|
-
var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports$1
|
|
26858
|
+
var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports$1, module$1) {
|
|
26859
26859
|
var cc = require_utils$1();
|
|
26860
26860
|
var join3 = __require$1("path").join;
|
|
26861
26861
|
var deepExtend = require_deep_extend();
|
|
@@ -26899,14 +26899,14 @@ var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/
|
|
|
26899
26899
|
]));
|
|
26900
26900
|
};
|
|
26901
26901
|
} });
|
|
26902
|
-
var require_registry_url = __commonJS$1({ "../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js"(exports$1
|
|
26902
|
+
var require_registry_url = __commonJS$1({ "../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js"(exports$1, module$1) {
|
|
26903
26903
|
module$1.exports = function(scope) {
|
|
26904
26904
|
var rc = require_rc()("npm", { registry: "https://registry.npmjs.org/" });
|
|
26905
26905
|
var url2 = rc[scope + ":registry"] || rc.registry;
|
|
26906
26906
|
return url2.slice(-1) === "/" ? url2 : url2 + "/";
|
|
26907
26907
|
};
|
|
26908
26908
|
} });
|
|
26909
|
-
var require_safe_buffer = __commonJS$1({ "../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(exports$1
|
|
26909
|
+
var require_safe_buffer = __commonJS$1({ "../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(exports$1, module$1) {
|
|
26910
26910
|
var buffer$1 = __require$1("buffer");
|
|
26911
26911
|
var Buffer2 = buffer$1.Buffer;
|
|
26912
26912
|
function copyProps(src$1, dst) {
|
|
@@ -26915,8 +26915,8 @@ var require_safe_buffer = __commonJS$1({ "../../node_modules/.pnpm/safe-buffer@5
|
|
|
26915
26915
|
__name$5(copyProps, "copyProps");
|
|
26916
26916
|
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) module$1.exports = buffer$1;
|
|
26917
26917
|
else {
|
|
26918
|
-
copyProps(buffer$1, exports$1
|
|
26919
|
-
exports$1
|
|
26918
|
+
copyProps(buffer$1, exports$1);
|
|
26919
|
+
exports$1.Buffer = SafeBuffer;
|
|
26920
26920
|
}
|
|
26921
26921
|
function SafeBuffer(arg, encodingOrOffset, length) {
|
|
26922
26922
|
return Buffer2(arg, encodingOrOffset, length);
|
|
@@ -26945,7 +26945,7 @@ var require_safe_buffer = __commonJS$1({ "../../node_modules/.pnpm/safe-buffer@5
|
|
|
26945
26945
|
return buffer$1.SlowBuffer(size);
|
|
26946
26946
|
};
|
|
26947
26947
|
} });
|
|
26948
|
-
var require_base64 = __commonJS$1({ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/base64.js"(exports$1
|
|
26948
|
+
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) {
|
|
26949
26949
|
var safeBuffer = require_safe_buffer().Buffer;
|
|
26950
26950
|
function decodeBase64(base643) {
|
|
26951
26951
|
return safeBuffer.from(base643, "base64").toString("utf8");
|
|
@@ -26960,7 +26960,7 @@ var require_base64 = __commonJS$1({ "../../node_modules/.pnpm/registry-auth-toke
|
|
|
26960
26960
|
encodeBase64
|
|
26961
26961
|
};
|
|
26962
26962
|
} });
|
|
26963
|
-
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
|
|
26963
|
+
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) {
|
|
26964
26964
|
var url2 = __require$1("url");
|
|
26965
26965
|
var base643 = require_base64();
|
|
26966
26966
|
var decodeBase64 = base643.decodeBase64;
|
|
@@ -27035,7 +27035,7 @@ var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/regis
|
|
|
27035
27035
|
}
|
|
27036
27036
|
__name$5(getTokenForUsernameAndPassword, "getTokenForUsernameAndPassword");
|
|
27037
27037
|
} });
|
|
27038
|
-
var require_update_check = __commonJS$1({ "../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports$1
|
|
27038
|
+
var require_update_check = __commonJS$1({ "../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports$1, module$1) {
|
|
27039
27039
|
var { URL: URL2 } = __require$1("url");
|
|
27040
27040
|
var { join: join3 } = __require$1("path");
|
|
27041
27041
|
var fs3 = __require$1("fs");
|
|
@@ -27314,7 +27314,7 @@ __export(external_exports$1, {
|
|
|
27314
27314
|
ZodEmail: () => ZodEmail$1,
|
|
27315
27315
|
ZodEmoji: () => ZodEmoji$1,
|
|
27316
27316
|
ZodEnum: () => ZodEnum$1,
|
|
27317
|
-
ZodError: () => ZodError,
|
|
27317
|
+
ZodError: () => ZodError$1,
|
|
27318
27318
|
ZodExactOptional: () => ZodExactOptional$1,
|
|
27319
27319
|
ZodFile: () => ZodFile,
|
|
27320
27320
|
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
@@ -27928,7 +27928,7 @@ __export(util_exports$1, {
|
|
|
27928
27928
|
parsedType: () => parsedType,
|
|
27929
27929
|
partial: () => partial$1,
|
|
27930
27930
|
pick: () => pick$1,
|
|
27931
|
-
prefixIssues: () => prefixIssues$
|
|
27931
|
+
prefixIssues: () => prefixIssues$2,
|
|
27932
27932
|
primitiveTypes: () => primitiveTypes$1,
|
|
27933
27933
|
promiseAllObject: () => promiseAllObject,
|
|
27934
27934
|
propertyKeyTypes: () => propertyKeyTypes$1,
|
|
@@ -28378,7 +28378,7 @@ function explicitlyAborted$1(x, startIndex = 0) {
|
|
|
28378
28378
|
return false;
|
|
28379
28379
|
}
|
|
28380
28380
|
__name$5(explicitlyAborted$1, "explicitlyAborted");
|
|
28381
|
-
function prefixIssues$
|
|
28381
|
+
function prefixIssues$2(path5, issues) {
|
|
28382
28382
|
return issues.map((iss) => {
|
|
28383
28383
|
var _a3;
|
|
28384
28384
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
@@ -28386,7 +28386,7 @@ function prefixIssues$1(path5, issues) {
|
|
|
28386
28386
|
return iss;
|
|
28387
28387
|
});
|
|
28388
28388
|
}
|
|
28389
|
-
__name$5(prefixIssues$
|
|
28389
|
+
__name$5(prefixIssues$2, "prefixIssues");
|
|
28390
28390
|
function unwrapMessage$1(message) {
|
|
28391
28391
|
return typeof message === "string" ? message : message?.message;
|
|
28392
28392
|
}
|
|
@@ -29351,7 +29351,7 @@ var $ZodCheckEndsWith$1 = /* @__PURE__ */ $constructor$1("$ZodCheckEndsWith", (i
|
|
|
29351
29351
|
};
|
|
29352
29352
|
});
|
|
29353
29353
|
function handleCheckPropertyResult(result, payload, property) {
|
|
29354
|
-
if (result.issues.length) payload.issues.push(...prefixIssues$
|
|
29354
|
+
if (result.issues.length) payload.issues.push(...prefixIssues$2(property, result.issues));
|
|
29355
29355
|
}
|
|
29356
29356
|
__name$5(handleCheckPropertyResult, "handleCheckPropertyResult");
|
|
29357
29357
|
var $ZodCheckProperty = /* @__PURE__ */ $constructor$1("$ZodCheckProperty", (inst, def) => {
|
|
@@ -29974,7 +29974,7 @@ var $ZodDate = /* @__PURE__ */ $constructor$1("$ZodDate", (inst, def) => {
|
|
|
29974
29974
|
};
|
|
29975
29975
|
});
|
|
29976
29976
|
function handleArrayResult$1(result, final, index) {
|
|
29977
|
-
if (result.issues.length) final.issues.push(...prefixIssues$
|
|
29977
|
+
if (result.issues.length) final.issues.push(...prefixIssues$2(index, result.issues));
|
|
29978
29978
|
final.value[index] = result.value;
|
|
29979
29979
|
}
|
|
29980
29980
|
__name$5(handleArrayResult$1, "handleArrayResult");
|
|
@@ -30010,7 +30010,7 @@ function handlePropertyResult$1(result, final, key, input, isOptionalIn, isOptio
|
|
|
30010
30010
|
const isPresent = key in input;
|
|
30011
30011
|
if (result.issues.length) {
|
|
30012
30012
|
if (isOptionalIn && isOptionalOut && !isPresent) return;
|
|
30013
|
-
final.issues.push(...prefixIssues$
|
|
30013
|
+
final.issues.push(...prefixIssues$2(key, result.issues));
|
|
30014
30014
|
}
|
|
30015
30015
|
if (!isPresent && !isOptionalIn) {
|
|
30016
30016
|
if (!result.issues.length) final.issues.push({
|
|
@@ -30582,7 +30582,7 @@ function getTupleOptStart(items, key) {
|
|
|
30582
30582
|
}
|
|
30583
30583
|
__name$5(getTupleOptStart, "getTupleOptStart");
|
|
30584
30584
|
function handleTupleResult(result, final, index) {
|
|
30585
|
-
if (result.issues.length) final.issues.push(...prefixIssues$
|
|
30585
|
+
if (result.issues.length) final.issues.push(...prefixIssues$2(index, result.issues));
|
|
30586
30586
|
final.value[index] = result.value;
|
|
30587
30587
|
}
|
|
30588
30588
|
__name$5(handleTupleResult, "handleTupleResult");
|
|
@@ -30595,7 +30595,7 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
30595
30595
|
final.value.length = i$1;
|
|
30596
30596
|
break;
|
|
30597
30597
|
}
|
|
30598
|
-
final.issues.push(...prefixIssues$
|
|
30598
|
+
final.issues.push(...prefixIssues$2(i$1, r2.issues));
|
|
30599
30599
|
}
|
|
30600
30600
|
final.value[i$1] = r2.value;
|
|
30601
30601
|
}
|
|
@@ -30646,11 +30646,11 @@ var $ZodRecord$1 = /* @__PURE__ */ $constructor$1("$ZodRecord", (inst, def) => {
|
|
|
30646
30646
|
issues: []
|
|
30647
30647
|
}, ctx);
|
|
30648
30648
|
if (result instanceof Promise) proms.push(result.then((result2) => {
|
|
30649
|
-
if (result2.issues.length) payload.issues.push(...prefixIssues$
|
|
30649
|
+
if (result2.issues.length) payload.issues.push(...prefixIssues$2(key, result2.issues));
|
|
30650
30650
|
payload.value[outKey] = result2.value;
|
|
30651
30651
|
}));
|
|
30652
30652
|
else {
|
|
30653
|
-
if (result.issues.length) payload.issues.push(...prefixIssues$
|
|
30653
|
+
if (result.issues.length) payload.issues.push(...prefixIssues$2(key, result.issues));
|
|
30654
30654
|
payload.value[outKey] = result.value;
|
|
30655
30655
|
}
|
|
30656
30656
|
}
|
|
@@ -30700,11 +30700,11 @@ var $ZodRecord$1 = /* @__PURE__ */ $constructor$1("$ZodRecord", (inst, def) => {
|
|
|
30700
30700
|
issues: []
|
|
30701
30701
|
}, ctx);
|
|
30702
30702
|
if (result instanceof Promise) proms.push(result.then((result2) => {
|
|
30703
|
-
if (result2.issues.length) payload.issues.push(...prefixIssues$
|
|
30703
|
+
if (result2.issues.length) payload.issues.push(...prefixIssues$2(key, result2.issues));
|
|
30704
30704
|
payload.value[keyResult.value] = result2.value;
|
|
30705
30705
|
}));
|
|
30706
30706
|
else {
|
|
30707
|
-
if (result.issues.length) payload.issues.push(...prefixIssues$
|
|
30707
|
+
if (result.issues.length) payload.issues.push(...prefixIssues$2(key, result.issues));
|
|
30708
30708
|
payload.value[keyResult.value] = result.value;
|
|
30709
30709
|
}
|
|
30710
30710
|
}
|
|
@@ -30747,7 +30747,7 @@ var $ZodMap = /* @__PURE__ */ $constructor$1("$ZodMap", (inst, def) => {
|
|
|
30747
30747
|
};
|
|
30748
30748
|
});
|
|
30749
30749
|
function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
30750
|
-
if (keyResult.issues.length) if (propertyKeyTypes$1.has(typeof key)) final.issues.push(...prefixIssues$
|
|
30750
|
+
if (keyResult.issues.length) if (propertyKeyTypes$1.has(typeof key)) final.issues.push(...prefixIssues$2(key, keyResult.issues));
|
|
30751
30751
|
else final.issues.push({
|
|
30752
30752
|
code: "invalid_key",
|
|
30753
30753
|
origin: "map",
|
|
@@ -30755,7 +30755,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
30755
30755
|
inst,
|
|
30756
30756
|
issues: keyResult.issues.map((iss) => finalizeIssue$1(iss, ctx, config$1()))
|
|
30757
30757
|
});
|
|
30758
|
-
if (valueResult.issues.length) if (propertyKeyTypes$1.has(typeof key)) final.issues.push(...prefixIssues$
|
|
30758
|
+
if (valueResult.issues.length) if (propertyKeyTypes$1.has(typeof key)) final.issues.push(...prefixIssues$2(key, valueResult.issues));
|
|
30759
30759
|
else final.issues.push({
|
|
30760
30760
|
origin: "map",
|
|
30761
30761
|
code: "invalid_element",
|
|
@@ -39237,7 +39237,7 @@ var initializer2 = /* @__PURE__ */ __name$5((inst, issues) => {
|
|
|
39237
39237
|
} }
|
|
39238
39238
|
});
|
|
39239
39239
|
}, "initializer");
|
|
39240
|
-
var ZodError = /* @__PURE__ */ $constructor$1("ZodError", initializer2);
|
|
39240
|
+
var ZodError$1 = /* @__PURE__ */ $constructor$1("ZodError", initializer2);
|
|
39241
39241
|
var ZodRealError$1 = /* @__PURE__ */ $constructor$1("ZodError", initializer2, { Parent: Error });
|
|
39242
39242
|
var parse2 = /* @__PURE__ */ _parse$1(ZodRealError$1);
|
|
39243
39243
|
var parseAsync2 = /* @__PURE__ */ _parseAsync$1(ZodRealError$1);
|
|
@@ -41247,14 +41247,14 @@ var getBindingNames = /* @__PURE__ */ __name$5((value) => {
|
|
|
41247
41247
|
if (typeof value !== "object" || value === null) return [];
|
|
41248
41248
|
if (isBindingList(value)) return value.bindings.map(({ name }) => name);
|
|
41249
41249
|
else if (isNamespaceList(value)) return value.map(({ binding }) => binding);
|
|
41250
|
-
else if (isRecord(value)) {
|
|
41250
|
+
else if (isRecord$1(value)) {
|
|
41251
41251
|
if (value["binding"] !== void 0) return [value["binding"]];
|
|
41252
41252
|
return Object.keys(value).filter((k) => value[k] !== void 0);
|
|
41253
41253
|
} else return [];
|
|
41254
41254
|
}, "getBindingNames");
|
|
41255
|
-
var isBindingList = /* @__PURE__ */ __name$5((value) => isRecord(value) && "bindings" in value && Array.isArray(value.bindings) && value.bindings.every((binding) => isRecord(binding) && "name" in binding && typeof binding.name === "string"), "isBindingList");
|
|
41256
|
-
var isNamespaceList = /* @__PURE__ */ __name$5((value) => Array.isArray(value) && value.every((entry) => isRecord(entry) && "binding" in entry && typeof entry.binding === "string"), "isNamespaceList");
|
|
41257
|
-
var isRecord = /* @__PURE__ */ __name$5((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRecord");
|
|
41255
|
+
var isBindingList = /* @__PURE__ */ __name$5((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");
|
|
41256
|
+
var isNamespaceList = /* @__PURE__ */ __name$5((value) => Array.isArray(value) && value.every((entry) => isRecord$1(entry) && "binding" in entry && typeof entry.binding === "string"), "isNamespaceList");
|
|
41257
|
+
var isRecord$1 = /* @__PURE__ */ __name$5((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRecord");
|
|
41258
41258
|
var validateUniqueNameProperty = /* @__PURE__ */ __name$5((diagnostics, field, value) => {
|
|
41259
41259
|
if (Array.isArray(value)) {
|
|
41260
41260
|
const nameCount = /* @__PURE__ */ new Map();
|
|
@@ -42556,6 +42556,7 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
|
|
|
42556
42556
|
if (rolloutStepsCount > containerAppOptional.max_instances) diagnostics.errors.push(`"containers.rollout_step_percentage" cannot have more steps (${rolloutStepsCount}) than "max_instances" (${containerAppOptional.max_instances})`);
|
|
42557
42557
|
}
|
|
42558
42558
|
validateOptionalProperty(diagnostics, field, "image_vars", containerAppOptional.image_vars, "object");
|
|
42559
|
+
validateContainerObservability(diagnostics, `${field}.observability`, containerAppOptional.observability, config2);
|
|
42559
42560
|
validateOptionalProperty(diagnostics, field, "scheduling_policy", containerAppOptional.scheduling_policy, "string", [
|
|
42560
42561
|
"regional",
|
|
42561
42562
|
"moon",
|
|
@@ -42574,6 +42575,7 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
|
|
|
42574
42575
|
"image",
|
|
42575
42576
|
"image_build_context",
|
|
42576
42577
|
"image_vars",
|
|
42578
|
+
"observability",
|
|
42577
42579
|
"class_name",
|
|
42578
42580
|
"scheduling_policy",
|
|
42579
42581
|
"instance_type",
|
|
@@ -43811,6 +43813,77 @@ var validateExports = /* @__PURE__ */ __name$5((diagnostics, field, value) => {
|
|
|
43811
43813
|
}
|
|
43812
43814
|
return valid$2;
|
|
43813
43815
|
}, "validateExports");
|
|
43816
|
+
var CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MIN = 1;
|
|
43817
|
+
var CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MAX = 99;
|
|
43818
|
+
var CONTAINER_OBSERVABILITY_TARGET_INSTANCE_COUNT_MIN = 1;
|
|
43819
|
+
function isContainerObservabilityEnabled(observability) {
|
|
43820
|
+
return observability?.logs?.enabled === true || observability?.enabled === true;
|
|
43821
|
+
}
|
|
43822
|
+
__name$5(isContainerObservabilityEnabled, "isContainerObservabilityEnabled");
|
|
43823
|
+
function hasConflictingContainerObservabilityEnabledValues(observability) {
|
|
43824
|
+
return typeof observability.enabled === "boolean" && typeof observability.logs?.enabled === "boolean" && observability.enabled !== observability.logs.enabled;
|
|
43825
|
+
}
|
|
43826
|
+
__name$5(hasConflictingContainerObservabilityEnabledValues, "hasConflictingContainerObservabilityEnabledValues");
|
|
43827
|
+
var validateContainerObservability = /* @__PURE__ */ __name$5((diagnostics, field, value) => {
|
|
43828
|
+
if (value === void 0) return true;
|
|
43829
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
43830
|
+
diagnostics.errors.push(`"${field}" should be an object but got ${JSON.stringify(value)}.`);
|
|
43831
|
+
return false;
|
|
43832
|
+
}
|
|
43833
|
+
const val = value;
|
|
43834
|
+
let isValid = true;
|
|
43835
|
+
isValid = validateOptionalProperty(diagnostics, field, "enabled", val.enabled, "boolean") && isValid;
|
|
43836
|
+
if (val.logs !== void 0) if (typeof val.logs !== "object" || val.logs === null || Array.isArray(val.logs)) {
|
|
43837
|
+
diagnostics.errors.push(`Expected "${field}.logs" to be of type object but got ${JSON.stringify(val.logs)}.`);
|
|
43838
|
+
isValid = false;
|
|
43839
|
+
} else {
|
|
43840
|
+
isValid = validateOptionalProperty(diagnostics, field, "logs.enabled", val.logs.enabled, "boolean") && isValid;
|
|
43841
|
+
isValid = validateAdditionalProperties(diagnostics, `${field}.logs`, Object.keys(val.logs), ["enabled"]) && isValid;
|
|
43842
|
+
}
|
|
43843
|
+
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, [{
|
|
43844
|
+
key: "enabled",
|
|
43845
|
+
value: val.enabled,
|
|
43846
|
+
type: "boolean"
|
|
43847
|
+
}, {
|
|
43848
|
+
key: "logs.enabled",
|
|
43849
|
+
value: val.logs?.enabled,
|
|
43850
|
+
type: "boolean"
|
|
43851
|
+
}]) && isValid;
|
|
43852
|
+
isValid = validateOptionalProperty(diagnostics, field, "target_instance_percentage", val.target_instance_percentage, "number") && isValid;
|
|
43853
|
+
isValid = validateOptionalProperty(diagnostics, field, "target_instance_count", val.target_instance_count, "number") && isValid;
|
|
43854
|
+
isValid = validateAdditionalProperties(diagnostics, field, Object.keys(val), [
|
|
43855
|
+
"enabled",
|
|
43856
|
+
"logs",
|
|
43857
|
+
"target_instance_percentage",
|
|
43858
|
+
"target_instance_count"
|
|
43859
|
+
]) && isValid;
|
|
43860
|
+
if (hasConflictingContainerObservabilityEnabledValues(val)) {
|
|
43861
|
+
diagnostics.errors.push(`"${field}.enabled" and "${field}.logs.enabled" cannot be set to different values.`);
|
|
43862
|
+
isValid = false;
|
|
43863
|
+
}
|
|
43864
|
+
if (val.target_instance_percentage !== void 0 && val.target_instance_count !== void 0) {
|
|
43865
|
+
diagnostics.errors.push(`"${field}.target_instance_percentage" and "${field}.target_instance_count" cannot both be set.`);
|
|
43866
|
+
isValid = false;
|
|
43867
|
+
}
|
|
43868
|
+
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)) {
|
|
43869
|
+
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.`);
|
|
43870
|
+
isValid = false;
|
|
43871
|
+
}
|
|
43872
|
+
if (typeof val.target_instance_count === "number" && (!Number.isInteger(val.target_instance_count) || val.target_instance_count < CONTAINER_OBSERVABILITY_TARGET_INSTANCE_COUNT_MIN)) {
|
|
43873
|
+
diagnostics.errors.push(`"${field}.target_instance_count" must be a positive integer.`);
|
|
43874
|
+
isValid = false;
|
|
43875
|
+
}
|
|
43876
|
+
const observabilityEnabled = isContainerObservabilityEnabled(val);
|
|
43877
|
+
if (val.target_instance_percentage !== void 0 && !observabilityEnabled) {
|
|
43878
|
+
diagnostics.errors.push(`"${field}.target_instance_percentage" requires "${field}.enabled" or "${field}.logs.enabled" to be true because container observability overrides root observability.`);
|
|
43879
|
+
isValid = false;
|
|
43880
|
+
}
|
|
43881
|
+
if (val.target_instance_count !== void 0 && !observabilityEnabled) {
|
|
43882
|
+
diagnostics.errors.push(`"${field}.target_instance_count" requires "${field}.enabled" or "${field}.logs.enabled" to be true because container observability overrides root observability.`);
|
|
43883
|
+
isValid = false;
|
|
43884
|
+
}
|
|
43885
|
+
return isValid;
|
|
43886
|
+
}, "validateContainerObservability");
|
|
43814
43887
|
var validateObservability = /* @__PURE__ */ __name$5((diagnostics, field, value) => {
|
|
43815
43888
|
if (value === void 0) return true;
|
|
43816
43889
|
if (typeof value !== "object" || value === null) {
|
|
@@ -43912,11 +43985,11 @@ var validateCache = /* @__PURE__ */ __name$5((diagnostics, field, value) => {
|
|
|
43912
43985
|
isValid = validateAdditionalProperties(diagnostics, field, Object.keys(val), ["enabled", "cross_version_cache"]) && isValid;
|
|
43913
43986
|
return isValid;
|
|
43914
43987
|
}, "validateCache");
|
|
43915
|
-
function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects, migrations, exports$1
|
|
43988
|
+
function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects, migrations, exports$1, configPath) {
|
|
43916
43989
|
if (!Array.isArray(durableObjects.bindings) || durableObjects.bindings.length === 0) return;
|
|
43917
43990
|
const exportedDurableObjects = durableObjects.bindings.filter((binding) => !binding.script_name);
|
|
43918
43991
|
const exportsCovers = /* @__PURE__ */ __name$5((className) => {
|
|
43919
|
-
const entry = exports$1
|
|
43992
|
+
const entry = exports$1?.[className];
|
|
43920
43993
|
if (entry === void 0 || entry.type !== "durable-object") return false;
|
|
43921
43994
|
const state = entry.state ?? "created";
|
|
43922
43995
|
return state === "created" || state === "expecting-transfer";
|
|
@@ -43938,11 +44011,11 @@ function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects,
|
|
|
43938
44011
|
\`\`\``);
|
|
43939
44012
|
}
|
|
43940
44013
|
__name$5(warnIfDurableObjectsHaveNoLifecycleConfig, "warnIfDurableObjectsHaveNoLifecycleConfig");
|
|
43941
|
-
function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$1
|
|
43942
|
-
if (migrations.length > 0 && exports$1
|
|
44014
|
+
function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$1) {
|
|
44015
|
+
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.`);
|
|
43943
44016
|
}
|
|
43944
44017
|
__name$5(errorIfMigrationsAndExportsBothSet, "errorIfMigrationsAndExportsBothSet");
|
|
43945
|
-
function validateContainerExportLinks(diagnostics, containers, exports$1
|
|
44018
|
+
function validateContainerExportLinks(diagnostics, containers, exports$1, containersDeclaredElsewhere) {
|
|
43946
44019
|
if (containers !== void 0 && !Array.isArray(containers)) return;
|
|
43947
44020
|
if (containers === void 0 && containersDeclaredElsewhere) return;
|
|
43948
44021
|
const containersByName = /* @__PURE__ */ new Map();
|
|
@@ -43960,7 +44033,7 @@ function validateContainerExportLinks(diagnostics, containers, exports$1$1, cont
|
|
|
43960
44033
|
}
|
|
43961
44034
|
const overSubscribedClassNames = new Set([...containerCountByClassName].filter(([, count]) => count > 1).map(([className]) => className));
|
|
43962
44035
|
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.`);
|
|
43963
|
-
const durableObjectExports = getDurableObjectExports(exports$1
|
|
44036
|
+
const durableObjectExports = getDurableObjectExports(exports$1);
|
|
43964
44037
|
const liveExportClassNames = /* @__PURE__ */ new Set();
|
|
43965
44038
|
const classNamesByContainerName = /* @__PURE__ */ new Map();
|
|
43966
44039
|
for (const [className, entry] of Object.entries(durableObjectExports)) {
|
|
@@ -43974,7 +44047,7 @@ function validateContainerExportLinks(diagnostics, containers, exports$1$1, cont
|
|
|
43974
44047
|
classNamesByContainerName.set(entry.container, [...classNamesByContainerName.get(entry.container) ?? [], className]);
|
|
43975
44048
|
}
|
|
43976
44049
|
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.`);
|
|
43977
|
-
const containerNameToClassName = getContainerNameToClassNameMap(exports$1
|
|
44050
|
+
const containerNameToClassName = getContainerNameToClassNameMap(exports$1);
|
|
43978
44051
|
const usesDurableObjectExports = Object.keys(durableObjectExports).length > 0;
|
|
43979
44052
|
for (const container of containers ?? []) {
|
|
43980
44053
|
if (typeof container.name !== "string") continue;
|
|
@@ -44552,8 +44625,8 @@ function getBindingKey(type) {
|
|
|
44552
44625
|
return "binding";
|
|
44553
44626
|
}
|
|
44554
44627
|
__name$5(getBindingKey, "getBindingKey");
|
|
44555
|
-
function extractBindingsOfType(type, bindings
|
|
44556
|
-
return Object.entries(bindings
|
|
44628
|
+
function extractBindingsOfType(type, bindings) {
|
|
44629
|
+
return Object.entries(bindings ?? {}).filter((binding) => binding[1].type === type).map((binding) => ({
|
|
44557
44630
|
...binding[1],
|
|
44558
44631
|
[getBindingKey(type)]: binding[0]
|
|
44559
44632
|
}));
|
|
@@ -44570,7 +44643,7 @@ __name$5(getBindings, "getBindings");
|
|
|
44570
44643
|
var { dim: dim$1, white: white$1 } = source_default;
|
|
44571
44644
|
var brandColor$1 = source_default.hex("#BD5B08");
|
|
44572
44645
|
var isConnectedStatusExplained = false;
|
|
44573
|
-
function printBindings(bindings
|
|
44646
|
+
function printBindings(bindings, options) {
|
|
44574
44647
|
const { containers = [], log: log$1, streamingTailConsumers = [], tailConsumers = [] } = options;
|
|
44575
44648
|
const context = options;
|
|
44576
44649
|
let hasConnectionStatus = false;
|
|
@@ -44585,48 +44658,48 @@ function printBindings(bindings$1, options) {
|
|
|
44585
44658
|
return `${s.substring(0, maxLength - 3)}...`;
|
|
44586
44659
|
}, "truncate");
|
|
44587
44660
|
const output = [];
|
|
44588
|
-
const data_blobs = extractBindingsOfType("data_blob", bindings
|
|
44589
|
-
const durable_objects = extractBindingsOfType("durable_object_namespace", bindings
|
|
44590
|
-
const workflows = extractBindingsOfType("workflow", bindings
|
|
44591
|
-
const kv_namespaces = extractBindingsOfType("kv_namespace", bindings
|
|
44592
|
-
const send_email = extractBindingsOfType("send_email", bindings
|
|
44593
|
-
const queues = extractBindingsOfType("queue", bindings
|
|
44594
|
-
const d1_databases = extractBindingsOfType("d1", bindings
|
|
44595
|
-
const vectorize = extractBindingsOfType("vectorize", bindings
|
|
44596
|
-
const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings
|
|
44597
|
-
const ai_search = extractBindingsOfType("ai_search", bindings
|
|
44598
|
-
const websearch = extractBindingsOfType("websearch", bindings
|
|
44599
|
-
const agent_memory = extractBindingsOfType("agent_memory", bindings
|
|
44600
|
-
const hyperdrive = extractBindingsOfType("hyperdrive", bindings
|
|
44601
|
-
const r2_buckets = extractBindingsOfType("r2_bucket", bindings
|
|
44602
|
-
const logfwdr = extractBindingsOfType("logfwdr", bindings
|
|
44603
|
-
const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings
|
|
44604
|
-
const artifacts = extractBindingsOfType("artifacts", bindings
|
|
44605
|
-
const services = extractBindingsOfType("service", bindings
|
|
44606
|
-
const vpc_services = extractBindingsOfType("vpc_service", bindings
|
|
44607
|
-
const vpc_networks = extractBindingsOfType("vpc_network", bindings
|
|
44608
|
-
const analytics_engine_datasets = extractBindingsOfType("analytics_engine", bindings
|
|
44609
|
-
const text_blobs = extractBindingsOfType("text_blob", bindings
|
|
44610
|
-
const browser = extractBindingsOfType("browser", bindings
|
|
44611
|
-
const images = extractBindingsOfType("images", bindings
|
|
44612
|
-
const stream$2 = extractBindingsOfType("stream", bindings
|
|
44613
|
-
const ai = extractBindingsOfType("ai", bindings
|
|
44614
|
-
const version_metadata = extractBindingsOfType("version_metadata", bindings
|
|
44615
|
-
const vars = Object.entries(bindings
|
|
44661
|
+
const data_blobs = extractBindingsOfType("data_blob", bindings);
|
|
44662
|
+
const durable_objects = extractBindingsOfType("durable_object_namespace", bindings);
|
|
44663
|
+
const workflows = extractBindingsOfType("workflow", bindings);
|
|
44664
|
+
const kv_namespaces = extractBindingsOfType("kv_namespace", bindings);
|
|
44665
|
+
const send_email = extractBindingsOfType("send_email", bindings);
|
|
44666
|
+
const queues = extractBindingsOfType("queue", bindings);
|
|
44667
|
+
const d1_databases = extractBindingsOfType("d1", bindings);
|
|
44668
|
+
const vectorize = extractBindingsOfType("vectorize", bindings);
|
|
44669
|
+
const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings);
|
|
44670
|
+
const ai_search = extractBindingsOfType("ai_search", bindings);
|
|
44671
|
+
const websearch = extractBindingsOfType("websearch", bindings);
|
|
44672
|
+
const agent_memory = extractBindingsOfType("agent_memory", bindings);
|
|
44673
|
+
const hyperdrive = extractBindingsOfType("hyperdrive", bindings);
|
|
44674
|
+
const r2_buckets = extractBindingsOfType("r2_bucket", bindings);
|
|
44675
|
+
const logfwdr = extractBindingsOfType("logfwdr", bindings);
|
|
44676
|
+
const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings);
|
|
44677
|
+
const artifacts = extractBindingsOfType("artifacts", bindings);
|
|
44678
|
+
const services = extractBindingsOfType("service", bindings);
|
|
44679
|
+
const vpc_services = extractBindingsOfType("vpc_service", bindings);
|
|
44680
|
+
const vpc_networks = extractBindingsOfType("vpc_network", bindings);
|
|
44681
|
+
const analytics_engine_datasets = extractBindingsOfType("analytics_engine", bindings);
|
|
44682
|
+
const text_blobs = extractBindingsOfType("text_blob", bindings);
|
|
44683
|
+
const browser = extractBindingsOfType("browser", bindings);
|
|
44684
|
+
const images = extractBindingsOfType("images", bindings);
|
|
44685
|
+
const stream$2 = extractBindingsOfType("stream", bindings);
|
|
44686
|
+
const ai = extractBindingsOfType("ai", bindings);
|
|
44687
|
+
const version_metadata = extractBindingsOfType("version_metadata", bindings);
|
|
44688
|
+
const vars = Object.entries(bindings ?? {}).filter(([_, binding]) => binding.type === "plain_text" || binding.type === "json" || binding.type === "secret_text").map(([name, binding]) => ({
|
|
44616
44689
|
binding: name,
|
|
44617
44690
|
...binding
|
|
44618
44691
|
}));
|
|
44619
|
-
const wasm_modules = extractBindingsOfType("wasm_module", bindings
|
|
44620
|
-
const dispatch_namespaces = extractBindingsOfType("dispatch_namespace", bindings
|
|
44621
|
-
const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings
|
|
44622
|
-
const pipelines = extractBindingsOfType("pipeline", bindings
|
|
44623
|
-
const ratelimits = extractBindingsOfType("ratelimit", bindings
|
|
44624
|
-
const assets = extractBindingsOfType("assets", bindings
|
|
44625
|
-
const unsafe_hello_world = extractBindingsOfType("unsafe_hello_world", bindings
|
|
44626
|
-
const flagship = extractBindingsOfType("flagship", bindings
|
|
44627
|
-
const media = extractBindingsOfType("media", bindings
|
|
44628
|
-
const worker_loaders = extractBindingsOfType("worker_loader", bindings
|
|
44629
|
-
const unsafe_bindings = Object.entries(bindings
|
|
44692
|
+
const wasm_modules = extractBindingsOfType("wasm_module", bindings);
|
|
44693
|
+
const dispatch_namespaces = extractBindingsOfType("dispatch_namespace", bindings);
|
|
44694
|
+
const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings);
|
|
44695
|
+
const pipelines = extractBindingsOfType("pipeline", bindings);
|
|
44696
|
+
const ratelimits = extractBindingsOfType("ratelimit", bindings);
|
|
44697
|
+
const assets = extractBindingsOfType("assets", bindings);
|
|
44698
|
+
const unsafe_hello_world = extractBindingsOfType("unsafe_hello_world", bindings);
|
|
44699
|
+
const flagship = extractBindingsOfType("flagship", bindings);
|
|
44700
|
+
const media = extractBindingsOfType("media", bindings);
|
|
44701
|
+
const worker_loaders = extractBindingsOfType("worker_loader", bindings);
|
|
44702
|
+
const unsafe_bindings = Object.entries(bindings ?? {}).filter(([_, binding]) => isUnsafeBindingType(binding.type) && binding.type !== "unsafe_hello_world").map(([name, binding]) => ({
|
|
44630
44703
|
name,
|
|
44631
44704
|
...binding
|
|
44632
44705
|
}));
|
|
@@ -45361,6 +45434,267 @@ function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
|
|
|
45361
45434
|
};
|
|
45362
45435
|
}
|
|
45363
45436
|
__name$5(getWranglerTmpDir, "getWranglerTmpDir");
|
|
45437
|
+
function buildDetailedError(message, ...extra) {
|
|
45438
|
+
return new ParseError({
|
|
45439
|
+
text: message,
|
|
45440
|
+
notes: extra.map((text) => ({ text })),
|
|
45441
|
+
telemetryMessage: false
|
|
45442
|
+
});
|
|
45443
|
+
}
|
|
45444
|
+
__name$5(buildDetailedError, "buildDetailedError");
|
|
45445
|
+
function maybeThrowFriendlyError(error51) {
|
|
45446
|
+
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.");
|
|
45447
|
+
}
|
|
45448
|
+
__name$5(maybeThrowFriendlyError, "maybeThrowFriendlyError");
|
|
45449
|
+
function logHeaders(headers, logger$1) {
|
|
45450
|
+
const clone2 = cloneHeaders(headers);
|
|
45451
|
+
clone2.delete("Authorization");
|
|
45452
|
+
logger$1.debugWithSanitization?.("HEADERS:", JSON.stringify(Object.fromEntries(clone2), null, 2));
|
|
45453
|
+
}
|
|
45454
|
+
__name$5(logHeaders, "logHeaders");
|
|
45455
|
+
async function performApiFetchBase(complianceConfig, resource, init = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
45456
|
+
assert2(credentials, "credentials are required for performApiFetch");
|
|
45457
|
+
const method = init.method ?? "GET";
|
|
45458
|
+
assert2(resource.startsWith("/"), `CF API fetch - resource path must start with a "/" but got "${resource}"`);
|
|
45459
|
+
const headers = cloneHeaders(new import_undici$3.Headers(init.headers));
|
|
45460
|
+
addAuthorizationHeader(headers, credentials);
|
|
45461
|
+
headers.set("User-Agent", userAgent);
|
|
45462
|
+
maybeAddTraceHeader(headers);
|
|
45463
|
+
const queryString = queryParams ? `?${queryParams.toString()}` : "";
|
|
45464
|
+
logger$1.debug(`-- START CF API REQUEST: ${method} ${getCloudflareApiBaseUrl(complianceConfig)}${resource}`);
|
|
45465
|
+
logger$1.debugWithSanitization?.("QUERY STRING:", queryString);
|
|
45466
|
+
logHeaders(headers, logger$1);
|
|
45467
|
+
logger$1.debugWithSanitization?.("INIT:", JSON.stringify({ ...init }, null, 2));
|
|
45468
|
+
if (init.body instanceof import_undici$3.FormData) logger$1.debugWithSanitization?.("BODY:", await new import_undici$3.Response(init.body).text(), null, 2);
|
|
45469
|
+
logger$1.debug("-- END CF API REQUEST");
|
|
45470
|
+
return await (0, import_undici$3.fetch)(`${getCloudflareApiBaseUrl(complianceConfig)}${resource}${queryString}`, {
|
|
45471
|
+
method,
|
|
45472
|
+
...init,
|
|
45473
|
+
headers,
|
|
45474
|
+
signal: abortSignal
|
|
45475
|
+
});
|
|
45476
|
+
}
|
|
45477
|
+
__name$5(performApiFetchBase, "performApiFetchBase");
|
|
45478
|
+
async function fetchInternalBase(complianceConfig, resource, init = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
45479
|
+
const method = init.method ?? "GET";
|
|
45480
|
+
const response = await performApiFetchBase(complianceConfig, resource, init, userAgent, logger$1, queryParams, abortSignal, credentials);
|
|
45481
|
+
const jsonText = await response.text();
|
|
45482
|
+
logger$1.debug("-- START CF API RESPONSE:", response.statusText, response.status);
|
|
45483
|
+
logHeaders(response.headers, logger$1);
|
|
45484
|
+
logger$1.debugWithSanitization?.("RESPONSE:", jsonText);
|
|
45485
|
+
logger$1.debug("-- END CF API RESPONSE");
|
|
45486
|
+
const retryAfterMs = parseRetryAfterMs(response.headers);
|
|
45487
|
+
if (!jsonText && (response.status === 204 || response.status === 205)) return {
|
|
45488
|
+
response: {
|
|
45489
|
+
result: {},
|
|
45490
|
+
success: true,
|
|
45491
|
+
errors: [],
|
|
45492
|
+
messages: []
|
|
45493
|
+
},
|
|
45494
|
+
status: response.status,
|
|
45495
|
+
retryAfterMs
|
|
45496
|
+
};
|
|
45497
|
+
if (isWAFBlockResponse(response.headers)) throwWAFBlockError(response.headers, method, resource, response.status, response.statusText, retryAfterMs);
|
|
45498
|
+
try {
|
|
45499
|
+
return {
|
|
45500
|
+
response: parseJSON(jsonText),
|
|
45501
|
+
status: response.status,
|
|
45502
|
+
retryAfterMs
|
|
45503
|
+
};
|
|
45504
|
+
} catch {
|
|
45505
|
+
const rayId = extractWAFBlockRayId(response.headers);
|
|
45506
|
+
throw new APIError({
|
|
45507
|
+
text: "Received a malformed response from the API",
|
|
45508
|
+
notes: [
|
|
45509
|
+
{ text: truncate(jsonText, 100) },
|
|
45510
|
+
{ text: `${method} ${resource} -> ${response.status} ${response.statusText}` },
|
|
45511
|
+
...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : []
|
|
45512
|
+
],
|
|
45513
|
+
status: response.status,
|
|
45514
|
+
retryAfterMs,
|
|
45515
|
+
telemetryMessage: false
|
|
45516
|
+
});
|
|
45517
|
+
}
|
|
45518
|
+
}
|
|
45519
|
+
__name$5(fetchInternalBase, "fetchInternalBase");
|
|
45520
|
+
async function fetchResultBase(complianceConfig, resource, init = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
45521
|
+
const { response: json2, status: status$1, retryAfterMs } = await fetchInternalBase(complianceConfig, resource, init, userAgent, logger$1, queryParams, abortSignal, credentials);
|
|
45522
|
+
if (json2.success) return json2.result;
|
|
45523
|
+
else throwFetchError(resource, json2, status$1, retryAfterMs);
|
|
45524
|
+
}
|
|
45525
|
+
__name$5(fetchResultBase, "fetchResultBase");
|
|
45526
|
+
async function fetchListResultBase(complianceConfig, resource, init = {}, userAgent, logger$1, queryParams, credentials) {
|
|
45527
|
+
const results = [];
|
|
45528
|
+
let getMoreResults = true;
|
|
45529
|
+
let cursor$1;
|
|
45530
|
+
while (getMoreResults) {
|
|
45531
|
+
if (cursor$1) {
|
|
45532
|
+
queryParams = new URLSearchParams$1(queryParams);
|
|
45533
|
+
queryParams.set("cursor", cursor$1);
|
|
45534
|
+
}
|
|
45535
|
+
const { response: json2, status: status$1, retryAfterMs } = await fetchInternalBase(complianceConfig, resource, init, userAgent, logger$1, queryParams, void 0, credentials);
|
|
45536
|
+
if (json2.success) {
|
|
45537
|
+
results.push(...json2.result);
|
|
45538
|
+
if (hasCursor(json2.result_info)) cursor$1 = json2.result_info?.cursor;
|
|
45539
|
+
else getMoreResults = false;
|
|
45540
|
+
} else throwFetchError(resource, json2, status$1, retryAfterMs);
|
|
45541
|
+
}
|
|
45542
|
+
return results;
|
|
45543
|
+
}
|
|
45544
|
+
__name$5(fetchListResultBase, "fetchListResultBase");
|
|
45545
|
+
function truncate(text, maxLength) {
|
|
45546
|
+
const { length } = text;
|
|
45547
|
+
if (length <= maxLength) return text;
|
|
45548
|
+
return `${text.substring(0, maxLength)}... (length = ${length})`;
|
|
45549
|
+
}
|
|
45550
|
+
__name$5(truncate, "truncate");
|
|
45551
|
+
function isWAFBlockResponse(headers) {
|
|
45552
|
+
return headers.get("cf-mitigated") === "challenge";
|
|
45553
|
+
}
|
|
45554
|
+
__name$5(isWAFBlockResponse, "isWAFBlockResponse");
|
|
45555
|
+
function parseRetryAfterValue(retryAfter) {
|
|
45556
|
+
if (!retryAfter) return;
|
|
45557
|
+
if (/^\d+$/.test(retryAfter.trim())) return Number(retryAfter) * 1e3;
|
|
45558
|
+
const retryAfterDate = new Date(retryAfter);
|
|
45559
|
+
if (!Number.isNaN(retryAfterDate.getTime())) return Math.max(0, retryAfterDate.getTime() - Date.now());
|
|
45560
|
+
}
|
|
45561
|
+
__name$5(parseRetryAfterValue, "parseRetryAfterValue");
|
|
45562
|
+
function parseRetryAfterMs(headers) {
|
|
45563
|
+
return parseRetryAfterValue(headers.get("Retry-After"));
|
|
45564
|
+
}
|
|
45565
|
+
__name$5(parseRetryAfterMs, "parseRetryAfterMs");
|
|
45566
|
+
function extractWAFBlockRayId(headers) {
|
|
45567
|
+
return headers.get("cf-ray") ?? void 0;
|
|
45568
|
+
}
|
|
45569
|
+
__name$5(extractWAFBlockRayId, "extractWAFBlockRayId");
|
|
45570
|
+
function extractAccountTag(resource) {
|
|
45571
|
+
return (/* @__PURE__ */ new RegExp("/accounts/([a-zA-Z0-9]+)/?")).exec(resource)?.[1];
|
|
45572
|
+
}
|
|
45573
|
+
__name$5(extractAccountTag, "extractAccountTag");
|
|
45574
|
+
function hasMorePages(result_info) {
|
|
45575
|
+
const page = result_info?.page;
|
|
45576
|
+
const per_page = result_info?.per_page;
|
|
45577
|
+
const total = result_info?.total_count;
|
|
45578
|
+
return page !== void 0 && per_page !== void 0 && total !== void 0 && page * per_page < total;
|
|
45579
|
+
}
|
|
45580
|
+
__name$5(hasMorePages, "hasMorePages");
|
|
45581
|
+
function renderError(err, level = 0) {
|
|
45582
|
+
const indent = " ".repeat(level);
|
|
45583
|
+
const message = err.message ?? "";
|
|
45584
|
+
const chainedMessages = "error_chain" in err ? err.error_chain?.map((chainedError) => `
|
|
45585
|
+
|
|
45586
|
+
${indent}- ${renderError(chainedError, level + 1)}`).join("\n") ?? "" : "";
|
|
45587
|
+
return (err.code ? `${message} [code: ${err.code}]` : message) + (err.documentation_url ? `
|
|
45588
|
+
${indent}To learn more about this error, visit: ${err.documentation_url}` : "") + chainedMessages;
|
|
45589
|
+
}
|
|
45590
|
+
__name$5(renderError, "renderError");
|
|
45591
|
+
function addAuthorizationHeader(headers, auth, overrideExisting = false) {
|
|
45592
|
+
if (!headers.has("Authorization") || overrideExisting) if ("apiToken" in auth) {
|
|
45593
|
+
const authorizationHeader = `Bearer ${auth.apiToken}`;
|
|
45594
|
+
validateAuthorizationHeaderValue(authorizationHeader);
|
|
45595
|
+
headers.set("Authorization", authorizationHeader);
|
|
45596
|
+
} else {
|
|
45597
|
+
headers.set("X-Auth-Key", auth.authKey);
|
|
45598
|
+
headers.set("X-Auth-Email", auth.authEmail);
|
|
45599
|
+
}
|
|
45600
|
+
}
|
|
45601
|
+
__name$5(addAuthorizationHeader, "addAuthorizationHeader");
|
|
45602
|
+
function validateAuthorizationHeaderValue(value) {
|
|
45603
|
+
for (const character of value) {
|
|
45604
|
+
const codePoint = character.codePointAt(0);
|
|
45605
|
+
if (codePoint === void 0 || codePoint > 255) throw new UserError(`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" });
|
|
45606
|
+
}
|
|
45607
|
+
}
|
|
45608
|
+
__name$5(validateAuthorizationHeaderValue, "validateAuthorizationHeaderValue");
|
|
45609
|
+
function formatAuthorizationHeaderCharacter(character, codePoint) {
|
|
45610
|
+
if (codePoint === void 0) return "\"\\u{unknown}\"";
|
|
45611
|
+
const codePointLabel = `U+${codePoint.toString(16).toUpperCase().padStart(4, "0")}`;
|
|
45612
|
+
return `${isPrintableCharacter(character) ? `"${character}"` : `"${escapeCharacter(character)}"`} (${codePointLabel})`;
|
|
45613
|
+
}
|
|
45614
|
+
__name$5(formatAuthorizationHeaderCharacter, "formatAuthorizationHeaderCharacter");
|
|
45615
|
+
function isPrintableCharacter(character) {
|
|
45616
|
+
return !/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(character);
|
|
45617
|
+
}
|
|
45618
|
+
__name$5(isPrintableCharacter, "isPrintableCharacter");
|
|
45619
|
+
function escapeCharacter(character) {
|
|
45620
|
+
return Array.from(character).map((c$1) => {
|
|
45621
|
+
const codePoint = c$1.codePointAt(0);
|
|
45622
|
+
if (codePoint === void 0) return "";
|
|
45623
|
+
return codePoint <= 65535 ? `\\u${codePoint.toString(16).toUpperCase().padStart(4, "0")}` : `\\u{${codePoint.toString(16).toUpperCase()}}`;
|
|
45624
|
+
}).join("");
|
|
45625
|
+
}
|
|
45626
|
+
__name$5(escapeCharacter, "escapeCharacter");
|
|
45627
|
+
function throwFetchError(resource, response, status$1, retryAfterMs) {
|
|
45628
|
+
const errors$1 = response.errors ?? [];
|
|
45629
|
+
for (const error52 of errors$1) maybeThrowFriendlyError(error52);
|
|
45630
|
+
const notes = [...errors$1.map((err) => ({ text: renderError(err) })), ...response.messages?.map((msg) => ({ text: typeof msg === "string" ? msg : msg.message ?? String(msg) })) ?? []];
|
|
45631
|
+
if (notes.length === 0) {
|
|
45632
|
+
const raw = response;
|
|
45633
|
+
const fallbackMessage = typeof raw.error === "string" ? `${raw.error}${raw.code ? ` [code: ${raw.code}]` : ""}` : void 0;
|
|
45634
|
+
if (fallbackMessage) notes.push({ text: fallbackMessage });
|
|
45635
|
+
}
|
|
45636
|
+
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.` });
|
|
45637
|
+
const error51 = new APIError({
|
|
45638
|
+
text: `A request to the Cloudflare API (${resource}) failed.`,
|
|
45639
|
+
notes,
|
|
45640
|
+
status: status$1,
|
|
45641
|
+
retryAfterMs,
|
|
45642
|
+
telemetryMessage: false
|
|
45643
|
+
});
|
|
45644
|
+
const code = errors$1[0]?.code;
|
|
45645
|
+
if (code) error51.code = code;
|
|
45646
|
+
const meta3 = errors$1[0]?.meta;
|
|
45647
|
+
if (meta3) error51.meta = meta3;
|
|
45648
|
+
error51.accountTag = extractAccountTag(resource);
|
|
45649
|
+
throw error51;
|
|
45650
|
+
}
|
|
45651
|
+
__name$5(throwFetchError, "throwFetchError");
|
|
45652
|
+
function throwWAFBlockError(headers, method, resource, status$1, statusText, retryAfterMs) {
|
|
45653
|
+
const rayId = extractWAFBlockRayId(headers);
|
|
45654
|
+
throw new APIError({
|
|
45655
|
+
text: "The Cloudflare API responded with a WAF block page instead of the expected JSON response",
|
|
45656
|
+
notes: [
|
|
45657
|
+
{ text: "Cloudflare's firewall (WAF) blocked this API request. This is usually a false positive." },
|
|
45658
|
+
...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : [],
|
|
45659
|
+
{ 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." },
|
|
45660
|
+
{ text: `${method} ${resource} -> ${status$1} ${statusText}` }
|
|
45661
|
+
],
|
|
45662
|
+
status: status$1,
|
|
45663
|
+
retryAfterMs,
|
|
45664
|
+
telemetryMessage: false
|
|
45665
|
+
});
|
|
45666
|
+
}
|
|
45667
|
+
__name$5(throwWAFBlockError, "throwWAFBlockError");
|
|
45668
|
+
async function fetchKVGetValueBase(complianceConfig, accountId, namespaceId, key, userAgent, logger$1, credentials) {
|
|
45669
|
+
const headers = new import_undici$3.Headers();
|
|
45670
|
+
addAuthorizationHeader(headers, credentials);
|
|
45671
|
+
headers.set("User-Agent", userAgent);
|
|
45672
|
+
maybeAddTraceHeader(headers);
|
|
45673
|
+
const resource = `${getCloudflareApiBaseUrl(complianceConfig)}/accounts/${accountId}/storage/kv/namespaces/${namespaceId}/values/${key}`;
|
|
45674
|
+
logger$1.debug(`-- START CF API REQUEST: GET ${resource}`);
|
|
45675
|
+
logger$1.debug("-- END CF API REQUEST");
|
|
45676
|
+
const response = await (0, import_undici$3.fetch)(resource, {
|
|
45677
|
+
method: "GET",
|
|
45678
|
+
headers
|
|
45679
|
+
});
|
|
45680
|
+
if (response.ok) return await response.arrayBuffer();
|
|
45681
|
+
else throw new Error(`Failed to fetch ${resource} - ${response.status}: ${response.statusText}`);
|
|
45682
|
+
}
|
|
45683
|
+
__name$5(fetchKVGetValueBase, "fetchKVGetValueBase");
|
|
45684
|
+
function hasCursor(result_info) {
|
|
45685
|
+
const cursor$1 = result_info?.cursor;
|
|
45686
|
+
return cursor$1 !== void 0 && cursor$1 !== null && cursor$1 !== "";
|
|
45687
|
+
}
|
|
45688
|
+
__name$5(hasCursor, "hasCursor");
|
|
45689
|
+
function maybeAddTraceHeader(headers) {
|
|
45690
|
+
const traceHeader = getTraceHeader();
|
|
45691
|
+
if (traceHeader) headers.set("Cf-Trace-Id", traceHeader);
|
|
45692
|
+
}
|
|
45693
|
+
__name$5(maybeAddTraceHeader, "maybeAddTraceHeader");
|
|
45694
|
+
function cloneHeaders(headers) {
|
|
45695
|
+
return new import_undici$3.Headers(headers);
|
|
45696
|
+
}
|
|
45697
|
+
__name$5(cloneHeaders, "cloneHeaders");
|
|
45364
45698
|
var import_command_exists$1 = __toESM(require_command_exists2());
|
|
45365
45699
|
var UPDATE_SERVICE_URL = "https://update.argotunnel.com";
|
|
45366
45700
|
var CLOUDFLARED_VERSION_PATTERN = /^\d{4}\.\d+\.\d+$/;
|
|
@@ -45750,12 +46084,93 @@ function removeCloudflaredCache(version2) {
|
|
|
45750
46084
|
}
|
|
45751
46085
|
__name$5(removeCloudflaredCache, "removeCloudflaredCache");
|
|
45752
46086
|
var TUNNEL_STARTUP_TIMEOUT_MS = 3e4;
|
|
46087
|
+
var TUNNEL_API_TIMEOUT_MS = 6e4;
|
|
45753
46088
|
var TUNNEL_FORCE_KILL_TIMEOUT_MS = 5e3;
|
|
45754
46089
|
var DEFAULT_TUNNEL_EXPIRY_MS = 3600 * 1e3;
|
|
45755
46090
|
var DEFAULT_TUNNEL_EXTENSION_MS = 3600 * 1e3;
|
|
45756
46091
|
var DEFAULT_TUNNEL_MAX_REMAINING_MS = 10800 * 1e3;
|
|
45757
46092
|
var DEFAULT_TUNNEL_REMINDER_INTERVAL_MS = 600 * 1e3;
|
|
45758
46093
|
var QUICK_TUNNEL_URL_REGEX = /https:\/\/[a-z0-9-]+\.trycloudflare\.com/;
|
|
46094
|
+
var LOCAL_TUNNEL_HOSTNAMES = /* @__PURE__ */ new Set([
|
|
46095
|
+
"localhost",
|
|
46096
|
+
"127.0.0.1",
|
|
46097
|
+
"::1",
|
|
46098
|
+
"0.0.0.0",
|
|
46099
|
+
"::"
|
|
46100
|
+
]);
|
|
46101
|
+
async function resolveNamedTunnel(name, origin, options) {
|
|
46102
|
+
const { accountId, apiToken, complianceRegion, logger: logger$1, userAgent, abortSignal } = options;
|
|
46103
|
+
const complianceConfig = { compliance_region: complianceRegion };
|
|
46104
|
+
const resource = `/accounts/${accountId}/cfd_tunnel`;
|
|
46105
|
+
const tunnel = (await fetchResultBase(complianceConfig, resource, void 0, userAgent, logger$1, new URLSearchParams({
|
|
46106
|
+
name,
|
|
46107
|
+
is_deleted: "false"
|
|
46108
|
+
}), createApiAbortSignal(TUNNEL_API_TIMEOUT_MS, abortSignal), apiToken)).find((item) => item.name === name);
|
|
46109
|
+
if (!tunnel) throw new UserError(`No Cloudflare Tunnel named "${name}" was found in this account. Use "wrangler tunnel list" to see available tunnels.`, { telemetryMessage: "tunnel resolve named missing tunnel" });
|
|
46110
|
+
const tunnelId = tunnel.id;
|
|
46111
|
+
if (!tunnelId) throw new FatalError(`Tunnel "${name}" was found but has no ID. This is unexpected.`, { telemetryMessage: "tunnel resolve named missing tunnel id" });
|
|
46112
|
+
const ingress = (await fetchResultBase(complianceConfig, `${resource}/${tunnelId}/configurations`, void 0, userAgent, logger$1, void 0, createApiAbortSignal(TUNNEL_API_TIMEOUT_MS, abortSignal), apiToken)).config?.ingress ?? [];
|
|
46113
|
+
const hostnames = getMatchingIngressHostnames(origin, ingress);
|
|
46114
|
+
if (hostnames.length === 0) throw new UserError(createMissingIngressMessage(name, origin, {
|
|
46115
|
+
dashboardUrl: `https://dash.cloudflare.com/${accountId}/tunnels/${tunnelId}`,
|
|
46116
|
+
ingress
|
|
46117
|
+
}), { telemetryMessage: "tunnel resolve named ingress mismatch" });
|
|
46118
|
+
const token = await fetchResultBase(complianceConfig, `${resource}/${tunnelId}/token`, void 0, userAgent, logger$1, void 0, createApiAbortSignal(TUNNEL_API_TIMEOUT_MS, abortSignal), apiToken);
|
|
46119
|
+
return {
|
|
46120
|
+
hostnames,
|
|
46121
|
+
token: String(token)
|
|
46122
|
+
};
|
|
46123
|
+
}
|
|
46124
|
+
__name$5(resolveNamedTunnel, "resolveNamedTunnel");
|
|
46125
|
+
function getMatchingIngressHostnames(origin, ingressConfig) {
|
|
46126
|
+
const hostnames = /* @__PURE__ */ new Set();
|
|
46127
|
+
const originUrl = normalizeURL(origin);
|
|
46128
|
+
for (const ingress of ingressConfig) try {
|
|
46129
|
+
const serviceUrl = normalizeURL(ingress.service);
|
|
46130
|
+
if (ingress.hostname && serviceUrl.toString() === originUrl.toString()) hostnames.add(ingress.hostname);
|
|
46131
|
+
} catch {}
|
|
46132
|
+
return [...hostnames];
|
|
46133
|
+
}
|
|
46134
|
+
__name$5(getMatchingIngressHostnames, "getMatchingIngressHostnames");
|
|
46135
|
+
function normalizeURL(url2) {
|
|
46136
|
+
const normalizedUrl = new URL(url2);
|
|
46137
|
+
if (LOCAL_TUNNEL_HOSTNAMES.has(normalizedUrl.hostname)) normalizedUrl.hostname = "localhost";
|
|
46138
|
+
if (!normalizedUrl.port) switch (normalizedUrl.protocol) {
|
|
46139
|
+
case "http:":
|
|
46140
|
+
normalizedUrl.port = "80";
|
|
46141
|
+
break;
|
|
46142
|
+
case "https:":
|
|
46143
|
+
normalizedUrl.port = "443";
|
|
46144
|
+
break;
|
|
46145
|
+
}
|
|
46146
|
+
return normalizedUrl;
|
|
46147
|
+
}
|
|
46148
|
+
__name$5(normalizeURL, "normalizeURL");
|
|
46149
|
+
function createApiAbortSignal(timeoutMs, abortSignal) {
|
|
46150
|
+
const timeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
46151
|
+
return abortSignal ? AbortSignal.any([abortSignal, timeoutSignal]) : timeoutSignal;
|
|
46152
|
+
}
|
|
46153
|
+
__name$5(createApiAbortSignal, "createApiAbortSignal");
|
|
46154
|
+
function createMissingIngressMessage(name, origin, { dashboardUrl, ingress }) {
|
|
46155
|
+
if (ingress.length === 0) return [
|
|
46156
|
+
`Tunnel "${name}" has no routes configured.`,
|
|
46157
|
+
"",
|
|
46158
|
+
`Add a route for ${origin} in the Cloudflare dashboard:`,
|
|
46159
|
+
dashboardUrl,
|
|
46160
|
+
""
|
|
46161
|
+
].join("\n");
|
|
46162
|
+
return [
|
|
46163
|
+
`Tunnel "${name}" has no route for ${origin}`,
|
|
46164
|
+
"",
|
|
46165
|
+
"Resolved routes:",
|
|
46166
|
+
...ingress.map(({ hostname: hostname3, service }) => ` - ${hostname3 ?? "(no hostname)"} -> ${service}`),
|
|
46167
|
+
"",
|
|
46168
|
+
"Update your local server settings or the tunnel routes in the Cloudflare dashboard:",
|
|
46169
|
+
dashboardUrl,
|
|
46170
|
+
""
|
|
46171
|
+
].join("\n");
|
|
46172
|
+
}
|
|
46173
|
+
__name$5(createMissingIngressMessage, "createMissingIngressMessage");
|
|
45759
46174
|
function startTunnel(options) {
|
|
45760
46175
|
let disposed = false;
|
|
45761
46176
|
let reminderInterval;
|
|
@@ -45936,267 +46351,6 @@ The local dev server started at ${origin.href}
|
|
|
45936
46351
|
return new Error(errorMessage);
|
|
45937
46352
|
}
|
|
45938
46353
|
__name$5(createTunnelStartupError, "createTunnelStartupError");
|
|
45939
|
-
function buildDetailedError(message, ...extra) {
|
|
45940
|
-
return new ParseError({
|
|
45941
|
-
text: message,
|
|
45942
|
-
notes: extra.map((text) => ({ text })),
|
|
45943
|
-
telemetryMessage: false
|
|
45944
|
-
});
|
|
45945
|
-
}
|
|
45946
|
-
__name$5(buildDetailedError, "buildDetailedError");
|
|
45947
|
-
function maybeThrowFriendlyError(error51) {
|
|
45948
|
-
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.");
|
|
45949
|
-
}
|
|
45950
|
-
__name$5(maybeThrowFriendlyError, "maybeThrowFriendlyError");
|
|
45951
|
-
function logHeaders(headers, logger$1) {
|
|
45952
|
-
const clone2 = cloneHeaders(headers);
|
|
45953
|
-
clone2.delete("Authorization");
|
|
45954
|
-
logger$1.debugWithSanitization?.("HEADERS:", JSON.stringify(Object.fromEntries(clone2), null, 2));
|
|
45955
|
-
}
|
|
45956
|
-
__name$5(logHeaders, "logHeaders");
|
|
45957
|
-
async function performApiFetchBase(complianceConfig, resource, init = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
45958
|
-
assert2(credentials, "credentials are required for performApiFetch");
|
|
45959
|
-
const method = init.method ?? "GET";
|
|
45960
|
-
assert2(resource.startsWith("/"), `CF API fetch - resource path must start with a "/" but got "${resource}"`);
|
|
45961
|
-
const headers = cloneHeaders(new import_undici$3.Headers(init.headers));
|
|
45962
|
-
addAuthorizationHeader(headers, credentials);
|
|
45963
|
-
headers.set("User-Agent", userAgent);
|
|
45964
|
-
maybeAddTraceHeader(headers);
|
|
45965
|
-
const queryString = queryParams ? `?${queryParams.toString()}` : "";
|
|
45966
|
-
logger$1.debug(`-- START CF API REQUEST: ${method} ${getCloudflareApiBaseUrl(complianceConfig)}${resource}`);
|
|
45967
|
-
logger$1.debugWithSanitization?.("QUERY STRING:", queryString);
|
|
45968
|
-
logHeaders(headers, logger$1);
|
|
45969
|
-
logger$1.debugWithSanitization?.("INIT:", JSON.stringify({ ...init }, null, 2));
|
|
45970
|
-
if (init.body instanceof import_undici$3.FormData) logger$1.debugWithSanitization?.("BODY:", await new import_undici$3.Response(init.body).text(), null, 2);
|
|
45971
|
-
logger$1.debug("-- END CF API REQUEST");
|
|
45972
|
-
return await (0, import_undici$3.fetch)(`${getCloudflareApiBaseUrl(complianceConfig)}${resource}${queryString}`, {
|
|
45973
|
-
method,
|
|
45974
|
-
...init,
|
|
45975
|
-
headers,
|
|
45976
|
-
signal: abortSignal
|
|
45977
|
-
});
|
|
45978
|
-
}
|
|
45979
|
-
__name$5(performApiFetchBase, "performApiFetchBase");
|
|
45980
|
-
async function fetchInternalBase(complianceConfig, resource, init = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
45981
|
-
const method = init.method ?? "GET";
|
|
45982
|
-
const response = await performApiFetchBase(complianceConfig, resource, init, userAgent, logger$1, queryParams, abortSignal, credentials);
|
|
45983
|
-
const jsonText = await response.text();
|
|
45984
|
-
logger$1.debug("-- START CF API RESPONSE:", response.statusText, response.status);
|
|
45985
|
-
logHeaders(response.headers, logger$1);
|
|
45986
|
-
logger$1.debugWithSanitization?.("RESPONSE:", jsonText);
|
|
45987
|
-
logger$1.debug("-- END CF API RESPONSE");
|
|
45988
|
-
const retryAfterMs = parseRetryAfterMs(response.headers);
|
|
45989
|
-
if (!jsonText && (response.status === 204 || response.status === 205)) return {
|
|
45990
|
-
response: {
|
|
45991
|
-
result: {},
|
|
45992
|
-
success: true,
|
|
45993
|
-
errors: [],
|
|
45994
|
-
messages: []
|
|
45995
|
-
},
|
|
45996
|
-
status: response.status,
|
|
45997
|
-
retryAfterMs
|
|
45998
|
-
};
|
|
45999
|
-
if (isWAFBlockResponse(response.headers)) throwWAFBlockError(response.headers, method, resource, response.status, response.statusText, retryAfterMs);
|
|
46000
|
-
try {
|
|
46001
|
-
return {
|
|
46002
|
-
response: parseJSON(jsonText),
|
|
46003
|
-
status: response.status,
|
|
46004
|
-
retryAfterMs
|
|
46005
|
-
};
|
|
46006
|
-
} catch {
|
|
46007
|
-
const rayId = extractWAFBlockRayId(response.headers);
|
|
46008
|
-
throw new APIError({
|
|
46009
|
-
text: "Received a malformed response from the API",
|
|
46010
|
-
notes: [
|
|
46011
|
-
{ text: truncate(jsonText, 100) },
|
|
46012
|
-
{ text: `${method} ${resource} -> ${response.status} ${response.statusText}` },
|
|
46013
|
-
...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : []
|
|
46014
|
-
],
|
|
46015
|
-
status: response.status,
|
|
46016
|
-
retryAfterMs,
|
|
46017
|
-
telemetryMessage: false
|
|
46018
|
-
});
|
|
46019
|
-
}
|
|
46020
|
-
}
|
|
46021
|
-
__name$5(fetchInternalBase, "fetchInternalBase");
|
|
46022
|
-
async function fetchResultBase(complianceConfig, resource, init = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
46023
|
-
const { response: json2, status: status$1, retryAfterMs } = await fetchInternalBase(complianceConfig, resource, init, userAgent, logger$1, queryParams, abortSignal, credentials);
|
|
46024
|
-
if (json2.success) return json2.result;
|
|
46025
|
-
else throwFetchError(resource, json2, status$1, retryAfterMs);
|
|
46026
|
-
}
|
|
46027
|
-
__name$5(fetchResultBase, "fetchResultBase");
|
|
46028
|
-
async function fetchListResultBase(complianceConfig, resource, init = {}, userAgent, logger$1, queryParams, credentials) {
|
|
46029
|
-
const results = [];
|
|
46030
|
-
let getMoreResults = true;
|
|
46031
|
-
let cursor$1;
|
|
46032
|
-
while (getMoreResults) {
|
|
46033
|
-
if (cursor$1) {
|
|
46034
|
-
queryParams = new URLSearchParams$1(queryParams);
|
|
46035
|
-
queryParams.set("cursor", cursor$1);
|
|
46036
|
-
}
|
|
46037
|
-
const { response: json2, status: status$1, retryAfterMs } = await fetchInternalBase(complianceConfig, resource, init, userAgent, logger$1, queryParams, void 0, credentials);
|
|
46038
|
-
if (json2.success) {
|
|
46039
|
-
results.push(...json2.result);
|
|
46040
|
-
if (hasCursor(json2.result_info)) cursor$1 = json2.result_info?.cursor;
|
|
46041
|
-
else getMoreResults = false;
|
|
46042
|
-
} else throwFetchError(resource, json2, status$1, retryAfterMs);
|
|
46043
|
-
}
|
|
46044
|
-
return results;
|
|
46045
|
-
}
|
|
46046
|
-
__name$5(fetchListResultBase, "fetchListResultBase");
|
|
46047
|
-
function truncate(text, maxLength) {
|
|
46048
|
-
const { length } = text;
|
|
46049
|
-
if (length <= maxLength) return text;
|
|
46050
|
-
return `${text.substring(0, maxLength)}... (length = ${length})`;
|
|
46051
|
-
}
|
|
46052
|
-
__name$5(truncate, "truncate");
|
|
46053
|
-
function isWAFBlockResponse(headers) {
|
|
46054
|
-
return headers.get("cf-mitigated") === "challenge";
|
|
46055
|
-
}
|
|
46056
|
-
__name$5(isWAFBlockResponse, "isWAFBlockResponse");
|
|
46057
|
-
function parseRetryAfterValue(retryAfter) {
|
|
46058
|
-
if (!retryAfter) return;
|
|
46059
|
-
if (/^\d+$/.test(retryAfter.trim())) return Number(retryAfter) * 1e3;
|
|
46060
|
-
const retryAfterDate = new Date(retryAfter);
|
|
46061
|
-
if (!Number.isNaN(retryAfterDate.getTime())) return Math.max(0, retryAfterDate.getTime() - Date.now());
|
|
46062
|
-
}
|
|
46063
|
-
__name$5(parseRetryAfterValue, "parseRetryAfterValue");
|
|
46064
|
-
function parseRetryAfterMs(headers) {
|
|
46065
|
-
return parseRetryAfterValue(headers.get("Retry-After"));
|
|
46066
|
-
}
|
|
46067
|
-
__name$5(parseRetryAfterMs, "parseRetryAfterMs");
|
|
46068
|
-
function extractWAFBlockRayId(headers) {
|
|
46069
|
-
return headers.get("cf-ray") ?? void 0;
|
|
46070
|
-
}
|
|
46071
|
-
__name$5(extractWAFBlockRayId, "extractWAFBlockRayId");
|
|
46072
|
-
function extractAccountTag(resource) {
|
|
46073
|
-
return (/* @__PURE__ */ new RegExp("/accounts/([a-zA-Z0-9]+)/?")).exec(resource)?.[1];
|
|
46074
|
-
}
|
|
46075
|
-
__name$5(extractAccountTag, "extractAccountTag");
|
|
46076
|
-
function hasMorePages(result_info) {
|
|
46077
|
-
const page = result_info?.page;
|
|
46078
|
-
const per_page = result_info?.per_page;
|
|
46079
|
-
const total = result_info?.total_count;
|
|
46080
|
-
return page !== void 0 && per_page !== void 0 && total !== void 0 && page * per_page < total;
|
|
46081
|
-
}
|
|
46082
|
-
__name$5(hasMorePages, "hasMorePages");
|
|
46083
|
-
function renderError(err, level = 0) {
|
|
46084
|
-
const indent = " ".repeat(level);
|
|
46085
|
-
const message = err.message ?? "";
|
|
46086
|
-
const chainedMessages = "error_chain" in err ? err.error_chain?.map((chainedError) => `
|
|
46087
|
-
|
|
46088
|
-
${indent}- ${renderError(chainedError, level + 1)}`).join("\n") ?? "" : "";
|
|
46089
|
-
return (err.code ? `${message} [code: ${err.code}]` : message) + (err.documentation_url ? `
|
|
46090
|
-
${indent}To learn more about this error, visit: ${err.documentation_url}` : "") + chainedMessages;
|
|
46091
|
-
}
|
|
46092
|
-
__name$5(renderError, "renderError");
|
|
46093
|
-
function addAuthorizationHeader(headers, auth, overrideExisting = false) {
|
|
46094
|
-
if (!headers.has("Authorization") || overrideExisting) if ("apiToken" in auth) {
|
|
46095
|
-
const authorizationHeader = `Bearer ${auth.apiToken}`;
|
|
46096
|
-
validateAuthorizationHeaderValue(authorizationHeader);
|
|
46097
|
-
headers.set("Authorization", authorizationHeader);
|
|
46098
|
-
} else {
|
|
46099
|
-
headers.set("X-Auth-Key", auth.authKey);
|
|
46100
|
-
headers.set("X-Auth-Email", auth.authEmail);
|
|
46101
|
-
}
|
|
46102
|
-
}
|
|
46103
|
-
__name$5(addAuthorizationHeader, "addAuthorizationHeader");
|
|
46104
|
-
function validateAuthorizationHeaderValue(value) {
|
|
46105
|
-
for (const character of value) {
|
|
46106
|
-
const codePoint = character.codePointAt(0);
|
|
46107
|
-
if (codePoint === void 0 || codePoint > 255) throw new UserError(`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" });
|
|
46108
|
-
}
|
|
46109
|
-
}
|
|
46110
|
-
__name$5(validateAuthorizationHeaderValue, "validateAuthorizationHeaderValue");
|
|
46111
|
-
function formatAuthorizationHeaderCharacter(character, codePoint) {
|
|
46112
|
-
if (codePoint === void 0) return "\"\\u{unknown}\"";
|
|
46113
|
-
const codePointLabel = `U+${codePoint.toString(16).toUpperCase().padStart(4, "0")}`;
|
|
46114
|
-
return `${isPrintableCharacter(character) ? `"${character}"` : `"${escapeCharacter(character)}"`} (${codePointLabel})`;
|
|
46115
|
-
}
|
|
46116
|
-
__name$5(formatAuthorizationHeaderCharacter, "formatAuthorizationHeaderCharacter");
|
|
46117
|
-
function isPrintableCharacter(character) {
|
|
46118
|
-
return !/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(character);
|
|
46119
|
-
}
|
|
46120
|
-
__name$5(isPrintableCharacter, "isPrintableCharacter");
|
|
46121
|
-
function escapeCharacter(character) {
|
|
46122
|
-
return Array.from(character).map((c$1) => {
|
|
46123
|
-
const codePoint = c$1.codePointAt(0);
|
|
46124
|
-
if (codePoint === void 0) return "";
|
|
46125
|
-
return codePoint <= 65535 ? `\\u${codePoint.toString(16).toUpperCase().padStart(4, "0")}` : `\\u{${codePoint.toString(16).toUpperCase()}}`;
|
|
46126
|
-
}).join("");
|
|
46127
|
-
}
|
|
46128
|
-
__name$5(escapeCharacter, "escapeCharacter");
|
|
46129
|
-
function throwFetchError(resource, response, status$1, retryAfterMs) {
|
|
46130
|
-
const errors$1 = response.errors ?? [];
|
|
46131
|
-
for (const error52 of errors$1) maybeThrowFriendlyError(error52);
|
|
46132
|
-
const notes = [...errors$1.map((err) => ({ text: renderError(err) })), ...response.messages?.map((msg) => ({ text: typeof msg === "string" ? msg : msg.message ?? String(msg) })) ?? []];
|
|
46133
|
-
if (notes.length === 0) {
|
|
46134
|
-
const raw = response;
|
|
46135
|
-
const fallbackMessage = typeof raw.error === "string" ? `${raw.error}${raw.code ? ` [code: ${raw.code}]` : ""}` : void 0;
|
|
46136
|
-
if (fallbackMessage) notes.push({ text: fallbackMessage });
|
|
46137
|
-
}
|
|
46138
|
-
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.` });
|
|
46139
|
-
const error51 = new APIError({
|
|
46140
|
-
text: `A request to the Cloudflare API (${resource}) failed.`,
|
|
46141
|
-
notes,
|
|
46142
|
-
status: status$1,
|
|
46143
|
-
retryAfterMs,
|
|
46144
|
-
telemetryMessage: false
|
|
46145
|
-
});
|
|
46146
|
-
const code = errors$1[0]?.code;
|
|
46147
|
-
if (code) error51.code = code;
|
|
46148
|
-
const meta3 = errors$1[0]?.meta;
|
|
46149
|
-
if (meta3) error51.meta = meta3;
|
|
46150
|
-
error51.accountTag = extractAccountTag(resource);
|
|
46151
|
-
throw error51;
|
|
46152
|
-
}
|
|
46153
|
-
__name$5(throwFetchError, "throwFetchError");
|
|
46154
|
-
function throwWAFBlockError(headers, method, resource, status$1, statusText, retryAfterMs) {
|
|
46155
|
-
const rayId = extractWAFBlockRayId(headers);
|
|
46156
|
-
throw new APIError({
|
|
46157
|
-
text: "The Cloudflare API responded with a WAF block page instead of the expected JSON response",
|
|
46158
|
-
notes: [
|
|
46159
|
-
{ text: "Cloudflare's firewall (WAF) blocked this API request. This is usually a false positive." },
|
|
46160
|
-
...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : [],
|
|
46161
|
-
{ 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." },
|
|
46162
|
-
{ text: `${method} ${resource} -> ${status$1} ${statusText}` }
|
|
46163
|
-
],
|
|
46164
|
-
status: status$1,
|
|
46165
|
-
retryAfterMs,
|
|
46166
|
-
telemetryMessage: false
|
|
46167
|
-
});
|
|
46168
|
-
}
|
|
46169
|
-
__name$5(throwWAFBlockError, "throwWAFBlockError");
|
|
46170
|
-
async function fetchKVGetValueBase(complianceConfig, accountId, namespaceId, key, userAgent, logger$1, credentials) {
|
|
46171
|
-
const headers = new import_undici$3.Headers();
|
|
46172
|
-
addAuthorizationHeader(headers, credentials);
|
|
46173
|
-
headers.set("User-Agent", userAgent);
|
|
46174
|
-
maybeAddTraceHeader(headers);
|
|
46175
|
-
const resource = `${getCloudflareApiBaseUrl(complianceConfig)}/accounts/${accountId}/storage/kv/namespaces/${namespaceId}/values/${key}`;
|
|
46176
|
-
logger$1.debug(`-- START CF API REQUEST: GET ${resource}`);
|
|
46177
|
-
logger$1.debug("-- END CF API REQUEST");
|
|
46178
|
-
const response = await (0, import_undici$3.fetch)(resource, {
|
|
46179
|
-
method: "GET",
|
|
46180
|
-
headers
|
|
46181
|
-
});
|
|
46182
|
-
if (response.ok) return await response.arrayBuffer();
|
|
46183
|
-
else throw new Error(`Failed to fetch ${resource} - ${response.status}: ${response.statusText}`);
|
|
46184
|
-
}
|
|
46185
|
-
__name$5(fetchKVGetValueBase, "fetchKVGetValueBase");
|
|
46186
|
-
function hasCursor(result_info) {
|
|
46187
|
-
const cursor$1 = result_info?.cursor;
|
|
46188
|
-
return cursor$1 !== void 0 && cursor$1 !== null && cursor$1 !== "";
|
|
46189
|
-
}
|
|
46190
|
-
__name$5(hasCursor, "hasCursor");
|
|
46191
|
-
function maybeAddTraceHeader(headers) {
|
|
46192
|
-
const traceHeader = getTraceHeader();
|
|
46193
|
-
if (traceHeader) headers.set("Cf-Trace-Id", traceHeader);
|
|
46194
|
-
}
|
|
46195
|
-
__name$5(maybeAddTraceHeader, "maybeAddTraceHeader");
|
|
46196
|
-
function cloneHeaders(headers) {
|
|
46197
|
-
return new import_undici$3.Headers(headers);
|
|
46198
|
-
}
|
|
46199
|
-
__name$5(cloneHeaders, "cloneHeaders");
|
|
46200
46354
|
var import_update_check = __toESM(require_update_check());
|
|
46201
46355
|
var UPDATE_CHECK_TIMEOUT_MS = 3e3;
|
|
46202
46356
|
var TIMED_OUT = Symbol("timed_out");
|
|
@@ -46220,7 +46374,7 @@ async function fetchLatestNpmVersion(name, version2) {
|
|
|
46220
46374
|
__name$5(fetchLatestNpmVersion, "fetchLatestNpmVersion");
|
|
46221
46375
|
async function openInBrowser(url2, logger$1) {
|
|
46222
46376
|
try {
|
|
46223
|
-
const { default: open$1 } = await import("./open-PBXRGS4R-
|
|
46377
|
+
const { default: open$1 } = await import("./open-PBXRGS4R-DFtj97wF.mjs");
|
|
46224
46378
|
(await open$1(url2)).on("error", (err) => {
|
|
46225
46379
|
handleBrowserOpenError(url2, err, logger$1);
|
|
46226
46380
|
});
|
|
@@ -50462,35 +50616,6 @@ function assertIsPreview(ctx) {
|
|
|
50462
50616
|
assert2(ctx.resolvedPluginConfig.type === "preview", `Expected "preview" plugin config`);
|
|
50463
50617
|
}
|
|
50464
50618
|
|
|
50465
|
-
//#endregion
|
|
50466
|
-
//#region ../config/dist/public-BwQqexwo.mjs
|
|
50467
|
-
const DEFINITION = Symbol.for("@cloudflare/config:definition");
|
|
50468
|
-
/**
|
|
50469
|
-
* Unwrap an authored config from its value / promise / function shape, awaiting
|
|
50470
|
-
* the result. A function config is invoked with {@link ConfigContext}.
|
|
50471
|
-
*/
|
|
50472
|
-
async function unwrap(config$2, ctx) {
|
|
50473
|
-
return typeof config$2 === "function" ? await config$2(ctx) : await config$2;
|
|
50474
|
-
}
|
|
50475
|
-
/**
|
|
50476
|
-
* Resolve any `cloudflare.config.ts` export to its plain config value.
|
|
50477
|
-
*
|
|
50478
|
-
* A `define*` helper stores its authored config plus `type` under the
|
|
50479
|
-
* {@link DEFINITION} symbol; here we unwrap the config and stamp `type` back on.
|
|
50480
|
-
* Every other export — a raw object/promise/function — is unwrapped as-is and
|
|
50481
|
-
* already carries its own `type`. Discrimination happens afterwards via `type`.
|
|
50482
|
-
*/
|
|
50483
|
-
async function resolveExportDefinition(def, ctx) {
|
|
50484
|
-
if (typeof def === "object" && def !== null && DEFINITION in def) {
|
|
50485
|
-
const { config: config$2, type } = def[DEFINITION];
|
|
50486
|
-
return {
|
|
50487
|
-
...await unwrap(config$2, ctx),
|
|
50488
|
-
type
|
|
50489
|
-
};
|
|
50490
|
-
}
|
|
50491
|
-
return await unwrap(def, ctx);
|
|
50492
|
-
}
|
|
50493
|
-
|
|
50494
50619
|
//#endregion
|
|
50495
50620
|
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
|
|
50496
50621
|
var _a$1;
|
|
@@ -50842,7 +50967,7 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
50842
50967
|
for (let i$1 = startIndex; i$1 < x.issues.length; i$1++) if (x.issues[i$1]?.continue === false) return true;
|
|
50843
50968
|
return false;
|
|
50844
50969
|
}
|
|
50845
|
-
function prefixIssues(path$2, issues) {
|
|
50970
|
+
function prefixIssues$1(path$2, issues) {
|
|
50846
50971
|
return issues.map((iss) => {
|
|
50847
50972
|
var _a$3;
|
|
50848
50973
|
(_a$3 = iss).path ?? (_a$3.path = []);
|
|
@@ -51975,7 +52100,7 @@ const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
|
51975
52100
|
};
|
|
51976
52101
|
});
|
|
51977
52102
|
function handleArrayResult(result, final, index) {
|
|
51978
|
-
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
52103
|
+
if (result.issues.length) final.issues.push(...prefixIssues$1(index, result.issues));
|
|
51979
52104
|
final.value[index] = result.value;
|
|
51980
52105
|
}
|
|
51981
52106
|
const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
@@ -52010,7 +52135,7 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
52010
52135
|
const isPresent = key in input;
|
|
52011
52136
|
if (result.issues.length) {
|
|
52012
52137
|
if (isOptionalIn && isOptionalOut && !isPresent) return;
|
|
52013
|
-
final.issues.push(...prefixIssues(key, result.issues));
|
|
52138
|
+
final.issues.push(...prefixIssues$1(key, result.issues));
|
|
52014
52139
|
}
|
|
52015
52140
|
if (!isPresent && !isOptionalIn) {
|
|
52016
52141
|
if (!result.issues.length) final.issues.push({
|
|
@@ -52500,11 +52625,11 @@ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
52500
52625
|
issues: []
|
|
52501
52626
|
}, ctx);
|
|
52502
52627
|
if (result instanceof Promise) proms.push(result.then((result$1) => {
|
|
52503
|
-
if (result$1.issues.length) payload.issues.push(...prefixIssues(key, result$1.issues));
|
|
52628
|
+
if (result$1.issues.length) payload.issues.push(...prefixIssues$1(key, result$1.issues));
|
|
52504
52629
|
payload.value[outKey] = result$1.value;
|
|
52505
52630
|
}));
|
|
52506
52631
|
else {
|
|
52507
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
52632
|
+
if (result.issues.length) payload.issues.push(...prefixIssues$1(key, result.issues));
|
|
52508
52633
|
payload.value[outKey] = result.value;
|
|
52509
52634
|
}
|
|
52510
52635
|
}
|
|
@@ -52554,11 +52679,11 @@ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
52554
52679
|
issues: []
|
|
52555
52680
|
}, ctx);
|
|
52556
52681
|
if (result instanceof Promise) proms.push(result.then((result$1) => {
|
|
52557
|
-
if (result$1.issues.length) payload.issues.push(...prefixIssues(key, result$1.issues));
|
|
52682
|
+
if (result$1.issues.length) payload.issues.push(...prefixIssues$1(key, result$1.issues));
|
|
52558
52683
|
payload.value[keyResult.value] = result$1.value;
|
|
52559
52684
|
}));
|
|
52560
52685
|
else {
|
|
52561
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
52686
|
+
if (result.issues.length) payload.issues.push(...prefixIssues$1(key, result.issues));
|
|
52562
52687
|
payload.value[keyResult.value] = result.value;
|
|
52563
52688
|
}
|
|
52564
52689
|
}
|
|
@@ -54101,6 +54226,7 @@ const initializer = (inst, issues) => {
|
|
|
54101
54226
|
} }
|
|
54102
54227
|
});
|
|
54103
54228
|
};
|
|
54229
|
+
const ZodError = /* @__PURE__ */ $constructor("ZodError", initializer);
|
|
54104
54230
|
const ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer, { Parent: Error });
|
|
54105
54231
|
|
|
54106
54232
|
//#endregion
|
|
@@ -55456,15 +55582,6 @@ const ConfigExportsTypeSchema = record(string(), unknown()).check((ctx) => {
|
|
|
55456
55582
|
});
|
|
55457
55583
|
}
|
|
55458
55584
|
});
|
|
55459
|
-
const ConfigExportsObjectSchema = object({ settings: InputSettingsSchema.optional() }).catchall(InputWorkerSchema);
|
|
55460
|
-
/**
|
|
55461
|
-
* Schema for the resolved config exports, keyed by export
|
|
55462
|
-
* name. Each value is discriminated on its `type` field. Reserves the
|
|
55463
|
-
* `settings` export name exclusively for settings configs: a `settings`
|
|
55464
|
-
* config must live on the `settings` export, and the `settings` export
|
|
55465
|
-
* may only hold a `settings` config.
|
|
55466
|
-
*/
|
|
55467
|
-
const ConfigExportsSchema = ConfigExportsTypeSchema.pipe(ConfigExportsObjectSchema);
|
|
55468
55585
|
const ModuleTypeSchema = _enum([
|
|
55469
55586
|
"esm",
|
|
55470
55587
|
"cjs",
|
|
@@ -55500,9 +55617,9 @@ const ManifestSchema = strictObject({
|
|
|
55500
55617
|
* base schema.
|
|
55501
55618
|
*/
|
|
55502
55619
|
const OutputWorkerSchema = BaseWorkerSchema.extend({ manifest: ManifestSchema.optional() });
|
|
55503
|
-
var import_dist = (/* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/dist/index.js": ((exports$
|
|
55504
|
-
Object.defineProperty(exports$
|
|
55505
|
-
exports$
|
|
55620
|
+
var import_dist = (/* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/dist/index.js": ((exports$1) => {
|
|
55621
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
55622
|
+
exports$1.dedent = void 0;
|
|
55506
55623
|
function dedent$1$1(templ) {
|
|
55507
55624
|
var values = [];
|
|
55508
55625
|
for (var _i = 1; _i < arguments.length; _i++) values[_i - 1] = arguments[_i];
|
|
@@ -55535,7 +55652,7 @@ var import_dist = (/* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ts-ded
|
|
|
55535
55652
|
});
|
|
55536
55653
|
return string$3;
|
|
55537
55654
|
}
|
|
55538
|
-
exports$
|
|
55655
|
+
exports$1.dedent = dedent$1$1;
|
|
55539
55656
|
}) }))();
|
|
55540
55657
|
/**
|
|
55541
55658
|
* Generate the content for worker-configuration.d.ts
|
|
@@ -56308,15 +56425,100 @@ function cleanupImportAttributes(context) {
|
|
|
56308
56425
|
context.importAttributes = attrs;
|
|
56309
56426
|
Object.freeze(context.importAttributes);
|
|
56310
56427
|
}
|
|
56428
|
+
const CROSS_WORKER_BINDING_TYPES = new Set([
|
|
56429
|
+
"durable-object",
|
|
56430
|
+
"worker",
|
|
56431
|
+
"workflow"
|
|
56432
|
+
]);
|
|
56433
|
+
function isRecord(value) {
|
|
56434
|
+
return typeof value === "object" && value !== null;
|
|
56435
|
+
}
|
|
56436
|
+
function isConfigReference(value) {
|
|
56437
|
+
return typeof value === "function" || isRecord(value);
|
|
56438
|
+
}
|
|
56439
|
+
function createDefinitionResolver(ctx) {
|
|
56440
|
+
const resolvedDefinitions = /* @__PURE__ */ new Map();
|
|
56441
|
+
return (input) => {
|
|
56442
|
+
const cached$2 = resolvedDefinitions.get(input);
|
|
56443
|
+
if (cached$2) return cached$2;
|
|
56444
|
+
const resolved = (async () => {
|
|
56445
|
+
return await (typeof input === "function" ? input(ctx) : input);
|
|
56446
|
+
})();
|
|
56447
|
+
resolvedDefinitions.set(input, resolved);
|
|
56448
|
+
return resolved;
|
|
56449
|
+
};
|
|
56450
|
+
}
|
|
56451
|
+
async function normalizeWorkerReferences(resolved, resolveDefinition) {
|
|
56452
|
+
if (!isRecord(resolved) || !isRecord(resolved.env)) return resolved;
|
|
56453
|
+
const env$3 = { ...resolved.env };
|
|
56454
|
+
for (const [bindingName, binding] of Object.entries(env$3)) {
|
|
56455
|
+
if (!isRecord(binding) || typeof binding.type !== "string" || !CROSS_WORKER_BINDING_TYPES.has(binding.type) || !isConfigReference(binding.worker)) continue;
|
|
56456
|
+
const target$1 = await resolveDefinition(binding.worker);
|
|
56457
|
+
env$3[bindingName] = {
|
|
56458
|
+
...binding,
|
|
56459
|
+
worker: isRecord(target$1) ? target$1.name : void 0
|
|
56460
|
+
};
|
|
56461
|
+
}
|
|
56462
|
+
return {
|
|
56463
|
+
...resolved,
|
|
56464
|
+
env: env$3
|
|
56465
|
+
};
|
|
56466
|
+
}
|
|
56467
|
+
function prefixIssues(issues, prefix) {
|
|
56468
|
+
return issues.map((issue$2) => ({
|
|
56469
|
+
...issue$2,
|
|
56470
|
+
path: [prefix, ...issue$2.path]
|
|
56471
|
+
}));
|
|
56472
|
+
}
|
|
56473
|
+
/**
|
|
56474
|
+
* Resolve and validate loaded `cloudflare.config.ts` exports.
|
|
56475
|
+
*
|
|
56476
|
+
* Config inputs are resolved once by identity. Top-level Worker exports are
|
|
56477
|
+
* also parsed once by identity; unexported references are resolved only far
|
|
56478
|
+
* enough to replace the reference with the Worker's name.
|
|
56479
|
+
*/
|
|
56480
|
+
async function resolveAndValidateConfigExports(exports$2, ctx) {
|
|
56481
|
+
const resolveDefinition = createDefinitionResolver(ctx);
|
|
56482
|
+
const parsedWorkers = /* @__PURE__ */ new Map();
|
|
56483
|
+
const resolvedExports = {};
|
|
56484
|
+
for (const [name, input] of Object.entries(exports$2)) resolvedExports[name] = await resolveDefinition(input);
|
|
56485
|
+
const typeResult = ConfigExportsTypeSchema.safeParse(resolvedExports);
|
|
56486
|
+
if (!typeResult.success) return typeResult;
|
|
56487
|
+
const issues = [];
|
|
56488
|
+
const data$1 = {};
|
|
56489
|
+
const resolvedSettings = resolvedExports.settings;
|
|
56490
|
+
const settingsResult = resolvedSettings ? InputSettingsSchema.safeParse(resolvedSettings) : void 0;
|
|
56491
|
+
if (settingsResult) if (settingsResult.success) data$1.settings = settingsResult.data;
|
|
56492
|
+
else issues.push(...prefixIssues(settingsResult.error.issues, "settings"));
|
|
56493
|
+
for (const [name, input] of Object.entries(exports$2)) {
|
|
56494
|
+
const resolved = resolvedExports[name];
|
|
56495
|
+
if (!isRecord(resolved)) continue;
|
|
56496
|
+
if (resolved.type === "worker") {
|
|
56497
|
+
let result = parsedWorkers.get(input);
|
|
56498
|
+
if (!result) {
|
|
56499
|
+
result = InputWorkerSchema.safeParse(await normalizeWorkerReferences(resolved, resolveDefinition));
|
|
56500
|
+
parsedWorkers.set(input, result);
|
|
56501
|
+
if (!result.success) issues.push(...prefixIssues(result.error.issues, name));
|
|
56502
|
+
}
|
|
56503
|
+
if (result.success) data$1[name] = result.data;
|
|
56504
|
+
continue;
|
|
56505
|
+
}
|
|
56506
|
+
}
|
|
56507
|
+
return issues.length > 0 ? {
|
|
56508
|
+
success: false,
|
|
56509
|
+
error: new ZodError(issues)
|
|
56510
|
+
} : {
|
|
56511
|
+
success: true,
|
|
56512
|
+
data: data$1
|
|
56513
|
+
};
|
|
56514
|
+
}
|
|
56311
56515
|
/**
|
|
56312
|
-
* Load a `cloudflare.config.ts`, resolve all exports, and validate
|
|
56516
|
+
* Load a `cloudflare.config.ts`, resolve all exports, and validate them.
|
|
56313
56517
|
*/
|
|
56314
56518
|
async function loadAndValidateConfig(configPath, ctx, options) {
|
|
56315
56519
|
const { exports: exports$2, dependencies } = await loadConfig(configPath, options);
|
|
56316
|
-
const resolved = {};
|
|
56317
|
-
for (const [name, value] of Object.entries(exports$2)) resolved[name] = await resolveExportDefinition(value, ctx);
|
|
56318
56520
|
return {
|
|
56319
|
-
result:
|
|
56521
|
+
result: await resolveAndValidateConfigExports(exports$2, ctx),
|
|
56320
56522
|
dependencies
|
|
56321
56523
|
};
|
|
56322
56524
|
}
|
|
@@ -58428,10 +58630,10 @@ pp$9.isSimpleAssignTarget = function(expr) {
|
|
|
58428
58630
|
};
|
|
58429
58631
|
var pp$8 = Parser.prototype;
|
|
58430
58632
|
pp$8.parseTopLevel = function(node) {
|
|
58431
|
-
var exports$
|
|
58633
|
+
var exports$1 = Object.create(null);
|
|
58432
58634
|
if (!node.body) node.body = [];
|
|
58433
58635
|
while (this.type !== types$1$1.eof) {
|
|
58434
|
-
var stmt = this.parseStatement(null, true, exports$
|
|
58636
|
+
var stmt = this.parseStatement(null, true, exports$1);
|
|
58435
58637
|
node.body.push(stmt);
|
|
58436
58638
|
}
|
|
58437
58639
|
if (this.inModule) for (var i$1 = 0, list$1 = Object.keys(this.undefinedExports); i$1 < list$1.length; i$1 += 1) {
|
|
@@ -58501,7 +58703,7 @@ pp$8.isAwaitUsing = function(isFor) {
|
|
|
58501
58703
|
pp$8.isUsing = function(isFor) {
|
|
58502
58704
|
return this.isUsingKeyword(false, isFor);
|
|
58503
58705
|
};
|
|
58504
|
-
pp$8.parseStatement = function(context, topLevel, exports$
|
|
58706
|
+
pp$8.parseStatement = function(context, topLevel, exports$1) {
|
|
58505
58707
|
var starttype = this.type, node = this.startNode(), kind;
|
|
58506
58708
|
if (this.isLet(context)) {
|
|
58507
58709
|
starttype = types$1$1._var;
|
|
@@ -58545,7 +58747,7 @@ pp$8.parseStatement = function(context, topLevel, exports$2) {
|
|
|
58545
58747
|
if (!topLevel) this.raise(this.start, "'import' and 'export' may only appear at the top level");
|
|
58546
58748
|
if (!this.inModule) this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
|
|
58547
58749
|
}
|
|
58548
|
-
return starttype === types$1$1._import ? this.parseImport(node) : this.parseExport(node, exports$
|
|
58750
|
+
return starttype === types$1$1._import ? this.parseImport(node) : this.parseExport(node, exports$1);
|
|
58549
58751
|
default:
|
|
58550
58752
|
if (this.isAsyncFunction()) {
|
|
58551
58753
|
if (context) this.unexpected();
|
|
@@ -59060,10 +59262,10 @@ function checkKeyName(node, name) {
|
|
|
59060
59262
|
var key = node.key;
|
|
59061
59263
|
return !computed && (key.type === "Identifier" && key.name === name || key.type === "Literal" && key.value === name);
|
|
59062
59264
|
}
|
|
59063
|
-
pp$8.parseExportAllDeclaration = function(node, exports$
|
|
59265
|
+
pp$8.parseExportAllDeclaration = function(node, exports$1) {
|
|
59064
59266
|
if (this.options.ecmaVersion >= 11) if (this.eatContextual("as")) {
|
|
59065
59267
|
node.exported = this.parseModuleExportName();
|
|
59066
|
-
this.checkExport(exports$
|
|
59268
|
+
this.checkExport(exports$1, node.exported, this.lastTokStart);
|
|
59067
59269
|
} else node.exported = null;
|
|
59068
59270
|
this.expectContextual("from");
|
|
59069
59271
|
if (this.type !== types$1$1.string) this.unexpected();
|
|
@@ -59072,24 +59274,24 @@ pp$8.parseExportAllDeclaration = function(node, exports$2) {
|
|
|
59072
59274
|
this.semicolon();
|
|
59073
59275
|
return this.finishNode(node, "ExportAllDeclaration");
|
|
59074
59276
|
};
|
|
59075
|
-
pp$8.parseExport = function(node, exports$
|
|
59277
|
+
pp$8.parseExport = function(node, exports$1) {
|
|
59076
59278
|
this.next();
|
|
59077
|
-
if (this.eat(types$1$1.star)) return this.parseExportAllDeclaration(node, exports$
|
|
59279
|
+
if (this.eat(types$1$1.star)) return this.parseExportAllDeclaration(node, exports$1);
|
|
59078
59280
|
if (this.eat(types$1$1._default)) {
|
|
59079
|
-
this.checkExport(exports$
|
|
59281
|
+
this.checkExport(exports$1, "default", this.lastTokStart);
|
|
59080
59282
|
node.declaration = this.parseExportDefaultDeclaration();
|
|
59081
59283
|
return this.finishNode(node, "ExportDefaultDeclaration");
|
|
59082
59284
|
}
|
|
59083
59285
|
if (this.shouldParseExportStatement()) {
|
|
59084
59286
|
node.declaration = this.parseExportDeclaration(node);
|
|
59085
|
-
if (node.declaration.type === "VariableDeclaration") this.checkVariableExport(exports$
|
|
59086
|
-
else this.checkExport(exports$
|
|
59287
|
+
if (node.declaration.type === "VariableDeclaration") this.checkVariableExport(exports$1, node.declaration.declarations);
|
|
59288
|
+
else this.checkExport(exports$1, node.declaration.id, node.declaration.id.start);
|
|
59087
59289
|
node.specifiers = [];
|
|
59088
59290
|
node.source = null;
|
|
59089
59291
|
if (this.options.ecmaVersion >= 16) node.attributes = [];
|
|
59090
59292
|
} else {
|
|
59091
59293
|
node.declaration = null;
|
|
59092
|
-
node.specifiers = this.parseExportSpecifiers(exports$
|
|
59294
|
+
node.specifiers = this.parseExportSpecifiers(exports$1);
|
|
59093
59295
|
if (this.eatContextual("from")) {
|
|
59094
59296
|
if (this.type !== types$1$1.string) this.unexpected();
|
|
59095
59297
|
node.source = this.parseExprAtom();
|
|
@@ -59127,45 +59329,45 @@ pp$8.parseExportDefaultDeclaration = function() {
|
|
|
59127
59329
|
return declaration;
|
|
59128
59330
|
}
|
|
59129
59331
|
};
|
|
59130
|
-
pp$8.checkExport = function(exports$
|
|
59131
|
-
if (!exports$
|
|
59332
|
+
pp$8.checkExport = function(exports$1, name, pos) {
|
|
59333
|
+
if (!exports$1) return;
|
|
59132
59334
|
if (typeof name !== "string") name = name.type === "Identifier" ? name.name : name.value;
|
|
59133
|
-
if (hasOwn(exports$
|
|
59134
|
-
exports$
|
|
59335
|
+
if (hasOwn(exports$1, name)) this.raiseRecoverable(pos, "Duplicate export '" + name + "'");
|
|
59336
|
+
exports$1[name] = true;
|
|
59135
59337
|
};
|
|
59136
|
-
pp$8.checkPatternExport = function(exports$
|
|
59338
|
+
pp$8.checkPatternExport = function(exports$1, pat) {
|
|
59137
59339
|
var type = pat.type;
|
|
59138
|
-
if (type === "Identifier") this.checkExport(exports$
|
|
59340
|
+
if (type === "Identifier") this.checkExport(exports$1, pat, pat.start);
|
|
59139
59341
|
else if (type === "ObjectPattern") for (var i$1 = 0, list$1 = pat.properties; i$1 < list$1.length; i$1 += 1) {
|
|
59140
59342
|
var prop = list$1[i$1];
|
|
59141
|
-
this.checkPatternExport(exports$
|
|
59343
|
+
this.checkPatternExport(exports$1, prop);
|
|
59142
59344
|
}
|
|
59143
59345
|
else if (type === "ArrayPattern") for (var i$1$1 = 0, list$1$1 = pat.elements; i$1$1 < list$1$1.length; i$1$1 += 1) {
|
|
59144
59346
|
var elt = list$1$1[i$1$1];
|
|
59145
|
-
if (elt) this.checkPatternExport(exports$
|
|
59347
|
+
if (elt) this.checkPatternExport(exports$1, elt);
|
|
59146
59348
|
}
|
|
59147
|
-
else if (type === "Property") this.checkPatternExport(exports$
|
|
59148
|
-
else if (type === "AssignmentPattern") this.checkPatternExport(exports$
|
|
59149
|
-
else if (type === "RestElement") this.checkPatternExport(exports$
|
|
59349
|
+
else if (type === "Property") this.checkPatternExport(exports$1, pat.value);
|
|
59350
|
+
else if (type === "AssignmentPattern") this.checkPatternExport(exports$1, pat.left);
|
|
59351
|
+
else if (type === "RestElement") this.checkPatternExport(exports$1, pat.argument);
|
|
59150
59352
|
};
|
|
59151
|
-
pp$8.checkVariableExport = function(exports$
|
|
59152
|
-
if (!exports$
|
|
59353
|
+
pp$8.checkVariableExport = function(exports$1, decls) {
|
|
59354
|
+
if (!exports$1) return;
|
|
59153
59355
|
for (var i$1 = 0, list$1 = decls; i$1 < list$1.length; i$1 += 1) {
|
|
59154
59356
|
var decl = list$1[i$1];
|
|
59155
|
-
this.checkPatternExport(exports$
|
|
59357
|
+
this.checkPatternExport(exports$1, decl.id);
|
|
59156
59358
|
}
|
|
59157
59359
|
};
|
|
59158
59360
|
pp$8.shouldParseExportStatement = function() {
|
|
59159
59361
|
return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction();
|
|
59160
59362
|
};
|
|
59161
|
-
pp$8.parseExportSpecifier = function(exports$
|
|
59363
|
+
pp$8.parseExportSpecifier = function(exports$1) {
|
|
59162
59364
|
var node = this.startNode();
|
|
59163
59365
|
node.local = this.parseModuleExportName();
|
|
59164
59366
|
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
|
|
59165
|
-
this.checkExport(exports$
|
|
59367
|
+
this.checkExport(exports$1, node.exported, node.exported.start);
|
|
59166
59368
|
return this.finishNode(node, "ExportSpecifier");
|
|
59167
59369
|
};
|
|
59168
|
-
pp$8.parseExportSpecifiers = function(exports$
|
|
59370
|
+
pp$8.parseExportSpecifiers = function(exports$1) {
|
|
59169
59371
|
var nodes = [], first = true;
|
|
59170
59372
|
this.expect(types$1$1.braceL);
|
|
59171
59373
|
while (!this.eat(types$1$1.braceR)) {
|
|
@@ -59173,7 +59375,7 @@ pp$8.parseExportSpecifiers = function(exports$2) {
|
|
|
59173
59375
|
this.expect(types$1$1.comma);
|
|
59174
59376
|
if (this.afterTrailingComma(types$1$1.braceR)) break;
|
|
59175
59377
|
} else first = false;
|
|
59176
|
-
nodes.push(this.parseExportSpecifier(exports$
|
|
59378
|
+
nodes.push(this.parseExportSpecifier(exports$1));
|
|
59177
59379
|
}
|
|
59178
59380
|
return nodes;
|
|
59179
59381
|
};
|
|
@@ -62895,10 +63097,10 @@ function resolvePackageTarget(packageJsonUrl, target$1, subpath, packageSubpath,
|
|
|
62895
63097
|
* @param {URL} base
|
|
62896
63098
|
* @returns {boolean}
|
|
62897
63099
|
*/
|
|
62898
|
-
function isConditionalExportsMainSugar(exports$
|
|
62899
|
-
if (typeof exports$
|
|
62900
|
-
if (typeof exports$
|
|
62901
|
-
const keys = Object.getOwnPropertyNames(exports$
|
|
63100
|
+
function isConditionalExportsMainSugar(exports$1, packageJsonUrl, base) {
|
|
63101
|
+
if (typeof exports$1 === "string" || Array.isArray(exports$1)) return true;
|
|
63102
|
+
if (typeof exports$1 !== "object" || exports$1 === null) return false;
|
|
63103
|
+
const keys = Object.getOwnPropertyNames(exports$1);
|
|
62902
63104
|
let isConditionalSugar = false;
|
|
62903
63105
|
let i$1 = 0;
|
|
62904
63106
|
let keyIndex = -1;
|
|
@@ -62931,17 +63133,17 @@ function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {
|
|
|
62931
63133
|
* @returns {URL}
|
|
62932
63134
|
*/
|
|
62933
63135
|
function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions) {
|
|
62934
|
-
let exports$
|
|
62935
|
-
if (isConditionalExportsMainSugar(exports$
|
|
62936
|
-
if (own.call(exports$
|
|
62937
|
-
const target$1 = exports$
|
|
63136
|
+
let exports$1 = packageConfig.exports;
|
|
63137
|
+
if (isConditionalExportsMainSugar(exports$1, packageJsonUrl, base)) exports$1 = { ".": exports$1 };
|
|
63138
|
+
if (own.call(exports$1, packageSubpath) && !packageSubpath.includes("*") && !packageSubpath.endsWith("/")) {
|
|
63139
|
+
const target$1 = exports$1[packageSubpath];
|
|
62938
63140
|
const resolveResult = resolvePackageTarget(packageJsonUrl, target$1, "", packageSubpath, base, false, false, false, conditions);
|
|
62939
63141
|
if (resolveResult === null || resolveResult === void 0) throw exportsNotFound(packageSubpath, packageJsonUrl, base);
|
|
62940
63142
|
return resolveResult;
|
|
62941
63143
|
}
|
|
62942
63144
|
let bestMatch = "";
|
|
62943
63145
|
let bestMatchSubpath = "";
|
|
62944
|
-
const keys = Object.getOwnPropertyNames(exports$
|
|
63146
|
+
const keys = Object.getOwnPropertyNames(exports$1);
|
|
62945
63147
|
let i$1 = -1;
|
|
62946
63148
|
while (++i$1 < keys.length) {
|
|
62947
63149
|
const key = keys[i$1];
|
|
@@ -62956,7 +63158,7 @@ function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, ba
|
|
|
62956
63158
|
}
|
|
62957
63159
|
}
|
|
62958
63160
|
if (bestMatch) {
|
|
62959
|
-
const target$1 = exports$
|
|
63161
|
+
const target$1 = exports$1[bestMatch];
|
|
62960
63162
|
const resolveResult = resolvePackageTarget(packageJsonUrl, target$1, bestMatchSubpath, bestMatch, base, true, false, packageSubpath.endsWith("/"), conditions);
|
|
62961
63163
|
if (resolveResult === null || resolveResult === void 0) throw exportsNotFound(packageSubpath, packageJsonUrl, base);
|
|
62962
63164
|
return resolveResult;
|
|
@@ -69795,10 +69997,10 @@ function getDockerPath() {
|
|
|
69795
69997
|
* or pull, and callers treat them alike.
|
|
69796
69998
|
*/
|
|
69797
69999
|
function getContainerOptions(options) {
|
|
69798
|
-
const { containersConfig, exports: exports$
|
|
70000
|
+
const { containersConfig, exports: exports$1, containerBuildId, configPath } = options;
|
|
69799
70001
|
if (!containersConfig?.length) return;
|
|
69800
70002
|
return containersConfig.map((container) => {
|
|
69801
|
-
const className = resolveContainerClassName(container, exports$
|
|
70003
|
+
const className = resolveContainerClassName(container, exports$1);
|
|
69802
70004
|
if (className === void 0) return;
|
|
69803
70005
|
const image_tag = getDevContainerImageName(className, containerBuildId);
|
|
69804
70006
|
if (isDockerfile(container.image, configPath)) return {
|
|
@@ -73635,7 +73837,7 @@ function createOAuthFlow(ctx) {
|
|
|
73635
73837
|
__name$1(createOAuthFlow, "createOAuthFlow");
|
|
73636
73838
|
var RESERVED_PROFILE_NAMES = ["default", "staging"];
|
|
73637
73839
|
function createProfileStore(args) {
|
|
73638
|
-
const bindings
|
|
73840
|
+
const bindings = {
|
|
73639
73841
|
read() {
|
|
73640
73842
|
return args.bindings.read();
|
|
73641
73843
|
},
|
|
@@ -73701,14 +73903,14 @@ function createProfileStore(args) {
|
|
|
73701
73903
|
};
|
|
73702
73904
|
return {
|
|
73703
73905
|
configs: args.configs,
|
|
73704
|
-
bindings
|
|
73906
|
+
bindings,
|
|
73705
73907
|
resolve(resolveArgs) {
|
|
73706
73908
|
if (resolveArgs.profile) {
|
|
73707
73909
|
if (resolveArgs.profile === "default") return "default";
|
|
73708
73910
|
validateProfileName(resolveArgs.profile);
|
|
73709
73911
|
return resolveArgs.profile;
|
|
73710
73912
|
}
|
|
73711
|
-
const dirProfile = bindings
|
|
73913
|
+
const dirProfile = bindings.getProfileForDirectory(resolveArgs.cwd);
|
|
73712
73914
|
if (dirProfile) return dirProfile;
|
|
73713
73915
|
return "default";
|
|
73714
73916
|
}
|
|
@@ -73724,9 +73926,9 @@ function formatDirectoryForUserError(dir$1) {
|
|
|
73724
73926
|
return path__default.relative(process.cwd(), dir$1) || ".";
|
|
73725
73927
|
}
|
|
73726
73928
|
__name$1(formatDirectoryForUserError, "formatDirectoryForUserError");
|
|
73727
|
-
function getProfileForDirectoryFromBindings(startDir, bindings
|
|
73929
|
+
function getProfileForDirectoryFromBindings(startDir, bindings) {
|
|
73728
73930
|
const normalizedDir = path__default.resolve(startDir);
|
|
73729
|
-
const sortedEntries = Object.entries(bindings
|
|
73931
|
+
const sortedEntries = Object.entries(bindings).sort(([a], [b]) => b.length - a.length);
|
|
73730
73932
|
for (const [boundDir, profile] of sortedEntries) {
|
|
73731
73933
|
if (normalizedDir === boundDir) return {
|
|
73732
73934
|
profile,
|
|
@@ -76811,7 +77013,7 @@ function fromMimeType(mimeType) {
|
|
|
76811
77013
|
return moduleType;
|
|
76812
77014
|
}
|
|
76813
77015
|
__name(fromMimeType, "fromMimeType");
|
|
76814
|
-
function createWorkerUploadForm(worker, bindings
|
|
77016
|
+
function createWorkerUploadForm(worker, bindings, options) {
|
|
76815
77017
|
const formData = new import_undici$1.FormData();
|
|
76816
77018
|
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$2, package_dependencies } = worker;
|
|
76817
77019
|
const assetConfig = {
|
|
@@ -76835,47 +77037,47 @@ function createWorkerUploadForm(worker, bindings$1, options) {
|
|
|
76835
77037
|
}
|
|
76836
77038
|
let { modules } = worker;
|
|
76837
77039
|
const metadataBindings = [];
|
|
76838
|
-
const plain_text = extractBindingsOfType("plain_text", bindings
|
|
76839
|
-
const json_bindings = extractBindingsOfType("json", bindings
|
|
76840
|
-
const secret_text = extractBindingsOfType("secret_text", bindings
|
|
76841
|
-
const kv_namespaces = extractBindingsOfType("kv_namespace", bindings
|
|
76842
|
-
const send_email = extractBindingsOfType("send_email", bindings
|
|
76843
|
-
const durable_objects = extractBindingsOfType("durable_object_namespace", bindings
|
|
76844
|
-
const workflows = extractBindingsOfType("workflow", bindings
|
|
76845
|
-
const queues = extractBindingsOfType("queue", bindings
|
|
76846
|
-
const r2_buckets = extractBindingsOfType("r2_bucket", bindings
|
|
76847
|
-
const d1_databases = extractBindingsOfType("d1", bindings
|
|
76848
|
-
const vectorize = extractBindingsOfType("vectorize", bindings
|
|
76849
|
-
const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings
|
|
76850
|
-
const ai_search = extractBindingsOfType("ai_search", bindings
|
|
76851
|
-
const websearch = extractBindingsOfType("websearch", bindings
|
|
76852
|
-
const agent_memory = extractBindingsOfType("agent_memory", bindings
|
|
76853
|
-
const hyperdrive = extractBindingsOfType("hyperdrive", bindings
|
|
76854
|
-
const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings
|
|
76855
|
-
const artifacts = extractBindingsOfType("artifacts", bindings
|
|
76856
|
-
const unsafe_hello_world = extractBindingsOfType("unsafe_hello_world", bindings
|
|
76857
|
-
const flagship = extractBindingsOfType("flagship", bindings
|
|
76858
|
-
const ratelimits = extractBindingsOfType("ratelimit", bindings
|
|
76859
|
-
const vpc_services = extractBindingsOfType("vpc_service", bindings
|
|
76860
|
-
const vpc_networks = extractBindingsOfType("vpc_network", bindings
|
|
76861
|
-
const services = extractBindingsOfType("service", bindings
|
|
76862
|
-
const analytics_engine_datasets = extractBindingsOfType("analytics_engine", bindings
|
|
76863
|
-
const dispatch_namespaces = extractBindingsOfType("dispatch_namespace", bindings
|
|
76864
|
-
const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings
|
|
76865
|
-
const pipelines = extractBindingsOfType("pipeline", bindings
|
|
76866
|
-
const worker_loaders = extractBindingsOfType("worker_loader", bindings
|
|
76867
|
-
const logfwdr = extractBindingsOfType("logfwdr", bindings
|
|
76868
|
-
const wasm_modules = extractBindingsOfType("wasm_module", bindings
|
|
76869
|
-
const browser = extractBindingsOfType("browser", bindings
|
|
76870
|
-
const ai = extractBindingsOfType("ai", bindings
|
|
76871
|
-
const images = extractBindingsOfType("images", bindings
|
|
76872
|
-
const stream$2 = extractBindingsOfType("stream", bindings
|
|
76873
|
-
const media = extractBindingsOfType("media", bindings
|
|
76874
|
-
const version_metadata = extractBindingsOfType("version_metadata", bindings
|
|
76875
|
-
const assetsBinding = extractBindingsOfType("assets", bindings
|
|
76876
|
-
const text_blobs = extractBindingsOfType("text_blob", bindings
|
|
76877
|
-
const data_blobs = extractBindingsOfType("data_blob", bindings
|
|
76878
|
-
extractBindingsOfType("inherit", bindings
|
|
77040
|
+
const plain_text = extractBindingsOfType("plain_text", bindings);
|
|
77041
|
+
const json_bindings = extractBindingsOfType("json", bindings);
|
|
77042
|
+
const secret_text = extractBindingsOfType("secret_text", bindings);
|
|
77043
|
+
const kv_namespaces = extractBindingsOfType("kv_namespace", bindings);
|
|
77044
|
+
const send_email = extractBindingsOfType("send_email", bindings);
|
|
77045
|
+
const durable_objects = extractBindingsOfType("durable_object_namespace", bindings);
|
|
77046
|
+
const workflows = extractBindingsOfType("workflow", bindings);
|
|
77047
|
+
const queues = extractBindingsOfType("queue", bindings);
|
|
77048
|
+
const r2_buckets = extractBindingsOfType("r2_bucket", bindings);
|
|
77049
|
+
const d1_databases = extractBindingsOfType("d1", bindings);
|
|
77050
|
+
const vectorize = extractBindingsOfType("vectorize", bindings);
|
|
77051
|
+
const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings);
|
|
77052
|
+
const ai_search = extractBindingsOfType("ai_search", bindings);
|
|
77053
|
+
const websearch = extractBindingsOfType("websearch", bindings)[0];
|
|
77054
|
+
const agent_memory = extractBindingsOfType("agent_memory", bindings);
|
|
77055
|
+
const hyperdrive = extractBindingsOfType("hyperdrive", bindings);
|
|
77056
|
+
const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings);
|
|
77057
|
+
const artifacts = extractBindingsOfType("artifacts", bindings);
|
|
77058
|
+
const unsafe_hello_world = extractBindingsOfType("unsafe_hello_world", bindings);
|
|
77059
|
+
const flagship = extractBindingsOfType("flagship", bindings);
|
|
77060
|
+
const ratelimits = extractBindingsOfType("ratelimit", bindings);
|
|
77061
|
+
const vpc_services = extractBindingsOfType("vpc_service", bindings);
|
|
77062
|
+
const vpc_networks = extractBindingsOfType("vpc_network", bindings);
|
|
77063
|
+
const services = extractBindingsOfType("service", bindings);
|
|
77064
|
+
const analytics_engine_datasets = extractBindingsOfType("analytics_engine", bindings);
|
|
77065
|
+
const dispatch_namespaces = extractBindingsOfType("dispatch_namespace", bindings);
|
|
77066
|
+
const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings);
|
|
77067
|
+
const pipelines = extractBindingsOfType("pipeline", bindings);
|
|
77068
|
+
const worker_loaders = extractBindingsOfType("worker_loader", bindings);
|
|
77069
|
+
const logfwdr = extractBindingsOfType("logfwdr", bindings);
|
|
77070
|
+
const wasm_modules = extractBindingsOfType("wasm_module", bindings);
|
|
77071
|
+
const browser = extractBindingsOfType("browser", bindings)[0];
|
|
77072
|
+
const ai = extractBindingsOfType("ai", bindings)[0];
|
|
77073
|
+
const images = extractBindingsOfType("images", bindings)[0];
|
|
77074
|
+
const stream$2 = extractBindingsOfType("stream", bindings)[0];
|
|
77075
|
+
const media = extractBindingsOfType("media", bindings)[0];
|
|
77076
|
+
const version_metadata = extractBindingsOfType("version_metadata", bindings)[0];
|
|
77077
|
+
const assetsBinding = extractBindingsOfType("assets", bindings)[0];
|
|
77078
|
+
const text_blobs = extractBindingsOfType("text_blob", bindings);
|
|
77079
|
+
const data_blobs = extractBindingsOfType("data_blob", bindings);
|
|
77080
|
+
extractBindingsOfType("inherit", bindings).forEach(({ binding }) => {
|
|
76879
77081
|
metadataBindings.push({
|
|
76880
77082
|
name: binding,
|
|
76881
77083
|
type: "inherit"
|
|
@@ -77232,7 +77434,7 @@ function createWorkerUploadForm(worker, bindings$1, options) {
|
|
|
77232
77434
|
});
|
|
77233
77435
|
formData.set(name, new File(["contents" in source ? source.contents : readFileSync(source.path)], "path" in source ? source.path ?? name : name, { type: "application/octet-stream" }));
|
|
77234
77436
|
});
|
|
77235
|
-
for (const [bindingName, config$2] of Object.entries(bindings
|
|
77437
|
+
for (const [bindingName, config$2] of Object.entries(bindings ?? {})) if (isUnsafeBindingType(config$2.type) && config$2.type !== "unsafe_hello_world") {
|
|
77236
77438
|
const { type,...data$1 } = config$2;
|
|
77237
77439
|
metadataBindings.push({
|
|
77238
77440
|
name: bindingName,
|
|
@@ -77330,7 +77532,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
|
|
|
77330
77532
|
//#endregion
|
|
77331
77533
|
//#region ../remote-bindings/dist/index.mjs
|
|
77332
77534
|
var import_undici = require_undici();
|
|
77333
|
-
var version$2 = "0.0.
|
|
77535
|
+
var version$2 = "0.0.21";
|
|
77334
77536
|
var NoDefaultValueProvided = class extends UserError {
|
|
77335
77537
|
constructor() {
|
|
77336
77538
|
super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
|
|
@@ -77771,7 +77973,7 @@ function handlePreviewSessionCreationError(err, accountId) {
|
|
|
77771
77973
|
* (flat Record<string, Binding>).
|
|
77772
77974
|
*/
|
|
77773
77975
|
function createRemoteWorkerInit(props) {
|
|
77774
|
-
const bindings
|
|
77976
|
+
const bindings = { ...props.bindings };
|
|
77775
77977
|
return {
|
|
77776
77978
|
name: props.name,
|
|
77777
77979
|
main: {
|
|
@@ -77781,7 +77983,7 @@ function createRemoteWorkerInit(props) {
|
|
|
77781
77983
|
content: props.bundle.entrypointSource
|
|
77782
77984
|
},
|
|
77783
77985
|
modules: props.bundle.modules,
|
|
77784
|
-
bindings
|
|
77986
|
+
bindings,
|
|
77785
77987
|
migrations: void 0,
|
|
77786
77988
|
exports: void 0,
|
|
77787
77989
|
compatibility_date: props.compatibilityDate,
|
|
@@ -78104,11 +78306,11 @@ function findRemoteSessionAuthError(error$2) {
|
|
|
78104
78306
|
if (isErrorEvent(error$2)) return findRemoteSessionAuthError(error$2.cause);
|
|
78105
78307
|
if (error$2 instanceof Error) return findRemoteSessionAuthError(error$2.cause);
|
|
78106
78308
|
}
|
|
78107
|
-
async function startRemoteProxySession(bindings
|
|
78108
|
-
for (const [name, binding] of Object.entries(bindings
|
|
78309
|
+
async function startRemoteProxySession(bindings, options) {
|
|
78310
|
+
for (const [name, binding] of Object.entries(bindings ?? {})) if (binding.type === "flagship" && binding.app_id === void 0) throw new UserError(`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" });
|
|
78109
78311
|
options.logger.log(source_default.dim("⎔ Establishing remote connection..."));
|
|
78110
78312
|
initLogger(getInternalLogger(options.logger));
|
|
78111
|
-
const rawBindings = toRawBindings(bindings
|
|
78313
|
+
const rawBindings = toRawBindings(bindings);
|
|
78112
78314
|
const workerConfig = {
|
|
78113
78315
|
name: options.workerName ?? randomUUID(),
|
|
78114
78316
|
entrypointSource: ProxyServerWorker_default,
|
|
@@ -78175,8 +78377,8 @@ async function startRemoteProxySession(bindings$1, options) {
|
|
|
78175
78377
|
dispose: () => devEnv.teardown()
|
|
78176
78378
|
};
|
|
78177
78379
|
}
|
|
78178
|
-
function toRawBindings(bindings
|
|
78179
|
-
return Object.fromEntries(Object.entries(bindings
|
|
78380
|
+
function toRawBindings(bindings) {
|
|
78381
|
+
return Object.fromEntries(Object.entries(bindings ?? {}).map(([key, binding]) => [key, {
|
|
78180
78382
|
...binding,
|
|
78181
78383
|
raw: true
|
|
78182
78384
|
}]));
|
|
@@ -78195,8 +78397,8 @@ function getInternalLogger(logger$1) {
|
|
|
78195
78397
|
console: disabled
|
|
78196
78398
|
};
|
|
78197
78399
|
}
|
|
78198
|
-
function pickRemoteBindings(bindings
|
|
78199
|
-
return Object.fromEntries(Object.entries(bindings
|
|
78400
|
+
function pickRemoteBindings(bindings) {
|
|
78401
|
+
return Object.fromEntries(Object.entries(bindings ?? {}).filter(([, binding]) => {
|
|
78200
78402
|
if (getBindingLocalSupport(binding.type) === "DO-NOT-USE-this-resource-will-never-have-a-local-simulator") return true;
|
|
78201
78403
|
return "remote" in binding && binding.remote;
|
|
78202
78404
|
}));
|
|
@@ -81095,11 +81297,11 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
|
|
|
81095
81297
|
const containerTagToOptionsMap = /* @__PURE__ */ new Map();
|
|
81096
81298
|
let containerEngine;
|
|
81097
81299
|
const workersFromConfig = resolvedPluginConfig.type === "workers" ? await Promise.all([...resolvedPluginConfig.environmentNameToWorkerMap].map(async ([environmentName, worker]) => {
|
|
81098
|
-
const bindings
|
|
81300
|
+
const bindings = wrangler.unstable_convertConfigBindingsToStartWorkerBindings(worker.config);
|
|
81099
81301
|
const preExistingRemoteProxySession = worker.config.configPath ? remoteProxySessionsDataMap.get(worker.config.configPath) : void 0;
|
|
81100
81302
|
const remoteProxySessionData = !resolvedPluginConfig.remoteBindings ? null : await maybeStartOrUpdateRemoteProxySession({
|
|
81101
81303
|
name: worker.config.name,
|
|
81102
|
-
bindings: bindings
|
|
81304
|
+
bindings: bindings ?? {},
|
|
81103
81305
|
complianceRegion: worker.config.compliance_region,
|
|
81104
81306
|
account_id: worker.config.account_id,
|
|
81105
81307
|
profileDir: resolvedViteConfig.root
|
|
@@ -81314,11 +81516,11 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
|
|
|
81314
81516
|
let containerEngine;
|
|
81315
81517
|
const workers = (await Promise.all(resolvedPluginConfig.workers.map(async (previewWorker) => {
|
|
81316
81518
|
const workerConfig = previewWorker.config;
|
|
81317
|
-
const bindings
|
|
81519
|
+
const bindings = wrangler.unstable_convertConfigBindingsToStartWorkerBindings(workerConfig);
|
|
81318
81520
|
const preExistingRemoteProxySessionData = workerConfig.configPath ? remoteProxySessionsDataMap.get(workerConfig.configPath) : void 0;
|
|
81319
81521
|
const remoteProxySessionData = !resolvedPluginConfig.remoteBindings ? null : await maybeStartOrUpdateRemoteProxySession({
|
|
81320
81522
|
name: workerConfig.name,
|
|
81321
|
-
bindings: bindings
|
|
81523
|
+
bindings: bindings ?? {},
|
|
81322
81524
|
complianceRegion: workerConfig.compliance_region,
|
|
81323
81525
|
account_id: workerConfig.account_id,
|
|
81324
81526
|
profileDir: resolvedViteConfig.root
|
|
@@ -82562,8 +82764,8 @@ function addShortcuts(server, ctx) {
|
|
|
82562
82764
|
viteServer.config.logger.info("");
|
|
82563
82765
|
const workerConfigs = ctx.allWorkerConfigs;
|
|
82564
82766
|
for (const workerConfig of workerConfigs) {
|
|
82565
|
-
const bindings
|
|
82566
|
-
wrangler.unstable_printBindings(bindings
|
|
82767
|
+
const bindings = wrangler.unstable_convertConfigBindingsToStartWorkerBindings(workerConfig);
|
|
82768
|
+
wrangler.unstable_printBindings(bindings, {
|
|
82567
82769
|
tailConsumers: workerConfig.tail_consumers,
|
|
82568
82770
|
streamingTailConsumers: workerConfig.streaming_tail_consumers,
|
|
82569
82771
|
containers: workerConfig.containers,
|