wrangler 4.93.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
|
}
|
|
@@ -45336,8 +45336,9 @@ async function getImageRepoTags(dockerPath, imageTag) {
|
|
|
45336
45336
|
async function cleanupDuplicateImageTags(dockerPath, imageTag) {
|
|
45337
45337
|
try {
|
|
45338
45338
|
const repoTags = await getImageRepoTags(dockerPath, imageTag);
|
|
45339
|
+
const currentBuildId = getImageTag(imageTag);
|
|
45339
45340
|
const tagsToRemove = repoTags.filter(
|
|
45340
|
-
(tag) => tag
|
|
45341
|
+
(tag) => tag.startsWith("cloudflare-dev") && getImageTag(tag) !== currentBuildId
|
|
45341
45342
|
);
|
|
45342
45343
|
if (tagsToRemove.length > 0) {
|
|
45343
45344
|
runDockerCmdWithOutput(dockerPath, ["rmi", ...tagsToRemove]);
|
|
@@ -45345,6 +45346,10 @@ async function cleanupDuplicateImageTags(dockerPath, imageTag) {
|
|
|
45345
45346
|
} catch {
|
|
45346
45347
|
}
|
|
45347
45348
|
}
|
|
45349
|
+
function getImageTag(imageTag) {
|
|
45350
|
+
const tagSeparatorIndex = imageTag.lastIndexOf(":");
|
|
45351
|
+
return tagSeparatorIndex === -1 ? void 0 : imageTag.slice(tagSeparatorIndex + 1);
|
|
45352
|
+
}
|
|
45348
45353
|
var runDockerCmd, runDockerCmdWithOutput, isDockerRunning, verifyDockerInstalled, cleanupContainers, getContainerIdsFromImage;
|
|
45349
45354
|
var init_utils = __esm({
|
|
45350
45355
|
"../containers-shared/src/utils.ts"() {
|
|
@@ -45480,6 +45485,7 @@ var init_utils = __esm({
|
|
|
45480
45485
|
__name(resolveDockerHost, "resolveDockerHost");
|
|
45481
45486
|
__name(getImageRepoTags, "getImageRepoTags");
|
|
45482
45487
|
__name(cleanupDuplicateImageTags, "cleanupDuplicateImageTags");
|
|
45488
|
+
__name(getImageTag, "getImageTag");
|
|
45483
45489
|
}
|
|
45484
45490
|
});
|
|
45485
45491
|
|
|
@@ -55945,7 +55951,7 @@ var name, version;
|
|
|
55945
55951
|
var init_package = __esm({
|
|
55946
55952
|
"package.json"() {
|
|
55947
55953
|
name = "wrangler";
|
|
55948
|
-
version = "4.93.
|
|
55954
|
+
version = "4.93.1";
|
|
55949
55955
|
}
|
|
55950
55956
|
});
|
|
55951
55957
|
function getWranglerVersion() {
|
|
@@ -62164,21 +62170,21 @@ var init_Mime = __esm({
|
|
|
62164
62170
|
}
|
|
62165
62171
|
const allExtensions = __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type);
|
|
62166
62172
|
let first = true;
|
|
62167
|
-
for (let
|
|
62168
|
-
const starred =
|
|
62169
|
-
|
|
62170
|
-
allExtensions?.add(
|
|
62173
|
+
for (let extension2 of extensions) {
|
|
62174
|
+
const starred = extension2.startsWith("*");
|
|
62175
|
+
extension2 = starred ? extension2.slice(1) : extension2;
|
|
62176
|
+
allExtensions?.add(extension2);
|
|
62171
62177
|
if (first) {
|
|
62172
|
-
__classPrivateFieldGet(this, _Mime_typeToExtension, "f").set(type,
|
|
62178
|
+
__classPrivateFieldGet(this, _Mime_typeToExtension, "f").set(type, extension2);
|
|
62173
62179
|
}
|
|
62174
62180
|
first = false;
|
|
62175
62181
|
if (starred)
|
|
62176
62182
|
continue;
|
|
62177
|
-
const currentType = __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(
|
|
62183
|
+
const currentType = __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(extension2);
|
|
62178
62184
|
if (currentType && currentType != type && !force) {
|
|
62179
|
-
throw new Error(`"${type} -> ${
|
|
62185
|
+
throw new Error(`"${type} -> ${extension2}" conflicts with "${currentType} -> ${extension2}". Pass \`force=true\` to override this definition.`);
|
|
62180
62186
|
}
|
|
62181
|
-
__classPrivateFieldGet(this, _Mime_extensionToType, "f").set(
|
|
62187
|
+
__classPrivateFieldGet(this, _Mime_extensionToType, "f").set(extension2, type);
|
|
62182
62188
|
}
|
|
62183
62189
|
}
|
|
62184
62190
|
return this;
|
|
@@ -133268,8 +133274,11 @@ var init_cfetch = __esm({
|
|
|
133268
133274
|
});
|
|
133269
133275
|
|
|
133270
133276
|
// src/user/fetch-accounts.ts
|
|
133277
|
+
function getErrorCode(err) {
|
|
133278
|
+
return err?.code;
|
|
133279
|
+
}
|
|
133271
133280
|
function isMembershipsInaccessible(err) {
|
|
133272
|
-
const code = err
|
|
133281
|
+
const code = getErrorCode(err);
|
|
133273
133282
|
return code !== void 0 && MEMBERSHIPS_INACCESSIBLE_CODES.includes(code);
|
|
133274
133283
|
}
|
|
133275
133284
|
async function fetchAllAccounts(complianceConfig, options = {}) {
|
|
@@ -133289,6 +133298,16 @@ async function fetchAllAccounts(complianceConfig, options = {}) {
|
|
|
133289
133298
|
if (accountsRes.status === "fulfilled" && accountsRes.value.length > 0) {
|
|
133290
133299
|
return accountsRes.value;
|
|
133291
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
|
+
}
|
|
133292
133311
|
throw new UserError(
|
|
133293
133312
|
`Failed to automatically retrieve account IDs for the logged in user.
|
|
133294
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`,
|
|
@@ -133318,6 +133337,7 @@ var init_fetch_accounts = __esm({
|
|
|
133318
133337
|
init_dist();
|
|
133319
133338
|
init_cfetch();
|
|
133320
133339
|
MEMBERSHIPS_INACCESSIBLE_CODES = [9106, 1e4];
|
|
133340
|
+
__name(getErrorCode, "getErrorCode");
|
|
133321
133341
|
__name(isMembershipsInaccessible, "isMembershipsInaccessible");
|
|
133322
133342
|
__name(fetchAllAccounts, "fetchAllAccounts");
|
|
133323
133343
|
}
|
|
@@ -133365,51 +133385,50 @@ function getAuthFromEnv() {
|
|
|
133365
133385
|
function validateScopeKeys(scopes) {
|
|
133366
133386
|
return scopes.every((scope) => scope in DefaultScopes);
|
|
133367
133387
|
}
|
|
133368
|
-
function
|
|
133388
|
+
function readStoredAuthState(config) {
|
|
133389
|
+
let parsed;
|
|
133369
133390
|
try {
|
|
133370
|
-
|
|
133371
|
-
|
|
133372
|
-
}
|
|
133373
|
-
|
|
133374
|
-
|
|
133375
|
-
|
|
133376
|
-
|
|
133377
|
-
|
|
133378
|
-
|
|
133379
|
-
|
|
133380
|
-
|
|
133381
|
-
|
|
133382
|
-
|
|
133383
|
-
|
|
133384
|
-
}
|
|
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;
|
|
133385
133410
|
logger.warn(
|
|
133386
133411
|
`It looks like you have used Wrangler v1's \`config\` command to login with an API token
|
|
133387
133412
|
from ${config === void 0 ? getAuthConfigFilePath() : "in-memory config"}.
|
|
133388
133413
|
This is no longer supported in the current version of Wrangler.
|
|
133389
133414
|
If you wish to authenticate via an API token then please set the \`CLOUDFLARE_API_TOKEN\` environment variable.`
|
|
133390
133415
|
);
|
|
133391
|
-
return { apiToken: api_token };
|
|
133392
133416
|
}
|
|
133393
|
-
|
|
133394
|
-
return void 0;
|
|
133417
|
+
return { deprecatedApiToken: api_token };
|
|
133395
133418
|
}
|
|
133396
|
-
}
|
|
133397
|
-
function reinitialiseAuthTokens(config) {
|
|
133398
|
-
localState = {
|
|
133399
|
-
...getAuthTokens(config)
|
|
133400
|
-
};
|
|
133419
|
+
return {};
|
|
133401
133420
|
}
|
|
133402
133421
|
function getAPIToken() {
|
|
133403
|
-
|
|
133404
|
-
|
|
133422
|
+
const envAuth = getAuthFromEnv();
|
|
133423
|
+
if (envAuth) {
|
|
133424
|
+
return envAuth;
|
|
133405
133425
|
}
|
|
133406
|
-
const
|
|
133407
|
-
if (
|
|
133408
|
-
return
|
|
133426
|
+
const stored = readStoredAuthState();
|
|
133427
|
+
if (stored.deprecatedApiToken) {
|
|
133428
|
+
return { apiToken: stored.deprecatedApiToken };
|
|
133409
133429
|
}
|
|
133410
|
-
|
|
133411
|
-
|
|
133412
|
-
return { apiToken: storedAccessToken };
|
|
133430
|
+
if (stored.accessToken?.value) {
|
|
133431
|
+
return { apiToken: stored.accessToken.value };
|
|
133413
133432
|
}
|
|
133414
133433
|
return void 0;
|
|
133415
133434
|
}
|
|
@@ -133480,9 +133499,8 @@ function isReturningFromAuthServer(query) {
|
|
|
133480
133499
|
if (!code) {
|
|
133481
133500
|
return false;
|
|
133482
133501
|
}
|
|
133483
|
-
const state2 = localState;
|
|
133484
133502
|
const stateQueryParam = query.state;
|
|
133485
|
-
if (stateQueryParam !==
|
|
133503
|
+
if (stateQueryParam !== oauthFlowState.stateQueryParam) {
|
|
133486
133504
|
logger.warn(
|
|
133487
133505
|
"Received query string parameter doesn't match the one sent! Possible malicious activity somewhere."
|
|
133488
133506
|
);
|
|
@@ -133491,14 +133509,14 @@ function isReturningFromAuthServer(query) {
|
|
|
133491
133509
|
});
|
|
133492
133510
|
}
|
|
133493
133511
|
assert54__default.default(!Array.isArray(code));
|
|
133494
|
-
|
|
133495
|
-
|
|
133512
|
+
oauthFlowState.authorizationCode = code;
|
|
133513
|
+
oauthFlowState.hasAuthCodeBeenExchangedForAccessToken = false;
|
|
133496
133514
|
return true;
|
|
133497
133515
|
}
|
|
133498
133516
|
async function getAuthURL(scopes, clientId) {
|
|
133499
133517
|
const { codeChallenge, codeVerifier } = await generatePKCECodes();
|
|
133500
133518
|
const stateQueryParam = generateRandomState(RECOMMENDED_STATE_LENGTH);
|
|
133501
|
-
Object.assign(
|
|
133519
|
+
Object.assign(oauthFlowState, {
|
|
133502
133520
|
codeChallenge,
|
|
133503
133521
|
codeVerifier,
|
|
133504
133522
|
stateQueryParam
|
|
@@ -133512,12 +133530,13 @@ async function getAuthURL(scopes, clientId) {
|
|
|
133512
133530
|
});
|
|
133513
133531
|
}
|
|
133514
133532
|
async function exchangeRefreshTokenForAccessToken() {
|
|
133515
|
-
|
|
133533
|
+
const storedRefreshToken = readStoredAuthState().refreshToken;
|
|
133534
|
+
if (!storedRefreshToken) {
|
|
133516
133535
|
logger.warn("No refresh token is present.");
|
|
133517
133536
|
}
|
|
133518
133537
|
const params = new URLSearchParams({
|
|
133519
133538
|
grant_type: "refresh_token",
|
|
133520
|
-
refresh_token:
|
|
133539
|
+
refresh_token: storedRefreshToken?.value ?? "",
|
|
133521
133540
|
client_id: getClientIdFromEnv()
|
|
133522
133541
|
});
|
|
133523
133542
|
const response = await fetchAuthToken(params);
|
|
@@ -133543,25 +133562,15 @@ async function exchangeRefreshTokenForAccessToken() {
|
|
|
133543
133562
|
throw json.error;
|
|
133544
133563
|
}
|
|
133545
133564
|
const { access_token, expires_in, refresh_token, scope } = json;
|
|
133546
|
-
let scopes = [];
|
|
133547
133565
|
const accessToken = {
|
|
133548
133566
|
value: access_token,
|
|
133549
133567
|
expiry: new Date(Date.now() + expires_in * 1e3).toISOString()
|
|
133550
133568
|
};
|
|
133551
|
-
|
|
133552
|
-
if (refresh_token) {
|
|
133553
|
-
localState.refreshToken = {
|
|
133554
|
-
value: refresh_token
|
|
133555
|
-
};
|
|
133556
|
-
}
|
|
133557
|
-
if (scope) {
|
|
133558
|
-
scopes = scope.split(" ");
|
|
133559
|
-
localState.scopes = scopes;
|
|
133560
|
-
}
|
|
133569
|
+
const scopes = scope ? scope.split(" ") : [];
|
|
133561
133570
|
const accessContext = {
|
|
133562
133571
|
token: accessToken,
|
|
133563
133572
|
scopes,
|
|
133564
|
-
refreshToken:
|
|
133573
|
+
refreshToken: refresh_token ? { value: refresh_token } : storedRefreshToken
|
|
133565
133574
|
};
|
|
133566
133575
|
return accessContext;
|
|
133567
133576
|
} catch (error2) {
|
|
@@ -133574,7 +133583,7 @@ async function exchangeRefreshTokenForAccessToken() {
|
|
|
133574
133583
|
}
|
|
133575
133584
|
}
|
|
133576
133585
|
async function exchangeAuthCodeForAccessToken() {
|
|
133577
|
-
const { authorizationCode, codeVerifier = "" } =
|
|
133586
|
+
const { authorizationCode, codeVerifier = "" } = oauthFlowState;
|
|
133578
133587
|
if (!codeVerifier) {
|
|
133579
133588
|
logger.warn("No code verifier is being sent.");
|
|
133580
133589
|
} else if (!authorizationCode) {
|
|
@@ -133600,27 +133609,17 @@ async function exchangeAuthCodeForAccessToken() {
|
|
|
133600
133609
|
throw new Error(json.error);
|
|
133601
133610
|
}
|
|
133602
133611
|
const { access_token, expires_in, refresh_token, scope } = json;
|
|
133603
|
-
|
|
133604
|
-
localState.hasAuthCodeBeenExchangedForAccessToken = true;
|
|
133612
|
+
oauthFlowState.hasAuthCodeBeenExchangedForAccessToken = true;
|
|
133605
133613
|
const expiryDate = new Date(Date.now() + expires_in * 1e3);
|
|
133606
133614
|
const accessToken = {
|
|
133607
133615
|
value: access_token,
|
|
133608
133616
|
expiry: expiryDate.toISOString()
|
|
133609
133617
|
};
|
|
133610
|
-
|
|
133611
|
-
if (refresh_token) {
|
|
133612
|
-
localState.refreshToken = {
|
|
133613
|
-
value: refresh_token
|
|
133614
|
-
};
|
|
133615
|
-
}
|
|
133616
|
-
if (scope) {
|
|
133617
|
-
scopes = scope.split(" ");
|
|
133618
|
-
localState.scopes = scopes;
|
|
133619
|
-
}
|
|
133618
|
+
const scopes = scope ? scope.split(" ") : [];
|
|
133620
133619
|
const accessContext = {
|
|
133621
133620
|
token: accessToken,
|
|
133622
133621
|
scopes,
|
|
133623
|
-
refreshToken:
|
|
133622
|
+
refreshToken: refresh_token ? { value: refresh_token } : void 0
|
|
133624
133623
|
};
|
|
133625
133624
|
return accessContext;
|
|
133626
133625
|
}
|
|
@@ -133663,7 +133662,6 @@ function writeAuthConfigFile(config) {
|
|
|
133663
133662
|
fs27.writeFileSync(path3__namespace.default.join(configPath), dist_default4.stringify(config), {
|
|
133664
133663
|
encoding: "utf-8"
|
|
133665
133664
|
});
|
|
133666
|
-
reinitialiseAuthTokens();
|
|
133667
133665
|
}
|
|
133668
133666
|
function readAuthConfigFile() {
|
|
133669
133667
|
return parseTOML(readFileSync(getAuthConfigFilePath()));
|
|
@@ -133671,7 +133669,7 @@ function readAuthConfigFile() {
|
|
|
133671
133669
|
async function loginOrRefreshIfRequired(complianceConfig, props) {
|
|
133672
133670
|
if (!getAPIToken()) {
|
|
133673
133671
|
return !isNonInteractiveOrCI() && await login(complianceConfig, props);
|
|
133674
|
-
} else if (
|
|
133672
|
+
} else if (isRefreshNeeded()) {
|
|
133675
133673
|
const didRefresh = await refreshToken();
|
|
133676
133674
|
if (didRefresh) {
|
|
133677
133675
|
return true;
|
|
@@ -133683,16 +133681,18 @@ async function loginOrRefreshIfRequired(complianceConfig, props) {
|
|
|
133683
133681
|
}
|
|
133684
133682
|
}
|
|
133685
133683
|
async function getOAuthTokenFromLocalState() {
|
|
133686
|
-
|
|
133684
|
+
let stored = readStoredAuthState();
|
|
133685
|
+
if (!stored.accessToken) {
|
|
133687
133686
|
return void 0;
|
|
133688
133687
|
}
|
|
133689
|
-
if (
|
|
133688
|
+
if (isRefreshNeeded()) {
|
|
133690
133689
|
const didRefresh = await refreshToken();
|
|
133691
133690
|
if (!didRefresh) {
|
|
133692
133691
|
return void 0;
|
|
133693
133692
|
}
|
|
133693
|
+
stored = readStoredAuthState();
|
|
133694
133694
|
}
|
|
133695
|
-
return
|
|
133695
|
+
return stored.accessToken?.value;
|
|
133696
133696
|
}
|
|
133697
133697
|
async function getOauthToken(options) {
|
|
133698
133698
|
const urlToOpen = await getAuthURL(options.scopes, options.clientId);
|
|
@@ -133842,12 +133842,14 @@ async function login(complianceConfig, props = {
|
|
|
133842
133842
|
purgeConfigCaches();
|
|
133843
133843
|
return true;
|
|
133844
133844
|
}
|
|
133845
|
-
function
|
|
133846
|
-
|
|
133845
|
+
function isRefreshNeeded() {
|
|
133846
|
+
if (getAuthFromEnv()) {
|
|
133847
|
+
return false;
|
|
133848
|
+
}
|
|
133849
|
+
const { accessToken } = readStoredAuthState();
|
|
133847
133850
|
return Boolean(accessToken && /* @__PURE__ */ new Date() >= new Date(accessToken.expiry));
|
|
133848
133851
|
}
|
|
133849
133852
|
async function refreshToken() {
|
|
133850
|
-
reinitialiseAuthTokens();
|
|
133851
133853
|
try {
|
|
133852
133854
|
const {
|
|
133853
133855
|
token: { value: oauth_token, expiry: expiration_time } = {
|
|
@@ -133879,25 +133881,12 @@ async function logout() {
|
|
|
133879
133881
|
);
|
|
133880
133882
|
return;
|
|
133881
133883
|
}
|
|
133882
|
-
|
|
133883
|
-
|
|
133884
|
-
|
|
133885
|
-
|
|
133886
|
-
}
|
|
133887
|
-
const body2 = `client_id=${encodeURIComponent(getClientIdFromEnv())}&token_type_hint=refresh_token&token=${encodeURIComponent(localState.refreshToken?.value || "")}`;
|
|
133888
|
-
const response2 = await (0, import_undici5.fetch)(getRevokeUrlFromEnv(), {
|
|
133889
|
-
method: "POST",
|
|
133890
|
-
body: body2,
|
|
133891
|
-
headers: {
|
|
133892
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
133893
|
-
}
|
|
133894
|
-
});
|
|
133895
|
-
await response2.text();
|
|
133896
|
-
logger.log(
|
|
133897
|
-
"\u{1F481} Wrangler is configured with an OAuth token. The token has been successfully revoked"
|
|
133898
|
-
);
|
|
133884
|
+
const storedRefreshToken = readStoredAuthState().refreshToken;
|
|
133885
|
+
if (!storedRefreshToken) {
|
|
133886
|
+
logger.log("Not logged in, exiting...");
|
|
133887
|
+
return;
|
|
133899
133888
|
}
|
|
133900
|
-
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 || "")}`;
|
|
133901
133890
|
const response = await (0, import_undici5.fetch)(getRevokeUrlFromEnv(), {
|
|
133902
133891
|
method: "POST",
|
|
133903
133892
|
body,
|
|
@@ -133992,17 +133981,13 @@ function requireApiToken() {
|
|
|
133992
133981
|
return credentials;
|
|
133993
133982
|
}
|
|
133994
133983
|
function saveAccountToCache(account) {
|
|
133995
|
-
localState.account = account;
|
|
133996
133984
|
saveToConfigCache("wrangler-account.json", { account });
|
|
133997
133985
|
}
|
|
133998
133986
|
function getAccountFromCache() {
|
|
133999
|
-
if (localState.account) {
|
|
134000
|
-
return localState.account;
|
|
134001
|
-
}
|
|
134002
133987
|
return getConfigCache("wrangler-account.json").account;
|
|
134003
133988
|
}
|
|
134004
133989
|
function getScopes() {
|
|
134005
|
-
return
|
|
133990
|
+
return readStoredAuthState().scopes;
|
|
134006
133991
|
}
|
|
134007
133992
|
function printScopes(scopes) {
|
|
134008
133993
|
const data = scopes.map((scope) => ({
|
|
@@ -134065,7 +134050,7 @@ async function getJSONFromResponse(response) {
|
|
|
134065
134050
|
);
|
|
134066
134051
|
}
|
|
134067
134052
|
}
|
|
134068
|
-
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;
|
|
134069
134054
|
var init_user2 = __esm({
|
|
134070
134055
|
"src/user/user.ts"() {
|
|
134071
134056
|
init_import_meta_url();
|
|
@@ -134115,11 +134100,9 @@ var init_user2 = __esm({
|
|
|
134115
134100
|
};
|
|
134116
134101
|
DefaultScopeKeys = Object.keys(DefaultScopes);
|
|
134117
134102
|
__name(validateScopeKeys, "validateScopeKeys");
|
|
134118
|
-
|
|
134119
|
-
|
|
134120
|
-
|
|
134121
|
-
__name(getAuthTokens, "getAuthTokens");
|
|
134122
|
-
__name(reinitialiseAuthTokens, "reinitialiseAuthTokens");
|
|
134103
|
+
oauthFlowState = {};
|
|
134104
|
+
hasWarnedAboutDeprecatedV1ApiToken = false;
|
|
134105
|
+
__name(readStoredAuthState, "readStoredAuthState");
|
|
134123
134106
|
__name(getAPIToken, "getAPIToken");
|
|
134124
134107
|
ErrorOAuth2 = class extends UserError {
|
|
134125
134108
|
static {
|
|
@@ -134282,7 +134265,7 @@ var init_user2 = __esm({
|
|
|
134282
134265
|
__name(getOAuthTokenFromLocalState, "getOAuthTokenFromLocalState");
|
|
134283
134266
|
__name(getOauthToken, "getOauthToken");
|
|
134284
134267
|
__name(login, "login");
|
|
134285
|
-
__name(
|
|
134268
|
+
__name(isRefreshNeeded, "isRefreshNeeded");
|
|
134286
134269
|
__name(refreshToken, "refreshToken");
|
|
134287
134270
|
__name(logout, "logout");
|
|
134288
134271
|
__name(listScopes, "listScopes");
|
|
@@ -137106,8 +137089,8 @@ function getMissingEntryPointMessage(absoluteEntryPointPath, relativeEntryPointP
|
|
|
137106
137089
|
"index",
|
|
137107
137090
|
"dist/index"
|
|
137108
137091
|
]) {
|
|
137109
|
-
for (const
|
|
137110
|
-
const filePath = basenamePath +
|
|
137092
|
+
for (const extension2 of [".ts", ".tsx", ".js", ".jsx"]) {
|
|
137093
|
+
const filePath = basenamePath + extension2;
|
|
137111
137094
|
if (fileExists(path3__namespace.default.resolve(absoluteEntryPointPath, filePath))) {
|
|
137112
137095
|
possiblePaths.push(path3__namespace.default.join(relativeEntryPointPath, filePath));
|
|
137113
137096
|
}
|
|
@@ -148267,116 +148250,16 @@ var init_instances2 = __esm({
|
|
|
148267
148250
|
}
|
|
148268
148251
|
});
|
|
148269
148252
|
|
|
148270
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
148271
|
-
var require_stream = __commonJS({
|
|
148272
|
-
"../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/stream.js"(exports, module2) {
|
|
148273
|
-
init_import_meta_url();
|
|
148274
|
-
var { Duplex: Duplex2 } = __require("stream");
|
|
148275
|
-
function emitClose(stream2) {
|
|
148276
|
-
stream2.emit("close");
|
|
148277
|
-
}
|
|
148278
|
-
__name(emitClose, "emitClose");
|
|
148279
|
-
function duplexOnEnd() {
|
|
148280
|
-
if (!this.destroyed && this._writableState.finished) {
|
|
148281
|
-
this.destroy();
|
|
148282
|
-
}
|
|
148283
|
-
}
|
|
148284
|
-
__name(duplexOnEnd, "duplexOnEnd");
|
|
148285
|
-
function duplexOnError(err) {
|
|
148286
|
-
this.removeListener("error", duplexOnError);
|
|
148287
|
-
this.destroy();
|
|
148288
|
-
if (this.listenerCount("error") === 0) {
|
|
148289
|
-
this.emit("error", err);
|
|
148290
|
-
}
|
|
148291
|
-
}
|
|
148292
|
-
__name(duplexOnError, "duplexOnError");
|
|
148293
|
-
function createWebSocketStream2(ws, options) {
|
|
148294
|
-
let terminateOnDestroy = true;
|
|
148295
|
-
const duplex = new Duplex2({
|
|
148296
|
-
...options,
|
|
148297
|
-
autoDestroy: false,
|
|
148298
|
-
emitClose: false,
|
|
148299
|
-
objectMode: false,
|
|
148300
|
-
writableObjectMode: false
|
|
148301
|
-
});
|
|
148302
|
-
ws.on("message", /* @__PURE__ */ __name(function message(msg, isBinary) {
|
|
148303
|
-
const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
148304
|
-
if (!duplex.push(data)) ws.pause();
|
|
148305
|
-
}, "message"));
|
|
148306
|
-
ws.once("error", /* @__PURE__ */ __name(function error2(err) {
|
|
148307
|
-
if (duplex.destroyed) return;
|
|
148308
|
-
terminateOnDestroy = false;
|
|
148309
|
-
duplex.destroy(err);
|
|
148310
|
-
}, "error"));
|
|
148311
|
-
ws.once("close", /* @__PURE__ */ __name(function close2() {
|
|
148312
|
-
if (duplex.destroyed) return;
|
|
148313
|
-
duplex.push(null);
|
|
148314
|
-
}, "close"));
|
|
148315
|
-
duplex._destroy = function(err, callback) {
|
|
148316
|
-
if (ws.readyState === ws.CLOSED) {
|
|
148317
|
-
callback(err);
|
|
148318
|
-
process.nextTick(emitClose, duplex);
|
|
148319
|
-
return;
|
|
148320
|
-
}
|
|
148321
|
-
let called = false;
|
|
148322
|
-
ws.once("error", /* @__PURE__ */ __name(function error2(err2) {
|
|
148323
|
-
called = true;
|
|
148324
|
-
callback(err2);
|
|
148325
|
-
}, "error"));
|
|
148326
|
-
ws.once("close", /* @__PURE__ */ __name(function close2() {
|
|
148327
|
-
if (!called) callback(err);
|
|
148328
|
-
process.nextTick(emitClose, duplex);
|
|
148329
|
-
}, "close"));
|
|
148330
|
-
if (terminateOnDestroy) ws.terminate();
|
|
148331
|
-
};
|
|
148332
|
-
duplex._final = function(callback) {
|
|
148333
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
148334
|
-
ws.once("open", /* @__PURE__ */ __name(function open3() {
|
|
148335
|
-
duplex._final(callback);
|
|
148336
|
-
}, "open"));
|
|
148337
|
-
return;
|
|
148338
|
-
}
|
|
148339
|
-
if (ws._socket === null) return;
|
|
148340
|
-
if (ws._socket._writableState.finished) {
|
|
148341
|
-
callback();
|
|
148342
|
-
if (duplex._readableState.endEmitted) duplex.destroy();
|
|
148343
|
-
} else {
|
|
148344
|
-
ws._socket.once("finish", /* @__PURE__ */ __name(function finish() {
|
|
148345
|
-
callback();
|
|
148346
|
-
}, "finish"));
|
|
148347
|
-
ws.close();
|
|
148348
|
-
}
|
|
148349
|
-
};
|
|
148350
|
-
duplex._read = function() {
|
|
148351
|
-
if (ws.isPaused) ws.resume();
|
|
148352
|
-
};
|
|
148353
|
-
duplex._write = function(chunk, encoding, callback) {
|
|
148354
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
148355
|
-
ws.once("open", /* @__PURE__ */ __name(function open3() {
|
|
148356
|
-
duplex._write(chunk, encoding, callback);
|
|
148357
|
-
}, "open"));
|
|
148358
|
-
return;
|
|
148359
|
-
}
|
|
148360
|
-
ws.send(chunk, callback);
|
|
148361
|
-
};
|
|
148362
|
-
duplex.on("end", duplexOnEnd);
|
|
148363
|
-
duplex.on("error", duplexOnError);
|
|
148364
|
-
return duplex;
|
|
148365
|
-
}
|
|
148366
|
-
__name(createWebSocketStream2, "createWebSocketStream");
|
|
148367
|
-
module2.exports = createWebSocketStream2;
|
|
148368
|
-
}
|
|
148369
|
-
});
|
|
148370
|
-
|
|
148371
|
-
// ../../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
|
|
148372
148254
|
var require_constants7 = __commonJS({
|
|
148373
|
-
"../../node_modules/.pnpm/ws@8.
|
|
148255
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/constants.js"(exports, module2) {
|
|
148374
148256
|
init_import_meta_url();
|
|
148375
148257
|
var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
|
|
148376
148258
|
var hasBlob = typeof Blob !== "undefined";
|
|
148377
148259
|
if (hasBlob) BINARY_TYPES.push("blob");
|
|
148378
148260
|
module2.exports = {
|
|
148379
148261
|
BINARY_TYPES,
|
|
148262
|
+
CLOSE_TIMEOUT: 3e4,
|
|
148380
148263
|
EMPTY_BUFFER: Buffer.alloc(0),
|
|
148381
148264
|
GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
|
|
148382
148265
|
hasBlob,
|
|
@@ -148390,9 +148273,9 @@ var require_constants7 = __commonJS({
|
|
|
148390
148273
|
}
|
|
148391
148274
|
});
|
|
148392
148275
|
|
|
148393
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
148276
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/buffer-util.js
|
|
148394
148277
|
var require_buffer_util = __commonJS({
|
|
148395
|
-
"../../node_modules/.pnpm/ws@8.
|
|
148278
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/buffer-util.js"(exports, module2) {
|
|
148396
148279
|
init_import_meta_url();
|
|
148397
148280
|
var { EMPTY_BUFFER } = require_constants7();
|
|
148398
148281
|
var FastBuffer = Buffer[Symbol.species];
|
|
@@ -148470,9 +148353,9 @@ var require_buffer_util = __commonJS({
|
|
|
148470
148353
|
}
|
|
148471
148354
|
});
|
|
148472
148355
|
|
|
148473
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
148356
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/limiter.js
|
|
148474
148357
|
var require_limiter = __commonJS({
|
|
148475
|
-
"../../node_modules/.pnpm/ws@8.
|
|
148358
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/limiter.js"(exports, module2) {
|
|
148476
148359
|
init_import_meta_url();
|
|
148477
148360
|
var kDone = Symbol("kDone");
|
|
148478
148361
|
var kRun = Symbol("kRun");
|
|
@@ -148523,9 +148406,9 @@ var require_limiter = __commonJS({
|
|
|
148523
148406
|
}
|
|
148524
148407
|
});
|
|
148525
148408
|
|
|
148526
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
148409
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/permessage-deflate.js
|
|
148527
148410
|
var require_permessage_deflate2 = __commonJS({
|
|
148528
|
-
"../../node_modules/.pnpm/ws@8.
|
|
148411
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/permessage-deflate.js"(exports, module2) {
|
|
148529
148412
|
init_import_meta_url();
|
|
148530
148413
|
var zlib3 = __require("zlib");
|
|
148531
148414
|
var bufferUtil = require_buffer_util();
|
|
@@ -148539,7 +148422,7 @@ var require_permessage_deflate2 = __commonJS({
|
|
|
148539
148422
|
var kBuffers = Symbol("buffers");
|
|
148540
148423
|
var kError = Symbol("error");
|
|
148541
148424
|
var zlibLimiter;
|
|
148542
|
-
var
|
|
148425
|
+
var PerMessageDeflate2 = class {
|
|
148543
148426
|
static {
|
|
148544
148427
|
__name(this, "PerMessageDeflate");
|
|
148545
148428
|
}
|
|
@@ -148553,6 +148436,9 @@ var require_permessage_deflate2 = __commonJS({
|
|
|
148553
148436
|
* acknowledge disabling of client context takeover
|
|
148554
148437
|
* @param {Number} [options.concurrencyLimit=10] The number of concurrent
|
|
148555
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
|
|
148556
148442
|
* @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the
|
|
148557
148443
|
* use of a custom server window size
|
|
148558
148444
|
* @param {Boolean} [options.serverNoContextTakeover=false] Request/accept
|
|
@@ -148563,15 +148449,12 @@ var require_permessage_deflate2 = __commonJS({
|
|
|
148563
148449
|
* deflate
|
|
148564
148450
|
* @param {Object} [options.zlibInflateOptions] Options to pass to zlib on
|
|
148565
148451
|
* inflate
|
|
148566
|
-
* @param {Boolean} [isServer=false] Create the instance in either server or
|
|
148567
|
-
* client mode
|
|
148568
|
-
* @param {Number} [maxPayload=0] The maximum allowed message length
|
|
148569
148452
|
*/
|
|
148570
|
-
constructor(options
|
|
148571
|
-
this._maxPayload = maxPayload | 0;
|
|
148453
|
+
constructor(options) {
|
|
148572
148454
|
this._options = options || {};
|
|
148573
148455
|
this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024;
|
|
148574
|
-
this.
|
|
148456
|
+
this._maxPayload = this._options.maxPayload | 0;
|
|
148457
|
+
this._isServer = !!this._options.isServer;
|
|
148575
148458
|
this._deflate = null;
|
|
148576
148459
|
this._inflate = null;
|
|
148577
148460
|
this.params = null;
|
|
@@ -148880,7 +148763,7 @@ var require_permessage_deflate2 = __commonJS({
|
|
|
148880
148763
|
});
|
|
148881
148764
|
}
|
|
148882
148765
|
};
|
|
148883
|
-
module2.exports =
|
|
148766
|
+
module2.exports = PerMessageDeflate2;
|
|
148884
148767
|
function deflateOnData(chunk) {
|
|
148885
148768
|
this[kBuffers].push(chunk);
|
|
148886
148769
|
this[kTotalLength] += chunk.length;
|
|
@@ -148901,6 +148784,10 @@ var require_permessage_deflate2 = __commonJS({
|
|
|
148901
148784
|
__name(inflateOnData, "inflateOnData");
|
|
148902
148785
|
function inflateOnError(err) {
|
|
148903
148786
|
this[kPerMessageDeflate]._inflate = null;
|
|
148787
|
+
if (this[kError]) {
|
|
148788
|
+
this[kCallback](this[kError]);
|
|
148789
|
+
return;
|
|
148790
|
+
}
|
|
148904
148791
|
err[kStatusCode] = 1007;
|
|
148905
148792
|
this[kCallback](err);
|
|
148906
148793
|
}
|
|
@@ -148908,9 +148795,9 @@ var require_permessage_deflate2 = __commonJS({
|
|
|
148908
148795
|
}
|
|
148909
148796
|
});
|
|
148910
148797
|
|
|
148911
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
148798
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/validation.js
|
|
148912
148799
|
var require_validation = __commonJS({
|
|
148913
|
-
"../../node_modules/.pnpm/ws@8.
|
|
148800
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/validation.js"(exports, module2) {
|
|
148914
148801
|
init_import_meta_url();
|
|
148915
148802
|
var { isUtf8 } = __require("buffer");
|
|
148916
148803
|
var { hasBlob } = require_constants7();
|
|
@@ -149112,12 +148999,12 @@ var require_validation = __commonJS({
|
|
|
149112
148999
|
}
|
|
149113
149000
|
});
|
|
149114
149001
|
|
|
149115
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
149002
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/receiver.js
|
|
149116
149003
|
var require_receiver2 = __commonJS({
|
|
149117
|
-
"../../node_modules/.pnpm/ws@8.
|
|
149004
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/receiver.js"(exports, module2) {
|
|
149118
149005
|
init_import_meta_url();
|
|
149119
149006
|
var { Writable: Writable5 } = __require("stream");
|
|
149120
|
-
var
|
|
149007
|
+
var PerMessageDeflate2 = require_permessage_deflate2();
|
|
149121
149008
|
var {
|
|
149122
149009
|
BINARY_TYPES,
|
|
149123
149010
|
EMPTY_BUFFER,
|
|
@@ -149287,7 +149174,7 @@ var require_receiver2 = __commonJS({
|
|
|
149287
149174
|
return;
|
|
149288
149175
|
}
|
|
149289
149176
|
const compressed = (buf[0] & 64) === 64;
|
|
149290
|
-
if (compressed && !this._extensions[
|
|
149177
|
+
if (compressed && !this._extensions[PerMessageDeflate2.extensionName]) {
|
|
149291
149178
|
const error2 = this.createError(
|
|
149292
149179
|
RangeError,
|
|
149293
149180
|
"RSV1 must be clear",
|
|
@@ -149531,7 +149418,7 @@ var require_receiver2 = __commonJS({
|
|
|
149531
149418
|
* @private
|
|
149532
149419
|
*/
|
|
149533
149420
|
decompress(data, cb2) {
|
|
149534
|
-
const perMessageDeflate = this._extensions[
|
|
149421
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
|
|
149535
149422
|
perMessageDeflate.decompress(data, this._fin, (err, buf) => {
|
|
149536
149423
|
if (err) return cb2(err);
|
|
149537
149424
|
if (buf.length) {
|
|
@@ -149707,13 +149594,16 @@ var require_receiver2 = __commonJS({
|
|
|
149707
149594
|
}
|
|
149708
149595
|
});
|
|
149709
149596
|
|
|
149710
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
149597
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/sender.js
|
|
149711
149598
|
var require_sender2 = __commonJS({
|
|
149712
|
-
"../../node_modules/.pnpm/ws@8.
|
|
149599
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/sender.js"(exports, module2) {
|
|
149713
149600
|
init_import_meta_url();
|
|
149714
149601
|
var { Duplex: Duplex2 } = __require("stream");
|
|
149715
149602
|
var { randomFillSync } = __require("crypto");
|
|
149716
|
-
var
|
|
149603
|
+
var {
|
|
149604
|
+
types: { isUint8Array }
|
|
149605
|
+
} = __require("util");
|
|
149606
|
+
var PerMessageDeflate2 = require_permessage_deflate2();
|
|
149717
149607
|
var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants7();
|
|
149718
149608
|
var { isBlob: isBlob5, isValidStatusCode } = require_validation();
|
|
149719
149609
|
var { mask: applyMask, toBuffer } = require_buffer_util();
|
|
@@ -149869,8 +149759,10 @@ var require_sender2 = __commonJS({
|
|
|
149869
149759
|
buf.writeUInt16BE(code, 0);
|
|
149870
149760
|
if (typeof data === "string") {
|
|
149871
149761
|
buf.write(data, 2);
|
|
149872
|
-
} else {
|
|
149762
|
+
} else if (isUint8Array(data)) {
|
|
149873
149763
|
buf.set(data, 2);
|
|
149764
|
+
} else {
|
|
149765
|
+
throw new TypeError("Second argument must be a string or a Uint8Array");
|
|
149874
149766
|
}
|
|
149875
149767
|
}
|
|
149876
149768
|
const options = {
|
|
@@ -150000,7 +149892,7 @@ var require_sender2 = __commonJS({
|
|
|
150000
149892
|
* @public
|
|
150001
149893
|
*/
|
|
150002
149894
|
send(data, options, cb2) {
|
|
150003
|
-
const perMessageDeflate = this._extensions[
|
|
149895
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
|
|
150004
149896
|
let opcode = options.binary ? 2 : 1;
|
|
150005
149897
|
let rsv1 = options.compress;
|
|
150006
149898
|
let byteLength;
|
|
@@ -150124,7 +150016,7 @@ var require_sender2 = __commonJS({
|
|
|
150124
150016
|
this.sendFrame(_Sender.frame(data, options), cb2);
|
|
150125
150017
|
return;
|
|
150126
150018
|
}
|
|
150127
|
-
const perMessageDeflate = this._extensions[
|
|
150019
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
|
|
150128
150020
|
this._bufferedBytes += options[kByteLength];
|
|
150129
150021
|
this._state = DEFLATING;
|
|
150130
150022
|
perMessageDeflate.compress(data, options.fin, (_4, buf) => {
|
|
@@ -150167,7 +150059,7 @@ var require_sender2 = __commonJS({
|
|
|
150167
150059
|
/**
|
|
150168
150060
|
* Sends a frame.
|
|
150169
150061
|
*
|
|
150170
|
-
* @param {Buffer[]} list The frame to send
|
|
150062
|
+
* @param {(Buffer | String)[]} list The frame to send
|
|
150171
150063
|
* @param {Function} [cb] Callback
|
|
150172
150064
|
* @private
|
|
150173
150065
|
*/
|
|
@@ -150200,9 +150092,9 @@ var require_sender2 = __commonJS({
|
|
|
150200
150092
|
}
|
|
150201
150093
|
});
|
|
150202
150094
|
|
|
150203
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
150095
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/event-target.js
|
|
150204
150096
|
var require_event_target = __commonJS({
|
|
150205
|
-
"../../node_modules/.pnpm/ws@8.
|
|
150097
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/event-target.js"(exports, module2) {
|
|
150206
150098
|
init_import_meta_url();
|
|
150207
150099
|
var { kForOnEventAttribute, kListener } = require_constants7();
|
|
150208
150100
|
var kCode = Symbol("kCode");
|
|
@@ -150442,9 +150334,9 @@ var require_event_target = __commonJS({
|
|
|
150442
150334
|
}
|
|
150443
150335
|
});
|
|
150444
150336
|
|
|
150445
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
150337
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/extension.js
|
|
150446
150338
|
var require_extension = __commonJS({
|
|
150447
|
-
"../../node_modules/.pnpm/ws@8.
|
|
150339
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/extension.js"(exports, module2) {
|
|
150448
150340
|
init_import_meta_url();
|
|
150449
150341
|
var { tokenChars } = require_validation();
|
|
150450
150342
|
function push2(dest, name2, elem) {
|
|
@@ -150579,11 +150471,11 @@ var require_extension = __commonJS({
|
|
|
150579
150471
|
}
|
|
150580
150472
|
__name(parse15, "parse");
|
|
150581
150473
|
function format9(extensions) {
|
|
150582
|
-
return Object.keys(extensions).map((
|
|
150583
|
-
let configurations = extensions[
|
|
150474
|
+
return Object.keys(extensions).map((extension2) => {
|
|
150475
|
+
let configurations = extensions[extension2];
|
|
150584
150476
|
if (!Array.isArray(configurations)) configurations = [configurations];
|
|
150585
150477
|
return configurations.map((params) => {
|
|
150586
|
-
return [
|
|
150478
|
+
return [extension2].concat(
|
|
150587
150479
|
Object.keys(params).map((k6) => {
|
|
150588
150480
|
let values = params[k6];
|
|
150589
150481
|
if (!Array.isArray(values)) values = [values];
|
|
@@ -150598,9 +150490,9 @@ var require_extension = __commonJS({
|
|
|
150598
150490
|
}
|
|
150599
150491
|
});
|
|
150600
150492
|
|
|
150601
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
150493
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/websocket.js
|
|
150602
150494
|
var require_websocket2 = __commonJS({
|
|
150603
|
-
"../../node_modules/.pnpm/ws@8.
|
|
150495
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/websocket.js"(exports, module2) {
|
|
150604
150496
|
init_import_meta_url();
|
|
150605
150497
|
var EventEmitter5 = __require("events");
|
|
150606
150498
|
var https3 = __require("https");
|
|
@@ -150610,12 +150502,13 @@ var require_websocket2 = __commonJS({
|
|
|
150610
150502
|
var { randomBytes: randomBytes2, createHash: createHash9 } = __require("crypto");
|
|
150611
150503
|
var { Duplex: Duplex2, Readable: Readable11 } = __require("stream");
|
|
150612
150504
|
var { URL: URL8 } = __require("url");
|
|
150613
|
-
var
|
|
150505
|
+
var PerMessageDeflate2 = require_permessage_deflate2();
|
|
150614
150506
|
var Receiver2 = require_receiver2();
|
|
150615
150507
|
var Sender2 = require_sender2();
|
|
150616
150508
|
var { isBlob: isBlob5 } = require_validation();
|
|
150617
150509
|
var {
|
|
150618
150510
|
BINARY_TYPES,
|
|
150511
|
+
CLOSE_TIMEOUT,
|
|
150619
150512
|
EMPTY_BUFFER,
|
|
150620
150513
|
GUID,
|
|
150621
150514
|
kForOnEventAttribute,
|
|
@@ -150629,7 +150522,6 @@ var require_websocket2 = __commonJS({
|
|
|
150629
150522
|
} = require_event_target();
|
|
150630
150523
|
var { format: format9, parse: parse15 } = require_extension();
|
|
150631
150524
|
var { toBuffer } = require_buffer_util();
|
|
150632
|
-
var closeTimeout = 30 * 1e3;
|
|
150633
150525
|
var kAborted = Symbol("kAborted");
|
|
150634
150526
|
var protocolVersions = [8, 13];
|
|
150635
150527
|
var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
|
|
@@ -150678,6 +150570,7 @@ var require_websocket2 = __commonJS({
|
|
|
150678
150570
|
initAsClient(this, address, protocols, options);
|
|
150679
150571
|
} else {
|
|
150680
150572
|
this._autoPong = options.autoPong;
|
|
150573
|
+
this._closeTimeout = options.closeTimeout;
|
|
150681
150574
|
this._isServer = true;
|
|
150682
150575
|
}
|
|
150683
150576
|
}
|
|
@@ -150820,8 +150713,8 @@ var require_websocket2 = __commonJS({
|
|
|
150820
150713
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
150821
150714
|
return;
|
|
150822
150715
|
}
|
|
150823
|
-
if (this._extensions[
|
|
150824
|
-
this._extensions[
|
|
150716
|
+
if (this._extensions[PerMessageDeflate2.extensionName]) {
|
|
150717
|
+
this._extensions[PerMessageDeflate2.extensionName].cleanup();
|
|
150825
150718
|
}
|
|
150826
150719
|
this._receiver.removeAllListeners();
|
|
150827
150720
|
this._readyState = _WebSocket.CLOSED;
|
|
@@ -150983,7 +150876,7 @@ var require_websocket2 = __commonJS({
|
|
|
150983
150876
|
fin: true,
|
|
150984
150877
|
...options
|
|
150985
150878
|
};
|
|
150986
|
-
if (!this._extensions[
|
|
150879
|
+
if (!this._extensions[PerMessageDeflate2.extensionName]) {
|
|
150987
150880
|
opts.compress = false;
|
|
150988
150881
|
}
|
|
150989
150882
|
this._sender.send(data || EMPTY_BUFFER, opts, cb2);
|
|
@@ -151079,6 +150972,7 @@ var require_websocket2 = __commonJS({
|
|
|
151079
150972
|
const opts = {
|
|
151080
150973
|
allowSynchronousEvents: true,
|
|
151081
150974
|
autoPong: true,
|
|
150975
|
+
closeTimeout: CLOSE_TIMEOUT,
|
|
151082
150976
|
protocolVersion: protocolVersions[1],
|
|
151083
150977
|
maxPayload: 100 * 1024 * 1024,
|
|
151084
150978
|
skipUTF8Validation: false,
|
|
@@ -151096,6 +150990,7 @@ var require_websocket2 = __commonJS({
|
|
|
151096
150990
|
port: void 0
|
|
151097
150991
|
};
|
|
151098
150992
|
websocket._autoPong = opts.autoPong;
|
|
150993
|
+
websocket._closeTimeout = opts.closeTimeout;
|
|
151099
150994
|
if (!protocolVersions.includes(opts.protocolVersion)) {
|
|
151100
150995
|
throw new RangeError(
|
|
151101
150996
|
`Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`
|
|
@@ -151107,7 +151002,7 @@ var require_websocket2 = __commonJS({
|
|
|
151107
151002
|
} else {
|
|
151108
151003
|
try {
|
|
151109
151004
|
parsedUrl = new URL8(address);
|
|
151110
|
-
} catch
|
|
151005
|
+
} catch {
|
|
151111
151006
|
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
151112
151007
|
}
|
|
151113
151008
|
}
|
|
@@ -151121,7 +151016,7 @@ var require_websocket2 = __commonJS({
|
|
|
151121
151016
|
const isIpcUrl = parsedUrl.protocol === "ws+unix:";
|
|
151122
151017
|
let invalidUrlMessage;
|
|
151123
151018
|
if (parsedUrl.protocol !== "ws:" && !isSecure && !isIpcUrl) {
|
|
151124
|
-
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:"`;
|
|
151125
151020
|
} else if (isIpcUrl && !parsedUrl.pathname) {
|
|
151126
151021
|
invalidUrlMessage = "The URL's pathname is empty";
|
|
151127
151022
|
} else if (parsedUrl.hash) {
|
|
@@ -151155,13 +151050,13 @@ var require_websocket2 = __commonJS({
|
|
|
151155
151050
|
opts.path = parsedUrl.pathname + parsedUrl.search;
|
|
151156
151051
|
opts.timeout = opts.handshakeTimeout;
|
|
151157
151052
|
if (opts.perMessageDeflate) {
|
|
151158
|
-
perMessageDeflate = new
|
|
151159
|
-
opts.perMessageDeflate
|
|
151160
|
-
false,
|
|
151161
|
-
opts.maxPayload
|
|
151162
|
-
);
|
|
151053
|
+
perMessageDeflate = new PerMessageDeflate2({
|
|
151054
|
+
...opts.perMessageDeflate,
|
|
151055
|
+
isServer: false,
|
|
151056
|
+
maxPayload: opts.maxPayload
|
|
151057
|
+
});
|
|
151163
151058
|
opts.headers["Sec-WebSocket-Extensions"] = format9({
|
|
151164
|
-
[
|
|
151059
|
+
[PerMessageDeflate2.extensionName]: perMessageDeflate.offer()
|
|
151165
151060
|
});
|
|
151166
151061
|
}
|
|
151167
151062
|
if (protocols.length) {
|
|
@@ -151304,19 +151199,19 @@ var require_websocket2 = __commonJS({
|
|
|
151304
151199
|
return;
|
|
151305
151200
|
}
|
|
151306
151201
|
const extensionNames = Object.keys(extensions);
|
|
151307
|
-
if (extensionNames.length !== 1 || extensionNames[0] !==
|
|
151202
|
+
if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate2.extensionName) {
|
|
151308
151203
|
const message = "Server indicated an extension that was not requested";
|
|
151309
151204
|
abortHandshake(websocket, socket, message);
|
|
151310
151205
|
return;
|
|
151311
151206
|
}
|
|
151312
151207
|
try {
|
|
151313
|
-
perMessageDeflate.accept(extensions[
|
|
151208
|
+
perMessageDeflate.accept(extensions[PerMessageDeflate2.extensionName]);
|
|
151314
151209
|
} catch (err) {
|
|
151315
151210
|
const message = "Invalid Sec-WebSocket-Extensions header";
|
|
151316
151211
|
abortHandshake(websocket, socket, message);
|
|
151317
151212
|
return;
|
|
151318
151213
|
}
|
|
151319
|
-
websocket._extensions[
|
|
151214
|
+
websocket._extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
|
|
151320
151215
|
}
|
|
151321
151216
|
websocket.setSocket(socket, head, {
|
|
151322
151217
|
allowSynchronousEvents: opts.allowSynchronousEvents,
|
|
@@ -151453,7 +151348,7 @@ var require_websocket2 = __commonJS({
|
|
|
151453
151348
|
function setCloseTimer(websocket) {
|
|
151454
151349
|
websocket._closeTimer = setTimeout(
|
|
151455
151350
|
websocket._socket.destroy.bind(websocket._socket),
|
|
151456
|
-
|
|
151351
|
+
websocket._closeTimeout
|
|
151457
151352
|
);
|
|
151458
151353
|
}
|
|
151459
151354
|
__name(setCloseTimer, "setCloseTimer");
|
|
@@ -151463,8 +151358,8 @@ var require_websocket2 = __commonJS({
|
|
|
151463
151358
|
this.removeListener("data", socketOnData);
|
|
151464
151359
|
this.removeListener("end", socketOnEnd);
|
|
151465
151360
|
websocket._readyState = WebSocket2.CLOSING;
|
|
151466
|
-
|
|
151467
|
-
|
|
151361
|
+
if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && this._readableState.length !== 0) {
|
|
151362
|
+
const chunk = this.read(this._readableState.length);
|
|
151468
151363
|
websocket._receiver.write(chunk);
|
|
151469
151364
|
}
|
|
151470
151365
|
websocket._receiver.end();
|
|
@@ -151504,9 +151399,111 @@ var require_websocket2 = __commonJS({
|
|
|
151504
151399
|
}
|
|
151505
151400
|
});
|
|
151506
151401
|
|
|
151507
|
-
// ../../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
|
|
151508
151505
|
var require_subprotocol = __commonJS({
|
|
151509
|
-
"../../node_modules/.pnpm/ws@8.
|
|
151506
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/subprotocol.js"(exports, module2) {
|
|
151510
151507
|
init_import_meta_url();
|
|
151511
151508
|
var { tokenChars } = require_validation();
|
|
151512
151509
|
function parse15(header) {
|
|
@@ -151550,19 +151547,19 @@ var require_subprotocol = __commonJS({
|
|
|
151550
151547
|
}
|
|
151551
151548
|
});
|
|
151552
151549
|
|
|
151553
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
151550
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/websocket-server.js
|
|
151554
151551
|
var require_websocket_server = __commonJS({
|
|
151555
|
-
"../../node_modules/.pnpm/ws@8.
|
|
151552
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/websocket-server.js"(exports, module2) {
|
|
151556
151553
|
init_import_meta_url();
|
|
151557
151554
|
var EventEmitter5 = __require("events");
|
|
151558
151555
|
var http6 = __require("http");
|
|
151559
151556
|
var { Duplex: Duplex2 } = __require("stream");
|
|
151560
151557
|
var { createHash: createHash9 } = __require("crypto");
|
|
151561
|
-
var
|
|
151562
|
-
var
|
|
151563
|
-
var
|
|
151558
|
+
var extension2 = require_extension();
|
|
151559
|
+
var PerMessageDeflate2 = require_permessage_deflate2();
|
|
151560
|
+
var subprotocol2 = require_subprotocol();
|
|
151564
151561
|
var WebSocket2 = require_websocket2();
|
|
151565
|
-
var { GUID, kWebSocket } = require_constants7();
|
|
151562
|
+
var { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants7();
|
|
151566
151563
|
var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
151567
151564
|
var RUNNING = 0;
|
|
151568
151565
|
var CLOSING = 1;
|
|
@@ -151584,6 +151581,9 @@ var require_websocket_server = __commonJS({
|
|
|
151584
151581
|
* pending connections
|
|
151585
151582
|
* @param {Boolean} [options.clientTracking=true] Specifies whether or not to
|
|
151586
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
|
|
151587
151587
|
* @param {Function} [options.handleProtocols] A hook to handle protocols
|
|
151588
151588
|
* @param {String} [options.host] The hostname where to bind the server
|
|
151589
151589
|
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
@@ -151612,6 +151612,7 @@ var require_websocket_server = __commonJS({
|
|
|
151612
151612
|
perMessageDeflate: false,
|
|
151613
151613
|
handleProtocols: null,
|
|
151614
151614
|
clientTracking: true,
|
|
151615
|
+
closeTimeout: CLOSE_TIMEOUT,
|
|
151615
151616
|
verifyClient: null,
|
|
151616
151617
|
noServer: false,
|
|
151617
151618
|
backlog: null,
|
|
@@ -151767,9 +151768,11 @@ var require_websocket_server = __commonJS({
|
|
|
151767
151768
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
151768
151769
|
return;
|
|
151769
151770
|
}
|
|
151770
|
-
if (version5 !==
|
|
151771
|
+
if (version5 !== 13 && version5 !== 8) {
|
|
151771
151772
|
const message = "Missing or invalid Sec-WebSocket-Version header";
|
|
151772
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message
|
|
151773
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
|
|
151774
|
+
"Sec-WebSocket-Version": "13, 8"
|
|
151775
|
+
});
|
|
151773
151776
|
return;
|
|
151774
151777
|
}
|
|
151775
151778
|
if (!this.shouldHandle(req)) {
|
|
@@ -151780,7 +151783,7 @@ var require_websocket_server = __commonJS({
|
|
|
151780
151783
|
let protocols = /* @__PURE__ */ new Set();
|
|
151781
151784
|
if (secWebSocketProtocol !== void 0) {
|
|
151782
151785
|
try {
|
|
151783
|
-
protocols =
|
|
151786
|
+
protocols = subprotocol2.parse(secWebSocketProtocol);
|
|
151784
151787
|
} catch (err) {
|
|
151785
151788
|
const message = "Invalid Sec-WebSocket-Protocol header";
|
|
151786
151789
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
@@ -151790,16 +151793,16 @@ var require_websocket_server = __commonJS({
|
|
|
151790
151793
|
const secWebSocketExtensions = req.headers["sec-websocket-extensions"];
|
|
151791
151794
|
const extensions = {};
|
|
151792
151795
|
if (this.options.perMessageDeflate && secWebSocketExtensions !== void 0) {
|
|
151793
|
-
const perMessageDeflate = new
|
|
151794
|
-
this.options.perMessageDeflate,
|
|
151795
|
-
true,
|
|
151796
|
-
this.options.maxPayload
|
|
151797
|
-
);
|
|
151796
|
+
const perMessageDeflate = new PerMessageDeflate2({
|
|
151797
|
+
...this.options.perMessageDeflate,
|
|
151798
|
+
isServer: true,
|
|
151799
|
+
maxPayload: this.options.maxPayload
|
|
151800
|
+
});
|
|
151798
151801
|
try {
|
|
151799
|
-
const offers =
|
|
151800
|
-
if (offers[
|
|
151801
|
-
perMessageDeflate.accept(offers[
|
|
151802
|
-
extensions[
|
|
151802
|
+
const offers = extension2.parse(secWebSocketExtensions);
|
|
151803
|
+
if (offers[PerMessageDeflate2.extensionName]) {
|
|
151804
|
+
perMessageDeflate.accept(offers[PerMessageDeflate2.extensionName]);
|
|
151805
|
+
extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
|
|
151803
151806
|
}
|
|
151804
151807
|
} catch (err) {
|
|
151805
151808
|
const message = "Invalid or unacceptable Sec-WebSocket-Extensions header";
|
|
@@ -151870,10 +151873,10 @@ var require_websocket_server = __commonJS({
|
|
|
151870
151873
|
ws._protocol = protocol;
|
|
151871
151874
|
}
|
|
151872
151875
|
}
|
|
151873
|
-
if (extensions[
|
|
151874
|
-
const params = extensions[
|
|
151875
|
-
const value =
|
|
151876
|
-
[
|
|
151876
|
+
if (extensions[PerMessageDeflate2.extensionName]) {
|
|
151877
|
+
const params = extensions[PerMessageDeflate2.extensionName].params;
|
|
151878
|
+
const value = extension2.format({
|
|
151879
|
+
[PerMessageDeflate2.extensionName]: [params]
|
|
151877
151880
|
});
|
|
151878
151881
|
headers.push(`Sec-WebSocket-Extensions: ${value}`);
|
|
151879
151882
|
ws._extensions = extensions;
|
|
@@ -151932,27 +151935,30 @@ var require_websocket_server = __commonJS({
|
|
|
151932
151935
|
);
|
|
151933
151936
|
}
|
|
151934
151937
|
__name(abortHandshake, "abortHandshake");
|
|
151935
|
-
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
|
|
151938
|
+
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message, headers) {
|
|
151936
151939
|
if (server.listenerCount("wsClientError")) {
|
|
151937
151940
|
const err = new Error(message);
|
|
151938
151941
|
Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
|
|
151939
151942
|
server.emit("wsClientError", err, socket, req);
|
|
151940
151943
|
} else {
|
|
151941
|
-
abortHandshake(socket, code, message);
|
|
151944
|
+
abortHandshake(socket, code, message, headers);
|
|
151942
151945
|
}
|
|
151943
151946
|
}
|
|
151944
151947
|
__name(abortHandshakeOrEmitwsClientError, "abortHandshakeOrEmitwsClientError");
|
|
151945
151948
|
}
|
|
151946
151949
|
});
|
|
151947
151950
|
|
|
151948
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
151951
|
+
// ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/wrapper.mjs
|
|
151949
151952
|
var import_websocket, wrapper_default;
|
|
151950
151953
|
var init_wrapper = __esm({
|
|
151951
|
-
"../../node_modules/.pnpm/ws@8.
|
|
151954
|
+
"../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/wrapper.mjs"() {
|
|
151952
151955
|
init_import_meta_url();
|
|
151953
151956
|
__toESM(require_stream(), 1);
|
|
151957
|
+
__toESM(require_extension(), 1);
|
|
151958
|
+
__toESM(require_permessage_deflate2(), 1);
|
|
151954
151959
|
__toESM(require_receiver2(), 1);
|
|
151955
151960
|
__toESM(require_sender2(), 1);
|
|
151961
|
+
__toESM(require_subprotocol(), 1);
|
|
151956
151962
|
import_websocket = __toESM(require_websocket2(), 1);
|
|
151957
151963
|
__toESM(require_websocket_server(), 1);
|
|
151958
151964
|
wrapper_default = import_websocket.default;
|
|
@@ -238582,8 +238588,8 @@ var init_hash = __esm({
|
|
|
238582
238588
|
hashFile = /* @__PURE__ */ __name((filepath) => {
|
|
238583
238589
|
const contents = fs27.readFileSync(filepath);
|
|
238584
238590
|
const base64Contents = contents.toString("base64");
|
|
238585
|
-
const
|
|
238586
|
-
return blake3Wasm.hash(base64Contents +
|
|
238591
|
+
const extension2 = path3.extname(filepath).substring(1);
|
|
238592
|
+
return blake3Wasm.hash(base64Contents + extension2).toString("hex").slice(0, 32);
|
|
238587
238593
|
}, "hashFile");
|
|
238588
238594
|
}
|
|
238589
238595
|
});
|
|
@@ -243100,6 +243106,23 @@ async function createDraftWorker({
|
|
|
243100
243106
|
}
|
|
243101
243107
|
);
|
|
243102
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
|
+
}
|
|
243103
243126
|
function validateFileSecrets(content, jsonFilePath) {
|
|
243104
243127
|
if (content === null || typeof content !== "object") {
|
|
243105
243128
|
throw new FatalError(
|
|
@@ -243162,13 +243185,12 @@ async function parseBulkInputToObject(input) {
|
|
|
243162
243185
|
}
|
|
243163
243186
|
return { content, secretSource, secretFormat };
|
|
243164
243187
|
}
|
|
243165
|
-
var import_dotenv2,
|
|
243188
|
+
var import_dotenv2, VERSION_NOT_DEPLOYED_ERR_CODE, secretNamespace, secretPutCommand, secretDeleteCommand, secretListCommand, secretBulkCommand;
|
|
243166
243189
|
var init_secret = __esm({
|
|
243167
243190
|
"src/secret/index.ts"() {
|
|
243168
243191
|
init_import_meta_url();
|
|
243169
243192
|
init_dist();
|
|
243170
243193
|
import_dotenv2 = __toESM(require_main());
|
|
243171
|
-
import_undici19 = __toESM(require_undici());
|
|
243172
243194
|
init_cfetch();
|
|
243173
243195
|
init_create_command();
|
|
243174
243196
|
init_create_worker_upload_form();
|
|
@@ -243430,6 +243452,7 @@ Otherwise, check that the Worker name is correct and you're logged into the righ
|
|
|
243430
243452
|
});
|
|
243431
243453
|
}
|
|
243432
243454
|
});
|
|
243455
|
+
__name(putBulkSecrets, "putBulkSecrets");
|
|
243433
243456
|
secretBulkCommand = createCommand({
|
|
243434
243457
|
metadata: {
|
|
243435
243458
|
description: "Upload multiple secrets for a Worker at once",
|
|
@@ -243463,7 +243486,7 @@ Otherwise, check that the Worker name is correct and you're logged into the righ
|
|
|
243463
243486
|
{ telemetryMessage: "secret bulk pages project" }
|
|
243464
243487
|
);
|
|
243465
243488
|
}
|
|
243466
|
-
const isServiceEnv = useServiceEnvironments(config) && args.env;
|
|
243489
|
+
const isServiceEnv = useServiceEnvironments(config) && !!args.env;
|
|
243467
243490
|
const scriptName = getLegacyScriptName(args, config);
|
|
243468
243491
|
if (!scriptName) {
|
|
243469
243492
|
const error2 = new UserError(
|
|
@@ -243482,27 +243505,21 @@ Otherwise, check that the Worker name is correct and you're logged into the righ
|
|
|
243482
243505
|
return logger.error(`\u{1F6A8} No content found in file, or piped input.`);
|
|
243483
243506
|
}
|
|
243484
243507
|
const { content, secretSource, secretFormat } = result;
|
|
243485
|
-
|
|
243486
|
-
const url4 = isServiceEnv ? `/accounts/${accountId}/workers/services/${scriptName}/environments/${args.env}/settings` : `/accounts/${accountId}/workers/scripts/${scriptName}/settings`;
|
|
243487
|
-
return fetchResult(config, url4);
|
|
243488
|
-
}
|
|
243489
|
-
__name(getSettings3, "getSettings");
|
|
243490
|
-
function putBindingsSettings(bindings) {
|
|
243491
|
-
const url4 = isServiceEnv ? `/accounts/${accountId}/workers/services/${scriptName}/environments/${args.env}/settings` : `/accounts/${accountId}/workers/scripts/${scriptName}/settings`;
|
|
243492
|
-
const data = new import_undici19.FormData();
|
|
243493
|
-
data.set("settings", JSON.stringify({ bindings }));
|
|
243494
|
-
return fetchResult(config, url4, {
|
|
243495
|
-
method: "PATCH",
|
|
243496
|
-
body: data
|
|
243497
|
-
});
|
|
243498
|
-
}
|
|
243499
|
-
__name(putBindingsSettings, "putBindingsSettings");
|
|
243500
|
-
let existingBindings;
|
|
243508
|
+
let created = [];
|
|
243501
243509
|
try {
|
|
243502
|
-
|
|
243503
|
-
|
|
243504
|
-
|
|
243505
|
-
|
|
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
|
+
}
|
|
243506
243523
|
const draftWorkerResult = await createDraftWorker({
|
|
243507
243524
|
config,
|
|
243508
243525
|
args,
|
|
@@ -243512,50 +243529,38 @@ Otherwise, check that the Worker name is correct and you're logged into the righ
|
|
|
243512
243529
|
if (draftWorkerResult === null) {
|
|
243513
243530
|
return;
|
|
243514
243531
|
}
|
|
243515
|
-
|
|
243516
|
-
|
|
243517
|
-
|
|
243518
|
-
|
|
243519
|
-
|
|
243520
|
-
|
|
243521
|
-
|
|
243522
|
-
}).map((binding) => ({ type: binding.type, name: binding.name }));
|
|
243523
|
-
const upsertBindings = Object.entries(
|
|
243524
|
-
content
|
|
243525
|
-
).map(([key, value]) => {
|
|
243526
|
-
return {
|
|
243527
|
-
type: "secret_text",
|
|
243528
|
-
name: key,
|
|
243529
|
-
text: value
|
|
243530
|
-
};
|
|
243531
|
-
});
|
|
243532
|
-
try {
|
|
243533
|
-
await putBindingsSettings(inheritBindings.concat(upsertBindings));
|
|
243534
|
-
for (const upsertedBinding of upsertBindings) {
|
|
243535
|
-
logger.log(
|
|
243536
|
-
`\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 }
|
|
243537
243539
|
);
|
|
243538
243540
|
}
|
|
243539
|
-
|
|
243540
|
-
logger.log("Finished processing secrets file:");
|
|
243541
|
-
logger.log(`\u2728 ${upsertBindings.length} secrets successfully uploaded`);
|
|
243542
|
-
sendMetricsEvent(
|
|
243543
|
-
"create encrypted variable",
|
|
243544
|
-
{
|
|
243545
|
-
secretOperation: "bulk",
|
|
243546
|
-
secretSource,
|
|
243547
|
-
secretFormat,
|
|
243548
|
-
hasEnvironment: Boolean(args.env)
|
|
243549
|
-
},
|
|
243550
|
-
{
|
|
243551
|
-
sendMetrics: config.send_metrics
|
|
243552
|
-
}
|
|
243553
|
-
);
|
|
243554
|
-
} catch (err) {
|
|
243541
|
+
} catch (e9) {
|
|
243555
243542
|
logger.log("");
|
|
243556
243543
|
logger.log(`\u{1F6A8} Secrets failed to upload`);
|
|
243557
|
-
throw
|
|
243544
|
+
throw e9;
|
|
243545
|
+
}
|
|
243546
|
+
for (const key of created) {
|
|
243547
|
+
logger.log(`\u2728 Successfully created secret for key: ${key}`);
|
|
243558
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
|
+
);
|
|
243559
243564
|
}
|
|
243560
243565
|
});
|
|
243561
243566
|
__name(validateFileSecrets, "validateFileSecrets");
|
|
@@ -266736,7 +266741,7 @@ var init_runtimeExtensions = __esm({
|
|
|
266736
266741
|
...asPartial(getHttpHandlerExtensionConfiguration(runtimeConfig)),
|
|
266737
266742
|
...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig))
|
|
266738
266743
|
};
|
|
266739
|
-
extensions.forEach((
|
|
266744
|
+
extensions.forEach((extension2) => extension2.configure(extensionConfiguration));
|
|
266740
266745
|
return {
|
|
266741
266746
|
...runtimeConfig,
|
|
266742
266747
|
...resolveAwsRegionExtensionConfiguration(extensionConfiguration),
|
|
@@ -268330,7 +268335,7 @@ var init_runtimeExtensions2 = __esm({
|
|
|
268330
268335
|
...asPartial2(getHttpHandlerExtensionConfiguration(runtimeConfig)),
|
|
268331
268336
|
...asPartial2(getHttpAuthExtensionConfiguration2(runtimeConfig))
|
|
268332
268337
|
};
|
|
268333
|
-
extensions.forEach((
|
|
268338
|
+
extensions.forEach((extension2) => extension2.configure(extensionConfiguration));
|
|
268334
268339
|
return {
|
|
268335
268340
|
...runtimeConfig,
|
|
268336
268341
|
...resolveAwsRegionExtensionConfiguration(extensionConfiguration),
|
|
@@ -269609,7 +269614,7 @@ var init_runtimeExtensions3 = __esm({
|
|
|
269609
269614
|
...asPartial3(getHttpHandlerExtensionConfiguration(runtimeConfig)),
|
|
269610
269615
|
...asPartial3(getHttpAuthExtensionConfiguration3(runtimeConfig))
|
|
269611
269616
|
};
|
|
269612
|
-
extensions.forEach((
|
|
269617
|
+
extensions.forEach((extension2) => extension2.configure(extensionConfiguration));
|
|
269613
269618
|
return {
|
|
269614
269619
|
...runtimeConfig,
|
|
269615
269620
|
...resolveAwsRegionExtensionConfiguration(extensionConfiguration),
|
|
@@ -272784,7 +272789,7 @@ var init_runtimeExtensions4 = __esm({
|
|
|
272784
272789
|
...asPartial4(getHttpHandlerExtensionConfiguration(runtimeConfig)),
|
|
272785
272790
|
...asPartial4(getHttpAuthExtensionConfiguration4(runtimeConfig))
|
|
272786
272791
|
};
|
|
272787
|
-
extensions.forEach((
|
|
272792
|
+
extensions.forEach((extension2) => extension2.configure(extensionConfiguration));
|
|
272788
272793
|
return {
|
|
272789
272794
|
...runtimeConfig,
|
|
272790
272795
|
...resolveAwsRegionExtensionConfiguration(extensionConfiguration),
|
|
@@ -277999,7 +278004,8 @@ var init_defaults = __esm({
|
|
|
277999
278004
|
},
|
|
278000
278005
|
rolling_policy: {
|
|
278001
278006
|
file_size_bytes: void 0,
|
|
278002
|
-
interval_seconds: 300
|
|
278007
|
+
interval_seconds: 300,
|
|
278008
|
+
min_interval_seconds: 60
|
|
278003
278009
|
},
|
|
278004
278010
|
r2: {
|
|
278005
278011
|
path: "",
|
|
@@ -278124,7 +278130,8 @@ async function promptCompression() {
|
|
|
278124
278130
|
fallbackOption: 3
|
|
278125
278131
|
});
|
|
278126
278132
|
}
|
|
278127
|
-
async function promptRollingPolicy() {
|
|
278133
|
+
async function promptRollingPolicy(options) {
|
|
278134
|
+
const minInterval = options?.minIntervalSeconds ?? 10;
|
|
278128
278135
|
const fileSizeMB = await promptWithRetry(
|
|
278129
278136
|
() => "File size",
|
|
278130
278137
|
() => prompt("Roll file when size reaches (MB, minimum 5):", {
|
|
@@ -278141,13 +278148,13 @@ async function promptRollingPolicy() {
|
|
|
278141
278148
|
);
|
|
278142
278149
|
const intervalSeconds = await promptWithRetry(
|
|
278143
278150
|
() => "Interval",
|
|
278144
|
-
() => prompt(
|
|
278151
|
+
() => prompt(`Roll file when time reaches (seconds, minimum ${minInterval}):`, {
|
|
278145
278152
|
defaultValue: String(SINK_DEFAULTS.rolling_policy.interval_seconds)
|
|
278146
278153
|
}),
|
|
278147
278154
|
(value) => {
|
|
278148
278155
|
const num = parseInt(value, 10);
|
|
278149
|
-
if (isNaN(num) || num <
|
|
278150
|
-
throw new UserError(
|
|
278156
|
+
if (isNaN(num) || num < minInterval) {
|
|
278157
|
+
throw new UserError(`Interval must be a number >= ${minInterval}`, {
|
|
278151
278158
|
telemetryMessage: "pipelines setup invalid interval"
|
|
278152
278159
|
});
|
|
278153
278160
|
}
|
|
@@ -278724,7 +278731,9 @@ async function setupDataCatalogSink(config, accountId, setupConfig) {
|
|
|
278724
278731
|
displayCatalogTokenInstructions(accountId);
|
|
278725
278732
|
const token = await promptCatalogToken(config, accountId, bucket);
|
|
278726
278733
|
const compression = await promptCompression();
|
|
278727
|
-
const rollingPolicy = await promptRollingPolicy(
|
|
278734
|
+
const rollingPolicy = await promptRollingPolicy({
|
|
278735
|
+
minIntervalSeconds: SINK_DEFAULTS.rolling_policy.min_interval_seconds
|
|
278736
|
+
});
|
|
278728
278737
|
setupConfig.sinkConfig = {
|
|
278729
278738
|
name: setupConfig.sinkName,
|
|
278730
278739
|
type: "r2_data_catalog",
|
|
@@ -279299,6 +279308,14 @@ var init_create11 = __esm({
|
|
|
279299
279308
|
{ telemetryMessage: "pipelines sinks create invalid format" }
|
|
279300
279309
|
);
|
|
279301
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
|
+
}
|
|
279302
279319
|
}
|
|
279303
279320
|
}, "validateArgs"),
|
|
279304
279321
|
async handler(args, { config }) {
|
|
@@ -290315,14 +290332,14 @@ function formatSqlResults(data, duration) {
|
|
|
290315
290332
|
logger.log(`On average, ${prettyBytes(bytesPerSecond)} / s`);
|
|
290316
290333
|
}
|
|
290317
290334
|
}
|
|
290318
|
-
var
|
|
290335
|
+
var import_undici19, r2SqlNamespace, r2SqlQueryCommand;
|
|
290319
290336
|
var init_sql = __esm({
|
|
290320
290337
|
"src/r2/sql.ts"() {
|
|
290321
290338
|
init_import_meta_url();
|
|
290322
290339
|
init_interactive();
|
|
290323
290340
|
init_dist();
|
|
290324
290341
|
init_pretty_bytes();
|
|
290325
|
-
|
|
290342
|
+
import_undici19 = __toESM(require_undici());
|
|
290326
290343
|
init_internal();
|
|
290327
290344
|
init_create_command();
|
|
290328
290345
|
init_logger();
|
|
@@ -290388,7 +290405,7 @@ var init_sql = __esm({
|
|
|
290388
290405
|
let duration = null;
|
|
290389
290406
|
try {
|
|
290390
290407
|
const start = Date.now();
|
|
290391
|
-
const response = await (0,
|
|
290408
|
+
const response = await (0, import_undici19.fetch)(apiUrl, {
|
|
290392
290409
|
method: "POST",
|
|
290393
290410
|
headers: {
|
|
290394
290411
|
Authorization: `Bearer ${token}`,
|
|
@@ -290604,6 +290621,12 @@ function getHostFromRoute(route) {
|
|
|
290604
290621
|
}
|
|
290605
290622
|
return host;
|
|
290606
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
|
+
}
|
|
290607
290630
|
async function getZoneForRoute(complianceConfig, from, zoneIdCache = /* @__PURE__ */ new Map()) {
|
|
290608
290631
|
const { route, accountId } = from;
|
|
290609
290632
|
const host = getHostFromRoute(route);
|
|
@@ -290773,6 +290796,7 @@ var init_zones3 = __esm({
|
|
|
290773
290796
|
init_cfetch();
|
|
290774
290797
|
init_retry();
|
|
290775
290798
|
__name(getHostFromRoute, "getHostFromRoute");
|
|
290799
|
+
__name(getZoneFromRoute, "getZoneFromRoute");
|
|
290776
290800
|
__name(getZoneForRoute, "getZoneForRoute");
|
|
290777
290801
|
__name(getHostFromUrl, "getHostFromUrl");
|
|
290778
290802
|
__name(getZoneIdForPreview, "getZoneIdForPreview");
|
|
@@ -296994,12 +297018,12 @@ var init_info5 = __esm({
|
|
|
296994
297018
|
});
|
|
296995
297019
|
}
|
|
296996
297020
|
});
|
|
296997
|
-
var
|
|
297021
|
+
var import_undici20, vectorizeInsertCommand;
|
|
296998
297022
|
var init_insert = __esm({
|
|
296999
297023
|
"src/vectorize/insert.ts"() {
|
|
297000
297024
|
init_import_meta_url();
|
|
297001
297025
|
init_dist();
|
|
297002
|
-
|
|
297026
|
+
import_undici20 = __toESM(require_undici());
|
|
297003
297027
|
init_create_command();
|
|
297004
297028
|
init_logger();
|
|
297005
297029
|
init_client14();
|
|
@@ -297062,7 +297086,7 @@ var init_insert = __esm({
|
|
|
297062
297086
|
}
|
|
297063
297087
|
let vectorInsertCount = 0;
|
|
297064
297088
|
for await (const batch of getBatchFromFile(rl, args.batchSize)) {
|
|
297065
|
-
const formData = new
|
|
297089
|
+
const formData = new import_undici20.FormData();
|
|
297066
297090
|
formData.append(
|
|
297067
297091
|
"vectors",
|
|
297068
297092
|
new File([batch.join(`
|
|
@@ -297523,12 +297547,12 @@ var init_query = __esm({
|
|
|
297523
297547
|
__name(validateQueryFilter, "validateQueryFilter");
|
|
297524
297548
|
}
|
|
297525
297549
|
});
|
|
297526
|
-
var
|
|
297550
|
+
var import_undici21, vectorizeUpsertCommand;
|
|
297527
297551
|
var init_upsert = __esm({
|
|
297528
297552
|
"src/vectorize/upsert.ts"() {
|
|
297529
297553
|
init_import_meta_url();
|
|
297530
297554
|
init_dist();
|
|
297531
|
-
|
|
297555
|
+
import_undici21 = __toESM(require_undici());
|
|
297532
297556
|
init_create_command();
|
|
297533
297557
|
init_logger();
|
|
297534
297558
|
init_client14();
|
|
@@ -297581,7 +297605,7 @@ var init_upsert = __esm({
|
|
|
297581
297605
|
}
|
|
297582
297606
|
let vectorUpsertCount = 0;
|
|
297583
297607
|
for await (const batch of getBatchFromFile(rl, args.batchSize)) {
|
|
297584
|
-
const formData = new
|
|
297608
|
+
const formData = new import_undici21.FormData();
|
|
297585
297609
|
formData.append(
|
|
297586
297610
|
"vectors",
|
|
297587
297611
|
new File([batch.join(`
|
|
@@ -300008,7 +300032,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
300008
300032
|
}
|
|
300009
300033
|
if (props.outFile) {
|
|
300010
300034
|
fs27.mkdirSync(path3__namespace.default.dirname(props.outFile), { recursive: true });
|
|
300011
|
-
const serializedFormData = await new
|
|
300035
|
+
const serializedFormData = await new import_undici22.Response(workerBundle).arrayBuffer();
|
|
300012
300036
|
fs27.writeFileSync(props.outFile, Buffer.from(serializedFormData));
|
|
300013
300037
|
}
|
|
300014
300038
|
} finally {
|
|
@@ -300112,13 +300136,13 @@ function generatePreviewAlias(scriptName) {
|
|
|
300112
300136
|
);
|
|
300113
300137
|
return truncatedAlias || warnAndExit();
|
|
300114
300138
|
}
|
|
300115
|
-
var
|
|
300139
|
+
var import_undici22, versionsUploadCommand, MAX_DNS_LABEL_LENGTH, HASH_LENGTH, ALIAS_VALIDATION_REGEX;
|
|
300116
300140
|
var init_upload5 = __esm({
|
|
300117
300141
|
"src/versions/upload.ts"() {
|
|
300118
300142
|
init_import_meta_url();
|
|
300119
300143
|
init_colors();
|
|
300120
300144
|
init_dist();
|
|
300121
|
-
|
|
300145
|
+
import_undici22 = __toESM(require_undici());
|
|
300122
300146
|
init_assets5();
|
|
300123
300147
|
init_cfetch();
|
|
300124
300148
|
init_create_command();
|
|
@@ -301078,7 +301102,7 @@ async function fetchLocalResult(port, path82, init4) {
|
|
|
301078
301102
|
const url4 = `http://localhost:${port}${LOCAL_EXPLORER_BASE_PATH}${path82}`;
|
|
301079
301103
|
let response;
|
|
301080
301104
|
try {
|
|
301081
|
-
response = await (0,
|
|
301105
|
+
response = await (0, import_undici23.fetch)(url4, {
|
|
301082
301106
|
method: init4?.method ?? "GET",
|
|
301083
301107
|
headers: init4?.headers,
|
|
301084
301108
|
body: init4?.body
|
|
@@ -301135,12 +301159,12 @@ async function updateLocalInstanceStatus(port, workflowName, instanceId, action)
|
|
|
301135
301159
|
}
|
|
301136
301160
|
);
|
|
301137
301161
|
}
|
|
301138
|
-
var
|
|
301162
|
+
var import_undici23, LOCAL_EXPLORER_BASE_PATH, DEFAULT_LOCAL_PORT2, localWorkflowArgs;
|
|
301139
301163
|
var init_local = __esm({
|
|
301140
301164
|
"src/workflows/local.ts"() {
|
|
301141
301165
|
init_import_meta_url();
|
|
301142
301166
|
init_dist();
|
|
301143
|
-
|
|
301167
|
+
import_undici23 = __toESM(require_undici());
|
|
301144
301168
|
init_logger();
|
|
301145
301169
|
LOCAL_EXPLORER_BASE_PATH = "/cdn-cgi/explorer/api";
|
|
301146
301170
|
DEFAULT_LOCAL_PORT2 = 8787;
|
|
@@ -306797,14 +306821,14 @@ function dispatchGenericCommandErrorEvent(dispatcher, startTime, error2) {
|
|
|
306797
306821
|
...sanitizeError(error2)
|
|
306798
306822
|
});
|
|
306799
306823
|
}
|
|
306800
|
-
var
|
|
306824
|
+
var import_undici24;
|
|
306801
306825
|
var init_src2 = __esm({
|
|
306802
306826
|
"src/index.ts"() {
|
|
306803
306827
|
init_import_meta_url();
|
|
306804
306828
|
init_dist7();
|
|
306805
306829
|
init_dist();
|
|
306806
306830
|
init_source();
|
|
306807
|
-
|
|
306831
|
+
import_undici24 = __toESM(require_undici());
|
|
306808
306832
|
init_yargs();
|
|
306809
306833
|
init_package();
|
|
306810
306834
|
init_ai3();
|
|
@@ -307035,8 +307059,8 @@ var init_src2 = __esm({
|
|
|
307035
307059
|
init_trigger();
|
|
307036
307060
|
init_wrangler_banner();
|
|
307037
307061
|
if (proxy) {
|
|
307038
|
-
(0,
|
|
307039
|
-
new
|
|
307062
|
+
(0, import_undici24.setGlobalDispatcher)(
|
|
307063
|
+
new import_undici24.EnvHttpProxyAgent({ noProxy: noProxy || "localhost,127.0.0.1,::1" })
|
|
307040
307064
|
);
|
|
307041
307065
|
logger.warn(
|
|
307042
307066
|
`Proxy environment variables detected. We'll use your proxy for fetch requests.`
|
|
@@ -308828,7 +308852,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
308828
308852
|
}
|
|
308829
308853
|
if (props.outFile) {
|
|
308830
308854
|
fs27.mkdirSync(path3__namespace.default.dirname(props.outFile), { recursive: true });
|
|
308831
|
-
const serializedFormData = await new
|
|
308855
|
+
const serializedFormData = await new import_undici25.Response(workerBundle).arrayBuffer();
|
|
308832
308856
|
fs27.writeFileSync(props.outFile, Buffer.from(serializedFormData));
|
|
308833
308857
|
}
|
|
308834
308858
|
} finally {
|
|
@@ -309062,7 +309086,7 @@ function getDeployConfirmFunction(strictMode = false) {
|
|
|
309062
309086
|
}
|
|
309063
309087
|
return confirm;
|
|
309064
309088
|
}
|
|
309065
|
-
var
|
|
309089
|
+
var import_undici25, validateRoutes3;
|
|
309066
309090
|
var init_deploy7 = __esm({
|
|
309067
309091
|
"src/deploy/deploy.ts"() {
|
|
309068
309092
|
init_import_meta_url();
|
|
@@ -309070,7 +309094,7 @@ var init_deploy7 = __esm({
|
|
|
309070
309094
|
init_containers_shared();
|
|
309071
309095
|
init_dist();
|
|
309072
309096
|
init_dist9();
|
|
309073
|
-
|
|
309097
|
+
import_undici25 = __toESM(require_undici());
|
|
309074
309098
|
init_assets5();
|
|
309075
309099
|
init_cfetch();
|
|
309076
309100
|
init_build3();
|
|
@@ -309333,7 +309357,7 @@ function errorOnLegacyPagesWorkerJSAsset(file3, hasAssetsIgnoreFile) {
|
|
|
309333
309357
|
}
|
|
309334
309358
|
}
|
|
309335
309359
|
}
|
|
309336
|
-
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;
|
|
309337
309361
|
var init_assets5 = __esm({
|
|
309338
309362
|
"src/assets.ts"() {
|
|
309339
309363
|
init_import_meta_url();
|
|
@@ -309344,7 +309368,7 @@ var init_assets5 = __esm({
|
|
|
309344
309368
|
init_source();
|
|
309345
309369
|
init_dist9();
|
|
309346
309370
|
init_pretty_bytes();
|
|
309347
|
-
|
|
309371
|
+
import_undici26 = __toESM(require_undici());
|
|
309348
309372
|
init_cfetch();
|
|
309349
309373
|
init_deploy7();
|
|
309350
309374
|
init_logger();
|
|
@@ -309419,7 +309443,7 @@ var init_assets5 = __esm({
|
|
|
309419
309443
|
attempts = 0;
|
|
309420
309444
|
let gatewayErrors = 0;
|
|
309421
309445
|
const doUpload = /* @__PURE__ */ __name(async () => {
|
|
309422
|
-
const payload = new
|
|
309446
|
+
const payload = new import_undici26.FormData();
|
|
309423
309447
|
const uploadedFiles = [];
|
|
309424
309448
|
for (const manifestEntry of bucket) {
|
|
309425
309449
|
const absFilePath = path3__namespace.join(assetDirectory, manifestEntry[0]);
|
|
@@ -309461,8 +309485,13 @@ var init_assets5 = __esm({
|
|
|
309461
309485
|
return res;
|
|
309462
309486
|
} catch (e9) {
|
|
309463
309487
|
if (attempts < MAX_UPLOAD_ATTEMPTS2) {
|
|
309464
|
-
logger.info(
|
|
309465
|
-
|
|
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);
|
|
309466
309495
|
await new Promise(
|
|
309467
309496
|
(resolvePromise) => setTimeout(resolvePromise, Math.pow(2, attempts) * 1e3)
|
|
309468
309497
|
);
|
|
@@ -312042,7 +312071,7 @@ async function tryExpandToken(exchangeUrl, ctx, abortSignal) {
|
|
|
312042
312071
|
` GET ${switchedExchangeUrl.href}`
|
|
312043
312072
|
);
|
|
312044
312073
|
logger.debug("-- END EXCHANGE API REQUEST");
|
|
312045
|
-
const exchangeResponse = await (0,
|
|
312074
|
+
const exchangeResponse = await (0, import_undici27.fetch)(switchedExchangeUrl, {
|
|
312046
312075
|
signal: abortSignal,
|
|
312047
312076
|
headers
|
|
312048
312077
|
});
|
|
@@ -312166,12 +312195,12 @@ async function createWorkerPreview(complianceConfig, init4, account, ctx, sessio
|
|
|
312166
312195
|
);
|
|
312167
312196
|
return token;
|
|
312168
312197
|
}
|
|
312169
|
-
var
|
|
312198
|
+
var import_undici27, PREVIEW_API_TIMEOUT_MS;
|
|
312170
312199
|
var init_create_worker_preview = __esm({
|
|
312171
312200
|
"src/dev/create-worker-preview.ts"() {
|
|
312172
312201
|
init_import_meta_url();
|
|
312173
312202
|
init_dist();
|
|
312174
|
-
|
|
312203
|
+
import_undici27 = __toESM(require_undici());
|
|
312175
312204
|
init_cfetch();
|
|
312176
312205
|
init_create_worker_upload_form();
|
|
312177
312206
|
init_logger();
|
|
@@ -313312,6 +313341,15 @@ function getUserWorkerInnerUrlOverrides(config) {
|
|
|
313312
313341
|
};
|
|
313313
313342
|
}
|
|
313314
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
|
+
}
|
|
313315
313353
|
async function convertToConfigBundle(event) {
|
|
313316
313354
|
const bindings = { ...event.config.bindings };
|
|
313317
313355
|
const crons = [];
|
|
@@ -313403,8 +313441,7 @@ async function convertToConfigBundle(event) {
|
|
|
313403
313441
|
containerBuildId: event.config.dev?.containerBuildId,
|
|
313404
313442
|
containerEngine: event.config.dev.containerEngine,
|
|
313405
313443
|
enableContainers: event.config.dev.enableContainers ?? true,
|
|
313406
|
-
|
|
313407
|
-
zone: event.config.dev?.origin?.hostname,
|
|
313444
|
+
zone: getZoneForCfWorkerHeader(event.config),
|
|
313408
313445
|
sendMetrics: event.config.sendMetrics,
|
|
313409
313446
|
publicUrl: event.config.dev?.server?.port ? miniflare.buildPublicUrl({
|
|
313410
313447
|
hostname: event.config.dev.server.hostname,
|
|
@@ -313455,6 +313492,7 @@ var init_LocalRuntimeController = __esm({
|
|
|
313455
313492
|
__name(getTextFileContents, "getTextFileContents");
|
|
313456
313493
|
__name(getName3, "getName");
|
|
313457
313494
|
__name(getUserWorkerInnerUrlOverrides, "getUserWorkerInnerUrlOverrides");
|
|
313495
|
+
__name(getZoneForCfWorkerHeader, "getZoneForCfWorkerHeader");
|
|
313458
313496
|
__name(convertToConfigBundle, "convertToConfigBundle");
|
|
313459
313497
|
LocalRuntimeController = class extends RuntimeController {
|
|
313460
313498
|
static {
|
|
@@ -316016,7 +316054,18 @@ async function generateHandler({
|
|
|
316016
316054
|
(async () => {
|
|
316017
316055
|
try {
|
|
316018
316056
|
const links = [];
|
|
316019
|
-
|
|
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(
|
|
316020
316069
|
"link[rel~=preconnect],link[rel~=preload],link[rel~=modulepreload]",
|
|
316021
316070
|
{
|
|
316022
316071
|
element(element) {
|
|
@@ -316038,7 +316087,17 @@ async function generateHandler({
|
|
|
316038
316087
|
).transform(clonedResponse);
|
|
316039
316088
|
await transformedResponse.text();
|
|
316040
316089
|
links.forEach(({ href, rel, as: as2 }) => {
|
|
316041
|
-
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}"`;
|
|
316042
316101
|
if (as2) {
|
|
316043
316102
|
link += `; as=${as2}`;
|
|
316044
316103
|
}
|
|
@@ -316534,7 +316593,7 @@ async function generateAssetsFetch(directory, log2, signal) {
|
|
|
316534
316593
|
return await generateResponse(request4);
|
|
316535
316594
|
};
|
|
316536
316595
|
}
|
|
316537
|
-
var import_mime3,
|
|
316596
|
+
var import_mime3, import_undici28, ProxyDispatcher, invalidAssetsFetch;
|
|
316538
316597
|
var init_assets6 = __esm({
|
|
316539
316598
|
"src/miniflare-cli/assets.ts"() {
|
|
316540
316599
|
init_import_meta_url();
|
|
@@ -316542,11 +316601,11 @@ var init_assets6 = __esm({
|
|
|
316542
316601
|
init_workers_shared();
|
|
316543
316602
|
init_esm6();
|
|
316544
316603
|
import_mime3 = __toESM(require_mime());
|
|
316545
|
-
|
|
316604
|
+
import_undici28 = __toESM(require_undici());
|
|
316546
316605
|
init_logger();
|
|
316547
316606
|
init_hash();
|
|
316548
316607
|
__name(generateASSETSBinding, "generateASSETSBinding");
|
|
316549
|
-
ProxyDispatcher = class _ProxyDispatcher extends
|
|
316608
|
+
ProxyDispatcher = class _ProxyDispatcher extends import_undici28.Dispatcher {
|
|
316550
316609
|
constructor(host) {
|
|
316551
316610
|
super();
|
|
316552
316611
|
this.host = host;
|
|
@@ -316554,7 +316613,7 @@ var init_assets6 = __esm({
|
|
|
316554
316613
|
static {
|
|
316555
316614
|
__name(this, "ProxyDispatcher");
|
|
316556
316615
|
}
|
|
316557
|
-
dispatcher = (0,
|
|
316616
|
+
dispatcher = (0, import_undici28.getGlobalDispatcher)();
|
|
316558
316617
|
dispatch(options, handler) {
|
|
316559
316618
|
if (this.host !== null) {
|
|
316560
316619
|
_ProxyDispatcher.reinstateHostHeader(options.headers, this.host);
|
|
@@ -317016,7 +317075,7 @@ unstable_dev()'s behaviour will likely change in future releases`
|
|
|
317016
317075
|
devServer.unregisterHotKeys?.();
|
|
317017
317076
|
}, "stop"),
|
|
317018
317077
|
fetch: /* @__PURE__ */ __name(async (input, init4) => {
|
|
317019
|
-
return await (0,
|
|
317078
|
+
return await (0, import_undici29.fetch)(
|
|
317020
317079
|
...parseRequestInput(address, port, input, init4, options?.localProtocol)
|
|
317021
317080
|
);
|
|
317022
317081
|
}, "fetch"),
|
|
@@ -317029,7 +317088,7 @@ function parseRequestInput(readyAddress, readyPort, input = "/", init4, protocol
|
|
|
317029
317088
|
if (typeof input === "string") {
|
|
317030
317089
|
input = new URL(input, "http://placeholder");
|
|
317031
317090
|
}
|
|
317032
|
-
const forward = new
|
|
317091
|
+
const forward = new import_undici29.Request(input, init4);
|
|
317033
317092
|
const url4 = new URL(forward.url);
|
|
317034
317093
|
forward.headers.set("MF-Original-URL", url4.toString());
|
|
317035
317094
|
forward.headers.set("MF-Disable-Pretty-Error", "true");
|
|
@@ -317041,12 +317100,12 @@ function parseRequestInput(readyAddress, readyPort, input = "/", init4, protocol
|
|
|
317041
317100
|
}
|
|
317042
317101
|
return [url4, forward];
|
|
317043
317102
|
}
|
|
317044
|
-
var
|
|
317103
|
+
var import_undici29;
|
|
317045
317104
|
var init_dev4 = __esm({
|
|
317046
317105
|
"src/api/dev.ts"() {
|
|
317047
317106
|
init_import_meta_url();
|
|
317048
317107
|
init_dist();
|
|
317049
|
-
|
|
317108
|
+
import_undici29 = __toESM(require_undici());
|
|
317050
317109
|
init_start_dev();
|
|
317051
317110
|
init_experimental_flags();
|
|
317052
317111
|
init_logger();
|
|
@@ -317162,6 +317221,13 @@ var init_executionContext = __esm({
|
|
|
317162
317221
|
function unstable_getDevCompatibilityDate() {
|
|
317163
317222
|
return getTodaysCompatDate();
|
|
317164
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
|
+
}
|
|
317165
317231
|
async function getPlatformProxy(options = {}) {
|
|
317166
317232
|
const env6 = options.environment;
|
|
317167
317233
|
const config = readConfig({
|
|
@@ -317265,6 +317331,7 @@ async function getMiniflareOptionsFromConfig(args) {
|
|
|
317265
317331
|
script: "",
|
|
317266
317332
|
modules: true,
|
|
317267
317333
|
name: config.name,
|
|
317334
|
+
zone: getZoneFromConfig(config),
|
|
317268
317335
|
...bindingOptions,
|
|
317269
317336
|
...assetOptions
|
|
317270
317337
|
},
|
|
@@ -317348,6 +317415,7 @@ function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6, options) {
|
|
|
317348
317415
|
compatibilityFlags: config.compatibility_flags,
|
|
317349
317416
|
modulesRules,
|
|
317350
317417
|
containerEngine: useContainers ? config.dev.container_engine ?? resolveDockerHost(getDockerPath()) : void 0,
|
|
317418
|
+
zone: getZoneFromConfig(config),
|
|
317351
317419
|
...bindingOptions,
|
|
317352
317420
|
...sitesOptions,
|
|
317353
317421
|
...assetOptions
|
|
@@ -317374,6 +317442,7 @@ var init_platform = __esm({
|
|
|
317374
317442
|
init_logger();
|
|
317375
317443
|
init_sites2();
|
|
317376
317444
|
init_dedent();
|
|
317445
|
+
init_zones3();
|
|
317377
317446
|
init_remoteBindings();
|
|
317378
317447
|
init_utils2();
|
|
317379
317448
|
init_caches();
|
|
@@ -317381,6 +317450,7 @@ var init_platform = __esm({
|
|
|
317381
317450
|
init_dev_vars();
|
|
317382
317451
|
init_details2();
|
|
317383
317452
|
__name(unstable_getDevCompatibilityDate, "unstable_getDevCompatibilityDate");
|
|
317453
|
+
__name(getZoneFromConfig, "getZoneFromConfig");
|
|
317384
317454
|
__name(getPlatformProxy, "getPlatformProxy");
|
|
317385
317455
|
__name(getMiniflareOptionsFromConfig, "getMiniflareOptionsFromConfig");
|
|
317386
317456
|
__name(getMiniflarePersistRoot, "getMiniflarePersistRoot");
|