@cloudflare/vitest-plugin 1.1.4 → 1.1.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/pool/index.mjs
CHANGED
|
@@ -11,13 +11,13 @@ import util, { TextEncoder as TextEncoder$1, inspect, stripVTControlCharacters,
|
|
|
11
11
|
import os, { arch } from "node:os";
|
|
12
12
|
import process5, { exit, stdin, stdout } from "node:process";
|
|
13
13
|
import tty from "node:tty";
|
|
14
|
-
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
15
14
|
import net from "node:net";
|
|
16
15
|
import http from "node:http";
|
|
17
16
|
import events, { EventEmitter } from "node:events";
|
|
18
17
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
19
18
|
import { assert as assert$1 } from "node:console";
|
|
20
19
|
import fs$1 from "node:fs/promises";
|
|
20
|
+
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
21
21
|
import * as timersPromises from "node:timers/promises";
|
|
22
22
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
23
23
|
import { DeferredPromise, Log, LogLevel, Miniflare, MiniflareCoreError, Mutex, Response, V4WorkerOptionsSchema, compileModuleRules, convertV4MiniflareOptions, getNodeCompat, kCurrentWorker, kUnsafeEphemeralUniqueKey, maybeApply, mergeWorkerOptions, parseModuleFallbackRequest, structuredSerializableReducers, structuredSerializableRevivers, testRegExps } from "miniflare";
|
|
@@ -75,10 +75,10 @@ function isAnnotation(value) {
|
|
|
75
75
|
return typeof value === "object" && value !== null && kMessages in value && kActual in value;
|
|
76
76
|
}
|
|
77
77
|
__name$3(isAnnotation, "isAnnotation");
|
|
78
|
-
function isRecord$
|
|
78
|
+
function isRecord$2(value) {
|
|
79
79
|
return typeof value === "object" && value !== null;
|
|
80
80
|
}
|
|
81
|
-
__name$3(isRecord$
|
|
81
|
+
__name$3(isRecord$2, "isRecord");
|
|
82
82
|
function arrayShallowEqual(a, b) {
|
|
83
83
|
if (a.length !== b.length) return false;
|
|
84
84
|
for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;
|
|
@@ -107,7 +107,7 @@ function annotate(groupCounts, annotated, input, issue$1, path$3, groupId) {
|
|
|
107
107
|
if (unionIssues.length > 0) {
|
|
108
108
|
const multipleDistinct = hasMultipleDistinctMessages(unionIssues, 1);
|
|
109
109
|
let newGroupId;
|
|
110
|
-
if (isRecord$
|
|
110
|
+
if (isRecord$2(input) && multipleDistinct) {
|
|
111
111
|
newGroupId = groupCounts.size;
|
|
112
112
|
groupCounts.set(newGroupId, 0);
|
|
113
113
|
}
|
|
@@ -136,13 +136,13 @@ function annotate(groupCounts, annotated, input, issue$1, path$3, groupId) {
|
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
const [head, ...tail$1] = path$3;
|
|
139
|
-
assert(isRecord$
|
|
139
|
+
assert(isRecord$2(input), "Expected object/array input for nested issue");
|
|
140
140
|
if (annotated === void 0) if (Array.isArray(input)) annotated = new Array(input.length);
|
|
141
141
|
else {
|
|
142
142
|
const entries = Object.keys(input).map((key) => [key, void 0]);
|
|
143
143
|
annotated = Object.fromEntries(entries);
|
|
144
144
|
}
|
|
145
|
-
assert(isRecord$
|
|
145
|
+
assert(isRecord$2(annotated), "Expected object/array for nested issue");
|
|
146
146
|
annotated[head] = annotate(groupCounts, annotated[head], input[head], issue$1, tail$1, groupId);
|
|
147
147
|
return annotated;
|
|
148
148
|
}
|
|
@@ -188,7 +188,7 @@ ${error$2}`;
|
|
|
188
188
|
}
|
|
189
189
|
result += `${indent}${dim$2(`]${suffix}`)}`;
|
|
190
190
|
return result;
|
|
191
|
-
} else if (isRecord$
|
|
191
|
+
} else if (isRecord$2(annotated)) {
|
|
192
192
|
let result = `${indent}${dim$2(`${prefix}{`)}
|
|
193
193
|
`;
|
|
194
194
|
const objectIndent = indent + " ";
|
|
@@ -331,43 +331,43 @@ function hasKnownExportType(entry) {
|
|
|
331
331
|
return type === "durable-object" || type === "worker";
|
|
332
332
|
}
|
|
333
333
|
__name$3(hasKnownExportType, "hasKnownExportType");
|
|
334
|
-
function partitionExports(exports$1
|
|
334
|
+
function partitionExports(exports$1) {
|
|
335
335
|
const partitioned = {
|
|
336
336
|
"durable-object": {},
|
|
337
337
|
worker: {}
|
|
338
338
|
};
|
|
339
|
-
if (exports$1
|
|
340
|
-
for (const [name, entry] of Object.entries(exports$1
|
|
339
|
+
if (exports$1 === void 0) return partitioned;
|
|
340
|
+
for (const [name, entry] of Object.entries(exports$1)) {
|
|
341
341
|
if (!hasKnownExportType(entry)) continue;
|
|
342
342
|
partitioned[entry.type][name] = entry;
|
|
343
343
|
}
|
|
344
344
|
return partitioned;
|
|
345
345
|
}
|
|
346
346
|
__name$3(partitionExports, "partitionExports");
|
|
347
|
-
function getDurableObjectExports(exports$1
|
|
348
|
-
return partitionExports(exports$1
|
|
347
|
+
function getDurableObjectExports(exports$1) {
|
|
348
|
+
return partitionExports(exports$1)["durable-object"];
|
|
349
349
|
}
|
|
350
350
|
__name$3(getDurableObjectExports, "getDurableObjectExports");
|
|
351
|
-
function hasDurableObjectExports(exports$1
|
|
352
|
-
return Object.keys(getDurableObjectExports(exports$1
|
|
351
|
+
function hasDurableObjectExports(exports$1) {
|
|
352
|
+
return Object.keys(getDurableObjectExports(exports$1)).length > 0;
|
|
353
353
|
}
|
|
354
354
|
__name$3(hasDurableObjectExports, "hasDurableObjectExports");
|
|
355
|
-
function getContainerNameToClassNameMap(exports$1
|
|
355
|
+
function getContainerNameToClassNameMap(exports$1) {
|
|
356
356
|
const containerNameToClassName = /* @__PURE__ */ new Map();
|
|
357
|
-
for (const [className, entry] of Object.entries(getDurableObjectExports(exports$1
|
|
357
|
+
for (const [className, entry] of Object.entries(getDurableObjectExports(exports$1))) if ("container" in entry && typeof entry.container === "string" && !containerNameToClassName.has(entry.container)) containerNameToClassName.set(entry.container, className);
|
|
358
358
|
return containerNameToClassName;
|
|
359
359
|
}
|
|
360
360
|
__name$3(getContainerNameToClassNameMap, "getContainerNameToClassNameMap");
|
|
361
|
-
function resolveContainerClassName(container, exports$1
|
|
361
|
+
function resolveContainerClassName(container, exports$1) {
|
|
362
362
|
if (container.class_name !== void 0) return container.class_name;
|
|
363
363
|
if (container.name === void 0) return;
|
|
364
|
-
return getContainerNameToClassNameMap(exports$1
|
|
364
|
+
return getContainerNameToClassNameMap(exports$1).get(container.name);
|
|
365
365
|
}
|
|
366
366
|
__name$3(resolveContainerClassName, "resolveContainerClassName");
|
|
367
|
-
function getContainerDurableObjectClassNames(containers, exports$1
|
|
367
|
+
function getContainerDurableObjectClassNames(containers, exports$1) {
|
|
368
368
|
const classNames = /* @__PURE__ */ new Set();
|
|
369
369
|
for (const container of containers ?? []) {
|
|
370
|
-
const className = resolveContainerClassName(container, exports$1
|
|
370
|
+
const className = resolveContainerClassName(container, exports$1);
|
|
371
371
|
if (className !== void 0) classNames.add(className);
|
|
372
372
|
}
|
|
373
373
|
return classNames;
|
|
@@ -2736,12 +2736,12 @@ function formatConfigSnippet(snippet, configPath, formatted = true) {
|
|
|
2736
2736
|
__name$3(formatConfigSnippet, "formatConfigSnippet");
|
|
2737
2737
|
|
|
2738
2738
|
//#endregion
|
|
2739
|
-
//#region ../workers-utils/dist/chunk-
|
|
2740
|
-
var DEFAULT_COMPAT_DATE = "2026-09-
|
|
2739
|
+
//#region ../workers-utils/dist/chunk-CDB2RWUW.mjs
|
|
2740
|
+
var DEFAULT_COMPAT_DATE = "2026-09-08";
|
|
2741
2741
|
function assertNever(_value) {}
|
|
2742
2742
|
__name$3(assertNever, "assertNever");
|
|
2743
|
-
function mapWorkerMetadataBindings(bindings
|
|
2744
|
-
return bindings
|
|
2743
|
+
function mapWorkerMetadataBindings(bindings) {
|
|
2744
|
+
return bindings.filter((binding) => binding.type !== "secret_text").reduce((configObj, binding) => {
|
|
2745
2745
|
switch (binding.type) {
|
|
2746
2746
|
case "plain_text":
|
|
2747
2747
|
configObj.vars = {
|
|
@@ -9991,8 +9991,8 @@ var require_client_h1 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm
|
|
|
9991
9991
|
* @param {import('net').Socket} socket
|
|
9992
9992
|
* @param {*} llhttp
|
|
9993
9993
|
*/
|
|
9994
|
-
constructor(client, socket, { exports: exports$
|
|
9995
|
-
this.llhttp = exports$
|
|
9994
|
+
constructor(client, socket, { exports: exports$1 }) {
|
|
9995
|
+
this.llhttp = exports$1;
|
|
9996
9996
|
this.ptr = this.llhttp.llhttp_alloc(constants$3.TYPE.RESPONSE);
|
|
9997
9997
|
this.client = client;
|
|
9998
9998
|
/**
|
|
@@ -26109,7 +26109,7 @@ var require_undici = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
|
|
|
26109
26109
|
//#endregion
|
|
26110
26110
|
//#region ../workers-utils/dist/index.mjs
|
|
26111
26111
|
var import_undici$3 = require_undici();
|
|
26112
|
-
var require_vendors$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json"(exports$1
|
|
26112
|
+
var require_vendors$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json"(exports$1, module$1) {
|
|
26113
26113
|
module$1.exports = [
|
|
26114
26114
|
{
|
|
26115
26115
|
name: "Agola CI",
|
|
@@ -26435,26 +26435,26 @@ var require_vendors$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/n
|
|
|
26435
26435
|
}
|
|
26436
26436
|
];
|
|
26437
26437
|
} });
|
|
26438
|
-
var require_ci_info$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/index.js"(exports$1
|
|
26438
|
+
var require_ci_info$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/index.js"(exports$1) {
|
|
26439
26439
|
var vendors$1 = require_vendors$1();
|
|
26440
26440
|
var env$2 = process.env;
|
|
26441
|
-
Object.defineProperty(exports$1
|
|
26441
|
+
Object.defineProperty(exports$1, "_vendors", { value: vendors$1.map(function(v) {
|
|
26442
26442
|
return v.constant;
|
|
26443
26443
|
}) });
|
|
26444
|
-
exports$1
|
|
26445
|
-
exports$1
|
|
26446
|
-
exports$1
|
|
26444
|
+
exports$1.name = null;
|
|
26445
|
+
exports$1.isPR = null;
|
|
26446
|
+
exports$1.id = null;
|
|
26447
26447
|
if (env$2.CI !== "false") vendors$1.forEach(function(vendor) {
|
|
26448
26448
|
const isCI2 = (Array.isArray(vendor.env) ? vendor.env : [vendor.env]).every(function(obj) {
|
|
26449
26449
|
return checkEnv$1(obj);
|
|
26450
26450
|
});
|
|
26451
|
-
exports$1
|
|
26451
|
+
exports$1[vendor.constant] = isCI2;
|
|
26452
26452
|
if (!isCI2) return;
|
|
26453
|
-
exports$1
|
|
26454
|
-
exports$1
|
|
26455
|
-
exports$1
|
|
26453
|
+
exports$1.name = vendor.name;
|
|
26454
|
+
exports$1.isPR = checkPR$1(vendor);
|
|
26455
|
+
exports$1.id = vendor.constant;
|
|
26456
26456
|
});
|
|
26457
|
-
exports$1
|
|
26457
|
+
exports$1.isCI = !!(env$2.CI !== "false" && (env$2.BUILD_ID || env$2.BUILD_NUMBER || env$2.CI || env$2.CI_APP_ID || env$2.CI_BUILD_ID || env$2.CI_BUILD_NUMBER || env$2.CI_NAME || env$2.CONTINUOUS_INTEGRATION || env$2.RUN_ID || exports$1.name || false));
|
|
26458
26458
|
function checkEnv$1(obj) {
|
|
26459
26459
|
if (typeof obj === "string") return !!env$2[obj];
|
|
26460
26460
|
if ("env" in obj) return env$2[obj.env] && env$2[obj.env].includes(obj.includes);
|
|
@@ -26482,7 +26482,7 @@ var require_ci_info$1 = __commonJS$1({ "../../node_modules/.pnpm/ci-info@4.4.0/n
|
|
|
26482
26482
|
}
|
|
26483
26483
|
__name$3(checkPR$1, "checkPR");
|
|
26484
26484
|
} });
|
|
26485
|
-
var require_command_exists$2 = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports$1
|
|
26485
|
+
var require_command_exists$2 = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports$1, module$1) {
|
|
26486
26486
|
var exec$3 = __require("child_process").exec;
|
|
26487
26487
|
var execSync$1 = __require("child_process").execSync;
|
|
26488
26488
|
var fs3 = __require("fs");
|
|
@@ -26586,14 +26586,14 @@ var require_command_exists$2 = __commonJS$1({ "../../node_modules/.pnpm/command-
|
|
|
26586
26586
|
else return commandExistsUnixSync$1(commandName, cleanedCommandName);
|
|
26587
26587
|
};
|
|
26588
26588
|
} });
|
|
26589
|
-
var require_command_exists2 = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/index.js"(exports$1
|
|
26589
|
+
var require_command_exists2 = __commonJS$1({ "../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/index.js"(exports$1, module$1) {
|
|
26590
26590
|
module$1.exports = require_command_exists$2();
|
|
26591
26591
|
} });
|
|
26592
|
-
var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports$1
|
|
26593
|
-
exports$1
|
|
26594
|
-
exports$1
|
|
26595
|
-
exports$1
|
|
26596
|
-
exports$1
|
|
26592
|
+
var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports$1) {
|
|
26593
|
+
exports$1.parse = exports$1.decode = decode3;
|
|
26594
|
+
exports$1.stringify = exports$1.encode = encode3;
|
|
26595
|
+
exports$1.safe = safe;
|
|
26596
|
+
exports$1.unsafe = unsafe;
|
|
26597
26597
|
var eol = typeof process !== "undefined" && process.platform === "win32" ? "\r\n" : "\n";
|
|
26598
26598
|
function encode3(obj, opt) {
|
|
26599
26599
|
var children = [];
|
|
@@ -26725,7 +26725,7 @@ var require_ini = __commonJS$1({ "../../node_modules/.pnpm/ini@1.3.8/node_module
|
|
|
26725
26725
|
}
|
|
26726
26726
|
__name$3(unsafe, "unsafe");
|
|
26727
26727
|
} });
|
|
26728
|
-
var require_strip_json_comments = __commonJS$1({ "../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js"(exports$1
|
|
26728
|
+
var require_strip_json_comments = __commonJS$1({ "../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js"(exports$1, module$1) {
|
|
26729
26729
|
var singleComment = 1;
|
|
26730
26730
|
var multiComment = 2;
|
|
26731
26731
|
function stripWithoutWhitespace() {
|
|
@@ -26784,16 +26784,16 @@ var require_strip_json_comments = __commonJS$1({ "../../node_modules/.pnpm/strip
|
|
|
26784
26784
|
return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset));
|
|
26785
26785
|
};
|
|
26786
26786
|
} });
|
|
26787
|
-
var require_utils = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports$1
|
|
26787
|
+
var require_utils = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports$1) {
|
|
26788
26788
|
var fs3 = __require("fs");
|
|
26789
26789
|
var ini = require_ini();
|
|
26790
26790
|
var path5 = __require("path");
|
|
26791
26791
|
var stripJsonComments = require_strip_json_comments();
|
|
26792
|
-
var parse3$1 = exports$1
|
|
26792
|
+
var parse3$1 = exports$1.parse = function(content) {
|
|
26793
26793
|
if (/^\s*{/.test(content)) return JSON.parse(stripJsonComments(content));
|
|
26794
26794
|
return ini.parse(content);
|
|
26795
26795
|
};
|
|
26796
|
-
var file2 = exports$1
|
|
26796
|
+
var file2 = exports$1.file = function() {
|
|
26797
26797
|
var args = [].slice.call(arguments).filter(function(arg) {
|
|
26798
26798
|
return arg != null;
|
|
26799
26799
|
});
|
|
@@ -26805,11 +26805,11 @@ var require_utils = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modul
|
|
|
26805
26805
|
return;
|
|
26806
26806
|
}
|
|
26807
26807
|
};
|
|
26808
|
-
exports$1
|
|
26808
|
+
exports$1.json = function() {
|
|
26809
26809
|
var content = file2.apply(null, arguments);
|
|
26810
26810
|
return content ? parse3$1(content) : null;
|
|
26811
26811
|
};
|
|
26812
|
-
exports$1
|
|
26812
|
+
exports$1.env = function(prefix, env2) {
|
|
26813
26813
|
env2 = env2 || process.env;
|
|
26814
26814
|
var obj = {};
|
|
26815
26815
|
var l = prefix.length;
|
|
@@ -26827,7 +26827,7 @@ var require_utils = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modul
|
|
|
26827
26827
|
}
|
|
26828
26828
|
return obj;
|
|
26829
26829
|
};
|
|
26830
|
-
exports$1
|
|
26830
|
+
exports$1.find = function() {
|
|
26831
26831
|
var rel = path5.join.apply(null, [].slice.call(arguments));
|
|
26832
26832
|
function find2(start, rel2) {
|
|
26833
26833
|
var file3 = path5.join(start, rel2);
|
|
@@ -26842,7 +26842,7 @@ var require_utils = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modul
|
|
|
26842
26842
|
return find2(process.cwd(), rel);
|
|
26843
26843
|
};
|
|
26844
26844
|
} });
|
|
26845
|
-
var require_deep_extend = __commonJS$1({ "../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js"(exports$1
|
|
26845
|
+
var require_deep_extend = __commonJS$1({ "../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js"(exports$1, module$1) {
|
|
26846
26846
|
function isSpecificValue(val) {
|
|
26847
26847
|
return val instanceof Buffer || val instanceof Date || val instanceof RegExp ? true : false;
|
|
26848
26848
|
}
|
|
@@ -26905,7 +26905,7 @@ var require_deep_extend = __commonJS$1({ "../../node_modules/.pnpm/deep-extend@0
|
|
|
26905
26905
|
return target;
|
|
26906
26906
|
};
|
|
26907
26907
|
} });
|
|
26908
|
-
var require_minimist = __commonJS$1({ "../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports$1
|
|
26908
|
+
var require_minimist = __commonJS$1({ "../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports$1, module$1) {
|
|
26909
26909
|
module$1.exports = function(args, opts) {
|
|
26910
26910
|
if (!opts) opts = {};
|
|
26911
26911
|
var flags = {
|
|
@@ -27080,7 +27080,7 @@ var require_minimist = __commonJS$1({ "../../node_modules/.pnpm/minimist@1.2.6/n
|
|
|
27080
27080
|
}
|
|
27081
27081
|
__name$3(isConstructorOrProto, "isConstructorOrProto");
|
|
27082
27082
|
} });
|
|
27083
|
-
var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports$1
|
|
27083
|
+
var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports$1, module$1) {
|
|
27084
27084
|
var cc = require_utils();
|
|
27085
27085
|
var join3 = __require("path").join;
|
|
27086
27086
|
var deepExtend = require_deep_extend();
|
|
@@ -27124,14 +27124,14 @@ var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/
|
|
|
27124
27124
|
]));
|
|
27125
27125
|
};
|
|
27126
27126
|
} });
|
|
27127
|
-
var require_registry_url = __commonJS$1({ "../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js"(exports$1
|
|
27127
|
+
var require_registry_url = __commonJS$1({ "../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js"(exports$1, module$1) {
|
|
27128
27128
|
module$1.exports = function(scope) {
|
|
27129
27129
|
var rc = require_rc()("npm", { registry: "https://registry.npmjs.org/" });
|
|
27130
27130
|
var url2 = rc[scope + ":registry"] || rc.registry;
|
|
27131
27131
|
return url2.slice(-1) === "/" ? url2 : url2 + "/";
|
|
27132
27132
|
};
|
|
27133
27133
|
} });
|
|
27134
|
-
var require_safe_buffer = __commonJS$1({ "../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(exports$1
|
|
27134
|
+
var require_safe_buffer = __commonJS$1({ "../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(exports$1, module$1) {
|
|
27135
27135
|
var buffer$1 = __require("buffer");
|
|
27136
27136
|
var Buffer2 = buffer$1.Buffer;
|
|
27137
27137
|
function copyProps(src$2, dst) {
|
|
@@ -27140,8 +27140,8 @@ var require_safe_buffer = __commonJS$1({ "../../node_modules/.pnpm/safe-buffer@5
|
|
|
27140
27140
|
__name$3(copyProps, "copyProps");
|
|
27141
27141
|
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) module$1.exports = buffer$1;
|
|
27142
27142
|
else {
|
|
27143
|
-
copyProps(buffer$1, exports$1
|
|
27144
|
-
exports$1
|
|
27143
|
+
copyProps(buffer$1, exports$1);
|
|
27144
|
+
exports$1.Buffer = SafeBuffer;
|
|
27145
27145
|
}
|
|
27146
27146
|
function SafeBuffer(arg, encodingOrOffset, length) {
|
|
27147
27147
|
return Buffer2(arg, encodingOrOffset, length);
|
|
@@ -27170,7 +27170,7 @@ var require_safe_buffer = __commonJS$1({ "../../node_modules/.pnpm/safe-buffer@5
|
|
|
27170
27170
|
return buffer$1.SlowBuffer(size);
|
|
27171
27171
|
};
|
|
27172
27172
|
} });
|
|
27173
|
-
var require_base64 = __commonJS$1({ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/base64.js"(exports$1
|
|
27173
|
+
var require_base64 = __commonJS$1({ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/base64.js"(exports$1, module$1) {
|
|
27174
27174
|
var safeBuffer = require_safe_buffer().Buffer;
|
|
27175
27175
|
function decodeBase64(base643) {
|
|
27176
27176
|
return safeBuffer.from(base643, "base64").toString("utf8");
|
|
@@ -27185,7 +27185,7 @@ var require_base64 = __commonJS$1({ "../../node_modules/.pnpm/registry-auth-toke
|
|
|
27185
27185
|
encodeBase64
|
|
27186
27186
|
};
|
|
27187
27187
|
} });
|
|
27188
|
-
var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/index.js"(exports$1
|
|
27188
|
+
var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/index.js"(exports$1, module$1) {
|
|
27189
27189
|
var url2 = __require("url");
|
|
27190
27190
|
var base643 = require_base64();
|
|
27191
27191
|
var decodeBase64 = base643.decodeBase64;
|
|
@@ -27260,7 +27260,7 @@ var require_registry_auth_token = __commonJS$1({ "../../node_modules/.pnpm/regis
|
|
|
27260
27260
|
}
|
|
27261
27261
|
__name$3(getTokenForUsernameAndPassword, "getTokenForUsernameAndPassword");
|
|
27262
27262
|
} });
|
|
27263
|
-
var require_update_check = __commonJS$1({ "../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports$1
|
|
27263
|
+
var require_update_check = __commonJS$1({ "../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports$1, module$1) {
|
|
27264
27264
|
var { URL: URL2 } = __require("url");
|
|
27265
27265
|
var { join: join3 } = __require("path");
|
|
27266
27266
|
var fs3 = __require("fs");
|
|
@@ -28153,7 +28153,7 @@ __export(util_exports, {
|
|
|
28153
28153
|
parsedType: () => parsedType,
|
|
28154
28154
|
partial: () => partial,
|
|
28155
28155
|
pick: () => pick,
|
|
28156
|
-
prefixIssues: () => prefixIssues,
|
|
28156
|
+
prefixIssues: () => prefixIssues$1,
|
|
28157
28157
|
primitiveTypes: () => primitiveTypes,
|
|
28158
28158
|
promiseAllObject: () => promiseAllObject,
|
|
28159
28159
|
propertyKeyTypes: () => propertyKeyTypes,
|
|
@@ -28603,7 +28603,7 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
28603
28603
|
return false;
|
|
28604
28604
|
}
|
|
28605
28605
|
__name$3(explicitlyAborted, "explicitlyAborted");
|
|
28606
|
-
function prefixIssues(path5, issues) {
|
|
28606
|
+
function prefixIssues$1(path5, issues) {
|
|
28607
28607
|
return issues.map((iss) => {
|
|
28608
28608
|
var _a3;
|
|
28609
28609
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
@@ -28611,7 +28611,7 @@ function prefixIssues(path5, issues) {
|
|
|
28611
28611
|
return iss;
|
|
28612
28612
|
});
|
|
28613
28613
|
}
|
|
28614
|
-
__name$3(prefixIssues, "prefixIssues");
|
|
28614
|
+
__name$3(prefixIssues$1, "prefixIssues");
|
|
28615
28615
|
function unwrapMessage(message) {
|
|
28616
28616
|
return typeof message === "string" ? message : message?.message;
|
|
28617
28617
|
}
|
|
@@ -29576,7 +29576,7 @@ var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst,
|
|
|
29576
29576
|
};
|
|
29577
29577
|
});
|
|
29578
29578
|
function handleCheckPropertyResult(result, payload, property) {
|
|
29579
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(property, result.issues));
|
|
29579
|
+
if (result.issues.length) payload.issues.push(...prefixIssues$1(property, result.issues));
|
|
29580
29580
|
}
|
|
29581
29581
|
__name$3(handleCheckPropertyResult, "handleCheckPropertyResult");
|
|
29582
29582
|
var $ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (inst, def) => {
|
|
@@ -30199,7 +30199,7 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
30199
30199
|
};
|
|
30200
30200
|
});
|
|
30201
30201
|
function handleArrayResult(result, final, index) {
|
|
30202
|
-
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
30202
|
+
if (result.issues.length) final.issues.push(...prefixIssues$1(index, result.issues));
|
|
30203
30203
|
final.value[index] = result.value;
|
|
30204
30204
|
}
|
|
30205
30205
|
__name$3(handleArrayResult, "handleArrayResult");
|
|
@@ -30235,7 +30235,7 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
30235
30235
|
const isPresent = key in input;
|
|
30236
30236
|
if (result.issues.length) {
|
|
30237
30237
|
if (isOptionalIn && isOptionalOut && !isPresent) return;
|
|
30238
|
-
final.issues.push(...prefixIssues(key, result.issues));
|
|
30238
|
+
final.issues.push(...prefixIssues$1(key, result.issues));
|
|
30239
30239
|
}
|
|
30240
30240
|
if (!isPresent && !isOptionalIn) {
|
|
30241
30241
|
if (!result.issues.length) final.issues.push({
|
|
@@ -30807,7 +30807,7 @@ function getTupleOptStart(items, key) {
|
|
|
30807
30807
|
}
|
|
30808
30808
|
__name$3(getTupleOptStart, "getTupleOptStart");
|
|
30809
30809
|
function handleTupleResult(result, final, index) {
|
|
30810
|
-
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
30810
|
+
if (result.issues.length) final.issues.push(...prefixIssues$1(index, result.issues));
|
|
30811
30811
|
final.value[index] = result.value;
|
|
30812
30812
|
}
|
|
30813
30813
|
__name$3(handleTupleResult, "handleTupleResult");
|
|
@@ -30820,7 +30820,7 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
30820
30820
|
final.value.length = i;
|
|
30821
30821
|
break;
|
|
30822
30822
|
}
|
|
30823
|
-
final.issues.push(...prefixIssues(i, r2.issues));
|
|
30823
|
+
final.issues.push(...prefixIssues$1(i, r2.issues));
|
|
30824
30824
|
}
|
|
30825
30825
|
final.value[i] = r2.value;
|
|
30826
30826
|
}
|
|
@@ -30871,11 +30871,11 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
30871
30871
|
issues: []
|
|
30872
30872
|
}, ctx);
|
|
30873
30873
|
if (result instanceof Promise) proms.push(result.then((result2) => {
|
|
30874
|
-
if (result2.issues.length) payload.issues.push(...prefixIssues(key, result2.issues));
|
|
30874
|
+
if (result2.issues.length) payload.issues.push(...prefixIssues$1(key, result2.issues));
|
|
30875
30875
|
payload.value[outKey] = result2.value;
|
|
30876
30876
|
}));
|
|
30877
30877
|
else {
|
|
30878
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
30878
|
+
if (result.issues.length) payload.issues.push(...prefixIssues$1(key, result.issues));
|
|
30879
30879
|
payload.value[outKey] = result.value;
|
|
30880
30880
|
}
|
|
30881
30881
|
}
|
|
@@ -30925,11 +30925,11 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
30925
30925
|
issues: []
|
|
30926
30926
|
}, ctx);
|
|
30927
30927
|
if (result instanceof Promise) proms.push(result.then((result2) => {
|
|
30928
|
-
if (result2.issues.length) payload.issues.push(...prefixIssues(key, result2.issues));
|
|
30928
|
+
if (result2.issues.length) payload.issues.push(...prefixIssues$1(key, result2.issues));
|
|
30929
30929
|
payload.value[keyResult.value] = result2.value;
|
|
30930
30930
|
}));
|
|
30931
30931
|
else {
|
|
30932
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
30932
|
+
if (result.issues.length) payload.issues.push(...prefixIssues$1(key, result.issues));
|
|
30933
30933
|
payload.value[keyResult.value] = result.value;
|
|
30934
30934
|
}
|
|
30935
30935
|
}
|
|
@@ -30972,7 +30972,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
|
30972
30972
|
};
|
|
30973
30973
|
});
|
|
30974
30974
|
function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
30975
|
-
if (keyResult.issues.length) if (propertyKeyTypes.has(typeof key)) final.issues.push(...prefixIssues(key, keyResult.issues));
|
|
30975
|
+
if (keyResult.issues.length) if (propertyKeyTypes.has(typeof key)) final.issues.push(...prefixIssues$1(key, keyResult.issues));
|
|
30976
30976
|
else final.issues.push({
|
|
30977
30977
|
code: "invalid_key",
|
|
30978
30978
|
origin: "map",
|
|
@@ -30980,7 +30980,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
30980
30980
|
inst,
|
|
30981
30981
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
30982
30982
|
});
|
|
30983
|
-
if (valueResult.issues.length) if (propertyKeyTypes.has(typeof key)) final.issues.push(...prefixIssues(key, valueResult.issues));
|
|
30983
|
+
if (valueResult.issues.length) if (propertyKeyTypes.has(typeof key)) final.issues.push(...prefixIssues$1(key, valueResult.issues));
|
|
30984
30984
|
else final.issues.push({
|
|
30985
30985
|
origin: "map",
|
|
30986
30986
|
code: "invalid_element",
|
|
@@ -41472,14 +41472,14 @@ var getBindingNames = /* @__PURE__ */ __name$3((value) => {
|
|
|
41472
41472
|
if (typeof value !== "object" || value === null) return [];
|
|
41473
41473
|
if (isBindingList(value)) return value.bindings.map(({ name }) => name);
|
|
41474
41474
|
else if (isNamespaceList(value)) return value.map(({ binding }) => binding);
|
|
41475
|
-
else if (isRecord(value)) {
|
|
41475
|
+
else if (isRecord$1(value)) {
|
|
41476
41476
|
if (value["binding"] !== void 0) return [value["binding"]];
|
|
41477
41477
|
return Object.keys(value).filter((k) => value[k] !== void 0);
|
|
41478
41478
|
} else return [];
|
|
41479
41479
|
}, "getBindingNames");
|
|
41480
|
-
var isBindingList = /* @__PURE__ */ __name$3((value) => isRecord(value) && "bindings" in value && Array.isArray(value.bindings) && value.bindings.every((binding) => isRecord(binding) && "name" in binding && typeof binding.name === "string"), "isBindingList");
|
|
41481
|
-
var isNamespaceList = /* @__PURE__ */ __name$3((value) => Array.isArray(value) && value.every((entry) => isRecord(entry) && "binding" in entry && typeof entry.binding === "string"), "isNamespaceList");
|
|
41482
|
-
var isRecord = /* @__PURE__ */ __name$3((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRecord");
|
|
41480
|
+
var isBindingList = /* @__PURE__ */ __name$3((value) => isRecord$1(value) && "bindings" in value && Array.isArray(value.bindings) && value.bindings.every((binding) => isRecord$1(binding) && "name" in binding && typeof binding.name === "string"), "isBindingList");
|
|
41481
|
+
var isNamespaceList = /* @__PURE__ */ __name$3((value) => Array.isArray(value) && value.every((entry) => isRecord$1(entry) && "binding" in entry && typeof entry.binding === "string"), "isNamespaceList");
|
|
41482
|
+
var isRecord$1 = /* @__PURE__ */ __name$3((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRecord");
|
|
41483
41483
|
var validateUniqueNameProperty = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
|
|
41484
41484
|
if (Array.isArray(value)) {
|
|
41485
41485
|
const nameCount = /* @__PURE__ */ new Map();
|
|
@@ -42781,6 +42781,7 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
|
|
|
42781
42781
|
if (rolloutStepsCount > containerAppOptional.max_instances) diagnostics.errors.push(`"containers.rollout_step_percentage" cannot have more steps (${rolloutStepsCount}) than "max_instances" (${containerAppOptional.max_instances})`);
|
|
42782
42782
|
}
|
|
42783
42783
|
validateOptionalProperty(diagnostics, field, "image_vars", containerAppOptional.image_vars, "object");
|
|
42784
|
+
validateContainerObservability(diagnostics, `${field}.observability`, containerAppOptional.observability, config2);
|
|
42784
42785
|
validateOptionalProperty(diagnostics, field, "scheduling_policy", containerAppOptional.scheduling_policy, "string", [
|
|
42785
42786
|
"regional",
|
|
42786
42787
|
"moon",
|
|
@@ -42799,6 +42800,7 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
|
|
|
42799
42800
|
"image",
|
|
42800
42801
|
"image_build_context",
|
|
42801
42802
|
"image_vars",
|
|
42803
|
+
"observability",
|
|
42802
42804
|
"class_name",
|
|
42803
42805
|
"scheduling_policy",
|
|
42804
42806
|
"instance_type",
|
|
@@ -44036,6 +44038,77 @@ var validateExports = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
|
|
|
44036
44038
|
}
|
|
44037
44039
|
return valid;
|
|
44038
44040
|
}, "validateExports");
|
|
44041
|
+
var CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MIN = 1;
|
|
44042
|
+
var CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MAX = 99;
|
|
44043
|
+
var CONTAINER_OBSERVABILITY_TARGET_INSTANCE_COUNT_MIN = 1;
|
|
44044
|
+
function isContainerObservabilityEnabled(observability) {
|
|
44045
|
+
return observability?.logs?.enabled === true || observability?.enabled === true;
|
|
44046
|
+
}
|
|
44047
|
+
__name$3(isContainerObservabilityEnabled, "isContainerObservabilityEnabled");
|
|
44048
|
+
function hasConflictingContainerObservabilityEnabledValues(observability) {
|
|
44049
|
+
return typeof observability.enabled === "boolean" && typeof observability.logs?.enabled === "boolean" && observability.enabled !== observability.logs.enabled;
|
|
44050
|
+
}
|
|
44051
|
+
__name$3(hasConflictingContainerObservabilityEnabledValues, "hasConflictingContainerObservabilityEnabledValues");
|
|
44052
|
+
var validateContainerObservability = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
|
|
44053
|
+
if (value === void 0) return true;
|
|
44054
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
44055
|
+
diagnostics.errors.push(`"${field}" should be an object but got ${JSON.stringify(value)}.`);
|
|
44056
|
+
return false;
|
|
44057
|
+
}
|
|
44058
|
+
const val = value;
|
|
44059
|
+
let isValid = true;
|
|
44060
|
+
isValid = validateOptionalProperty(diagnostics, field, "enabled", val.enabled, "boolean") && isValid;
|
|
44061
|
+
if (val.logs !== void 0) if (typeof val.logs !== "object" || val.logs === null || Array.isArray(val.logs)) {
|
|
44062
|
+
diagnostics.errors.push(`Expected "${field}.logs" to be of type object but got ${JSON.stringify(val.logs)}.`);
|
|
44063
|
+
isValid = false;
|
|
44064
|
+
} else {
|
|
44065
|
+
isValid = validateOptionalProperty(diagnostics, field, "logs.enabled", val.logs.enabled, "boolean") && isValid;
|
|
44066
|
+
isValid = validateAdditionalProperties(diagnostics, `${field}.logs`, Object.keys(val.logs), ["enabled"]) && isValid;
|
|
44067
|
+
}
|
|
44068
|
+
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, [{
|
|
44069
|
+
key: "enabled",
|
|
44070
|
+
value: val.enabled,
|
|
44071
|
+
type: "boolean"
|
|
44072
|
+
}, {
|
|
44073
|
+
key: "logs.enabled",
|
|
44074
|
+
value: val.logs?.enabled,
|
|
44075
|
+
type: "boolean"
|
|
44076
|
+
}]) && isValid;
|
|
44077
|
+
isValid = validateOptionalProperty(diagnostics, field, "target_instance_percentage", val.target_instance_percentage, "number") && isValid;
|
|
44078
|
+
isValid = validateOptionalProperty(diagnostics, field, "target_instance_count", val.target_instance_count, "number") && isValid;
|
|
44079
|
+
isValid = validateAdditionalProperties(diagnostics, field, Object.keys(val), [
|
|
44080
|
+
"enabled",
|
|
44081
|
+
"logs",
|
|
44082
|
+
"target_instance_percentage",
|
|
44083
|
+
"target_instance_count"
|
|
44084
|
+
]) && isValid;
|
|
44085
|
+
if (hasConflictingContainerObservabilityEnabledValues(val)) {
|
|
44086
|
+
diagnostics.errors.push(`"${field}.enabled" and "${field}.logs.enabled" cannot be set to different values.`);
|
|
44087
|
+
isValid = false;
|
|
44088
|
+
}
|
|
44089
|
+
if (val.target_instance_percentage !== void 0 && val.target_instance_count !== void 0) {
|
|
44090
|
+
diagnostics.errors.push(`"${field}.target_instance_percentage" and "${field}.target_instance_count" cannot both be set.`);
|
|
44091
|
+
isValid = false;
|
|
44092
|
+
}
|
|
44093
|
+
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)) {
|
|
44094
|
+
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.`);
|
|
44095
|
+
isValid = false;
|
|
44096
|
+
}
|
|
44097
|
+
if (typeof val.target_instance_count === "number" && (!Number.isInteger(val.target_instance_count) || val.target_instance_count < CONTAINER_OBSERVABILITY_TARGET_INSTANCE_COUNT_MIN)) {
|
|
44098
|
+
diagnostics.errors.push(`"${field}.target_instance_count" must be a positive integer.`);
|
|
44099
|
+
isValid = false;
|
|
44100
|
+
}
|
|
44101
|
+
const observabilityEnabled = isContainerObservabilityEnabled(val);
|
|
44102
|
+
if (val.target_instance_percentage !== void 0 && !observabilityEnabled) {
|
|
44103
|
+
diagnostics.errors.push(`"${field}.target_instance_percentage" requires "${field}.enabled" or "${field}.logs.enabled" to be true because container observability overrides root observability.`);
|
|
44104
|
+
isValid = false;
|
|
44105
|
+
}
|
|
44106
|
+
if (val.target_instance_count !== void 0 && !observabilityEnabled) {
|
|
44107
|
+
diagnostics.errors.push(`"${field}.target_instance_count" requires "${field}.enabled" or "${field}.logs.enabled" to be true because container observability overrides root observability.`);
|
|
44108
|
+
isValid = false;
|
|
44109
|
+
}
|
|
44110
|
+
return isValid;
|
|
44111
|
+
}, "validateContainerObservability");
|
|
44039
44112
|
var validateObservability = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
|
|
44040
44113
|
if (value === void 0) return true;
|
|
44041
44114
|
if (typeof value !== "object" || value === null) {
|
|
@@ -44137,11 +44210,11 @@ var validateCache = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
|
|
|
44137
44210
|
isValid = validateAdditionalProperties(diagnostics, field, Object.keys(val), ["enabled", "cross_version_cache"]) && isValid;
|
|
44138
44211
|
return isValid;
|
|
44139
44212
|
}, "validateCache");
|
|
44140
|
-
function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects, migrations, exports$1
|
|
44213
|
+
function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects, migrations, exports$1, configPath) {
|
|
44141
44214
|
if (!Array.isArray(durableObjects.bindings) || durableObjects.bindings.length === 0) return;
|
|
44142
44215
|
const exportedDurableObjects = durableObjects.bindings.filter((binding) => !binding.script_name);
|
|
44143
44216
|
const exportsCovers = /* @__PURE__ */ __name$3((className) => {
|
|
44144
|
-
const entry = exports$1
|
|
44217
|
+
const entry = exports$1?.[className];
|
|
44145
44218
|
if (entry === void 0 || entry.type !== "durable-object") return false;
|
|
44146
44219
|
const state = entry.state ?? "created";
|
|
44147
44220
|
return state === "created" || state === "expecting-transfer";
|
|
@@ -44163,11 +44236,11 @@ function warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, durableObjects,
|
|
|
44163
44236
|
\`\`\``);
|
|
44164
44237
|
}
|
|
44165
44238
|
__name$3(warnIfDurableObjectsHaveNoLifecycleConfig, "warnIfDurableObjectsHaveNoLifecycleConfig");
|
|
44166
|
-
function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$1
|
|
44167
|
-
if (migrations.length > 0 && exports$1
|
|
44239
|
+
function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$1) {
|
|
44240
|
+
if (migrations.length > 0 && exports$1 !== void 0 && Object.values(exports$1).some((entry) => entry.type === "durable-object")) diagnostics.errors.push(`\`migrations\` and \`exports\` are mutually exclusive. Choose one or the other to declare your Durable Object lifecycle, but not both.`);
|
|
44168
44241
|
}
|
|
44169
44242
|
__name$3(errorIfMigrationsAndExportsBothSet, "errorIfMigrationsAndExportsBothSet");
|
|
44170
|
-
function validateContainerExportLinks(diagnostics, containers, exports$1
|
|
44243
|
+
function validateContainerExportLinks(diagnostics, containers, exports$1, containersDeclaredElsewhere) {
|
|
44171
44244
|
if (containers !== void 0 && !Array.isArray(containers)) return;
|
|
44172
44245
|
if (containers === void 0 && containersDeclaredElsewhere) return;
|
|
44173
44246
|
const containersByName = /* @__PURE__ */ new Map();
|
|
@@ -44185,7 +44258,7 @@ function validateContainerExportLinks(diagnostics, containers, exports$1$1, cont
|
|
|
44185
44258
|
}
|
|
44186
44259
|
const overSubscribedClassNames = new Set([...containerCountByClassName].filter(([, count]) => count > 1).map(([className]) => className));
|
|
44187
44260
|
for (const className of [...overSubscribedClassNames].sort()) diagnostics.errors.push(`More than one container is attached to the Durable Object "${className}". A Durable Object can only have one container attached to it.`);
|
|
44188
|
-
const durableObjectExports = getDurableObjectExports(exports$1
|
|
44261
|
+
const durableObjectExports = getDurableObjectExports(exports$1);
|
|
44189
44262
|
const liveExportClassNames = /* @__PURE__ */ new Set();
|
|
44190
44263
|
const classNamesByContainerName = /* @__PURE__ */ new Map();
|
|
44191
44264
|
for (const [className, entry] of Object.entries(durableObjectExports)) {
|
|
@@ -44199,7 +44272,7 @@ function validateContainerExportLinks(diagnostics, containers, exports$1$1, cont
|
|
|
44199
44272
|
classNamesByContainerName.set(entry.container, [...classNamesByContainerName.get(entry.container) ?? [], className]);
|
|
44200
44273
|
}
|
|
44201
44274
|
for (const [containerName, classNames] of classNamesByContainerName) if (classNames.length > 1) diagnostics.errors.push(`The container "${containerName}" is referenced by more than one Durable Object export (${classNames.join(", ")}). A container can only back a single Durable Object.`);
|
|
44202
|
-
const containerNameToClassName = getContainerNameToClassNameMap(exports$1
|
|
44275
|
+
const containerNameToClassName = getContainerNameToClassNameMap(exports$1);
|
|
44203
44276
|
const usesDurableObjectExports = Object.keys(durableObjectExports).length > 0;
|
|
44204
44277
|
for (const container of containers ?? []) {
|
|
44205
44278
|
if (typeof container.name !== "string") continue;
|
|
@@ -44777,8 +44850,8 @@ function getBindingKey(type) {
|
|
|
44777
44850
|
return "binding";
|
|
44778
44851
|
}
|
|
44779
44852
|
__name$3(getBindingKey, "getBindingKey");
|
|
44780
|
-
function extractBindingsOfType(type, bindings
|
|
44781
|
-
return Object.entries(bindings
|
|
44853
|
+
function extractBindingsOfType(type, bindings) {
|
|
44854
|
+
return Object.entries(bindings ?? {}).filter((binding) => binding[1].type === type).map((binding) => ({
|
|
44782
44855
|
...binding[1],
|
|
44783
44856
|
[getBindingKey(type)]: binding[0]
|
|
44784
44857
|
}));
|
|
@@ -44795,7 +44868,7 @@ __name$3(getBindings, "getBindings");
|
|
|
44795
44868
|
var { dim: dim$1, white: white$1 } = source_default;
|
|
44796
44869
|
var brandColor$1 = source_default.hex("#BD5B08");
|
|
44797
44870
|
var isConnectedStatusExplained = false;
|
|
44798
|
-
function printBindings(bindings
|
|
44871
|
+
function printBindings(bindings, options) {
|
|
44799
44872
|
const { containers = [], log: log$2, streamingTailConsumers = [], tailConsumers = [] } = options;
|
|
44800
44873
|
const context = options;
|
|
44801
44874
|
let hasConnectionStatus = false;
|
|
@@ -44810,48 +44883,48 @@ function printBindings(bindings$1, options) {
|
|
|
44810
44883
|
return `${s.substring(0, maxLength - 3)}...`;
|
|
44811
44884
|
}, "truncate");
|
|
44812
44885
|
const output = [];
|
|
44813
|
-
const data_blobs = extractBindingsOfType("data_blob", bindings
|
|
44814
|
-
const durable_objects = extractBindingsOfType("durable_object_namespace", bindings
|
|
44815
|
-
const workflows = extractBindingsOfType("workflow", bindings
|
|
44816
|
-
const kv_namespaces = extractBindingsOfType("kv_namespace", bindings
|
|
44817
|
-
const send_email = extractBindingsOfType("send_email", bindings
|
|
44818
|
-
const queues = extractBindingsOfType("queue", bindings
|
|
44819
|
-
const d1_databases = extractBindingsOfType("d1", bindings
|
|
44820
|
-
const vectorize = extractBindingsOfType("vectorize", bindings
|
|
44821
|
-
const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings
|
|
44822
|
-
const ai_search = extractBindingsOfType("ai_search", bindings
|
|
44823
|
-
const websearch = extractBindingsOfType("websearch", bindings
|
|
44824
|
-
const agent_memory = extractBindingsOfType("agent_memory", bindings
|
|
44825
|
-
const hyperdrive = extractBindingsOfType("hyperdrive", bindings
|
|
44826
|
-
const r2_buckets = extractBindingsOfType("r2_bucket", bindings
|
|
44827
|
-
const logfwdr = extractBindingsOfType("logfwdr", bindings
|
|
44828
|
-
const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings
|
|
44829
|
-
const artifacts = extractBindingsOfType("artifacts", bindings
|
|
44830
|
-
const services = extractBindingsOfType("service", bindings
|
|
44831
|
-
const vpc_services = extractBindingsOfType("vpc_service", bindings
|
|
44832
|
-
const vpc_networks = extractBindingsOfType("vpc_network", bindings
|
|
44833
|
-
const analytics_engine_datasets = extractBindingsOfType("analytics_engine", bindings
|
|
44834
|
-
const text_blobs = extractBindingsOfType("text_blob", bindings
|
|
44835
|
-
const browser = extractBindingsOfType("browser", bindings
|
|
44836
|
-
const images = extractBindingsOfType("images", bindings
|
|
44837
|
-
const stream$2 = extractBindingsOfType("stream", bindings
|
|
44838
|
-
const ai = extractBindingsOfType("ai", bindings
|
|
44839
|
-
const version_metadata = extractBindingsOfType("version_metadata", bindings
|
|
44840
|
-
const vars = Object.entries(bindings
|
|
44886
|
+
const data_blobs = extractBindingsOfType("data_blob", bindings);
|
|
44887
|
+
const durable_objects = extractBindingsOfType("durable_object_namespace", bindings);
|
|
44888
|
+
const workflows = extractBindingsOfType("workflow", bindings);
|
|
44889
|
+
const kv_namespaces = extractBindingsOfType("kv_namespace", bindings);
|
|
44890
|
+
const send_email = extractBindingsOfType("send_email", bindings);
|
|
44891
|
+
const queues = extractBindingsOfType("queue", bindings);
|
|
44892
|
+
const d1_databases = extractBindingsOfType("d1", bindings);
|
|
44893
|
+
const vectorize = extractBindingsOfType("vectorize", bindings);
|
|
44894
|
+
const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings);
|
|
44895
|
+
const ai_search = extractBindingsOfType("ai_search", bindings);
|
|
44896
|
+
const websearch = extractBindingsOfType("websearch", bindings);
|
|
44897
|
+
const agent_memory = extractBindingsOfType("agent_memory", bindings);
|
|
44898
|
+
const hyperdrive = extractBindingsOfType("hyperdrive", bindings);
|
|
44899
|
+
const r2_buckets = extractBindingsOfType("r2_bucket", bindings);
|
|
44900
|
+
const logfwdr = extractBindingsOfType("logfwdr", bindings);
|
|
44901
|
+
const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings);
|
|
44902
|
+
const artifacts = extractBindingsOfType("artifacts", bindings);
|
|
44903
|
+
const services = extractBindingsOfType("service", bindings);
|
|
44904
|
+
const vpc_services = extractBindingsOfType("vpc_service", bindings);
|
|
44905
|
+
const vpc_networks = extractBindingsOfType("vpc_network", bindings);
|
|
44906
|
+
const analytics_engine_datasets = extractBindingsOfType("analytics_engine", bindings);
|
|
44907
|
+
const text_blobs = extractBindingsOfType("text_blob", bindings);
|
|
44908
|
+
const browser = extractBindingsOfType("browser", bindings);
|
|
44909
|
+
const images = extractBindingsOfType("images", bindings);
|
|
44910
|
+
const stream$2 = extractBindingsOfType("stream", bindings);
|
|
44911
|
+
const ai = extractBindingsOfType("ai", bindings);
|
|
44912
|
+
const version_metadata = extractBindingsOfType("version_metadata", bindings);
|
|
44913
|
+
const vars = Object.entries(bindings ?? {}).filter(([_, binding]) => binding.type === "plain_text" || binding.type === "json" || binding.type === "secret_text").map(([name, binding]) => ({
|
|
44841
44914
|
binding: name,
|
|
44842
44915
|
...binding
|
|
44843
44916
|
}));
|
|
44844
|
-
const wasm_modules = extractBindingsOfType("wasm_module", bindings
|
|
44845
|
-
const dispatch_namespaces = extractBindingsOfType("dispatch_namespace", bindings
|
|
44846
|
-
const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings
|
|
44847
|
-
const pipelines = extractBindingsOfType("pipeline", bindings
|
|
44848
|
-
const ratelimits = extractBindingsOfType("ratelimit", bindings
|
|
44849
|
-
const assets = extractBindingsOfType("assets", bindings
|
|
44850
|
-
const unsafe_hello_world = extractBindingsOfType("unsafe_hello_world", bindings
|
|
44851
|
-
const flagship = extractBindingsOfType("flagship", bindings
|
|
44852
|
-
const media = extractBindingsOfType("media", bindings
|
|
44853
|
-
const worker_loaders = extractBindingsOfType("worker_loader", bindings
|
|
44854
|
-
const unsafe_bindings = Object.entries(bindings
|
|
44917
|
+
const wasm_modules = extractBindingsOfType("wasm_module", bindings);
|
|
44918
|
+
const dispatch_namespaces = extractBindingsOfType("dispatch_namespace", bindings);
|
|
44919
|
+
const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings);
|
|
44920
|
+
const pipelines = extractBindingsOfType("pipeline", bindings);
|
|
44921
|
+
const ratelimits = extractBindingsOfType("ratelimit", bindings);
|
|
44922
|
+
const assets = extractBindingsOfType("assets", bindings);
|
|
44923
|
+
const unsafe_hello_world = extractBindingsOfType("unsafe_hello_world", bindings);
|
|
44924
|
+
const flagship = extractBindingsOfType("flagship", bindings);
|
|
44925
|
+
const media = extractBindingsOfType("media", bindings);
|
|
44926
|
+
const worker_loaders = extractBindingsOfType("worker_loader", bindings);
|
|
44927
|
+
const unsafe_bindings = Object.entries(bindings ?? {}).filter(([_, binding]) => isUnsafeBindingType(binding.type) && binding.type !== "unsafe_hello_world").map(([name, binding]) => ({
|
|
44855
44928
|
name,
|
|
44856
44929
|
...binding
|
|
44857
44930
|
}));
|
|
@@ -45586,6 +45659,267 @@ function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
|
|
|
45586
45659
|
};
|
|
45587
45660
|
}
|
|
45588
45661
|
__name$3(getWranglerTmpDir, "getWranglerTmpDir");
|
|
45662
|
+
function buildDetailedError(message, ...extra) {
|
|
45663
|
+
return new ParseError({
|
|
45664
|
+
text: message,
|
|
45665
|
+
notes: extra.map((text) => ({ text })),
|
|
45666
|
+
telemetryMessage: false
|
|
45667
|
+
});
|
|
45668
|
+
}
|
|
45669
|
+
__name$3(buildDetailedError, "buildDetailedError");
|
|
45670
|
+
function maybeThrowFriendlyError(error51) {
|
|
45671
|
+
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.");
|
|
45672
|
+
}
|
|
45673
|
+
__name$3(maybeThrowFriendlyError, "maybeThrowFriendlyError");
|
|
45674
|
+
function logHeaders(headers, logger$1) {
|
|
45675
|
+
const clone2 = cloneHeaders(headers);
|
|
45676
|
+
clone2.delete("Authorization");
|
|
45677
|
+
logger$1.debugWithSanitization?.("HEADERS:", JSON.stringify(Object.fromEntries(clone2), null, 2));
|
|
45678
|
+
}
|
|
45679
|
+
__name$3(logHeaders, "logHeaders");
|
|
45680
|
+
async function performApiFetchBase(complianceConfig, resource, init$2 = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
45681
|
+
assert(credentials, "credentials are required for performApiFetch");
|
|
45682
|
+
const method = init$2.method ?? "GET";
|
|
45683
|
+
assert(resource.startsWith("/"), `CF API fetch - resource path must start with a "/" but got "${resource}"`);
|
|
45684
|
+
const headers = cloneHeaders(new import_undici$3.Headers(init$2.headers));
|
|
45685
|
+
addAuthorizationHeader(headers, credentials);
|
|
45686
|
+
headers.set("User-Agent", userAgent);
|
|
45687
|
+
maybeAddTraceHeader(headers);
|
|
45688
|
+
const queryString = queryParams ? `?${queryParams.toString()}` : "";
|
|
45689
|
+
logger$1.debug(`-- START CF API REQUEST: ${method} ${getCloudflareApiBaseUrl(complianceConfig)}${resource}`);
|
|
45690
|
+
logger$1.debugWithSanitization?.("QUERY STRING:", queryString);
|
|
45691
|
+
logHeaders(headers, logger$1);
|
|
45692
|
+
logger$1.debugWithSanitization?.("INIT:", JSON.stringify({ ...init$2 }, null, 2));
|
|
45693
|
+
if (init$2.body instanceof import_undici$3.FormData) logger$1.debugWithSanitization?.("BODY:", await new import_undici$3.Response(init$2.body).text(), null, 2);
|
|
45694
|
+
logger$1.debug("-- END CF API REQUEST");
|
|
45695
|
+
return await (0, import_undici$3.fetch)(`${getCloudflareApiBaseUrl(complianceConfig)}${resource}${queryString}`, {
|
|
45696
|
+
method,
|
|
45697
|
+
...init$2,
|
|
45698
|
+
headers,
|
|
45699
|
+
signal: abortSignal
|
|
45700
|
+
});
|
|
45701
|
+
}
|
|
45702
|
+
__name$3(performApiFetchBase, "performApiFetchBase");
|
|
45703
|
+
async function fetchInternalBase(complianceConfig, resource, init$2 = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
45704
|
+
const method = init$2.method ?? "GET";
|
|
45705
|
+
const response = await performApiFetchBase(complianceConfig, resource, init$2, userAgent, logger$1, queryParams, abortSignal, credentials);
|
|
45706
|
+
const jsonText = await response.text();
|
|
45707
|
+
logger$1.debug("-- START CF API RESPONSE:", response.statusText, response.status);
|
|
45708
|
+
logHeaders(response.headers, logger$1);
|
|
45709
|
+
logger$1.debugWithSanitization?.("RESPONSE:", jsonText);
|
|
45710
|
+
logger$1.debug("-- END CF API RESPONSE");
|
|
45711
|
+
const retryAfterMs = parseRetryAfterMs(response.headers);
|
|
45712
|
+
if (!jsonText && (response.status === 204 || response.status === 205)) return {
|
|
45713
|
+
response: {
|
|
45714
|
+
result: {},
|
|
45715
|
+
success: true,
|
|
45716
|
+
errors: [],
|
|
45717
|
+
messages: []
|
|
45718
|
+
},
|
|
45719
|
+
status: response.status,
|
|
45720
|
+
retryAfterMs
|
|
45721
|
+
};
|
|
45722
|
+
if (isWAFBlockResponse(response.headers)) throwWAFBlockError(response.headers, method, resource, response.status, response.statusText, retryAfterMs);
|
|
45723
|
+
try {
|
|
45724
|
+
return {
|
|
45725
|
+
response: parseJSON(jsonText),
|
|
45726
|
+
status: response.status,
|
|
45727
|
+
retryAfterMs
|
|
45728
|
+
};
|
|
45729
|
+
} catch {
|
|
45730
|
+
const rayId = extractWAFBlockRayId(response.headers);
|
|
45731
|
+
throw new APIError({
|
|
45732
|
+
text: "Received a malformed response from the API",
|
|
45733
|
+
notes: [
|
|
45734
|
+
{ text: truncate(jsonText, 100) },
|
|
45735
|
+
{ text: `${method} ${resource} -> ${response.status} ${response.statusText}` },
|
|
45736
|
+
...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : []
|
|
45737
|
+
],
|
|
45738
|
+
status: response.status,
|
|
45739
|
+
retryAfterMs,
|
|
45740
|
+
telemetryMessage: false
|
|
45741
|
+
});
|
|
45742
|
+
}
|
|
45743
|
+
}
|
|
45744
|
+
__name$3(fetchInternalBase, "fetchInternalBase");
|
|
45745
|
+
async function fetchResultBase(complianceConfig, resource, init$2 = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
45746
|
+
const { response: json2, status: status$1, retryAfterMs } = await fetchInternalBase(complianceConfig, resource, init$2, userAgent, logger$1, queryParams, abortSignal, credentials);
|
|
45747
|
+
if (json2.success) return json2.result;
|
|
45748
|
+
else throwFetchError(resource, json2, status$1, retryAfterMs);
|
|
45749
|
+
}
|
|
45750
|
+
__name$3(fetchResultBase, "fetchResultBase");
|
|
45751
|
+
async function fetchListResultBase(complianceConfig, resource, init$2 = {}, userAgent, logger$1, queryParams, credentials) {
|
|
45752
|
+
const results = [];
|
|
45753
|
+
let getMoreResults = true;
|
|
45754
|
+
let cursor$1;
|
|
45755
|
+
while (getMoreResults) {
|
|
45756
|
+
if (cursor$1) {
|
|
45757
|
+
queryParams = new URLSearchParams$1(queryParams);
|
|
45758
|
+
queryParams.set("cursor", cursor$1);
|
|
45759
|
+
}
|
|
45760
|
+
const { response: json2, status: status$1, retryAfterMs } = await fetchInternalBase(complianceConfig, resource, init$2, userAgent, logger$1, queryParams, void 0, credentials);
|
|
45761
|
+
if (json2.success) {
|
|
45762
|
+
results.push(...json2.result);
|
|
45763
|
+
if (hasCursor(json2.result_info)) cursor$1 = json2.result_info?.cursor;
|
|
45764
|
+
else getMoreResults = false;
|
|
45765
|
+
} else throwFetchError(resource, json2, status$1, retryAfterMs);
|
|
45766
|
+
}
|
|
45767
|
+
return results;
|
|
45768
|
+
}
|
|
45769
|
+
__name$3(fetchListResultBase, "fetchListResultBase");
|
|
45770
|
+
function truncate(text, maxLength) {
|
|
45771
|
+
const { length } = text;
|
|
45772
|
+
if (length <= maxLength) return text;
|
|
45773
|
+
return `${text.substring(0, maxLength)}... (length = ${length})`;
|
|
45774
|
+
}
|
|
45775
|
+
__name$3(truncate, "truncate");
|
|
45776
|
+
function isWAFBlockResponse(headers) {
|
|
45777
|
+
return headers.get("cf-mitigated") === "challenge";
|
|
45778
|
+
}
|
|
45779
|
+
__name$3(isWAFBlockResponse, "isWAFBlockResponse");
|
|
45780
|
+
function parseRetryAfterValue(retryAfter) {
|
|
45781
|
+
if (!retryAfter) return;
|
|
45782
|
+
if (/^\d+$/.test(retryAfter.trim())) return Number(retryAfter) * 1e3;
|
|
45783
|
+
const retryAfterDate = new Date(retryAfter);
|
|
45784
|
+
if (!Number.isNaN(retryAfterDate.getTime())) return Math.max(0, retryAfterDate.getTime() - Date.now());
|
|
45785
|
+
}
|
|
45786
|
+
__name$3(parseRetryAfterValue, "parseRetryAfterValue");
|
|
45787
|
+
function parseRetryAfterMs(headers) {
|
|
45788
|
+
return parseRetryAfterValue(headers.get("Retry-After"));
|
|
45789
|
+
}
|
|
45790
|
+
__name$3(parseRetryAfterMs, "parseRetryAfterMs");
|
|
45791
|
+
function extractWAFBlockRayId(headers) {
|
|
45792
|
+
return headers.get("cf-ray") ?? void 0;
|
|
45793
|
+
}
|
|
45794
|
+
__name$3(extractWAFBlockRayId, "extractWAFBlockRayId");
|
|
45795
|
+
function extractAccountTag(resource) {
|
|
45796
|
+
return (/* @__PURE__ */ new RegExp("/accounts/([a-zA-Z0-9]+)/?")).exec(resource)?.[1];
|
|
45797
|
+
}
|
|
45798
|
+
__name$3(extractAccountTag, "extractAccountTag");
|
|
45799
|
+
function hasMorePages(result_info) {
|
|
45800
|
+
const page = result_info?.page;
|
|
45801
|
+
const per_page = result_info?.per_page;
|
|
45802
|
+
const total = result_info?.total_count;
|
|
45803
|
+
return page !== void 0 && per_page !== void 0 && total !== void 0 && page * per_page < total;
|
|
45804
|
+
}
|
|
45805
|
+
__name$3(hasMorePages, "hasMorePages");
|
|
45806
|
+
function renderError(err, level = 0) {
|
|
45807
|
+
const indent = " ".repeat(level);
|
|
45808
|
+
const message = err.message ?? "";
|
|
45809
|
+
const chainedMessages = "error_chain" in err ? err.error_chain?.map((chainedError) => `
|
|
45810
|
+
|
|
45811
|
+
${indent}- ${renderError(chainedError, level + 1)}`).join("\n") ?? "" : "";
|
|
45812
|
+
return (err.code ? `${message} [code: ${err.code}]` : message) + (err.documentation_url ? `
|
|
45813
|
+
${indent}To learn more about this error, visit: ${err.documentation_url}` : "") + chainedMessages;
|
|
45814
|
+
}
|
|
45815
|
+
__name$3(renderError, "renderError");
|
|
45816
|
+
function addAuthorizationHeader(headers, auth, overrideExisting = false) {
|
|
45817
|
+
if (!headers.has("Authorization") || overrideExisting) if ("apiToken" in auth) {
|
|
45818
|
+
const authorizationHeader = `Bearer ${auth.apiToken}`;
|
|
45819
|
+
validateAuthorizationHeaderValue(authorizationHeader);
|
|
45820
|
+
headers.set("Authorization", authorizationHeader);
|
|
45821
|
+
} else {
|
|
45822
|
+
headers.set("X-Auth-Key", auth.authKey);
|
|
45823
|
+
headers.set("X-Auth-Email", auth.authEmail);
|
|
45824
|
+
}
|
|
45825
|
+
}
|
|
45826
|
+
__name$3(addAuthorizationHeader, "addAuthorizationHeader");
|
|
45827
|
+
function validateAuthorizationHeaderValue(value) {
|
|
45828
|
+
for (const character of value) {
|
|
45829
|
+
const codePoint = character.codePointAt(0);
|
|
45830
|
+
if (codePoint === void 0 || codePoint > 255) throw new UserError$1(`The configured Cloudflare API token contains a character that cannot be used in an HTTP Authorization header: ${formatAuthorizationHeaderCharacter(character, codePoint)}. Recreate or copy the token again, making sure it does not include characters such as ellipses.`, { telemetryMessage: "cfetch auth invalid authorization header" });
|
|
45831
|
+
}
|
|
45832
|
+
}
|
|
45833
|
+
__name$3(validateAuthorizationHeaderValue, "validateAuthorizationHeaderValue");
|
|
45834
|
+
function formatAuthorizationHeaderCharacter(character, codePoint) {
|
|
45835
|
+
if (codePoint === void 0) return "\"\\u{unknown}\"";
|
|
45836
|
+
const codePointLabel = `U+${codePoint.toString(16).toUpperCase().padStart(4, "0")}`;
|
|
45837
|
+
return `${isPrintableCharacter(character) ? `"${character}"` : `"${escapeCharacter(character)}"`} (${codePointLabel})`;
|
|
45838
|
+
}
|
|
45839
|
+
__name$3(formatAuthorizationHeaderCharacter, "formatAuthorizationHeaderCharacter");
|
|
45840
|
+
function isPrintableCharacter(character) {
|
|
45841
|
+
return !/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(character);
|
|
45842
|
+
}
|
|
45843
|
+
__name$3(isPrintableCharacter, "isPrintableCharacter");
|
|
45844
|
+
function escapeCharacter(character) {
|
|
45845
|
+
return Array.from(character).map((c$1) => {
|
|
45846
|
+
const codePoint = c$1.codePointAt(0);
|
|
45847
|
+
if (codePoint === void 0) return "";
|
|
45848
|
+
return codePoint <= 65535 ? `\\u${codePoint.toString(16).toUpperCase().padStart(4, "0")}` : `\\u{${codePoint.toString(16).toUpperCase()}}`;
|
|
45849
|
+
}).join("");
|
|
45850
|
+
}
|
|
45851
|
+
__name$3(escapeCharacter, "escapeCharacter");
|
|
45852
|
+
function throwFetchError(resource, response, status$1, retryAfterMs) {
|
|
45853
|
+
const errors$1 = response.errors ?? [];
|
|
45854
|
+
for (const error52 of errors$1) maybeThrowFriendlyError(error52);
|
|
45855
|
+
const notes = [...errors$1.map((err) => ({ text: renderError(err) })), ...response.messages?.map((msg) => ({ text: typeof msg === "string" ? msg : msg.message ?? String(msg) })) ?? []];
|
|
45856
|
+
if (notes.length === 0) {
|
|
45857
|
+
const raw = response;
|
|
45858
|
+
const fallbackMessage = typeof raw.error === "string" ? `${raw.error}${raw.code ? ` [code: ${raw.code}]` : ""}` : void 0;
|
|
45859
|
+
if (fallbackMessage) notes.push({ text: fallbackMessage });
|
|
45860
|
+
}
|
|
45861
|
+
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.` });
|
|
45862
|
+
const error51 = new APIError({
|
|
45863
|
+
text: `A request to the Cloudflare API (${resource}) failed.`,
|
|
45864
|
+
notes,
|
|
45865
|
+
status: status$1,
|
|
45866
|
+
retryAfterMs,
|
|
45867
|
+
telemetryMessage: false
|
|
45868
|
+
});
|
|
45869
|
+
const code = errors$1[0]?.code;
|
|
45870
|
+
if (code) error51.code = code;
|
|
45871
|
+
const meta3 = errors$1[0]?.meta;
|
|
45872
|
+
if (meta3) error51.meta = meta3;
|
|
45873
|
+
error51.accountTag = extractAccountTag(resource);
|
|
45874
|
+
throw error51;
|
|
45875
|
+
}
|
|
45876
|
+
__name$3(throwFetchError, "throwFetchError");
|
|
45877
|
+
function throwWAFBlockError(headers, method, resource, status$1, statusText, retryAfterMs) {
|
|
45878
|
+
const rayId = extractWAFBlockRayId(headers);
|
|
45879
|
+
throw new APIError({
|
|
45880
|
+
text: "The Cloudflare API responded with a WAF block page instead of the expected JSON response",
|
|
45881
|
+
notes: [
|
|
45882
|
+
{ text: "Cloudflare's firewall (WAF) blocked this API request. This is usually a false positive." },
|
|
45883
|
+
...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : [],
|
|
45884
|
+
{ 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." },
|
|
45885
|
+
{ text: `${method} ${resource} -> ${status$1} ${statusText}` }
|
|
45886
|
+
],
|
|
45887
|
+
status: status$1,
|
|
45888
|
+
retryAfterMs,
|
|
45889
|
+
telemetryMessage: false
|
|
45890
|
+
});
|
|
45891
|
+
}
|
|
45892
|
+
__name$3(throwWAFBlockError, "throwWAFBlockError");
|
|
45893
|
+
async function fetchKVGetValueBase(complianceConfig, accountId, namespaceId, key, userAgent, logger$1, credentials) {
|
|
45894
|
+
const headers = new import_undici$3.Headers();
|
|
45895
|
+
addAuthorizationHeader(headers, credentials);
|
|
45896
|
+
headers.set("User-Agent", userAgent);
|
|
45897
|
+
maybeAddTraceHeader(headers);
|
|
45898
|
+
const resource = `${getCloudflareApiBaseUrl(complianceConfig)}/accounts/${accountId}/storage/kv/namespaces/${namespaceId}/values/${key}`;
|
|
45899
|
+
logger$1.debug(`-- START CF API REQUEST: GET ${resource}`);
|
|
45900
|
+
logger$1.debug("-- END CF API REQUEST");
|
|
45901
|
+
const response = await (0, import_undici$3.fetch)(resource, {
|
|
45902
|
+
method: "GET",
|
|
45903
|
+
headers
|
|
45904
|
+
});
|
|
45905
|
+
if (response.ok) return await response.arrayBuffer();
|
|
45906
|
+
else throw new Error(`Failed to fetch ${resource} - ${response.status}: ${response.statusText}`);
|
|
45907
|
+
}
|
|
45908
|
+
__name$3(fetchKVGetValueBase, "fetchKVGetValueBase");
|
|
45909
|
+
function hasCursor(result_info) {
|
|
45910
|
+
const cursor$1 = result_info?.cursor;
|
|
45911
|
+
return cursor$1 !== void 0 && cursor$1 !== null && cursor$1 !== "";
|
|
45912
|
+
}
|
|
45913
|
+
__name$3(hasCursor, "hasCursor");
|
|
45914
|
+
function maybeAddTraceHeader(headers) {
|
|
45915
|
+
const traceHeader = getTraceHeader();
|
|
45916
|
+
if (traceHeader) headers.set("Cf-Trace-Id", traceHeader);
|
|
45917
|
+
}
|
|
45918
|
+
__name$3(maybeAddTraceHeader, "maybeAddTraceHeader");
|
|
45919
|
+
function cloneHeaders(headers) {
|
|
45920
|
+
return new import_undici$3.Headers(headers);
|
|
45921
|
+
}
|
|
45922
|
+
__name$3(cloneHeaders, "cloneHeaders");
|
|
45589
45923
|
var import_command_exists$1 = __toESM(require_command_exists2());
|
|
45590
45924
|
var UPDATE_SERVICE_URL = "https://update.argotunnel.com";
|
|
45591
45925
|
var CLOUDFLARED_VERSION_PATTERN = /^\d{4}\.\d+\.\d+$/;
|
|
@@ -45975,12 +46309,93 @@ function removeCloudflaredCache(version2) {
|
|
|
45975
46309
|
}
|
|
45976
46310
|
__name$3(removeCloudflaredCache, "removeCloudflaredCache");
|
|
45977
46311
|
var TUNNEL_STARTUP_TIMEOUT_MS = 3e4;
|
|
46312
|
+
var TUNNEL_API_TIMEOUT_MS = 6e4;
|
|
45978
46313
|
var TUNNEL_FORCE_KILL_TIMEOUT_MS = 5e3;
|
|
45979
46314
|
var DEFAULT_TUNNEL_EXPIRY_MS = 3600 * 1e3;
|
|
45980
46315
|
var DEFAULT_TUNNEL_EXTENSION_MS = 3600 * 1e3;
|
|
45981
46316
|
var DEFAULT_TUNNEL_MAX_REMAINING_MS = 10800 * 1e3;
|
|
45982
46317
|
var DEFAULT_TUNNEL_REMINDER_INTERVAL_MS = 600 * 1e3;
|
|
45983
46318
|
var QUICK_TUNNEL_URL_REGEX = /https:\/\/[a-z0-9-]+\.trycloudflare\.com/;
|
|
46319
|
+
var LOCAL_TUNNEL_HOSTNAMES = /* @__PURE__ */ new Set([
|
|
46320
|
+
"localhost",
|
|
46321
|
+
"127.0.0.1",
|
|
46322
|
+
"::1",
|
|
46323
|
+
"0.0.0.0",
|
|
46324
|
+
"::"
|
|
46325
|
+
]);
|
|
46326
|
+
async function resolveNamedTunnel(name, origin, options) {
|
|
46327
|
+
const { accountId, apiToken, complianceRegion, logger: logger$1, userAgent, abortSignal } = options;
|
|
46328
|
+
const complianceConfig = { compliance_region: complianceRegion };
|
|
46329
|
+
const resource = `/accounts/${accountId}/cfd_tunnel`;
|
|
46330
|
+
const tunnel = (await fetchResultBase(complianceConfig, resource, void 0, userAgent, logger$1, new URLSearchParams({
|
|
46331
|
+
name,
|
|
46332
|
+
is_deleted: "false"
|
|
46333
|
+
}), createApiAbortSignal(TUNNEL_API_TIMEOUT_MS, abortSignal), apiToken)).find((item) => item.name === name);
|
|
46334
|
+
if (!tunnel) throw new UserError$1(`No Cloudflare Tunnel named "${name}" was found in this account. Use "wrangler tunnel list" to see available tunnels.`, { telemetryMessage: "tunnel resolve named missing tunnel" });
|
|
46335
|
+
const tunnelId = tunnel.id;
|
|
46336
|
+
if (!tunnelId) throw new FatalError$1(`Tunnel "${name}" was found but has no ID. This is unexpected.`, { telemetryMessage: "tunnel resolve named missing tunnel id" });
|
|
46337
|
+
const ingress = (await fetchResultBase(complianceConfig, `${resource}/${tunnelId}/configurations`, void 0, userAgent, logger$1, void 0, createApiAbortSignal(TUNNEL_API_TIMEOUT_MS, abortSignal), apiToken)).config?.ingress ?? [];
|
|
46338
|
+
const hostnames = getMatchingIngressHostnames(origin, ingress);
|
|
46339
|
+
if (hostnames.length === 0) throw new UserError$1(createMissingIngressMessage(name, origin, {
|
|
46340
|
+
dashboardUrl: `https://dash.cloudflare.com/${accountId}/tunnels/${tunnelId}`,
|
|
46341
|
+
ingress
|
|
46342
|
+
}), { telemetryMessage: "tunnel resolve named ingress mismatch" });
|
|
46343
|
+
const token = await fetchResultBase(complianceConfig, `${resource}/${tunnelId}/token`, void 0, userAgent, logger$1, void 0, createApiAbortSignal(TUNNEL_API_TIMEOUT_MS, abortSignal), apiToken);
|
|
46344
|
+
return {
|
|
46345
|
+
hostnames,
|
|
46346
|
+
token: String(token)
|
|
46347
|
+
};
|
|
46348
|
+
}
|
|
46349
|
+
__name$3(resolveNamedTunnel, "resolveNamedTunnel");
|
|
46350
|
+
function getMatchingIngressHostnames(origin, ingressConfig) {
|
|
46351
|
+
const hostnames = /* @__PURE__ */ new Set();
|
|
46352
|
+
const originUrl = normalizeURL(origin);
|
|
46353
|
+
for (const ingress of ingressConfig) try {
|
|
46354
|
+
const serviceUrl = normalizeURL(ingress.service);
|
|
46355
|
+
if (ingress.hostname && serviceUrl.toString() === originUrl.toString()) hostnames.add(ingress.hostname);
|
|
46356
|
+
} catch {}
|
|
46357
|
+
return [...hostnames];
|
|
46358
|
+
}
|
|
46359
|
+
__name$3(getMatchingIngressHostnames, "getMatchingIngressHostnames");
|
|
46360
|
+
function normalizeURL(url2) {
|
|
46361
|
+
const normalizedUrl = new URL(url2);
|
|
46362
|
+
if (LOCAL_TUNNEL_HOSTNAMES.has(normalizedUrl.hostname)) normalizedUrl.hostname = "localhost";
|
|
46363
|
+
if (!normalizedUrl.port) switch (normalizedUrl.protocol) {
|
|
46364
|
+
case "http:":
|
|
46365
|
+
normalizedUrl.port = "80";
|
|
46366
|
+
break;
|
|
46367
|
+
case "https:":
|
|
46368
|
+
normalizedUrl.port = "443";
|
|
46369
|
+
break;
|
|
46370
|
+
}
|
|
46371
|
+
return normalizedUrl;
|
|
46372
|
+
}
|
|
46373
|
+
__name$3(normalizeURL, "normalizeURL");
|
|
46374
|
+
function createApiAbortSignal(timeoutMs, abortSignal) {
|
|
46375
|
+
const timeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
46376
|
+
return abortSignal ? AbortSignal.any([abortSignal, timeoutSignal]) : timeoutSignal;
|
|
46377
|
+
}
|
|
46378
|
+
__name$3(createApiAbortSignal, "createApiAbortSignal");
|
|
46379
|
+
function createMissingIngressMessage(name, origin, { dashboardUrl, ingress }) {
|
|
46380
|
+
if (ingress.length === 0) return [
|
|
46381
|
+
`Tunnel "${name}" has no routes configured.`,
|
|
46382
|
+
"",
|
|
46383
|
+
`Add a route for ${origin} in the Cloudflare dashboard:`,
|
|
46384
|
+
dashboardUrl,
|
|
46385
|
+
""
|
|
46386
|
+
].join("\n");
|
|
46387
|
+
return [
|
|
46388
|
+
`Tunnel "${name}" has no route for ${origin}`,
|
|
46389
|
+
"",
|
|
46390
|
+
"Resolved routes:",
|
|
46391
|
+
...ingress.map(({ hostname: hostname3, service }) => ` - ${hostname3 ?? "(no hostname)"} -> ${service}`),
|
|
46392
|
+
"",
|
|
46393
|
+
"Update your local server settings or the tunnel routes in the Cloudflare dashboard:",
|
|
46394
|
+
dashboardUrl,
|
|
46395
|
+
""
|
|
46396
|
+
].join("\n");
|
|
46397
|
+
}
|
|
46398
|
+
__name$3(createMissingIngressMessage, "createMissingIngressMessage");
|
|
45984
46399
|
function startTunnel(options) {
|
|
45985
46400
|
let disposed = false;
|
|
45986
46401
|
let reminderInterval;
|
|
@@ -46161,267 +46576,6 @@ The local dev server started at ${origin.href}
|
|
|
46161
46576
|
return new Error(errorMessage);
|
|
46162
46577
|
}
|
|
46163
46578
|
__name$3(createTunnelStartupError, "createTunnelStartupError");
|
|
46164
|
-
function buildDetailedError(message, ...extra) {
|
|
46165
|
-
return new ParseError({
|
|
46166
|
-
text: message,
|
|
46167
|
-
notes: extra.map((text) => ({ text })),
|
|
46168
|
-
telemetryMessage: false
|
|
46169
|
-
});
|
|
46170
|
-
}
|
|
46171
|
-
__name$3(buildDetailedError, "buildDetailedError");
|
|
46172
|
-
function maybeThrowFriendlyError(error51) {
|
|
46173
|
-
if (error51.message === "workers.api.error.email_verification_required") throw buildDetailedError("Please verify your account's email address and try again.", "Check your email for a verification link, or login to https://dash.cloudflare.com and request a new one.");
|
|
46174
|
-
}
|
|
46175
|
-
__name$3(maybeThrowFriendlyError, "maybeThrowFriendlyError");
|
|
46176
|
-
function logHeaders(headers, logger$1) {
|
|
46177
|
-
const clone2 = cloneHeaders(headers);
|
|
46178
|
-
clone2.delete("Authorization");
|
|
46179
|
-
logger$1.debugWithSanitization?.("HEADERS:", JSON.stringify(Object.fromEntries(clone2), null, 2));
|
|
46180
|
-
}
|
|
46181
|
-
__name$3(logHeaders, "logHeaders");
|
|
46182
|
-
async function performApiFetchBase(complianceConfig, resource, init$2 = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
46183
|
-
assert(credentials, "credentials are required for performApiFetch");
|
|
46184
|
-
const method = init$2.method ?? "GET";
|
|
46185
|
-
assert(resource.startsWith("/"), `CF API fetch - resource path must start with a "/" but got "${resource}"`);
|
|
46186
|
-
const headers = cloneHeaders(new import_undici$3.Headers(init$2.headers));
|
|
46187
|
-
addAuthorizationHeader(headers, credentials);
|
|
46188
|
-
headers.set("User-Agent", userAgent);
|
|
46189
|
-
maybeAddTraceHeader(headers);
|
|
46190
|
-
const queryString = queryParams ? `?${queryParams.toString()}` : "";
|
|
46191
|
-
logger$1.debug(`-- START CF API REQUEST: ${method} ${getCloudflareApiBaseUrl(complianceConfig)}${resource}`);
|
|
46192
|
-
logger$1.debugWithSanitization?.("QUERY STRING:", queryString);
|
|
46193
|
-
logHeaders(headers, logger$1);
|
|
46194
|
-
logger$1.debugWithSanitization?.("INIT:", JSON.stringify({ ...init$2 }, null, 2));
|
|
46195
|
-
if (init$2.body instanceof import_undici$3.FormData) logger$1.debugWithSanitization?.("BODY:", await new import_undici$3.Response(init$2.body).text(), null, 2);
|
|
46196
|
-
logger$1.debug("-- END CF API REQUEST");
|
|
46197
|
-
return await (0, import_undici$3.fetch)(`${getCloudflareApiBaseUrl(complianceConfig)}${resource}${queryString}`, {
|
|
46198
|
-
method,
|
|
46199
|
-
...init$2,
|
|
46200
|
-
headers,
|
|
46201
|
-
signal: abortSignal
|
|
46202
|
-
});
|
|
46203
|
-
}
|
|
46204
|
-
__name$3(performApiFetchBase, "performApiFetchBase");
|
|
46205
|
-
async function fetchInternalBase(complianceConfig, resource, init$2 = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
46206
|
-
const method = init$2.method ?? "GET";
|
|
46207
|
-
const response = await performApiFetchBase(complianceConfig, resource, init$2, userAgent, logger$1, queryParams, abortSignal, credentials);
|
|
46208
|
-
const jsonText = await response.text();
|
|
46209
|
-
logger$1.debug("-- START CF API RESPONSE:", response.statusText, response.status);
|
|
46210
|
-
logHeaders(response.headers, logger$1);
|
|
46211
|
-
logger$1.debugWithSanitization?.("RESPONSE:", jsonText);
|
|
46212
|
-
logger$1.debug("-- END CF API RESPONSE");
|
|
46213
|
-
const retryAfterMs = parseRetryAfterMs(response.headers);
|
|
46214
|
-
if (!jsonText && (response.status === 204 || response.status === 205)) return {
|
|
46215
|
-
response: {
|
|
46216
|
-
result: {},
|
|
46217
|
-
success: true,
|
|
46218
|
-
errors: [],
|
|
46219
|
-
messages: []
|
|
46220
|
-
},
|
|
46221
|
-
status: response.status,
|
|
46222
|
-
retryAfterMs
|
|
46223
|
-
};
|
|
46224
|
-
if (isWAFBlockResponse(response.headers)) throwWAFBlockError(response.headers, method, resource, response.status, response.statusText, retryAfterMs);
|
|
46225
|
-
try {
|
|
46226
|
-
return {
|
|
46227
|
-
response: parseJSON(jsonText),
|
|
46228
|
-
status: response.status,
|
|
46229
|
-
retryAfterMs
|
|
46230
|
-
};
|
|
46231
|
-
} catch {
|
|
46232
|
-
const rayId = extractWAFBlockRayId(response.headers);
|
|
46233
|
-
throw new APIError({
|
|
46234
|
-
text: "Received a malformed response from the API",
|
|
46235
|
-
notes: [
|
|
46236
|
-
{ text: truncate(jsonText, 100) },
|
|
46237
|
-
{ text: `${method} ${resource} -> ${response.status} ${response.statusText}` },
|
|
46238
|
-
...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : []
|
|
46239
|
-
],
|
|
46240
|
-
status: response.status,
|
|
46241
|
-
retryAfterMs,
|
|
46242
|
-
telemetryMessage: false
|
|
46243
|
-
});
|
|
46244
|
-
}
|
|
46245
|
-
}
|
|
46246
|
-
__name$3(fetchInternalBase, "fetchInternalBase");
|
|
46247
|
-
async function fetchResultBase(complianceConfig, resource, init$2 = {}, userAgent, logger$1, queryParams, abortSignal, credentials) {
|
|
46248
|
-
const { response: json2, status: status$1, retryAfterMs } = await fetchInternalBase(complianceConfig, resource, init$2, userAgent, logger$1, queryParams, abortSignal, credentials);
|
|
46249
|
-
if (json2.success) return json2.result;
|
|
46250
|
-
else throwFetchError(resource, json2, status$1, retryAfterMs);
|
|
46251
|
-
}
|
|
46252
|
-
__name$3(fetchResultBase, "fetchResultBase");
|
|
46253
|
-
async function fetchListResultBase(complianceConfig, resource, init$2 = {}, userAgent, logger$1, queryParams, credentials) {
|
|
46254
|
-
const results = [];
|
|
46255
|
-
let getMoreResults = true;
|
|
46256
|
-
let cursor$1;
|
|
46257
|
-
while (getMoreResults) {
|
|
46258
|
-
if (cursor$1) {
|
|
46259
|
-
queryParams = new URLSearchParams$1(queryParams);
|
|
46260
|
-
queryParams.set("cursor", cursor$1);
|
|
46261
|
-
}
|
|
46262
|
-
const { response: json2, status: status$1, retryAfterMs } = await fetchInternalBase(complianceConfig, resource, init$2, userAgent, logger$1, queryParams, void 0, credentials);
|
|
46263
|
-
if (json2.success) {
|
|
46264
|
-
results.push(...json2.result);
|
|
46265
|
-
if (hasCursor(json2.result_info)) cursor$1 = json2.result_info?.cursor;
|
|
46266
|
-
else getMoreResults = false;
|
|
46267
|
-
} else throwFetchError(resource, json2, status$1, retryAfterMs);
|
|
46268
|
-
}
|
|
46269
|
-
return results;
|
|
46270
|
-
}
|
|
46271
|
-
__name$3(fetchListResultBase, "fetchListResultBase");
|
|
46272
|
-
function truncate(text, maxLength) {
|
|
46273
|
-
const { length } = text;
|
|
46274
|
-
if (length <= maxLength) return text;
|
|
46275
|
-
return `${text.substring(0, maxLength)}... (length = ${length})`;
|
|
46276
|
-
}
|
|
46277
|
-
__name$3(truncate, "truncate");
|
|
46278
|
-
function isWAFBlockResponse(headers) {
|
|
46279
|
-
return headers.get("cf-mitigated") === "challenge";
|
|
46280
|
-
}
|
|
46281
|
-
__name$3(isWAFBlockResponse, "isWAFBlockResponse");
|
|
46282
|
-
function parseRetryAfterValue(retryAfter) {
|
|
46283
|
-
if (!retryAfter) return;
|
|
46284
|
-
if (/^\d+$/.test(retryAfter.trim())) return Number(retryAfter) * 1e3;
|
|
46285
|
-
const retryAfterDate = new Date(retryAfter);
|
|
46286
|
-
if (!Number.isNaN(retryAfterDate.getTime())) return Math.max(0, retryAfterDate.getTime() - Date.now());
|
|
46287
|
-
}
|
|
46288
|
-
__name$3(parseRetryAfterValue, "parseRetryAfterValue");
|
|
46289
|
-
function parseRetryAfterMs(headers) {
|
|
46290
|
-
return parseRetryAfterValue(headers.get("Retry-After"));
|
|
46291
|
-
}
|
|
46292
|
-
__name$3(parseRetryAfterMs, "parseRetryAfterMs");
|
|
46293
|
-
function extractWAFBlockRayId(headers) {
|
|
46294
|
-
return headers.get("cf-ray") ?? void 0;
|
|
46295
|
-
}
|
|
46296
|
-
__name$3(extractWAFBlockRayId, "extractWAFBlockRayId");
|
|
46297
|
-
function extractAccountTag(resource) {
|
|
46298
|
-
return (/* @__PURE__ */ new RegExp("/accounts/([a-zA-Z0-9]+)/?")).exec(resource)?.[1];
|
|
46299
|
-
}
|
|
46300
|
-
__name$3(extractAccountTag, "extractAccountTag");
|
|
46301
|
-
function hasMorePages(result_info) {
|
|
46302
|
-
const page = result_info?.page;
|
|
46303
|
-
const per_page = result_info?.per_page;
|
|
46304
|
-
const total = result_info?.total_count;
|
|
46305
|
-
return page !== void 0 && per_page !== void 0 && total !== void 0 && page * per_page < total;
|
|
46306
|
-
}
|
|
46307
|
-
__name$3(hasMorePages, "hasMorePages");
|
|
46308
|
-
function renderError(err, level = 0) {
|
|
46309
|
-
const indent = " ".repeat(level);
|
|
46310
|
-
const message = err.message ?? "";
|
|
46311
|
-
const chainedMessages = "error_chain" in err ? err.error_chain?.map((chainedError) => `
|
|
46312
|
-
|
|
46313
|
-
${indent}- ${renderError(chainedError, level + 1)}`).join("\n") ?? "" : "";
|
|
46314
|
-
return (err.code ? `${message} [code: ${err.code}]` : message) + (err.documentation_url ? `
|
|
46315
|
-
${indent}To learn more about this error, visit: ${err.documentation_url}` : "") + chainedMessages;
|
|
46316
|
-
}
|
|
46317
|
-
__name$3(renderError, "renderError");
|
|
46318
|
-
function addAuthorizationHeader(headers, auth, overrideExisting = false) {
|
|
46319
|
-
if (!headers.has("Authorization") || overrideExisting) if ("apiToken" in auth) {
|
|
46320
|
-
const authorizationHeader = `Bearer ${auth.apiToken}`;
|
|
46321
|
-
validateAuthorizationHeaderValue(authorizationHeader);
|
|
46322
|
-
headers.set("Authorization", authorizationHeader);
|
|
46323
|
-
} else {
|
|
46324
|
-
headers.set("X-Auth-Key", auth.authKey);
|
|
46325
|
-
headers.set("X-Auth-Email", auth.authEmail);
|
|
46326
|
-
}
|
|
46327
|
-
}
|
|
46328
|
-
__name$3(addAuthorizationHeader, "addAuthorizationHeader");
|
|
46329
|
-
function validateAuthorizationHeaderValue(value) {
|
|
46330
|
-
for (const character of value) {
|
|
46331
|
-
const codePoint = character.codePointAt(0);
|
|
46332
|
-
if (codePoint === void 0 || codePoint > 255) throw new UserError$1(`The configured Cloudflare API token contains a character that cannot be used in an HTTP Authorization header: ${formatAuthorizationHeaderCharacter(character, codePoint)}. Recreate or copy the token again, making sure it does not include characters such as ellipses.`, { telemetryMessage: "cfetch auth invalid authorization header" });
|
|
46333
|
-
}
|
|
46334
|
-
}
|
|
46335
|
-
__name$3(validateAuthorizationHeaderValue, "validateAuthorizationHeaderValue");
|
|
46336
|
-
function formatAuthorizationHeaderCharacter(character, codePoint) {
|
|
46337
|
-
if (codePoint === void 0) return "\"\\u{unknown}\"";
|
|
46338
|
-
const codePointLabel = `U+${codePoint.toString(16).toUpperCase().padStart(4, "0")}`;
|
|
46339
|
-
return `${isPrintableCharacter(character) ? `"${character}"` : `"${escapeCharacter(character)}"`} (${codePointLabel})`;
|
|
46340
|
-
}
|
|
46341
|
-
__name$3(formatAuthorizationHeaderCharacter, "formatAuthorizationHeaderCharacter");
|
|
46342
|
-
function isPrintableCharacter(character) {
|
|
46343
|
-
return !/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(character);
|
|
46344
|
-
}
|
|
46345
|
-
__name$3(isPrintableCharacter, "isPrintableCharacter");
|
|
46346
|
-
function escapeCharacter(character) {
|
|
46347
|
-
return Array.from(character).map((c$1) => {
|
|
46348
|
-
const codePoint = c$1.codePointAt(0);
|
|
46349
|
-
if (codePoint === void 0) return "";
|
|
46350
|
-
return codePoint <= 65535 ? `\\u${codePoint.toString(16).toUpperCase().padStart(4, "0")}` : `\\u{${codePoint.toString(16).toUpperCase()}}`;
|
|
46351
|
-
}).join("");
|
|
46352
|
-
}
|
|
46353
|
-
__name$3(escapeCharacter, "escapeCharacter");
|
|
46354
|
-
function throwFetchError(resource, response, status$1, retryAfterMs) {
|
|
46355
|
-
const errors$1 = response.errors ?? [];
|
|
46356
|
-
for (const error52 of errors$1) maybeThrowFriendlyError(error52);
|
|
46357
|
-
const notes = [...errors$1.map((err) => ({ text: renderError(err) })), ...response.messages?.map((msg) => ({ text: typeof msg === "string" ? msg : msg.message ?? String(msg) })) ?? []];
|
|
46358
|
-
if (notes.length === 0) {
|
|
46359
|
-
const raw = response;
|
|
46360
|
-
const fallbackMessage = typeof raw.error === "string" ? `${raw.error}${raw.code ? ` [code: ${raw.code}]` : ""}` : void 0;
|
|
46361
|
-
if (fallbackMessage) notes.push({ text: fallbackMessage });
|
|
46362
|
-
}
|
|
46363
|
-
if (retryAfterMs !== void 0) notes.push({ text: `The API responded with a "Retry-After" header indicating you should wait ${Math.ceil(retryAfterMs / 1e3)} second(s) before retrying.` });
|
|
46364
|
-
const error51 = new APIError({
|
|
46365
|
-
text: `A request to the Cloudflare API (${resource}) failed.`,
|
|
46366
|
-
notes,
|
|
46367
|
-
status: status$1,
|
|
46368
|
-
retryAfterMs,
|
|
46369
|
-
telemetryMessage: false
|
|
46370
|
-
});
|
|
46371
|
-
const code = errors$1[0]?.code;
|
|
46372
|
-
if (code) error51.code = code;
|
|
46373
|
-
const meta3 = errors$1[0]?.meta;
|
|
46374
|
-
if (meta3) error51.meta = meta3;
|
|
46375
|
-
error51.accountTag = extractAccountTag(resource);
|
|
46376
|
-
throw error51;
|
|
46377
|
-
}
|
|
46378
|
-
__name$3(throwFetchError, "throwFetchError");
|
|
46379
|
-
function throwWAFBlockError(headers, method, resource, status$1, statusText, retryAfterMs) {
|
|
46380
|
-
const rayId = extractWAFBlockRayId(headers);
|
|
46381
|
-
throw new APIError({
|
|
46382
|
-
text: "The Cloudflare API responded with a WAF block page instead of the expected JSON response",
|
|
46383
|
-
notes: [
|
|
46384
|
-
{ text: "Cloudflare's firewall (WAF) blocked this API request. This is usually a false positive." },
|
|
46385
|
-
...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : [],
|
|
46386
|
-
{ text: rayId ? "If the issue persists, please open a Cloudflare Support ticket and include the Ray ID above." : "If the issue persists, please open a Cloudflare Support ticket. You can find the Cloudflare Ray ID on the block page in your browser." },
|
|
46387
|
-
{ text: `${method} ${resource} -> ${status$1} ${statusText}` }
|
|
46388
|
-
],
|
|
46389
|
-
status: status$1,
|
|
46390
|
-
retryAfterMs,
|
|
46391
|
-
telemetryMessage: false
|
|
46392
|
-
});
|
|
46393
|
-
}
|
|
46394
|
-
__name$3(throwWAFBlockError, "throwWAFBlockError");
|
|
46395
|
-
async function fetchKVGetValueBase(complianceConfig, accountId, namespaceId, key, userAgent, logger$1, credentials) {
|
|
46396
|
-
const headers = new import_undici$3.Headers();
|
|
46397
|
-
addAuthorizationHeader(headers, credentials);
|
|
46398
|
-
headers.set("User-Agent", userAgent);
|
|
46399
|
-
maybeAddTraceHeader(headers);
|
|
46400
|
-
const resource = `${getCloudflareApiBaseUrl(complianceConfig)}/accounts/${accountId}/storage/kv/namespaces/${namespaceId}/values/${key}`;
|
|
46401
|
-
logger$1.debug(`-- START CF API REQUEST: GET ${resource}`);
|
|
46402
|
-
logger$1.debug("-- END CF API REQUEST");
|
|
46403
|
-
const response = await (0, import_undici$3.fetch)(resource, {
|
|
46404
|
-
method: "GET",
|
|
46405
|
-
headers
|
|
46406
|
-
});
|
|
46407
|
-
if (response.ok) return await response.arrayBuffer();
|
|
46408
|
-
else throw new Error(`Failed to fetch ${resource} - ${response.status}: ${response.statusText}`);
|
|
46409
|
-
}
|
|
46410
|
-
__name$3(fetchKVGetValueBase, "fetchKVGetValueBase");
|
|
46411
|
-
function hasCursor(result_info) {
|
|
46412
|
-
const cursor$1 = result_info?.cursor;
|
|
46413
|
-
return cursor$1 !== void 0 && cursor$1 !== null && cursor$1 !== "";
|
|
46414
|
-
}
|
|
46415
|
-
__name$3(hasCursor, "hasCursor");
|
|
46416
|
-
function maybeAddTraceHeader(headers) {
|
|
46417
|
-
const traceHeader = getTraceHeader();
|
|
46418
|
-
if (traceHeader) headers.set("Cf-Trace-Id", traceHeader);
|
|
46419
|
-
}
|
|
46420
|
-
__name$3(maybeAddTraceHeader, "maybeAddTraceHeader");
|
|
46421
|
-
function cloneHeaders(headers) {
|
|
46422
|
-
return new import_undici$3.Headers(headers);
|
|
46423
|
-
}
|
|
46424
|
-
__name$3(cloneHeaders, "cloneHeaders");
|
|
46425
46579
|
var import_update_check = __toESM(require_update_check());
|
|
46426
46580
|
var UPDATE_CHECK_TIMEOUT_MS = 3e3;
|
|
46427
46581
|
var TIMED_OUT = Symbol("timed_out");
|
|
@@ -46445,7 +46599,7 @@ async function fetchLatestNpmVersion(name, version2) {
|
|
|
46445
46599
|
__name$3(fetchLatestNpmVersion, "fetchLatestNpmVersion");
|
|
46446
46600
|
async function openInBrowser(url2, logger$1) {
|
|
46447
46601
|
try {
|
|
46448
|
-
const { default: open } = await import("./open-PBXRGS4R-
|
|
46602
|
+
const { default: open } = await import("./open-PBXRGS4R-CzyP5HqI.mjs");
|
|
46449
46603
|
(await open(url2)).on("error", (err) => {
|
|
46450
46604
|
handleBrowserOpenError(url2, err, logger$1);
|
|
46451
46605
|
});
|
|
@@ -48660,8 +48814,8 @@ await cjsModuleLexer.init();
|
|
|
48660
48814
|
* using the same package as Node.
|
|
48661
48815
|
*/
|
|
48662
48816
|
async function getCjsNamedExports(vite, filePath, contents, seen = /* @__PURE__ */ new Set()) {
|
|
48663
|
-
const { exports: exports$
|
|
48664
|
-
const result = new Set(exports$
|
|
48817
|
+
const { exports: exports$1, reexports } = cjsModuleLexer.parse(contents);
|
|
48818
|
+
const result = new Set(exports$1);
|
|
48665
48819
|
for (const reexport of reexports) {
|
|
48666
48820
|
const resolved = await viteResolve(vite, reexport, filePath, true);
|
|
48667
48821
|
if (seen.has(resolved)) continue;
|
|
@@ -52976,7 +53130,7 @@ function createOAuthFlow(ctx) {
|
|
|
52976
53130
|
__name$2(createOAuthFlow, "createOAuthFlow");
|
|
52977
53131
|
var RESERVED_PROFILE_NAMES = ["default", "staging"];
|
|
52978
53132
|
function createProfileStore(args) {
|
|
52979
|
-
const bindings
|
|
53133
|
+
const bindings = {
|
|
52980
53134
|
read() {
|
|
52981
53135
|
return args.bindings.read();
|
|
52982
53136
|
},
|
|
@@ -53042,14 +53196,14 @@ function createProfileStore(args) {
|
|
|
53042
53196
|
};
|
|
53043
53197
|
return {
|
|
53044
53198
|
configs: args.configs,
|
|
53045
|
-
bindings
|
|
53199
|
+
bindings,
|
|
53046
53200
|
resolve(resolveArgs) {
|
|
53047
53201
|
if (resolveArgs.profile) {
|
|
53048
53202
|
if (resolveArgs.profile === "default") return "default";
|
|
53049
53203
|
validateProfileName(resolveArgs.profile);
|
|
53050
53204
|
return resolveArgs.profile;
|
|
53051
53205
|
}
|
|
53052
|
-
const dirProfile = bindings
|
|
53206
|
+
const dirProfile = bindings.getProfileForDirectory(resolveArgs.cwd);
|
|
53053
53207
|
if (dirProfile) return dirProfile;
|
|
53054
53208
|
return "default";
|
|
53055
53209
|
}
|
|
@@ -53065,9 +53219,9 @@ function formatDirectoryForUserError(dir$1) {
|
|
|
53065
53219
|
return path.relative(process.cwd(), dir$1) || ".";
|
|
53066
53220
|
}
|
|
53067
53221
|
__name$2(formatDirectoryForUserError, "formatDirectoryForUserError");
|
|
53068
|
-
function getProfileForDirectoryFromBindings(startDir, bindings
|
|
53222
|
+
function getProfileForDirectoryFromBindings(startDir, bindings) {
|
|
53069
53223
|
const normalizedDir = path.resolve(startDir);
|
|
53070
|
-
const sortedEntries = Object.entries(bindings
|
|
53224
|
+
const sortedEntries = Object.entries(bindings).sort(([a], [b]) => b.length - a.length);
|
|
53071
53225
|
for (const [boundDir, profile] of sortedEntries) {
|
|
53072
53226
|
if (normalizedDir === boundDir) return {
|
|
53073
53227
|
profile,
|
|
@@ -55738,9 +55892,7 @@ var CF_SCOPES = [
|
|
|
55738
55892
|
"dns_records:edit",
|
|
55739
55893
|
"dns_records:read",
|
|
55740
55894
|
"dns_settings:read",
|
|
55741
|
-
"email_routing:read",
|
|
55742
55895
|
"email_routing:write",
|
|
55743
|
-
"email_sending:read",
|
|
55744
55896
|
"email_sending:write",
|
|
55745
55897
|
"firstpartytags:write",
|
|
55746
55898
|
"images:read",
|
|
@@ -59735,7 +59887,7 @@ function fromMimeType(mimeType) {
|
|
|
59735
59887
|
return moduleType;
|
|
59736
59888
|
}
|
|
59737
59889
|
__name$1(fromMimeType, "fromMimeType");
|
|
59738
|
-
function createWorkerUploadForm(worker, bindings
|
|
59890
|
+
function createWorkerUploadForm(worker, bindings, options) {
|
|
59739
59891
|
const formData = new import_undici$1.FormData();
|
|
59740
59892
|
const { main, sourceMaps, migrations, exports: configuredExports, compatibility_date, compatibility_flags, keepVars, keepSecrets, keepBindings, logpush, placement, tail_consumers, streaming_tail_consumers, limits, annotations, keep_assets, assets, observability, cache: cache$1, package_dependencies } = worker;
|
|
59741
59893
|
const assetConfig = {
|
|
@@ -59759,47 +59911,47 @@ function createWorkerUploadForm(worker, bindings$1, options) {
|
|
|
59759
59911
|
}
|
|
59760
59912
|
let { modules } = worker;
|
|
59761
59913
|
const metadataBindings = [];
|
|
59762
|
-
const plain_text = extractBindingsOfType("plain_text", bindings
|
|
59763
|
-
const json_bindings = extractBindingsOfType("json", bindings
|
|
59764
|
-
const secret_text = extractBindingsOfType("secret_text", bindings
|
|
59765
|
-
const kv_namespaces = extractBindingsOfType("kv_namespace", bindings
|
|
59766
|
-
const send_email = extractBindingsOfType("send_email", bindings
|
|
59767
|
-
const durable_objects = extractBindingsOfType("durable_object_namespace", bindings
|
|
59768
|
-
const workflows = extractBindingsOfType("workflow", bindings
|
|
59769
|
-
const queues = extractBindingsOfType("queue", bindings
|
|
59770
|
-
const r2_buckets = extractBindingsOfType("r2_bucket", bindings
|
|
59771
|
-
const d1_databases = extractBindingsOfType("d1", bindings
|
|
59772
|
-
const vectorize = extractBindingsOfType("vectorize", bindings
|
|
59773
|
-
const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings
|
|
59774
|
-
const ai_search = extractBindingsOfType("ai_search", bindings
|
|
59775
|
-
const websearch = extractBindingsOfType("websearch", bindings
|
|
59776
|
-
const agent_memory = extractBindingsOfType("agent_memory", bindings
|
|
59777
|
-
const hyperdrive = extractBindingsOfType("hyperdrive", bindings
|
|
59778
|
-
const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings
|
|
59779
|
-
const artifacts = extractBindingsOfType("artifacts", bindings
|
|
59780
|
-
const unsafe_hello_world = extractBindingsOfType("unsafe_hello_world", bindings
|
|
59781
|
-
const flagship = extractBindingsOfType("flagship", bindings
|
|
59782
|
-
const ratelimits = extractBindingsOfType("ratelimit", bindings
|
|
59783
|
-
const vpc_services = extractBindingsOfType("vpc_service", bindings
|
|
59784
|
-
const vpc_networks = extractBindingsOfType("vpc_network", bindings
|
|
59785
|
-
const services = extractBindingsOfType("service", bindings
|
|
59786
|
-
const analytics_engine_datasets = extractBindingsOfType("analytics_engine", bindings
|
|
59787
|
-
const dispatch_namespaces = extractBindingsOfType("dispatch_namespace", bindings
|
|
59788
|
-
const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings
|
|
59789
|
-
const pipelines = extractBindingsOfType("pipeline", bindings
|
|
59790
|
-
const worker_loaders = extractBindingsOfType("worker_loader", bindings
|
|
59791
|
-
const logfwdr = extractBindingsOfType("logfwdr", bindings
|
|
59792
|
-
const wasm_modules = extractBindingsOfType("wasm_module", bindings
|
|
59793
|
-
const browser = extractBindingsOfType("browser", bindings
|
|
59794
|
-
const ai = extractBindingsOfType("ai", bindings
|
|
59795
|
-
const images = extractBindingsOfType("images", bindings
|
|
59796
|
-
const stream$2 = extractBindingsOfType("stream", bindings
|
|
59797
|
-
const media = extractBindingsOfType("media", bindings
|
|
59798
|
-
const version_metadata = extractBindingsOfType("version_metadata", bindings
|
|
59799
|
-
const assetsBinding = extractBindingsOfType("assets", bindings
|
|
59800
|
-
const text_blobs = extractBindingsOfType("text_blob", bindings
|
|
59801
|
-
const data_blobs = extractBindingsOfType("data_blob", bindings
|
|
59802
|
-
extractBindingsOfType("inherit", bindings
|
|
59914
|
+
const plain_text = extractBindingsOfType("plain_text", bindings);
|
|
59915
|
+
const json_bindings = extractBindingsOfType("json", bindings);
|
|
59916
|
+
const secret_text = extractBindingsOfType("secret_text", bindings);
|
|
59917
|
+
const kv_namespaces = extractBindingsOfType("kv_namespace", bindings);
|
|
59918
|
+
const send_email = extractBindingsOfType("send_email", bindings);
|
|
59919
|
+
const durable_objects = extractBindingsOfType("durable_object_namespace", bindings);
|
|
59920
|
+
const workflows = extractBindingsOfType("workflow", bindings);
|
|
59921
|
+
const queues = extractBindingsOfType("queue", bindings);
|
|
59922
|
+
const r2_buckets = extractBindingsOfType("r2_bucket", bindings);
|
|
59923
|
+
const d1_databases = extractBindingsOfType("d1", bindings);
|
|
59924
|
+
const vectorize = extractBindingsOfType("vectorize", bindings);
|
|
59925
|
+
const ai_search_namespaces = extractBindingsOfType("ai_search_namespace", bindings);
|
|
59926
|
+
const ai_search = extractBindingsOfType("ai_search", bindings);
|
|
59927
|
+
const websearch = extractBindingsOfType("websearch", bindings)[0];
|
|
59928
|
+
const agent_memory = extractBindingsOfType("agent_memory", bindings);
|
|
59929
|
+
const hyperdrive = extractBindingsOfType("hyperdrive", bindings);
|
|
59930
|
+
const secrets_store_secrets = extractBindingsOfType("secrets_store_secret", bindings);
|
|
59931
|
+
const artifacts = extractBindingsOfType("artifacts", bindings);
|
|
59932
|
+
const unsafe_hello_world = extractBindingsOfType("unsafe_hello_world", bindings);
|
|
59933
|
+
const flagship = extractBindingsOfType("flagship", bindings);
|
|
59934
|
+
const ratelimits = extractBindingsOfType("ratelimit", bindings);
|
|
59935
|
+
const vpc_services = extractBindingsOfType("vpc_service", bindings);
|
|
59936
|
+
const vpc_networks = extractBindingsOfType("vpc_network", bindings);
|
|
59937
|
+
const services = extractBindingsOfType("service", bindings);
|
|
59938
|
+
const analytics_engine_datasets = extractBindingsOfType("analytics_engine", bindings);
|
|
59939
|
+
const dispatch_namespaces = extractBindingsOfType("dispatch_namespace", bindings);
|
|
59940
|
+
const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings);
|
|
59941
|
+
const pipelines = extractBindingsOfType("pipeline", bindings);
|
|
59942
|
+
const worker_loaders = extractBindingsOfType("worker_loader", bindings);
|
|
59943
|
+
const logfwdr = extractBindingsOfType("logfwdr", bindings);
|
|
59944
|
+
const wasm_modules = extractBindingsOfType("wasm_module", bindings);
|
|
59945
|
+
const browser = extractBindingsOfType("browser", bindings)[0];
|
|
59946
|
+
const ai = extractBindingsOfType("ai", bindings)[0];
|
|
59947
|
+
const images = extractBindingsOfType("images", bindings)[0];
|
|
59948
|
+
const stream$2 = extractBindingsOfType("stream", bindings)[0];
|
|
59949
|
+
const media = extractBindingsOfType("media", bindings)[0];
|
|
59950
|
+
const version_metadata = extractBindingsOfType("version_metadata", bindings)[0];
|
|
59951
|
+
const assetsBinding = extractBindingsOfType("assets", bindings)[0];
|
|
59952
|
+
const text_blobs = extractBindingsOfType("text_blob", bindings);
|
|
59953
|
+
const data_blobs = extractBindingsOfType("data_blob", bindings);
|
|
59954
|
+
extractBindingsOfType("inherit", bindings).forEach(({ binding }) => {
|
|
59803
59955
|
metadataBindings.push({
|
|
59804
59956
|
name: binding,
|
|
59805
59957
|
type: "inherit"
|
|
@@ -60156,7 +60308,7 @@ function createWorkerUploadForm(worker, bindings$1, options) {
|
|
|
60156
60308
|
});
|
|
60157
60309
|
formData.set(name, new File(["contents" in source ? source.contents : readFileSync(source.path)], "path" in source ? source.path ?? name : name, { type: "application/octet-stream" }));
|
|
60158
60310
|
});
|
|
60159
|
-
for (const [bindingName, config$1] of Object.entries(bindings
|
|
60311
|
+
for (const [bindingName, config$1] of Object.entries(bindings ?? {})) if (isUnsafeBindingType(config$1.type) && config$1.type !== "unsafe_hello_world") {
|
|
60160
60312
|
const { type,...data } = config$1;
|
|
60161
60313
|
metadataBindings.push({
|
|
60162
60314
|
name: bindingName,
|
|
@@ -60254,7 +60406,7 @@ __name$1(createWorkerUploadForm, "createWorkerUploadForm");
|
|
|
60254
60406
|
//#endregion
|
|
60255
60407
|
//#region ../remote-bindings/dist/index.mjs
|
|
60256
60408
|
var import_undici = require_undici();
|
|
60257
|
-
var version = "0.0.
|
|
60409
|
+
var version = "0.0.21";
|
|
60258
60410
|
var NoDefaultValueProvided = class extends UserError$1 {
|
|
60259
60411
|
constructor() {
|
|
60260
60412
|
super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
|
|
@@ -60695,7 +60847,7 @@ function handlePreviewSessionCreationError(err, accountId) {
|
|
|
60695
60847
|
* (flat Record<string, Binding>).
|
|
60696
60848
|
*/
|
|
60697
60849
|
function createRemoteWorkerInit(props) {
|
|
60698
|
-
const bindings
|
|
60850
|
+
const bindings = { ...props.bindings };
|
|
60699
60851
|
return {
|
|
60700
60852
|
name: props.name,
|
|
60701
60853
|
main: {
|
|
@@ -60705,7 +60857,7 @@ function createRemoteWorkerInit(props) {
|
|
|
60705
60857
|
content: props.bundle.entrypointSource
|
|
60706
60858
|
},
|
|
60707
60859
|
modules: props.bundle.modules,
|
|
60708
|
-
bindings
|
|
60860
|
+
bindings,
|
|
60709
60861
|
migrations: void 0,
|
|
60710
60862
|
exports: void 0,
|
|
60711
60863
|
compatibility_date: props.compatibilityDate,
|
|
@@ -61028,11 +61180,11 @@ function findRemoteSessionAuthError(error$2) {
|
|
|
61028
61180
|
if (isErrorEvent(error$2)) return findRemoteSessionAuthError(error$2.cause);
|
|
61029
61181
|
if (error$2 instanceof Error) return findRemoteSessionAuthError(error$2.cause);
|
|
61030
61182
|
}
|
|
61031
|
-
async function startRemoteProxySession(bindings
|
|
61032
|
-
for (const [name, binding] of Object.entries(bindings
|
|
61183
|
+
async function startRemoteProxySession(bindings, options) {
|
|
61184
|
+
for (const [name, binding] of Object.entries(bindings ?? {})) if (binding.type === "flagship" && binding.app_id === void 0) throw new UserError$1(`Flagship binding "${name}" has no \`app_id\` and has not been created, but needs to run remotely. Run \`wrangler flagship apps create\` to create an app.`, { telemetryMessage: "flagship remote binding missing app_id" });
|
|
61033
61185
|
options.logger.log(source_default.dim("⎔ Establishing remote connection..."));
|
|
61034
61186
|
initLogger(getInternalLogger(options.logger));
|
|
61035
|
-
const rawBindings = toRawBindings(bindings
|
|
61187
|
+
const rawBindings = toRawBindings(bindings);
|
|
61036
61188
|
const workerConfig = {
|
|
61037
61189
|
name: options.workerName ?? randomUUID(),
|
|
61038
61190
|
entrypointSource: ProxyServerWorker_default,
|
|
@@ -61099,8 +61251,8 @@ async function startRemoteProxySession(bindings$1, options) {
|
|
|
61099
61251
|
dispose: () => devEnv.teardown()
|
|
61100
61252
|
};
|
|
61101
61253
|
}
|
|
61102
|
-
function toRawBindings(bindings
|
|
61103
|
-
return Object.fromEntries(Object.entries(bindings
|
|
61254
|
+
function toRawBindings(bindings) {
|
|
61255
|
+
return Object.fromEntries(Object.entries(bindings ?? {}).map(([key, binding]) => [key, {
|
|
61104
61256
|
...binding,
|
|
61105
61257
|
raw: true
|
|
61106
61258
|
}]));
|
|
@@ -61119,8 +61271,8 @@ function getInternalLogger(logger$1) {
|
|
|
61119
61271
|
console: disabled
|
|
61120
61272
|
};
|
|
61121
61273
|
}
|
|
61122
|
-
function pickRemoteBindings(bindings
|
|
61123
|
-
return Object.fromEntries(Object.entries(bindings
|
|
61274
|
+
function pickRemoteBindings(bindings) {
|
|
61275
|
+
return Object.fromEntries(Object.entries(bindings ?? {}).filter(([, binding]) => {
|
|
61124
61276
|
if (getBindingLocalSupport(binding.type) === "DO-NOT-USE-this-resource-will-never-have-a-local-simulator") return true;
|
|
61125
61277
|
return "remote" in binding && binding.remote;
|
|
61126
61278
|
}));
|
|
@@ -61164,35 +61316,6 @@ function deepStrictEqual(source, target) {
|
|
|
61164
61316
|
}
|
|
61165
61317
|
}
|
|
61166
61318
|
|
|
61167
|
-
//#endregion
|
|
61168
|
-
//#region ../config/dist/public-BwQqexwo.mjs
|
|
61169
|
-
const DEFINITION = Symbol.for("@cloudflare/config:definition");
|
|
61170
|
-
/**
|
|
61171
|
-
* Unwrap an authored config from its value / promise / function shape, awaiting
|
|
61172
|
-
* the result. A function config is invoked with {@link ConfigContext}.
|
|
61173
|
-
*/
|
|
61174
|
-
async function unwrap(config$1, ctx) {
|
|
61175
|
-
return typeof config$1 === "function" ? await config$1(ctx) : await config$1;
|
|
61176
|
-
}
|
|
61177
|
-
/**
|
|
61178
|
-
* Resolve any `cloudflare.config.ts` export to its plain config value.
|
|
61179
|
-
*
|
|
61180
|
-
* A `define*` helper stores its authored config plus `type` under the
|
|
61181
|
-
* {@link DEFINITION} symbol; here we unwrap the config and stamp `type` back on.
|
|
61182
|
-
* Every other export — a raw object/promise/function — is unwrapped as-is and
|
|
61183
|
-
* already carries its own `type`. Discrimination happens afterwards via `type`.
|
|
61184
|
-
*/
|
|
61185
|
-
async function resolveExportDefinition(def, ctx) {
|
|
61186
|
-
if (typeof def === "object" && def !== null && DEFINITION in def) {
|
|
61187
|
-
const { config: config$1, type } = def[DEFINITION];
|
|
61188
|
-
return {
|
|
61189
|
-
...await unwrap(config$1, ctx),
|
|
61190
|
-
type
|
|
61191
|
-
};
|
|
61192
|
-
}
|
|
61193
|
-
return await unwrap(def, ctx);
|
|
61194
|
-
}
|
|
61195
|
-
|
|
61196
61319
|
//#endregion
|
|
61197
61320
|
//#region ../config/dist/index.mjs
|
|
61198
61321
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -61662,15 +61785,6 @@ const ConfigExportsTypeSchema = z$1.record(z$1.string(), z$1.unknown()).check((c
|
|
|
61662
61785
|
});
|
|
61663
61786
|
}
|
|
61664
61787
|
});
|
|
61665
|
-
const ConfigExportsObjectSchema = z$1.object({ settings: InputSettingsSchema.optional() }).catchall(InputWorkerSchema);
|
|
61666
|
-
/**
|
|
61667
|
-
* Schema for the resolved config exports, keyed by export
|
|
61668
|
-
* name. Each value is discriminated on its `type` field. Reserves the
|
|
61669
|
-
* `settings` export name exclusively for settings configs: a `settings`
|
|
61670
|
-
* config must live on the `settings` export, and the `settings` export
|
|
61671
|
-
* may only hold a `settings` config.
|
|
61672
|
-
*/
|
|
61673
|
-
const ConfigExportsSchema = ConfigExportsTypeSchema.pipe(ConfigExportsObjectSchema);
|
|
61674
61788
|
const ModuleTypeSchema = z$1.enum([
|
|
61675
61789
|
"esm",
|
|
61676
61790
|
"cjs",
|
|
@@ -61706,9 +61820,9 @@ const ManifestSchema = z$1.strictObject({
|
|
|
61706
61820
|
* base schema.
|
|
61707
61821
|
*/
|
|
61708
61822
|
const OutputWorkerSchema = BaseWorkerSchema.extend({ manifest: ManifestSchema.optional() });
|
|
61709
|
-
var import_dist = (/* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/dist/index.js": ((exports$
|
|
61710
|
-
Object.defineProperty(exports$
|
|
61711
|
-
exports$
|
|
61823
|
+
var import_dist = (/* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/dist/index.js": ((exports$1) => {
|
|
61824
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
61825
|
+
exports$1.dedent = void 0;
|
|
61712
61826
|
function dedent$1$1(templ) {
|
|
61713
61827
|
var values = [];
|
|
61714
61828
|
for (var _i = 1; _i < arguments.length; _i++) values[_i - 1] = arguments[_i];
|
|
@@ -61741,7 +61855,7 @@ var import_dist = (/* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ts-ded
|
|
|
61741
61855
|
});
|
|
61742
61856
|
return string$1;
|
|
61743
61857
|
}
|
|
61744
|
-
exports$
|
|
61858
|
+
exports$1.dedent = dedent$1$1;
|
|
61745
61859
|
}) }))();
|
|
61746
61860
|
var __defProp = Object.defineProperty;
|
|
61747
61861
|
var __name = (target, value) => __defProp(target, "name", {
|
|
@@ -62481,15 +62595,100 @@ function cleanupImportAttributes(context) {
|
|
|
62481
62595
|
context.importAttributes = attrs;
|
|
62482
62596
|
Object.freeze(context.importAttributes);
|
|
62483
62597
|
}
|
|
62598
|
+
const CROSS_WORKER_BINDING_TYPES = new Set([
|
|
62599
|
+
"durable-object",
|
|
62600
|
+
"worker",
|
|
62601
|
+
"workflow"
|
|
62602
|
+
]);
|
|
62603
|
+
function isRecord(value) {
|
|
62604
|
+
return typeof value === "object" && value !== null;
|
|
62605
|
+
}
|
|
62606
|
+
function isConfigReference(value) {
|
|
62607
|
+
return typeof value === "function" || isRecord(value);
|
|
62608
|
+
}
|
|
62609
|
+
function createDefinitionResolver(ctx) {
|
|
62610
|
+
const resolvedDefinitions = /* @__PURE__ */ new Map();
|
|
62611
|
+
return (input) => {
|
|
62612
|
+
const cached$1 = resolvedDefinitions.get(input);
|
|
62613
|
+
if (cached$1) return cached$1;
|
|
62614
|
+
const resolved = (async () => {
|
|
62615
|
+
return await (typeof input === "function" ? input(ctx) : input);
|
|
62616
|
+
})();
|
|
62617
|
+
resolvedDefinitions.set(input, resolved);
|
|
62618
|
+
return resolved;
|
|
62619
|
+
};
|
|
62620
|
+
}
|
|
62621
|
+
async function normalizeWorkerReferences(resolved, resolveDefinition) {
|
|
62622
|
+
if (!isRecord(resolved) || !isRecord(resolved.env)) return resolved;
|
|
62623
|
+
const env$2 = { ...resolved.env };
|
|
62624
|
+
for (const [bindingName, binding] of Object.entries(env$2)) {
|
|
62625
|
+
if (!isRecord(binding) || typeof binding.type !== "string" || !CROSS_WORKER_BINDING_TYPES.has(binding.type) || !isConfigReference(binding.worker)) continue;
|
|
62626
|
+
const target = await resolveDefinition(binding.worker);
|
|
62627
|
+
env$2[bindingName] = {
|
|
62628
|
+
...binding,
|
|
62629
|
+
worker: isRecord(target) ? target.name : void 0
|
|
62630
|
+
};
|
|
62631
|
+
}
|
|
62632
|
+
return {
|
|
62633
|
+
...resolved,
|
|
62634
|
+
env: env$2
|
|
62635
|
+
};
|
|
62636
|
+
}
|
|
62637
|
+
function prefixIssues(issues, prefix) {
|
|
62638
|
+
return issues.map((issue$1) => ({
|
|
62639
|
+
...issue$1,
|
|
62640
|
+
path: [prefix, ...issue$1.path]
|
|
62641
|
+
}));
|
|
62642
|
+
}
|
|
62643
|
+
/**
|
|
62644
|
+
* Resolve and validate loaded `cloudflare.config.ts` exports.
|
|
62645
|
+
*
|
|
62646
|
+
* Config inputs are resolved once by identity. Top-level Worker exports are
|
|
62647
|
+
* also parsed once by identity; unexported references are resolved only far
|
|
62648
|
+
* enough to replace the reference with the Worker's name.
|
|
62649
|
+
*/
|
|
62650
|
+
async function resolveAndValidateConfigExports(exports$2, ctx) {
|
|
62651
|
+
const resolveDefinition = createDefinitionResolver(ctx);
|
|
62652
|
+
const parsedWorkers = /* @__PURE__ */ new Map();
|
|
62653
|
+
const resolvedExports = {};
|
|
62654
|
+
for (const [name, input] of Object.entries(exports$2)) resolvedExports[name] = await resolveDefinition(input);
|
|
62655
|
+
const typeResult = ConfigExportsTypeSchema.safeParse(resolvedExports);
|
|
62656
|
+
if (!typeResult.success) return typeResult;
|
|
62657
|
+
const issues = [];
|
|
62658
|
+
const data = {};
|
|
62659
|
+
const resolvedSettings = resolvedExports.settings;
|
|
62660
|
+
const settingsResult = resolvedSettings ? InputSettingsSchema.safeParse(resolvedSettings) : void 0;
|
|
62661
|
+
if (settingsResult) if (settingsResult.success) data.settings = settingsResult.data;
|
|
62662
|
+
else issues.push(...prefixIssues(settingsResult.error.issues, "settings"));
|
|
62663
|
+
for (const [name, input] of Object.entries(exports$2)) {
|
|
62664
|
+
const resolved = resolvedExports[name];
|
|
62665
|
+
if (!isRecord(resolved)) continue;
|
|
62666
|
+
if (resolved.type === "worker") {
|
|
62667
|
+
let result = parsedWorkers.get(input);
|
|
62668
|
+
if (!result) {
|
|
62669
|
+
result = InputWorkerSchema.safeParse(await normalizeWorkerReferences(resolved, resolveDefinition));
|
|
62670
|
+
parsedWorkers.set(input, result);
|
|
62671
|
+
if (!result.success) issues.push(...prefixIssues(result.error.issues, name));
|
|
62672
|
+
}
|
|
62673
|
+
if (result.success) data[name] = result.data;
|
|
62674
|
+
continue;
|
|
62675
|
+
}
|
|
62676
|
+
}
|
|
62677
|
+
return issues.length > 0 ? {
|
|
62678
|
+
success: false,
|
|
62679
|
+
error: new z$1.ZodError(issues)
|
|
62680
|
+
} : {
|
|
62681
|
+
success: true,
|
|
62682
|
+
data
|
|
62683
|
+
};
|
|
62684
|
+
}
|
|
62484
62685
|
/**
|
|
62485
|
-
* Load a `cloudflare.config.ts`, resolve all exports, and validate
|
|
62686
|
+
* Load a `cloudflare.config.ts`, resolve all exports, and validate them.
|
|
62486
62687
|
*/
|
|
62487
62688
|
async function loadAndValidateConfig(configPath, ctx, options) {
|
|
62488
62689
|
const { exports: exports$2, dependencies } = await loadConfig(configPath, options);
|
|
62489
|
-
const resolved = {};
|
|
62490
|
-
for (const [name, value] of Object.entries(exports$2)) resolved[name] = await resolveExportDefinition(value, ctx);
|
|
62491
62690
|
return {
|
|
62492
|
-
result:
|
|
62691
|
+
result: await resolveAndValidateConfigExports(exports$2, ctx),
|
|
62493
62692
|
dependencies
|
|
62494
62693
|
};
|
|
62495
62694
|
}
|