wrangler 4.92.0 → 4.93.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/wrangler-dist/cli.js
CHANGED
|
@@ -9760,7 +9760,7 @@ var require_formdata = __commonJS({
|
|
|
9760
9760
|
var { kEnumerableProperty } = require_util();
|
|
9761
9761
|
var { webidl } = require_webidl();
|
|
9762
9762
|
var nodeUtil = __require("util");
|
|
9763
|
-
var
|
|
9763
|
+
var FormData12 = class _FormData {
|
|
9764
9764
|
static {
|
|
9765
9765
|
__name(this, "FormData");
|
|
9766
9766
|
}
|
|
@@ -9880,11 +9880,11 @@ var require_formdata = __commonJS({
|
|
|
9880
9880
|
formData.#state = newState;
|
|
9881
9881
|
}
|
|
9882
9882
|
};
|
|
9883
|
-
var { getFormDataState, setFormDataState } =
|
|
9884
|
-
Reflect.deleteProperty(
|
|
9885
|
-
Reflect.deleteProperty(
|
|
9886
|
-
iteratorMixin("FormData",
|
|
9887
|
-
Object.defineProperties(
|
|
9883
|
+
var { getFormDataState, setFormDataState } = FormData12;
|
|
9884
|
+
Reflect.deleteProperty(FormData12, "getFormDataState");
|
|
9885
|
+
Reflect.deleteProperty(FormData12, "setFormDataState");
|
|
9886
|
+
iteratorMixin("FormData", FormData12, getFormDataState, "name", "value");
|
|
9887
|
+
Object.defineProperties(FormData12.prototype, {
|
|
9888
9888
|
append: kEnumerableProperty,
|
|
9889
9889
|
delete: kEnumerableProperty,
|
|
9890
9890
|
get: kEnumerableProperty,
|
|
@@ -9912,8 +9912,8 @@ var require_formdata = __commonJS({
|
|
|
9912
9912
|
return { name: name2, value };
|
|
9913
9913
|
}
|
|
9914
9914
|
__name(makeEntry, "makeEntry");
|
|
9915
|
-
webidl.is.FormData = webidl.util.MakeTypeAssertion(
|
|
9916
|
-
module2.exports = { FormData:
|
|
9915
|
+
webidl.is.FormData = webidl.util.MakeTypeAssertion(FormData12);
|
|
9916
|
+
module2.exports = { FormData: FormData12, makeEntry, setFormDataState };
|
|
9917
9917
|
}
|
|
9918
9918
|
});
|
|
9919
9919
|
|
|
@@ -10284,7 +10284,7 @@ var require_body = __commonJS({
|
|
|
10284
10284
|
fullyReadBody,
|
|
10285
10285
|
extractMimeType
|
|
10286
10286
|
} = require_util2();
|
|
10287
|
-
var { FormData:
|
|
10287
|
+
var { FormData: FormData12, setFormDataState } = require_formdata();
|
|
10288
10288
|
var { webidl } = require_webidl();
|
|
10289
10289
|
var assert63 = __require("assert");
|
|
10290
10290
|
var { isErrored, isDisturbed } = __require("stream");
|
|
@@ -10480,13 +10480,13 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
10480
10480
|
switch (mimeType.essence) {
|
|
10481
10481
|
case "multipart/form-data": {
|
|
10482
10482
|
const parsed = multipartFormDataParser(value, mimeType);
|
|
10483
|
-
const fd = new
|
|
10483
|
+
const fd = new FormData12();
|
|
10484
10484
|
setFormDataState(fd, parsed);
|
|
10485
10485
|
return fd;
|
|
10486
10486
|
}
|
|
10487
10487
|
case "application/x-www-form-urlencoded": {
|
|
10488
10488
|
const entries2 = new URLSearchParams(value.toString());
|
|
10489
|
-
const fd = new
|
|
10489
|
+
const fd = new FormData12();
|
|
10490
10490
|
for (const [name2, value2] of entries2) {
|
|
10491
10491
|
fd.append(name2, value2);
|
|
10492
10492
|
}
|
|
@@ -27170,7 +27170,7 @@ var require_permessage_deflate = __commonJS({
|
|
|
27170
27170
|
var kBuffer = Symbol("kBuffer");
|
|
27171
27171
|
var kLength = Symbol("kLength");
|
|
27172
27172
|
var kDefaultMaxDecompressedSize = 4 * 1024 * 1024;
|
|
27173
|
-
var
|
|
27173
|
+
var PerMessageDeflate2 = class {
|
|
27174
27174
|
static {
|
|
27175
27175
|
__name(this, "PerMessageDeflate");
|
|
27176
27176
|
}
|
|
@@ -27251,7 +27251,7 @@ var require_permessage_deflate = __commonJS({
|
|
|
27251
27251
|
});
|
|
27252
27252
|
}
|
|
27253
27253
|
};
|
|
27254
|
-
module2.exports = { PerMessageDeflate };
|
|
27254
|
+
module2.exports = { PerMessageDeflate: PerMessageDeflate2 };
|
|
27255
27255
|
}
|
|
27256
27256
|
});
|
|
27257
27257
|
|
|
@@ -27273,7 +27273,7 @@ var require_receiver = __commonJS({
|
|
|
27273
27273
|
} = require_util5();
|
|
27274
27274
|
var { failWebsocketConnection } = require_connection();
|
|
27275
27275
|
var { WebsocketFrameSend } = require_frame();
|
|
27276
|
-
var { PerMessageDeflate } = require_permessage_deflate();
|
|
27276
|
+
var { PerMessageDeflate: PerMessageDeflate2 } = require_permessage_deflate();
|
|
27277
27277
|
var { MessageSizeExceededError } = require_errors();
|
|
27278
27278
|
var ByteParser = class extends Writable5 {
|
|
27279
27279
|
static {
|
|
@@ -27299,7 +27299,7 @@ var require_receiver = __commonJS({
|
|
|
27299
27299
|
this.#handler = handler;
|
|
27300
27300
|
this.#extensions = extensions == null ? /* @__PURE__ */ new Map() : extensions;
|
|
27301
27301
|
if (this.#extensions.has("permessage-deflate")) {
|
|
27302
|
-
this.#extensions.set("permessage-deflate", new
|
|
27302
|
+
this.#extensions.set("permessage-deflate", new PerMessageDeflate2(extensions));
|
|
27303
27303
|
}
|
|
27304
27304
|
}
|
|
27305
27305
|
/**
|
|
@@ -32704,19 +32704,19 @@ var init_dist = __esm({
|
|
|
32704
32704
|
}
|
|
32705
32705
|
__name(XDG, "XDG");
|
|
32706
32706
|
__name2(XDG, "XDG");
|
|
32707
|
-
var
|
|
32708
|
-
XDG.cache =
|
|
32709
|
-
XDG.config =
|
|
32710
|
-
XDG.data =
|
|
32711
|
-
XDG.runtime =
|
|
32712
|
-
XDG.state =
|
|
32707
|
+
var extension2 = isMacOS ? macos() : isWinOS ? windows() : linux();
|
|
32708
|
+
XDG.cache = extension2.cache;
|
|
32709
|
+
XDG.config = extension2.config;
|
|
32710
|
+
XDG.data = extension2.data;
|
|
32711
|
+
XDG.runtime = extension2.runtime;
|
|
32712
|
+
XDG.state = extension2.state;
|
|
32713
32713
|
XDG.configDirs = /* @__PURE__ */ __name2(/* @__PURE__ */ __name(function configDirs() {
|
|
32714
32714
|
var pathList = env6.get("XDG_CONFIG_DIRS");
|
|
32715
|
-
return __spreadArray2([
|
|
32715
|
+
return __spreadArray2([extension2.config()], pathList ? pathList.split(path410.delimiter) : []);
|
|
32716
32716
|
}, "configDirs"), "configDirs");
|
|
32717
32717
|
XDG.dataDirs = /* @__PURE__ */ __name2(/* @__PURE__ */ __name(function dataDirs() {
|
|
32718
32718
|
var pathList = env6.get("XDG_DATA_DIRS");
|
|
32719
|
-
return __spreadArray2([
|
|
32719
|
+
return __spreadArray2([extension2.data()], pathList ? pathList.split(path410.delimiter) : []);
|
|
32720
32720
|
}, "dataDirs"), "dataDirs");
|
|
32721
32721
|
return XDG;
|
|
32722
32722
|
}
|
|
@@ -45233,6 +45233,36 @@ var init_inspect = __esm({
|
|
|
45233
45233
|
__name(dockerImageInspect, "dockerImageInspect");
|
|
45234
45234
|
}
|
|
45235
45235
|
});
|
|
45236
|
+
function getFailedToRunDockerErrorMessage({
|
|
45237
|
+
numberOfContainers,
|
|
45238
|
+
isDev,
|
|
45239
|
+
isDryRun
|
|
45240
|
+
}) {
|
|
45241
|
+
const operation = isDev ? "running dev" : `deploying${isDryRun ? " (even in dry-run mode)" : ""}`;
|
|
45242
|
+
const headline = `The Docker CLI is needed to build the configured ${numberOfContainers !== 1 ? "images" : "image"} before ${operation} but could not be launched.`;
|
|
45243
|
+
let daemonHint;
|
|
45244
|
+
if (process.platform === "darwin") {
|
|
45245
|
+
daemonHint = "open the Docker Desktop app or run `open -a Docker`";
|
|
45246
|
+
} else if (process.platform === "win32") {
|
|
45247
|
+
daemonHint = "open the Docker Desktop app";
|
|
45248
|
+
} else {
|
|
45249
|
+
daemonHint = "run `sudo systemctl start docker`";
|
|
45250
|
+
}
|
|
45251
|
+
const steps = `To fix this, try the following:
|
|
45252
|
+
- If Docker is not installed, download it from https://docs.docker.com/get-started/get-docker/
|
|
45253
|
+
- If Docker is installed but the daemon is not running,
|
|
45254
|
+
${daemonHint}.
|
|
45255
|
+
- If you use an alternative Docker-compatible CLI (e.g. Podman),
|
|
45256
|
+
set the WRANGLER_DOCKER_BIN environment variable to its path and DOCKER_HOST to its socket.`;
|
|
45257
|
+
const alternatives = "Note: Other container tooling that is compatible with the Docker CLI and engine may work, but is not yet guaranteed to do so.";
|
|
45258
|
+
const hint = isDev ? "To suppress this error if you do not intend on triggering any container instances, set dev.enable_containers to false in your Wrangler config or pass --enable-containers=false." : "If you cannot run Docker locally, you can still deploy your Worker by passing --containers-rollout=none. This will not deploy or update your Container.";
|
|
45259
|
+
return `${headline}
|
|
45260
|
+
${steps}
|
|
45261
|
+
|
|
45262
|
+
${alternatives}
|
|
45263
|
+
|
|
45264
|
+
${hint}`;
|
|
45265
|
+
}
|
|
45236
45266
|
function getContainerIdsByImageTags(dockerPath, imageTags) {
|
|
45237
45267
|
const ids = /* @__PURE__ */ new Set();
|
|
45238
45268
|
for (const imageTag of imageTags) {
|
|
@@ -45306,8 +45336,9 @@ async function getImageRepoTags(dockerPath, imageTag) {
|
|
|
45306
45336
|
async function cleanupDuplicateImageTags(dockerPath, imageTag) {
|
|
45307
45337
|
try {
|
|
45308
45338
|
const repoTags = await getImageRepoTags(dockerPath, imageTag);
|
|
45339
|
+
const currentBuildId = getImageTag(imageTag);
|
|
45309
45340
|
const tagsToRemove = repoTags.filter(
|
|
45310
|
-
(tag) => tag
|
|
45341
|
+
(tag) => tag.startsWith("cloudflare-dev") && getImageTag(tag) !== currentBuildId
|
|
45311
45342
|
);
|
|
45312
45343
|
if (tagsToRemove.length > 0) {
|
|
45313
45344
|
runDockerCmdWithOutput(dockerPath, ["rmi", ...tagsToRemove]);
|
|
@@ -45315,6 +45346,10 @@ async function cleanupDuplicateImageTags(dockerPath, imageTag) {
|
|
|
45315
45346
|
} catch {
|
|
45316
45347
|
}
|
|
45317
45348
|
}
|
|
45349
|
+
function getImageTag(imageTag) {
|
|
45350
|
+
const tagSeparatorIndex = imageTag.lastIndexOf(":");
|
|
45351
|
+
return tagSeparatorIndex === -1 ? void 0 : imageTag.slice(tagSeparatorIndex + 1);
|
|
45352
|
+
}
|
|
45318
45353
|
var runDockerCmd, runDockerCmdWithOutput, isDockerRunning, verifyDockerInstalled, cleanupContainers, getContainerIdsFromImage;
|
|
45319
45354
|
var init_utils = __esm({
|
|
45320
45355
|
"../containers-shared/src/utils.ts"() {
|
|
@@ -45399,16 +45434,27 @@ var init_utils = __esm({
|
|
|
45399
45434
|
}
|
|
45400
45435
|
return true;
|
|
45401
45436
|
}, "isDockerRunning");
|
|
45402
|
-
verifyDockerInstalled = /* @__PURE__ */ __name(async (
|
|
45437
|
+
verifyDockerInstalled = /* @__PURE__ */ __name(async ({
|
|
45438
|
+
dockerPath,
|
|
45439
|
+
numberOfContainers,
|
|
45440
|
+
isDev = true,
|
|
45441
|
+
isDryRun = false
|
|
45442
|
+
}) => {
|
|
45403
45443
|
const dockerIsRunning = await isDockerRunning(dockerPath);
|
|
45404
45444
|
if (!dockerIsRunning) {
|
|
45405
45445
|
throw new UserError(
|
|
45406
|
-
|
|
45407
|
-
|
|
45408
|
-
|
|
45446
|
+
getFailedToRunDockerErrorMessage({
|
|
45447
|
+
numberOfContainers,
|
|
45448
|
+
isDev,
|
|
45449
|
+
isDryRun
|
|
45450
|
+
}),
|
|
45451
|
+
{
|
|
45452
|
+
telemetryMessage: false
|
|
45453
|
+
}
|
|
45409
45454
|
);
|
|
45410
45455
|
}
|
|
45411
45456
|
}, "verifyDockerInstalled");
|
|
45457
|
+
__name(getFailedToRunDockerErrorMessage, "getFailedToRunDockerErrorMessage");
|
|
45412
45458
|
cleanupContainers = /* @__PURE__ */ __name((dockerPath, imageTags) => {
|
|
45413
45459
|
try {
|
|
45414
45460
|
const containerIds = getContainerIdsByImageTags(dockerPath, imageTags);
|
|
@@ -45439,6 +45485,7 @@ Other container tooling that is compatible with the Docker CLI and engine may wo
|
|
|
45439
45485
|
__name(resolveDockerHost, "resolveDockerHost");
|
|
45440
45486
|
__name(getImageRepoTags, "getImageRepoTags");
|
|
45441
45487
|
__name(cleanupDuplicateImageTags, "cleanupDuplicateImageTags");
|
|
45488
|
+
__name(getImageTag, "getImageTag");
|
|
45442
45489
|
}
|
|
45443
45490
|
});
|
|
45444
45491
|
|
|
@@ -45507,7 +45554,10 @@ async function prepareContainerImagesForDev(args) {
|
|
|
45507
45554
|
{ telemetryMessage: false }
|
|
45508
45555
|
);
|
|
45509
45556
|
}
|
|
45510
|
-
await verifyDockerInstalled(
|
|
45557
|
+
await verifyDockerInstalled({
|
|
45558
|
+
dockerPath,
|
|
45559
|
+
numberOfContainers: containerOptions.length
|
|
45560
|
+
});
|
|
45511
45561
|
for (const options of containerOptions) {
|
|
45512
45562
|
if ("dockerfile" in options) {
|
|
45513
45563
|
const build5 = await buildImage(dockerPath, options);
|
|
@@ -49983,9 +50033,35 @@ function getWranglerHiddenDirPath(projectRoot) {
|
|
|
49983
50033
|
projectRoot ??= process.cwd();
|
|
49984
50034
|
return path3__namespace.default.join(projectRoot, ".wrangler");
|
|
49985
50035
|
}
|
|
50036
|
+
function sweepStaleWranglerTmpDirs(tmpRoot) {
|
|
50037
|
+
if (sweptTmpRoots.has(tmpRoot)) {
|
|
50038
|
+
return;
|
|
50039
|
+
}
|
|
50040
|
+
sweptTmpRoots.add(tmpRoot);
|
|
50041
|
+
let entries2;
|
|
50042
|
+
try {
|
|
50043
|
+
entries2 = fs27__namespace.default.readdirSync(tmpRoot, { withFileTypes: true });
|
|
50044
|
+
} catch {
|
|
50045
|
+
return;
|
|
50046
|
+
}
|
|
50047
|
+
const cutoff = Date.now() - STALE_WRANGLER_TMP_DIR_MS;
|
|
50048
|
+
for (const entry of entries2) {
|
|
50049
|
+
if (!entry.isDirectory()) {
|
|
50050
|
+
continue;
|
|
50051
|
+
}
|
|
50052
|
+
const entryPath = path3__namespace.default.join(tmpRoot, entry.name);
|
|
50053
|
+
try {
|
|
50054
|
+
if (fs27__namespace.default.statSync(entryPath).mtimeMs < cutoff) {
|
|
50055
|
+
removeDirSync(entryPath);
|
|
50056
|
+
}
|
|
50057
|
+
} catch {
|
|
50058
|
+
}
|
|
50059
|
+
}
|
|
50060
|
+
}
|
|
49986
50061
|
function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
|
|
49987
50062
|
const tmpRoot = path3__namespace.default.join(getWranglerHiddenDirPath(projectRoot), "tmp");
|
|
49988
50063
|
fs27__namespace.default.mkdirSync(tmpRoot, { recursive: true });
|
|
50064
|
+
sweepStaleWranglerTmpDirs(tmpRoot);
|
|
49989
50065
|
const tmpPrefix = path3__namespace.default.join(tmpRoot, `${prefix}-`);
|
|
49990
50066
|
const tmpDir = fs27__namespace.default.realpathSync(fs27__namespace.default.mkdtempSync(tmpPrefix));
|
|
49991
50067
|
const cleanupDir = /* @__PURE__ */ __name(() => {
|
|
@@ -50005,7 +50081,7 @@ function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
|
|
|
50005
50081
|
}
|
|
50006
50082
|
};
|
|
50007
50083
|
}
|
|
50008
|
-
var import_signal_exit2;
|
|
50084
|
+
var import_signal_exit2, STALE_WRANGLER_TMP_DIR_MS, sweptTmpRoots;
|
|
50009
50085
|
var init_paths = __esm({
|
|
50010
50086
|
"src/paths.ts"() {
|
|
50011
50087
|
init_import_meta_url();
|
|
@@ -50015,6 +50091,9 @@ var init_paths = __esm({
|
|
|
50015
50091
|
__name(readableRelative, "readableRelative");
|
|
50016
50092
|
__name(getBasePath, "getBasePath");
|
|
50017
50093
|
__name(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
|
|
50094
|
+
STALE_WRANGLER_TMP_DIR_MS = 24 * 60 * 60 * 1e3;
|
|
50095
|
+
sweptTmpRoots = /* @__PURE__ */ new Set();
|
|
50096
|
+
__name(sweepStaleWranglerTmpDirs, "sweepStaleWranglerTmpDirs");
|
|
50018
50097
|
__name(getWranglerTmpDir, "getWranglerTmpDir");
|
|
50019
50098
|
}
|
|
50020
50099
|
});
|
|
@@ -55872,7 +55951,7 @@ var name, version;
|
|
|
55872
55951
|
var init_package = __esm({
|
|
55873
55952
|
"package.json"() {
|
|
55874
55953
|
name = "wrangler";
|
|
55875
|
-
version = "4.
|
|
55954
|
+
version = "4.93.1";
|
|
55876
55955
|
}
|
|
55877
55956
|
});
|
|
55878
55957
|
function getWranglerVersion() {
|
|
@@ -62091,21 +62170,21 @@ var init_Mime = __esm({
|
|
|
62091
62170
|
}
|
|
62092
62171
|
const allExtensions = __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type);
|
|
62093
62172
|
let first = true;
|
|
62094
|
-
for (let
|
|
62095
|
-
const starred =
|
|
62096
|
-
|
|
62097
|
-
allExtensions?.add(
|
|
62173
|
+
for (let extension2 of extensions) {
|
|
62174
|
+
const starred = extension2.startsWith("*");
|
|
62175
|
+
extension2 = starred ? extension2.slice(1) : extension2;
|
|
62176
|
+
allExtensions?.add(extension2);
|
|
62098
62177
|
if (first) {
|
|
62099
|
-
__classPrivateFieldGet(this, _Mime_typeToExtension, "f").set(type,
|
|
62178
|
+
__classPrivateFieldGet(this, _Mime_typeToExtension, "f").set(type, extension2);
|
|
62100
62179
|
}
|
|
62101
62180
|
first = false;
|
|
62102
62181
|
if (starred)
|
|
62103
62182
|
continue;
|
|
62104
|
-
const currentType = __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(
|
|
62183
|
+
const currentType = __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(extension2);
|
|
62105
62184
|
if (currentType && currentType != type && !force) {
|
|
62106
|
-
throw new Error(`"${type} -> ${
|
|
62185
|
+
throw new Error(`"${type} -> ${extension2}" conflicts with "${currentType} -> ${extension2}". Pass \`force=true\` to override this definition.`);
|
|
62107
62186
|
}
|
|
62108
|
-
__classPrivateFieldGet(this, _Mime_extensionToType, "f").set(
|
|
62187
|
+
__classPrivateFieldGet(this, _Mime_extensionToType, "f").set(extension2, type);
|
|
62109
62188
|
}
|
|
62110
62189
|
}
|
|
62111
62190
|
return this;
|
|
@@ -133195,8 +133274,11 @@ var init_cfetch = __esm({
|
|
|
133195
133274
|
});
|
|
133196
133275
|
|
|
133197
133276
|
// src/user/fetch-accounts.ts
|
|
133277
|
+
function getErrorCode(err) {
|
|
133278
|
+
return err?.code;
|
|
133279
|
+
}
|
|
133198
133280
|
function isMembershipsInaccessible(err) {
|
|
133199
|
-
const code = err
|
|
133281
|
+
const code = getErrorCode(err);
|
|
133200
133282
|
return code !== void 0 && MEMBERSHIPS_INACCESSIBLE_CODES.includes(code);
|
|
133201
133283
|
}
|
|
133202
133284
|
async function fetchAllAccounts(complianceConfig, options = {}) {
|
|
@@ -133216,6 +133298,16 @@ async function fetchAllAccounts(complianceConfig, options = {}) {
|
|
|
133216
133298
|
if (accountsRes.status === "fulfilled" && accountsRes.value.length > 0) {
|
|
133217
133299
|
return accountsRes.value;
|
|
133218
133300
|
}
|
|
133301
|
+
const errCode = getErrorCode(membershipsRes.reason);
|
|
133302
|
+
if (errCode === 9106) {
|
|
133303
|
+
throw new UserError(
|
|
133304
|
+
`Failed to automatically retrieve account IDs for the logged in user.
|
|
133305
|
+
You may have incorrect permissions on your API token, or an environment variable such as CLOUDFLARE_API_TOKEN, CLOUDFLARE_API_KEY, or CLOUDFLARE_EMAIL may be set to an invalid value.
|
|
133306
|
+
Check your environment and unset or correct any Cloudflare credential variables, or run \`wrangler logout\` followed by \`wrangler login\` to re-authenticate.
|
|
133307
|
+
You can also skip this account check by adding an \`account_id\` in your ${configFileName(void 0)} file, or by setting the value of CLOUDFLARE_ACCOUNT_ID`,
|
|
133308
|
+
{ telemetryMessage: "user account fetch permission denied" }
|
|
133309
|
+
);
|
|
133310
|
+
}
|
|
133219
133311
|
throw new UserError(
|
|
133220
133312
|
`Failed to automatically retrieve account IDs for the logged in user.
|
|
133221
133313
|
You may have incorrect permissions on your API token. You can skip this account check by adding an \`account_id\` in your ${configFileName(void 0)} file, or by setting the value of CLOUDFLARE_ACCOUNT_ID`,
|
|
@@ -133245,6 +133337,7 @@ var init_fetch_accounts = __esm({
|
|
|
133245
133337
|
init_dist();
|
|
133246
133338
|
init_cfetch();
|
|
133247
133339
|
MEMBERSHIPS_INACCESSIBLE_CODES = [9106, 1e4];
|
|
133340
|
+
__name(getErrorCode, "getErrorCode");
|
|
133248
133341
|
__name(isMembershipsInaccessible, "isMembershipsInaccessible");
|
|
133249
133342
|
__name(fetchAllAccounts, "fetchAllAccounts");
|
|
133250
133343
|
}
|
|
@@ -133292,51 +133385,50 @@ function getAuthFromEnv() {
|
|
|
133292
133385
|
function validateScopeKeys(scopes) {
|
|
133293
133386
|
return scopes.every((scope) => scope in DefaultScopes);
|
|
133294
133387
|
}
|
|
133295
|
-
function
|
|
133388
|
+
function readStoredAuthState(config) {
|
|
133389
|
+
let parsed;
|
|
133296
133390
|
try {
|
|
133297
|
-
|
|
133298
|
-
|
|
133299
|
-
}
|
|
133300
|
-
|
|
133301
|
-
|
|
133302
|
-
|
|
133303
|
-
|
|
133304
|
-
|
|
133305
|
-
|
|
133306
|
-
|
|
133307
|
-
|
|
133308
|
-
|
|
133309
|
-
|
|
133310
|
-
|
|
133311
|
-
}
|
|
133391
|
+
parsed = config ?? readAuthConfigFile();
|
|
133392
|
+
} catch {
|
|
133393
|
+
return {};
|
|
133394
|
+
}
|
|
133395
|
+
const { oauth_token, refresh_token, expiration_time, scopes, api_token } = parsed;
|
|
133396
|
+
if (oauth_token) {
|
|
133397
|
+
return {
|
|
133398
|
+
accessToken: {
|
|
133399
|
+
value: oauth_token,
|
|
133400
|
+
// If there is no `expiration_time` field then set it to an old date, to cause it to expire immediately.
|
|
133401
|
+
expiry: expiration_time ?? "2000-01-01:00:00:00+00:00"
|
|
133402
|
+
},
|
|
133403
|
+
refreshToken: { value: refresh_token ?? "" },
|
|
133404
|
+
scopes
|
|
133405
|
+
};
|
|
133406
|
+
}
|
|
133407
|
+
if (api_token) {
|
|
133408
|
+
if (!hasWarnedAboutDeprecatedV1ApiToken) {
|
|
133409
|
+
hasWarnedAboutDeprecatedV1ApiToken = true;
|
|
133312
133410
|
logger.warn(
|
|
133313
133411
|
`It looks like you have used Wrangler v1's \`config\` command to login with an API token
|
|
133314
133412
|
from ${config === void 0 ? getAuthConfigFilePath() : "in-memory config"}.
|
|
133315
133413
|
This is no longer supported in the current version of Wrangler.
|
|
133316
133414
|
If you wish to authenticate via an API token then please set the \`CLOUDFLARE_API_TOKEN\` environment variable.`
|
|
133317
133415
|
);
|
|
133318
|
-
return { apiToken: api_token };
|
|
133319
133416
|
}
|
|
133320
|
-
|
|
133321
|
-
return void 0;
|
|
133417
|
+
return { deprecatedApiToken: api_token };
|
|
133322
133418
|
}
|
|
133323
|
-
}
|
|
133324
|
-
function reinitialiseAuthTokens(config) {
|
|
133325
|
-
localState = {
|
|
133326
|
-
...getAuthTokens(config)
|
|
133327
|
-
};
|
|
133419
|
+
return {};
|
|
133328
133420
|
}
|
|
133329
133421
|
function getAPIToken() {
|
|
133330
|
-
|
|
133331
|
-
|
|
133422
|
+
const envAuth = getAuthFromEnv();
|
|
133423
|
+
if (envAuth) {
|
|
133424
|
+
return envAuth;
|
|
133332
133425
|
}
|
|
133333
|
-
const
|
|
133334
|
-
if (
|
|
133335
|
-
return
|
|
133426
|
+
const stored = readStoredAuthState();
|
|
133427
|
+
if (stored.deprecatedApiToken) {
|
|
133428
|
+
return { apiToken: stored.deprecatedApiToken };
|
|
133336
133429
|
}
|
|
133337
|
-
|
|
133338
|
-
|
|
133339
|
-
return { apiToken: storedAccessToken };
|
|
133430
|
+
if (stored.accessToken?.value) {
|
|
133431
|
+
return { apiToken: stored.accessToken.value };
|
|
133340
133432
|
}
|
|
133341
133433
|
return void 0;
|
|
133342
133434
|
}
|
|
@@ -133407,9 +133499,8 @@ function isReturningFromAuthServer(query) {
|
|
|
133407
133499
|
if (!code) {
|
|
133408
133500
|
return false;
|
|
133409
133501
|
}
|
|
133410
|
-
const state2 = localState;
|
|
133411
133502
|
const stateQueryParam = query.state;
|
|
133412
|
-
if (stateQueryParam !==
|
|
133503
|
+
if (stateQueryParam !== oauthFlowState.stateQueryParam) {
|
|
133413
133504
|
logger.warn(
|
|
133414
133505
|
"Received query string parameter doesn't match the one sent! Possible malicious activity somewhere."
|
|
133415
133506
|
);
|
|
@@ -133418,14 +133509,14 @@ function isReturningFromAuthServer(query) {
|
|
|
133418
133509
|
});
|
|
133419
133510
|
}
|
|
133420
133511
|
assert54__default.default(!Array.isArray(code));
|
|
133421
|
-
|
|
133422
|
-
|
|
133512
|
+
oauthFlowState.authorizationCode = code;
|
|
133513
|
+
oauthFlowState.hasAuthCodeBeenExchangedForAccessToken = false;
|
|
133423
133514
|
return true;
|
|
133424
133515
|
}
|
|
133425
133516
|
async function getAuthURL(scopes, clientId) {
|
|
133426
133517
|
const { codeChallenge, codeVerifier } = await generatePKCECodes();
|
|
133427
133518
|
const stateQueryParam = generateRandomState(RECOMMENDED_STATE_LENGTH);
|
|
133428
|
-
Object.assign(
|
|
133519
|
+
Object.assign(oauthFlowState, {
|
|
133429
133520
|
codeChallenge,
|
|
133430
133521
|
codeVerifier,
|
|
133431
133522
|
stateQueryParam
|
|
@@ -133439,12 +133530,13 @@ async function getAuthURL(scopes, clientId) {
|
|
|
133439
133530
|
});
|
|
133440
133531
|
}
|
|
133441
133532
|
async function exchangeRefreshTokenForAccessToken() {
|
|
133442
|
-
|
|
133533
|
+
const storedRefreshToken = readStoredAuthState().refreshToken;
|
|
133534
|
+
if (!storedRefreshToken) {
|
|
133443
133535
|
logger.warn("No refresh token is present.");
|
|
133444
133536
|
}
|
|
133445
133537
|
const params = new URLSearchParams({
|
|
133446
133538
|
grant_type: "refresh_token",
|
|
133447
|
-
refresh_token:
|
|
133539
|
+
refresh_token: storedRefreshToken?.value ?? "",
|
|
133448
133540
|
client_id: getClientIdFromEnv()
|
|
133449
133541
|
});
|
|
133450
133542
|
const response = await fetchAuthToken(params);
|
|
@@ -133470,25 +133562,15 @@ async function exchangeRefreshTokenForAccessToken() {
|
|
|
133470
133562
|
throw json.error;
|
|
133471
133563
|
}
|
|
133472
133564
|
const { access_token, expires_in, refresh_token, scope } = json;
|
|
133473
|
-
let scopes = [];
|
|
133474
133565
|
const accessToken = {
|
|
133475
133566
|
value: access_token,
|
|
133476
133567
|
expiry: new Date(Date.now() + expires_in * 1e3).toISOString()
|
|
133477
133568
|
};
|
|
133478
|
-
|
|
133479
|
-
if (refresh_token) {
|
|
133480
|
-
localState.refreshToken = {
|
|
133481
|
-
value: refresh_token
|
|
133482
|
-
};
|
|
133483
|
-
}
|
|
133484
|
-
if (scope) {
|
|
133485
|
-
scopes = scope.split(" ");
|
|
133486
|
-
localState.scopes = scopes;
|
|
133487
|
-
}
|
|
133569
|
+
const scopes = scope ? scope.split(" ") : [];
|
|
133488
133570
|
const accessContext = {
|
|
133489
133571
|
token: accessToken,
|
|
133490
133572
|
scopes,
|
|
133491
|
-
refreshToken:
|
|
133573
|
+
refreshToken: refresh_token ? { value: refresh_token } : storedRefreshToken
|
|
133492
133574
|
};
|
|
133493
133575
|
return accessContext;
|
|
133494
133576
|
} catch (error2) {
|
|
@@ -133501,7 +133583,7 @@ async function exchangeRefreshTokenForAccessToken() {
|
|
|
133501
133583
|
}
|
|
133502
133584
|
}
|
|
133503
133585
|
async function exchangeAuthCodeForAccessToken() {
|
|
133504
|
-
const { authorizationCode, codeVerifier = "" } =
|
|
133586
|
+
const { authorizationCode, codeVerifier = "" } = oauthFlowState;
|
|
133505
133587
|
if (!codeVerifier) {
|
|
133506
133588
|
logger.warn("No code verifier is being sent.");
|
|
133507
133589
|
} else if (!authorizationCode) {
|
|
@@ -133527,27 +133609,17 @@ async function exchangeAuthCodeForAccessToken() {
|
|
|
133527
133609
|
throw new Error(json.error);
|
|
133528
133610
|
}
|
|
133529
133611
|
const { access_token, expires_in, refresh_token, scope } = json;
|
|
133530
|
-
|
|
133531
|
-
localState.hasAuthCodeBeenExchangedForAccessToken = true;
|
|
133612
|
+
oauthFlowState.hasAuthCodeBeenExchangedForAccessToken = true;
|
|
133532
133613
|
const expiryDate = new Date(Date.now() + expires_in * 1e3);
|
|
133533
133614
|
const accessToken = {
|
|
133534
133615
|
value: access_token,
|
|
133535
133616
|
expiry: expiryDate.toISOString()
|
|
133536
133617
|
};
|
|
133537
|
-
|
|
133538
|
-
if (refresh_token) {
|
|
133539
|
-
localState.refreshToken = {
|
|
133540
|
-
value: refresh_token
|
|
133541
|
-
};
|
|
133542
|
-
}
|
|
133543
|
-
if (scope) {
|
|
133544
|
-
scopes = scope.split(" ");
|
|
133545
|
-
localState.scopes = scopes;
|
|
133546
|
-
}
|
|
133618
|
+
const scopes = scope ? scope.split(" ") : [];
|
|
133547
133619
|
const accessContext = {
|
|
133548
133620
|
token: accessToken,
|
|
133549
133621
|
scopes,
|
|
133550
|
-
refreshToken:
|
|
133622
|
+
refreshToken: refresh_token ? { value: refresh_token } : void 0
|
|
133551
133623
|
};
|
|
133552
133624
|
return accessContext;
|
|
133553
133625
|
}
|
|
@@ -133590,7 +133662,6 @@ function writeAuthConfigFile(config) {
|
|
|
133590
133662
|
fs27.writeFileSync(path3__namespace.default.join(configPath), dist_default4.stringify(config), {
|
|
133591
133663
|
encoding: "utf-8"
|
|
133592
133664
|
});
|
|
133593
|
-
reinitialiseAuthTokens();
|
|
133594
133665
|
}
|
|
133595
133666
|
function readAuthConfigFile() {
|
|
133596
133667
|
return parseTOML(readFileSync(getAuthConfigFilePath()));
|
|
@@ -133598,7 +133669,7 @@ function readAuthConfigFile() {
|
|
|
133598
133669
|
async function loginOrRefreshIfRequired(complianceConfig, props) {
|
|
133599
133670
|
if (!getAPIToken()) {
|
|
133600
133671
|
return !isNonInteractiveOrCI() && await login(complianceConfig, props);
|
|
133601
|
-
} else if (
|
|
133672
|
+
} else if (isRefreshNeeded()) {
|
|
133602
133673
|
const didRefresh = await refreshToken();
|
|
133603
133674
|
if (didRefresh) {
|
|
133604
133675
|
return true;
|
|
@@ -133610,16 +133681,18 @@ async function loginOrRefreshIfRequired(complianceConfig, props) {
|
|
|
133610
133681
|
}
|
|
133611
133682
|
}
|
|
133612
133683
|
async function getOAuthTokenFromLocalState() {
|
|
133613
|
-
|
|
133684
|
+
let stored = readStoredAuthState();
|
|
133685
|
+
if (!stored.accessToken) {
|
|
133614
133686
|
return void 0;
|
|
133615
133687
|
}
|
|
133616
|
-
if (
|
|
133688
|
+
if (isRefreshNeeded()) {
|
|
133617
133689
|
const didRefresh = await refreshToken();
|
|
133618
133690
|
if (!didRefresh) {
|
|
133619
133691
|
return void 0;
|
|
133620
133692
|
}
|
|
133693
|
+
stored = readStoredAuthState();
|
|
133621
133694
|
}
|
|
133622
|
-
return
|
|
133695
|
+
return stored.accessToken?.value;
|
|
133623
133696
|
}
|
|
133624
133697
|
async function getOauthToken(options) {
|
|
133625
133698
|
const urlToOpen = await getAuthURL(options.scopes, options.clientId);
|
|
@@ -133769,12 +133842,14 @@ async function login(complianceConfig, props = {
|
|
|
133769
133842
|
purgeConfigCaches();
|
|
133770
133843
|
return true;
|
|
133771
133844
|
}
|
|
133772
|
-
function
|
|
133773
|
-
|
|
133845
|
+
function isRefreshNeeded() {
|
|
133846
|
+
if (getAuthFromEnv()) {
|
|
133847
|
+
return false;
|
|
133848
|
+
}
|
|
133849
|
+
const { accessToken } = readStoredAuthState();
|
|
133774
133850
|
return Boolean(accessToken && /* @__PURE__ */ new Date() >= new Date(accessToken.expiry));
|
|
133775
133851
|
}
|
|
133776
133852
|
async function refreshToken() {
|
|
133777
|
-
reinitialiseAuthTokens();
|
|
133778
133853
|
try {
|
|
133779
133854
|
const {
|
|
133780
133855
|
token: { value: oauth_token, expiry: expiration_time } = {
|
|
@@ -133806,25 +133881,12 @@ async function logout() {
|
|
|
133806
133881
|
);
|
|
133807
133882
|
return;
|
|
133808
133883
|
}
|
|
133809
|
-
|
|
133810
|
-
|
|
133811
|
-
|
|
133812
|
-
|
|
133813
|
-
}
|
|
133814
|
-
const body2 = `client_id=${encodeURIComponent(getClientIdFromEnv())}&token_type_hint=refresh_token&token=${encodeURIComponent(localState.refreshToken?.value || "")}`;
|
|
133815
|
-
const response2 = await (0, import_undici5.fetch)(getRevokeUrlFromEnv(), {
|
|
133816
|
-
method: "POST",
|
|
133817
|
-
body: body2,
|
|
133818
|
-
headers: {
|
|
133819
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
133820
|
-
}
|
|
133821
|
-
});
|
|
133822
|
-
await response2.text();
|
|
133823
|
-
logger.log(
|
|
133824
|
-
"\u{1F481} Wrangler is configured with an OAuth token. The token has been successfully revoked"
|
|
133825
|
-
);
|
|
133884
|
+
const storedRefreshToken = readStoredAuthState().refreshToken;
|
|
133885
|
+
if (!storedRefreshToken) {
|
|
133886
|
+
logger.log("Not logged in, exiting...");
|
|
133887
|
+
return;
|
|
133826
133888
|
}
|
|
133827
|
-
const body = `client_id=${encodeURIComponent(getClientIdFromEnv())}&token_type_hint=refresh_token&token=${encodeURIComponent(
|
|
133889
|
+
const body = `client_id=${encodeURIComponent(getClientIdFromEnv())}&token_type_hint=refresh_token&token=${encodeURIComponent(storedRefreshToken.value || "")}`;
|
|
133828
133890
|
const response = await (0, import_undici5.fetch)(getRevokeUrlFromEnv(), {
|
|
133829
133891
|
method: "POST",
|
|
133830
133892
|
body,
|
|
@@ -133919,17 +133981,13 @@ function requireApiToken() {
|
|
|
133919
133981
|
return credentials;
|
|
133920
133982
|
}
|
|
133921
133983
|
function saveAccountToCache(account) {
|
|
133922
|
-
localState.account = account;
|
|
133923
133984
|
saveToConfigCache("wrangler-account.json", { account });
|
|
133924
133985
|
}
|
|
133925
133986
|
function getAccountFromCache() {
|
|
133926
|
-
if (localState.account) {
|
|
133927
|
-
return localState.account;
|
|
133928
|
-
}
|
|
133929
133987
|
return getConfigCache("wrangler-account.json").account;
|
|
133930
133988
|
}
|
|
133931
133989
|
function getScopes() {
|
|
133932
|
-
return
|
|
133990
|
+
return readStoredAuthState().scopes;
|
|
133933
133991
|
}
|
|
133934
133992
|
function printScopes(scopes) {
|
|
133935
133993
|
const data = scopes.map((scope) => ({
|
|
@@ -133992,7 +134050,7 @@ async function getJSONFromResponse(response) {
|
|
|
133992
134050
|
);
|
|
133993
134051
|
}
|
|
133994
134052
|
}
|
|
133995
|
-
var import_ci_info4, import_undici5, USER_AUTH_CONFIG_PATH, DefaultScopes, DefaultScopeKeys,
|
|
134053
|
+
var import_ci_info4, import_undici5, USER_AUTH_CONFIG_PATH, DefaultScopes, DefaultScopeKeys, oauthFlowState, hasWarnedAboutDeprecatedV1ApiToken, ErrorOAuth2, ErrorUnknown, ErrorNoAuthCode, ErrorInvalidReturnedStateParam, ErrorInvalidJson, ErrorInvalidScope, ErrorInvalidRequest, ErrorInvalidToken, ErrorAuthenticationGrant, ErrorUnauthorizedClient, ErrorAccessDenied, ErrorUnsupportedResponseType, ErrorServerError, ErrorTemporarilyUnavailable, ErrorAccessTokenResponse, ErrorInvalidClient, ErrorInvalidGrant, ErrorUnsupportedGrantType, RECOMMENDED_CODE_VERIFIER_LENGTH, RECOMMENDED_STATE_LENGTH, PKCE_CHARSET;
|
|
133996
134054
|
var init_user2 = __esm({
|
|
133997
134055
|
"src/user/user.ts"() {
|
|
133998
134056
|
init_import_meta_url();
|
|
@@ -134042,11 +134100,9 @@ var init_user2 = __esm({
|
|
|
134042
134100
|
};
|
|
134043
134101
|
DefaultScopeKeys = Object.keys(DefaultScopes);
|
|
134044
134102
|
__name(validateScopeKeys, "validateScopeKeys");
|
|
134045
|
-
|
|
134046
|
-
|
|
134047
|
-
|
|
134048
|
-
__name(getAuthTokens, "getAuthTokens");
|
|
134049
|
-
__name(reinitialiseAuthTokens, "reinitialiseAuthTokens");
|
|
134103
|
+
oauthFlowState = {};
|
|
134104
|
+
hasWarnedAboutDeprecatedV1ApiToken = false;
|
|
134105
|
+
__name(readStoredAuthState, "readStoredAuthState");
|
|
134050
134106
|
__name(getAPIToken, "getAPIToken");
|
|
134051
134107
|
ErrorOAuth2 = class extends UserError {
|
|
134052
134108
|
static {
|
|
@@ -134209,7 +134265,7 @@ var init_user2 = __esm({
|
|
|
134209
134265
|
__name(getOAuthTokenFromLocalState, "getOAuthTokenFromLocalState");
|
|
134210
134266
|
__name(getOauthToken, "getOauthToken");
|
|
134211
134267
|
__name(login, "login");
|
|
134212
|
-
__name(
|
|
134268
|
+
__name(isRefreshNeeded, "isRefreshNeeded");
|
|
134213
134269
|
__name(refreshToken, "refreshToken");
|
|
134214
134270
|
__name(logout, "logout");
|
|
134215
134271
|
__name(listScopes, "listScopes");
|
|
@@ -137033,8 +137089,8 @@ function getMissingEntryPointMessage(absoluteEntryPointPath, relativeEntryPointP
|
|
|
137033
137089
|
"index",
|
|
137034
137090
|
"dist/index"
|
|
137035
137091
|
]) {
|
|
137036
|
-
for (const
|
|
137037
|
-
const filePath = basenamePath +
|
|
137092
|
+
for (const extension2 of [".ts", ".tsx", ".js", ".jsx"]) {
|
|
137093
|
+
const filePath = basenamePath + extension2;
|
|
137038
137094
|
if (fileExists(path3__namespace.default.resolve(absoluteEntryPointPath, filePath))) {
|
|
137039
137095
|
possiblePaths.push(path3__namespace.default.join(relativeEntryPointPath, filePath));
|
|
137040
137096
|
}
|
|
@@ -148194,116 +148250,16 @@ var init_instances2 = __esm({
|
|
|
148194
148250
|
}
|
|
148195
148251
|
});
|
|
148196
148252
|
|
|
148197
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
148198
|
-
var require_stream = __commonJS({
|
|
148199
|
-
"../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/stream.js"(exports, module2) {
|
|
148200
|
-
init_import_meta_url();
|
|
148201
|
-
var { Duplex: Duplex2 } = __require("stream");
|
|
148202
|
-
function emitClose(stream2) {
|
|
148203
|
-
stream2.emit("close");
|
|
148204
|
-
}
|
|
148205
|
-
__name(emitClose, "emitClose");
|
|
148206
|
-
function duplexOnEnd() {
|
|
148207
|
-
if (!this.destroyed && this._writableState.finished) {
|
|
148208
|
-
this.destroy();
|
|
148209
|
-
}
|
|
148210
|
-
}
|
|
148211
|
-
__name(duplexOnEnd, "duplexOnEnd");
|
|
148212
|
-
function duplexOnError(err) {
|
|
148213
|
-
this.removeListener("error", duplexOnError);
|
|
148214
|
-
this.destroy();
|
|
148215
|
-
if (this.listenerCount("error") === 0) {
|
|
148216
|
-
this.emit("error", err);
|
|
148217
|
-
}
|
|
148218
|
-
}
|
|
148219
|
-
__name(duplexOnError, "duplexOnError");
|
|
148220
|
-
function createWebSocketStream2(ws, options) {
|
|
148221
|
-
let terminateOnDestroy = true;
|
|
148222
|
-
const duplex = new Duplex2({
|
|
148223
|
-
...options,
|
|
148224
|
-
autoDestroy: false,
|
|
148225
|
-
emitClose: false,
|
|
148226
|
-
objectMode: false,
|
|
148227
|
-
writableObjectMode: false
|
|
148228
|
-
});
|
|
148229
|
-
ws.on("message", /* @__PURE__ */ __name(function message(msg, isBinary) {
|
|
148230
|
-
const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
148231
|
-
if (!duplex.push(data)) ws.pause();
|
|
148232
|
-
}, "message"));
|
|
148233
|
-
ws.once("error", /* @__PURE__ */ __name(function error2(err) {
|
|
148234
|
-
if (duplex.destroyed) return;
|
|
148235
|
-
terminateOnDestroy = false;
|
|
148236
|
-
duplex.destroy(err);
|
|
148237
|
-
}, "error"));
|
|
148238
|
-
ws.once("close", /* @__PURE__ */ __name(function close2() {
|
|
148239
|
-
if (duplex.destroyed) return;
|
|
148240
|
-
duplex.push(null);
|
|
148241
|
-
}, "close"));
|
|
148242
|
-
duplex._destroy = function(err, callback) {
|
|
148243
|
-
if (ws.readyState === ws.CLOSED) {
|
|
148244
|
-
callback(err);
|
|
148245
|
-
process.nextTick(emitClose, duplex);
|
|
148246
|
-
return;
|
|
148247
|
-
}
|
|
148248
|
-
let called = false;
|
|
148249
|
-
ws.once("error", /* @__PURE__ */ __name(function error2(err2) {
|
|
148250
|
-
called = true;
|
|
148251
|
-
callback(err2);
|
|
148252
|
-
}, "error"));
|
|
148253
|
-
ws.once("close", /* @__PURE__ */ __name(function close2() {
|
|
148254
|
-
if (!called) callback(err);
|
|
148255
|
-
process.nextTick(emitClose, duplex);
|
|
148256
|
-
}, "close"));
|
|
148257
|
-
if (terminateOnDestroy) ws.terminate();
|
|
148258
|
-
};
|
|
148259
|
-
duplex._final = function(callback) {
|
|
148260
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
148261
|
-
ws.once("open", /* @__PURE__ */ __name(function open3() {
|
|
148262
|
-
duplex._final(callback);
|
|
148263
|
-
}, "open"));
|
|
148264
|
-
return;
|
|
148265
|
-
}
|
|
148266
|
-
if (ws._socket === null) return;
|
|
148267
|
-
if (ws._socket._writableState.finished) {
|
|
148268
|
-
callback();
|
|
148269
|
-
if (duplex._readableState.endEmitted) duplex.destroy();
|
|
148270
|
-
} else {
|
|
148271
|
-
ws._socket.once("finish", /* @__PURE__ */ __name(function finish() {
|
|
148272
|
-
callback();
|
|
148273
|
-
}, "finish"));
|
|
148274
|
-
ws.close();
|
|
148275
|
-
}
|
|
148276
|
-
};
|
|
148277
|
-
duplex._read = function() {
|
|
148278
|
-
if (ws.isPaused) ws.resume();
|
|
148279
|
-
};
|
|
148280
|
-
duplex._write = function(chunk, encoding, callback) {
|
|
148281
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
148282
|
-
ws.once("open", /* @__PURE__ */ __name(function open3() {
|
|
148283
|
-
duplex._write(chunk, encoding, callback);
|
|
148284
|
-
}, "open"));
|
|
148285
|
-
return;
|
|
148286
|
-
}
|
|
148287
|
-
ws.send(chunk, callback);
|
|
148288
|
-
};
|
|
148289
|
-
duplex.on("end", duplexOnEnd);
|
|
148290
|
-
duplex.on("error", duplexOnError);
|
|
148291
|
-
return duplex;
|
|
148292
|
-
}
|
|
148293
|
-
__name(createWebSocketStream2, "createWebSocketStream");
|
|
148294
|
-
module2.exports = createWebSocketStream2;
|
|
148295
|
-
}
|
|
148296
|
-
});
|
|
148297
|
-
|
|
148298
|
-
// ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/constants.js
|
|
148253
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/constants.js
|
|
148299
148254
|
var require_constants7 = __commonJS({
|
|
148300
|
-
"../../node_modules/.pnpm/ws@8.
|
|
148255
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/constants.js"(exports, module2) {
|
|
148301
148256
|
init_import_meta_url();
|
|
148302
148257
|
var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
|
|
148303
148258
|
var hasBlob = typeof Blob !== "undefined";
|
|
148304
148259
|
if (hasBlob) BINARY_TYPES.push("blob");
|
|
148305
148260
|
module2.exports = {
|
|
148306
148261
|
BINARY_TYPES,
|
|
148262
|
+
CLOSE_TIMEOUT: 3e4,
|
|
148307
148263
|
EMPTY_BUFFER: Buffer.alloc(0),
|
|
148308
148264
|
GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
|
|
148309
148265
|
hasBlob,
|
|
@@ -148317,9 +148273,9 @@ var require_constants7 = __commonJS({
|
|
|
148317
148273
|
}
|
|
148318
148274
|
});
|
|
148319
148275
|
|
|
148320
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
148276
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/buffer-util.js
|
|
148321
148277
|
var require_buffer_util = __commonJS({
|
|
148322
|
-
"../../node_modules/.pnpm/ws@8.
|
|
148278
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/buffer-util.js"(exports, module2) {
|
|
148323
148279
|
init_import_meta_url();
|
|
148324
148280
|
var { EMPTY_BUFFER } = require_constants7();
|
|
148325
148281
|
var FastBuffer = Buffer[Symbol.species];
|
|
@@ -148397,9 +148353,9 @@ var require_buffer_util = __commonJS({
|
|
|
148397
148353
|
}
|
|
148398
148354
|
});
|
|
148399
148355
|
|
|
148400
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
148356
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/limiter.js
|
|
148401
148357
|
var require_limiter = __commonJS({
|
|
148402
|
-
"../../node_modules/.pnpm/ws@8.
|
|
148358
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/limiter.js"(exports, module2) {
|
|
148403
148359
|
init_import_meta_url();
|
|
148404
148360
|
var kDone = Symbol("kDone");
|
|
148405
148361
|
var kRun = Symbol("kRun");
|
|
@@ -148450,9 +148406,9 @@ var require_limiter = __commonJS({
|
|
|
148450
148406
|
}
|
|
148451
148407
|
});
|
|
148452
148408
|
|
|
148453
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
148409
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/permessage-deflate.js
|
|
148454
148410
|
var require_permessage_deflate2 = __commonJS({
|
|
148455
|
-
"../../node_modules/.pnpm/ws@8.
|
|
148411
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/permessage-deflate.js"(exports, module2) {
|
|
148456
148412
|
init_import_meta_url();
|
|
148457
148413
|
var zlib3 = __require("zlib");
|
|
148458
148414
|
var bufferUtil = require_buffer_util();
|
|
@@ -148466,7 +148422,7 @@ var require_permessage_deflate2 = __commonJS({
|
|
|
148466
148422
|
var kBuffers = Symbol("buffers");
|
|
148467
148423
|
var kError = Symbol("error");
|
|
148468
148424
|
var zlibLimiter;
|
|
148469
|
-
var
|
|
148425
|
+
var PerMessageDeflate2 = class {
|
|
148470
148426
|
static {
|
|
148471
148427
|
__name(this, "PerMessageDeflate");
|
|
148472
148428
|
}
|
|
@@ -148480,6 +148436,9 @@ var require_permessage_deflate2 = __commonJS({
|
|
|
148480
148436
|
* acknowledge disabling of client context takeover
|
|
148481
148437
|
* @param {Number} [options.concurrencyLimit=10] The number of concurrent
|
|
148482
148438
|
* calls to zlib
|
|
148439
|
+
* @param {Boolean} [options.isServer=false] Create the instance in either
|
|
148440
|
+
* server or client mode
|
|
148441
|
+
* @param {Number} [options.maxPayload=0] The maximum allowed message length
|
|
148483
148442
|
* @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the
|
|
148484
148443
|
* use of a custom server window size
|
|
148485
148444
|
* @param {Boolean} [options.serverNoContextTakeover=false] Request/accept
|
|
@@ -148490,15 +148449,12 @@ var require_permessage_deflate2 = __commonJS({
|
|
|
148490
148449
|
* deflate
|
|
148491
148450
|
* @param {Object} [options.zlibInflateOptions] Options to pass to zlib on
|
|
148492
148451
|
* inflate
|
|
148493
|
-
* @param {Boolean} [isServer=false] Create the instance in either server or
|
|
148494
|
-
* client mode
|
|
148495
|
-
* @param {Number} [maxPayload=0] The maximum allowed message length
|
|
148496
148452
|
*/
|
|
148497
|
-
constructor(options
|
|
148498
|
-
this._maxPayload = maxPayload | 0;
|
|
148453
|
+
constructor(options) {
|
|
148499
148454
|
this._options = options || {};
|
|
148500
148455
|
this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024;
|
|
148501
|
-
this.
|
|
148456
|
+
this._maxPayload = this._options.maxPayload | 0;
|
|
148457
|
+
this._isServer = !!this._options.isServer;
|
|
148502
148458
|
this._deflate = null;
|
|
148503
148459
|
this._inflate = null;
|
|
148504
148460
|
this.params = null;
|
|
@@ -148807,7 +148763,7 @@ var require_permessage_deflate2 = __commonJS({
|
|
|
148807
148763
|
});
|
|
148808
148764
|
}
|
|
148809
148765
|
};
|
|
148810
|
-
module2.exports =
|
|
148766
|
+
module2.exports = PerMessageDeflate2;
|
|
148811
148767
|
function deflateOnData(chunk) {
|
|
148812
148768
|
this[kBuffers].push(chunk);
|
|
148813
148769
|
this[kTotalLength] += chunk.length;
|
|
@@ -148828,6 +148784,10 @@ var require_permessage_deflate2 = __commonJS({
|
|
|
148828
148784
|
__name(inflateOnData, "inflateOnData");
|
|
148829
148785
|
function inflateOnError(err) {
|
|
148830
148786
|
this[kPerMessageDeflate]._inflate = null;
|
|
148787
|
+
if (this[kError]) {
|
|
148788
|
+
this[kCallback](this[kError]);
|
|
148789
|
+
return;
|
|
148790
|
+
}
|
|
148831
148791
|
err[kStatusCode] = 1007;
|
|
148832
148792
|
this[kCallback](err);
|
|
148833
148793
|
}
|
|
@@ -148835,9 +148795,9 @@ var require_permessage_deflate2 = __commonJS({
|
|
|
148835
148795
|
}
|
|
148836
148796
|
});
|
|
148837
148797
|
|
|
148838
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
148798
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/validation.js
|
|
148839
148799
|
var require_validation = __commonJS({
|
|
148840
|
-
"../../node_modules/.pnpm/ws@8.
|
|
148800
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/validation.js"(exports, module2) {
|
|
148841
148801
|
init_import_meta_url();
|
|
148842
148802
|
var { isUtf8 } = __require("buffer");
|
|
148843
148803
|
var { hasBlob } = require_constants7();
|
|
@@ -149039,12 +148999,12 @@ var require_validation = __commonJS({
|
|
|
149039
148999
|
}
|
|
149040
149000
|
});
|
|
149041
149001
|
|
|
149042
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
149002
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/receiver.js
|
|
149043
149003
|
var require_receiver2 = __commonJS({
|
|
149044
|
-
"../../node_modules/.pnpm/ws@8.
|
|
149004
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/receiver.js"(exports, module2) {
|
|
149045
149005
|
init_import_meta_url();
|
|
149046
149006
|
var { Writable: Writable5 } = __require("stream");
|
|
149047
|
-
var
|
|
149007
|
+
var PerMessageDeflate2 = require_permessage_deflate2();
|
|
149048
149008
|
var {
|
|
149049
149009
|
BINARY_TYPES,
|
|
149050
149010
|
EMPTY_BUFFER,
|
|
@@ -149214,7 +149174,7 @@ var require_receiver2 = __commonJS({
|
|
|
149214
149174
|
return;
|
|
149215
149175
|
}
|
|
149216
149176
|
const compressed = (buf[0] & 64) === 64;
|
|
149217
|
-
if (compressed && !this._extensions[
|
|
149177
|
+
if (compressed && !this._extensions[PerMessageDeflate2.extensionName]) {
|
|
149218
149178
|
const error2 = this.createError(
|
|
149219
149179
|
RangeError,
|
|
149220
149180
|
"RSV1 must be clear",
|
|
@@ -149458,7 +149418,7 @@ var require_receiver2 = __commonJS({
|
|
|
149458
149418
|
* @private
|
|
149459
149419
|
*/
|
|
149460
149420
|
decompress(data, cb2) {
|
|
149461
|
-
const perMessageDeflate = this._extensions[
|
|
149421
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
|
|
149462
149422
|
perMessageDeflate.decompress(data, this._fin, (err, buf) => {
|
|
149463
149423
|
if (err) return cb2(err);
|
|
149464
149424
|
if (buf.length) {
|
|
@@ -149634,13 +149594,16 @@ var require_receiver2 = __commonJS({
|
|
|
149634
149594
|
}
|
|
149635
149595
|
});
|
|
149636
149596
|
|
|
149637
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
149597
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/sender.js
|
|
149638
149598
|
var require_sender2 = __commonJS({
|
|
149639
|
-
"../../node_modules/.pnpm/ws@8.
|
|
149599
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/sender.js"(exports, module2) {
|
|
149640
149600
|
init_import_meta_url();
|
|
149641
149601
|
var { Duplex: Duplex2 } = __require("stream");
|
|
149642
149602
|
var { randomFillSync } = __require("crypto");
|
|
149643
|
-
var
|
|
149603
|
+
var {
|
|
149604
|
+
types: { isUint8Array }
|
|
149605
|
+
} = __require("util");
|
|
149606
|
+
var PerMessageDeflate2 = require_permessage_deflate2();
|
|
149644
149607
|
var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants7();
|
|
149645
149608
|
var { isBlob: isBlob5, isValidStatusCode } = require_validation();
|
|
149646
149609
|
var { mask: applyMask, toBuffer } = require_buffer_util();
|
|
@@ -149796,8 +149759,10 @@ var require_sender2 = __commonJS({
|
|
|
149796
149759
|
buf.writeUInt16BE(code, 0);
|
|
149797
149760
|
if (typeof data === "string") {
|
|
149798
149761
|
buf.write(data, 2);
|
|
149799
|
-
} else {
|
|
149762
|
+
} else if (isUint8Array(data)) {
|
|
149800
149763
|
buf.set(data, 2);
|
|
149764
|
+
} else {
|
|
149765
|
+
throw new TypeError("Second argument must be a string or a Uint8Array");
|
|
149801
149766
|
}
|
|
149802
149767
|
}
|
|
149803
149768
|
const options = {
|
|
@@ -149927,7 +149892,7 @@ var require_sender2 = __commonJS({
|
|
|
149927
149892
|
* @public
|
|
149928
149893
|
*/
|
|
149929
149894
|
send(data, options, cb2) {
|
|
149930
|
-
const perMessageDeflate = this._extensions[
|
|
149895
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
|
|
149931
149896
|
let opcode = options.binary ? 2 : 1;
|
|
149932
149897
|
let rsv1 = options.compress;
|
|
149933
149898
|
let byteLength;
|
|
@@ -150051,7 +150016,7 @@ var require_sender2 = __commonJS({
|
|
|
150051
150016
|
this.sendFrame(_Sender.frame(data, options), cb2);
|
|
150052
150017
|
return;
|
|
150053
150018
|
}
|
|
150054
|
-
const perMessageDeflate = this._extensions[
|
|
150019
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
|
|
150055
150020
|
this._bufferedBytes += options[kByteLength];
|
|
150056
150021
|
this._state = DEFLATING;
|
|
150057
150022
|
perMessageDeflate.compress(data, options.fin, (_4, buf) => {
|
|
@@ -150094,7 +150059,7 @@ var require_sender2 = __commonJS({
|
|
|
150094
150059
|
/**
|
|
150095
150060
|
* Sends a frame.
|
|
150096
150061
|
*
|
|
150097
|
-
* @param {Buffer[]} list The frame to send
|
|
150062
|
+
* @param {(Buffer | String)[]} list The frame to send
|
|
150098
150063
|
* @param {Function} [cb] Callback
|
|
150099
150064
|
* @private
|
|
150100
150065
|
*/
|
|
@@ -150127,9 +150092,9 @@ var require_sender2 = __commonJS({
|
|
|
150127
150092
|
}
|
|
150128
150093
|
});
|
|
150129
150094
|
|
|
150130
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
150095
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/event-target.js
|
|
150131
150096
|
var require_event_target = __commonJS({
|
|
150132
|
-
"../../node_modules/.pnpm/ws@8.
|
|
150097
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/event-target.js"(exports, module2) {
|
|
150133
150098
|
init_import_meta_url();
|
|
150134
150099
|
var { kForOnEventAttribute, kListener } = require_constants7();
|
|
150135
150100
|
var kCode = Symbol("kCode");
|
|
@@ -150369,9 +150334,9 @@ var require_event_target = __commonJS({
|
|
|
150369
150334
|
}
|
|
150370
150335
|
});
|
|
150371
150336
|
|
|
150372
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
150337
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/extension.js
|
|
150373
150338
|
var require_extension = __commonJS({
|
|
150374
|
-
"../../node_modules/.pnpm/ws@8.
|
|
150339
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/extension.js"(exports, module2) {
|
|
150375
150340
|
init_import_meta_url();
|
|
150376
150341
|
var { tokenChars } = require_validation();
|
|
150377
150342
|
function push2(dest, name2, elem) {
|
|
@@ -150506,11 +150471,11 @@ var require_extension = __commonJS({
|
|
|
150506
150471
|
}
|
|
150507
150472
|
__name(parse15, "parse");
|
|
150508
150473
|
function format9(extensions) {
|
|
150509
|
-
return Object.keys(extensions).map((
|
|
150510
|
-
let configurations = extensions[
|
|
150474
|
+
return Object.keys(extensions).map((extension2) => {
|
|
150475
|
+
let configurations = extensions[extension2];
|
|
150511
150476
|
if (!Array.isArray(configurations)) configurations = [configurations];
|
|
150512
150477
|
return configurations.map((params) => {
|
|
150513
|
-
return [
|
|
150478
|
+
return [extension2].concat(
|
|
150514
150479
|
Object.keys(params).map((k6) => {
|
|
150515
150480
|
let values = params[k6];
|
|
150516
150481
|
if (!Array.isArray(values)) values = [values];
|
|
@@ -150525,9 +150490,9 @@ var require_extension = __commonJS({
|
|
|
150525
150490
|
}
|
|
150526
150491
|
});
|
|
150527
150492
|
|
|
150528
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
150493
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/websocket.js
|
|
150529
150494
|
var require_websocket2 = __commonJS({
|
|
150530
|
-
"../../node_modules/.pnpm/ws@8.
|
|
150495
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/websocket.js"(exports, module2) {
|
|
150531
150496
|
init_import_meta_url();
|
|
150532
150497
|
var EventEmitter5 = __require("events");
|
|
150533
150498
|
var https3 = __require("https");
|
|
@@ -150537,12 +150502,13 @@ var require_websocket2 = __commonJS({
|
|
|
150537
150502
|
var { randomBytes: randomBytes2, createHash: createHash9 } = __require("crypto");
|
|
150538
150503
|
var { Duplex: Duplex2, Readable: Readable11 } = __require("stream");
|
|
150539
150504
|
var { URL: URL8 } = __require("url");
|
|
150540
|
-
var
|
|
150505
|
+
var PerMessageDeflate2 = require_permessage_deflate2();
|
|
150541
150506
|
var Receiver2 = require_receiver2();
|
|
150542
150507
|
var Sender2 = require_sender2();
|
|
150543
150508
|
var { isBlob: isBlob5 } = require_validation();
|
|
150544
150509
|
var {
|
|
150545
150510
|
BINARY_TYPES,
|
|
150511
|
+
CLOSE_TIMEOUT,
|
|
150546
150512
|
EMPTY_BUFFER,
|
|
150547
150513
|
GUID,
|
|
150548
150514
|
kForOnEventAttribute,
|
|
@@ -150556,7 +150522,6 @@ var require_websocket2 = __commonJS({
|
|
|
150556
150522
|
} = require_event_target();
|
|
150557
150523
|
var { format: format9, parse: parse15 } = require_extension();
|
|
150558
150524
|
var { toBuffer } = require_buffer_util();
|
|
150559
|
-
var closeTimeout = 30 * 1e3;
|
|
150560
150525
|
var kAborted = Symbol("kAborted");
|
|
150561
150526
|
var protocolVersions = [8, 13];
|
|
150562
150527
|
var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
|
|
@@ -150605,6 +150570,7 @@ var require_websocket2 = __commonJS({
|
|
|
150605
150570
|
initAsClient(this, address, protocols, options);
|
|
150606
150571
|
} else {
|
|
150607
150572
|
this._autoPong = options.autoPong;
|
|
150573
|
+
this._closeTimeout = options.closeTimeout;
|
|
150608
150574
|
this._isServer = true;
|
|
150609
150575
|
}
|
|
150610
150576
|
}
|
|
@@ -150747,8 +150713,8 @@ var require_websocket2 = __commonJS({
|
|
|
150747
150713
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
150748
150714
|
return;
|
|
150749
150715
|
}
|
|
150750
|
-
if (this._extensions[
|
|
150751
|
-
this._extensions[
|
|
150716
|
+
if (this._extensions[PerMessageDeflate2.extensionName]) {
|
|
150717
|
+
this._extensions[PerMessageDeflate2.extensionName].cleanup();
|
|
150752
150718
|
}
|
|
150753
150719
|
this._receiver.removeAllListeners();
|
|
150754
150720
|
this._readyState = _WebSocket.CLOSED;
|
|
@@ -150910,7 +150876,7 @@ var require_websocket2 = __commonJS({
|
|
|
150910
150876
|
fin: true,
|
|
150911
150877
|
...options
|
|
150912
150878
|
};
|
|
150913
|
-
if (!this._extensions[
|
|
150879
|
+
if (!this._extensions[PerMessageDeflate2.extensionName]) {
|
|
150914
150880
|
opts.compress = false;
|
|
150915
150881
|
}
|
|
150916
150882
|
this._sender.send(data || EMPTY_BUFFER, opts, cb2);
|
|
@@ -151006,6 +150972,7 @@ var require_websocket2 = __commonJS({
|
|
|
151006
150972
|
const opts = {
|
|
151007
150973
|
allowSynchronousEvents: true,
|
|
151008
150974
|
autoPong: true,
|
|
150975
|
+
closeTimeout: CLOSE_TIMEOUT,
|
|
151009
150976
|
protocolVersion: protocolVersions[1],
|
|
151010
150977
|
maxPayload: 100 * 1024 * 1024,
|
|
151011
150978
|
skipUTF8Validation: false,
|
|
@@ -151023,6 +150990,7 @@ var require_websocket2 = __commonJS({
|
|
|
151023
150990
|
port: void 0
|
|
151024
150991
|
};
|
|
151025
150992
|
websocket._autoPong = opts.autoPong;
|
|
150993
|
+
websocket._closeTimeout = opts.closeTimeout;
|
|
151026
150994
|
if (!protocolVersions.includes(opts.protocolVersion)) {
|
|
151027
150995
|
throw new RangeError(
|
|
151028
150996
|
`Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`
|
|
@@ -151034,7 +151002,7 @@ var require_websocket2 = __commonJS({
|
|
|
151034
151002
|
} else {
|
|
151035
151003
|
try {
|
|
151036
151004
|
parsedUrl = new URL8(address);
|
|
151037
|
-
} catch
|
|
151005
|
+
} catch {
|
|
151038
151006
|
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
151039
151007
|
}
|
|
151040
151008
|
}
|
|
@@ -151048,7 +151016,7 @@ var require_websocket2 = __commonJS({
|
|
|
151048
151016
|
const isIpcUrl = parsedUrl.protocol === "ws+unix:";
|
|
151049
151017
|
let invalidUrlMessage;
|
|
151050
151018
|
if (parsedUrl.protocol !== "ws:" && !isSecure && !isIpcUrl) {
|
|
151051
|
-
invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`;
|
|
151019
|
+
invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;
|
|
151052
151020
|
} else if (isIpcUrl && !parsedUrl.pathname) {
|
|
151053
151021
|
invalidUrlMessage = "The URL's pathname is empty";
|
|
151054
151022
|
} else if (parsedUrl.hash) {
|
|
@@ -151082,13 +151050,13 @@ var require_websocket2 = __commonJS({
|
|
|
151082
151050
|
opts.path = parsedUrl.pathname + parsedUrl.search;
|
|
151083
151051
|
opts.timeout = opts.handshakeTimeout;
|
|
151084
151052
|
if (opts.perMessageDeflate) {
|
|
151085
|
-
perMessageDeflate = new
|
|
151086
|
-
opts.perMessageDeflate
|
|
151087
|
-
false,
|
|
151088
|
-
opts.maxPayload
|
|
151089
|
-
);
|
|
151053
|
+
perMessageDeflate = new PerMessageDeflate2({
|
|
151054
|
+
...opts.perMessageDeflate,
|
|
151055
|
+
isServer: false,
|
|
151056
|
+
maxPayload: opts.maxPayload
|
|
151057
|
+
});
|
|
151090
151058
|
opts.headers["Sec-WebSocket-Extensions"] = format9({
|
|
151091
|
-
[
|
|
151059
|
+
[PerMessageDeflate2.extensionName]: perMessageDeflate.offer()
|
|
151092
151060
|
});
|
|
151093
151061
|
}
|
|
151094
151062
|
if (protocols.length) {
|
|
@@ -151231,19 +151199,19 @@ var require_websocket2 = __commonJS({
|
|
|
151231
151199
|
return;
|
|
151232
151200
|
}
|
|
151233
151201
|
const extensionNames = Object.keys(extensions);
|
|
151234
|
-
if (extensionNames.length !== 1 || extensionNames[0] !==
|
|
151202
|
+
if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate2.extensionName) {
|
|
151235
151203
|
const message = "Server indicated an extension that was not requested";
|
|
151236
151204
|
abortHandshake(websocket, socket, message);
|
|
151237
151205
|
return;
|
|
151238
151206
|
}
|
|
151239
151207
|
try {
|
|
151240
|
-
perMessageDeflate.accept(extensions[
|
|
151208
|
+
perMessageDeflate.accept(extensions[PerMessageDeflate2.extensionName]);
|
|
151241
151209
|
} catch (err) {
|
|
151242
151210
|
const message = "Invalid Sec-WebSocket-Extensions header";
|
|
151243
151211
|
abortHandshake(websocket, socket, message);
|
|
151244
151212
|
return;
|
|
151245
151213
|
}
|
|
151246
|
-
websocket._extensions[
|
|
151214
|
+
websocket._extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
|
|
151247
151215
|
}
|
|
151248
151216
|
websocket.setSocket(socket, head, {
|
|
151249
151217
|
allowSynchronousEvents: opts.allowSynchronousEvents,
|
|
@@ -151380,7 +151348,7 @@ var require_websocket2 = __commonJS({
|
|
|
151380
151348
|
function setCloseTimer(websocket) {
|
|
151381
151349
|
websocket._closeTimer = setTimeout(
|
|
151382
151350
|
websocket._socket.destroy.bind(websocket._socket),
|
|
151383
|
-
|
|
151351
|
+
websocket._closeTimeout
|
|
151384
151352
|
);
|
|
151385
151353
|
}
|
|
151386
151354
|
__name(setCloseTimer, "setCloseTimer");
|
|
@@ -151390,8 +151358,8 @@ var require_websocket2 = __commonJS({
|
|
|
151390
151358
|
this.removeListener("data", socketOnData);
|
|
151391
151359
|
this.removeListener("end", socketOnEnd);
|
|
151392
151360
|
websocket._readyState = WebSocket2.CLOSING;
|
|
151393
|
-
|
|
151394
|
-
|
|
151361
|
+
if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && this._readableState.length !== 0) {
|
|
151362
|
+
const chunk = this.read(this._readableState.length);
|
|
151395
151363
|
websocket._receiver.write(chunk);
|
|
151396
151364
|
}
|
|
151397
151365
|
websocket._receiver.end();
|
|
@@ -151431,9 +151399,111 @@ var require_websocket2 = __commonJS({
|
|
|
151431
151399
|
}
|
|
151432
151400
|
});
|
|
151433
151401
|
|
|
151434
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
151402
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/stream.js
|
|
151403
|
+
var require_stream = __commonJS({
|
|
151404
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/stream.js"(exports, module2) {
|
|
151405
|
+
init_import_meta_url();
|
|
151406
|
+
require_websocket2();
|
|
151407
|
+
var { Duplex: Duplex2 } = __require("stream");
|
|
151408
|
+
function emitClose(stream2) {
|
|
151409
|
+
stream2.emit("close");
|
|
151410
|
+
}
|
|
151411
|
+
__name(emitClose, "emitClose");
|
|
151412
|
+
function duplexOnEnd() {
|
|
151413
|
+
if (!this.destroyed && this._writableState.finished) {
|
|
151414
|
+
this.destroy();
|
|
151415
|
+
}
|
|
151416
|
+
}
|
|
151417
|
+
__name(duplexOnEnd, "duplexOnEnd");
|
|
151418
|
+
function duplexOnError(err) {
|
|
151419
|
+
this.removeListener("error", duplexOnError);
|
|
151420
|
+
this.destroy();
|
|
151421
|
+
if (this.listenerCount("error") === 0) {
|
|
151422
|
+
this.emit("error", err);
|
|
151423
|
+
}
|
|
151424
|
+
}
|
|
151425
|
+
__name(duplexOnError, "duplexOnError");
|
|
151426
|
+
function createWebSocketStream2(ws, options) {
|
|
151427
|
+
let terminateOnDestroy = true;
|
|
151428
|
+
const duplex = new Duplex2({
|
|
151429
|
+
...options,
|
|
151430
|
+
autoDestroy: false,
|
|
151431
|
+
emitClose: false,
|
|
151432
|
+
objectMode: false,
|
|
151433
|
+
writableObjectMode: false
|
|
151434
|
+
});
|
|
151435
|
+
ws.on("message", /* @__PURE__ */ __name(function message(msg, isBinary) {
|
|
151436
|
+
const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
151437
|
+
if (!duplex.push(data)) ws.pause();
|
|
151438
|
+
}, "message"));
|
|
151439
|
+
ws.once("error", /* @__PURE__ */ __name(function error2(err) {
|
|
151440
|
+
if (duplex.destroyed) return;
|
|
151441
|
+
terminateOnDestroy = false;
|
|
151442
|
+
duplex.destroy(err);
|
|
151443
|
+
}, "error"));
|
|
151444
|
+
ws.once("close", /* @__PURE__ */ __name(function close2() {
|
|
151445
|
+
if (duplex.destroyed) return;
|
|
151446
|
+
duplex.push(null);
|
|
151447
|
+
}, "close"));
|
|
151448
|
+
duplex._destroy = function(err, callback) {
|
|
151449
|
+
if (ws.readyState === ws.CLOSED) {
|
|
151450
|
+
callback(err);
|
|
151451
|
+
process.nextTick(emitClose, duplex);
|
|
151452
|
+
return;
|
|
151453
|
+
}
|
|
151454
|
+
let called = false;
|
|
151455
|
+
ws.once("error", /* @__PURE__ */ __name(function error2(err2) {
|
|
151456
|
+
called = true;
|
|
151457
|
+
callback(err2);
|
|
151458
|
+
}, "error"));
|
|
151459
|
+
ws.once("close", /* @__PURE__ */ __name(function close2() {
|
|
151460
|
+
if (!called) callback(err);
|
|
151461
|
+
process.nextTick(emitClose, duplex);
|
|
151462
|
+
}, "close"));
|
|
151463
|
+
if (terminateOnDestroy) ws.terminate();
|
|
151464
|
+
};
|
|
151465
|
+
duplex._final = function(callback) {
|
|
151466
|
+
if (ws.readyState === ws.CONNECTING) {
|
|
151467
|
+
ws.once("open", /* @__PURE__ */ __name(function open3() {
|
|
151468
|
+
duplex._final(callback);
|
|
151469
|
+
}, "open"));
|
|
151470
|
+
return;
|
|
151471
|
+
}
|
|
151472
|
+
if (ws._socket === null) return;
|
|
151473
|
+
if (ws._socket._writableState.finished) {
|
|
151474
|
+
callback();
|
|
151475
|
+
if (duplex._readableState.endEmitted) duplex.destroy();
|
|
151476
|
+
} else {
|
|
151477
|
+
ws._socket.once("finish", /* @__PURE__ */ __name(function finish() {
|
|
151478
|
+
callback();
|
|
151479
|
+
}, "finish"));
|
|
151480
|
+
ws.close();
|
|
151481
|
+
}
|
|
151482
|
+
};
|
|
151483
|
+
duplex._read = function() {
|
|
151484
|
+
if (ws.isPaused) ws.resume();
|
|
151485
|
+
};
|
|
151486
|
+
duplex._write = function(chunk, encoding, callback) {
|
|
151487
|
+
if (ws.readyState === ws.CONNECTING) {
|
|
151488
|
+
ws.once("open", /* @__PURE__ */ __name(function open3() {
|
|
151489
|
+
duplex._write(chunk, encoding, callback);
|
|
151490
|
+
}, "open"));
|
|
151491
|
+
return;
|
|
151492
|
+
}
|
|
151493
|
+
ws.send(chunk, callback);
|
|
151494
|
+
};
|
|
151495
|
+
duplex.on("end", duplexOnEnd);
|
|
151496
|
+
duplex.on("error", duplexOnError);
|
|
151497
|
+
return duplex;
|
|
151498
|
+
}
|
|
151499
|
+
__name(createWebSocketStream2, "createWebSocketStream");
|
|
151500
|
+
module2.exports = createWebSocketStream2;
|
|
151501
|
+
}
|
|
151502
|
+
});
|
|
151503
|
+
|
|
151504
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/subprotocol.js
|
|
151435
151505
|
var require_subprotocol = __commonJS({
|
|
151436
|
-
"../../node_modules/.pnpm/ws@8.
|
|
151506
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/subprotocol.js"(exports, module2) {
|
|
151437
151507
|
init_import_meta_url();
|
|
151438
151508
|
var { tokenChars } = require_validation();
|
|
151439
151509
|
function parse15(header) {
|
|
@@ -151477,19 +151547,19 @@ var require_subprotocol = __commonJS({
|
|
|
151477
151547
|
}
|
|
151478
151548
|
});
|
|
151479
151549
|
|
|
151480
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
151550
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/websocket-server.js
|
|
151481
151551
|
var require_websocket_server = __commonJS({
|
|
151482
|
-
"../../node_modules/.pnpm/ws@8.
|
|
151552
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/websocket-server.js"(exports, module2) {
|
|
151483
151553
|
init_import_meta_url();
|
|
151484
151554
|
var EventEmitter5 = __require("events");
|
|
151485
151555
|
var http6 = __require("http");
|
|
151486
151556
|
var { Duplex: Duplex2 } = __require("stream");
|
|
151487
151557
|
var { createHash: createHash9 } = __require("crypto");
|
|
151488
|
-
var
|
|
151489
|
-
var
|
|
151490
|
-
var
|
|
151558
|
+
var extension2 = require_extension();
|
|
151559
|
+
var PerMessageDeflate2 = require_permessage_deflate2();
|
|
151560
|
+
var subprotocol2 = require_subprotocol();
|
|
151491
151561
|
var WebSocket2 = require_websocket2();
|
|
151492
|
-
var { GUID, kWebSocket } = require_constants7();
|
|
151562
|
+
var { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants7();
|
|
151493
151563
|
var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
151494
151564
|
var RUNNING = 0;
|
|
151495
151565
|
var CLOSING = 1;
|
|
@@ -151511,6 +151581,9 @@ var require_websocket_server = __commonJS({
|
|
|
151511
151581
|
* pending connections
|
|
151512
151582
|
* @param {Boolean} [options.clientTracking=true] Specifies whether or not to
|
|
151513
151583
|
* track clients
|
|
151584
|
+
* @param {Number} [options.closeTimeout=30000] Duration in milliseconds to
|
|
151585
|
+
* wait for the closing handshake to finish after `websocket.close()` is
|
|
151586
|
+
* called
|
|
151514
151587
|
* @param {Function} [options.handleProtocols] A hook to handle protocols
|
|
151515
151588
|
* @param {String} [options.host] The hostname where to bind the server
|
|
151516
151589
|
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
@@ -151539,6 +151612,7 @@ var require_websocket_server = __commonJS({
|
|
|
151539
151612
|
perMessageDeflate: false,
|
|
151540
151613
|
handleProtocols: null,
|
|
151541
151614
|
clientTracking: true,
|
|
151615
|
+
closeTimeout: CLOSE_TIMEOUT,
|
|
151542
151616
|
verifyClient: null,
|
|
151543
151617
|
noServer: false,
|
|
151544
151618
|
backlog: null,
|
|
@@ -151694,9 +151768,11 @@ var require_websocket_server = __commonJS({
|
|
|
151694
151768
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
151695
151769
|
return;
|
|
151696
151770
|
}
|
|
151697
|
-
if (version5 !==
|
|
151771
|
+
if (version5 !== 13 && version5 !== 8) {
|
|
151698
151772
|
const message = "Missing or invalid Sec-WebSocket-Version header";
|
|
151699
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message
|
|
151773
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
|
|
151774
|
+
"Sec-WebSocket-Version": "13, 8"
|
|
151775
|
+
});
|
|
151700
151776
|
return;
|
|
151701
151777
|
}
|
|
151702
151778
|
if (!this.shouldHandle(req)) {
|
|
@@ -151707,7 +151783,7 @@ var require_websocket_server = __commonJS({
|
|
|
151707
151783
|
let protocols = /* @__PURE__ */ new Set();
|
|
151708
151784
|
if (secWebSocketProtocol !== void 0) {
|
|
151709
151785
|
try {
|
|
151710
|
-
protocols =
|
|
151786
|
+
protocols = subprotocol2.parse(secWebSocketProtocol);
|
|
151711
151787
|
} catch (err) {
|
|
151712
151788
|
const message = "Invalid Sec-WebSocket-Protocol header";
|
|
151713
151789
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
@@ -151717,16 +151793,16 @@ var require_websocket_server = __commonJS({
|
|
|
151717
151793
|
const secWebSocketExtensions = req.headers["sec-websocket-extensions"];
|
|
151718
151794
|
const extensions = {};
|
|
151719
151795
|
if (this.options.perMessageDeflate && secWebSocketExtensions !== void 0) {
|
|
151720
|
-
const perMessageDeflate = new
|
|
151721
|
-
this.options.perMessageDeflate,
|
|
151722
|
-
true,
|
|
151723
|
-
this.options.maxPayload
|
|
151724
|
-
);
|
|
151796
|
+
const perMessageDeflate = new PerMessageDeflate2({
|
|
151797
|
+
...this.options.perMessageDeflate,
|
|
151798
|
+
isServer: true,
|
|
151799
|
+
maxPayload: this.options.maxPayload
|
|
151800
|
+
});
|
|
151725
151801
|
try {
|
|
151726
|
-
const offers =
|
|
151727
|
-
if (offers[
|
|
151728
|
-
perMessageDeflate.accept(offers[
|
|
151729
|
-
extensions[
|
|
151802
|
+
const offers = extension2.parse(secWebSocketExtensions);
|
|
151803
|
+
if (offers[PerMessageDeflate2.extensionName]) {
|
|
151804
|
+
perMessageDeflate.accept(offers[PerMessageDeflate2.extensionName]);
|
|
151805
|
+
extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
|
|
151730
151806
|
}
|
|
151731
151807
|
} catch (err) {
|
|
151732
151808
|
const message = "Invalid or unacceptable Sec-WebSocket-Extensions header";
|
|
@@ -151797,10 +151873,10 @@ var require_websocket_server = __commonJS({
|
|
|
151797
151873
|
ws._protocol = protocol;
|
|
151798
151874
|
}
|
|
151799
151875
|
}
|
|
151800
|
-
if (extensions[
|
|
151801
|
-
const params = extensions[
|
|
151802
|
-
const value =
|
|
151803
|
-
[
|
|
151876
|
+
if (extensions[PerMessageDeflate2.extensionName]) {
|
|
151877
|
+
const params = extensions[PerMessageDeflate2.extensionName].params;
|
|
151878
|
+
const value = extension2.format({
|
|
151879
|
+
[PerMessageDeflate2.extensionName]: [params]
|
|
151804
151880
|
});
|
|
151805
151881
|
headers.push(`Sec-WebSocket-Extensions: ${value}`);
|
|
151806
151882
|
ws._extensions = extensions;
|
|
@@ -151859,27 +151935,30 @@ var require_websocket_server = __commonJS({
|
|
|
151859
151935
|
);
|
|
151860
151936
|
}
|
|
151861
151937
|
__name(abortHandshake, "abortHandshake");
|
|
151862
|
-
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
|
|
151938
|
+
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message, headers) {
|
|
151863
151939
|
if (server.listenerCount("wsClientError")) {
|
|
151864
151940
|
const err = new Error(message);
|
|
151865
151941
|
Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
|
|
151866
151942
|
server.emit("wsClientError", err, socket, req);
|
|
151867
151943
|
} else {
|
|
151868
|
-
abortHandshake(socket, code, message);
|
|
151944
|
+
abortHandshake(socket, code, message, headers);
|
|
151869
151945
|
}
|
|
151870
151946
|
}
|
|
151871
151947
|
__name(abortHandshakeOrEmitwsClientError, "abortHandshakeOrEmitwsClientError");
|
|
151872
151948
|
}
|
|
151873
151949
|
});
|
|
151874
151950
|
|
|
151875
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
151951
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/wrapper.mjs
|
|
151876
151952
|
var import_websocket, wrapper_default;
|
|
151877
151953
|
var init_wrapper = __esm({
|
|
151878
|
-
"../../node_modules/.pnpm/ws@8.
|
|
151954
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/wrapper.mjs"() {
|
|
151879
151955
|
init_import_meta_url();
|
|
151880
151956
|
__toESM(require_stream(), 1);
|
|
151957
|
+
__toESM(require_extension(), 1);
|
|
151958
|
+
__toESM(require_permessage_deflate2(), 1);
|
|
151881
151959
|
__toESM(require_receiver2(), 1);
|
|
151882
151960
|
__toESM(require_sender2(), 1);
|
|
151961
|
+
__toESM(require_subprotocol(), 1);
|
|
151883
151962
|
import_websocket = __toESM(require_websocket2(), 1);
|
|
151884
151963
|
__toESM(require_websocket_server(), 1);
|
|
151885
151964
|
wrapper_default = import_websocket.default;
|
|
@@ -154982,7 +155061,7 @@ var init_config5 = __esm({
|
|
|
154982
155061
|
},
|
|
154983
155062
|
affinities: convertContainerAffinitiesForApi(container),
|
|
154984
155063
|
rollout_step_percentage: args?.containersRollout === "immediate" ? 100 : container.rollout_step_percentage ?? rolloutStepPercentageFallback,
|
|
154985
|
-
rollout_kind: container.rollout_kind ?? "full_auto",
|
|
155064
|
+
rollout_kind: args?.containersRollout === "none" ? "none" : container.rollout_kind ?? "full_auto",
|
|
154986
155065
|
rollout_active_grace_period: container.rollout_active_grace_period ?? 0,
|
|
154987
155066
|
observability: {
|
|
154988
155067
|
logs_enabled: config.observability?.logs?.enabled ?? config.observability?.enabled === true
|
|
@@ -160448,19 +160527,35 @@ function truncateDescription(description, alreadyUsed) {
|
|
|
160448
160527
|
}
|
|
160449
160528
|
return truncate2(description, process.stdout.columns - alreadyUsed);
|
|
160450
160529
|
}
|
|
160451
|
-
async function aiCatalogList(complianceConfig, accountId, partialUrl) {
|
|
160530
|
+
async function aiCatalogList(complianceConfig, accountId, partialUrl, options = {}) {
|
|
160452
160531
|
const pageSize = 50;
|
|
160453
160532
|
let page = 1;
|
|
160454
160533
|
const results = [];
|
|
160455
160534
|
while (results.length % pageSize === 0) {
|
|
160535
|
+
const queryParams = new URLSearchParams({
|
|
160536
|
+
per_page: pageSize.toString(),
|
|
160537
|
+
page: page.toString()
|
|
160538
|
+
});
|
|
160539
|
+
if (options.author !== void 0) {
|
|
160540
|
+
queryParams.set("author", options.author);
|
|
160541
|
+
}
|
|
160542
|
+
if (options.hideExperimental) {
|
|
160543
|
+
queryParams.set("hide_experimental", "true");
|
|
160544
|
+
}
|
|
160545
|
+
if (options.search !== void 0) {
|
|
160546
|
+
queryParams.set("search", options.search);
|
|
160547
|
+
}
|
|
160548
|
+
if (options.source !== void 0) {
|
|
160549
|
+
queryParams.set("source", options.source.toString());
|
|
160550
|
+
}
|
|
160551
|
+
if (options.task !== void 0) {
|
|
160552
|
+
queryParams.set("task", options.task);
|
|
160553
|
+
}
|
|
160456
160554
|
const json = await fetchResult(
|
|
160457
160555
|
complianceConfig,
|
|
160458
160556
|
`/accounts/${accountId}/ai/${partialUrl}`,
|
|
160459
160557
|
{},
|
|
160460
|
-
|
|
160461
|
-
per_page: pageSize.toString(),
|
|
160462
|
-
page: page.toString()
|
|
160463
|
-
})
|
|
160558
|
+
queryParams
|
|
160464
160559
|
);
|
|
160465
160560
|
page++;
|
|
160466
160561
|
results.push(...json);
|
|
@@ -160489,8 +160584,13 @@ var init_utils6 = __esm({
|
|
|
160489
160584
|
__name(truncateDescription, "truncateDescription");
|
|
160490
160585
|
__name(aiCatalogList, "aiCatalogList");
|
|
160491
160586
|
__name(aiFinetuneList, "aiFinetuneList");
|
|
160492
|
-
listCatalogEntries = /* @__PURE__ */ __name(async (complianceConfig, accountId) => {
|
|
160493
|
-
return await aiCatalogList(
|
|
160587
|
+
listCatalogEntries = /* @__PURE__ */ __name(async (complianceConfig, accountId, options = {}) => {
|
|
160588
|
+
return await aiCatalogList(
|
|
160589
|
+
complianceConfig,
|
|
160590
|
+
accountId,
|
|
160591
|
+
"models/search",
|
|
160592
|
+
options
|
|
160593
|
+
);
|
|
160494
160594
|
}, "listCatalogEntries");
|
|
160495
160595
|
listFinetuneEntries = /* @__PURE__ */ __name(async (complianceConfig, accountId) => {
|
|
160496
160596
|
return await aiFinetuneList(complianceConfig, accountId);
|
|
@@ -160610,7 +160710,41 @@ var init_createFinetune = __esm({
|
|
|
160610
160710
|
});
|
|
160611
160711
|
|
|
160612
160712
|
// src/ai/listCatalog.ts
|
|
160613
|
-
|
|
160713
|
+
async function listModels({
|
|
160714
|
+
author,
|
|
160715
|
+
hideExperimental,
|
|
160716
|
+
json = false,
|
|
160717
|
+
search,
|
|
160718
|
+
source,
|
|
160719
|
+
task
|
|
160720
|
+
}, config) {
|
|
160721
|
+
const accountId = await requireAuth(config);
|
|
160722
|
+
const entries2 = await listCatalogEntries(config, accountId, {
|
|
160723
|
+
author,
|
|
160724
|
+
hideExperimental,
|
|
160725
|
+
search,
|
|
160726
|
+
source,
|
|
160727
|
+
task
|
|
160728
|
+
});
|
|
160729
|
+
if (json) {
|
|
160730
|
+
logger.json(entries2);
|
|
160731
|
+
} else if (entries2.length === 0) {
|
|
160732
|
+
logger.log(`No models found.`);
|
|
160733
|
+
} else {
|
|
160734
|
+
logger.table(
|
|
160735
|
+
entries2.map((entry) => ({
|
|
160736
|
+
model: entry.id,
|
|
160737
|
+
name: entry.name,
|
|
160738
|
+
description: truncateDescription(
|
|
160739
|
+
entry.description,
|
|
160740
|
+
entry.id.length + entry.name.length + (entry.task ? entry.task.name.length : 0) + 10
|
|
160741
|
+
),
|
|
160742
|
+
task: entry.task ? entry.task.name : ""
|
|
160743
|
+
}))
|
|
160744
|
+
);
|
|
160745
|
+
}
|
|
160746
|
+
}
|
|
160747
|
+
var aiModelsCommand, aiModelsListCommand;
|
|
160614
160748
|
var init_listCatalog = __esm({
|
|
160615
160749
|
"src/ai/listCatalog.ts"() {
|
|
160616
160750
|
init_import_meta_url();
|
|
@@ -160619,6 +160753,19 @@ var init_listCatalog = __esm({
|
|
|
160619
160753
|
init_user3();
|
|
160620
160754
|
init_utils6();
|
|
160621
160755
|
aiModelsCommand = createCommand({
|
|
160756
|
+
metadata: {
|
|
160757
|
+
description: "Manage AI models",
|
|
160758
|
+
status: "stable",
|
|
160759
|
+
owner: "Product: AI"
|
|
160760
|
+
},
|
|
160761
|
+
behaviour: {
|
|
160762
|
+
printBanner: true
|
|
160763
|
+
},
|
|
160764
|
+
async handler(_args, { config }) {
|
|
160765
|
+
await listModels({}, config);
|
|
160766
|
+
}
|
|
160767
|
+
});
|
|
160768
|
+
aiModelsListCommand = createCommand({
|
|
160622
160769
|
metadata: {
|
|
160623
160770
|
description: "List catalog models",
|
|
160624
160771
|
status: "stable",
|
|
@@ -160632,32 +160779,37 @@ var init_listCatalog = __esm({
|
|
|
160632
160779
|
type: "boolean",
|
|
160633
160780
|
description: "Return output as JSON",
|
|
160634
160781
|
default: false
|
|
160782
|
+
},
|
|
160783
|
+
search: {
|
|
160784
|
+
type: "string",
|
|
160785
|
+
description: "Search models by name or description"
|
|
160786
|
+
},
|
|
160787
|
+
task: {
|
|
160788
|
+
type: "string",
|
|
160789
|
+
description: "Filter by task name"
|
|
160790
|
+
},
|
|
160791
|
+
author: {
|
|
160792
|
+
type: "string",
|
|
160793
|
+
description: "Filter by author"
|
|
160794
|
+
},
|
|
160795
|
+
source: {
|
|
160796
|
+
type: "number",
|
|
160797
|
+
description: "Filter by source ID"
|
|
160798
|
+
},
|
|
160799
|
+
"hide-experimental": {
|
|
160800
|
+
type: "boolean",
|
|
160801
|
+
description: "Hide experimental models",
|
|
160802
|
+
default: false
|
|
160635
160803
|
}
|
|
160636
160804
|
},
|
|
160637
|
-
async handler({ json }, { config }) {
|
|
160638
|
-
|
|
160639
|
-
|
|
160640
|
-
|
|
160641
|
-
|
|
160642
|
-
} else {
|
|
160643
|
-
if (entries2.length === 0) {
|
|
160644
|
-
logger.log(`No models found.`);
|
|
160645
|
-
} else {
|
|
160646
|
-
logger.table(
|
|
160647
|
-
entries2.map((entry) => ({
|
|
160648
|
-
model: entry.id,
|
|
160649
|
-
name: entry.name,
|
|
160650
|
-
description: truncateDescription(
|
|
160651
|
-
entry.description,
|
|
160652
|
-
entry.id.length + entry.name.length + (entry.task ? entry.task.name.length : 0) + 10
|
|
160653
|
-
),
|
|
160654
|
-
task: entry.task ? entry.task.name : ""
|
|
160655
|
-
}))
|
|
160656
|
-
);
|
|
160657
|
-
}
|
|
160658
|
-
}
|
|
160805
|
+
async handler({ author, hideExperimental, json, search, source, task }, { config }) {
|
|
160806
|
+
await listModels(
|
|
160807
|
+
{ author, hideExperimental, json, search, source, task },
|
|
160808
|
+
config
|
|
160809
|
+
);
|
|
160659
160810
|
}
|
|
160660
160811
|
});
|
|
160812
|
+
__name(listModels, "listModels");
|
|
160661
160813
|
}
|
|
160662
160814
|
});
|
|
160663
160815
|
|
|
@@ -160711,6 +160863,43 @@ var init_listFinetune = __esm({
|
|
|
160711
160863
|
});
|
|
160712
160864
|
}
|
|
160713
160865
|
});
|
|
160866
|
+
|
|
160867
|
+
// src/ai/modelSchema.ts
|
|
160868
|
+
var aiModelsSchemaCommand;
|
|
160869
|
+
var init_modelSchema = __esm({
|
|
160870
|
+
"src/ai/modelSchema.ts"() {
|
|
160871
|
+
init_import_meta_url();
|
|
160872
|
+
init_create_command();
|
|
160873
|
+
init_logger();
|
|
160874
|
+
init_user3();
|
|
160875
|
+
aiModelsSchemaCommand = createCommand({
|
|
160876
|
+
metadata: {
|
|
160877
|
+
description: "Get model schema",
|
|
160878
|
+
status: "stable",
|
|
160879
|
+
owner: "Product: AI"
|
|
160880
|
+
},
|
|
160881
|
+
behaviour: {
|
|
160882
|
+
printBanner: false
|
|
160883
|
+
},
|
|
160884
|
+
args: {
|
|
160885
|
+
model: {
|
|
160886
|
+
type: "string",
|
|
160887
|
+
demandOption: true,
|
|
160888
|
+
description: "The model to fetch a schema for"
|
|
160889
|
+
}
|
|
160890
|
+
},
|
|
160891
|
+
positionalArgs: ["model"],
|
|
160892
|
+
async handler({ model }, { config, sdk }) {
|
|
160893
|
+
const accountId = await requireAuth(config);
|
|
160894
|
+
const schema = await sdk.ai.models.schema.get({
|
|
160895
|
+
account_id: accountId,
|
|
160896
|
+
model
|
|
160897
|
+
});
|
|
160898
|
+
logger.json(schema);
|
|
160899
|
+
}
|
|
160900
|
+
});
|
|
160901
|
+
}
|
|
160902
|
+
});
|
|
160714
160903
|
function formatLabelledValues(view, {
|
|
160715
160904
|
formatLabel = /* @__PURE__ */ __name((label) => white(label + ":"), "formatLabel"),
|
|
160716
160905
|
formatValue = /* @__PURE__ */ __name((value) => gray(value), "formatValue"),
|
|
@@ -181270,7 +181459,10 @@ Your database may not be available to serve requests during the migration, conti
|
|
|
181270
181459
|
preview
|
|
181271
181460
|
});
|
|
181272
181461
|
if (response === null) {
|
|
181273
|
-
|
|
181462
|
+
throw new UserError(
|
|
181463
|
+
`Migration "${migration.name}" was not applied \u2014 execution was cancelled.`,
|
|
181464
|
+
{ telemetryMessage: "d1 migrations apply execution cancelled" }
|
|
181465
|
+
);
|
|
181274
181466
|
}
|
|
181275
181467
|
for (const result of response) {
|
|
181276
181468
|
if (Array.isArray(result)) {
|
|
@@ -181286,6 +181478,9 @@ Your database may not be available to serve requests during the migration, conti
|
|
|
181286
181478
|
}
|
|
181287
181479
|
}
|
|
181288
181480
|
} catch (e9) {
|
|
181481
|
+
if (e9 instanceof UserError) {
|
|
181482
|
+
throw e9;
|
|
181483
|
+
}
|
|
181289
181484
|
const err = e9;
|
|
181290
181485
|
const maybeCause = err.cause ?? err;
|
|
181291
181486
|
success2 = false;
|
|
@@ -230862,8 +231057,8 @@ var init_deploy2 = __esm({
|
|
|
230862
231057
|
type: "string"
|
|
230863
231058
|
},
|
|
230864
231059
|
"containers-rollout": {
|
|
230865
|
-
describe: "Rollout strategy for Containers changes. If set to immediate, it will override `rollout_percentage_steps` if configured and roll out to 100% of instances in one step. ",
|
|
230866
|
-
choices: ["immediate", "gradual"]
|
|
231060
|
+
describe: "Rollout strategy for Containers changes. If set to immediate, it will override `rollout_percentage_steps` if configured and roll out to 100% of instances in one step. If set to none, the Worker will be deployed without building or updating any Containers.",
|
|
231061
|
+
choices: ["immediate", "gradual", "none"]
|
|
230867
231062
|
},
|
|
230868
231063
|
strict: {
|
|
230869
231064
|
describe: "Enables strict mode for the deploy command, this prevents deployments to occur when there are even small potential risks.",
|
|
@@ -238393,8 +238588,8 @@ var init_hash = __esm({
|
|
|
238393
238588
|
hashFile = /* @__PURE__ */ __name((filepath) => {
|
|
238394
238589
|
const contents = fs27.readFileSync(filepath);
|
|
238395
238590
|
const base64Contents = contents.toString("base64");
|
|
238396
|
-
const
|
|
238397
|
-
return blake3Wasm.hash(base64Contents +
|
|
238591
|
+
const extension2 = path3.extname(filepath).substring(1);
|
|
238592
|
+
return blake3Wasm.hash(base64Contents + extension2).toString("hex").slice(0, 32);
|
|
238398
238593
|
}, "hashFile");
|
|
238399
238594
|
}
|
|
238400
238595
|
});
|
|
@@ -242911,6 +243106,23 @@ async function createDraftWorker({
|
|
|
242911
243106
|
}
|
|
242912
243107
|
);
|
|
242913
243108
|
}
|
|
243109
|
+
async function putBulkSecrets(config, accountId, scriptName, environment, content, options = {}) {
|
|
243110
|
+
const isServiceEnv = options?.isServiceEnv;
|
|
243111
|
+
const url4 = isServiceEnv ? `/accounts/${accountId}/workers/services/${scriptName}/environments/${environment}/secrets-bulk` : `/accounts/${accountId}/workers/scripts/${scriptName}/secrets-bulk`;
|
|
243112
|
+
const secretEntries = Object.entries(content);
|
|
243113
|
+
const secrets = {};
|
|
243114
|
+
const toCreate = [];
|
|
243115
|
+
for (const [key, value] of secretEntries) {
|
|
243116
|
+
toCreate.push(key);
|
|
243117
|
+
secrets[key] = { name: key, text: value, type: "secret_text" };
|
|
243118
|
+
}
|
|
243119
|
+
const resp = await fetchResult(config, url4, {
|
|
243120
|
+
method: "PATCH",
|
|
243121
|
+
headers: { "Content-Type": "application/merge-patch+json" },
|
|
243122
|
+
body: JSON.stringify({ secrets })
|
|
243123
|
+
});
|
|
243124
|
+
return [resp, toCreate];
|
|
243125
|
+
}
|
|
242914
243126
|
function validateFileSecrets(content, jsonFilePath) {
|
|
242915
243127
|
if (content === null || typeof content !== "object") {
|
|
242916
243128
|
throw new FatalError(
|
|
@@ -242973,13 +243185,12 @@ async function parseBulkInputToObject(input) {
|
|
|
242973
243185
|
}
|
|
242974
243186
|
return { content, secretSource, secretFormat };
|
|
242975
243187
|
}
|
|
242976
|
-
var import_dotenv2,
|
|
243188
|
+
var import_dotenv2, VERSION_NOT_DEPLOYED_ERR_CODE, secretNamespace, secretPutCommand, secretDeleteCommand, secretListCommand, secretBulkCommand;
|
|
242977
243189
|
var init_secret = __esm({
|
|
242978
243190
|
"src/secret/index.ts"() {
|
|
242979
243191
|
init_import_meta_url();
|
|
242980
243192
|
init_dist();
|
|
242981
243193
|
import_dotenv2 = __toESM(require_main());
|
|
242982
|
-
import_undici19 = __toESM(require_undici());
|
|
242983
243194
|
init_cfetch();
|
|
242984
243195
|
init_create_command();
|
|
242985
243196
|
init_create_worker_upload_form();
|
|
@@ -243241,6 +243452,7 @@ Otherwise, check that the Worker name is correct and you're logged into the righ
|
|
|
243241
243452
|
});
|
|
243242
243453
|
}
|
|
243243
243454
|
});
|
|
243455
|
+
__name(putBulkSecrets, "putBulkSecrets");
|
|
243244
243456
|
secretBulkCommand = createCommand({
|
|
243245
243457
|
metadata: {
|
|
243246
243458
|
description: "Upload multiple secrets for a Worker at once",
|
|
@@ -243274,7 +243486,7 @@ Otherwise, check that the Worker name is correct and you're logged into the righ
|
|
|
243274
243486
|
{ telemetryMessage: "secret bulk pages project" }
|
|
243275
243487
|
);
|
|
243276
243488
|
}
|
|
243277
|
-
const isServiceEnv = useServiceEnvironments(config) && args.env;
|
|
243489
|
+
const isServiceEnv = useServiceEnvironments(config) && !!args.env;
|
|
243278
243490
|
const scriptName = getLegacyScriptName(args, config);
|
|
243279
243491
|
if (!scriptName) {
|
|
243280
243492
|
const error2 = new UserError(
|
|
@@ -243293,27 +243505,21 @@ Otherwise, check that the Worker name is correct and you're logged into the righ
|
|
|
243293
243505
|
return logger.error(`\u{1F6A8} No content found in file, or piped input.`);
|
|
243294
243506
|
}
|
|
243295
243507
|
const { content, secretSource, secretFormat } = result;
|
|
243296
|
-
|
|
243297
|
-
const url4 = isServiceEnv ? `/accounts/${accountId}/workers/services/${scriptName}/environments/${args.env}/settings` : `/accounts/${accountId}/workers/scripts/${scriptName}/settings`;
|
|
243298
|
-
return fetchResult(config, url4);
|
|
243299
|
-
}
|
|
243300
|
-
__name(getSettings3, "getSettings");
|
|
243301
|
-
function putBindingsSettings(bindings) {
|
|
243302
|
-
const url4 = isServiceEnv ? `/accounts/${accountId}/workers/services/${scriptName}/environments/${args.env}/settings` : `/accounts/${accountId}/workers/scripts/${scriptName}/settings`;
|
|
243303
|
-
const data = new import_undici19.FormData();
|
|
243304
|
-
data.set("settings", JSON.stringify({ bindings }));
|
|
243305
|
-
return fetchResult(config, url4, {
|
|
243306
|
-
method: "PATCH",
|
|
243307
|
-
body: data
|
|
243308
|
-
});
|
|
243309
|
-
}
|
|
243310
|
-
__name(putBindingsSettings, "putBindingsSettings");
|
|
243311
|
-
let existingBindings;
|
|
243508
|
+
let created = [];
|
|
243312
243509
|
try {
|
|
243313
|
-
|
|
243314
|
-
|
|
243315
|
-
|
|
243316
|
-
|
|
243510
|
+
try {
|
|
243511
|
+
[, created] = await putBulkSecrets(
|
|
243512
|
+
config,
|
|
243513
|
+
accountId,
|
|
243514
|
+
scriptName,
|
|
243515
|
+
args.env,
|
|
243516
|
+
content,
|
|
243517
|
+
{ isServiceEnv }
|
|
243518
|
+
);
|
|
243519
|
+
} catch (e9) {
|
|
243520
|
+
if (!isWorkerNotFoundError(e9)) {
|
|
243521
|
+
throw e9;
|
|
243522
|
+
}
|
|
243317
243523
|
const draftWorkerResult = await createDraftWorker({
|
|
243318
243524
|
config,
|
|
243319
243525
|
args,
|
|
@@ -243323,50 +243529,38 @@ Otherwise, check that the Worker name is correct and you're logged into the righ
|
|
|
243323
243529
|
if (draftWorkerResult === null) {
|
|
243324
243530
|
return;
|
|
243325
243531
|
}
|
|
243326
|
-
|
|
243327
|
-
|
|
243328
|
-
|
|
243329
|
-
|
|
243330
|
-
|
|
243331
|
-
|
|
243332
|
-
|
|
243333
|
-
}).map((binding) => ({ type: binding.type, name: binding.name }));
|
|
243334
|
-
const upsertBindings = Object.entries(
|
|
243335
|
-
content
|
|
243336
|
-
).map(([key, value]) => {
|
|
243337
|
-
return {
|
|
243338
|
-
type: "secret_text",
|
|
243339
|
-
name: key,
|
|
243340
|
-
text: value
|
|
243341
|
-
};
|
|
243342
|
-
});
|
|
243343
|
-
try {
|
|
243344
|
-
await putBindingsSettings(inheritBindings.concat(upsertBindings));
|
|
243345
|
-
for (const upsertedBinding of upsertBindings) {
|
|
243346
|
-
logger.log(
|
|
243347
|
-
`\u2728 Successfully created secret for key: ${upsertedBinding.name}`
|
|
243532
|
+
[, created] = await putBulkSecrets(
|
|
243533
|
+
config,
|
|
243534
|
+
accountId,
|
|
243535
|
+
scriptName,
|
|
243536
|
+
args.env,
|
|
243537
|
+
content,
|
|
243538
|
+
{ isServiceEnv }
|
|
243348
243539
|
);
|
|
243349
243540
|
}
|
|
243350
|
-
|
|
243351
|
-
logger.log("Finished processing secrets file:");
|
|
243352
|
-
logger.log(`\u2728 ${upsertBindings.length} secrets successfully uploaded`);
|
|
243353
|
-
sendMetricsEvent(
|
|
243354
|
-
"create encrypted variable",
|
|
243355
|
-
{
|
|
243356
|
-
secretOperation: "bulk",
|
|
243357
|
-
secretSource,
|
|
243358
|
-
secretFormat,
|
|
243359
|
-
hasEnvironment: Boolean(args.env)
|
|
243360
|
-
},
|
|
243361
|
-
{
|
|
243362
|
-
sendMetrics: config.send_metrics
|
|
243363
|
-
}
|
|
243364
|
-
);
|
|
243365
|
-
} catch (err) {
|
|
243541
|
+
} catch (e9) {
|
|
243366
243542
|
logger.log("");
|
|
243367
243543
|
logger.log(`\u{1F6A8} Secrets failed to upload`);
|
|
243368
|
-
throw
|
|
243544
|
+
throw e9;
|
|
243545
|
+
}
|
|
243546
|
+
for (const key of created) {
|
|
243547
|
+
logger.log(`\u2728 Successfully created secret for key: ${key}`);
|
|
243369
243548
|
}
|
|
243549
|
+
logger.log("");
|
|
243550
|
+
logger.log("Finished processing secrets file:");
|
|
243551
|
+
logger.log(`\u2728 ${created.length} secrets successfully uploaded`);
|
|
243552
|
+
sendMetricsEvent(
|
|
243553
|
+
"create encrypted variable",
|
|
243554
|
+
{
|
|
243555
|
+
secretOperation: "bulk",
|
|
243556
|
+
secretSource,
|
|
243557
|
+
secretFormat,
|
|
243558
|
+
hasEnvironment: Boolean(args.env)
|
|
243559
|
+
},
|
|
243560
|
+
{
|
|
243561
|
+
sendMetrics: config.send_metrics
|
|
243562
|
+
}
|
|
243563
|
+
);
|
|
243370
243564
|
}
|
|
243371
243565
|
});
|
|
243372
243566
|
__name(validateFileSecrets, "validateFileSecrets");
|
|
@@ -266547,7 +266741,7 @@ var init_runtimeExtensions = __esm({
|
|
|
266547
266741
|
...asPartial(getHttpHandlerExtensionConfiguration(runtimeConfig)),
|
|
266548
266742
|
...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig))
|
|
266549
266743
|
};
|
|
266550
|
-
extensions.forEach((
|
|
266744
|
+
extensions.forEach((extension2) => extension2.configure(extensionConfiguration));
|
|
266551
266745
|
return {
|
|
266552
266746
|
...runtimeConfig,
|
|
266553
266747
|
...resolveAwsRegionExtensionConfiguration(extensionConfiguration),
|
|
@@ -268141,7 +268335,7 @@ var init_runtimeExtensions2 = __esm({
|
|
|
268141
268335
|
...asPartial2(getHttpHandlerExtensionConfiguration(runtimeConfig)),
|
|
268142
268336
|
...asPartial2(getHttpAuthExtensionConfiguration2(runtimeConfig))
|
|
268143
268337
|
};
|
|
268144
|
-
extensions.forEach((
|
|
268338
|
+
extensions.forEach((extension2) => extension2.configure(extensionConfiguration));
|
|
268145
268339
|
return {
|
|
268146
268340
|
...runtimeConfig,
|
|
268147
268341
|
...resolveAwsRegionExtensionConfiguration(extensionConfiguration),
|
|
@@ -269420,7 +269614,7 @@ var init_runtimeExtensions3 = __esm({
|
|
|
269420
269614
|
...asPartial3(getHttpHandlerExtensionConfiguration(runtimeConfig)),
|
|
269421
269615
|
...asPartial3(getHttpAuthExtensionConfiguration3(runtimeConfig))
|
|
269422
269616
|
};
|
|
269423
|
-
extensions.forEach((
|
|
269617
|
+
extensions.forEach((extension2) => extension2.configure(extensionConfiguration));
|
|
269424
269618
|
return {
|
|
269425
269619
|
...runtimeConfig,
|
|
269426
269620
|
...resolveAwsRegionExtensionConfiguration(extensionConfiguration),
|
|
@@ -272595,7 +272789,7 @@ var init_runtimeExtensions4 = __esm({
|
|
|
272595
272789
|
...asPartial4(getHttpHandlerExtensionConfiguration(runtimeConfig)),
|
|
272596
272790
|
...asPartial4(getHttpAuthExtensionConfiguration4(runtimeConfig))
|
|
272597
272791
|
};
|
|
272598
|
-
extensions.forEach((
|
|
272792
|
+
extensions.forEach((extension2) => extension2.configure(extensionConfiguration));
|
|
272599
272793
|
return {
|
|
272600
272794
|
...runtimeConfig,
|
|
272601
272795
|
...resolveAwsRegionExtensionConfiguration(extensionConfiguration),
|
|
@@ -277810,7 +278004,8 @@ var init_defaults = __esm({
|
|
|
277810
278004
|
},
|
|
277811
278005
|
rolling_policy: {
|
|
277812
278006
|
file_size_bytes: void 0,
|
|
277813
|
-
interval_seconds: 300
|
|
278007
|
+
interval_seconds: 300,
|
|
278008
|
+
min_interval_seconds: 60
|
|
277814
278009
|
},
|
|
277815
278010
|
r2: {
|
|
277816
278011
|
path: "",
|
|
@@ -277935,7 +278130,8 @@ async function promptCompression() {
|
|
|
277935
278130
|
fallbackOption: 3
|
|
277936
278131
|
});
|
|
277937
278132
|
}
|
|
277938
|
-
async function promptRollingPolicy() {
|
|
278133
|
+
async function promptRollingPolicy(options) {
|
|
278134
|
+
const minInterval = options?.minIntervalSeconds ?? 10;
|
|
277939
278135
|
const fileSizeMB = await promptWithRetry(
|
|
277940
278136
|
() => "File size",
|
|
277941
278137
|
() => prompt("Roll file when size reaches (MB, minimum 5):", {
|
|
@@ -277952,13 +278148,13 @@ async function promptRollingPolicy() {
|
|
|
277952
278148
|
);
|
|
277953
278149
|
const intervalSeconds = await promptWithRetry(
|
|
277954
278150
|
() => "Interval",
|
|
277955
|
-
() => prompt(
|
|
278151
|
+
() => prompt(`Roll file when time reaches (seconds, minimum ${minInterval}):`, {
|
|
277956
278152
|
defaultValue: String(SINK_DEFAULTS.rolling_policy.interval_seconds)
|
|
277957
278153
|
}),
|
|
277958
278154
|
(value) => {
|
|
277959
278155
|
const num = parseInt(value, 10);
|
|
277960
|
-
if (isNaN(num) || num <
|
|
277961
|
-
throw new UserError(
|
|
278156
|
+
if (isNaN(num) || num < minInterval) {
|
|
278157
|
+
throw new UserError(`Interval must be a number >= ${minInterval}`, {
|
|
277962
278158
|
telemetryMessage: "pipelines setup invalid interval"
|
|
277963
278159
|
});
|
|
277964
278160
|
}
|
|
@@ -278535,7 +278731,9 @@ async function setupDataCatalogSink(config, accountId, setupConfig) {
|
|
|
278535
278731
|
displayCatalogTokenInstructions(accountId);
|
|
278536
278732
|
const token = await promptCatalogToken(config, accountId, bucket);
|
|
278537
278733
|
const compression = await promptCompression();
|
|
278538
|
-
const rollingPolicy = await promptRollingPolicy(
|
|
278734
|
+
const rollingPolicy = await promptRollingPolicy({
|
|
278735
|
+
minIntervalSeconds: SINK_DEFAULTS.rolling_policy.min_interval_seconds
|
|
278736
|
+
});
|
|
278539
278737
|
setupConfig.sinkConfig = {
|
|
278540
278738
|
name: setupConfig.sinkName,
|
|
278541
278739
|
type: "r2_data_catalog",
|
|
@@ -279110,6 +279308,14 @@ var init_create11 = __esm({
|
|
|
279110
279308
|
{ telemetryMessage: "pipelines sinks create invalid format" }
|
|
279111
279309
|
);
|
|
279112
279310
|
}
|
|
279311
|
+
if (args.rollInterval !== void 0 && args.rollInterval < SINK_DEFAULTS.rolling_policy.min_interval_seconds) {
|
|
279312
|
+
throw new CommandLineArgsError(
|
|
279313
|
+
`Pipeline frequency must be at least ${SINK_DEFAULTS.rolling_policy.min_interval_seconds} seconds for R2 Data Catalog sinks to prevent compaction issues. Current value: ${args.rollInterval} seconds.`,
|
|
279314
|
+
{
|
|
279315
|
+
telemetryMessage: "pipelines r2 data catalog interval below minimum threshold"
|
|
279316
|
+
}
|
|
279317
|
+
);
|
|
279318
|
+
}
|
|
279113
279319
|
}
|
|
279114
279320
|
}, "validateArgs"),
|
|
279115
279321
|
async handler(args, { config }) {
|
|
@@ -290126,14 +290332,14 @@ function formatSqlResults(data, duration) {
|
|
|
290126
290332
|
logger.log(`On average, ${prettyBytes(bytesPerSecond)} / s`);
|
|
290127
290333
|
}
|
|
290128
290334
|
}
|
|
290129
|
-
var
|
|
290335
|
+
var import_undici19, r2SqlNamespace, r2SqlQueryCommand;
|
|
290130
290336
|
var init_sql = __esm({
|
|
290131
290337
|
"src/r2/sql.ts"() {
|
|
290132
290338
|
init_import_meta_url();
|
|
290133
290339
|
init_interactive();
|
|
290134
290340
|
init_dist();
|
|
290135
290341
|
init_pretty_bytes();
|
|
290136
|
-
|
|
290342
|
+
import_undici19 = __toESM(require_undici());
|
|
290137
290343
|
init_internal();
|
|
290138
290344
|
init_create_command();
|
|
290139
290345
|
init_logger();
|
|
@@ -290199,7 +290405,7 @@ var init_sql = __esm({
|
|
|
290199
290405
|
let duration = null;
|
|
290200
290406
|
try {
|
|
290201
290407
|
const start = Date.now();
|
|
290202
|
-
const response = await (0,
|
|
290408
|
+
const response = await (0, import_undici19.fetch)(apiUrl, {
|
|
290203
290409
|
method: "POST",
|
|
290204
290410
|
headers: {
|
|
290205
290411
|
Authorization: `Bearer ${token}`,
|
|
@@ -290415,6 +290621,12 @@ function getHostFromRoute(route) {
|
|
|
290415
290621
|
}
|
|
290416
290622
|
return host;
|
|
290417
290623
|
}
|
|
290624
|
+
function getZoneFromRoute(route) {
|
|
290625
|
+
if (typeof route === "object" && "zone_name" in route && route.zone_name) {
|
|
290626
|
+
return route.zone_name;
|
|
290627
|
+
}
|
|
290628
|
+
return getHostFromRoute(route);
|
|
290629
|
+
}
|
|
290418
290630
|
async function getZoneForRoute(complianceConfig, from, zoneIdCache = /* @__PURE__ */ new Map()) {
|
|
290419
290631
|
const { route, accountId } = from;
|
|
290420
290632
|
const host = getHostFromRoute(route);
|
|
@@ -290584,6 +290796,7 @@ var init_zones3 = __esm({
|
|
|
290584
290796
|
init_cfetch();
|
|
290585
290797
|
init_retry();
|
|
290586
290798
|
__name(getHostFromRoute, "getHostFromRoute");
|
|
290799
|
+
__name(getZoneFromRoute, "getZoneFromRoute");
|
|
290587
290800
|
__name(getZoneForRoute, "getZoneForRoute");
|
|
290588
290801
|
__name(getHostFromUrl, "getHostFromUrl");
|
|
290589
290802
|
__name(getZoneIdForPreview, "getZoneIdForPreview");
|
|
@@ -290809,7 +291022,13 @@ var init_tail2 = __esm({
|
|
|
290809
291022
|
});
|
|
290810
291023
|
|
|
290811
291024
|
// src/routes.ts
|
|
290812
|
-
async function getWorkersDevSubdomain(complianceConfig, accountId,
|
|
291025
|
+
async function getWorkersDevSubdomain(complianceConfig, accountId, options = {}) {
|
|
291026
|
+
const {
|
|
291027
|
+
configPath,
|
|
291028
|
+
apiToken,
|
|
291029
|
+
abortSignal,
|
|
291030
|
+
registrationContext = "workers_dev"
|
|
291031
|
+
} = options;
|
|
290813
291032
|
try {
|
|
290814
291033
|
const { subdomain } = await fetchResult(
|
|
290815
291034
|
complianceConfig,
|
|
@@ -290822,29 +291041,66 @@ async function getWorkersDevSubdomain(complianceConfig, accountId, configPath, a
|
|
|
290822
291041
|
return `${subdomain}${getComplianceRegionSubdomain(complianceConfig)}.workers.dev`;
|
|
290823
291042
|
} catch (e9) {
|
|
290824
291043
|
const error2 = e9;
|
|
290825
|
-
if (typeof error2
|
|
290826
|
-
|
|
290827
|
-
|
|
291044
|
+
if (typeof error2 !== "object" || !error2 || error2.code !== 10007) {
|
|
291045
|
+
throw e9;
|
|
291046
|
+
}
|
|
291047
|
+
logger.warn(getRegistrationWarning(registrationContext));
|
|
291048
|
+
const wantsToRegister = await confirm(
|
|
291049
|
+
"Would you like to register a workers.dev subdomain now?",
|
|
291050
|
+
{ fallbackValue: false }
|
|
291051
|
+
);
|
|
291052
|
+
if (!wantsToRegister) {
|
|
291053
|
+
throw getRegistrationDeclinedError(
|
|
291054
|
+
registrationContext,
|
|
291055
|
+
accountId,
|
|
291056
|
+
configPath
|
|
290828
291057
|
);
|
|
290829
|
-
|
|
290830
|
-
|
|
290831
|
-
|
|
291058
|
+
}
|
|
291059
|
+
return await registerSubdomain(
|
|
291060
|
+
complianceConfig,
|
|
291061
|
+
accountId,
|
|
291062
|
+
configPath,
|
|
291063
|
+
registrationContext
|
|
291064
|
+
);
|
|
291065
|
+
}
|
|
291066
|
+
}
|
|
291067
|
+
function getRegistrationWarning(registrationContext) {
|
|
291068
|
+
switch (registrationContext) {
|
|
291069
|
+
case "workflows":
|
|
291070
|
+
return "You need to register a workers.dev subdomain before deploying Workflows";
|
|
291071
|
+
case "workers_dev":
|
|
291072
|
+
return "You need to register a workers.dev subdomain before publishing to workers.dev";
|
|
291073
|
+
default: {
|
|
291074
|
+
const _exhaustive = registrationContext;
|
|
291075
|
+
return _exhaustive;
|
|
291076
|
+
}
|
|
291077
|
+
}
|
|
291078
|
+
}
|
|
291079
|
+
function getRegistrationDeclinedError(registrationContext, accountId, configPath) {
|
|
291080
|
+
const onboardingLink = `https://dash.cloudflare.com/${accountId}/workers/onboarding`;
|
|
291081
|
+
switch (registrationContext) {
|
|
291082
|
+
case "workflows":
|
|
291083
|
+
return new UserError(
|
|
291084
|
+
`Workflows require your account to have a workers.dev subdomain. Register a workers.dev subdomain here:
|
|
291085
|
+
${onboardingLink}`,
|
|
291086
|
+
{
|
|
291087
|
+
telemetryMessage: "workflows workers dev registration declined"
|
|
291088
|
+
}
|
|
290832
291089
|
);
|
|
290833
|
-
|
|
290834
|
-
|
|
290835
|
-
|
|
290836
|
-
throw new UserError(`${solutionMessage}
|
|
291090
|
+
case "workers_dev": {
|
|
291091
|
+
const solutionMessage = `You can either deploy your worker to one or more routes by specifying them in your ${configFileName(configPath)} file, or register a workers.dev subdomain here:`;
|
|
291092
|
+
return new UserError(`${solutionMessage}
|
|
290837
291093
|
${onboardingLink}`, {
|
|
290838
|
-
|
|
290839
|
-
|
|
290840
|
-
|
|
290841
|
-
|
|
290842
|
-
|
|
290843
|
-
|
|
291094
|
+
telemetryMessage: "routes workers dev registration declined"
|
|
291095
|
+
});
|
|
291096
|
+
}
|
|
291097
|
+
default: {
|
|
291098
|
+
const _exhaustive = registrationContext;
|
|
291099
|
+
return _exhaustive;
|
|
290844
291100
|
}
|
|
290845
291101
|
}
|
|
290846
291102
|
}
|
|
290847
|
-
async function registerSubdomain(complianceConfig, accountId, configPath) {
|
|
291103
|
+
async function registerSubdomain(complianceConfig, accountId, configPath, registrationContext) {
|
|
290848
291104
|
let subdomain;
|
|
290849
291105
|
while (subdomain === void 0) {
|
|
290850
291106
|
const potentialName = await prompt(
|
|
@@ -290883,12 +291139,11 @@ async function registerSubdomain(complianceConfig, accountId, configPath) {
|
|
|
290883
291139
|
)}. Ok to proceed?`
|
|
290884
291140
|
);
|
|
290885
291141
|
if (!ok) {
|
|
290886
|
-
|
|
290887
|
-
|
|
290888
|
-
|
|
290889
|
-
|
|
290890
|
-
|
|
290891
|
-
});
|
|
291142
|
+
throw getRegistrationDeclinedError(
|
|
291143
|
+
registrationContext,
|
|
291144
|
+
accountId,
|
|
291145
|
+
configPath
|
|
291146
|
+
);
|
|
290892
291147
|
}
|
|
290893
291148
|
try {
|
|
290894
291149
|
const result = await fetchResult(
|
|
@@ -290935,6 +291190,8 @@ var init_routes6 = __esm({
|
|
|
290935
291190
|
init_dialogs();
|
|
290936
291191
|
init_logger();
|
|
290937
291192
|
__name(getWorkersDevSubdomain, "getWorkersDevSubdomain");
|
|
291193
|
+
__name(getRegistrationWarning, "getRegistrationWarning");
|
|
291194
|
+
__name(getRegistrationDeclinedError, "getRegistrationDeclinedError");
|
|
290938
291195
|
__name(registerSubdomain, "registerSubdomain");
|
|
290939
291196
|
}
|
|
290940
291197
|
});
|
|
@@ -290981,6 +291238,9 @@ async function triggersDeploy(props) {
|
|
|
290981
291238
|
}
|
|
290982
291239
|
const uploadMs = Date.now() - start;
|
|
290983
291240
|
const deployments = [];
|
|
291241
|
+
const hasWorkflowsDefinedInThisScript = config.workflows.some(
|
|
291242
|
+
(workflow) => isWorkflowDefinedInThisScript(workflow, scriptName)
|
|
291243
|
+
);
|
|
290984
291244
|
const { wantWorkersDev, workersDevInSync } = await subdomainDeploy(
|
|
290985
291245
|
props,
|
|
290986
291246
|
accountId,
|
|
@@ -291050,6 +291310,12 @@ ${dashLink}`, {
|
|
|
291050
291310
|
});
|
|
291051
291311
|
}
|
|
291052
291312
|
}
|
|
291313
|
+
if (!wantWorkersDev && hasWorkflowsDefinedInThisScript) {
|
|
291314
|
+
await getWorkersDevSubdomain(config, accountId, {
|
|
291315
|
+
configPath: config.configPath,
|
|
291316
|
+
registrationContext: "workflows"
|
|
291317
|
+
});
|
|
291318
|
+
}
|
|
291053
291319
|
if (routesOnly.length > 0) {
|
|
291054
291320
|
deployments.push(
|
|
291055
291321
|
publishRoutes(config, routesOnly, {
|
|
@@ -291095,7 +291361,7 @@ ${dashLink}`, {
|
|
|
291095
291361
|
}
|
|
291096
291362
|
if (config.workflows?.length) {
|
|
291097
291363
|
for (const workflow of config.workflows) {
|
|
291098
|
-
if (workflow
|
|
291364
|
+
if (!isWorkflowDefinedInThisScript(workflow, scriptName)) {
|
|
291099
291365
|
if (workflow.limits) {
|
|
291100
291366
|
throw new UserError(
|
|
291101
291367
|
`Workflow "${workflow.name}" has "limits" configured but references external script "${workflow.script_name}". Configure limits on the worker that defines the workflow.`,
|
|
@@ -291179,11 +291445,9 @@ async function validateSubdomainMixedState(props, accountId, scriptName, before,
|
|
|
291179
291445
|
if (after.workers_dev === after.preview_urls) {
|
|
291180
291446
|
return after;
|
|
291181
291447
|
}
|
|
291182
|
-
const userSubdomain = await getWorkersDevSubdomain(
|
|
291183
|
-
config
|
|
291184
|
-
|
|
291185
|
-
config.configPath
|
|
291186
|
-
);
|
|
291448
|
+
const userSubdomain = await getWorkersDevSubdomain(config, accountId, {
|
|
291449
|
+
configPath: config.configPath
|
|
291450
|
+
});
|
|
291187
291451
|
const previewUrl = `https://<VERSION_PREFIX>-${scriptName}.${userSubdomain}`;
|
|
291188
291452
|
if (!after.workers_dev && after.preview_urls) {
|
|
291189
291453
|
logger.warn(
|
|
@@ -291212,14 +291476,12 @@ async function validateSubdomainMixedState(props, accountId, scriptName, before,
|
|
|
291212
291476
|
async function subdomainDeploy(props, accountId, scriptName, envName, workerUrl, routes, deployments, firstDeploy) {
|
|
291213
291477
|
const { config } = props;
|
|
291214
291478
|
const { workers_dev: wantWorkersDev, preview_urls: wantPreviews } = getSubdomainValues(config.workers_dev, config.preview_urls, routes);
|
|
291215
|
-
let workersDevURL;
|
|
291216
291479
|
if (wantWorkersDev) {
|
|
291217
|
-
const userSubdomain = await getWorkersDevSubdomain(
|
|
291218
|
-
config
|
|
291219
|
-
|
|
291220
|
-
|
|
291221
|
-
);
|
|
291222
|
-
workersDevURL = !props.useServiceEnvironments || !props.env ? `${scriptName}.${userSubdomain}` : `${envName}.${scriptName}.${userSubdomain}`;
|
|
291480
|
+
const userSubdomain = await getWorkersDevSubdomain(config, accountId, {
|
|
291481
|
+
configPath: config.configPath
|
|
291482
|
+
});
|
|
291483
|
+
const workersDevURL = !props.useServiceEnvironments || !props.env ? `${scriptName}.${userSubdomain}` : `${envName}.${scriptName}.${userSubdomain}`;
|
|
291484
|
+
deployments.push(Promise.resolve([workersDevURL]));
|
|
291223
291485
|
}
|
|
291224
291486
|
const before = await fetchResult(config, `${workerUrl}/subdomain`);
|
|
291225
291487
|
const after = await retryOnAPIFailure(
|
|
@@ -291273,9 +291535,6 @@ async function subdomainDeploy(props, accountId, scriptName, envName, workerUrl,
|
|
|
291273
291535
|
{ workers_dev: after.enabled, preview_urls: after.previews_enabled },
|
|
291274
291536
|
firstDeploy
|
|
291275
291537
|
);
|
|
291276
|
-
if (workersDevURL) {
|
|
291277
|
-
deployments.push(Promise.resolve([workersDevURL]));
|
|
291278
|
-
}
|
|
291279
291538
|
return {
|
|
291280
291539
|
wantWorkersDev,
|
|
291281
291540
|
wantPreviews,
|
|
@@ -291283,6 +291542,9 @@ async function subdomainDeploy(props, accountId, scriptName, envName, workerUrl,
|
|
|
291283
291542
|
previewsInSync: before.previews_enabled === after.previews_enabled
|
|
291284
291543
|
};
|
|
291285
291544
|
}
|
|
291545
|
+
function isWorkflowDefinedInThisScript(workflow, scriptName) {
|
|
291546
|
+
return workflow.script_name === void 0 || workflow.script_name === scriptName;
|
|
291547
|
+
}
|
|
291286
291548
|
var init_deploy5 = __esm({
|
|
291287
291549
|
"src/triggers/deploy.ts"() {
|
|
291288
291550
|
init_import_meta_url();
|
|
@@ -291302,6 +291564,7 @@ var init_deploy5 = __esm({
|
|
|
291302
291564
|
__name(getSubdomainValuesAPIMock, "getSubdomainValuesAPIMock");
|
|
291303
291565
|
__name(validateSubdomainMixedState, "validateSubdomainMixedState");
|
|
291304
291566
|
__name(subdomainDeploy, "subdomainDeploy");
|
|
291567
|
+
__name(isWorkflowDefinedInThisScript, "isWorkflowDefinedInThisScript");
|
|
291305
291568
|
}
|
|
291306
291569
|
});
|
|
291307
291570
|
|
|
@@ -296755,12 +297018,12 @@ var init_info5 = __esm({
|
|
|
296755
297018
|
});
|
|
296756
297019
|
}
|
|
296757
297020
|
});
|
|
296758
|
-
var
|
|
297021
|
+
var import_undici20, vectorizeInsertCommand;
|
|
296759
297022
|
var init_insert = __esm({
|
|
296760
297023
|
"src/vectorize/insert.ts"() {
|
|
296761
297024
|
init_import_meta_url();
|
|
296762
297025
|
init_dist();
|
|
296763
|
-
|
|
297026
|
+
import_undici20 = __toESM(require_undici());
|
|
296764
297027
|
init_create_command();
|
|
296765
297028
|
init_logger();
|
|
296766
297029
|
init_client14();
|
|
@@ -296823,7 +297086,7 @@ var init_insert = __esm({
|
|
|
296823
297086
|
}
|
|
296824
297087
|
let vectorInsertCount = 0;
|
|
296825
297088
|
for await (const batch of getBatchFromFile(rl, args.batchSize)) {
|
|
296826
|
-
const formData = new
|
|
297089
|
+
const formData = new import_undici20.FormData();
|
|
296827
297090
|
formData.append(
|
|
296828
297091
|
"vectors",
|
|
296829
297092
|
new File([batch.join(`
|
|
@@ -297284,12 +297547,12 @@ var init_query = __esm({
|
|
|
297284
297547
|
__name(validateQueryFilter, "validateQueryFilter");
|
|
297285
297548
|
}
|
|
297286
297549
|
});
|
|
297287
|
-
var
|
|
297550
|
+
var import_undici21, vectorizeUpsertCommand;
|
|
297288
297551
|
var init_upsert = __esm({
|
|
297289
297552
|
"src/vectorize/upsert.ts"() {
|
|
297290
297553
|
init_import_meta_url();
|
|
297291
297554
|
init_dist();
|
|
297292
|
-
|
|
297555
|
+
import_undici21 = __toESM(require_undici());
|
|
297293
297556
|
init_create_command();
|
|
297294
297557
|
init_logger();
|
|
297295
297558
|
init_client14();
|
|
@@ -297342,7 +297605,7 @@ var init_upsert = __esm({
|
|
|
297342
297605
|
}
|
|
297343
297606
|
let vectorUpsertCount = 0;
|
|
297344
297607
|
for await (const batch of getBatchFromFile(rl, args.batchSize)) {
|
|
297345
|
-
const formData = new
|
|
297608
|
+
const formData = new import_undici21.FormData();
|
|
297346
297609
|
formData.append(
|
|
297347
297610
|
"vectors",
|
|
297348
297611
|
new File([batch.join(`
|
|
@@ -299769,7 +300032,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
299769
300032
|
}
|
|
299770
300033
|
if (props.outFile) {
|
|
299771
300034
|
fs27.mkdirSync(path3__namespace.default.dirname(props.outFile), { recursive: true });
|
|
299772
|
-
const serializedFormData = await new
|
|
300035
|
+
const serializedFormData = await new import_undici22.Response(workerBundle).arrayBuffer();
|
|
299773
300036
|
fs27.writeFileSync(props.outFile, Buffer.from(serializedFormData));
|
|
299774
300037
|
}
|
|
299775
300038
|
} finally {
|
|
@@ -299794,11 +300057,9 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
299794
300057
|
if (versionId && hasPreview) {
|
|
299795
300058
|
const { previews_enabled: previews_available_on_subdomain } = await fetchResult(config, `${workerUrl}/subdomain`);
|
|
299796
300059
|
if (previews_available_on_subdomain) {
|
|
299797
|
-
const userSubdomain = await getWorkersDevSubdomain(
|
|
299798
|
-
config
|
|
299799
|
-
|
|
299800
|
-
config.configPath
|
|
299801
|
-
);
|
|
300060
|
+
const userSubdomain = await getWorkersDevSubdomain(config, accountId, {
|
|
300061
|
+
configPath: config.configPath
|
|
300062
|
+
});
|
|
299802
300063
|
const shortVersion = versionId.slice(0, 8);
|
|
299803
300064
|
versionPreviewUrl = `https://${shortVersion}-${workerName}.${userSubdomain}`;
|
|
299804
300065
|
logger.log(`Version Preview URL: ${versionPreviewUrl}`);
|
|
@@ -299875,13 +300136,13 @@ function generatePreviewAlias(scriptName) {
|
|
|
299875
300136
|
);
|
|
299876
300137
|
return truncatedAlias || warnAndExit();
|
|
299877
300138
|
}
|
|
299878
|
-
var
|
|
300139
|
+
var import_undici22, versionsUploadCommand, MAX_DNS_LABEL_LENGTH, HASH_LENGTH, ALIAS_VALIDATION_REGEX;
|
|
299879
300140
|
var init_upload5 = __esm({
|
|
299880
300141
|
"src/versions/upload.ts"() {
|
|
299881
300142
|
init_import_meta_url();
|
|
299882
300143
|
init_colors();
|
|
299883
300144
|
init_dist();
|
|
299884
|
-
|
|
300145
|
+
import_undici22 = __toESM(require_undici());
|
|
299885
300146
|
init_assets5();
|
|
299886
300147
|
init_cfetch();
|
|
299887
300148
|
init_create_command();
|
|
@@ -300841,7 +301102,7 @@ async function fetchLocalResult(port, path82, init4) {
|
|
|
300841
301102
|
const url4 = `http://localhost:${port}${LOCAL_EXPLORER_BASE_PATH}${path82}`;
|
|
300842
301103
|
let response;
|
|
300843
301104
|
try {
|
|
300844
|
-
response = await (0,
|
|
301105
|
+
response = await (0, import_undici23.fetch)(url4, {
|
|
300845
301106
|
method: init4?.method ?? "GET",
|
|
300846
301107
|
headers: init4?.headers,
|
|
300847
301108
|
body: init4?.body
|
|
@@ -300898,12 +301159,12 @@ async function updateLocalInstanceStatus(port, workflowName, instanceId, action)
|
|
|
300898
301159
|
}
|
|
300899
301160
|
);
|
|
300900
301161
|
}
|
|
300901
|
-
var
|
|
301162
|
+
var import_undici23, LOCAL_EXPLORER_BASE_PATH, DEFAULT_LOCAL_PORT2, localWorkflowArgs;
|
|
300902
301163
|
var init_local = __esm({
|
|
300903
301164
|
"src/workflows/local.ts"() {
|
|
300904
301165
|
init_import_meta_url();
|
|
300905
301166
|
init_dist();
|
|
300906
|
-
|
|
301167
|
+
import_undici23 = __toESM(require_undici());
|
|
300907
301168
|
init_logger();
|
|
300908
301169
|
LOCAL_EXPLORER_BASE_PATH = "/cdn-cgi/explorer/api";
|
|
300909
301170
|
DEFAULT_LOCAL_PORT2 = 8787;
|
|
@@ -306040,6 +306301,8 @@ function createCLIParser(argv) {
|
|
|
306040
306301
|
registry.define([
|
|
306041
306302
|
{ command: "wrangler ai", definition: aiNamespace },
|
|
306042
306303
|
{ command: "wrangler ai models", definition: aiModelsCommand },
|
|
306304
|
+
{ command: "wrangler ai models list", definition: aiModelsListCommand },
|
|
306305
|
+
{ command: "wrangler ai models schema", definition: aiModelsSchemaCommand },
|
|
306043
306306
|
{ command: "wrangler ai finetune", definition: aiFineTuneNamespace },
|
|
306044
306307
|
{ command: "wrangler ai finetune list", definition: aiFineTuneListCommand },
|
|
306045
306308
|
{
|
|
@@ -306558,14 +306821,14 @@ function dispatchGenericCommandErrorEvent(dispatcher, startTime, error2) {
|
|
|
306558
306821
|
...sanitizeError(error2)
|
|
306559
306822
|
});
|
|
306560
306823
|
}
|
|
306561
|
-
var
|
|
306824
|
+
var import_undici24;
|
|
306562
306825
|
var init_src2 = __esm({
|
|
306563
306826
|
"src/index.ts"() {
|
|
306564
306827
|
init_import_meta_url();
|
|
306565
306828
|
init_dist7();
|
|
306566
306829
|
init_dist();
|
|
306567
306830
|
init_source();
|
|
306568
|
-
|
|
306831
|
+
import_undici24 = __toESM(require_undici());
|
|
306569
306832
|
init_yargs();
|
|
306570
306833
|
init_package();
|
|
306571
306834
|
init_ai3();
|
|
@@ -306586,6 +306849,7 @@ var init_src2 = __esm({
|
|
|
306586
306849
|
init_createFinetune();
|
|
306587
306850
|
init_listCatalog();
|
|
306588
306851
|
init_listFinetune();
|
|
306852
|
+
init_modelSchema();
|
|
306589
306853
|
init_artifacts();
|
|
306590
306854
|
init_browser_rendering2();
|
|
306591
306855
|
init_build4();
|
|
@@ -306795,8 +307059,8 @@ var init_src2 = __esm({
|
|
|
306795
307059
|
init_trigger();
|
|
306796
307060
|
init_wrangler_banner();
|
|
306797
307061
|
if (proxy) {
|
|
306798
|
-
(0,
|
|
306799
|
-
new
|
|
307062
|
+
(0, import_undici24.setGlobalDispatcher)(
|
|
307063
|
+
new import_undici24.EnvHttpProxyAgent({ noProxy: noProxy || "localhost,127.0.0.1,::1" })
|
|
306800
307064
|
);
|
|
306801
307065
|
logger.warn(
|
|
306802
307066
|
`Proxy environment variables detected. We'll use your proxy for fetch requests.`
|
|
@@ -308141,6 +308405,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
308141
308405
|
{ telemetryMessage: "[data_blobs] with an ES module worker" }
|
|
308142
308406
|
);
|
|
308143
308407
|
}
|
|
308408
|
+
const isDryRun = props.dryRun;
|
|
308144
308409
|
let sourceMapSize;
|
|
308145
308410
|
const normalisedContainerConfig = await getNormalizedContainerOptions(
|
|
308146
308411
|
config,
|
|
@@ -308230,21 +308495,21 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
308230
308495
|
const content = fs27.readFileSync(resolvedEntryPointPath, {
|
|
308231
308496
|
encoding: "utf-8"
|
|
308232
308497
|
});
|
|
308233
|
-
const migrations = !
|
|
308498
|
+
const migrations = !isDryRun ? await getMigrationsToUpload(scriptName, {
|
|
308234
308499
|
accountId,
|
|
308235
308500
|
config,
|
|
308236
308501
|
useServiceEnvironments: props.useServiceEnvironments,
|
|
308237
308502
|
env: props.env,
|
|
308238
308503
|
dispatchNamespace: props.dispatchNamespace
|
|
308239
308504
|
}) : void 0;
|
|
308240
|
-
const assetsJwt = props.assetsOptions && !
|
|
308505
|
+
const assetsJwt = props.assetsOptions && !isDryRun ? await syncAssets(
|
|
308241
308506
|
config,
|
|
308242
308507
|
accountId,
|
|
308243
308508
|
props.assetsOptions.directory,
|
|
308244
308509
|
scriptName,
|
|
308245
308510
|
props.dispatchNamespace
|
|
308246
308511
|
) : void 0;
|
|
308247
|
-
if (props.assetsOptions &&
|
|
308512
|
+
if (props.assetsOptions && isDryRun) {
|
|
308248
308513
|
await buildAssetManifest(props.assetsOptions.directory);
|
|
308249
308514
|
}
|
|
308250
308515
|
const workersSitesAssets = await syncWorkersSite(
|
|
@@ -308257,7 +308522,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
308257
308522
|
scriptName + (useServiceEnvironments2 ? `-${props.env}` : ""),
|
|
308258
308523
|
props.legacyAssetPaths,
|
|
308259
308524
|
false,
|
|
308260
|
-
|
|
308525
|
+
isDryRun,
|
|
308261
308526
|
props.oldAssetTtl
|
|
308262
308527
|
);
|
|
308263
308528
|
const bindings = getBindings(config);
|
|
@@ -308343,22 +308608,27 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
308343
308608
|
const canUseNewVersionsDeploymentsApi = workerExists && props.dispatchNamespace === void 0 && !useServiceEnvironments2 && format9 === "modules" && migrations === void 0 && !config.first_party_worker && config.containers === void 0;
|
|
308344
308609
|
let workerBundle;
|
|
308345
308610
|
const dockerPath = getDockerPath();
|
|
308346
|
-
if (normalisedContainerConfig.length) {
|
|
308347
|
-
const
|
|
308611
|
+
if (normalisedContainerConfig.length && props.containersRollout !== "none") {
|
|
308612
|
+
const containersWithDockerfile = normalisedContainerConfig.filter(
|
|
308348
308613
|
(container) => "dockerfile" in container
|
|
308349
308614
|
);
|
|
308350
|
-
if (
|
|
308351
|
-
await verifyDockerInstalled(
|
|
308615
|
+
if (containersWithDockerfile.length > 0) {
|
|
308616
|
+
await verifyDockerInstalled({
|
|
308617
|
+
dockerPath,
|
|
308618
|
+
isDev: false,
|
|
308619
|
+
isDryRun,
|
|
308620
|
+
numberOfContainers: containersWithDockerfile.length
|
|
308621
|
+
});
|
|
308352
308622
|
}
|
|
308353
308623
|
}
|
|
308354
|
-
if (
|
|
308624
|
+
if (isDryRun) {
|
|
308355
308625
|
if (normalisedContainerConfig.length) {
|
|
308356
308626
|
for (const container of normalisedContainerConfig) {
|
|
308357
|
-
if ("dockerfile" in container) {
|
|
308627
|
+
if ("dockerfile" in container && props.containersRollout !== "none") {
|
|
308358
308628
|
await buildContainer(
|
|
308359
308629
|
container,
|
|
308360
308630
|
workerTag ?? "worker-tag",
|
|
308361
|
-
|
|
308631
|
+
isDryRun,
|
|
308362
308632
|
dockerPath
|
|
308363
308633
|
);
|
|
308364
308634
|
}
|
|
@@ -308582,7 +308852,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
308582
308852
|
}
|
|
308583
308853
|
if (props.outFile) {
|
|
308584
308854
|
fs27.mkdirSync(path3__namespace.default.dirname(props.outFile), { recursive: true });
|
|
308585
|
-
const serializedFormData = await new
|
|
308855
|
+
const serializedFormData = await new import_undici25.Response(workerBundle).arrayBuffer();
|
|
308586
308856
|
fs27.writeFileSync(props.outFile, Buffer.from(serializedFormData));
|
|
308587
308857
|
}
|
|
308588
308858
|
} finally {
|
|
@@ -308590,13 +308860,13 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
308590
308860
|
destination.remove();
|
|
308591
308861
|
}
|
|
308592
308862
|
}
|
|
308593
|
-
if (
|
|
308863
|
+
if (isDryRun) {
|
|
308594
308864
|
logger.log(`--dry-run: exiting now.`);
|
|
308595
308865
|
return { versionId, workerTag };
|
|
308596
308866
|
}
|
|
308597
308867
|
const uploadMs = Date.now() - start;
|
|
308598
308868
|
logger.log("Uploaded", workerName, formatTime2(uploadMs));
|
|
308599
|
-
if (normalisedContainerConfig.length) {
|
|
308869
|
+
if (normalisedContainerConfig.length && props.containersRollout !== "none") {
|
|
308600
308870
|
assert54__default.default(versionId && accountId);
|
|
308601
308871
|
await deployContainers(config, normalisedContainerConfig, {
|
|
308602
308872
|
versionId,
|
|
@@ -308816,7 +309086,7 @@ function getDeployConfirmFunction(strictMode = false) {
|
|
|
308816
309086
|
}
|
|
308817
309087
|
return confirm;
|
|
308818
309088
|
}
|
|
308819
|
-
var
|
|
309089
|
+
var import_undici25, validateRoutes3;
|
|
308820
309090
|
var init_deploy7 = __esm({
|
|
308821
309091
|
"src/deploy/deploy.ts"() {
|
|
308822
309092
|
init_import_meta_url();
|
|
@@ -308824,7 +309094,7 @@ var init_deploy7 = __esm({
|
|
|
308824
309094
|
init_containers_shared();
|
|
308825
309095
|
init_dist();
|
|
308826
309096
|
init_dist9();
|
|
308827
|
-
|
|
309097
|
+
import_undici25 = __toESM(require_undici());
|
|
308828
309098
|
init_assets5();
|
|
308829
309099
|
init_cfetch();
|
|
308830
309100
|
init_build3();
|
|
@@ -309087,7 +309357,7 @@ function errorOnLegacyPagesWorkerJSAsset(file3, hasAssetsIgnoreFile) {
|
|
|
309087
309357
|
}
|
|
309088
309358
|
}
|
|
309089
309359
|
}
|
|
309090
|
-
var
|
|
309360
|
+
var import_undici26, BULK_UPLOAD_CONCURRENCY2, MAX_UPLOAD_ATTEMPTS2, MAX_UPLOAD_GATEWAY_ERRORS2, MAX_DIFF_LINES2, syncAssets, buildAssetManifest, NonExistentAssetsDirError, NonDirectoryAssetsDirError, WORKER_JS_FILENAME;
|
|
309091
309361
|
var init_assets5 = __esm({
|
|
309092
309362
|
"src/assets.ts"() {
|
|
309093
309363
|
init_import_meta_url();
|
|
@@ -309098,7 +309368,7 @@ var init_assets5 = __esm({
|
|
|
309098
309368
|
init_source();
|
|
309099
309369
|
init_dist9();
|
|
309100
309370
|
init_pretty_bytes();
|
|
309101
|
-
|
|
309371
|
+
import_undici26 = __toESM(require_undici());
|
|
309102
309372
|
init_cfetch();
|
|
309103
309373
|
init_deploy7();
|
|
309104
309374
|
init_logger();
|
|
@@ -309173,7 +309443,7 @@ var init_assets5 = __esm({
|
|
|
309173
309443
|
attempts = 0;
|
|
309174
309444
|
let gatewayErrors = 0;
|
|
309175
309445
|
const doUpload = /* @__PURE__ */ __name(async () => {
|
|
309176
|
-
const payload = new
|
|
309446
|
+
const payload = new import_undici26.FormData();
|
|
309177
309447
|
const uploadedFiles = [];
|
|
309178
309448
|
for (const manifestEntry of bucket) {
|
|
309179
309449
|
const absFilePath = path3__namespace.join(assetDirectory, manifestEntry[0]);
|
|
@@ -309215,8 +309485,13 @@ var init_assets5 = __esm({
|
|
|
309215
309485
|
return res;
|
|
309216
309486
|
} catch (e9) {
|
|
309217
309487
|
if (attempts < MAX_UPLOAD_ATTEMPTS2) {
|
|
309218
|
-
logger.info(
|
|
309219
|
-
|
|
309488
|
+
logger.info(
|
|
309489
|
+
source_default.dim(
|
|
309490
|
+
`Asset upload failed. Retrying... ${attempts + 1} of ${MAX_UPLOAD_ATTEMPTS2} attempts.
|
|
309491
|
+
`
|
|
309492
|
+
)
|
|
309493
|
+
);
|
|
309494
|
+
logger.debug(e9);
|
|
309220
309495
|
await new Promise(
|
|
309221
309496
|
(resolvePromise) => setTimeout(resolvePromise, Math.pow(2, attempts) * 1e3)
|
|
309222
309497
|
);
|
|
@@ -311796,7 +312071,7 @@ async function tryExpandToken(exchangeUrl, ctx, abortSignal) {
|
|
|
311796
312071
|
` GET ${switchedExchangeUrl.href}`
|
|
311797
312072
|
);
|
|
311798
312073
|
logger.debug("-- END EXCHANGE API REQUEST");
|
|
311799
|
-
const exchangeResponse = await (0,
|
|
312074
|
+
const exchangeResponse = await (0, import_undici27.fetch)(switchedExchangeUrl, {
|
|
311800
312075
|
signal: abortSignal,
|
|
311801
312076
|
headers
|
|
311802
312077
|
});
|
|
@@ -311842,9 +312117,10 @@ async function createPreviewSession(complianceConfig, account, ctx, abortSignal,
|
|
|
311842
312117
|
const subdomain = await getWorkersDevSubdomain(
|
|
311843
312118
|
complianceConfig,
|
|
311844
312119
|
account.accountId,
|
|
311845
|
-
|
|
311846
|
-
|
|
311847
|
-
|
|
312120
|
+
{
|
|
312121
|
+
apiToken,
|
|
312122
|
+
abortSignal: withTimeout(abortSignal)
|
|
312123
|
+
}
|
|
311848
312124
|
);
|
|
311849
312125
|
host = `${name2 ?? crypto2__default.default.randomUUID()}.${subdomain}`;
|
|
311850
312126
|
}
|
|
@@ -311919,12 +312195,12 @@ async function createWorkerPreview(complianceConfig, init4, account, ctx, sessio
|
|
|
311919
312195
|
);
|
|
311920
312196
|
return token;
|
|
311921
312197
|
}
|
|
311922
|
-
var
|
|
312198
|
+
var import_undici27, PREVIEW_API_TIMEOUT_MS;
|
|
311923
312199
|
var init_create_worker_preview = __esm({
|
|
311924
312200
|
"src/dev/create-worker-preview.ts"() {
|
|
311925
312201
|
init_import_meta_url();
|
|
311926
312202
|
init_dist();
|
|
311927
|
-
|
|
312203
|
+
import_undici27 = __toESM(require_undici());
|
|
311928
312204
|
init_cfetch();
|
|
311929
312205
|
init_create_worker_upload_form();
|
|
311930
312206
|
init_logger();
|
|
@@ -312759,6 +313035,32 @@ var init_ProxyServerWorker = __esm({
|
|
|
312759
313035
|
ProxyServerWorker_default = scriptPath3;
|
|
312760
313036
|
}
|
|
312761
313037
|
});
|
|
313038
|
+
function isErrorEvent3(error2) {
|
|
313039
|
+
return typeof error2 === "object" && error2 !== null && "type" in error2 && error2.type === "error" && "reason" in error2 && "cause" in error2;
|
|
313040
|
+
}
|
|
313041
|
+
function getErrorMessage3(error2) {
|
|
313042
|
+
if (error2 instanceof Error) {
|
|
313043
|
+
return getErrorMessage3(error2.cause) ?? error2.message;
|
|
313044
|
+
}
|
|
313045
|
+
if (typeof error2 === "string") {
|
|
313046
|
+
return error2;
|
|
313047
|
+
}
|
|
313048
|
+
if (typeof error2 === "object" && error2 !== null) {
|
|
313049
|
+
const maybeMessage = error2.message;
|
|
313050
|
+
if (typeof maybeMessage === "string") {
|
|
313051
|
+
const maybeCause = error2.cause;
|
|
313052
|
+
return getErrorMessage3(maybeCause) ?? maybeMessage;
|
|
313053
|
+
}
|
|
313054
|
+
}
|
|
313055
|
+
return void 0;
|
|
313056
|
+
}
|
|
313057
|
+
function formatRemoteProxySessionError(error2) {
|
|
313058
|
+
if (isErrorEvent3(error2)) {
|
|
313059
|
+
const causeMessage = getErrorMessage3(error2.cause);
|
|
313060
|
+
return causeMessage ? `${error2.reason}: ${causeMessage}` : error2.reason;
|
|
313061
|
+
}
|
|
313062
|
+
return getErrorMessage3(error2);
|
|
313063
|
+
}
|
|
312762
313064
|
async function startRemoteProxySession(bindings, options) {
|
|
312763
313065
|
logger.log(source_default.dim("\u2394 Establishing remote connection..."));
|
|
312764
313066
|
const rawBindings = Object.fromEntries(
|
|
@@ -312811,8 +313113,9 @@ ${errorMessage}`
|
|
|
312811
313113
|
worker.raw.proxy.localServerReady.promise
|
|
312812
313114
|
]);
|
|
312813
313115
|
if (maybeError && maybeError.error) {
|
|
313116
|
+
const details = formatRemoteProxySessionError(maybeError.error);
|
|
312814
313117
|
throw new Error(
|
|
312815
|
-
"Failed to start the remote proxy session. There is likely additional logging output above.",
|
|
313118
|
+
details ? `Failed to start the remote proxy session. ${details}` : "Failed to start the remote proxy session. There is likely additional logging output above.",
|
|
312816
313119
|
{
|
|
312817
313120
|
cause: maybeError.error
|
|
312818
313121
|
}
|
|
@@ -312863,6 +313166,9 @@ var init_start_remote_proxy_session = __esm({
|
|
|
312863
313166
|
init_logger();
|
|
312864
313167
|
init_paths();
|
|
312865
313168
|
init_startDevWorker();
|
|
313169
|
+
__name(isErrorEvent3, "isErrorEvent");
|
|
313170
|
+
__name(getErrorMessage3, "getErrorMessage");
|
|
313171
|
+
__name(formatRemoteProxySessionError, "formatRemoteProxySessionError");
|
|
312866
313172
|
__name(startRemoteProxySession, "startRemoteProxySession");
|
|
312867
313173
|
__name(getStartWorkerLogLevel, "getStartWorkerLogLevel");
|
|
312868
313174
|
}
|
|
@@ -313035,6 +313341,15 @@ function getUserWorkerInnerUrlOverrides(config) {
|
|
|
313035
313341
|
};
|
|
313036
313342
|
}
|
|
313037
313343
|
}
|
|
313344
|
+
function getZoneForCfWorkerHeader(config) {
|
|
313345
|
+
const firstRouteTrigger = config.triggers?.find(
|
|
313346
|
+
(t12) => t12.type === "route"
|
|
313347
|
+
);
|
|
313348
|
+
if (firstRouteTrigger && "zone_name" in firstRouteTrigger && firstRouteTrigger.zone_name) {
|
|
313349
|
+
return firstRouteTrigger.zone_name;
|
|
313350
|
+
}
|
|
313351
|
+
return config.dev?.origin?.hostname;
|
|
313352
|
+
}
|
|
313038
313353
|
async function convertToConfigBundle(event) {
|
|
313039
313354
|
const bindings = { ...event.config.bindings };
|
|
313040
313355
|
const crons = [];
|
|
@@ -313126,8 +313441,7 @@ async function convertToConfigBundle(event) {
|
|
|
313126
313441
|
containerBuildId: event.config.dev?.containerBuildId,
|
|
313127
313442
|
containerEngine: event.config.dev.containerEngine,
|
|
313128
313443
|
enableContainers: event.config.dev.enableContainers ?? true,
|
|
313129
|
-
|
|
313130
|
-
zone: event.config.dev?.origin?.hostname,
|
|
313444
|
+
zone: getZoneForCfWorkerHeader(event.config),
|
|
313131
313445
|
sendMetrics: event.config.sendMetrics,
|
|
313132
313446
|
publicUrl: event.config.dev?.server?.port ? miniflare.buildPublicUrl({
|
|
313133
313447
|
hostname: event.config.dev.server.hostname,
|
|
@@ -313178,6 +313492,7 @@ var init_LocalRuntimeController = __esm({
|
|
|
313178
313492
|
__name(getTextFileContents, "getTextFileContents");
|
|
313179
313493
|
__name(getName3, "getName");
|
|
313180
313494
|
__name(getUserWorkerInnerUrlOverrides, "getUserWorkerInnerUrlOverrides");
|
|
313495
|
+
__name(getZoneForCfWorkerHeader, "getZoneForCfWorkerHeader");
|
|
313181
313496
|
__name(convertToConfigBundle, "convertToConfigBundle");
|
|
313182
313497
|
LocalRuntimeController = class extends RuntimeController {
|
|
313183
313498
|
static {
|
|
@@ -315739,7 +316054,18 @@ async function generateHandler({
|
|
|
315739
316054
|
(async () => {
|
|
315740
316055
|
try {
|
|
315741
316056
|
const links = [];
|
|
315742
|
-
|
|
316057
|
+
let baseHref;
|
|
316058
|
+
const transformedResponse = new HTMLRewriter().on("base[href]", {
|
|
316059
|
+
element(element) {
|
|
316060
|
+
if (baseHref !== void 0) {
|
|
316061
|
+
return;
|
|
316062
|
+
}
|
|
316063
|
+
const href = element.getAttribute("href");
|
|
316064
|
+
if (href !== null) {
|
|
316065
|
+
baseHref = href;
|
|
316066
|
+
}
|
|
316067
|
+
}
|
|
316068
|
+
}).on(
|
|
315743
316069
|
"link[rel~=preconnect],link[rel~=preload],link[rel~=modulepreload]",
|
|
315744
316070
|
{
|
|
315745
316071
|
element(element) {
|
|
@@ -315761,7 +316087,17 @@ async function generateHandler({
|
|
|
315761
316087
|
).transform(clonedResponse);
|
|
315762
316088
|
await transformedResponse.text();
|
|
315763
316089
|
links.forEach(({ href, rel, as: as2 }) => {
|
|
315764
|
-
let
|
|
316090
|
+
let resolvedHref = href;
|
|
316091
|
+
if (baseHref !== void 0) {
|
|
316092
|
+
try {
|
|
316093
|
+
resolvedHref = new URL(
|
|
316094
|
+
href,
|
|
316095
|
+
new URL(baseHref, request4.url)
|
|
316096
|
+
).href;
|
|
316097
|
+
} catch {
|
|
316098
|
+
}
|
|
316099
|
+
}
|
|
316100
|
+
let link = `<${resolvedHref}>; rel="${rel}"`;
|
|
315765
316101
|
if (as2) {
|
|
315766
316102
|
link += `; as=${as2}`;
|
|
315767
316103
|
}
|
|
@@ -316257,7 +316593,7 @@ async function generateAssetsFetch(directory, log2, signal) {
|
|
|
316257
316593
|
return await generateResponse(request4);
|
|
316258
316594
|
};
|
|
316259
316595
|
}
|
|
316260
|
-
var import_mime3,
|
|
316596
|
+
var import_mime3, import_undici28, ProxyDispatcher, invalidAssetsFetch;
|
|
316261
316597
|
var init_assets6 = __esm({
|
|
316262
316598
|
"src/miniflare-cli/assets.ts"() {
|
|
316263
316599
|
init_import_meta_url();
|
|
@@ -316265,11 +316601,11 @@ var init_assets6 = __esm({
|
|
|
316265
316601
|
init_workers_shared();
|
|
316266
316602
|
init_esm6();
|
|
316267
316603
|
import_mime3 = __toESM(require_mime());
|
|
316268
|
-
|
|
316604
|
+
import_undici28 = __toESM(require_undici());
|
|
316269
316605
|
init_logger();
|
|
316270
316606
|
init_hash();
|
|
316271
316607
|
__name(generateASSETSBinding, "generateASSETSBinding");
|
|
316272
|
-
ProxyDispatcher = class _ProxyDispatcher extends
|
|
316608
|
+
ProxyDispatcher = class _ProxyDispatcher extends import_undici28.Dispatcher {
|
|
316273
316609
|
constructor(host) {
|
|
316274
316610
|
super();
|
|
316275
316611
|
this.host = host;
|
|
@@ -316277,7 +316613,7 @@ var init_assets6 = __esm({
|
|
|
316277
316613
|
static {
|
|
316278
316614
|
__name(this, "ProxyDispatcher");
|
|
316279
316615
|
}
|
|
316280
|
-
dispatcher = (0,
|
|
316616
|
+
dispatcher = (0, import_undici28.getGlobalDispatcher)();
|
|
316281
316617
|
dispatch(options, handler) {
|
|
316282
316618
|
if (this.host !== null) {
|
|
316283
316619
|
_ProxyDispatcher.reinstateHostHeader(options.headers, this.host);
|
|
@@ -316739,7 +317075,7 @@ unstable_dev()'s behaviour will likely change in future releases`
|
|
|
316739
317075
|
devServer.unregisterHotKeys?.();
|
|
316740
317076
|
}, "stop"),
|
|
316741
317077
|
fetch: /* @__PURE__ */ __name(async (input, init4) => {
|
|
316742
|
-
return await (0,
|
|
317078
|
+
return await (0, import_undici29.fetch)(
|
|
316743
317079
|
...parseRequestInput(address, port, input, init4, options?.localProtocol)
|
|
316744
317080
|
);
|
|
316745
317081
|
}, "fetch"),
|
|
@@ -316752,7 +317088,7 @@ function parseRequestInput(readyAddress, readyPort, input = "/", init4, protocol
|
|
|
316752
317088
|
if (typeof input === "string") {
|
|
316753
317089
|
input = new URL(input, "http://placeholder");
|
|
316754
317090
|
}
|
|
316755
|
-
const forward = new
|
|
317091
|
+
const forward = new import_undici29.Request(input, init4);
|
|
316756
317092
|
const url4 = new URL(forward.url);
|
|
316757
317093
|
forward.headers.set("MF-Original-URL", url4.toString());
|
|
316758
317094
|
forward.headers.set("MF-Disable-Pretty-Error", "true");
|
|
@@ -316764,12 +317100,12 @@ function parseRequestInput(readyAddress, readyPort, input = "/", init4, protocol
|
|
|
316764
317100
|
}
|
|
316765
317101
|
return [url4, forward];
|
|
316766
317102
|
}
|
|
316767
|
-
var
|
|
317103
|
+
var import_undici29;
|
|
316768
317104
|
var init_dev4 = __esm({
|
|
316769
317105
|
"src/api/dev.ts"() {
|
|
316770
317106
|
init_import_meta_url();
|
|
316771
317107
|
init_dist();
|
|
316772
|
-
|
|
317108
|
+
import_undici29 = __toESM(require_undici());
|
|
316773
317109
|
init_start_dev();
|
|
316774
317110
|
init_experimental_flags();
|
|
316775
317111
|
init_logger();
|
|
@@ -316885,6 +317221,13 @@ var init_executionContext = __esm({
|
|
|
316885
317221
|
function unstable_getDevCompatibilityDate() {
|
|
316886
317222
|
return getTodaysCompatDate();
|
|
316887
317223
|
}
|
|
317224
|
+
function getZoneFromConfig(config) {
|
|
317225
|
+
const firstRoute = config.route ?? config.routes?.[0];
|
|
317226
|
+
if (firstRoute) {
|
|
317227
|
+
return getZoneFromRoute(firstRoute);
|
|
317228
|
+
}
|
|
317229
|
+
return void 0;
|
|
317230
|
+
}
|
|
316888
317231
|
async function getPlatformProxy(options = {}) {
|
|
316889
317232
|
const env6 = options.environment;
|
|
316890
317233
|
const config = readConfig({
|
|
@@ -316988,6 +317331,7 @@ async function getMiniflareOptionsFromConfig(args) {
|
|
|
316988
317331
|
script: "",
|
|
316989
317332
|
modules: true,
|
|
316990
317333
|
name: config.name,
|
|
317334
|
+
zone: getZoneFromConfig(config),
|
|
316991
317335
|
...bindingOptions,
|
|
316992
317336
|
...assetOptions
|
|
316993
317337
|
},
|
|
@@ -317071,6 +317415,7 @@ function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6, options) {
|
|
|
317071
317415
|
compatibilityFlags: config.compatibility_flags,
|
|
317072
317416
|
modulesRules,
|
|
317073
317417
|
containerEngine: useContainers ? config.dev.container_engine ?? resolveDockerHost(getDockerPath()) : void 0,
|
|
317418
|
+
zone: getZoneFromConfig(config),
|
|
317074
317419
|
...bindingOptions,
|
|
317075
317420
|
...sitesOptions,
|
|
317076
317421
|
...assetOptions
|
|
@@ -317097,6 +317442,7 @@ var init_platform = __esm({
|
|
|
317097
317442
|
init_logger();
|
|
317098
317443
|
init_sites2();
|
|
317099
317444
|
init_dedent();
|
|
317445
|
+
init_zones3();
|
|
317100
317446
|
init_remoteBindings();
|
|
317101
317447
|
init_utils2();
|
|
317102
317448
|
init_caches();
|
|
@@ -317104,6 +317450,7 @@ var init_platform = __esm({
|
|
|
317104
317450
|
init_dev_vars();
|
|
317105
317451
|
init_details2();
|
|
317106
317452
|
__name(unstable_getDevCompatibilityDate, "unstable_getDevCompatibilityDate");
|
|
317453
|
+
__name(getZoneFromConfig, "getZoneFromConfig");
|
|
317107
317454
|
__name(getPlatformProxy, "getPlatformProxy");
|
|
317108
317455
|
__name(getMiniflareOptionsFromConfig, "getMiniflareOptionsFromConfig");
|
|
317109
317456
|
__name(getMiniflarePersistRoot, "getMiniflarePersistRoot");
|