@cloudflare/vite-plugin 2.0.0-beta.v.15 → 2.0.0-beta.v.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs
CHANGED
|
@@ -64350,7 +64350,7 @@ function isInteractive() {
|
|
|
64350
64350
|
//#region ../workers-auth/dist/chunk-VAZEJK55.mjs
|
|
64351
64351
|
createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
|
|
64352
64352
|
var __defProp$2 = Object.defineProperty;
|
|
64353
|
-
var __name$
|
|
64353
|
+
var __name$2 = (target$1, value) => __defProp$2(target$1, "name", {
|
|
64354
64354
|
value,
|
|
64355
64355
|
configurable: true
|
|
64356
64356
|
});
|
|
@@ -64383,7 +64383,7 @@ If you wish to authenticate via an API token then please set the \`CLOUDFLARE_AP
|
|
|
64383
64383
|
}
|
|
64384
64384
|
return {};
|
|
64385
64385
|
}
|
|
64386
|
-
__name$
|
|
64386
|
+
__name$2(readStoredAuthState, "readStoredAuthState");
|
|
64387
64387
|
var getCloudflareAPITokenFromEnv = getEnvironmentVariableFactory({
|
|
64388
64388
|
variableName: "CLOUDFLARE_API_TOKEN",
|
|
64389
64389
|
deprecatedName: "CF_API_TOKEN"
|
|
@@ -64408,7 +64408,7 @@ function getAuthFromEnv(options) {
|
|
|
64408
64408
|
const apiToken = getCloudflareAPITokenFromEnv();
|
|
64409
64409
|
if (apiToken) return { apiToken };
|
|
64410
64410
|
}
|
|
64411
|
-
__name$
|
|
64411
|
+
__name$2(getAuthFromEnv, "getAuthFromEnv");
|
|
64412
64412
|
function getAPIToken(options) {
|
|
64413
64413
|
const envAuth = getAuthFromEnv(options);
|
|
64414
64414
|
if (envAuth) return envAuth;
|
|
@@ -64419,35 +64419,35 @@ function getAPIToken(options) {
|
|
|
64419
64419
|
if (stored.deprecatedApiToken) return { apiToken: stored.deprecatedApiToken };
|
|
64420
64420
|
if (stored.accessToken?.value) return { apiToken: stored.accessToken.value };
|
|
64421
64421
|
}
|
|
64422
|
-
__name$
|
|
64422
|
+
__name$2(getAPIToken, "getAPIToken");
|
|
64423
64423
|
function requireApiToken(options) {
|
|
64424
64424
|
const credentials = getAPIToken(options);
|
|
64425
64425
|
if (!credentials) throw new UserError("No API token found.", { telemetryMessage: "user auth missing api token" });
|
|
64426
64426
|
return credentials;
|
|
64427
64427
|
}
|
|
64428
|
-
__name$
|
|
64428
|
+
__name$2(requireApiToken, "requireApiToken");
|
|
64429
64429
|
var ACCOUNT_ID_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
64430
64430
|
function validateAccountId(accountId, source) {
|
|
64431
64431
|
if (!ACCOUNT_ID_PATTERN.test(accountId)) throw new UserError(`Invalid account ID "${accountId}" ${source}. Account IDs may only contain alphanumeric characters, hyphens, and underscores.`, { telemetryMessage: "user account id invalid characters" });
|
|
64432
64432
|
return accountId;
|
|
64433
64433
|
}
|
|
64434
|
-
__name$
|
|
64434
|
+
__name$2(validateAccountId, "validateAccountId");
|
|
64435
64435
|
var getCloudflareAuthProfileFromEnv = getEnvironmentVariableFactory({ variableName: "CLOUDFLARE_AUTH_PROFILE" });
|
|
64436
64436
|
var getAuthDomainFromEnv = getEnvironmentVariableFactory({
|
|
64437
64437
|
variableName: "WRANGLER_AUTH_DOMAIN",
|
|
64438
|
-
defaultValue: /* @__PURE__ */ __name$
|
|
64438
|
+
defaultValue: /* @__PURE__ */ __name$2(() => getCloudflareApiEnvironmentFromEnv() === "staging" ? "dash.staging.cloudflare.com" : "dash.cloudflare.com", "defaultValue")
|
|
64439
64439
|
});
|
|
64440
64440
|
var getAuthUrlFromEnv = getEnvironmentVariableFactory({
|
|
64441
64441
|
variableName: "WRANGLER_AUTH_URL",
|
|
64442
|
-
defaultValue: /* @__PURE__ */ __name$
|
|
64442
|
+
defaultValue: /* @__PURE__ */ __name$2(() => `https://${getAuthDomainFromEnv()}/oauth2/auth`, "defaultValue")
|
|
64443
64443
|
});
|
|
64444
64444
|
var getTokenUrlFromEnv = getEnvironmentVariableFactory({
|
|
64445
64445
|
variableName: "WRANGLER_TOKEN_URL",
|
|
64446
|
-
defaultValue: /* @__PURE__ */ __name$
|
|
64446
|
+
defaultValue: /* @__PURE__ */ __name$2(() => `https://${getAuthDomainFromEnv()}/oauth2/token`, "defaultValue")
|
|
64447
64447
|
});
|
|
64448
64448
|
var getRevokeUrlFromEnv = getEnvironmentVariableFactory({
|
|
64449
64449
|
variableName: "WRANGLER_REVOKE_URL",
|
|
64450
|
-
defaultValue: /* @__PURE__ */ __name$
|
|
64450
|
+
defaultValue: /* @__PURE__ */ __name$2(() => `https://${getAuthDomainFromEnv()}/oauth2/revoke`, "defaultValue")
|
|
64451
64451
|
});
|
|
64452
64452
|
var readCloudflareAccountIdFromEnv = getEnvironmentVariableFactory({
|
|
64453
64453
|
variableName: "CLOUDFLARE_ACCOUNT_ID",
|
|
@@ -64458,12 +64458,12 @@ function getCloudflareAccountIdFromEnv() {
|
|
|
64458
64458
|
if (!accountId) return;
|
|
64459
64459
|
return validateAccountId(accountId, "set in the `CLOUDFLARE_ACCOUNT_ID` environment variable");
|
|
64460
64460
|
}
|
|
64461
|
-
__name$
|
|
64461
|
+
__name$2(getCloudflareAccountIdFromEnv, "getCloudflareAccountIdFromEnv");
|
|
64462
64462
|
var DEVICE_AUTH_PATH = "/oauth2/device/auth";
|
|
64463
64463
|
function getDeviceAuthUrl() {
|
|
64464
64464
|
return `https://${getAuthDomainFromEnv()}${DEVICE_AUTH_PATH}`;
|
|
64465
64465
|
}
|
|
64466
|
-
__name$
|
|
64466
|
+
__name$2(getDeviceAuthUrl, "getDeviceAuthUrl");
|
|
64467
64467
|
var getAccessClientIdFromEnv = getEnvironmentVariableFactory({ variableName: "CLOUDFLARE_ACCESS_CLIENT_ID" });
|
|
64468
64468
|
var getAccessClientSecretFromEnv = getEnvironmentVariableFactory({ variableName: "CLOUDFLARE_ACCESS_CLIENT_SECRET" });
|
|
64469
64469
|
var getCfAuthorizationTokenFromEnv = getEnvironmentVariableFactory({ variableName: "WRANGLER_CF_AUTHORIZATION_TOKEN" });
|
|
@@ -64475,12 +64475,12 @@ function buildProbeUrl(domain$1, previewToken) {
|
|
|
64475
64475
|
if (previewToken) url2.searchParams.set("cf_workers_preview_token", previewToken);
|
|
64476
64476
|
return url2.toString();
|
|
64477
64477
|
}
|
|
64478
|
-
__name$
|
|
64478
|
+
__name$2(buildProbeUrl, "buildProbeUrl");
|
|
64479
64479
|
function clearAccessCaches() {
|
|
64480
64480
|
for (const key of Object.keys(headersCache)) delete headersCache[key];
|
|
64481
64481
|
usesAccessCache.clear();
|
|
64482
64482
|
}
|
|
64483
|
-
__name$
|
|
64483
|
+
__name$2(clearAccessCaches, "clearAccessCaches");
|
|
64484
64484
|
async function domainUsesAccess(domain$1, logger$2, previewToken) {
|
|
64485
64485
|
logger$2.debug("Checking if domain has Access enabled:", domain$1);
|
|
64486
64486
|
const cacheKey = JSON.stringify([domain$1, Boolean(previewToken)]);
|
|
@@ -64510,7 +64510,7 @@ async function domainUsesAccess(domain$1, logger$2, previewToken) {
|
|
|
64510
64510
|
return false;
|
|
64511
64511
|
}
|
|
64512
64512
|
}
|
|
64513
|
-
__name$
|
|
64513
|
+
__name$2(domainUsesAccess, "domainUsesAccess");
|
|
64514
64514
|
async function getAccessHeaders(domain$1, options) {
|
|
64515
64515
|
const logger$2 = options.logger;
|
|
64516
64516
|
const clientId = getAccessClientIdFromEnv();
|
|
@@ -64546,7 +64546,7 @@ See https://developers.cloudflare.com/cloudflare-one/access-controls/service-cre
|
|
|
64546
64546
|
}
|
|
64547
64547
|
throw new Error("Failed to authenticate with Cloudflare Access");
|
|
64548
64548
|
}
|
|
64549
|
-
__name$
|
|
64549
|
+
__name$2(getAccessHeaders, "getAccessHeaders");
|
|
64550
64550
|
function spawnCloudflaredAccessLogin(loginTarget, signal) {
|
|
64551
64551
|
return new Promise((resolve$3, reject) => {
|
|
64552
64552
|
const child = spawn("cloudflared", [
|
|
@@ -64557,7 +64557,7 @@ function spawnCloudflaredAccessLogin(loginTarget, signal) {
|
|
|
64557
64557
|
const stdoutChunks = [];
|
|
64558
64558
|
child.stdout.on("data", (chunk) => stdoutChunks.push(chunk));
|
|
64559
64559
|
child.stderr.resume();
|
|
64560
|
-
const killChild = /* @__PURE__ */ __name$
|
|
64560
|
+
const killChild = /* @__PURE__ */ __name$2(() => child.kill(), "killChild");
|
|
64561
64561
|
process.once("exit", killChild);
|
|
64562
64562
|
child.on("error", (error$3) => {
|
|
64563
64563
|
process.removeListener("exit", killChild);
|
|
@@ -64580,7 +64580,7 @@ function spawnCloudflaredAccessLogin(loginTarget, signal) {
|
|
|
64580
64580
|
});
|
|
64581
64581
|
});
|
|
64582
64582
|
}
|
|
64583
|
-
__name$
|
|
64583
|
+
__name$2(spawnCloudflaredAccessLogin, "spawnCloudflaredAccessLogin");
|
|
64584
64584
|
async function getCloudflareAccessHeaders(options) {
|
|
64585
64585
|
const cfAuthToken = getCfAuthorizationTokenFromEnv();
|
|
64586
64586
|
if (cfAuthToken !== void 0) {
|
|
@@ -64589,7 +64589,7 @@ async function getCloudflareAccessHeaders(options) {
|
|
|
64589
64589
|
}
|
|
64590
64590
|
return getAccessHeaders(getAuthDomainFromEnv(), options);
|
|
64591
64591
|
}
|
|
64592
|
-
__name$
|
|
64592
|
+
__name$2(getCloudflareAccessHeaders, "getCloudflareAccessHeaders");
|
|
64593
64593
|
var RECOMMENDED_CODE_VERIFIER_LENGTH = 96;
|
|
64594
64594
|
var RECOMMENDED_STATE_LENGTH = 32;
|
|
64595
64595
|
var PKCE_CHARSET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
|
|
@@ -64600,7 +64600,7 @@ function base64urlEncode(value) {
|
|
|
64600
64600
|
base64$3 = base64$3.replace(/=/g, "");
|
|
64601
64601
|
return base64$3;
|
|
64602
64602
|
}
|
|
64603
|
-
__name$
|
|
64603
|
+
__name$2(base64urlEncode, "base64urlEncode");
|
|
64604
64604
|
async function generatePKCECodes() {
|
|
64605
64605
|
const output$1 = new Uint32Array(RECOMMENDED_CODE_VERIFIER_LENGTH);
|
|
64606
64606
|
webcrypto.getRandomValues(output$1);
|
|
@@ -64615,8 +64615,8 @@ async function generatePKCECodes() {
|
|
|
64615
64615
|
codeVerifier
|
|
64616
64616
|
};
|
|
64617
64617
|
}
|
|
64618
|
-
__name$
|
|
64619
|
-
var generateVerificationUrl = /* @__PURE__ */ __name$
|
|
64618
|
+
__name$2(generatePKCECodes, "generatePKCECodes");
|
|
64619
|
+
var generateVerificationUrl = /* @__PURE__ */ __name$2(({ verificationUri, userCode }) => {
|
|
64620
64620
|
const url2 = new URL(verificationUri);
|
|
64621
64621
|
url2.searchParams.set("user_code", userCode);
|
|
64622
64622
|
return url2.toString();
|
|
@@ -64628,15 +64628,15 @@ function parseUrl(value) {
|
|
|
64628
64628
|
return;
|
|
64629
64629
|
}
|
|
64630
64630
|
}
|
|
64631
|
-
__name$
|
|
64631
|
+
__name$2(parseUrl, "parseUrl");
|
|
64632
64632
|
function assertTrustedVerificationUrl(verificationUrl, options) {
|
|
64633
64633
|
const url2 = parseUrl(verificationUrl);
|
|
64634
64634
|
const expected = parseUrl(`https://${options.authDomain}`);
|
|
64635
64635
|
if (!(url2 !== void 0 && expected !== void 0 && url2.protocol === "https:" && url2.username === "" && url2.password === "" && url2.host === expected.host)) throw new UserError(`The authorization server returned an untrusted \`${options.field}\`: ${verificationUrl}
|
|
64636
64636
|
Expected an \`https\` URL on \`${options.authDomain}\`. Refusing to display or open it.`, { telemetryMessage: "user device-flow untrusted verification url" });
|
|
64637
64637
|
}
|
|
64638
|
-
__name$
|
|
64639
|
-
var generateAuthUrl = /* @__PURE__ */ __name$
|
|
64638
|
+
__name$2(assertTrustedVerificationUrl, "assertTrustedVerificationUrl");
|
|
64639
|
+
var generateAuthUrl = /* @__PURE__ */ __name$2(({ authUrl, clientId, scopes, stateQueryParam, codeChallenge, redirectUri }) => {
|
|
64640
64640
|
return authUrl + `?response_type=code&client_id=${encodeURIComponent(clientId)}&redirect_uri=${encodeURIComponent(redirectUri)}&scope=${encodeURIComponent([...scopes, "offline_access"].join(" "))}&state=${stateQueryParam}&code_challenge=${encodeURIComponent(codeChallenge)}&code_challenge_method=S256`;
|
|
64641
64641
|
}, "generateAuthUrl");
|
|
64642
64642
|
function generateRandomState(lengthOfState) {
|
|
@@ -64644,7 +64644,7 @@ function generateRandomState(lengthOfState) {
|
|
|
64644
64644
|
webcrypto.getRandomValues(output$1);
|
|
64645
64645
|
return Array.from(output$1).map((num) => PKCE_CHARSET[num % PKCE_CHARSET.length]).join("");
|
|
64646
64646
|
}
|
|
64647
|
-
__name$
|
|
64647
|
+
__name$2(generateRandomState, "generateRandomState");
|
|
64648
64648
|
var POW_MAX_ITERATIONS = 64e6;
|
|
64649
64649
|
function solvePow(seed, k, g) {
|
|
64650
64650
|
const checkpoints = new Array(k + 1);
|
|
@@ -64656,11 +64656,11 @@ function solvePow(seed, k, g) {
|
|
|
64656
64656
|
}
|
|
64657
64657
|
return checkpoints;
|
|
64658
64658
|
}
|
|
64659
|
-
__name$
|
|
64659
|
+
__name$2(solvePow, "solvePow");
|
|
64660
64660
|
function encodeCheckpoints(checkpoints) {
|
|
64661
64661
|
return Buffer.concat(checkpoints).toString("base64");
|
|
64662
64662
|
}
|
|
64663
|
-
__name$
|
|
64663
|
+
__name$2(encodeCheckpoints, "encodeCheckpoints");
|
|
64664
64664
|
function solveChallenge(challenge) {
|
|
64665
64665
|
const checkpoints = solvePow(Buffer.from(challenge.seed, "base64url"), challenge.k, challenge.g);
|
|
64666
64666
|
return {
|
|
@@ -64668,7 +64668,7 @@ function solveChallenge(challenge) {
|
|
|
64668
64668
|
solution: { checkpoints: encodeCheckpoints(checkpoints) }
|
|
64669
64669
|
};
|
|
64670
64670
|
}
|
|
64671
|
-
__name$
|
|
64671
|
+
__name$2(solveChallenge, "solveChallenge");
|
|
64672
64672
|
var DEFAULT_TEMPORARY_ACCOUNT_FLAG = "--temporary-account";
|
|
64673
64673
|
var TEMPORARY_TERMS_URLS = {
|
|
64674
64674
|
termsOfService: "https://www.cloudflare.com/terms/",
|
|
@@ -64715,7 +64715,7 @@ function getResponseErrorCode(body) {
|
|
|
64715
64715
|
if (typeof error$3 !== "object" || error$3 === null || !("code" in error$3)) return;
|
|
64716
64716
|
return typeof error$3.code === "number" ? error$3.code : void 0;
|
|
64717
64717
|
}
|
|
64718
|
-
__name$
|
|
64718
|
+
__name$2(getResponseErrorCode, "getResponseErrorCode");
|
|
64719
64719
|
async function getEventAccountError(response) {
|
|
64720
64720
|
let body;
|
|
64721
64721
|
try {
|
|
@@ -64731,27 +64731,27 @@ async function getEventAccountError(response) {
|
|
|
64731
64731
|
if (eventError.fatal) return new FatalError(eventError.message, options);
|
|
64732
64732
|
return new UserError(eventError.message, options);
|
|
64733
64733
|
}
|
|
64734
|
-
__name$
|
|
64734
|
+
__name$2(getEventAccountError, "getEventAccountError");
|
|
64735
64735
|
function getTemporaryPreviewUrl() {
|
|
64736
64736
|
return `${getCloudflareApiBaseUrl(COMPLIANCE_REGION_CONFIG_PUBLIC)}/provisioning/previews`;
|
|
64737
64737
|
}
|
|
64738
|
-
__name$
|
|
64738
|
+
__name$2(getTemporaryPreviewUrl, "getTemporaryPreviewUrl");
|
|
64739
64739
|
function getTemporaryPreviewChallengeUrl() {
|
|
64740
64740
|
return `${getTemporaryPreviewUrl()}/challenge`;
|
|
64741
64741
|
}
|
|
64742
|
-
__name$
|
|
64742
|
+
__name$2(getTemporaryPreviewChallengeUrl, "getTemporaryPreviewChallengeUrl");
|
|
64743
64743
|
function isFutureTimestamp(timestamp) {
|
|
64744
64744
|
const parsed = Date.parse(timestamp);
|
|
64745
64745
|
return !Number.isNaN(parsed) && parsed > Date.now();
|
|
64746
64746
|
}
|
|
64747
|
-
__name$
|
|
64747
|
+
__name$2(isFutureTimestamp, "isFutureTimestamp");
|
|
64748
64748
|
function getCachedTemporaryPreviewAccount(storage) {
|
|
64749
64749
|
const temporaryPreviewAccount = storage.read();
|
|
64750
64750
|
if (!temporaryPreviewAccount) return;
|
|
64751
64751
|
if (!temporaryPreviewAccount.account?.id || !temporaryPreviewAccount.account?.apiToken || !temporaryPreviewAccount.account?.name || !temporaryPreviewAccount.claim?.url || !isFutureTimestamp(temporaryPreviewAccount.account?.expiresAt ?? "") || !isFutureTimestamp(temporaryPreviewAccount.claim?.expiresAt ?? "")) return;
|
|
64752
64752
|
return temporaryPreviewAccount;
|
|
64753
64753
|
}
|
|
64754
|
-
__name$
|
|
64754
|
+
__name$2(getCachedTemporaryPreviewAccount, "getCachedTemporaryPreviewAccount");
|
|
64755
64755
|
async function requestPowSolution(temporaryAccountLogger, cliDisplayName) {
|
|
64756
64756
|
const headers = new import_undici$2.Headers({ "Content-Type": "application/json" });
|
|
64757
64757
|
addCustomApiHeaders(headers);
|
|
@@ -64778,7 +64778,7 @@ async function requestPowSolution(temporaryAccountLogger, cliDisplayName) {
|
|
|
64778
64778
|
g
|
|
64779
64779
|
});
|
|
64780
64780
|
}
|
|
64781
|
-
__name$
|
|
64781
|
+
__name$2(requestPowSolution, "requestPowSolution");
|
|
64782
64782
|
async function createTemporaryPreviewAccount(temporaryAccountLogger, request$2, cliDisplayName = "Wrangler") {
|
|
64783
64783
|
const pow = await requestPowSolution(temporaryAccountLogger, cliDisplayName);
|
|
64784
64784
|
const headers = new import_undici$2.Headers({ "Content-Type": "application/json" });
|
|
@@ -64831,7 +64831,7 @@ async function createTemporaryPreviewAccount(temporaryAccountLogger, request$2,
|
|
|
64831
64831
|
}
|
|
64832
64832
|
};
|
|
64833
64833
|
}
|
|
64834
|
-
__name$
|
|
64834
|
+
__name$2(createTemporaryPreviewAccount, "createTemporaryPreviewAccount");
|
|
64835
64835
|
async function getOrCreateTemporaryPreviewAccount(options) {
|
|
64836
64836
|
const cachedPreviewAccount = getCachedTemporaryPreviewAccount(options.storage);
|
|
64837
64837
|
if (cachedPreviewAccount) {
|
|
@@ -64849,7 +64849,7 @@ async function getOrCreateTemporaryPreviewAccount(options) {
|
|
|
64849
64849
|
cached: false
|
|
64850
64850
|
};
|
|
64851
64851
|
}
|
|
64852
|
-
__name$
|
|
64852
|
+
__name$2(getOrCreateTemporaryPreviewAccount, "getOrCreateTemporaryPreviewAccount");
|
|
64853
64853
|
function dedent(templ) {
|
|
64854
64854
|
var values = [];
|
|
64855
64855
|
for (var _i = 1; _i < arguments.length; _i++) values[_i - 1] = arguments[_i];
|
|
@@ -64882,11 +64882,11 @@ function dedent(templ) {
|
|
|
64882
64882
|
});
|
|
64883
64883
|
return string$2;
|
|
64884
64884
|
}
|
|
64885
|
-
__name$
|
|
64885
|
+
__name$2(dedent, "dedent");
|
|
64886
64886
|
var esm_default = dedent;
|
|
64887
64887
|
var ErrorOAuth2 = class extends UserError {
|
|
64888
64888
|
static {
|
|
64889
|
-
__name$
|
|
64889
|
+
__name$2(this, "ErrorOAuth2");
|
|
64890
64890
|
}
|
|
64891
64891
|
/** The OAuth `error` code returned by the provider (e.g. `invalid_scope`). */
|
|
64892
64892
|
code;
|
|
@@ -64900,7 +64900,7 @@ var ErrorOAuth2 = class extends UserError {
|
|
|
64900
64900
|
};
|
|
64901
64901
|
var ErrorUnknown = class extends ErrorOAuth2 {
|
|
64902
64902
|
static {
|
|
64903
|
-
__name$
|
|
64903
|
+
__name$2(this, "ErrorUnknown");
|
|
64904
64904
|
}
|
|
64905
64905
|
toString() {
|
|
64906
64906
|
return "ErrorUnknown";
|
|
@@ -64908,7 +64908,7 @@ var ErrorUnknown = class extends ErrorOAuth2 {
|
|
|
64908
64908
|
};
|
|
64909
64909
|
var ErrorAuthServerUnreachable = class extends ErrorOAuth2 {
|
|
64910
64910
|
static {
|
|
64911
|
-
__name$
|
|
64911
|
+
__name$2(this, "ErrorAuthServerUnreachable");
|
|
64912
64912
|
}
|
|
64913
64913
|
toString() {
|
|
64914
64914
|
return "ErrorAuthServerUnreachable";
|
|
@@ -64916,7 +64916,7 @@ var ErrorAuthServerUnreachable = class extends ErrorOAuth2 {
|
|
|
64916
64916
|
};
|
|
64917
64917
|
var ErrorNoAuthCode = class extends ErrorOAuth2 {
|
|
64918
64918
|
static {
|
|
64919
|
-
__name$
|
|
64919
|
+
__name$2(this, "ErrorNoAuthCode");
|
|
64920
64920
|
}
|
|
64921
64921
|
toString() {
|
|
64922
64922
|
return "ErrorNoAuthCode";
|
|
@@ -64924,7 +64924,7 @@ var ErrorNoAuthCode = class extends ErrorOAuth2 {
|
|
|
64924
64924
|
};
|
|
64925
64925
|
var ErrorInvalidReturnedStateParam = class extends ErrorOAuth2 {
|
|
64926
64926
|
static {
|
|
64927
|
-
__name$
|
|
64927
|
+
__name$2(this, "ErrorInvalidReturnedStateParam");
|
|
64928
64928
|
}
|
|
64929
64929
|
toString() {
|
|
64930
64930
|
return "ErrorInvalidReturnedStateParam";
|
|
@@ -64932,7 +64932,7 @@ var ErrorInvalidReturnedStateParam = class extends ErrorOAuth2 {
|
|
|
64932
64932
|
};
|
|
64933
64933
|
var ErrorInvalidJson = class extends ErrorOAuth2 {
|
|
64934
64934
|
static {
|
|
64935
|
-
__name$
|
|
64935
|
+
__name$2(this, "ErrorInvalidJson");
|
|
64936
64936
|
}
|
|
64937
64937
|
toString() {
|
|
64938
64938
|
return "ErrorInvalidJson";
|
|
@@ -64940,7 +64940,7 @@ var ErrorInvalidJson = class extends ErrorOAuth2 {
|
|
|
64940
64940
|
};
|
|
64941
64941
|
var ErrorInvalidScope = class extends ErrorOAuth2 {
|
|
64942
64942
|
static {
|
|
64943
|
-
__name$
|
|
64943
|
+
__name$2(this, "ErrorInvalidScope");
|
|
64944
64944
|
}
|
|
64945
64945
|
toString() {
|
|
64946
64946
|
return "ErrorInvalidScope";
|
|
@@ -64948,7 +64948,7 @@ var ErrorInvalidScope = class extends ErrorOAuth2 {
|
|
|
64948
64948
|
};
|
|
64949
64949
|
var ErrorInvalidRequest = class extends ErrorOAuth2 {
|
|
64950
64950
|
static {
|
|
64951
|
-
__name$
|
|
64951
|
+
__name$2(this, "ErrorInvalidRequest");
|
|
64952
64952
|
}
|
|
64953
64953
|
toString() {
|
|
64954
64954
|
return "ErrorInvalidRequest";
|
|
@@ -64956,7 +64956,7 @@ var ErrorInvalidRequest = class extends ErrorOAuth2 {
|
|
|
64956
64956
|
};
|
|
64957
64957
|
var ErrorInvalidToken = class extends ErrorOAuth2 {
|
|
64958
64958
|
static {
|
|
64959
|
-
__name$
|
|
64959
|
+
__name$2(this, "ErrorInvalidToken");
|
|
64960
64960
|
}
|
|
64961
64961
|
toString() {
|
|
64962
64962
|
return "ErrorInvalidToken";
|
|
@@ -64964,7 +64964,7 @@ var ErrorInvalidToken = class extends ErrorOAuth2 {
|
|
|
64964
64964
|
};
|
|
64965
64965
|
var ErrorAuthenticationGrant = class extends ErrorOAuth2 {
|
|
64966
64966
|
static {
|
|
64967
|
-
__name$
|
|
64967
|
+
__name$2(this, "ErrorAuthenticationGrant");
|
|
64968
64968
|
}
|
|
64969
64969
|
toString() {
|
|
64970
64970
|
return "ErrorAuthenticationGrant";
|
|
@@ -64972,7 +64972,7 @@ var ErrorAuthenticationGrant = class extends ErrorOAuth2 {
|
|
|
64972
64972
|
};
|
|
64973
64973
|
var ErrorUnauthorizedClient = class extends ErrorAuthenticationGrant {
|
|
64974
64974
|
static {
|
|
64975
|
-
__name$
|
|
64975
|
+
__name$2(this, "ErrorUnauthorizedClient");
|
|
64976
64976
|
}
|
|
64977
64977
|
toString() {
|
|
64978
64978
|
return "ErrorUnauthorizedClient";
|
|
@@ -64980,7 +64980,7 @@ var ErrorUnauthorizedClient = class extends ErrorAuthenticationGrant {
|
|
|
64980
64980
|
};
|
|
64981
64981
|
var ErrorAccessDenied = class extends ErrorAuthenticationGrant {
|
|
64982
64982
|
static {
|
|
64983
|
-
__name$
|
|
64983
|
+
__name$2(this, "ErrorAccessDenied");
|
|
64984
64984
|
}
|
|
64985
64985
|
toString() {
|
|
64986
64986
|
return "ErrorAccessDenied";
|
|
@@ -64988,7 +64988,7 @@ var ErrorAccessDenied = class extends ErrorAuthenticationGrant {
|
|
|
64988
64988
|
};
|
|
64989
64989
|
var ErrorUnsupportedResponseType = class extends ErrorAuthenticationGrant {
|
|
64990
64990
|
static {
|
|
64991
|
-
__name$
|
|
64991
|
+
__name$2(this, "ErrorUnsupportedResponseType");
|
|
64992
64992
|
}
|
|
64993
64993
|
toString() {
|
|
64994
64994
|
return "ErrorUnsupportedResponseType";
|
|
@@ -64996,7 +64996,7 @@ var ErrorUnsupportedResponseType = class extends ErrorAuthenticationGrant {
|
|
|
64996
64996
|
};
|
|
64997
64997
|
var ErrorServerError = class extends ErrorAuthenticationGrant {
|
|
64998
64998
|
static {
|
|
64999
|
-
__name$
|
|
64999
|
+
__name$2(this, "ErrorServerError");
|
|
65000
65000
|
}
|
|
65001
65001
|
toString() {
|
|
65002
65002
|
return "ErrorServerError";
|
|
@@ -65004,7 +65004,7 @@ var ErrorServerError = class extends ErrorAuthenticationGrant {
|
|
|
65004
65004
|
};
|
|
65005
65005
|
var ErrorTemporarilyUnavailable = class extends ErrorAuthenticationGrant {
|
|
65006
65006
|
static {
|
|
65007
|
-
__name$
|
|
65007
|
+
__name$2(this, "ErrorTemporarilyUnavailable");
|
|
65008
65008
|
}
|
|
65009
65009
|
toString() {
|
|
65010
65010
|
return "ErrorTemporarilyUnavailable";
|
|
@@ -65012,7 +65012,7 @@ var ErrorTemporarilyUnavailable = class extends ErrorAuthenticationGrant {
|
|
|
65012
65012
|
};
|
|
65013
65013
|
var ErrorAccessTokenResponse = class extends ErrorOAuth2 {
|
|
65014
65014
|
static {
|
|
65015
|
-
__name$
|
|
65015
|
+
__name$2(this, "ErrorAccessTokenResponse");
|
|
65016
65016
|
}
|
|
65017
65017
|
toString() {
|
|
65018
65018
|
return "ErrorAccessTokenResponse";
|
|
@@ -65020,7 +65020,7 @@ var ErrorAccessTokenResponse = class extends ErrorOAuth2 {
|
|
|
65020
65020
|
};
|
|
65021
65021
|
var ErrorInvalidClient = class extends ErrorAccessTokenResponse {
|
|
65022
65022
|
static {
|
|
65023
|
-
__name$
|
|
65023
|
+
__name$2(this, "ErrorInvalidClient");
|
|
65024
65024
|
}
|
|
65025
65025
|
toString() {
|
|
65026
65026
|
return "ErrorInvalidClient";
|
|
@@ -65028,7 +65028,7 @@ var ErrorInvalidClient = class extends ErrorAccessTokenResponse {
|
|
|
65028
65028
|
};
|
|
65029
65029
|
var ErrorInvalidGrant = class extends ErrorAccessTokenResponse {
|
|
65030
65030
|
static {
|
|
65031
|
-
__name$
|
|
65031
|
+
__name$2(this, "ErrorInvalidGrant");
|
|
65032
65032
|
}
|
|
65033
65033
|
toString() {
|
|
65034
65034
|
return "ErrorInvalidGrant";
|
|
@@ -65036,7 +65036,7 @@ var ErrorInvalidGrant = class extends ErrorAccessTokenResponse {
|
|
|
65036
65036
|
};
|
|
65037
65037
|
var ErrorUnsupportedGrantType = class extends ErrorAccessTokenResponse {
|
|
65038
65038
|
static {
|
|
65039
|
-
__name$
|
|
65039
|
+
__name$2(this, "ErrorUnsupportedGrantType");
|
|
65040
65040
|
}
|
|
65041
65041
|
toString() {
|
|
65042
65042
|
return "ErrorUnsupportedGrantType";
|
|
@@ -65050,11 +65050,11 @@ function formatOAuthErrorMessage(code, description, uri) {
|
|
|
65050
65050
|
See: ${escapeOAuthErrorText(uri)}`;
|
|
65051
65051
|
return message;
|
|
65052
65052
|
}
|
|
65053
|
-
__name$
|
|
65053
|
+
__name$2(formatOAuthErrorMessage, "formatOAuthErrorMessage");
|
|
65054
65054
|
function escapeOAuthErrorText(value) {
|
|
65055
65055
|
return value.replace(/[\u0000-\u001f\u007f-\u009f]/g, (character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
65056
65056
|
}
|
|
65057
|
-
__name$
|
|
65057
|
+
__name$2(escapeOAuthErrorText, "escapeOAuthErrorText");
|
|
65058
65058
|
function toErrorClass(rawError, description, uri) {
|
|
65059
65059
|
const message = formatOAuthErrorMessage(rawError, description, uri);
|
|
65060
65060
|
let error$3;
|
|
@@ -65104,7 +65104,7 @@ function toErrorClass(rawError, description, uri) {
|
|
|
65104
65104
|
error$3.uri = uri;
|
|
65105
65105
|
return error$3;
|
|
65106
65106
|
}
|
|
65107
|
-
__name$
|
|
65107
|
+
__name$2(toErrorClass, "toErrorClass");
|
|
65108
65108
|
var TOKEN_REQUEST_TIMEOUT_MS = 3e4;
|
|
65109
65109
|
function isReturningFromAuthServer(query, state, logger$2) {
|
|
65110
65110
|
const stateQueryParam = query.state;
|
|
@@ -65120,7 +65120,7 @@ function isReturningFromAuthServer(query, state, logger$2) {
|
|
|
65120
65120
|
state.hasAuthCodeBeenExchangedForAccessToken = false;
|
|
65121
65121
|
return true;
|
|
65122
65122
|
}
|
|
65123
|
-
__name$
|
|
65123
|
+
__name$2(isReturningFromAuthServer, "isReturningFromAuthServer");
|
|
65124
65124
|
async function getAuthURL(scopes, clientId, redirectUri, state, generators) {
|
|
65125
65125
|
const { codeChallenge, codeVerifier } = await generatePKCECodes();
|
|
65126
65126
|
const stateQueryParam = generators.generateRandomState(RECOMMENDED_STATE_LENGTH);
|
|
@@ -65138,7 +65138,7 @@ async function getAuthURL(scopes, clientId, redirectUri, state, generators) {
|
|
|
65138
65138
|
redirectUri
|
|
65139
65139
|
});
|
|
65140
65140
|
}
|
|
65141
|
-
__name$
|
|
65141
|
+
__name$2(getAuthURL, "getAuthURL");
|
|
65142
65142
|
async function exchangeRefreshTokenForAccessToken(logger$2, isNonInteractiveOrCI2, clientId, storage, cliDisplayName) {
|
|
65143
65143
|
const storedRefreshToken = readStoredAuthState({
|
|
65144
65144
|
warningLogger: logger$2,
|
|
@@ -65176,7 +65176,7 @@ async function exchangeRefreshTokenForAccessToken(logger$2, isNonInteractiveOrCI
|
|
|
65176
65176
|
else throw error$3;
|
|
65177
65177
|
}
|
|
65178
65178
|
}
|
|
65179
|
-
__name$
|
|
65179
|
+
__name$2(exchangeRefreshTokenForAccessToken, "exchangeRefreshTokenForAccessToken");
|
|
65180
65180
|
async function exchangeAuthCodeForAccessToken(state, logger$2, isNonInteractiveOrCI2, clientId, redirectUri, cliDisplayName) {
|
|
65181
65181
|
const { authorizationCode, codeVerifier = "" } = state;
|
|
65182
65182
|
if (!codeVerifier) logger$2.warn("No code verifier is being sent.");
|
|
@@ -65206,7 +65206,7 @@ async function exchangeAuthCodeForAccessToken(state, logger$2, isNonInteractiveO
|
|
|
65206
65206
|
refreshToken: refresh_token ? { value: refresh_token } : void 0
|
|
65207
65207
|
};
|
|
65208
65208
|
}
|
|
65209
|
-
__name$
|
|
65209
|
+
__name$2(exchangeAuthCodeForAccessToken, "exchangeAuthCodeForAccessToken");
|
|
65210
65210
|
async function fetchAuthToken(body, logger$2, isNonInteractiveOrCI2, cliDisplayName) {
|
|
65211
65211
|
const headers = { "Content-Type": "application/x-www-form-urlencoded" };
|
|
65212
65212
|
logger$2.debug("fetching auth token", `grant_type=${body.get("grant_type") ?? "<unknown>"}`);
|
|
@@ -65239,7 +65239,7 @@ async function fetchAuthToken(body, logger$2, isNonInteractiveOrCI2, cliDisplayN
|
|
|
65239
65239
|
});
|
|
65240
65240
|
}
|
|
65241
65241
|
}
|
|
65242
|
-
__name$
|
|
65242
|
+
__name$2(fetchAuthToken, "fetchAuthToken");
|
|
65243
65243
|
async function getJSONFromResponse(response, logger$2) {
|
|
65244
65244
|
const text = await response.text();
|
|
65245
65245
|
try {
|
|
@@ -65253,9 +65253,9 @@ async function getJSONFromResponse(response, logger$2) {
|
|
|
65253
65253
|
throw new Error(`Invalid JSON in response: status: ${response.status} ${response.statusText}`, { cause: e });
|
|
65254
65254
|
}
|
|
65255
65255
|
}
|
|
65256
|
-
__name$
|
|
65256
|
+
__name$2(getJSONFromResponse, "getJSONFromResponse");
|
|
65257
65257
|
function renderOauthErrorPage(cliDisplayName, detail) {
|
|
65258
|
-
const escape = /* @__PURE__ */ __name$
|
|
65258
|
+
const escape = /* @__PURE__ */ __name$2((value) => value.replace(/[&<>"']/g, (character) => ({
|
|
65259
65259
|
"&": "&",
|
|
65260
65260
|
"<": "<",
|
|
65261
65261
|
">": ">",
|
|
@@ -65288,7 +65288,7 @@ function renderOauthErrorPage(cliDisplayName, detail) {
|
|
|
65288
65288
|
</html>
|
|
65289
65289
|
`;
|
|
65290
65290
|
}
|
|
65291
|
-
__name$
|
|
65291
|
+
__name$2(renderOauthErrorPage, "renderOauthErrorPage");
|
|
65292
65292
|
async function getOauthToken(options, state, ctx, generators) {
|
|
65293
65293
|
const urlToOpen = await getAuthURL(options.scopes, options.clientId, options.redirectUri, state, generators);
|
|
65294
65294
|
const callbackPath = new URL(options.redirectUri).pathname;
|
|
@@ -65314,12 +65314,12 @@ async function getOauthToken(options, state, ctx, generators) {
|
|
|
65314
65314
|
}
|
|
65315
65315
|
});
|
|
65316
65316
|
}
|
|
65317
|
-
__name$
|
|
65317
|
+
__name$2(finish, "finish");
|
|
65318
65318
|
function renderErrorPage(detail) {
|
|
65319
65319
|
res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
|
|
65320
65320
|
res.end(renderOauthErrorPage(ctx.cliDisplayName, detail));
|
|
65321
65321
|
}
|
|
65322
|
-
__name$
|
|
65322
|
+
__name$2(renderErrorPage, "renderErrorPage");
|
|
65323
65323
|
assert(req.url, "This request doesn't have a URL");
|
|
65324
65324
|
const { pathname, query } = url.parse(req.url, true);
|
|
65325
65325
|
if (req.method !== "GET") return res.end("OK");
|
|
@@ -65393,7 +65393,7 @@ If you have changed the callback host or port because you are running in a conta
|
|
|
65393
65393
|
} else ctx.logger.log(`Visit this link to authenticate: ${urlToOpen}`);
|
|
65394
65394
|
return Promise.race([timerPromise, loginPromise]);
|
|
65395
65395
|
}
|
|
65396
|
-
__name$
|
|
65396
|
+
__name$2(getOauthToken, "getOauthToken");
|
|
65397
65397
|
var DEVICE_FLOW_MAX_DURATION_SECONDS = 300;
|
|
65398
65398
|
var DEVICE_FLOW_MIN_POLL_INTERVAL_SECONDS = 1;
|
|
65399
65399
|
function getStringMember(body, key) {
|
|
@@ -65401,23 +65401,23 @@ function getStringMember(body, key) {
|
|
|
65401
65401
|
const value = body[key];
|
|
65402
65402
|
return typeof value === "string" && value !== "" ? value : void 0;
|
|
65403
65403
|
}
|
|
65404
|
-
__name$
|
|
65404
|
+
__name$2(getStringMember, "getStringMember");
|
|
65405
65405
|
function getPositiveNumberMember(body, key) {
|
|
65406
65406
|
if (typeof body !== "object" || body === null) return;
|
|
65407
65407
|
const value = body[key];
|
|
65408
65408
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
|
|
65409
65409
|
}
|
|
65410
|
-
__name$
|
|
65410
|
+
__name$2(getPositiveNumberMember, "getPositiveNumberMember");
|
|
65411
65411
|
function describeUnusableResponse(response, body) {
|
|
65412
65412
|
const status$1 = `HTTP ${response.status} ${response.statusText}`.trim();
|
|
65413
65413
|
const description = getStringMember(body, "error_description");
|
|
65414
65414
|
return description ? `${status$1}: ${description}` : status$1;
|
|
65415
65415
|
}
|
|
65416
|
-
__name$
|
|
65416
|
+
__name$2(describeUnusableResponse, "describeUnusableResponse");
|
|
65417
65417
|
function isRetryableStatus(status$1) {
|
|
65418
65418
|
return status$1 >= 500 || status$1 === 429;
|
|
65419
65419
|
}
|
|
65420
|
-
__name$
|
|
65420
|
+
__name$2(isRetryableStatus, "isRetryableStatus");
|
|
65421
65421
|
function asDeviceAuthorizationResponse(body) {
|
|
65422
65422
|
const deviceCode = getStringMember(body, "device_code");
|
|
65423
65423
|
const userCode = getStringMember(body, "user_code");
|
|
@@ -65433,7 +65433,7 @@ function asDeviceAuthorizationResponse(body) {
|
|
|
65433
65433
|
interval: getPositiveNumberMember(body, "interval")
|
|
65434
65434
|
};
|
|
65435
65435
|
}
|
|
65436
|
-
__name$
|
|
65436
|
+
__name$2(asDeviceAuthorizationResponse, "asDeviceAuthorizationResponse");
|
|
65437
65437
|
async function readJson(response, logger$2) {
|
|
65438
65438
|
const text = await response.text();
|
|
65439
65439
|
try {
|
|
@@ -65447,7 +65447,7 @@ async function readJson(response, logger$2) {
|
|
|
65447
65447
|
throw new Error(`Invalid JSON in response: status: ${response.status} ${response.statusText}`, { cause: e });
|
|
65448
65448
|
}
|
|
65449
65449
|
}
|
|
65450
|
-
__name$
|
|
65450
|
+
__name$2(readJson, "readJson");
|
|
65451
65451
|
async function buildDeviceAuthHeaders(logger$2, isNonInteractiveOrCI2, cliDisplayName) {
|
|
65452
65452
|
const headers = { "Content-Type": "application/x-www-form-urlencoded" };
|
|
65453
65453
|
if (await domainUsesAccess(getAuthDomainFromEnv(), logger$2)) {
|
|
@@ -65460,7 +65460,7 @@ async function buildDeviceAuthHeaders(logger$2, isNonInteractiveOrCI2, cliDispla
|
|
|
65460
65460
|
}
|
|
65461
65461
|
return headers;
|
|
65462
65462
|
}
|
|
65463
|
-
__name$
|
|
65463
|
+
__name$2(buildDeviceAuthHeaders, "buildDeviceAuthHeaders");
|
|
65464
65464
|
async function requestDeviceAuthorization(scopes, clientId, logger$2, isNonInteractiveOrCI2, cliDisplayName) {
|
|
65465
65465
|
const params = new URLSearchParams({
|
|
65466
65466
|
client_id: clientId,
|
|
@@ -65487,7 +65487,7 @@ Enable debug logging to see the full response.`, { telemetryMessage: "user devic
|
|
|
65487
65487
|
}
|
|
65488
65488
|
return deviceAuth;
|
|
65489
65489
|
}
|
|
65490
|
-
__name$
|
|
65490
|
+
__name$2(requestDeviceAuthorization, "requestDeviceAuthorization");
|
|
65491
65491
|
async function pollDeviceToken(deviceCode, clientId, logger$2, isNonInteractiveOrCI2, cliDisplayName) {
|
|
65492
65492
|
const response = await fetchAuthToken(new URLSearchParams({
|
|
65493
65493
|
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
@@ -65520,11 +65520,11 @@ async function pollDeviceToken(deviceCode, clientId, logger$2, isNonInteractiveO
|
|
|
65520
65520
|
}
|
|
65521
65521
|
};
|
|
65522
65522
|
}
|
|
65523
|
-
__name$
|
|
65523
|
+
__name$2(pollDeviceToken, "pollDeviceToken");
|
|
65524
65524
|
function sleep(seconds) {
|
|
65525
65525
|
return new Promise((resolve$3) => setTimeout(resolve$3, seconds * 1e3));
|
|
65526
65526
|
}
|
|
65527
|
-
__name$
|
|
65527
|
+
__name$2(sleep, "sleep");
|
|
65528
65528
|
async function getOauthTokenViaDeviceFlow(options, ctx) {
|
|
65529
65529
|
const { logger: logger$2, openInBrowser: openInBrowser$1, isNonInteractiveOrCI: isNonInteractiveOrCI2 } = ctx;
|
|
65530
65530
|
const deviceAuth = await requestDeviceAuthorization(options.scopes, options.clientId, logger$2, isNonInteractiveOrCI2, ctx.cliDisplayName);
|
|
@@ -65605,7 +65605,7 @@ If you don't want to do this consider passing an API token via the \`CLOUDFLARE_
|
|
|
65605
65605
|
Enable debug logging to see the full response, then run \`${ctx.deviceLoginCommand}\` to try again.`, { telemetryMessage: "user device-flow poll failed" });
|
|
65606
65606
|
throw new UserError(`Device authorization timed out after ${toHumanPeriod(maxDurationSeconds)}. Please run \`${ctx.deviceLoginCommand}\` again to obtain a new code.`, { telemetryMessage: "user device-flow authorization timeout" });
|
|
65607
65607
|
}
|
|
65608
|
-
__name$
|
|
65608
|
+
__name$2(getOauthTokenViaDeviceFlow, "getOauthTokenViaDeviceFlow");
|
|
65609
65609
|
function toHumanPeriod(seconds) {
|
|
65610
65610
|
if (seconds < 60) return `${seconds} seconds`;
|
|
65611
65611
|
const minutes = Math.floor(seconds / 60);
|
|
@@ -65616,7 +65616,7 @@ function toHumanPeriod(seconds) {
|
|
|
65616
65616
|
if (remainingSeconds == 59) return `${minutes + 1} ${minutesPostfix}`;
|
|
65617
65617
|
return `${minutes} ${minutesPostfix} and ${remainingSeconds} ${secondsPostfix}`;
|
|
65618
65618
|
}
|
|
65619
|
-
__name$
|
|
65619
|
+
__name$2(toHumanPeriod, "toHumanPeriod");
|
|
65620
65620
|
function createOAuthFlow(ctx) {
|
|
65621
65621
|
const oauthFlowState = {};
|
|
65622
65622
|
const generators = {
|
|
@@ -65627,8 +65627,8 @@ function createOAuthFlow(ctx) {
|
|
|
65627
65627
|
function getStorage(profile) {
|
|
65628
65628
|
return ctx.storageFactory(profile ?? activeProfile);
|
|
65629
65629
|
}
|
|
65630
|
-
__name$
|
|
65631
|
-
const getClientId = /* @__PURE__ */ __name$
|
|
65630
|
+
__name$2(getStorage, "getStorage");
|
|
65631
|
+
const getClientId = /* @__PURE__ */ __name$2(() => typeof ctx.clientId === "function" ? ctx.clientId() : ctx.clientId, "getClientId");
|
|
65632
65632
|
const consent = ctx.consent;
|
|
65633
65633
|
let temporaryRequest;
|
|
65634
65634
|
let activeTemporaryAccount;
|
|
@@ -65677,7 +65677,7 @@ function createOAuthFlow(ctx) {
|
|
|
65677
65677
|
ctx.purgeOnLoginOrLogout?.();
|
|
65678
65678
|
return true;
|
|
65679
65679
|
}
|
|
65680
|
-
__name$
|
|
65680
|
+
__name$2(login, "login");
|
|
65681
65681
|
function isRefreshNeeded(profile) {
|
|
65682
65682
|
if (ctx.hasEnvCredentials()) return false;
|
|
65683
65683
|
const { accessToken } = readStoredAuthState({
|
|
@@ -65686,7 +65686,7 @@ function createOAuthFlow(ctx) {
|
|
|
65686
65686
|
});
|
|
65687
65687
|
return Boolean(accessToken && /* @__PURE__ */ new Date() >= new Date(accessToken.expiry));
|
|
65688
65688
|
}
|
|
65689
|
-
__name$
|
|
65689
|
+
__name$2(isRefreshNeeded, "isRefreshNeeded");
|
|
65690
65690
|
async function refreshToken(profile) {
|
|
65691
65691
|
const storage = getStorage(profile);
|
|
65692
65692
|
try {
|
|
@@ -65706,7 +65706,7 @@ function createOAuthFlow(ctx) {
|
|
|
65706
65706
|
return e instanceof ErrorAuthServerUnreachable || e instanceof Error && e.name === "TimeoutError" ? "unreachable" : "rejected";
|
|
65707
65707
|
}
|
|
65708
65708
|
}
|
|
65709
|
-
__name$
|
|
65709
|
+
__name$2(refreshToken, "refreshToken");
|
|
65710
65710
|
async function loginOrRefreshIfRequired(props) {
|
|
65711
65711
|
if (ctx.hasEnvCredentials()) return { loggedIn: true };
|
|
65712
65712
|
const stored = readStoredAuthState({
|
|
@@ -65741,7 +65741,7 @@ function createOAuthFlow(ctx) {
|
|
|
65741
65741
|
};
|
|
65742
65742
|
} else return { loggedIn: true };
|
|
65743
65743
|
}
|
|
65744
|
-
__name$
|
|
65744
|
+
__name$2(loginOrRefreshIfRequired, "loginOrRefreshIfRequired");
|
|
65745
65745
|
async function logout(profile) {
|
|
65746
65746
|
const clearedTemporary = clearTemporaryAccount();
|
|
65747
65747
|
if (ctx.hasEnvCredentials()) {
|
|
@@ -65766,7 +65766,7 @@ function createOAuthFlow(ctx) {
|
|
|
65766
65766
|
ctx.logger.log(`Successfully logged out.`);
|
|
65767
65767
|
ctx.purgeOnLoginOrLogout?.();
|
|
65768
65768
|
}
|
|
65769
|
-
__name$
|
|
65769
|
+
__name$2(logout, "logout");
|
|
65770
65770
|
async function getOAuthTokenFromLocalState() {
|
|
65771
65771
|
let stored = readStoredAuthState({
|
|
65772
65772
|
warningLogger: ctx.logger,
|
|
@@ -65782,7 +65782,7 @@ function createOAuthFlow(ctx) {
|
|
|
65782
65782
|
}
|
|
65783
65783
|
return stored.accessToken?.value;
|
|
65784
65784
|
}
|
|
65785
|
-
__name$
|
|
65785
|
+
__name$2(getOAuthTokenFromLocalState, "getOAuthTokenFromLocalState");
|
|
65786
65786
|
function getAPITokenInternal() {
|
|
65787
65787
|
if (activeTemporaryAccount) return { apiToken: activeTemporaryAccount.account.apiToken };
|
|
65788
65788
|
return getAPIToken({
|
|
@@ -65791,7 +65791,7 @@ function createOAuthFlow(ctx) {
|
|
|
65791
65791
|
allowGlobalAuthKey: ctx.allowGlobalAuthKey
|
|
65792
65792
|
});
|
|
65793
65793
|
}
|
|
65794
|
-
__name$
|
|
65794
|
+
__name$2(getAPITokenInternal, "getAPITokenInternal");
|
|
65795
65795
|
function requireApiTokenInternal() {
|
|
65796
65796
|
if (activeTemporaryAccount) return { apiToken: activeTemporaryAccount.account.apiToken };
|
|
65797
65797
|
return requireApiToken({
|
|
@@ -65800,20 +65800,20 @@ function createOAuthFlow(ctx) {
|
|
|
65800
65800
|
allowGlobalAuthKey: ctx.allowGlobalAuthKey
|
|
65801
65801
|
});
|
|
65802
65802
|
}
|
|
65803
|
-
__name$
|
|
65803
|
+
__name$2(requireApiTokenInternal, "requireApiTokenInternal");
|
|
65804
65804
|
function setTemporaryAllowed(allowed, request$2) {
|
|
65805
65805
|
temporaryRequest = allowed && ctx.temporary !== void 0 ? request$2 ?? {} : void 0;
|
|
65806
65806
|
activeTemporaryAccount = void 0;
|
|
65807
65807
|
}
|
|
65808
|
-
__name$
|
|
65808
|
+
__name$2(setTemporaryAllowed, "setTemporaryAllowed");
|
|
65809
65809
|
function isTemporaryAllowed() {
|
|
65810
65810
|
return temporaryRequest !== void 0;
|
|
65811
65811
|
}
|
|
65812
|
-
__name$
|
|
65812
|
+
__name$2(isTemporaryAllowed, "isTemporaryAllowed");
|
|
65813
65813
|
function getActiveTemporaryAccount() {
|
|
65814
65814
|
return activeTemporaryAccount;
|
|
65815
65815
|
}
|
|
65816
|
-
__name$
|
|
65816
|
+
__name$2(getActiveTemporaryAccount, "getActiveTemporaryAccount");
|
|
65817
65817
|
async function activateTemporaryAccount() {
|
|
65818
65818
|
if (!ctx.temporary) throw new UserError(`Temporary preview accounts are not supported by ${ctx.cliDisplayName}.`, { telemetryMessage: "user temporary account unsupported" });
|
|
65819
65819
|
const result = await getOrCreateTemporaryPreviewAccount({
|
|
@@ -65823,27 +65823,27 @@ function createOAuthFlow(ctx) {
|
|
|
65823
65823
|
activeTemporaryAccount = result.account;
|
|
65824
65824
|
return result;
|
|
65825
65825
|
}
|
|
65826
|
-
__name$
|
|
65826
|
+
__name$2(activateTemporaryAccount, "activateTemporaryAccount");
|
|
65827
65827
|
function clearTemporaryAccount() {
|
|
65828
65828
|
activeTemporaryAccount = void 0;
|
|
65829
65829
|
return ctx.temporary?.storage.clear() ?? false;
|
|
65830
65830
|
}
|
|
65831
|
-
__name$
|
|
65831
|
+
__name$2(clearTemporaryAccount, "clearTemporaryAccount");
|
|
65832
65832
|
function setProfile(profile) {
|
|
65833
65833
|
activeProfile = profile;
|
|
65834
65834
|
}
|
|
65835
|
-
__name$
|
|
65835
|
+
__name$2(setProfile, "setProfile");
|
|
65836
65836
|
function getActiveProfile() {
|
|
65837
65837
|
return activeProfile;
|
|
65838
65838
|
}
|
|
65839
|
-
__name$
|
|
65839
|
+
__name$2(getActiveProfile, "getActiveProfile");
|
|
65840
65840
|
function getScopes() {
|
|
65841
65841
|
return readStoredAuthState({
|
|
65842
65842
|
warningLogger: ctx.logger,
|
|
65843
65843
|
storage: getStorage()
|
|
65844
65844
|
}).scopes;
|
|
65845
65845
|
}
|
|
65846
|
-
__name$
|
|
65846
|
+
__name$2(getScopes, "getScopes");
|
|
65847
65847
|
return {
|
|
65848
65848
|
setProfile,
|
|
65849
65849
|
getActiveProfile,
|
|
@@ -65860,7 +65860,7 @@ function createOAuthFlow(ctx) {
|
|
|
65860
65860
|
activateTemporaryAccount
|
|
65861
65861
|
};
|
|
65862
65862
|
}
|
|
65863
|
-
__name$
|
|
65863
|
+
__name$2(createOAuthFlow, "createOAuthFlow");
|
|
65864
65864
|
var RESERVED_PROFILE_NAMES = ["default", "staging"];
|
|
65865
65865
|
function createProfileStore(args) {
|
|
65866
65866
|
const bindings = {
|
|
@@ -65943,16 +65943,16 @@ function createProfileStore(args) {
|
|
|
65943
65943
|
}
|
|
65944
65944
|
};
|
|
65945
65945
|
}
|
|
65946
|
-
__name$
|
|
65946
|
+
__name$2(createProfileStore, "createProfileStore");
|
|
65947
65947
|
function validateProfileName(name) {
|
|
65948
65948
|
if (RESERVED_PROFILE_NAMES.includes(name.toLowerCase())) throw new UserError(`"${name}" is a reserved profile name. Use the login and logout commands to manage the default profile, which applies as a global fallback.`, { telemetryMessage: "auth profile reserved name" });
|
|
65949
65949
|
if (!/^[a-zA-Z0-9_-]+$/.test(name)) throw new UserError(`Invalid profile name "${name}". Profile names may only contain alphanumeric characters, hyphens, and underscores.`, { telemetryMessage: "auth profile invalid name" });
|
|
65950
65950
|
}
|
|
65951
|
-
__name$
|
|
65951
|
+
__name$2(validateProfileName, "validateProfileName");
|
|
65952
65952
|
function formatDirectoryForUserError(dir$1) {
|
|
65953
65953
|
return path__default.relative(process.cwd(), dir$1) || ".";
|
|
65954
65954
|
}
|
|
65955
|
-
__name$
|
|
65955
|
+
__name$2(formatDirectoryForUserError, "formatDirectoryForUserError");
|
|
65956
65956
|
function getProfileForDirectoryFromBindings(startDir, bindings) {
|
|
65957
65957
|
const normalizedDir = path__default.resolve(startDir);
|
|
65958
65958
|
const sortedEntries = Object.entries(bindings).sort(([a], [b]) => b.length - a.length);
|
|
@@ -65967,7 +65967,7 @@ function getProfileForDirectoryFromBindings(startDir, bindings) {
|
|
|
65967
65967
|
};
|
|
65968
65968
|
}
|
|
65969
65969
|
}
|
|
65970
|
-
__name$
|
|
65970
|
+
__name$2(getProfileForDirectoryFromBindings, "getProfileForDirectoryFromBindings");
|
|
65971
65971
|
var BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
65972
65972
|
var HAS_WELLFORMED = !!"".isWellFormed;
|
|
65973
65973
|
function extendedTypeOf(obj) {
|
|
@@ -65986,26 +65986,26 @@ function extendedTypeOf(obj) {
|
|
|
65986
65986
|
}
|
|
65987
65987
|
return type;
|
|
65988
65988
|
}
|
|
65989
|
-
__name$
|
|
65989
|
+
__name$2(extendedTypeOf, "extendedTypeOf");
|
|
65990
65990
|
function isArrayOfTables(obj) {
|
|
65991
65991
|
for (let i$1 = 0; i$1 < obj.length; i$1++) if (extendedTypeOf(obj[i$1]) !== "object") return false;
|
|
65992
65992
|
return obj.length != 0;
|
|
65993
65993
|
}
|
|
65994
|
-
__name$
|
|
65994
|
+
__name$2(isArrayOfTables, "isArrayOfTables");
|
|
65995
65995
|
function formatWellFormedStringUnchecked(s) {
|
|
65996
65996
|
return JSON.stringify(s).replaceAll("", "\\u007f");
|
|
65997
65997
|
}
|
|
65998
|
-
__name$
|
|
65998
|
+
__name$2(formatWellFormedStringUnchecked, "formatWellFormedStringUnchecked");
|
|
65999
65999
|
function formatString(s) {
|
|
66000
66000
|
return formatWellFormedStringUnchecked(HAS_WELLFORMED ? s.toWellFormed() : s);
|
|
66001
66001
|
}
|
|
66002
|
-
__name$
|
|
66002
|
+
__name$2(formatString, "formatString");
|
|
66003
66003
|
function formatKey(s) {
|
|
66004
66004
|
if (BARE_KEY.test(s)) return s;
|
|
66005
66005
|
if (HAS_WELLFORMED && !s.isWellFormed()) throw new RangeError("key contains illegal lone surrogates");
|
|
66006
66006
|
return formatWellFormedStringUnchecked(s);
|
|
66007
66007
|
}
|
|
66008
|
-
__name$
|
|
66008
|
+
__name$2(formatKey, "formatKey");
|
|
66009
66009
|
function stringifyValue(val, type, depth, numberAsFloat, strictTemporal) {
|
|
66010
66010
|
if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
66011
66011
|
switch (type) {
|
|
@@ -66037,7 +66037,7 @@ function stringifyValue(val, type, depth, numberAsFloat, strictTemporal) {
|
|
|
66037
66037
|
case "temporal/x": throw new TypeError("Unsupported " + val[Symbol.toStringTag]);
|
|
66038
66038
|
}
|
|
66039
66039
|
}
|
|
66040
|
-
__name$
|
|
66040
|
+
__name$2(stringifyValue, "stringifyValue");
|
|
66041
66041
|
function stringifyInlineTable(obj, depth, numberAsFloat, strictTemporal) {
|
|
66042
66042
|
let keys = Object.keys(obj);
|
|
66043
66043
|
if (keys.length === 0) return "{}";
|
|
@@ -66049,7 +66049,7 @@ function stringifyInlineTable(obj, depth, numberAsFloat, strictTemporal) {
|
|
|
66049
66049
|
}
|
|
66050
66050
|
return res + " }";
|
|
66051
66051
|
}
|
|
66052
|
-
__name$
|
|
66052
|
+
__name$2(stringifyInlineTable, "stringifyInlineTable");
|
|
66053
66053
|
function stringifyArray(array$2, depth, numberAsFloat, strictTemporal) {
|
|
66054
66054
|
if (array$2.length === 0) return "[]";
|
|
66055
66055
|
let res = "[ ";
|
|
@@ -66060,7 +66060,7 @@ function stringifyArray(array$2, depth, numberAsFloat, strictTemporal) {
|
|
|
66060
66060
|
}
|
|
66061
66061
|
return res + " ]";
|
|
66062
66062
|
}
|
|
66063
|
-
__name$
|
|
66063
|
+
__name$2(stringifyArray, "stringifyArray");
|
|
66064
66064
|
function stringifyArrayTable(array$2, key, depth, numberAsFloat, strictTemporal) {
|
|
66065
66065
|
if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
66066
66066
|
let res = "";
|
|
@@ -66071,7 +66071,7 @@ function stringifyArrayTable(array$2, key, depth, numberAsFloat, strictTemporal)
|
|
|
66071
66071
|
}
|
|
66072
66072
|
return res;
|
|
66073
66073
|
}
|
|
66074
|
-
__name$
|
|
66074
|
+
__name$2(stringifyArrayTable, "stringifyArrayTable");
|
|
66075
66075
|
function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat, strictTemporal) {
|
|
66076
66076
|
if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
66077
66077
|
let preamble = "";
|
|
@@ -66100,32 +66100,32 @@ ${preamble}` : `[${tableKey}]`;
|
|
|
66100
66100
|
return preamble && tables ? `${preamble}
|
|
66101
66101
|
${tables}` : preamble || tables;
|
|
66102
66102
|
}
|
|
66103
|
-
__name$
|
|
66103
|
+
__name$2(stringifyTable, "stringifyTable");
|
|
66104
66104
|
function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false, strictTemporal = false } = {}) {
|
|
66105
66105
|
if (extendedTypeOf(obj) !== "object") throw new TypeError("stringify can only be called with an object");
|
|
66106
66106
|
let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat, strictTemporal);
|
|
66107
66107
|
if (str[str.length - 1] !== "\n") return str + "\n";
|
|
66108
66108
|
return str;
|
|
66109
66109
|
}
|
|
66110
|
-
__name$
|
|
66110
|
+
__name$2(stringify, "stringify");
|
|
66111
66111
|
var FILE_FORMATS = {
|
|
66112
66112
|
toml: {
|
|
66113
|
-
parse: /* @__PURE__ */ __name$
|
|
66114
|
-
stringify: /* @__PURE__ */ __name$
|
|
66113
|
+
parse: /* @__PURE__ */ __name$2((raw) => parseTOML(raw), "parse"),
|
|
66114
|
+
stringify: /* @__PURE__ */ __name$2((value) => stringify(value), "stringify")
|
|
66115
66115
|
},
|
|
66116
66116
|
json: {
|
|
66117
|
-
parse: /* @__PURE__ */ __name$
|
|
66118
|
-
stringify: /* @__PURE__ */ __name$
|
|
66117
|
+
parse: /* @__PURE__ */ __name$2((raw) => JSON.parse(raw), "parse"),
|
|
66118
|
+
stringify: /* @__PURE__ */ __name$2((value) => JSON.stringify(value, null, " "), "stringify")
|
|
66119
66119
|
}
|
|
66120
66120
|
};
|
|
66121
66121
|
function parseFile(format$3, raw) {
|
|
66122
66122
|
return FILE_FORMATS[format$3].parse(raw);
|
|
66123
66123
|
}
|
|
66124
|
-
__name$
|
|
66124
|
+
__name$2(parseFile, "parseFile");
|
|
66125
66125
|
function stringifyFile(format$3, value) {
|
|
66126
66126
|
return FILE_FORMATS[format$3].stringify(value);
|
|
66127
66127
|
}
|
|
66128
|
-
__name$
|
|
66128
|
+
__name$2(stringifyFile, "stringifyFile");
|
|
66129
66129
|
var USER_AUTH_CONFIG_PATH = "config";
|
|
66130
66130
|
function resolveAuthProfileBaseName(profile) {
|
|
66131
66131
|
if (profile === void 0 || profile === "default") {
|
|
@@ -66135,11 +66135,11 @@ function resolveAuthProfileBaseName(profile) {
|
|
|
66135
66135
|
validateProfileName(profile);
|
|
66136
66136
|
return profile;
|
|
66137
66137
|
}
|
|
66138
|
-
__name$
|
|
66139
|
-
function getAuthConfigFilePath$
|
|
66138
|
+
__name$2(resolveAuthProfileBaseName, "resolveAuthProfileBaseName");
|
|
66139
|
+
function getAuthConfigFilePath$1(configPath, profile, extension = "toml") {
|
|
66140
66140
|
return path__default.join(configPath, USER_AUTH_CONFIG_PATH, `${resolveAuthProfileBaseName(profile)}.${extension}`);
|
|
66141
66141
|
}
|
|
66142
|
-
__name$
|
|
66142
|
+
__name$2(getAuthConfigFilePath$1, "getAuthConfigFilePath");
|
|
66143
66143
|
var FileCredentialStore = class {
|
|
66144
66144
|
/**
|
|
66145
66145
|
* @param configPath consumer-provided global config directory (the CLI
|
|
@@ -66155,11 +66155,11 @@ var FileCredentialStore = class {
|
|
|
66155
66155
|
this.format = format$3;
|
|
66156
66156
|
}
|
|
66157
66157
|
static {
|
|
66158
|
-
__name$
|
|
66158
|
+
__name$2(this, "FileCredentialStore");
|
|
66159
66159
|
}
|
|
66160
66160
|
kind = "file";
|
|
66161
66161
|
filePath() {
|
|
66162
|
-
return getAuthConfigFilePath$
|
|
66162
|
+
return getAuthConfigFilePath$1(this.configPath, this.profile, this.format);
|
|
66163
66163
|
}
|
|
66164
66164
|
read() {
|
|
66165
66165
|
const filePath = this.filePath();
|
|
@@ -66196,7 +66196,7 @@ var CIPHER_NAME = "aes-256-gcm";
|
|
|
66196
66196
|
function generateKey() {
|
|
66197
66197
|
return new Uint8Array(randomBytes(KEY_LENGTH_BYTES));
|
|
66198
66198
|
}
|
|
66199
|
-
__name$
|
|
66199
|
+
__name$2(generateKey, "generateKey");
|
|
66200
66200
|
function encryptString(plaintext, key) {
|
|
66201
66201
|
if (key.length !== KEY_LENGTH_BYTES) throw new Error(`AES-256-GCM requires a ${KEY_LENGTH_BYTES}-byte key (got ${key.length} bytes).`);
|
|
66202
66202
|
const iv = randomBytes(IV_LENGTH_BYTES);
|
|
@@ -66211,7 +66211,7 @@ function encryptString(plaintext, key) {
|
|
|
66211
66211
|
ciphertext: ciphertext.toString("base64")
|
|
66212
66212
|
};
|
|
66213
66213
|
}
|
|
66214
|
-
__name$
|
|
66214
|
+
__name$2(encryptString, "encryptString");
|
|
66215
66215
|
function decryptString(envelope, key) {
|
|
66216
66216
|
if (key.length !== KEY_LENGTH_BYTES) throw new Error(`AES-256-GCM requires a ${KEY_LENGTH_BYTES}-byte key (got ${key.length} bytes).`);
|
|
66217
66217
|
if (envelope.v !== 1) throw new Error(`Unsupported encrypted envelope version: ${envelope.v}.`);
|
|
@@ -66224,18 +66224,18 @@ function decryptString(envelope, key) {
|
|
|
66224
66224
|
decipher.setAuthTag(tag);
|
|
66225
66225
|
return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString("utf-8");
|
|
66226
66226
|
}
|
|
66227
|
-
__name$
|
|
66227
|
+
__name$2(decryptString, "decryptString");
|
|
66228
66228
|
function parseEncryptedEnvelope(raw) {
|
|
66229
66229
|
if (typeof raw !== "object" || raw === null) return;
|
|
66230
66230
|
const candidate = raw;
|
|
66231
66231
|
if (candidate.v !== 1 || candidate.alg !== ALGORITHM_LABEL || typeof candidate.iv !== "string" || typeof candidate.tag !== "string" || typeof candidate.ciphertext !== "string") return;
|
|
66232
66232
|
return candidate;
|
|
66233
66233
|
}
|
|
66234
|
-
__name$
|
|
66235
|
-
function getEncryptedAuthConfigFilePath$
|
|
66234
|
+
__name$2(parseEncryptedEnvelope, "parseEncryptedEnvelope");
|
|
66235
|
+
function getEncryptedAuthConfigFilePath$1(configPath, profile) {
|
|
66236
66236
|
return path__default.join(configPath, "config", `${resolveAuthProfileBaseName(profile)}.enc`);
|
|
66237
66237
|
}
|
|
66238
|
-
__name$
|
|
66238
|
+
__name$2(getEncryptedAuthConfigFilePath$1, "getEncryptedAuthConfigFilePath");
|
|
66239
66239
|
var EncryptedFileCredentialStore = class {
|
|
66240
66240
|
/**
|
|
66241
66241
|
* @param configPath consumer-provided global config directory (the CLI
|
|
@@ -66256,14 +66256,14 @@ var EncryptedFileCredentialStore = class {
|
|
|
66256
66256
|
this.format = format$3;
|
|
66257
66257
|
}
|
|
66258
66258
|
static {
|
|
66259
|
-
__name$
|
|
66259
|
+
__name$2(this, "EncryptedFileCredentialStore");
|
|
66260
66260
|
}
|
|
66261
66261
|
kind = "encrypted-file";
|
|
66262
66262
|
plaintextPath() {
|
|
66263
|
-
return getAuthConfigFilePath$
|
|
66263
|
+
return getAuthConfigFilePath$1(this.configPath, this.profile, this.format);
|
|
66264
66264
|
}
|
|
66265
66265
|
read() {
|
|
66266
|
-
const encryptedPath = getEncryptedAuthConfigFilePath$
|
|
66266
|
+
const encryptedPath = getEncryptedAuthConfigFilePath$1(this.configPath, this.profile);
|
|
66267
66267
|
if (existsSync(encryptedPath)) return this.readEncryptedFile(encryptedPath);
|
|
66268
66268
|
const plaintextPath = this.plaintextPath();
|
|
66269
66269
|
if (existsSync(plaintextPath)) return this.migrateFromPlaintext(plaintextPath, encryptedPath);
|
|
@@ -66271,7 +66271,7 @@ var EncryptedFileCredentialStore = class {
|
|
|
66271
66271
|
write(config$3) {
|
|
66272
66272
|
const key = this.ensureKey();
|
|
66273
66273
|
const envelope = encryptString(stringifyFile(this.format, config$3), key);
|
|
66274
|
-
const encryptedPath = getEncryptedAuthConfigFilePath$
|
|
66274
|
+
const encryptedPath = getEncryptedAuthConfigFilePath$1(this.configPath, this.profile);
|
|
66275
66275
|
mkdirSync(path__default.dirname(encryptedPath), { recursive: true });
|
|
66276
66276
|
writeFileSync(encryptedPath, JSON.stringify(envelope, null, " "), {
|
|
66277
66277
|
encoding: "utf-8",
|
|
@@ -66282,7 +66282,7 @@ var EncryptedFileCredentialStore = class {
|
|
|
66282
66282
|
if (existsSync(plaintextPath)) rmSync(plaintextPath);
|
|
66283
66283
|
}
|
|
66284
66284
|
clear() {
|
|
66285
|
-
const encryptedPath = getEncryptedAuthConfigFilePath$
|
|
66285
|
+
const encryptedPath = getEncryptedAuthConfigFilePath$1(this.configPath, this.profile);
|
|
66286
66286
|
const plaintextPath = this.plaintextPath();
|
|
66287
66287
|
let existed = false;
|
|
66288
66288
|
if (existsSync(encryptedPath)) {
|
|
@@ -66299,10 +66299,10 @@ var EncryptedFileCredentialStore = class {
|
|
|
66299
66299
|
return existed;
|
|
66300
66300
|
}
|
|
66301
66301
|
path() {
|
|
66302
|
-
return getEncryptedAuthConfigFilePath$
|
|
66302
|
+
return getEncryptedAuthConfigFilePath$1(this.configPath, this.profile);
|
|
66303
66303
|
}
|
|
66304
66304
|
describe() {
|
|
66305
|
-
return `Encrypted file (${getEncryptedAuthConfigFilePath$
|
|
66305
|
+
return `Encrypted file (${getEncryptedAuthConfigFilePath$1(this.configPath, this.profile)}) with key in ${this.keyProvider.describe()}`;
|
|
66306
66306
|
}
|
|
66307
66307
|
readEncryptedFile(encryptedPath) {
|
|
66308
66308
|
const key = this.keyProvider.getKey();
|
|
@@ -66380,22 +66380,22 @@ function defaultNpmRunner(args) {
|
|
|
66380
66380
|
}
|
|
66381
66381
|
return spawnSync("npm", args, options);
|
|
66382
66382
|
}
|
|
66383
|
-
__name$
|
|
66383
|
+
__name$2(defaultNpmRunner, "defaultNpmRunner");
|
|
66384
66384
|
var npmRunner = defaultNpmRunner;
|
|
66385
66385
|
var cachedBindingPathByDir = /* @__PURE__ */ new Map();
|
|
66386
66386
|
function setNpmRunner(fn) {
|
|
66387
66387
|
npmRunner = fn ?? defaultNpmRunner;
|
|
66388
66388
|
cachedBindingPathByDir.clear();
|
|
66389
66389
|
}
|
|
66390
|
-
__name$
|
|
66390
|
+
__name$2(setNpmRunner, "setNpmRunner");
|
|
66391
66391
|
function getKeyringInstallDir(configPath) {
|
|
66392
66392
|
return path__default.join(configPath, "native", "keyring");
|
|
66393
66393
|
}
|
|
66394
|
-
__name$
|
|
66394
|
+
__name$2(getKeyringInstallDir, "getKeyringInstallDir");
|
|
66395
66395
|
function getInstalledBindingPath(installDir) {
|
|
66396
66396
|
return path__default.join(installDir, "node_modules", "@napi-rs", "keyring");
|
|
66397
66397
|
}
|
|
66398
|
-
__name$
|
|
66398
|
+
__name$2(getInstalledBindingPath, "getInstalledBindingPath");
|
|
66399
66399
|
function canLoadKeyringBinding(candidate) {
|
|
66400
66400
|
try {
|
|
66401
66401
|
createRequire(candidate)(candidate);
|
|
@@ -66404,7 +66404,7 @@ function canLoadKeyringBinding(candidate) {
|
|
|
66404
66404
|
return false;
|
|
66405
66405
|
}
|
|
66406
66406
|
}
|
|
66407
|
-
__name$
|
|
66407
|
+
__name$2(canLoadKeyringBinding, "canLoadKeyringBinding");
|
|
66408
66408
|
function findKeyringBinding(installDir) {
|
|
66409
66409
|
const cached$2 = cachedBindingPathByDir.get(installDir);
|
|
66410
66410
|
if (cached$2 !== void 0) return cached$2;
|
|
@@ -66426,7 +66426,7 @@ function findKeyringBinding(installDir) {
|
|
|
66426
66426
|
cachedBindingPathByDir.set(installDir, null);
|
|
66427
66427
|
return null;
|
|
66428
66428
|
}
|
|
66429
|
-
__name$
|
|
66429
|
+
__name$2(findKeyringBinding, "findKeyringBinding");
|
|
66430
66430
|
function installKeyringBindingSync(installDir) {
|
|
66431
66431
|
const dir$1 = installDir;
|
|
66432
66432
|
mkdirSync(dir$1, { recursive: true });
|
|
@@ -66467,12 +66467,12 @@ Its platform-specific binary ships as a separate optional package, so a download
|
|
|
66467
66467
|
Retry once the underlying issue is fixed, or install the binding globally:
|
|
66468
66468
|
npm install -g @napi-rs/keyring@${PINNED_KEYRING_VERSION}`, { telemetryMessage: "workers-auth keyring install incomplete" });
|
|
66469
66469
|
}
|
|
66470
|
-
__name$
|
|
66470
|
+
__name$2(installKeyringBindingSync, "installKeyringBindingSync");
|
|
66471
66471
|
var entryFactoryOverride;
|
|
66472
66472
|
function setKeyringEntryFactory(factory$1) {
|
|
66473
66473
|
entryFactoryOverride = factory$1;
|
|
66474
66474
|
}
|
|
66475
|
-
__name$
|
|
66475
|
+
__name$2(setKeyringEntryFactory, "setKeyringEntryFactory");
|
|
66476
66476
|
function resolveKeyringEntryFactory(installDir) {
|
|
66477
66477
|
if (entryFactoryOverride !== void 0) return entryFactoryOverride;
|
|
66478
66478
|
const bindingPath = findKeyringBinding(installDir);
|
|
@@ -66483,11 +66483,11 @@ Retry the command, or install the binding globally:
|
|
|
66483
66483
|
const mod$1 = createRequire(bindingPath)(bindingPath);
|
|
66484
66484
|
return (service, account) => new mod$1.Entry(service, account);
|
|
66485
66485
|
}
|
|
66486
|
-
__name$
|
|
66486
|
+
__name$2(resolveKeyringEntryFactory, "resolveKeyringEntryFactory");
|
|
66487
66487
|
function getKeyringAccountName(profile) {
|
|
66488
66488
|
return resolveAuthProfileBaseName(profile);
|
|
66489
66489
|
}
|
|
66490
|
-
__name$
|
|
66490
|
+
__name$2(getKeyringAccountName, "getKeyringAccountName");
|
|
66491
66491
|
function encodeKeyEnvelope(key) {
|
|
66492
66492
|
const envelope = {
|
|
66493
66493
|
v: 1,
|
|
@@ -66496,7 +66496,7 @@ function encodeKeyEnvelope(key) {
|
|
|
66496
66496
|
};
|
|
66497
66497
|
return JSON.stringify(envelope);
|
|
66498
66498
|
}
|
|
66499
|
-
__name$
|
|
66499
|
+
__name$2(encodeKeyEnvelope, "encodeKeyEnvelope");
|
|
66500
66500
|
function decodeKeyEnvelope(raw) {
|
|
66501
66501
|
if (raw === "") return;
|
|
66502
66502
|
let parsed;
|
|
@@ -66514,21 +66514,21 @@ function decodeKeyEnvelope(raw) {
|
|
|
66514
66514
|
return;
|
|
66515
66515
|
}
|
|
66516
66516
|
}
|
|
66517
|
-
__name$
|
|
66517
|
+
__name$2(decodeKeyEnvelope, "decodeKeyEnvelope");
|
|
66518
66518
|
function defaultRunner(args, options = {}) {
|
|
66519
66519
|
return spawnSync("secret-tool", args, {
|
|
66520
66520
|
encoding: "utf-8",
|
|
66521
66521
|
input: options.input
|
|
66522
66522
|
});
|
|
66523
66523
|
}
|
|
66524
|
-
__name$
|
|
66524
|
+
__name$2(defaultRunner, "defaultRunner");
|
|
66525
66525
|
var runner = defaultRunner;
|
|
66526
66526
|
var cachedProbeResult = void 0;
|
|
66527
66527
|
function setLinuxSecretToolRunner(fn) {
|
|
66528
66528
|
runner = fn ?? defaultRunner;
|
|
66529
66529
|
cachedProbeResult = void 0;
|
|
66530
66530
|
}
|
|
66531
|
-
__name$
|
|
66531
|
+
__name$2(setLinuxSecretToolRunner, "setLinuxSecretToolRunner");
|
|
66532
66532
|
function probeSecretTool() {
|
|
66533
66533
|
if (cachedProbeResult !== void 0) return cachedProbeResult;
|
|
66534
66534
|
let result;
|
|
@@ -66540,14 +66540,14 @@ function probeSecretTool() {
|
|
|
66540
66540
|
cachedProbeResult = result;
|
|
66541
66541
|
return result;
|
|
66542
66542
|
}
|
|
66543
|
-
__name$
|
|
66543
|
+
__name$2(probeSecretTool, "probeSecretTool");
|
|
66544
66544
|
var LinuxSecretToolKeyProvider = class {
|
|
66545
66545
|
constructor(serviceName, profile) {
|
|
66546
66546
|
this.serviceName = serviceName;
|
|
66547
66547
|
this.profile = profile;
|
|
66548
66548
|
}
|
|
66549
66549
|
static {
|
|
66550
|
-
__name$
|
|
66550
|
+
__name$2(this, "LinuxSecretToolKeyProvider");
|
|
66551
66551
|
}
|
|
66552
66552
|
getKey() {
|
|
66553
66553
|
const r$1 = runner([
|
|
@@ -66593,19 +66593,19 @@ function defaultRunner2(args, options = {}) {
|
|
|
66593
66593
|
input: options.input
|
|
66594
66594
|
});
|
|
66595
66595
|
}
|
|
66596
|
-
__name$
|
|
66596
|
+
__name$2(defaultRunner2, "defaultRunner");
|
|
66597
66597
|
var runner2 = defaultRunner2;
|
|
66598
66598
|
function setMacSecurityCommandRunner(fn) {
|
|
66599
66599
|
runner2 = fn ?? defaultRunner2;
|
|
66600
66600
|
}
|
|
66601
|
-
__name$
|
|
66601
|
+
__name$2(setMacSecurityCommandRunner, "setMacSecurityCommandRunner");
|
|
66602
66602
|
var MacSecurityKeyProvider = class {
|
|
66603
66603
|
constructor(serviceName, profile) {
|
|
66604
66604
|
this.serviceName = serviceName;
|
|
66605
66605
|
this.profile = profile;
|
|
66606
66606
|
}
|
|
66607
66607
|
static {
|
|
66608
|
-
__name$
|
|
66608
|
+
__name$2(this, "MacSecurityKeyProvider");
|
|
66609
66609
|
}
|
|
66610
66610
|
getKey() {
|
|
66611
66611
|
const r$1 = runner2([
|
|
@@ -66661,7 +66661,7 @@ var NapiKeyringKeyProvider = class {
|
|
|
66661
66661
|
this.profile = profile;
|
|
66662
66662
|
}
|
|
66663
66663
|
static {
|
|
66664
|
-
__name$
|
|
66664
|
+
__name$2(this, "NapiKeyringKeyProvider");
|
|
66665
66665
|
}
|
|
66666
66666
|
entry() {
|
|
66667
66667
|
return resolveKeyringEntryFactory(this.installDir)(this.serviceName, getKeyringAccountName(this.profile));
|
|
@@ -66687,7 +66687,7 @@ var testProviderFactory;
|
|
|
66687
66687
|
function setKeyProviderFactoryForTesting(factory$1) {
|
|
66688
66688
|
testProviderFactory = factory$1;
|
|
66689
66689
|
}
|
|
66690
|
-
__name$
|
|
66690
|
+
__name$2(setKeyProviderFactoryForTesting, "setKeyProviderFactoryForTesting");
|
|
66691
66691
|
function resolveKeyProvider(serviceName, profile, configPath) {
|
|
66692
66692
|
if (testProviderFactory !== void 0) return {
|
|
66693
66693
|
kind: "available",
|
|
@@ -66712,14 +66712,14 @@ function resolveKeyProvider(serviceName, profile, configPath) {
|
|
|
66712
66712
|
};
|
|
66713
66713
|
return {
|
|
66714
66714
|
kind: "needs-install",
|
|
66715
|
-
install: /* @__PURE__ */ __name$
|
|
66716
|
-
afterInstall: /* @__PURE__ */ __name$
|
|
66715
|
+
install: /* @__PURE__ */ __name$2(() => installKeyringBindingSync(installDir), "install"),
|
|
66716
|
+
afterInstall: /* @__PURE__ */ __name$2(() => new NapiKeyringKeyProvider(serviceName, installDir, profile), "afterInstall")
|
|
66717
66717
|
};
|
|
66718
66718
|
}
|
|
66719
66719
|
default: return { kind: "unsupported" };
|
|
66720
66720
|
}
|
|
66721
66721
|
}
|
|
66722
|
-
__name$
|
|
66722
|
+
__name$2(resolveKeyProvider, "resolveKeyProvider");
|
|
66723
66723
|
var sessionFlags = {
|
|
66724
66724
|
installFailedThisSession: false,
|
|
66725
66725
|
hasWarnedAboutKeyringFallback: false,
|
|
@@ -66728,13 +66728,13 @@ var sessionFlags = {
|
|
|
66728
66728
|
function getResolverSessionFlags() {
|
|
66729
66729
|
return sessionFlags;
|
|
66730
66730
|
}
|
|
66731
|
-
__name$
|
|
66731
|
+
__name$2(getResolverSessionFlags, "getResolverSessionFlags");
|
|
66732
66732
|
function resetCredentialStorageState() {
|
|
66733
66733
|
sessionFlags.installFailedThisSession = false;
|
|
66734
66734
|
sessionFlags.hasWarnedAboutKeyringFallback = false;
|
|
66735
66735
|
sessionFlags.hasWarnedAboutSecretToolMissing = false;
|
|
66736
66736
|
}
|
|
66737
|
-
__name$
|
|
66737
|
+
__name$2(resetCredentialStorageState, "resetCredentialStorageState");
|
|
66738
66738
|
function createCredentialStorageContext(context) {
|
|
66739
66739
|
const config$3 = {
|
|
66740
66740
|
...context,
|
|
@@ -66744,22 +66744,22 @@ function createCredentialStorageContext(context) {
|
|
|
66744
66744
|
function getActiveStore(profile) {
|
|
66745
66745
|
return resolveActiveCredentialStore(config$3, profile);
|
|
66746
66746
|
}
|
|
66747
|
-
__name$
|
|
66747
|
+
__name$2(getActiveStore, "getActiveStore");
|
|
66748
66748
|
function storageFactory(profile) {
|
|
66749
66749
|
return {
|
|
66750
|
-
read: /* @__PURE__ */ __name$
|
|
66751
|
-
write: /* @__PURE__ */ __name$
|
|
66752
|
-
clear: /* @__PURE__ */ __name$
|
|
66753
|
-
path: /* @__PURE__ */ __name$
|
|
66750
|
+
read: /* @__PURE__ */ __name$2(() => getActiveStore(profile).read(), "read"),
|
|
66751
|
+
write: /* @__PURE__ */ __name$2((value) => getActiveStore(profile).write(value), "write"),
|
|
66752
|
+
clear: /* @__PURE__ */ __name$2(() => getActiveStore(profile).clear(), "clear"),
|
|
66753
|
+
path: /* @__PURE__ */ __name$2(() => getActiveStore(profile).path(), "path")
|
|
66754
66754
|
};
|
|
66755
66755
|
}
|
|
66756
|
-
__name$
|
|
66756
|
+
__name$2(storageFactory, "storageFactory");
|
|
66757
66757
|
return {
|
|
66758
66758
|
storageFactory,
|
|
66759
66759
|
getActiveStore
|
|
66760
66760
|
};
|
|
66761
66761
|
}
|
|
66762
|
-
__name$
|
|
66762
|
+
__name$2(createCredentialStorageContext, "createCredentialStorageContext");
|
|
66763
66763
|
function resolveActiveCredentialStore(config$3, profile) {
|
|
66764
66764
|
const envOverride = getCloudflareAuthUseKeyringFromEnv();
|
|
66765
66765
|
const configPath = config$3.getConfigPath();
|
|
@@ -66773,13 +66773,13 @@ function resolveActiveCredentialStore(config$3, profile) {
|
|
|
66773
66773
|
case "unsupported": return handleUnsupported(forcedByEnvVar, config$3, profile);
|
|
66774
66774
|
}
|
|
66775
66775
|
}
|
|
66776
|
-
__name$
|
|
66776
|
+
__name$2(resolveActiveCredentialStore, "resolveActiveCredentialStore");
|
|
66777
66777
|
function buildMigrationLogger(config$3) {
|
|
66778
66778
|
return (result) => {
|
|
66779
66779
|
config$3.logger.warn(`Migrated credentials from ${result.plaintextPath} into ${result.encryptedPath} (key in ${result.keyProviderDescription}). The plaintext file has been deleted.`);
|
|
66780
66780
|
};
|
|
66781
66781
|
}
|
|
66782
|
-
__name$
|
|
66782
|
+
__name$2(buildMigrationLogger, "buildMigrationLogger");
|
|
66783
66783
|
function handleNeedsInstall(resolution, forcedByEnvVar, config$3, profile) {
|
|
66784
66784
|
const flags = getResolverSessionFlags();
|
|
66785
66785
|
if (flags.installFailedThisSession) {
|
|
@@ -66797,7 +66797,7 @@ function handleNeedsInstall(resolution, forcedByEnvVar, config$3, profile) {
|
|
|
66797
66797
|
}
|
|
66798
66798
|
return new EncryptedFileCredentialStore(config$3.getConfigPath(), resolution.afterInstall(), buildMigrationLogger(config$3), profile, config$3.format);
|
|
66799
66799
|
}
|
|
66800
|
-
__name$
|
|
66800
|
+
__name$2(handleNeedsInstall, "handleNeedsInstall");
|
|
66801
66801
|
function handleUnsupported(forcedByEnvVar, config$3, profile) {
|
|
66802
66802
|
const platform$1 = process.platform;
|
|
66803
66803
|
const linuxMissingTool = platform$1 === "linux";
|
|
@@ -66816,7 +66816,7 @@ Falling back to the plaintext credentials file for this session.`);
|
|
|
66816
66816
|
}
|
|
66817
66817
|
return fallbackToFileWithWarning(message, config$3, profile);
|
|
66818
66818
|
}
|
|
66819
|
-
__name$
|
|
66819
|
+
__name$2(handleUnsupported, "handleUnsupported");
|
|
66820
66820
|
function fallbackToFileWithWarning(message, config$3, profile) {
|
|
66821
66821
|
const flags = getResolverSessionFlags();
|
|
66822
66822
|
if (!flags.hasWarnedAboutKeyringFallback) {
|
|
@@ -66825,7 +66825,7 @@ function fallbackToFileWithWarning(message, config$3, profile) {
|
|
|
66825
66825
|
}
|
|
66826
66826
|
return new FileCredentialStore(config$3.getConfigPath(), profile, config$3.format);
|
|
66827
66827
|
}
|
|
66828
|
-
__name$
|
|
66828
|
+
__name$2(fallbackToFileWithWarning, "fallbackToFileWithWarning");
|
|
66829
66829
|
function secretToolMissingMessage(loginCommand) {
|
|
66830
66830
|
return `\`secret-tool\` is required for OS keyring storage on Linux but is not installed.
|
|
66831
66831
|
|
|
@@ -66837,7 +66837,7 @@ Install it via your package manager:
|
|
|
66837
66837
|
|
|
66838
66838
|
Or disable keyring storage: \`${loginCommand} --no-use-keyring\`.`;
|
|
66839
66839
|
}
|
|
66840
|
-
__name$
|
|
66840
|
+
__name$2(secretToolMissingMessage, "secretToolMissingMessage");
|
|
66841
66841
|
function windowsBindingMissingMessage(loginCommand) {
|
|
66842
66842
|
return `\`@napi-rs/keyring\` is required for OS keyring storage on Windows but is not installed.
|
|
66843
66843
|
|
|
@@ -66847,9 +66847,9 @@ Run \`${loginCommand} --use-keyring\` interactively to install it automatically,
|
|
|
66847
66847
|
|
|
66848
66848
|
Or disable keyring storage: \`${loginCommand} --no-use-keyring\`.`;
|
|
66849
66849
|
}
|
|
66850
|
-
__name$
|
|
66850
|
+
__name$2(windowsBindingMissingMessage, "windowsBindingMissingMessage");
|
|
66851
66851
|
function scrubEncryptedCredentials(options) {
|
|
66852
|
-
const encryptedPath = getEncryptedAuthConfigFilePath$
|
|
66852
|
+
const encryptedPath = getEncryptedAuthConfigFilePath$1(options.configPath, options.profile);
|
|
66853
66853
|
const encryptedFileExisted = existsSync(encryptedPath);
|
|
66854
66854
|
const resolution = resolveKeyProvider(options.serviceName, options.profile, options.configPath);
|
|
66855
66855
|
if (resolution.kind === "available") {
|
|
@@ -66865,14 +66865,14 @@ function scrubEncryptedCredentials(options) {
|
|
|
66865
66865
|
encryptedFileExisted
|
|
66866
66866
|
};
|
|
66867
66867
|
}
|
|
66868
|
-
__name$
|
|
66868
|
+
__name$2(scrubEncryptedCredentials, "scrubEncryptedCredentials");
|
|
66869
66869
|
var AuthenticationError = class extends UserError {
|
|
66870
66870
|
constructor(message, reason, telemetryMessage) {
|
|
66871
66871
|
super(message, { telemetryMessage });
|
|
66872
66872
|
this.reason = reason;
|
|
66873
66873
|
}
|
|
66874
66874
|
static {
|
|
66875
|
-
__name$
|
|
66875
|
+
__name$2(this, "AuthenticationError");
|
|
66876
66876
|
}
|
|
66877
66877
|
};
|
|
66878
66878
|
|
|
@@ -66883,8 +66883,8 @@ function createPreferences(getConfigPath) {
|
|
|
66883
66883
|
function getUserPreferencesPath() {
|
|
66884
66884
|
return path__default.resolve(getConfigPath(), "preferences.json");
|
|
66885
66885
|
}
|
|
66886
|
-
__name$
|
|
66887
|
-
function readUserPreferences$
|
|
66886
|
+
__name$2(getUserPreferencesPath, "getUserPreferencesPath");
|
|
66887
|
+
function readUserPreferences$1() {
|
|
66888
66888
|
try {
|
|
66889
66889
|
const raw = readFileSync(getUserPreferencesPath(), "utf8");
|
|
66890
66890
|
const parsed = JSON.parse(raw);
|
|
@@ -66894,23 +66894,23 @@ function createPreferences(getConfigPath) {
|
|
|
66894
66894
|
return {};
|
|
66895
66895
|
}
|
|
66896
66896
|
}
|
|
66897
|
-
__name$
|
|
66898
|
-
function updateUserPreferences$
|
|
66897
|
+
__name$2(readUserPreferences$1, "readUserPreferences");
|
|
66898
|
+
function updateUserPreferences$1(update) {
|
|
66899
66899
|
const next = {
|
|
66900
|
-
...readUserPreferences$
|
|
66900
|
+
...readUserPreferences$1(),
|
|
66901
66901
|
...update
|
|
66902
66902
|
};
|
|
66903
66903
|
const filePath = getUserPreferencesPath();
|
|
66904
66904
|
mkdirSync(path__default.dirname(filePath), { recursive: true });
|
|
66905
66905
|
writeFileSync(filePath, JSON.stringify(next, null, " "), { encoding: "utf-8" });
|
|
66906
66906
|
}
|
|
66907
|
-
__name$
|
|
66907
|
+
__name$2(updateUserPreferences$1, "updateUserPreferences");
|
|
66908
66908
|
return {
|
|
66909
|
-
readUserPreferences: readUserPreferences$
|
|
66910
|
-
updateUserPreferences: updateUserPreferences$
|
|
66909
|
+
readUserPreferences: readUserPreferences$1,
|
|
66910
|
+
updateUserPreferences: updateUserPreferences$1
|
|
66911
66911
|
};
|
|
66912
66912
|
}
|
|
66913
|
-
__name$
|
|
66913
|
+
__name$2(createPreferences, "createPreferences");
|
|
66914
66914
|
var millisecondsInMinute = 6e4;
|
|
66915
66915
|
var minutesInYear = 525600;
|
|
66916
66916
|
var minutesInMonth = 43200;
|
|
@@ -66922,46 +66922,46 @@ function constructFrom(date$2, value) {
|
|
|
66922
66922
|
if (date$2 instanceof Date) return new date$2.constructor(value);
|
|
66923
66923
|
return new Date(value);
|
|
66924
66924
|
}
|
|
66925
|
-
__name$
|
|
66925
|
+
__name$2(constructFrom, "constructFrom");
|
|
66926
66926
|
function toDate(argument, context) {
|
|
66927
66927
|
return constructFrom(context || argument, argument);
|
|
66928
66928
|
}
|
|
66929
|
-
__name$
|
|
66929
|
+
__name$2(toDate, "toDate");
|
|
66930
66930
|
var defaultOptions$1 = {};
|
|
66931
66931
|
function getDefaultOptions() {
|
|
66932
66932
|
return defaultOptions$1;
|
|
66933
66933
|
}
|
|
66934
|
-
__name$
|
|
66934
|
+
__name$2(getDefaultOptions, "getDefaultOptions");
|
|
66935
66935
|
function getTimezoneOffsetInMilliseconds(date$2) {
|
|
66936
66936
|
const _date$1 = toDate(date$2);
|
|
66937
66937
|
const utcDate = new Date(Date.UTC(_date$1.getFullYear(), _date$1.getMonth(), _date$1.getDate(), _date$1.getHours(), _date$1.getMinutes(), _date$1.getSeconds(), _date$1.getMilliseconds()));
|
|
66938
66938
|
utcDate.setUTCFullYear(_date$1.getFullYear());
|
|
66939
66939
|
return +date$2 - +utcDate;
|
|
66940
66940
|
}
|
|
66941
|
-
__name$
|
|
66941
|
+
__name$2(getTimezoneOffsetInMilliseconds, "getTimezoneOffsetInMilliseconds");
|
|
66942
66942
|
function normalizeDates(context, ...dates) {
|
|
66943
66943
|
const normalize$1 = constructFrom.bind(null, context || dates.find((date$2) => typeof date$2 === "object"));
|
|
66944
66944
|
return dates.map(normalize$1);
|
|
66945
66945
|
}
|
|
66946
|
-
__name$
|
|
66946
|
+
__name$2(normalizeDates, "normalizeDates");
|
|
66947
66947
|
function compareAsc(dateLeft, dateRight) {
|
|
66948
66948
|
const diff = +toDate(dateLeft) - +toDate(dateRight);
|
|
66949
66949
|
if (diff < 0) return -1;
|
|
66950
66950
|
else if (diff > 0) return 1;
|
|
66951
66951
|
return diff;
|
|
66952
66952
|
}
|
|
66953
|
-
__name$
|
|
66953
|
+
__name$2(compareAsc, "compareAsc");
|
|
66954
66954
|
function constructNow(date$2) {
|
|
66955
66955
|
return constructFrom(date$2, Date.now());
|
|
66956
66956
|
}
|
|
66957
|
-
__name$
|
|
66957
|
+
__name$2(constructNow, "constructNow");
|
|
66958
66958
|
function getRoundingMethod(method) {
|
|
66959
66959
|
return (number$3) => {
|
|
66960
66960
|
const result = (method ? Math[method] : Math.trunc)(number$3);
|
|
66961
66961
|
return result === 0 ? 0 : result;
|
|
66962
66962
|
};
|
|
66963
66963
|
}
|
|
66964
|
-
__name$
|
|
66964
|
+
__name$2(getRoundingMethod, "getRoundingMethod");
|
|
66965
66965
|
var formatDistanceLocale = {
|
|
66966
66966
|
lessThanXSeconds: {
|
|
66967
66967
|
one: "less than a second",
|
|
@@ -67025,7 +67025,7 @@ var formatDistanceLocale = {
|
|
|
67025
67025
|
other: "almost {{count}} years"
|
|
67026
67026
|
}
|
|
67027
67027
|
};
|
|
67028
|
-
var formatDistance = /* @__PURE__ */ __name$
|
|
67028
|
+
var formatDistance = /* @__PURE__ */ __name$2((token, count, options) => {
|
|
67029
67029
|
let result;
|
|
67030
67030
|
const tokenValue = formatDistanceLocale[token];
|
|
67031
67031
|
if (typeof tokenValue === "string") result = tokenValue;
|
|
@@ -67041,7 +67041,7 @@ function buildFormatLongFn(args) {
|
|
|
67041
67041
|
return args.formats[width] || args.formats[args.defaultWidth];
|
|
67042
67042
|
};
|
|
67043
67043
|
}
|
|
67044
|
-
__name$
|
|
67044
|
+
__name$2(buildFormatLongFn, "buildFormatLongFn");
|
|
67045
67045
|
var formatLong = {
|
|
67046
67046
|
date: buildFormatLongFn({
|
|
67047
67047
|
formats: {
|
|
@@ -67079,7 +67079,7 @@ var formatRelativeLocale = {
|
|
|
67079
67079
|
nextWeek: "eeee 'at' p",
|
|
67080
67080
|
other: "P"
|
|
67081
67081
|
};
|
|
67082
|
-
var formatRelative = /* @__PURE__ */ __name$
|
|
67082
|
+
var formatRelative = /* @__PURE__ */ __name$2((token, _date$1, _baseDate, _options) => formatRelativeLocale[token], "formatRelative");
|
|
67083
67083
|
function buildLocalizeFn(args) {
|
|
67084
67084
|
return (value, options) => {
|
|
67085
67085
|
const context = options?.context ? String(options.context) : "standalone";
|
|
@@ -67097,9 +67097,9 @@ function buildLocalizeFn(args) {
|
|
|
67097
67097
|
return valuesArray[index];
|
|
67098
67098
|
};
|
|
67099
67099
|
}
|
|
67100
|
-
__name$
|
|
67100
|
+
__name$2(buildLocalizeFn, "buildLocalizeFn");
|
|
67101
67101
|
var localize = {
|
|
67102
|
-
ordinalNumber: /* @__PURE__ */ __name$
|
|
67102
|
+
ordinalNumber: /* @__PURE__ */ __name$2((dirtyNumber, _options) => {
|
|
67103
67103
|
const number$3 = Number(dirtyNumber);
|
|
67104
67104
|
const rem100 = number$3 % 100;
|
|
67105
67105
|
if (rem100 > 20 || rem100 < 10) switch (rem100 % 10) {
|
|
@@ -67139,7 +67139,7 @@ var localize = {
|
|
|
67139
67139
|
]
|
|
67140
67140
|
},
|
|
67141
67141
|
defaultWidth: "wide",
|
|
67142
|
-
argumentCallback: /* @__PURE__ */ __name$
|
|
67142
|
+
argumentCallback: /* @__PURE__ */ __name$2((quarter) => quarter - 1, "argumentCallback")
|
|
67143
67143
|
}),
|
|
67144
67144
|
month: buildLocalizeFn({
|
|
67145
67145
|
values: {
|
|
@@ -67317,15 +67317,15 @@ function buildMatchFn(args) {
|
|
|
67317
67317
|
};
|
|
67318
67318
|
};
|
|
67319
67319
|
}
|
|
67320
|
-
__name$
|
|
67320
|
+
__name$2(buildMatchFn, "buildMatchFn");
|
|
67321
67321
|
function findKey(object$2, predicate) {
|
|
67322
67322
|
for (const key in object$2) if (Object.prototype.hasOwnProperty.call(object$2, key) && predicate(object$2[key])) return key;
|
|
67323
67323
|
}
|
|
67324
|
-
__name$
|
|
67324
|
+
__name$2(findKey, "findKey");
|
|
67325
67325
|
function findIndex(array$2, predicate) {
|
|
67326
67326
|
for (let key = 0; key < array$2.length; key++) if (predicate(array$2[key])) return key;
|
|
67327
67327
|
}
|
|
67328
|
-
__name$
|
|
67328
|
+
__name$2(findIndex, "findIndex");
|
|
67329
67329
|
function buildMatchPatternFn(args) {
|
|
67330
67330
|
return (string$2, options = {}) => {
|
|
67331
67331
|
const matchResult = string$2.match(args.matchPattern);
|
|
@@ -67342,7 +67342,7 @@ function buildMatchPatternFn(args) {
|
|
|
67342
67342
|
};
|
|
67343
67343
|
};
|
|
67344
67344
|
}
|
|
67345
|
-
__name$
|
|
67345
|
+
__name$2(buildMatchPatternFn, "buildMatchPatternFn");
|
|
67346
67346
|
var enUS = {
|
|
67347
67347
|
code: "en-US",
|
|
67348
67348
|
formatDistance,
|
|
@@ -67353,7 +67353,7 @@ var enUS = {
|
|
|
67353
67353
|
ordinalNumber: buildMatchPatternFn({
|
|
67354
67354
|
matchPattern: /^(\d+)(th|st|nd|rd)?/i,
|
|
67355
67355
|
parsePattern: /\d+/i,
|
|
67356
|
-
valueCallback: /* @__PURE__ */ __name$
|
|
67356
|
+
valueCallback: /* @__PURE__ */ __name$2((value) => parseInt(value, 10), "valueCallback")
|
|
67357
67357
|
}),
|
|
67358
67358
|
era: buildMatchFn({
|
|
67359
67359
|
matchPatterns: {
|
|
@@ -67379,7 +67379,7 @@ var enUS = {
|
|
|
67379
67379
|
/4/i
|
|
67380
67380
|
] },
|
|
67381
67381
|
defaultParseWidth: "any",
|
|
67382
|
-
valueCallback: /* @__PURE__ */ __name$
|
|
67382
|
+
valueCallback: /* @__PURE__ */ __name$2((index) => index + 1, "valueCallback")
|
|
67383
67383
|
}),
|
|
67384
67384
|
month: buildMatchFn({
|
|
67385
67385
|
matchPatterns: {
|
|
@@ -67517,14 +67517,14 @@ function formatDistanceStrict(laterDate, earlierDate, options) {
|
|
|
67517
67517
|
return locale.formatDistance("xYears", years, localizeOptions);
|
|
67518
67518
|
}
|
|
67519
67519
|
}
|
|
67520
|
-
__name$
|
|
67520
|
+
__name$2(formatDistanceStrict, "formatDistanceStrict");
|
|
67521
67521
|
function formatDistanceToNowStrict(date$2, options) {
|
|
67522
67522
|
return formatDistanceStrict(date$2, constructNow(date$2), options);
|
|
67523
67523
|
}
|
|
67524
|
-
__name$
|
|
67524
|
+
__name$2(formatDistanceToNowStrict, "formatDistanceToNowStrict");
|
|
67525
67525
|
function createFileStorage(format$3, getPath) {
|
|
67526
67526
|
return {
|
|
67527
|
-
read: /* @__PURE__ */ __name$
|
|
67527
|
+
read: /* @__PURE__ */ __name$2(() => {
|
|
67528
67528
|
const filePath = getPath();
|
|
67529
67529
|
if (!existsSync(filePath)) return;
|
|
67530
67530
|
const contents = readFileSync$1(filePath);
|
|
@@ -67552,10 +67552,10 @@ function createFileStorage(format$3, getPath) {
|
|
|
67552
67552
|
path: getPath
|
|
67553
67553
|
};
|
|
67554
67554
|
}
|
|
67555
|
-
__name$
|
|
67555
|
+
__name$2(createFileStorage, "createFileStorage");
|
|
67556
67556
|
function createTemporaryTermsPrompt(deps) {
|
|
67557
67557
|
const { temporaryAccountLogger, prompt } = deps;
|
|
67558
|
-
return /* @__PURE__ */ __name$
|
|
67558
|
+
return /* @__PURE__ */ __name$2(async function ensureTemporaryTermsAccepted(question, notice) {
|
|
67559
67559
|
if (isNonInteractiveOrCI()) {
|
|
67560
67560
|
temporaryAccountLogger.log(notice);
|
|
67561
67561
|
return true;
|
|
@@ -67564,17 +67564,17 @@ function createTemporaryTermsPrompt(deps) {
|
|
|
67564
67564
|
return typeof answer === "string" && answer.trim().toLowerCase() === "yes";
|
|
67565
67565
|
}, "ensureTemporaryTermsAccepted");
|
|
67566
67566
|
}
|
|
67567
|
-
__name$
|
|
67567
|
+
__name$2(createTemporaryTermsPrompt, "createTemporaryTermsPrompt");
|
|
67568
67568
|
var MEMBERSHIPS_INACCESSIBLE_CODES = [9106, 1e4];
|
|
67569
67569
|
function getErrorCode(err) {
|
|
67570
67570
|
return err?.code;
|
|
67571
67571
|
}
|
|
67572
|
-
__name$
|
|
67572
|
+
__name$2(getErrorCode, "getErrorCode");
|
|
67573
67573
|
function isMembershipsInaccessible(err) {
|
|
67574
67574
|
const code = getErrorCode(err);
|
|
67575
67575
|
return code !== void 0 && MEMBERSHIPS_INACCESSIBLE_CODES.includes(code);
|
|
67576
67576
|
}
|
|
67577
|
-
__name$
|
|
67577
|
+
__name$2(isMembershipsInaccessible, "isMembershipsInaccessible");
|
|
67578
67578
|
function notLoggedInErrorBodies(loginCommand) {
|
|
67579
67579
|
return {
|
|
67580
67580
|
"no-credentials-non-interactive": `Could not authenticate because no credentials were found and the environment is non-interactive. Set a CLOUDFLARE_API_TOKEN environment variable or run \`${loginCommand}\` in an interactive terminal first.`,
|
|
@@ -67584,7 +67584,7 @@ function notLoggedInErrorBodies(loginCommand) {
|
|
|
67584
67584
|
"token-refresh-unreachable": `Your auth token has expired and could not be refreshed because the Cloudflare auth server could not be reached. This is usually a network problem (connectivity, proxy, or IPv6), not an invalid login: your stored credentials were left unchanged. Check your connection and try again.`
|
|
67585
67585
|
};
|
|
67586
67586
|
}
|
|
67587
|
-
__name$
|
|
67587
|
+
__name$2(notLoggedInErrorBodies, "notLoggedInErrorBodies");
|
|
67588
67588
|
function logTemporaryPreviewAccount(temporaryAccountLogger, temporaryPreviewAccount, cached$2) {
|
|
67589
67589
|
const claimExpiresAt = new Date(temporaryPreviewAccount.claim.expiresAt);
|
|
67590
67590
|
temporaryAccountLogger.log(dedent`
|
|
@@ -67594,7 +67594,7 @@ function logTemporaryPreviewAccount(temporaryAccountLogger, temporaryPreviewAcco
|
|
|
67594
67594
|
Claim URL: ${temporaryPreviewAccount.claim.url}
|
|
67595
67595
|
`);
|
|
67596
67596
|
}
|
|
67597
|
-
__name$
|
|
67597
|
+
__name$2(logTemporaryPreviewAccount, "logTemporaryPreviewAccount");
|
|
67598
67598
|
function createCloudflareAuth(descriptor, ctx) {
|
|
67599
67599
|
const { logger: logger$2 } = ctx;
|
|
67600
67600
|
const temporaryAccountLogger = ctx.temporaryAccountLogger ?? logger$2;
|
|
@@ -67611,16 +67611,16 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67611
67611
|
function clearAccountSelection() {
|
|
67612
67612
|
accountSelection = void 0;
|
|
67613
67613
|
}
|
|
67614
|
-
__name$
|
|
67614
|
+
__name$2(clearAccountSelection, "clearAccountSelection");
|
|
67615
67615
|
function purgeAccountCaches() {
|
|
67616
67616
|
clearAccountSelection();
|
|
67617
67617
|
configCache.purgeConfigCaches();
|
|
67618
67618
|
}
|
|
67619
|
-
__name$
|
|
67619
|
+
__name$2(purgeAccountCaches, "purgeAccountCaches");
|
|
67620
67620
|
const credentialStorage = createCredentialStorageContext({
|
|
67621
67621
|
serviceName: descriptor.keyringServiceName,
|
|
67622
67622
|
getConfigPath: descriptor.getConfigPath,
|
|
67623
|
-
isKeyringEnabled: /* @__PURE__ */ __name$
|
|
67623
|
+
isKeyringEnabled: /* @__PURE__ */ __name$2(() => preferences.readUserPreferences().keyring_enabled === true, "isKeyringEnabled"),
|
|
67624
67624
|
logger: logger$2,
|
|
67625
67625
|
isNonInteractiveOrCI,
|
|
67626
67626
|
loginCommand: descriptor.commands.login,
|
|
@@ -67630,8 +67630,8 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67630
67630
|
const oauthFlow = createOAuthFlow({
|
|
67631
67631
|
logger: logger$2,
|
|
67632
67632
|
isNonInteractiveOrCI,
|
|
67633
|
-
openInBrowser: /* @__PURE__ */ __name$
|
|
67634
|
-
hasEnvCredentials: /* @__PURE__ */ __name$
|
|
67633
|
+
openInBrowser: /* @__PURE__ */ __name$2((url$2) => openInBrowser(url$2, logger$2), "openInBrowser"),
|
|
67634
|
+
hasEnvCredentials: /* @__PURE__ */ __name$2(() => getAuthFromEnv({ allowGlobalAuthKey }) !== void 0, "hasEnvCredentials"),
|
|
67635
67635
|
purgeOnLoginOrLogout: purgeAccountCaches,
|
|
67636
67636
|
clientId: descriptor.clientId,
|
|
67637
67637
|
consent: descriptor.consent,
|
|
@@ -67655,27 +67655,27 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67655
67655
|
function setProfile(profile) {
|
|
67656
67656
|
oauthFlow.setProfile(profile);
|
|
67657
67657
|
}
|
|
67658
|
-
__name$
|
|
67658
|
+
__name$2(setProfile, "setProfile");
|
|
67659
67659
|
function getActiveProfile() {
|
|
67660
67660
|
return oauthFlow.getActiveProfile();
|
|
67661
67661
|
}
|
|
67662
|
-
__name$
|
|
67662
|
+
__name$2(getActiveProfile, "getActiveProfile");
|
|
67663
67663
|
function getCredentialStore() {
|
|
67664
67664
|
return credentialStorage.getActiveStore(oauthFlow.getActiveProfile());
|
|
67665
67665
|
}
|
|
67666
|
-
__name$
|
|
67666
|
+
__name$2(getCredentialStore, "getCredentialStore");
|
|
67667
67667
|
function setTemporaryAllowed(allowed, request$2) {
|
|
67668
67668
|
oauthFlow.setTemporaryAllowed(allowed, request$2);
|
|
67669
67669
|
}
|
|
67670
|
-
__name$
|
|
67670
|
+
__name$2(setTemporaryAllowed, "setTemporaryAllowed");
|
|
67671
67671
|
function getAPIToken$1() {
|
|
67672
67672
|
return oauthFlow.getAPIToken();
|
|
67673
67673
|
}
|
|
67674
|
-
__name$
|
|
67674
|
+
__name$2(getAPIToken$1, "getAPIToken");
|
|
67675
67675
|
function requireApiToken$1() {
|
|
67676
67676
|
return oauthFlow.requireApiToken();
|
|
67677
67677
|
}
|
|
67678
|
-
__name$
|
|
67678
|
+
__name$2(requireApiToken$1, "requireApiToken");
|
|
67679
67679
|
function withLoginDefaults(complianceConfig, props) {
|
|
67680
67680
|
return {
|
|
67681
67681
|
complianceConfig,
|
|
@@ -67687,43 +67687,43 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67687
67687
|
device: props?.device ?? descriptor.useDeviceFlowByDefault ?? false
|
|
67688
67688
|
};
|
|
67689
67689
|
}
|
|
67690
|
-
__name$
|
|
67690
|
+
__name$2(withLoginDefaults, "withLoginDefaults");
|
|
67691
67691
|
async function login(complianceConfig, props) {
|
|
67692
67692
|
return oauthFlow.login(withLoginDefaults(complianceConfig, props));
|
|
67693
67693
|
}
|
|
67694
|
-
__name$
|
|
67694
|
+
__name$2(login, "login");
|
|
67695
67695
|
async function logout(profile) {
|
|
67696
67696
|
return oauthFlow.logout(profile);
|
|
67697
67697
|
}
|
|
67698
|
-
__name$
|
|
67698
|
+
__name$2(logout, "logout");
|
|
67699
67699
|
async function loginOrRefreshIfRequired(complianceConfig, props) {
|
|
67700
67700
|
if (oauthFlow.getActiveTemporaryAccount()) return { loggedIn: true };
|
|
67701
67701
|
return oauthFlow.loginOrRefreshIfRequired(withLoginDefaults(complianceConfig, props));
|
|
67702
67702
|
}
|
|
67703
|
-
__name$
|
|
67703
|
+
__name$2(loginOrRefreshIfRequired, "loginOrRefreshIfRequired");
|
|
67704
67704
|
async function getOAuthTokenFromLocalState() {
|
|
67705
67705
|
return oauthFlow.getOAuthTokenFromLocalState();
|
|
67706
67706
|
}
|
|
67707
|
-
__name$
|
|
67707
|
+
__name$2(getOAuthTokenFromLocalState, "getOAuthTokenFromLocalState");
|
|
67708
67708
|
function getScopes() {
|
|
67709
67709
|
return oauthFlow.getScopes();
|
|
67710
67710
|
}
|
|
67711
|
-
__name$
|
|
67711
|
+
__name$2(getScopes, "getScopes");
|
|
67712
67712
|
function readAuthCredentials() {
|
|
67713
67713
|
return credentialStorage.storageFactory(getActiveProfile()).read();
|
|
67714
67714
|
}
|
|
67715
|
-
__name$
|
|
67715
|
+
__name$2(readAuthCredentials, "readAuthCredentials");
|
|
67716
67716
|
function writeAuthCredentials(config$3) {
|
|
67717
67717
|
clearAccountSelection();
|
|
67718
67718
|
credentialStorage.storageFactory(getActiveProfile()).write(config$3);
|
|
67719
67719
|
}
|
|
67720
|
-
__name$
|
|
67720
|
+
__name$2(writeAuthCredentials, "writeAuthCredentials");
|
|
67721
67721
|
function getAccountCacheFileName() {
|
|
67722
67722
|
const profile = oauthFlow.getActiveProfile();
|
|
67723
67723
|
if (profile === "default") return `${descriptor.accountCachePrefix}.json`;
|
|
67724
67724
|
return `${descriptor.accountCachePrefix}-${profile}.json`;
|
|
67725
67725
|
}
|
|
67726
|
-
__name$
|
|
67726
|
+
__name$2(getAccountCacheFileName, "getAccountCacheFileName");
|
|
67727
67727
|
function retainAccountSelection(account) {
|
|
67728
67728
|
accountSelection = {
|
|
67729
67729
|
account,
|
|
@@ -67731,7 +67731,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67731
67731
|
};
|
|
67732
67732
|
if (persistAccountSelection) configCache.saveToConfigCache(getAccountCacheFileName(), { account });
|
|
67733
67733
|
}
|
|
67734
|
-
__name$
|
|
67734
|
+
__name$2(retainAccountSelection, "retainAccountSelection");
|
|
67735
67735
|
function resolveAccountSelection() {
|
|
67736
67736
|
const profile = getActiveProfile();
|
|
67737
67737
|
if (persistAccountSelection) {
|
|
@@ -67743,12 +67743,12 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67743
67743
|
} else if (accountSelection?.profile !== profile) clearAccountSelection();
|
|
67744
67744
|
return accountSelection?.account;
|
|
67745
67745
|
}
|
|
67746
|
-
__name$
|
|
67746
|
+
__name$2(resolveAccountSelection, "resolveAccountSelection");
|
|
67747
67747
|
function getAccountFromCache() {
|
|
67748
67748
|
if (!persistAccountSelection) return;
|
|
67749
67749
|
return configCache.getConfigCache(getAccountCacheFileName()).account;
|
|
67750
67750
|
}
|
|
67751
|
-
__name$
|
|
67751
|
+
__name$2(getAccountFromCache, "getAccountFromCache");
|
|
67752
67752
|
async function fetchAccountsPaged(complianceConfig, resource, credentials) {
|
|
67753
67753
|
const results = [];
|
|
67754
67754
|
let getMoreResults = true;
|
|
@@ -67766,7 +67766,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67766
67766
|
}
|
|
67767
67767
|
return results;
|
|
67768
67768
|
}
|
|
67769
|
-
__name$
|
|
67769
|
+
__name$2(fetchAccountsPaged, "fetchAccountsPaged");
|
|
67770
67770
|
async function fetchAllAccounts(complianceConfig, options = {}) {
|
|
67771
67771
|
const { throwOnEmpty = true } = options;
|
|
67772
67772
|
const loginResult = await loginOrRefreshIfRequired(complianceConfig);
|
|
@@ -67790,7 +67790,7 @@ In a non-interactive environment, it is mandatory to specify an account ID, eith
|
|
|
67790
67790
|
Alternatively, try running \`${descriptor.commands.login}\` to re-authenticate.`, { telemetryMessage: "user account fetch empty" });
|
|
67791
67791
|
return usableAccounts;
|
|
67792
67792
|
}
|
|
67793
|
-
__name$
|
|
67793
|
+
__name$2(fetchAllAccounts, "fetchAllAccounts");
|
|
67794
67794
|
function getActiveAccountId(config$3) {
|
|
67795
67795
|
const temporaryAccount = oauthFlow.getActiveTemporaryAccount();
|
|
67796
67796
|
if (temporaryAccount) return temporaryAccount.account.id;
|
|
@@ -67799,7 +67799,7 @@ Alternatively, try running \`${descriptor.commands.login}\` to re-authenticate.`
|
|
|
67799
67799
|
if (envAccountId) return envAccountId;
|
|
67800
67800
|
return resolveAccountSelection()?.id;
|
|
67801
67801
|
}
|
|
67802
|
-
__name$
|
|
67802
|
+
__name$2(getActiveAccountId, "getActiveAccountId");
|
|
67803
67803
|
async function selectAccountId(config$3) {
|
|
67804
67804
|
const accounts = await fetchAllAccounts(config$3);
|
|
67805
67805
|
if (accounts.length === 1) {
|
|
@@ -67832,7 +67832,7 @@ ${accounts.map((account) => ` \`${redactAccountName ? "(redacted)" : account.na
|
|
|
67832
67832
|
throw e;
|
|
67833
67833
|
}
|
|
67834
67834
|
}
|
|
67835
|
-
__name$
|
|
67835
|
+
__name$2(selectAccountId, "selectAccountId");
|
|
67836
67836
|
async function getOrSelectAccountId(config$3) {
|
|
67837
67837
|
const activeAccountId = getActiveAccountId(config$3);
|
|
67838
67838
|
if (activeAccountId) return activeAccountId;
|
|
@@ -67841,7 +67841,7 @@ ${accounts.map((account) => ` \`${redactAccountName ? "(redacted)" : account.na
|
|
|
67841
67841
|
});
|
|
67842
67842
|
return accountSelectionPromise;
|
|
67843
67843
|
}
|
|
67844
|
-
__name$
|
|
67844
|
+
__name$2(getOrSelectAccountId, "getOrSelectAccountId");
|
|
67845
67845
|
async function requireAuth(config$3) {
|
|
67846
67846
|
if (oauthFlow.isTemporaryAllowed()) {
|
|
67847
67847
|
if (getCloudflareComplianceRegion(config$3) !== "public") throw new UserError("Temporary accounts aren't available when the compliance region is not set to public.", { telemetryMessage: "user temporary account unavailable in compliance region" });
|
|
@@ -67860,7 +67860,7 @@ ${accounts.map((account) => ` \`${redactAccountName ? "(redacted)" : account.na
|
|
|
67860
67860
|
if (!accountId) throw new UserError("No account id found, quitting...", { telemetryMessage: "user auth missing account id" });
|
|
67861
67861
|
return accountId;
|
|
67862
67862
|
}
|
|
67863
|
-
__name$
|
|
67863
|
+
__name$2(requireAuth, "requireAuth");
|
|
67864
67864
|
return {
|
|
67865
67865
|
setProfile,
|
|
67866
67866
|
getActiveProfile,
|
|
@@ -67882,24 +67882,24 @@ ${accounts.map((account) => ` \`${redactAccountName ? "(redacted)" : account.na
|
|
|
67882
67882
|
requireAuth
|
|
67883
67883
|
};
|
|
67884
67884
|
}
|
|
67885
|
-
__name$
|
|
67885
|
+
__name$2(createCloudflareAuth, "createCloudflareAuth");
|
|
67886
67886
|
var DIRECTORY_BINDINGS_FILE = "profiles/directory-bindings.json";
|
|
67887
67887
|
var ENCRYPTED_PROFILE_CONFIG_EXTENSION = ".enc";
|
|
67888
67888
|
function createCloudflareProfileStore(ctx) {
|
|
67889
67889
|
const { logger: logger$2, getConfigPath, keyringServiceName, format: format$3 } = ctx;
|
|
67890
67890
|
const plaintextExtension = `.${format$3}`;
|
|
67891
67891
|
function plaintextPath(profile) {
|
|
67892
|
-
return getAuthConfigFilePath$
|
|
67892
|
+
return getAuthConfigFilePath$1(getConfigPath(), profile, format$3);
|
|
67893
67893
|
}
|
|
67894
|
-
__name$
|
|
67894
|
+
__name$2(plaintextPath, "plaintextPath");
|
|
67895
67895
|
function encryptedPath(profile) {
|
|
67896
|
-
return getEncryptedAuthConfigFilePath$
|
|
67896
|
+
return getEncryptedAuthConfigFilePath$1(getConfigPath(), profile);
|
|
67897
67897
|
}
|
|
67898
|
-
__name$
|
|
67898
|
+
__name$2(encryptedPath, "encryptedPath");
|
|
67899
67899
|
function getProfileConfigDirectory() {
|
|
67900
67900
|
return path__default.dirname(plaintextPath("default"));
|
|
67901
67901
|
}
|
|
67902
|
-
__name$
|
|
67902
|
+
__name$2(getProfileConfigDirectory, "getProfileConfigDirectory");
|
|
67903
67903
|
const configs = {
|
|
67904
67904
|
exists(profile) {
|
|
67905
67905
|
return existsSync(plaintextPath(profile)) || existsSync(encryptedPath(profile));
|
|
@@ -67926,7 +67926,7 @@ function createCloudflareProfileStore(ctx) {
|
|
|
67926
67926
|
function getDirectoryBindingsPath() {
|
|
67927
67927
|
return path__default.join(getConfigPath(), DIRECTORY_BINDINGS_FILE);
|
|
67928
67928
|
}
|
|
67929
|
-
__name$
|
|
67929
|
+
__name$2(getDirectoryBindingsPath, "getDirectoryBindingsPath");
|
|
67930
67930
|
return createProfileStore({
|
|
67931
67931
|
configs,
|
|
67932
67932
|
bindings: {
|
|
@@ -67946,17 +67946,17 @@ function createCloudflareProfileStore(ctx) {
|
|
|
67946
67946
|
}
|
|
67947
67947
|
});
|
|
67948
67948
|
}
|
|
67949
|
-
__name$
|
|
67949
|
+
__name$2(createCloudflareProfileStore, "createCloudflareProfileStore");
|
|
67950
67950
|
function createKeyringPreference(deps) {
|
|
67951
67951
|
const { loginCommand, createProfileCommand, keyringServiceName, getConfigPath, format: format$3, preferences } = deps;
|
|
67952
|
-
const { readUserPreferences: readUserPreferences$
|
|
67952
|
+
const { readUserPreferences: readUserPreferences$1, updateUserPreferences: updateUserPreferences$1 } = preferences;
|
|
67953
67953
|
function describeProfile(profile) {
|
|
67954
67954
|
return profile ?? "default";
|
|
67955
67955
|
}
|
|
67956
|
-
__name$
|
|
67956
|
+
__name$2(describeProfile, "describeProfile");
|
|
67957
67957
|
function listEncryptedProfiles(logger$2) {
|
|
67958
67958
|
const encrypted = [];
|
|
67959
|
-
if (existsSync(getEncryptedAuthConfigFilePath$
|
|
67959
|
+
if (existsSync(getEncryptedAuthConfigFilePath$1(getConfigPath()))) encrypted.push(void 0);
|
|
67960
67960
|
const profileStore = createCloudflareProfileStore({
|
|
67961
67961
|
logger: logger$2,
|
|
67962
67962
|
getConfigPath,
|
|
@@ -67969,11 +67969,11 @@ function createKeyringPreference(deps) {
|
|
|
67969
67969
|
} catch {
|
|
67970
67970
|
continue;
|
|
67971
67971
|
}
|
|
67972
|
-
if (existsSync(getEncryptedAuthConfigFilePath$
|
|
67972
|
+
if (existsSync(getEncryptedAuthConfigFilePath$1(getConfigPath(), name))) encrypted.push(name);
|
|
67973
67973
|
}
|
|
67974
67974
|
return encrypted;
|
|
67975
67975
|
}
|
|
67976
|
-
__name$
|
|
67976
|
+
__name$2(listEncryptedProfiles, "listEncryptedProfiles");
|
|
67977
67977
|
function scrubAllEncryptedProfiles(logger$2) {
|
|
67978
67978
|
const encryptedProfiles = listEncryptedProfiles(logger$2);
|
|
67979
67979
|
if (encryptedProfiles.length === 0) return;
|
|
@@ -67997,60 +67997,60 @@ function createKeyringPreference(deps) {
|
|
|
67997
67997
|
}
|
|
67998
67998
|
if (unreachable.length > 0) logger$2.warn(`The keyring backend was not reachable on this host, so the keyring entry for ${unreachable.map((p$2) => `"${p$2}"`).join(", ")} could not be cleared. Clear it manually if it persists.`);
|
|
67999
67999
|
}
|
|
68000
|
-
__name$
|
|
68001
|
-
function setKeyringPreference$
|
|
68000
|
+
__name$2(scrubAllEncryptedProfiles, "scrubAllEncryptedProfiles");
|
|
68001
|
+
function setKeyringPreference$1(enabled, ctx) {
|
|
68002
68002
|
const { logger: logger$2, getCredentialStore } = ctx;
|
|
68003
|
-
const previouslyEnabled = readUserPreferences$
|
|
68003
|
+
const previouslyEnabled = readUserPreferences$1().keyring_enabled === true;
|
|
68004
68004
|
const envOverride = getCloudflareAuthUseKeyringFromEnv();
|
|
68005
68005
|
if (envOverride !== void 0 && envOverride !== enabled) logger$2.warn(`CLOUDFLARE_AUTH_USE_KEYRING=${envOverride} overrides ${enabled ? "enabling" : "disabling"} keyring storage for this command.`);
|
|
68006
68006
|
if (!enabled && envOverride !== true) scrubAllEncryptedProfiles(logger$2);
|
|
68007
|
-
updateUserPreferences$
|
|
68007
|
+
updateUserPreferences$1({ keyring_enabled: enabled });
|
|
68008
68008
|
if (enabled && envOverride !== false) try {
|
|
68009
68009
|
if (getCredentialStore().kind !== "encrypted-file") {
|
|
68010
|
-
updateUserPreferences$
|
|
68010
|
+
updateUserPreferences$1({ keyring_enabled: previouslyEnabled });
|
|
68011
68011
|
logger$2.warn("Keyring storage isn't available on this host (see warning above), so it was not enabled. Try again once the keyring backend is reachable.");
|
|
68012
68012
|
}
|
|
68013
68013
|
} catch (e) {
|
|
68014
|
-
updateUserPreferences$
|
|
68014
|
+
updateUserPreferences$1({ keyring_enabled: previouslyEnabled });
|
|
68015
68015
|
throw e;
|
|
68016
68016
|
}
|
|
68017
|
-
return { enabled: readUserPreferences$
|
|
68017
|
+
return { enabled: readUserPreferences$1().keyring_enabled === true };
|
|
68018
68018
|
}
|
|
68019
|
-
__name$
|
|
68020
|
-
return { setKeyringPreference: setKeyringPreference$
|
|
68019
|
+
__name$2(setKeyringPreference$1, "setKeyringPreference");
|
|
68020
|
+
return { setKeyringPreference: setKeyringPreference$1 };
|
|
68021
68021
|
}
|
|
68022
|
-
__name$
|
|
68022
|
+
__name$2(createKeyringPreference, "createKeyringPreference");
|
|
68023
68023
|
function createAuthConfigFileHelpers(deps) {
|
|
68024
68024
|
const { getConfigPath, format: format$3 } = deps;
|
|
68025
68025
|
function getAuthConfigFilePath2(profile) {
|
|
68026
|
-
return getAuthConfigFilePath$
|
|
68026
|
+
return getAuthConfigFilePath$1(getConfigPath(), profile, format$3);
|
|
68027
68027
|
}
|
|
68028
|
-
__name$
|
|
68028
|
+
__name$2(getAuthConfigFilePath2, "getAuthConfigFilePath");
|
|
68029
68029
|
function getEncryptedAuthConfigFilePath2(profile) {
|
|
68030
|
-
return getEncryptedAuthConfigFilePath$
|
|
68030
|
+
return getEncryptedAuthConfigFilePath$1(getConfigPath(), profile);
|
|
68031
68031
|
}
|
|
68032
|
-
__name$
|
|
68033
|
-
function defaultAuthConfigStorage$
|
|
68032
|
+
__name$2(getEncryptedAuthConfigFilePath2, "getEncryptedAuthConfigFilePath");
|
|
68033
|
+
function defaultAuthConfigStorage$1(profile) {
|
|
68034
68034
|
return createFileStorage(format$3, () => getAuthConfigFilePath2(profile));
|
|
68035
68035
|
}
|
|
68036
|
-
__name$
|
|
68037
|
-
function writeAuthConfigFile$
|
|
68038
|
-
defaultAuthConfigStorage$
|
|
68036
|
+
__name$2(defaultAuthConfigStorage$1, "defaultAuthConfigStorage");
|
|
68037
|
+
function writeAuthConfigFile$1(config$3, profile) {
|
|
68038
|
+
defaultAuthConfigStorage$1(profile).write(config$3);
|
|
68039
68039
|
}
|
|
68040
|
-
__name$
|
|
68041
|
-
function readAuthConfigFile$
|
|
68042
|
-
return defaultAuthConfigStorage$
|
|
68040
|
+
__name$2(writeAuthConfigFile$1, "writeAuthConfigFile");
|
|
68041
|
+
function readAuthConfigFile$1(profile) {
|
|
68042
|
+
return defaultAuthConfigStorage$1(profile).read();
|
|
68043
68043
|
}
|
|
68044
|
-
__name$
|
|
68044
|
+
__name$2(readAuthConfigFile$1, "readAuthConfigFile");
|
|
68045
68045
|
return {
|
|
68046
68046
|
getAuthConfigFilePath: getAuthConfigFilePath2,
|
|
68047
68047
|
getEncryptedAuthConfigFilePath: getEncryptedAuthConfigFilePath2,
|
|
68048
|
-
defaultAuthConfigStorage: defaultAuthConfigStorage$
|
|
68049
|
-
readAuthConfigFile: readAuthConfigFile$
|
|
68050
|
-
writeAuthConfigFile: writeAuthConfigFile$
|
|
68048
|
+
defaultAuthConfigStorage: defaultAuthConfigStorage$1,
|
|
68049
|
+
readAuthConfigFile: readAuthConfigFile$1,
|
|
68050
|
+
writeAuthConfigFile: writeAuthConfigFile$1
|
|
68051
68051
|
};
|
|
68052
68052
|
}
|
|
68053
|
-
__name$
|
|
68053
|
+
__name$2(createAuthConfigFileHelpers, "createAuthConfigFileHelpers");
|
|
68054
68054
|
|
|
68055
68055
|
//#endregion
|
|
68056
68056
|
//#region ../workers-auth/dist/cf/index.mjs
|
|
@@ -68066,9 +68066,9 @@ var CF_CONSENT_PAGES = {
|
|
|
68066
68066
|
error: "Error: Consent denied. You must grant consent to cf in order to login.\nIf you don't want to do this consider passing an API token via the `CLOUDFLARE_API_TOKEN` environment variable"
|
|
68067
68067
|
}
|
|
68068
68068
|
};
|
|
68069
|
-
var getClientIdFromEnv
|
|
68069
|
+
var getClientIdFromEnv = getEnvironmentVariableFactory({
|
|
68070
68070
|
variableName: "CLOUDFLARE_CLIENT_ID",
|
|
68071
|
-
defaultValue: /* @__PURE__ */ __name$
|
|
68071
|
+
defaultValue: /* @__PURE__ */ __name$2(() => "cbca97e7-c331-4cdd-8fd8-e25a451b98bf", "defaultValue")
|
|
68072
68072
|
});
|
|
68073
68073
|
function getCfConfigPath() {
|
|
68074
68074
|
return getGlobalConfigPath({
|
|
@@ -68077,7 +68077,7 @@ function getCfConfigPath() {
|
|
|
68077
68077
|
useLegacyHomeDir: false
|
|
68078
68078
|
});
|
|
68079
68079
|
}
|
|
68080
|
-
__name$
|
|
68080
|
+
__name$2(getCfConfigPath, "getCfConfigPath");
|
|
68081
68081
|
var CF_CLIENT_REGISTERED_SCOPES = [
|
|
68082
68082
|
"access:read",
|
|
68083
68083
|
"access:write",
|
|
@@ -68572,30 +68572,30 @@ var CF_UNGRANTABLE_SCOPE_SET = new Set([
|
|
|
68572
68572
|
"oauth_account_ssl_and_certificates_write"
|
|
68573
68573
|
]);
|
|
68574
68574
|
var CF_REQUESTABLE_SCOPES = CF_CLIENT_REGISTERED_SCOPES.filter((scope) => !CF_UNGRANTABLE_SCOPE_SET.has(scope));
|
|
68575
|
-
var DefaultScopeKeys
|
|
68576
|
-
function setLoginScopeKeys
|
|
68577
|
-
DefaultScopeKeys
|
|
68575
|
+
var DefaultScopeKeys = [...CF_REQUESTABLE_SCOPES];
|
|
68576
|
+
function setLoginScopeKeys(scopes) {
|
|
68577
|
+
DefaultScopeKeys = scopes;
|
|
68578
68578
|
}
|
|
68579
|
-
__name$
|
|
68579
|
+
__name$2(setLoginScopeKeys, "setLoginScopeKeys");
|
|
68580
68580
|
var CF_SCOPE_SET = new Set(CF_REQUESTABLE_SCOPES);
|
|
68581
|
-
function validateScopeKeys
|
|
68581
|
+
function validateScopeKeys(scopes) {
|
|
68582
68582
|
return scopes.every((scope) => CF_SCOPE_SET.has(scope));
|
|
68583
68583
|
}
|
|
68584
|
-
__name$
|
|
68585
|
-
function getTemporaryAccountConfigFile
|
|
68584
|
+
__name$2(validateScopeKeys, "validateScopeKeys");
|
|
68585
|
+
function getTemporaryAccountConfigFile() {
|
|
68586
68586
|
const environment = getCloudflareApiEnvironmentFromEnv();
|
|
68587
68587
|
return environment === "production" ? "cloudflare-temporary-account.json" : `cloudflare-temporary-account.${environment}.json`;
|
|
68588
68588
|
}
|
|
68589
|
-
__name$
|
|
68589
|
+
__name$2(getTemporaryAccountConfigFile, "getTemporaryAccountConfigFile");
|
|
68590
68590
|
function getCfTemporaryAccountConfigPath() {
|
|
68591
|
-
return path__default.join(getCfConfigPath(), getTemporaryAccountConfigFile
|
|
68591
|
+
return path__default.join(getCfConfigPath(), getTemporaryAccountConfigFile());
|
|
68592
68592
|
}
|
|
68593
|
-
__name$
|
|
68593
|
+
__name$2(getCfTemporaryAccountConfigPath, "getCfTemporaryAccountConfigPath");
|
|
68594
68594
|
function createJsonFileStorage(getPath) {
|
|
68595
68595
|
return createFileStorage("json", getPath);
|
|
68596
68596
|
}
|
|
68597
|
-
__name$
|
|
68598
|
-
var { getAuthConfigFilePath
|
|
68597
|
+
__name$2(createJsonFileStorage, "createJsonFileStorage");
|
|
68598
|
+
var { getAuthConfigFilePath, getEncryptedAuthConfigFilePath, defaultAuthConfigStorage, readAuthConfigFile, writeAuthConfigFile } = createAuthConfigFileHelpers({
|
|
68599
68599
|
getConfigPath: getCfConfigPath,
|
|
68600
68600
|
format: "json"
|
|
68601
68601
|
});
|
|
@@ -68611,7 +68611,7 @@ var CF_CLI = {
|
|
|
68611
68611
|
deviceLogin: "cf auth login"
|
|
68612
68612
|
},
|
|
68613
68613
|
keyringServiceName: CF_KEYRING_SERVICE_NAME,
|
|
68614
|
-
clientId: getClientIdFromEnv
|
|
68614
|
+
clientId: getClientIdFromEnv,
|
|
68615
68615
|
consent: CF_CONSENT_PAGES,
|
|
68616
68616
|
redirectUri: CF_OAUTH_CALLBACK_URL,
|
|
68617
68617
|
useDeviceFlowByDefault: true,
|
|
@@ -68621,15 +68621,15 @@ var CF_CLI = {
|
|
|
68621
68621
|
fileFormat: "json",
|
|
68622
68622
|
accountCachePrefix: "cloudflare-account",
|
|
68623
68623
|
cacheNamespace: "cloudflare",
|
|
68624
|
-
getConfigFileLabel: /* @__PURE__ */ __name$
|
|
68625
|
-
getDefaultScopeKeys: /* @__PURE__ */ __name$
|
|
68624
|
+
getConfigFileLabel: /* @__PURE__ */ __name$2(() => "cloudflare.config.ts", "getConfigFileLabel"),
|
|
68625
|
+
getDefaultScopeKeys: /* @__PURE__ */ __name$2(() => DefaultScopeKeys, "getDefaultScopeKeys")
|
|
68626
68626
|
};
|
|
68627
68627
|
var cfPreferences = createPreferences(getCfConfigPath);
|
|
68628
|
-
var { readUserPreferences
|
|
68628
|
+
var { readUserPreferences, updateUserPreferences } = cfPreferences;
|
|
68629
68629
|
function createCfAuth(ctx) {
|
|
68630
68630
|
return createCloudflareAuth(CF_CLI, ctx);
|
|
68631
68631
|
}
|
|
68632
|
-
__name$
|
|
68632
|
+
__name$2(createCfAuth, "createCfAuth");
|
|
68633
68633
|
function createCfProfileStore(ctx) {
|
|
68634
68634
|
return createCloudflareProfileStore({
|
|
68635
68635
|
logger: ctx.logger,
|
|
@@ -68638,7 +68638,7 @@ function createCfProfileStore(ctx) {
|
|
|
68638
68638
|
format: "json"
|
|
68639
68639
|
});
|
|
68640
68640
|
}
|
|
68641
|
-
__name$
|
|
68641
|
+
__name$2(createCfProfileStore, "createCfProfileStore");
|
|
68642
68642
|
var cfKeyringPreference = createKeyringPreference({
|
|
68643
68643
|
loginCommand: CF_CLI.commands.login,
|
|
68644
68644
|
createProfileCommand: CF_CLI.commands.createProfile,
|
|
@@ -68647,10 +68647,10 @@ var cfKeyringPreference = createKeyringPreference({
|
|
|
68647
68647
|
format: "json",
|
|
68648
68648
|
preferences: cfPreferences
|
|
68649
68649
|
});
|
|
68650
|
-
function setKeyringPreference
|
|
68650
|
+
function setKeyringPreference(enabled, ctx) {
|
|
68651
68651
|
return cfKeyringPreference.setKeyringPreference(enabled, ctx);
|
|
68652
68652
|
}
|
|
68653
|
-
__name$
|
|
68653
|
+
__name$2(setKeyringPreference, "setKeyringPreference");
|
|
68654
68654
|
|
|
68655
68655
|
//#endregion
|
|
68656
68656
|
//#region ../../node_modules/.pnpm/@remix-run+node-fetch-server@1.0.0/node_modules/@remix-run/node-fetch-server/dist/lib/request-listener.js
|
|
@@ -80570,7 +80570,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
80570
80570
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
80571
80571
|
var __getProtoOf = Object.getPrototypeOf;
|
|
80572
80572
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
80573
|
-
var __name$
|
|
80573
|
+
var __name$1 = (target$1, value) => __defProp$1(target$1, "name", {
|
|
80574
80574
|
value,
|
|
80575
80575
|
configurable: true
|
|
80576
80576
|
});
|
|
@@ -80612,7 +80612,7 @@ var require_constants = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
80612
80612
|
kListener: Symbol("kListener"),
|
|
80613
80613
|
kStatusCode: Symbol("status-code"),
|
|
80614
80614
|
kWebSocket: Symbol("websocket"),
|
|
80615
|
-
NOOP: /* @__PURE__ */ __name$
|
|
80615
|
+
NOOP: /* @__PURE__ */ __name$1(() => {}, "NOOP")
|
|
80616
80616
|
};
|
|
80617
80617
|
} });
|
|
80618
80618
|
var require_buffer_util = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/buffer-util.js"(exports$1, module$1) {
|
|
@@ -80631,20 +80631,20 @@ var require_buffer_util = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_
|
|
|
80631
80631
|
if (offset < totalLength) return new FastBuffer$1(target$1.buffer, target$1.byteOffset, offset);
|
|
80632
80632
|
return target$1;
|
|
80633
80633
|
}
|
|
80634
|
-
__name$
|
|
80634
|
+
__name$1(concat, "concat");
|
|
80635
80635
|
function _mask(source, mask, output$1, offset, length) {
|
|
80636
80636
|
for (let i$1 = 0; i$1 < length; i$1++) output$1[offset + i$1] = source[i$1] ^ mask[i$1 & 3];
|
|
80637
80637
|
}
|
|
80638
|
-
__name$
|
|
80638
|
+
__name$1(_mask, "_mask");
|
|
80639
80639
|
function _unmask(buffer$3, mask) {
|
|
80640
80640
|
for (let i$1 = 0; i$1 < buffer$3.length; i$1++) buffer$3[i$1] ^= mask[i$1 & 3];
|
|
80641
80641
|
}
|
|
80642
|
-
__name$
|
|
80642
|
+
__name$1(_unmask, "_unmask");
|
|
80643
80643
|
function toArrayBuffer$2(buf) {
|
|
80644
80644
|
if (buf.length === buf.buffer.byteLength) return buf.buffer;
|
|
80645
80645
|
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);
|
|
80646
80646
|
}
|
|
80647
|
-
__name$
|
|
80647
|
+
__name$1(toArrayBuffer$2, "toArrayBuffer");
|
|
80648
80648
|
function toBuffer$1(data$1) {
|
|
80649
80649
|
toBuffer$1.readOnly = true;
|
|
80650
80650
|
if (Buffer.isBuffer(data$1)) return data$1;
|
|
@@ -80657,7 +80657,7 @@ var require_buffer_util = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_
|
|
|
80657
80657
|
}
|
|
80658
80658
|
return buf;
|
|
80659
80659
|
}
|
|
80660
|
-
__name$
|
|
80660
|
+
__name$1(toBuffer$1, "toBuffer");
|
|
80661
80661
|
module$1.exports = {
|
|
80662
80662
|
concat,
|
|
80663
80663
|
mask: _mask,
|
|
@@ -80682,7 +80682,7 @@ var require_limiter = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modu
|
|
|
80682
80682
|
var kRun = Symbol("kRun");
|
|
80683
80683
|
var Limiter = class {
|
|
80684
80684
|
static {
|
|
80685
|
-
__name$
|
|
80685
|
+
__name$1(this, "Limiter");
|
|
80686
80686
|
}
|
|
80687
80687
|
/**
|
|
80688
80688
|
* Creates a new `Limiter`.
|
|
@@ -80745,7 +80745,7 @@ var require_permessage_deflate = __commonJS({ "../../node_modules/.pnpm/ws@8.21.
|
|
|
80745
80745
|
var zlibLimiter;
|
|
80746
80746
|
var PerMessageDeflate2 = class {
|
|
80747
80747
|
static {
|
|
80748
|
-
__name$
|
|
80748
|
+
__name$1(this, "PerMessageDeflate");
|
|
80749
80749
|
}
|
|
80750
80750
|
/**
|
|
80751
80751
|
* Creates a PerMessageDeflate instance.
|
|
@@ -81016,7 +81016,7 @@ var require_permessage_deflate = __commonJS({ "../../node_modules/.pnpm/ws@8.21.
|
|
|
81016
81016
|
this[kBuffers].push(chunk);
|
|
81017
81017
|
this[kTotalLength] += chunk.length;
|
|
81018
81018
|
}
|
|
81019
|
-
__name$
|
|
81019
|
+
__name$1(deflateOnData, "deflateOnData");
|
|
81020
81020
|
function inflateOnData(chunk) {
|
|
81021
81021
|
this[kTotalLength] += chunk.length;
|
|
81022
81022
|
if (this[kPerMessageDeflate]._maxPayload < 1 || this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload) {
|
|
@@ -81029,7 +81029,7 @@ var require_permessage_deflate = __commonJS({ "../../node_modules/.pnpm/ws@8.21.
|
|
|
81029
81029
|
this.removeListener("data", inflateOnData);
|
|
81030
81030
|
this.reset();
|
|
81031
81031
|
}
|
|
81032
|
-
__name$
|
|
81032
|
+
__name$1(inflateOnData, "inflateOnData");
|
|
81033
81033
|
function inflateOnError(err) {
|
|
81034
81034
|
this[kPerMessageDeflate]._inflate = null;
|
|
81035
81035
|
if (this[kError$3]) {
|
|
@@ -81039,7 +81039,7 @@ var require_permessage_deflate = __commonJS({ "../../node_modules/.pnpm/ws@8.21.
|
|
|
81039
81039
|
err[kStatusCode] = 1007;
|
|
81040
81040
|
this[kCallback](err);
|
|
81041
81041
|
}
|
|
81042
|
-
__name$
|
|
81042
|
+
__name$1(inflateOnError, "inflateOnError");
|
|
81043
81043
|
} });
|
|
81044
81044
|
var require_validation = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/validation.js"(exports$1, module$1) {
|
|
81045
81045
|
var { isUtf8: isUtf8$1 } = __require("buffer");
|
|
@@ -81177,7 +81177,7 @@ var require_validation = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_m
|
|
|
81177
81177
|
function isValidStatusCode$2(code) {
|
|
81178
81178
|
return code >= 1e3 && code <= 1014 && code !== 1004 && code !== 1005 && code !== 1006 || code >= 3e3 && code <= 4999;
|
|
81179
81179
|
}
|
|
81180
|
-
__name$
|
|
81180
|
+
__name$1(isValidStatusCode$2, "isValidStatusCode");
|
|
81181
81181
|
function _isValidUTF8(buf) {
|
|
81182
81182
|
const len = buf.length;
|
|
81183
81183
|
let i$1 = 0;
|
|
@@ -81194,11 +81194,11 @@ var require_validation = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_m
|
|
|
81194
81194
|
} else return false;
|
|
81195
81195
|
return true;
|
|
81196
81196
|
}
|
|
81197
|
-
__name$
|
|
81197
|
+
__name$1(_isValidUTF8, "_isValidUTF8");
|
|
81198
81198
|
function isBlob2(value) {
|
|
81199
81199
|
return hasBlob && typeof value === "object" && typeof value.arrayBuffer === "function" && typeof value.type === "string" && typeof value.stream === "function" && (value[Symbol.toStringTag] === "Blob" || value[Symbol.toStringTag] === "File");
|
|
81200
81200
|
}
|
|
81201
|
-
__name$
|
|
81201
|
+
__name$1(isBlob2, "isBlob");
|
|
81202
81202
|
module$1.exports = {
|
|
81203
81203
|
isBlob: isBlob2,
|
|
81204
81204
|
isValidStatusCode: isValidStatusCode$2,
|
|
@@ -81231,7 +81231,7 @@ var require_receiver = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mod
|
|
|
81231
81231
|
var DEFER_EVENT = 6;
|
|
81232
81232
|
var Receiver2 = class extends Writable$3 {
|
|
81233
81233
|
static {
|
|
81234
|
-
__name$
|
|
81234
|
+
__name$1(this, "Receiver");
|
|
81235
81235
|
}
|
|
81236
81236
|
/**
|
|
81237
81237
|
* Creates a Receiver instance.
|
|
@@ -81694,7 +81694,7 @@ var require_sender = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
81694
81694
|
var GET_BLOB_DATA = 2;
|
|
81695
81695
|
module$1.exports = class _Sender {
|
|
81696
81696
|
static {
|
|
81697
|
-
__name$
|
|
81697
|
+
__name$1(this, "Sender");
|
|
81698
81698
|
}
|
|
81699
81699
|
/**
|
|
81700
81700
|
* Creates a Sender instance.
|
|
@@ -82148,12 +82148,12 @@ var require_sender = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
82148
82148
|
if (typeof callback === "function") callback(err);
|
|
82149
82149
|
}
|
|
82150
82150
|
}
|
|
82151
|
-
__name$
|
|
82151
|
+
__name$1(callCallbacks, "callCallbacks");
|
|
82152
82152
|
function onError$1(sender, err, cb) {
|
|
82153
82153
|
callCallbacks(sender, err, cb);
|
|
82154
82154
|
sender.onerror(err);
|
|
82155
82155
|
}
|
|
82156
|
-
__name$
|
|
82156
|
+
__name$1(onError$1, "onError");
|
|
82157
82157
|
} });
|
|
82158
82158
|
var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/event-target.js"(exports$1, module$1) {
|
|
82159
82159
|
var { kForOnEventAttribute, kListener: kListener$1 } = require_constants();
|
|
@@ -82167,7 +82167,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82167
82167
|
var kWasClean = Symbol("kWasClean");
|
|
82168
82168
|
var Event$1 = class {
|
|
82169
82169
|
static {
|
|
82170
|
-
__name$
|
|
82170
|
+
__name$1(this, "Event");
|
|
82171
82171
|
}
|
|
82172
82172
|
/**
|
|
82173
82173
|
* Create a new `Event`.
|
|
@@ -82196,7 +82196,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82196
82196
|
Object.defineProperty(Event$1.prototype, "type", { enumerable: true });
|
|
82197
82197
|
var CloseEvent$3 = class extends Event$1 {
|
|
82198
82198
|
static {
|
|
82199
|
-
__name$
|
|
82199
|
+
__name$1(this, "CloseEvent");
|
|
82200
82200
|
}
|
|
82201
82201
|
/**
|
|
82202
82202
|
* Create a new `CloseEvent`.
|
|
@@ -82241,7 +82241,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82241
82241
|
Object.defineProperty(CloseEvent$3.prototype, "wasClean", { enumerable: true });
|
|
82242
82242
|
var ErrorEvent$3 = class extends Event$1 {
|
|
82243
82243
|
static {
|
|
82244
|
-
__name$
|
|
82244
|
+
__name$1(this, "ErrorEvent");
|
|
82245
82245
|
}
|
|
82246
82246
|
/**
|
|
82247
82247
|
* Create a new `ErrorEvent`.
|
|
@@ -82274,7 +82274,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82274
82274
|
Object.defineProperty(ErrorEvent$3.prototype, "message", { enumerable: true });
|
|
82275
82275
|
var MessageEvent$2 = class extends Event$1 {
|
|
82276
82276
|
static {
|
|
82277
|
-
__name$
|
|
82277
|
+
__name$1(this, "MessageEvent");
|
|
82278
82278
|
}
|
|
82279
82279
|
/**
|
|
82280
82280
|
* Create a new `MessageEvent`.
|
|
@@ -82304,12 +82304,12 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82304
82304
|
addEventListener(type, handler, options = {}) {
|
|
82305
82305
|
for (const listener of this.listeners(type)) if (!options[kForOnEventAttribute] && listener[kListener$1] === handler && !listener[kForOnEventAttribute]) return;
|
|
82306
82306
|
let wrapper;
|
|
82307
|
-
if (type === "message") wrapper = /* @__PURE__ */ __name$
|
|
82307
|
+
if (type === "message") wrapper = /* @__PURE__ */ __name$1(function onMessage(data$1, isBinary) {
|
|
82308
82308
|
const event = new MessageEvent$2("message", { data: isBinary ? data$1 : data$1.toString() });
|
|
82309
82309
|
event[kTarget] = this;
|
|
82310
82310
|
callListener(handler, this, event);
|
|
82311
82311
|
}, "onMessage");
|
|
82312
|
-
else if (type === "close") wrapper = /* @__PURE__ */ __name$
|
|
82312
|
+
else if (type === "close") wrapper = /* @__PURE__ */ __name$1(function onClose(code, message) {
|
|
82313
82313
|
const event = new CloseEvent$3("close", {
|
|
82314
82314
|
code,
|
|
82315
82315
|
reason: message.toString(),
|
|
@@ -82318,7 +82318,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82318
82318
|
event[kTarget] = this;
|
|
82319
82319
|
callListener(handler, this, event);
|
|
82320
82320
|
}, "onClose");
|
|
82321
|
-
else if (type === "error") wrapper = /* @__PURE__ */ __name$
|
|
82321
|
+
else if (type === "error") wrapper = /* @__PURE__ */ __name$1(function onError$1(error$3) {
|
|
82322
82322
|
const event = new ErrorEvent$3("error", {
|
|
82323
82323
|
error: error$3,
|
|
82324
82324
|
message: error$3.message
|
|
@@ -82326,7 +82326,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82326
82326
|
event[kTarget] = this;
|
|
82327
82327
|
callListener(handler, this, event);
|
|
82328
82328
|
}, "onError");
|
|
82329
|
-
else if (type === "open") wrapper = /* @__PURE__ */ __name$
|
|
82329
|
+
else if (type === "open") wrapper = /* @__PURE__ */ __name$1(function onOpen() {
|
|
82330
82330
|
const event = new Event$1("open");
|
|
82331
82331
|
event[kTarget] = this;
|
|
82332
82332
|
callListener(handler, this, event);
|
|
@@ -82350,7 +82350,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82350
82350
|
if (typeof listener === "object" && listener.handleEvent) listener.handleEvent.call(listener, event);
|
|
82351
82351
|
else listener.call(thisArg, event);
|
|
82352
82352
|
}
|
|
82353
|
-
__name$
|
|
82353
|
+
__name$1(callListener, "callListener");
|
|
82354
82354
|
} });
|
|
82355
82355
|
var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/extension.js"(exports$1, module$1) {
|
|
82356
82356
|
var { tokenChars } = require_validation();
|
|
@@ -82358,7 +82358,7 @@ var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
82358
82358
|
if (dest[name] === void 0) dest[name] = [elem];
|
|
82359
82359
|
else dest[name].push(elem);
|
|
82360
82360
|
}
|
|
82361
|
-
__name$
|
|
82361
|
+
__name$1(push, "push");
|
|
82362
82362
|
function parse$6(header) {
|
|
82363
82363
|
const offers = /* @__PURE__ */ Object.create(null);
|
|
82364
82364
|
let params = /* @__PURE__ */ Object.create(null);
|
|
@@ -82452,7 +82452,7 @@ var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
82452
82452
|
}
|
|
82453
82453
|
return offers;
|
|
82454
82454
|
}
|
|
82455
|
-
__name$
|
|
82455
|
+
__name$1(parse$6, "parse");
|
|
82456
82456
|
function format$3(extensions) {
|
|
82457
82457
|
return Object.keys(extensions).map((extension2) => {
|
|
82458
82458
|
let configurations = extensions[extension2];
|
|
@@ -82466,7 +82466,7 @@ var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
82466
82466
|
}).join(", ");
|
|
82467
82467
|
}).join(", ");
|
|
82468
82468
|
}
|
|
82469
|
-
__name$
|
|
82469
|
+
__name$1(format$3, "format");
|
|
82470
82470
|
module$1.exports = {
|
|
82471
82471
|
format: format$3,
|
|
82472
82472
|
parse: parse$6
|
|
@@ -82500,7 +82500,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
82500
82500
|
var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
82501
82501
|
var WebSocket2 = class _WebSocket extends EventEmitter$4 {
|
|
82502
82502
|
static {
|
|
82503
|
-
__name$
|
|
82503
|
+
__name$1(this, "WebSocket");
|
|
82504
82504
|
}
|
|
82505
82505
|
/**
|
|
82506
82506
|
* Create a new `WebSocket`.
|
|
@@ -83126,25 +83126,25 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83126
83126
|
if (opts.finishRequest) opts.finishRequest(req, websocket);
|
|
83127
83127
|
else req.end();
|
|
83128
83128
|
}
|
|
83129
|
-
__name$
|
|
83129
|
+
__name$1(initAsClient, "initAsClient");
|
|
83130
83130
|
function emitErrorAndClose(websocket, err) {
|
|
83131
83131
|
websocket._readyState = WebSocket2.CLOSING;
|
|
83132
83132
|
websocket._errorEmitted = true;
|
|
83133
83133
|
websocket.emit("error", err);
|
|
83134
83134
|
websocket.emitClose();
|
|
83135
83135
|
}
|
|
83136
|
-
__name$
|
|
83136
|
+
__name$1(emitErrorAndClose, "emitErrorAndClose");
|
|
83137
83137
|
function netConnect(options) {
|
|
83138
83138
|
options.path = options.socketPath;
|
|
83139
83139
|
return net$5.connect(options);
|
|
83140
83140
|
}
|
|
83141
|
-
__name$
|
|
83141
|
+
__name$1(netConnect, "netConnect");
|
|
83142
83142
|
function tlsConnect(options) {
|
|
83143
83143
|
options.path = void 0;
|
|
83144
83144
|
if (!options.servername && options.servername !== "") options.servername = net$5.isIP(options.host) ? "" : options.host;
|
|
83145
83145
|
return tls$2.connect(options);
|
|
83146
83146
|
}
|
|
83147
|
-
__name$
|
|
83147
|
+
__name$1(tlsConnect, "tlsConnect");
|
|
83148
83148
|
function abortHandshake(websocket, stream$2, message) {
|
|
83149
83149
|
websocket._readyState = WebSocket2.CLOSING;
|
|
83150
83150
|
const err = new Error(message);
|
|
@@ -83160,7 +83160,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83160
83160
|
stream$2.once("close", websocket.emitClose.bind(websocket));
|
|
83161
83161
|
}
|
|
83162
83162
|
}
|
|
83163
|
-
__name$
|
|
83163
|
+
__name$1(abortHandshake, "abortHandshake");
|
|
83164
83164
|
function sendAfterClose(websocket, data$1, cb) {
|
|
83165
83165
|
if (data$1) {
|
|
83166
83166
|
const length = isBlob2(data$1) ? data$1.size : toBuffer$1(data$1).length;
|
|
@@ -83172,7 +83172,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83172
83172
|
process.nextTick(cb, err);
|
|
83173
83173
|
}
|
|
83174
83174
|
}
|
|
83175
|
-
__name$
|
|
83175
|
+
__name$1(sendAfterClose, "sendAfterClose");
|
|
83176
83176
|
function receiverOnConclude(code, reason) {
|
|
83177
83177
|
const websocket = this[kWebSocket];
|
|
83178
83178
|
websocket._closeFrameReceived = true;
|
|
@@ -83184,12 +83184,12 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83184
83184
|
if (code === 1005) websocket.close();
|
|
83185
83185
|
else websocket.close(code, reason);
|
|
83186
83186
|
}
|
|
83187
|
-
__name$
|
|
83187
|
+
__name$1(receiverOnConclude, "receiverOnConclude");
|
|
83188
83188
|
function receiverOnDrain() {
|
|
83189
83189
|
const websocket = this[kWebSocket];
|
|
83190
83190
|
if (!websocket.isPaused) websocket._socket.resume();
|
|
83191
83191
|
}
|
|
83192
|
-
__name$
|
|
83192
|
+
__name$1(receiverOnDrain, "receiverOnDrain");
|
|
83193
83193
|
function receiverOnError(err) {
|
|
83194
83194
|
const websocket = this[kWebSocket];
|
|
83195
83195
|
if (websocket._socket[kWebSocket] !== void 0) {
|
|
@@ -83202,29 +83202,29 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83202
83202
|
websocket.emit("error", err);
|
|
83203
83203
|
}
|
|
83204
83204
|
}
|
|
83205
|
-
__name$
|
|
83205
|
+
__name$1(receiverOnError, "receiverOnError");
|
|
83206
83206
|
function receiverOnFinish() {
|
|
83207
83207
|
this[kWebSocket].emitClose();
|
|
83208
83208
|
}
|
|
83209
|
-
__name$
|
|
83209
|
+
__name$1(receiverOnFinish, "receiverOnFinish");
|
|
83210
83210
|
function receiverOnMessage(data$1, isBinary) {
|
|
83211
83211
|
this[kWebSocket].emit("message", data$1, isBinary);
|
|
83212
83212
|
}
|
|
83213
|
-
__name$
|
|
83213
|
+
__name$1(receiverOnMessage, "receiverOnMessage");
|
|
83214
83214
|
function receiverOnPing(data$1) {
|
|
83215
83215
|
const websocket = this[kWebSocket];
|
|
83216
83216
|
if (websocket._autoPong) websocket.pong(data$1, !this._isServer, NOOP);
|
|
83217
83217
|
websocket.emit("ping", data$1);
|
|
83218
83218
|
}
|
|
83219
|
-
__name$
|
|
83219
|
+
__name$1(receiverOnPing, "receiverOnPing");
|
|
83220
83220
|
function receiverOnPong(data$1) {
|
|
83221
83221
|
this[kWebSocket].emit("pong", data$1);
|
|
83222
83222
|
}
|
|
83223
|
-
__name$
|
|
83223
|
+
__name$1(receiverOnPong, "receiverOnPong");
|
|
83224
83224
|
function resume$1(stream$2) {
|
|
83225
83225
|
stream$2.resume();
|
|
83226
83226
|
}
|
|
83227
|
-
__name$
|
|
83227
|
+
__name$1(resume$1, "resume");
|
|
83228
83228
|
function senderOnError(err) {
|
|
83229
83229
|
const websocket = this[kWebSocket];
|
|
83230
83230
|
if (websocket.readyState === WebSocket2.CLOSED) return;
|
|
@@ -83238,11 +83238,11 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83238
83238
|
websocket.emit("error", err);
|
|
83239
83239
|
}
|
|
83240
83240
|
}
|
|
83241
|
-
__name$
|
|
83241
|
+
__name$1(senderOnError, "senderOnError");
|
|
83242
83242
|
function setCloseTimer(websocket) {
|
|
83243
83243
|
websocket._closeTimer = setTimeout(websocket._socket.destroy.bind(websocket._socket), websocket._closeTimeout);
|
|
83244
83244
|
}
|
|
83245
|
-
__name$
|
|
83245
|
+
__name$1(setCloseTimer, "setCloseTimer");
|
|
83246
83246
|
function socketOnClose() {
|
|
83247
83247
|
const websocket = this[kWebSocket];
|
|
83248
83248
|
this.removeListener("close", socketOnClose);
|
|
@@ -83262,18 +83262,18 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83262
83262
|
websocket._receiver.on("finish", receiverOnFinish);
|
|
83263
83263
|
}
|
|
83264
83264
|
}
|
|
83265
|
-
__name$
|
|
83265
|
+
__name$1(socketOnClose, "socketOnClose");
|
|
83266
83266
|
function socketOnData(chunk) {
|
|
83267
83267
|
if (!this[kWebSocket]._receiver.write(chunk)) this.pause();
|
|
83268
83268
|
}
|
|
83269
|
-
__name$
|
|
83269
|
+
__name$1(socketOnData, "socketOnData");
|
|
83270
83270
|
function socketOnEnd() {
|
|
83271
83271
|
const websocket = this[kWebSocket];
|
|
83272
83272
|
websocket._readyState = WebSocket2.CLOSING;
|
|
83273
83273
|
websocket._receiver.end();
|
|
83274
83274
|
this.end();
|
|
83275
83275
|
}
|
|
83276
|
-
__name$
|
|
83276
|
+
__name$1(socketOnEnd, "socketOnEnd");
|
|
83277
83277
|
function socketOnError() {
|
|
83278
83278
|
const websocket = this[kWebSocket];
|
|
83279
83279
|
this.removeListener("error", socketOnError);
|
|
@@ -83283,7 +83283,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83283
83283
|
this.destroy();
|
|
83284
83284
|
}
|
|
83285
83285
|
}
|
|
83286
|
-
__name$
|
|
83286
|
+
__name$1(socketOnError, "socketOnError");
|
|
83287
83287
|
} });
|
|
83288
83288
|
var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/stream.js"(exports$1, module$1) {
|
|
83289
83289
|
require_websocket();
|
|
@@ -83291,17 +83291,17 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83291
83291
|
function emitClose(stream$2) {
|
|
83292
83292
|
stream$2.emit("close");
|
|
83293
83293
|
}
|
|
83294
|
-
__name$
|
|
83294
|
+
__name$1(emitClose, "emitClose");
|
|
83295
83295
|
function duplexOnEnd() {
|
|
83296
83296
|
if (!this.destroyed && this._writableState.finished) this.destroy();
|
|
83297
83297
|
}
|
|
83298
|
-
__name$
|
|
83298
|
+
__name$1(duplexOnEnd, "duplexOnEnd");
|
|
83299
83299
|
function duplexOnError(err) {
|
|
83300
83300
|
this.removeListener("error", duplexOnError);
|
|
83301
83301
|
this.destroy();
|
|
83302
83302
|
if (this.listenerCount("error") === 0) this.emit("error", err);
|
|
83303
83303
|
}
|
|
83304
|
-
__name$
|
|
83304
|
+
__name$1(duplexOnError, "duplexOnError");
|
|
83305
83305
|
function createWebSocketStream2(ws, options) {
|
|
83306
83306
|
let terminateOnDestroy = true;
|
|
83307
83307
|
const duplex = new Duplex$1({
|
|
@@ -83311,16 +83311,16 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83311
83311
|
objectMode: false,
|
|
83312
83312
|
writableObjectMode: false
|
|
83313
83313
|
});
|
|
83314
|
-
ws.on("message", /* @__PURE__ */ __name$
|
|
83314
|
+
ws.on("message", /* @__PURE__ */ __name$1(function message(msg, isBinary) {
|
|
83315
83315
|
const data$1 = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
83316
83316
|
if (!duplex.push(data$1)) ws.pause();
|
|
83317
83317
|
}, "message"));
|
|
83318
|
-
ws.once("error", /* @__PURE__ */ __name$
|
|
83318
|
+
ws.once("error", /* @__PURE__ */ __name$1(function error$3(err) {
|
|
83319
83319
|
if (duplex.destroyed) return;
|
|
83320
83320
|
terminateOnDestroy = false;
|
|
83321
83321
|
duplex.destroy(err);
|
|
83322
83322
|
}, "error"));
|
|
83323
|
-
ws.once("close", /* @__PURE__ */ __name$
|
|
83323
|
+
ws.once("close", /* @__PURE__ */ __name$1(function close() {
|
|
83324
83324
|
if (duplex.destroyed) return;
|
|
83325
83325
|
duplex.push(null);
|
|
83326
83326
|
}, "close"));
|
|
@@ -83331,11 +83331,11 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83331
83331
|
return;
|
|
83332
83332
|
}
|
|
83333
83333
|
let called = false;
|
|
83334
|
-
ws.once("error", /* @__PURE__ */ __name$
|
|
83334
|
+
ws.once("error", /* @__PURE__ */ __name$1(function error$3(err2) {
|
|
83335
83335
|
called = true;
|
|
83336
83336
|
callback(err2);
|
|
83337
83337
|
}, "error"));
|
|
83338
|
-
ws.once("close", /* @__PURE__ */ __name$
|
|
83338
|
+
ws.once("close", /* @__PURE__ */ __name$1(function close() {
|
|
83339
83339
|
if (!called) callback(err);
|
|
83340
83340
|
process.nextTick(emitClose, duplex);
|
|
83341
83341
|
}, "close"));
|
|
@@ -83343,7 +83343,7 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83343
83343
|
};
|
|
83344
83344
|
duplex._final = function(callback) {
|
|
83345
83345
|
if (ws.readyState === ws.CONNECTING) {
|
|
83346
|
-
ws.once("open", /* @__PURE__ */ __name$
|
|
83346
|
+
ws.once("open", /* @__PURE__ */ __name$1(function open$3() {
|
|
83347
83347
|
duplex._final(callback);
|
|
83348
83348
|
}, "open"));
|
|
83349
83349
|
return;
|
|
@@ -83353,7 +83353,7 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83353
83353
|
callback();
|
|
83354
83354
|
if (duplex._readableState.endEmitted) duplex.destroy();
|
|
83355
83355
|
} else {
|
|
83356
|
-
ws._socket.once("finish", /* @__PURE__ */ __name$
|
|
83356
|
+
ws._socket.once("finish", /* @__PURE__ */ __name$1(function finish() {
|
|
83357
83357
|
callback();
|
|
83358
83358
|
}, "finish"));
|
|
83359
83359
|
ws.close();
|
|
@@ -83364,7 +83364,7 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83364
83364
|
};
|
|
83365
83365
|
duplex._write = function(chunk, encoding, callback) {
|
|
83366
83366
|
if (ws.readyState === ws.CONNECTING) {
|
|
83367
|
-
ws.once("open", /* @__PURE__ */ __name$
|
|
83367
|
+
ws.once("open", /* @__PURE__ */ __name$1(function open$3() {
|
|
83368
83368
|
duplex._write(chunk, encoding, callback);
|
|
83369
83369
|
}, "open"));
|
|
83370
83370
|
return;
|
|
@@ -83375,7 +83375,7 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83375
83375
|
duplex.on("error", duplexOnError);
|
|
83376
83376
|
return duplex;
|
|
83377
83377
|
}
|
|
83378
|
-
__name$
|
|
83378
|
+
__name$1(createWebSocketStream2, "createWebSocketStream");
|
|
83379
83379
|
module$1.exports = createWebSocketStream2;
|
|
83380
83380
|
} });
|
|
83381
83381
|
var require_subprotocol = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/subprotocol.js"(exports$1, module$1) {
|
|
@@ -83406,7 +83406,7 @@ var require_subprotocol = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_
|
|
|
83406
83406
|
protocols.add(protocol);
|
|
83407
83407
|
return protocols;
|
|
83408
83408
|
}
|
|
83409
|
-
__name$
|
|
83409
|
+
__name$1(parse$6, "parse");
|
|
83410
83410
|
module$1.exports = { parse: parse$6 };
|
|
83411
83411
|
} });
|
|
83412
83412
|
var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket-server.js"(exports$1, module$1) {
|
|
@@ -83425,7 +83425,7 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/
|
|
|
83425
83425
|
var CLOSED$1 = 2;
|
|
83426
83426
|
var WebSocketServer2 = class extends EventEmitter$4 {
|
|
83427
83427
|
static {
|
|
83428
|
-
__name$
|
|
83428
|
+
__name$1(this, "WebSocketServer");
|
|
83429
83429
|
}
|
|
83430
83430
|
/**
|
|
83431
83431
|
* Create a `WebSocketServer` instance.
|
|
@@ -83505,7 +83505,7 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/
|
|
|
83505
83505
|
this._removeListeners = addListeners(this._server, {
|
|
83506
83506
|
listening: this.emit.bind(this, "listening"),
|
|
83507
83507
|
error: this.emit.bind(this, "error"),
|
|
83508
|
-
upgrade: /* @__PURE__ */ __name$
|
|
83508
|
+
upgrade: /* @__PURE__ */ __name$1((req, socket, head) => {
|
|
83509
83509
|
this.handleUpgrade(req, socket, head, emitConnection);
|
|
83510
83510
|
}, "upgrade")
|
|
83511
83511
|
});
|
|
@@ -83719,20 +83719,20 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/
|
|
|
83719
83719
|
module$1.exports = WebSocketServer2;
|
|
83720
83720
|
function addListeners(server, map$1) {
|
|
83721
83721
|
for (const event of Object.keys(map$1)) server.on(event, map$1[event]);
|
|
83722
|
-
return /* @__PURE__ */ __name$
|
|
83722
|
+
return /* @__PURE__ */ __name$1(function removeListeners() {
|
|
83723
83723
|
for (const event of Object.keys(map$1)) server.removeListener(event, map$1[event]);
|
|
83724
83724
|
}, "removeListeners");
|
|
83725
83725
|
}
|
|
83726
|
-
__name$
|
|
83726
|
+
__name$1(addListeners, "addListeners");
|
|
83727
83727
|
function emitClose(server) {
|
|
83728
83728
|
server._state = CLOSED$1;
|
|
83729
83729
|
server.emit("close");
|
|
83730
83730
|
}
|
|
83731
|
-
__name$
|
|
83731
|
+
__name$1(emitClose, "emitClose");
|
|
83732
83732
|
function socketOnError() {
|
|
83733
83733
|
this.destroy();
|
|
83734
83734
|
}
|
|
83735
|
-
__name$
|
|
83735
|
+
__name$1(socketOnError, "socketOnError");
|
|
83736
83736
|
function abortHandshake(socket, code, message, headers) {
|
|
83737
83737
|
message = message || http$2.STATUS_CODES[code];
|
|
83738
83738
|
headers = {
|
|
@@ -83745,7 +83745,7 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/
|
|
|
83745
83745
|
socket.end(`HTTP/1.1 ${code} ${http$2.STATUS_CODES[code]}\r
|
|
83746
83746
|
` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message);
|
|
83747
83747
|
}
|
|
83748
|
-
__name$
|
|
83748
|
+
__name$1(abortHandshake, "abortHandshake");
|
|
83749
83749
|
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message, headers) {
|
|
83750
83750
|
if (server.listenerCount("wsClientError")) {
|
|
83751
83751
|
const err = new Error(message);
|
|
@@ -83753,11 +83753,11 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/
|
|
|
83753
83753
|
server.emit("wsClientError", err, socket, req);
|
|
83754
83754
|
} else abortHandshake(socket, code, message, headers);
|
|
83755
83755
|
}
|
|
83756
|
-
__name$
|
|
83756
|
+
__name$1(abortHandshakeOrEmitwsClientError, "abortHandshakeOrEmitwsClientError");
|
|
83757
83757
|
} });
|
|
83758
83758
|
var ApiError = class extends Error {
|
|
83759
83759
|
static {
|
|
83760
|
-
__name$
|
|
83760
|
+
__name$1(this, "ApiError");
|
|
83761
83761
|
}
|
|
83762
83762
|
url;
|
|
83763
83763
|
status;
|
|
@@ -83776,7 +83776,7 @@ var ApiError = class extends Error {
|
|
|
83776
83776
|
};
|
|
83777
83777
|
var CancelError = class extends Error {
|
|
83778
83778
|
static {
|
|
83779
|
-
__name$
|
|
83779
|
+
__name$1(this, "CancelError");
|
|
83780
83780
|
}
|
|
83781
83781
|
constructor(message) {
|
|
83782
83782
|
super(message);
|
|
@@ -83788,7 +83788,7 @@ var CancelError = class extends Error {
|
|
|
83788
83788
|
};
|
|
83789
83789
|
var CancelablePromise = class {
|
|
83790
83790
|
static {
|
|
83791
|
-
__name$
|
|
83791
|
+
__name$1(this, "CancelablePromise");
|
|
83792
83792
|
}
|
|
83793
83793
|
#isResolved;
|
|
83794
83794
|
#isRejected;
|
|
@@ -83805,23 +83805,23 @@ var CancelablePromise = class {
|
|
|
83805
83805
|
this.#promise = new Promise((resolve2, reject) => {
|
|
83806
83806
|
this.#resolve = resolve2;
|
|
83807
83807
|
this.#reject = reject;
|
|
83808
|
-
const onResolve = /* @__PURE__ */ __name$
|
|
83808
|
+
const onResolve = /* @__PURE__ */ __name$1((value) => {
|
|
83809
83809
|
if (this.#isResolved || this.#isRejected || this.#isCancelled) return;
|
|
83810
83810
|
this.#isResolved = true;
|
|
83811
83811
|
this.#resolve?.(value);
|
|
83812
83812
|
}, "onResolve");
|
|
83813
|
-
const onReject = /* @__PURE__ */ __name$
|
|
83813
|
+
const onReject = /* @__PURE__ */ __name$1((reason) => {
|
|
83814
83814
|
if (this.#isResolved || this.#isRejected || this.#isCancelled) return;
|
|
83815
83815
|
this.#isRejected = true;
|
|
83816
83816
|
this.#reject?.(reason);
|
|
83817
83817
|
}, "onReject");
|
|
83818
|
-
const onCancel = /* @__PURE__ */ __name$
|
|
83818
|
+
const onCancel = /* @__PURE__ */ __name$1((cancelHandler) => {
|
|
83819
83819
|
if (this.#isResolved || this.#isRejected || this.#isCancelled) return;
|
|
83820
83820
|
this.#cancelHandlers.push(cancelHandler);
|
|
83821
83821
|
}, "onCancel");
|
|
83822
|
-
Object.defineProperty(onCancel, "isResolved", { get: /* @__PURE__ */ __name$
|
|
83823
|
-
Object.defineProperty(onCancel, "isRejected", { get: /* @__PURE__ */ __name$
|
|
83824
|
-
Object.defineProperty(onCancel, "isCancelled", { get: /* @__PURE__ */ __name$
|
|
83822
|
+
Object.defineProperty(onCancel, "isResolved", { get: /* @__PURE__ */ __name$1(() => this.#isResolved, "get") });
|
|
83823
|
+
Object.defineProperty(onCancel, "isRejected", { get: /* @__PURE__ */ __name$1(() => this.#isRejected, "get") });
|
|
83824
|
+
Object.defineProperty(onCancel, "isCancelled", { get: /* @__PURE__ */ __name$1(() => this.#isCancelled, "get") });
|
|
83825
83825
|
return executor(onResolve, onReject, onCancel);
|
|
83826
83826
|
});
|
|
83827
83827
|
}
|
|
@@ -83865,34 +83865,34 @@ var OpenAPI = {
|
|
|
83865
83865
|
ENCODE_PATH: void 0,
|
|
83866
83866
|
LOGGER: void 0
|
|
83867
83867
|
};
|
|
83868
|
-
var isDefined = /* @__PURE__ */ __name$
|
|
83868
|
+
var isDefined = /* @__PURE__ */ __name$1((value) => {
|
|
83869
83869
|
return value !== void 0 && value !== null;
|
|
83870
83870
|
}, "isDefined");
|
|
83871
|
-
var isString = /* @__PURE__ */ __name$
|
|
83871
|
+
var isString = /* @__PURE__ */ __name$1((value) => {
|
|
83872
83872
|
return typeof value === "string";
|
|
83873
83873
|
}, "isString");
|
|
83874
|
-
var isStringWithValue = /* @__PURE__ */ __name$
|
|
83874
|
+
var isStringWithValue = /* @__PURE__ */ __name$1((value) => {
|
|
83875
83875
|
return isString(value) && value !== "";
|
|
83876
83876
|
}, "isStringWithValue");
|
|
83877
|
-
var isBlob = /* @__PURE__ */ __name$
|
|
83877
|
+
var isBlob = /* @__PURE__ */ __name$1((value) => {
|
|
83878
83878
|
return typeof value === "object" && typeof value.type === "string" && typeof value.stream === "function" && typeof value.arrayBuffer === "function" && typeof value.constructor === "function" && typeof value.constructor.name === "string" && /^(Blob|File)$/.test(value.constructor.name) && /^(Blob|File)$/.test(value[Symbol.toStringTag]);
|
|
83879
83879
|
}, "isBlob");
|
|
83880
|
-
var isErrorResponse = /* @__PURE__ */ __name$
|
|
83880
|
+
var isErrorResponse = /* @__PURE__ */ __name$1((value) => {
|
|
83881
83881
|
return typeof value === "object" && value !== null && "error" in value && typeof value.error === "string";
|
|
83882
83882
|
}, "isErrorResponse");
|
|
83883
|
-
var base64 = /* @__PURE__ */ __name$
|
|
83883
|
+
var base64 = /* @__PURE__ */ __name$1((str) => {
|
|
83884
83884
|
try {
|
|
83885
83885
|
return btoa(str);
|
|
83886
83886
|
} catch (err) {
|
|
83887
83887
|
return Buffer.from(str).toString("base64");
|
|
83888
83888
|
}
|
|
83889
83889
|
}, "base64");
|
|
83890
|
-
var getQueryString = /* @__PURE__ */ __name$
|
|
83890
|
+
var getQueryString = /* @__PURE__ */ __name$1((params) => {
|
|
83891
83891
|
const qs = [];
|
|
83892
|
-
const append = /* @__PURE__ */ __name$
|
|
83892
|
+
const append = /* @__PURE__ */ __name$1((key, value) => {
|
|
83893
83893
|
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
83894
83894
|
}, "append");
|
|
83895
|
-
const process2$1 = /* @__PURE__ */ __name$
|
|
83895
|
+
const process2$1 = /* @__PURE__ */ __name$1((key, value) => {
|
|
83896
83896
|
if (isDefined(value)) if (Array.isArray(value)) value.forEach((v) => {
|
|
83897
83897
|
process2$1(key, v);
|
|
83898
83898
|
});
|
|
@@ -83907,7 +83907,7 @@ var getQueryString = /* @__PURE__ */ __name$2((params) => {
|
|
|
83907
83907
|
if (qs.length > 0) return `?${qs.join("&")}`;
|
|
83908
83908
|
return "";
|
|
83909
83909
|
}, "getQueryString");
|
|
83910
|
-
var getUrl = /* @__PURE__ */ __name$
|
|
83910
|
+
var getUrl = /* @__PURE__ */ __name$1((config$3, options) => {
|
|
83911
83911
|
const encoder$1 = config$3.ENCODE_PATH || encodeURI;
|
|
83912
83912
|
const path4 = options.url.replace("{api-version}", config$3.VERSION).replace(/{(.*?)}/g, (substring, group) => {
|
|
83913
83913
|
if (options.path?.hasOwnProperty(group)) return encoder$1(String(options.path[group]));
|
|
@@ -83917,10 +83917,10 @@ var getUrl = /* @__PURE__ */ __name$2((config$3, options) => {
|
|
|
83917
83917
|
if (options.query) return `${url$2}${getQueryString(options.query)}`;
|
|
83918
83918
|
return url$2;
|
|
83919
83919
|
}, "getUrl");
|
|
83920
|
-
var getFormData = /* @__PURE__ */ __name$
|
|
83920
|
+
var getFormData = /* @__PURE__ */ __name$1((options) => {
|
|
83921
83921
|
if (options.formData) {
|
|
83922
83922
|
const formData = new FormData();
|
|
83923
|
-
const process2$1 = /* @__PURE__ */ __name$
|
|
83923
|
+
const process2$1 = /* @__PURE__ */ __name$1(async (key, value) => {
|
|
83924
83924
|
if (isString(value)) formData.append(key, value);
|
|
83925
83925
|
else formData.append(key, JSON.stringify(value));
|
|
83926
83926
|
}, "process");
|
|
@@ -83931,11 +83931,11 @@ var getFormData = /* @__PURE__ */ __name$2((options) => {
|
|
|
83931
83931
|
return formData;
|
|
83932
83932
|
}
|
|
83933
83933
|
}, "getFormData");
|
|
83934
|
-
var resolve$1 = /* @__PURE__ */ __name$
|
|
83934
|
+
var resolve$1 = /* @__PURE__ */ __name$1(async (options, resolver) => {
|
|
83935
83935
|
if (typeof resolver === "function") return resolver(options);
|
|
83936
83936
|
return resolver;
|
|
83937
83937
|
}, "resolve");
|
|
83938
|
-
var getHeaders = /* @__PURE__ */ __name$
|
|
83938
|
+
var getHeaders = /* @__PURE__ */ __name$1(async (config$3, options) => {
|
|
83939
83939
|
const token = await resolve$1(options, config$3.TOKEN);
|
|
83940
83940
|
const username = await resolve$1(options, config$3.USERNAME);
|
|
83941
83941
|
const password = await resolve$1(options, config$3.PASSWORD);
|
|
@@ -83958,15 +83958,15 @@ var getHeaders = /* @__PURE__ */ __name$2(async (config$3, options) => {
|
|
|
83958
83958
|
addCustomApiHeaders(requestHeaders);
|
|
83959
83959
|
return requestHeaders;
|
|
83960
83960
|
}, "getHeaders");
|
|
83961
|
-
var getRequestBody = /* @__PURE__ */ __name$
|
|
83961
|
+
var getRequestBody = /* @__PURE__ */ __name$1((options) => {
|
|
83962
83962
|
if (options.body !== void 0) if (options.mediaType?.includes("/json")) return JSON.stringify(options.body);
|
|
83963
83963
|
else if (isString(options.body) || isBlob(options.body)) return options.body;
|
|
83964
83964
|
else return JSON.stringify(options.body);
|
|
83965
83965
|
}, "getRequestBody");
|
|
83966
|
-
var isResponseSchemaV4 = /* @__PURE__ */ __name$
|
|
83966
|
+
var isResponseSchemaV4 = /* @__PURE__ */ __name$1((config$3, _options) => {
|
|
83967
83967
|
return config$3.BASE.endsWith("/containers");
|
|
83968
83968
|
}, "isResponseSchemaV4");
|
|
83969
|
-
var parseResponseSchemaV4 = /* @__PURE__ */ __name$
|
|
83969
|
+
var parseResponseSchemaV4 = /* @__PURE__ */ __name$1((url$2, response, responseHeader, responseBody) => {
|
|
83970
83970
|
const fetchResult2 = typeof responseBody === "object" ? responseBody : JSON.parse(responseBody);
|
|
83971
83971
|
const ok = response.ok && fetchResult2.success;
|
|
83972
83972
|
let result;
|
|
@@ -83982,7 +83982,7 @@ var parseResponseSchemaV4 = /* @__PURE__ */ __name$2((url$2, response, responseH
|
|
|
83982
83982
|
body: responseHeader ?? result
|
|
83983
83983
|
};
|
|
83984
83984
|
}, "parseResponseSchemaV4");
|
|
83985
|
-
var sendRequest = /* @__PURE__ */ __name$
|
|
83985
|
+
var sendRequest = /* @__PURE__ */ __name$1(async (config$3, options, url$2, body, formData, headers, onCancel) => {
|
|
83986
83986
|
const controller = new AbortController();
|
|
83987
83987
|
const request2 = {
|
|
83988
83988
|
headers,
|
|
@@ -83994,13 +83994,13 @@ var sendRequest = /* @__PURE__ */ __name$2(async (config$3, options, url$2, body
|
|
|
83994
83994
|
onCancel(() => controller.abort());
|
|
83995
83995
|
return await fetch(url$2, request2);
|
|
83996
83996
|
}, "sendRequest");
|
|
83997
|
-
var getResponseHeader = /* @__PURE__ */ __name$
|
|
83997
|
+
var getResponseHeader = /* @__PURE__ */ __name$1((response, responseHeader) => {
|
|
83998
83998
|
if (responseHeader) {
|
|
83999
83999
|
const content = response.headers.get(responseHeader);
|
|
84000
84000
|
if (isString(content)) return content;
|
|
84001
84001
|
}
|
|
84002
84002
|
}, "getResponseHeader");
|
|
84003
|
-
var getResponseBody = /* @__PURE__ */ __name$
|
|
84003
|
+
var getResponseBody = /* @__PURE__ */ __name$1(async (response) => {
|
|
84004
84004
|
if (response.status !== 204) try {
|
|
84005
84005
|
const contentType = response.headers.get("Content-Type");
|
|
84006
84006
|
if (contentType) if (["application/json", "application/problem+json"].some((type) => contentType.toLowerCase().startsWith(type))) return await response.json();
|
|
@@ -84009,7 +84009,7 @@ var getResponseBody = /* @__PURE__ */ __name$2(async (response) => {
|
|
|
84009
84009
|
console.error(error$3);
|
|
84010
84010
|
}
|
|
84011
84011
|
}, "getResponseBody");
|
|
84012
|
-
var catchErrorCodes = /* @__PURE__ */ __name$
|
|
84012
|
+
var catchErrorCodes = /* @__PURE__ */ __name$1((options, result) => {
|
|
84013
84013
|
const error$3 = {
|
|
84014
84014
|
400: "Bad Request",
|
|
84015
84015
|
401: "Unauthorized",
|
|
@@ -84023,7 +84023,7 @@ var catchErrorCodes = /* @__PURE__ */ __name$2((options, result) => {
|
|
|
84023
84023
|
if (error$3) throw new ApiError(options, result, error$3);
|
|
84024
84024
|
if (!result.ok) throw new ApiError(options, result, "Generic Error");
|
|
84025
84025
|
}, "catchErrorCodes");
|
|
84026
|
-
var executeRequest = /* @__PURE__ */ __name$
|
|
84026
|
+
var executeRequest = /* @__PURE__ */ __name$1(async (config$3, options, onCancel) => {
|
|
84027
84027
|
const url$2 = getUrl(config$3, options);
|
|
84028
84028
|
const formData = getFormData(options);
|
|
84029
84029
|
const body = getRequestBody(options);
|
|
@@ -84038,7 +84038,7 @@ var executeRequest = /* @__PURE__ */ __name$2(async (config$3, options, onCancel
|
|
|
84038
84038
|
responseHeader: getResponseHeader(response, options.responseHeader)
|
|
84039
84039
|
};
|
|
84040
84040
|
}, "executeRequest");
|
|
84041
|
-
var buildApiResult = /* @__PURE__ */ __name$
|
|
84041
|
+
var buildApiResult = /* @__PURE__ */ __name$1((config$3, options, req) => {
|
|
84042
84042
|
if (isResponseSchemaV4(config$3, options)) return parseResponseSchemaV4(req.url, req.response, req.responseHeader, req.responseBody);
|
|
84043
84043
|
return {
|
|
84044
84044
|
url: req.url,
|
|
@@ -84048,7 +84048,7 @@ var buildApiResult = /* @__PURE__ */ __name$2((config$3, options, req) => {
|
|
|
84048
84048
|
body: req.responseHeader ?? req.responseBody
|
|
84049
84049
|
};
|
|
84050
84050
|
}, "buildApiResult");
|
|
84051
|
-
var request = /* @__PURE__ */ __name$
|
|
84051
|
+
var request = /* @__PURE__ */ __name$1((config$3, options) => {
|
|
84052
84052
|
return new CancelablePromise(async (resolve2, reject, onCancel) => {
|
|
84053
84053
|
try {
|
|
84054
84054
|
const req = await executeRequest(config$3, options, onCancel);
|
|
@@ -84062,7 +84062,7 @@ var request = /* @__PURE__ */ __name$2((config$3, options) => {
|
|
|
84062
84062
|
}
|
|
84063
84063
|
});
|
|
84064
84064
|
}, "request");
|
|
84065
|
-
var requestPaginated = /* @__PURE__ */ __name$
|
|
84065
|
+
var requestPaginated = /* @__PURE__ */ __name$1((config$3, options) => {
|
|
84066
84066
|
return new CancelablePromise(async (resolve2, reject, onCancel) => {
|
|
84067
84067
|
try {
|
|
84068
84068
|
const req = await executeRequest(config$3, options, onCancel);
|
|
@@ -84081,13 +84081,13 @@ var requestPaginated = /* @__PURE__ */ __name$2((config$3, options) => {
|
|
|
84081
84081
|
}
|
|
84082
84082
|
});
|
|
84083
84083
|
}, "requestPaginated");
|
|
84084
|
-
var debugLogRequest = /* @__PURE__ */ __name$
|
|
84084
|
+
var debugLogRequest = /* @__PURE__ */ __name$1(async (config$3, url$2, headers, body) => {
|
|
84085
84085
|
config$3.LOGGER?.debug(`-- START CF API REQUEST: ${url$2}`);
|
|
84086
84086
|
config$3.LOGGER?.debugWithSanitization("HEADERS:", JSON.stringify(sanitizeHeaders(headers), null, 2));
|
|
84087
84087
|
config$3.LOGGER?.debugWithSanitization("BODY:", JSON.stringify(body instanceof FormData ? await new Response(body).text() : body, null, 2));
|
|
84088
84088
|
config$3.LOGGER?.debug("-- END CF API REQUEST");
|
|
84089
84089
|
}, "debugLogRequest");
|
|
84090
|
-
var debugLogResponse = /* @__PURE__ */ __name$
|
|
84090
|
+
var debugLogResponse = /* @__PURE__ */ __name$1((config$3, response) => {
|
|
84091
84091
|
config$3.LOGGER?.debug("-- START CF API RESPONSE:", response.statusText, response.status);
|
|
84092
84092
|
config$3.LOGGER?.debugWithSanitization("RESPONSE:", response.body);
|
|
84093
84093
|
config$3.LOGGER?.debug("-- END CF API RESPONSE");
|
|
@@ -84227,7 +84227,7 @@ var UpdateApplicationRolloutRequest;
|
|
|
84227
84227
|
})(UpdateApplicationRolloutRequest || (UpdateApplicationRolloutRequest = {}));
|
|
84228
84228
|
var AccountService = class {
|
|
84229
84229
|
static {
|
|
84230
|
-
__name$
|
|
84230
|
+
__name$1(this, "AccountService");
|
|
84231
84231
|
}
|
|
84232
84232
|
/**
|
|
84233
84233
|
* Get complete account details related to Cloudchamber
|
|
@@ -84268,7 +84268,7 @@ var AccountService = class {
|
|
|
84268
84268
|
};
|
|
84269
84269
|
var ApplicationsService = class {
|
|
84270
84270
|
static {
|
|
84271
|
-
__name$
|
|
84271
|
+
__name$1(this, "ApplicationsService");
|
|
84272
84272
|
}
|
|
84273
84273
|
/**
|
|
84274
84274
|
* Create a new application
|
|
@@ -84733,7 +84733,7 @@ var ApplicationsService = class {
|
|
|
84733
84733
|
};
|
|
84734
84734
|
var ContainerImagePreparationsService = class {
|
|
84735
84735
|
static {
|
|
84736
|
-
__name$
|
|
84736
|
+
__name$1(this, "ContainerImagePreparationsService");
|
|
84737
84737
|
}
|
|
84738
84738
|
/**
|
|
84739
84739
|
* Prepare a digest-pinned managed image for the Containers runtime.
|
|
@@ -84755,7 +84755,7 @@ var ContainerImagePreparationsService = class {
|
|
|
84755
84755
|
};
|
|
84756
84756
|
var DeploymentsService = class {
|
|
84757
84757
|
static {
|
|
84758
|
-
__name$
|
|
84758
|
+
__name$1(this, "DeploymentsService");
|
|
84759
84759
|
}
|
|
84760
84760
|
/**
|
|
84761
84761
|
* Get a specific deployment within an application
|
|
@@ -84994,7 +84994,7 @@ var DeploymentsService = class {
|
|
|
84994
84994
|
};
|
|
84995
84995
|
var ImageRegistriesService = class {
|
|
84996
84996
|
static {
|
|
84997
|
-
__name$
|
|
84997
|
+
__name$1(this, "ImageRegistriesService");
|
|
84998
84998
|
}
|
|
84999
84999
|
/**
|
|
85000
85000
|
* Create an image registry protocol that resolves to multiple domains.
|
|
@@ -85144,7 +85144,7 @@ var ImageRegistriesService = class {
|
|
|
85144
85144
|
};
|
|
85145
85145
|
var IPsService = class {
|
|
85146
85146
|
static {
|
|
85147
|
-
__name$
|
|
85147
|
+
__name$1(this, "IPsService");
|
|
85148
85148
|
}
|
|
85149
85149
|
/**
|
|
85150
85150
|
* List IPs
|
|
@@ -85175,7 +85175,7 @@ var IPsService = class {
|
|
|
85175
85175
|
};
|
|
85176
85176
|
var JobsService = class {
|
|
85177
85177
|
static {
|
|
85178
|
-
__name$
|
|
85178
|
+
__name$1(this, "JobsService");
|
|
85179
85179
|
}
|
|
85180
85180
|
/**
|
|
85181
85181
|
* Application queue status
|
|
@@ -85295,7 +85295,7 @@ var JobsService = class {
|
|
|
85295
85295
|
};
|
|
85296
85296
|
var PlacementsService = class {
|
|
85297
85297
|
static {
|
|
85298
|
-
__name$
|
|
85298
|
+
__name$1(this, "PlacementsService");
|
|
85299
85299
|
}
|
|
85300
85300
|
/**
|
|
85301
85301
|
* List placements
|
|
@@ -85363,7 +85363,7 @@ var PlacementsService = class {
|
|
|
85363
85363
|
};
|
|
85364
85364
|
var RolloutsService = class {
|
|
85365
85365
|
static {
|
|
85366
|
-
__name$
|
|
85366
|
+
__name$1(this, "RolloutsService");
|
|
85367
85367
|
}
|
|
85368
85368
|
/**
|
|
85369
85369
|
* Create a new rollout for an application
|
|
@@ -85489,7 +85489,7 @@ var RolloutsService = class {
|
|
|
85489
85489
|
};
|
|
85490
85490
|
var SecretsService = class {
|
|
85491
85491
|
static {
|
|
85492
|
-
__name$
|
|
85492
|
+
__name$1(this, "SecretsService");
|
|
85493
85493
|
}
|
|
85494
85494
|
/**
|
|
85495
85495
|
* Add a new secret to the account
|
|
@@ -85585,7 +85585,7 @@ var SecretsService = class {
|
|
|
85585
85585
|
};
|
|
85586
85586
|
var SshPublicKeysService = class {
|
|
85587
85587
|
static {
|
|
85588
|
-
__name$
|
|
85588
|
+
__name$1(this, "SshPublicKeysService");
|
|
85589
85589
|
}
|
|
85590
85590
|
/**
|
|
85591
85591
|
* Add SSH public key
|
|
@@ -85642,7 +85642,7 @@ var SshPublicKeysService = class {
|
|
|
85642
85642
|
});
|
|
85643
85643
|
}
|
|
85644
85644
|
};
|
|
85645
|
-
var noop = /* @__PURE__ */ __name$
|
|
85645
|
+
var noop = /* @__PURE__ */ __name$1(() => {}, "noop");
|
|
85646
85646
|
var logger$1 = {
|
|
85647
85647
|
debug: noop,
|
|
85648
85648
|
log: noop,
|
|
@@ -85650,10 +85650,10 @@ var logger$1 = {
|
|
|
85650
85650
|
warn: noop,
|
|
85651
85651
|
error: noop
|
|
85652
85652
|
};
|
|
85653
|
-
var fetchResult$1 = /* @__PURE__ */ __name$
|
|
85653
|
+
var fetchResult$1 = /* @__PURE__ */ __name$1(() => {
|
|
85654
85654
|
throw new Error("initContainersSharedContext() must be called first");
|
|
85655
85655
|
}, "fetchResult");
|
|
85656
|
-
var fetchPagedListResult = /* @__PURE__ */ __name$
|
|
85656
|
+
var fetchPagedListResult = /* @__PURE__ */ __name$1(() => {
|
|
85657
85657
|
throw new Error("initContainersSharedContext() must be called first");
|
|
85658
85658
|
}, "fetchPagedListResult");
|
|
85659
85659
|
function initContainersSharedContext(ctx) {
|
|
@@ -85661,8 +85661,8 @@ function initContainersSharedContext(ctx) {
|
|
|
85661
85661
|
fetchResult$1 = ctx.fetchResult;
|
|
85662
85662
|
if (ctx.fetchPagedListResult !== void 0) fetchPagedListResult = ctx.fetchPagedListResult;
|
|
85663
85663
|
}
|
|
85664
|
-
__name$
|
|
85665
|
-
var getCloudflareRegistryWithAccountNamespace = /* @__PURE__ */ __name$
|
|
85664
|
+
__name$1(initContainersSharedContext, "initContainersSharedContext");
|
|
85665
|
+
var getCloudflareRegistryWithAccountNamespace = /* @__PURE__ */ __name$1((accountID, tag, complianceConfig) => {
|
|
85666
85666
|
return `${getCloudflareContainerRegistry(complianceConfig)}/${accountID}/${tag}`;
|
|
85667
85667
|
}, "getCloudflareRegistryWithAccountNamespace");
|
|
85668
85668
|
var MF_DEV_CONTAINER_PREFIX = "cloudflare-dev";
|
|
@@ -85670,8 +85670,8 @@ function getCloudflareContainerRegistry(complianceConfig = COMPLIANCE_REGION_CON
|
|
|
85670
85670
|
if (process.env.CLOUDFLARE_CONTAINER_REGISTRY) return process.env.CLOUDFLARE_CONTAINER_REGISTRY;
|
|
85671
85671
|
return `${process.env.WRANGLER_API_ENVIRONMENT === "staging" ? "staging." : ""}registry${getComplianceRegionSubdomain(complianceConfig)}.cloudflare.com`;
|
|
85672
85672
|
}
|
|
85673
|
-
__name$
|
|
85674
|
-
var getDevContainerImageName = /* @__PURE__ */ __name$
|
|
85673
|
+
__name$1(getCloudflareContainerRegistry, "getCloudflareContainerRegistry");
|
|
85674
|
+
var getDevContainerImageName = /* @__PURE__ */ __name$1((name, tag) => {
|
|
85675
85675
|
return `${MF_DEV_CONTAINER_PREFIX}/${name.toLowerCase()}:${tag}`;
|
|
85676
85676
|
}, "getDevContainerImageName");
|
|
85677
85677
|
function configureOpenAPIForContainerPull(accountId, apiToken, apiBase = "https://api.cloudflare.com/client/v4") {
|
|
@@ -85682,7 +85682,7 @@ function configureOpenAPIForContainerPull(accountId, apiToken, apiBase = "https:
|
|
|
85682
85682
|
Authorization: `Bearer ${apiToken}`
|
|
85683
85683
|
};
|
|
85684
85684
|
}
|
|
85685
|
-
__name$
|
|
85685
|
+
__name$1(configureOpenAPIForContainerPull, "configureOpenAPIForContainerPull");
|
|
85686
85686
|
async function dockerLoginImageRegistry(pathToDocker, domain$1) {
|
|
85687
85687
|
const credentials = await ImageRegistriesService.generateImageRegistryCredentials(domain$1, {
|
|
85688
85688
|
expiration_minutes: 15,
|
|
@@ -85710,8 +85710,8 @@ async function dockerLoginImageRegistry(pathToDocker, domain$1) {
|
|
|
85710
85710
|
});
|
|
85711
85711
|
});
|
|
85712
85712
|
}
|
|
85713
|
-
__name$
|
|
85714
|
-
var runDockerCmd = /* @__PURE__ */ __name$
|
|
85713
|
+
__name$1(dockerLoginImageRegistry, "dockerLoginImageRegistry");
|
|
85714
|
+
var runDockerCmd = /* @__PURE__ */ __name$1((dockerPath, args, stdio) => {
|
|
85715
85715
|
let aborted$2 = false;
|
|
85716
85716
|
let resolve2;
|
|
85717
85717
|
let reject;
|
|
@@ -85739,17 +85739,17 @@ var runDockerCmd = /* @__PURE__ */ __name$2((dockerPath, args, stdio) => {
|
|
|
85739
85739
|
}
|
|
85740
85740
|
});
|
|
85741
85741
|
return {
|
|
85742
|
-
abort: /* @__PURE__ */ __name$
|
|
85742
|
+
abort: /* @__PURE__ */ __name$1(() => {
|
|
85743
85743
|
aborted$2 = true;
|
|
85744
85744
|
child.unref();
|
|
85745
85745
|
if (child.pid !== void 0) if (process.platform === "win32") child.kill();
|
|
85746
85746
|
else process.kill(-child.pid);
|
|
85747
85747
|
}, "abort"),
|
|
85748
85748
|
ready,
|
|
85749
|
-
then: /* @__PURE__ */ __name$
|
|
85749
|
+
then: /* @__PURE__ */ __name$1(async (onResolve, onReject) => ready.then(onResolve).catch(onReject), "then")
|
|
85750
85750
|
};
|
|
85751
85751
|
}, "runDockerCmd");
|
|
85752
|
-
var runDockerCmdWithOutput = /* @__PURE__ */ __name$
|
|
85752
|
+
var runDockerCmdWithOutput = /* @__PURE__ */ __name$1((dockerPath, args) => {
|
|
85753
85753
|
try {
|
|
85754
85754
|
return execFileSync(dockerPath, args, {
|
|
85755
85755
|
encoding: "utf8",
|
|
@@ -85768,7 +85768,7 @@ async function containerPrivilegesAllowed(dockerHost, dockerPath = "docker") {
|
|
|
85768
85768
|
const localRootlessLinux = platform$1 === "linux" && existsSync("/dev/fuse") && rootless;
|
|
85769
85769
|
return localVm || localRootlessLinux;
|
|
85770
85770
|
}
|
|
85771
|
-
__name$
|
|
85771
|
+
__name$1(containerPrivilegesAllowed, "containerPrivilegesAllowed");
|
|
85772
85772
|
function isLocalDockerEndpoint(dockerHost) {
|
|
85773
85773
|
try {
|
|
85774
85774
|
const url$2 = new URL(dockerHost);
|
|
@@ -85777,7 +85777,7 @@ function isLocalDockerEndpoint(dockerHost) {
|
|
|
85777
85777
|
return false;
|
|
85778
85778
|
}
|
|
85779
85779
|
}
|
|
85780
|
-
__name$
|
|
85780
|
+
__name$1(isLocalDockerEndpoint, "isLocalDockerEndpoint");
|
|
85781
85781
|
async function getDockerSecurityOptions(dockerPath, dockerHost) {
|
|
85782
85782
|
const output$1 = await new Promise((resolve2, reject) => {
|
|
85783
85783
|
execFile(dockerPath, [
|
|
@@ -85796,12 +85796,12 @@ async function getDockerSecurityOptions(dockerPath, dockerHost) {
|
|
|
85796
85796
|
});
|
|
85797
85797
|
return JSON.parse(output$1);
|
|
85798
85798
|
}
|
|
85799
|
-
__name$
|
|
85799
|
+
__name$1(getDockerSecurityOptions, "getDockerSecurityOptions");
|
|
85800
85800
|
function detectWsl() {
|
|
85801
85801
|
return process.platform === "linux" && release().toLowerCase().includes("microsoft");
|
|
85802
85802
|
}
|
|
85803
|
-
__name$
|
|
85804
|
-
var isDockerRunning = /* @__PURE__ */ __name$
|
|
85803
|
+
__name$1(detectWsl, "detectWsl");
|
|
85804
|
+
var isDockerRunning = /* @__PURE__ */ __name$1(async (dockerPath) => {
|
|
85805
85805
|
try {
|
|
85806
85806
|
await runDockerCmd(dockerPath, ["info"], [
|
|
85807
85807
|
"inherit",
|
|
@@ -85813,7 +85813,7 @@ var isDockerRunning = /* @__PURE__ */ __name$2(async (dockerPath) => {
|
|
|
85813
85813
|
}
|
|
85814
85814
|
return true;
|
|
85815
85815
|
}, "isDockerRunning");
|
|
85816
|
-
var verifyDockerInstalled = /* @__PURE__ */ __name$
|
|
85816
|
+
var verifyDockerInstalled = /* @__PURE__ */ __name$1(async ({ dockerPath, operation, imageNoun, hint }) => {
|
|
85817
85817
|
if (!await isDockerRunning(dockerPath)) throw new UserError(getFailedToRunDockerErrorMessage({
|
|
85818
85818
|
operation,
|
|
85819
85819
|
imageNoun,
|
|
@@ -85840,11 +85840,11 @@ Note: Other container tooling that is compatible with the Docker CLI and engine
|
|
|
85840
85840
|
${hint}`;
|
|
85841
85841
|
return message;
|
|
85842
85842
|
}
|
|
85843
|
-
__name$
|
|
85843
|
+
__name$1(getFailedToRunDockerErrorMessage, "getFailedToRunDockerErrorMessage");
|
|
85844
85844
|
function generateContainerBuildId() {
|
|
85845
85845
|
return randomUUID().slice(0, 8);
|
|
85846
85846
|
}
|
|
85847
|
-
__name$
|
|
85847
|
+
__name$1(generateContainerBuildId, "generateContainerBuildId");
|
|
85848
85848
|
function getDockerSocketFromContext(dockerPath) {
|
|
85849
85849
|
try {
|
|
85850
85850
|
const currentContext = runDockerCmdWithOutput(dockerPath, [
|
|
@@ -85857,7 +85857,7 @@ function getDockerSocketFromContext(dockerPath) {
|
|
|
85857
85857
|
} catch {}
|
|
85858
85858
|
return null;
|
|
85859
85859
|
}
|
|
85860
|
-
__name$
|
|
85860
|
+
__name$1(getDockerSocketFromContext, "getDockerSocketFromContext");
|
|
85861
85861
|
function resolveDockerHost(dockerPath) {
|
|
85862
85862
|
if (process.env.WRANGLER_DOCKER_HOST) return process.env.WRANGLER_DOCKER_HOST;
|
|
85863
85863
|
if (process.env.DOCKER_HOST) return process.env.DOCKER_HOST;
|
|
@@ -85865,16 +85865,16 @@ function resolveDockerHost(dockerPath) {
|
|
|
85865
85865
|
if (contextSocket) return contextSocket;
|
|
85866
85866
|
return process.platform === "win32" ? "//./pipe/docker_engine" : "unix:///var/run/docker.sock";
|
|
85867
85867
|
}
|
|
85868
|
-
__name$
|
|
85868
|
+
__name$1(resolveDockerHost, "resolveDockerHost");
|
|
85869
85869
|
var DEFAULT_CONTAINER_EGRESS_INTERCEPTOR_IMAGE = "cloudflare/proxy-everything:3cb1195@sha256:0ef6716c52430096900b150d84a3302057d6cd2319dae7987128c85d0733e3c8";
|
|
85870
85870
|
function getEgressInterceptorPlatform() {
|
|
85871
85871
|
return process.env.MINIFLARE_CONTAINER_EGRESS_IMAGE_PLATFORM;
|
|
85872
85872
|
}
|
|
85873
|
-
__name$
|
|
85873
|
+
__name$1(getEgressInterceptorPlatform, "getEgressInterceptorPlatform");
|
|
85874
85874
|
function getEgressInterceptorImage() {
|
|
85875
85875
|
return process.env.MINIFLARE_CONTAINER_EGRESS_IMAGE ?? DEFAULT_CONTAINER_EGRESS_INTERCEPTOR_IMAGE;
|
|
85876
85876
|
}
|
|
85877
|
-
__name$
|
|
85877
|
+
__name$1(getEgressInterceptorImage, "getEgressInterceptorImage");
|
|
85878
85878
|
async function pullEgressInterceptorImage(dockerPath) {
|
|
85879
85879
|
const image = getEgressInterceptorImage();
|
|
85880
85880
|
const platform$1 = getEgressInterceptorPlatform();
|
|
@@ -85882,7 +85882,7 @@ async function pullEgressInterceptorImage(dockerPath) {
|
|
|
85882
85882
|
if (platform$1 !== void 0) args.push("--platform", platform$1);
|
|
85883
85883
|
await runDockerCmd(dockerPath, args);
|
|
85884
85884
|
}
|
|
85885
|
-
__name$
|
|
85885
|
+
__name$1(pullEgressInterceptorImage, "pullEgressInterceptorImage");
|
|
85886
85886
|
async function pullImage(dockerPath, options, logger2, complianceConfig, registryConfigureCommand) {
|
|
85887
85887
|
const domain$1 = new URL(`http://${options.image_uri}`).hostname;
|
|
85888
85888
|
const isExternalRegistry = domain$1 !== getCloudflareContainerRegistry(complianceConfig);
|
|
@@ -85909,13 +85909,13 @@ Attempting to pull image anyway...`);
|
|
|
85909
85909
|
return { aborted: aborted$2 };
|
|
85910
85910
|
});
|
|
85911
85911
|
return {
|
|
85912
|
-
abort: /* @__PURE__ */ __name$
|
|
85912
|
+
abort: /* @__PURE__ */ __name$1(() => {
|
|
85913
85913
|
pull.abort();
|
|
85914
85914
|
}, "abort"),
|
|
85915
85915
|
ready
|
|
85916
85916
|
};
|
|
85917
85917
|
}
|
|
85918
|
-
__name$
|
|
85918
|
+
__name$1(pullImage, "pullImage");
|
|
85919
85919
|
async function prepareContainerImagesForDev(args) {
|
|
85920
85920
|
const { dockerPath, containerOptions, onContainerImagePreparationStart, onContainerImagePreparationEnd } = args;
|
|
85921
85921
|
let aborted$2 = false;
|
|
@@ -85941,7 +85941,7 @@ async function prepareContainerImagesForDev(args) {
|
|
|
85941
85941
|
});
|
|
85942
85942
|
onContainerImagePreparationStart({
|
|
85943
85943
|
containerOptions: options,
|
|
85944
|
-
abort: /* @__PURE__ */ __name$
|
|
85944
|
+
abort: /* @__PURE__ */ __name$1(() => {
|
|
85945
85945
|
aborted$2 = true;
|
|
85946
85946
|
build.abort();
|
|
85947
85947
|
}, "abort")
|
|
@@ -85952,7 +85952,7 @@ async function prepareContainerImagesForDev(args) {
|
|
|
85952
85952
|
const pull = await pullImage(dockerPath, options, args.logger, args.complianceConfig, args.registryConfigureCommand);
|
|
85953
85953
|
onContainerImagePreparationStart({
|
|
85954
85954
|
containerOptions: options,
|
|
85955
|
-
abort: /* @__PURE__ */ __name$
|
|
85955
|
+
abort: /* @__PURE__ */ __name$1(() => {
|
|
85956
85956
|
aborted$2 = true;
|
|
85957
85957
|
pull.abort();
|
|
85958
85958
|
}, "abort")
|
|
@@ -85966,7 +85966,7 @@ async function prepareContainerImagesForDev(args) {
|
|
|
85966
85966
|
if (!aborted$2) await pullEgressInterceptorImage(dockerPath);
|
|
85967
85967
|
return { aborted: aborted$2 };
|
|
85968
85968
|
}
|
|
85969
|
-
__name$
|
|
85969
|
+
__name$1(prepareContainerImagesForDev, "prepareContainerImagesForDev");
|
|
85970
85970
|
function isCloudflareRegistryImage(image, complianceConfig) {
|
|
85971
85971
|
let url$2;
|
|
85972
85972
|
try {
|
|
@@ -85974,7 +85974,7 @@ function isCloudflareRegistryImage(image, complianceConfig) {
|
|
|
85974
85974
|
} catch {}
|
|
85975
85975
|
return url$2 === void 0 || !url$2.host.match(/[:.]/) && url$2.hostname !== "localhost" || url$2.hostname === getCloudflareContainerRegistry(complianceConfig);
|
|
85976
85976
|
}
|
|
85977
|
-
__name$
|
|
85977
|
+
__name$1(isCloudflareRegistryImage, "isCloudflareRegistryImage");
|
|
85978
85978
|
function resolveImageName(accountId, image, complianceConfig) {
|
|
85979
85979
|
let url$2;
|
|
85980
85980
|
try {
|
|
@@ -85993,11 +85993,11 @@ Current account: "${accountId}"`);
|
|
|
85993
85993
|
}
|
|
85994
85994
|
return `${url$2.hostname}/${accountId}${url$2.pathname}`;
|
|
85995
85995
|
}
|
|
85996
|
-
__name$
|
|
85996
|
+
__name$1(resolveImageName, "resolveImageName");
|
|
85997
85997
|
function invalidGarCredentialError() {
|
|
85998
85998
|
return new UserError("The Google service account key must be a JSON key file or its base64-encoded form.", { telemetryMessage: "containers registries configure invalid gar credential" });
|
|
85999
85999
|
}
|
|
86000
|
-
__name$
|
|
86000
|
+
__name$1(invalidGarCredentialError, "invalidGarCredentialError");
|
|
86001
86001
|
function tryParseJson(value) {
|
|
86002
86002
|
try {
|
|
86003
86003
|
return JSON.parse(value);
|
|
@@ -86005,12 +86005,12 @@ function tryParseJson(value) {
|
|
|
86005
86005
|
return;
|
|
86006
86006
|
}
|
|
86007
86007
|
}
|
|
86008
|
-
__name$
|
|
86008
|
+
__name$1(tryParseJson, "tryParseJson");
|
|
86009
86009
|
function assertJsonObject(parsed) {
|
|
86010
86010
|
if (typeof parsed !== "object" || parsed === null) throw invalidGarCredentialError();
|
|
86011
86011
|
return parsed;
|
|
86012
86012
|
}
|
|
86013
|
-
__name$
|
|
86013
|
+
__name$1(assertJsonObject, "assertJsonObject");
|
|
86014
86014
|
function validateServiceAccountKey(accountKey) {
|
|
86015
86015
|
const privateKey = accountKey.private_key;
|
|
86016
86016
|
const clientEmail = accountKey.client_email;
|
|
@@ -86027,7 +86027,7 @@ function validateServiceAccountKey(accountKey) {
|
|
|
86027
86027
|
private_key_id: privateKeyId
|
|
86028
86028
|
};
|
|
86029
86029
|
}
|
|
86030
|
-
__name$
|
|
86030
|
+
__name$1(validateServiceAccountKey, "validateServiceAccountKey");
|
|
86031
86031
|
function validateAndEncodeGarKey(rawKey, expectedEmail) {
|
|
86032
86032
|
const trimmed = rawKey.trim();
|
|
86033
86033
|
let base64Key;
|
|
@@ -86047,7 +86047,7 @@ function validateAndEncodeGarKey(rawKey, expectedEmail) {
|
|
|
86047
86047
|
if (key.client_email !== expectedEmail) throw new UserError(`The provided --gar-email "${expectedEmail}" does not match the service account email "${key.client_email}" in the key.`, { telemetryMessage: "containers registries configure gar email mismatch" });
|
|
86048
86048
|
return base64Key;
|
|
86049
86049
|
}
|
|
86050
|
-
__name$
|
|
86050
|
+
__name$1(validateAndEncodeGarKey, "validateAndEncodeGarKey");
|
|
86051
86051
|
async function dockerImageInspect(dockerPath, options) {
|
|
86052
86052
|
return new Promise((resolve2, reject) => {
|
|
86053
86053
|
const proc = spawn(dockerPath, [
|
|
@@ -86072,7 +86072,7 @@ async function dockerImageInspect(dockerPath, options) {
|
|
|
86072
86072
|
proc.on("error", (err) => reject(err));
|
|
86073
86073
|
});
|
|
86074
86074
|
}
|
|
86075
|
-
__name$
|
|
86075
|
+
__name$1(dockerImageInspect, "dockerImageInspect");
|
|
86076
86076
|
var MB = 1e3 * 1e3;
|
|
86077
86077
|
var MiB = 1024 * 1024;
|
|
86078
86078
|
var instanceTypes = {
|
|
@@ -86129,7 +86129,7 @@ function configToUsage(containerConfig) {
|
|
|
86129
86129
|
disk_mb: containerConfig.disk_bytes / MB
|
|
86130
86130
|
};
|
|
86131
86131
|
}
|
|
86132
|
-
__name$
|
|
86132
|
+
__name$1(configToUsage, "configToUsage");
|
|
86133
86133
|
function accountToLimits(account) {
|
|
86134
86134
|
return {
|
|
86135
86135
|
vcpu: account.limits.vcpu_per_deployment,
|
|
@@ -86137,15 +86137,15 @@ function accountToLimits(account) {
|
|
|
86137
86137
|
disk_mb: account.limits.disk_mb_per_deployment
|
|
86138
86138
|
};
|
|
86139
86139
|
}
|
|
86140
|
-
__name$
|
|
86140
|
+
__name$1(accountToLimits, "accountToLimits");
|
|
86141
86141
|
function getInstanceTypeUsage(instanceType) {
|
|
86142
86142
|
return instanceTypes[instanceType];
|
|
86143
86143
|
}
|
|
86144
|
-
__name$
|
|
86144
|
+
__name$1(getInstanceTypeUsage, "getInstanceTypeUsage");
|
|
86145
86145
|
function inferInstanceType(config$3) {
|
|
86146
86146
|
for (const [instanceType, configuration] of Object.entries(instanceTypes)) if (config$3.vcpu === configuration.vcpu && config$3.memory_mib === configuration.memory_mib && config$3.disk?.size_mb === configuration.disk_mb) return (instanceType in LEGACY_TO_CANONICAL ? LEGACY_TO_CANONICAL[instanceType] : void 0) ?? instanceType;
|
|
86147
86147
|
}
|
|
86148
|
-
__name$
|
|
86148
|
+
__name$1(inferInstanceType, "inferInstanceType");
|
|
86149
86149
|
function cleanForInstanceType(app) {
|
|
86150
86150
|
if (!("configuration" in app)) return app;
|
|
86151
86151
|
const instance_type = inferInstanceType(app.configuration);
|
|
@@ -86156,7 +86156,7 @@ function cleanForInstanceType(app) {
|
|
|
86156
86156
|
delete app.configuration.vcpu;
|
|
86157
86157
|
return app;
|
|
86158
86158
|
}
|
|
86159
|
-
__name$
|
|
86159
|
+
__name$1(cleanForInstanceType, "cleanForInstanceType");
|
|
86160
86160
|
async function ensureContainerLimits(options) {
|
|
86161
86161
|
const limits = accountToLimits(options.account);
|
|
86162
86162
|
if (!options.containerConfig) {
|
|
@@ -86179,7 +86179,7 @@ async function ensureContainerLimits(options) {
|
|
|
86179
86179
|
imageTag: options.imageTag
|
|
86180
86180
|
});
|
|
86181
86181
|
}
|
|
86182
|
-
__name$
|
|
86182
|
+
__name$1(ensureContainerLimits, "ensureContainerLimits");
|
|
86183
86183
|
async function ensureImageFitsLimits(options) {
|
|
86184
86184
|
const inspectOutput = await dockerImageInspect(options.pathToDocker, {
|
|
86185
86185
|
imageTag: options.imageTag,
|
|
@@ -86193,21 +86193,21 @@ async function ensureImageFitsLimits(options) {
|
|
|
86193
86193
|
logger$1.debug(`Disk size limits when building container image: availableSize=${Math.ceil(options.availableSizeInBytes / MB)}MB, requiredSize=${Math.ceil(requiredSizeInBytes / MB)}MB`);
|
|
86194
86194
|
if (options.availableSizeInBytes < requiredSizeInBytes) throw new UserError(`Image too large: needs ${Math.ceil(requiredSizeInBytes / MB)}MB, but your app is limited to images with size ${options.availableSizeInBytes / MB}MB. You need more disk for this image.`, { telemetryMessage: "cloudchamber limits image too large" });
|
|
86195
86195
|
}
|
|
86196
|
-
__name$
|
|
86196
|
+
__name$1(ensureImageFitsLimits, "ensureImageFitsLimits");
|
|
86197
86197
|
async function getContainerAccount(accountId, complianceConfig) {
|
|
86198
86198
|
if (accountId === void 0) return await AccountService.getMe();
|
|
86199
86199
|
return await fetchResult$1(complianceConfig ?? {}, `/accounts/${accountId}/containers/me`);
|
|
86200
86200
|
}
|
|
86201
|
-
__name$
|
|
86201
|
+
__name$1(getContainerAccount, "getContainerAccount");
|
|
86202
86202
|
var MAX_DOCKER_REPOSITORY_NAME_LENGTH = 255;
|
|
86203
86203
|
function normalizeContainerImageRepositoryName(value) {
|
|
86204
86204
|
return value.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/[._-]+/g, (separators) => separators === "." || separators === "_" || separators === "__" || /^-+$/.test(separators) ? separators : "-").replace(/^[._-]+|[._-]+$/g, "").slice(0, MAX_DOCKER_REPOSITORY_NAME_LENGTH).replace(/[._-]+$/g, "") || "container";
|
|
86205
86205
|
}
|
|
86206
|
-
__name$
|
|
86206
|
+
__name$1(normalizeContainerImageRepositoryName, "normalizeContainerImageRepositoryName");
|
|
86207
86207
|
function isDockerfileContainerConfig(container) {
|
|
86208
86208
|
return "dockerfile" in container;
|
|
86209
86209
|
}
|
|
86210
|
-
__name$
|
|
86210
|
+
__name$1(isDockerfileContainerConfig, "isDockerfileContainerConfig");
|
|
86211
86211
|
async function constructBuildCommand(options) {
|
|
86212
86212
|
const imageOutput = process.env.WRANGLER_CONTAINER_IMAGE_COMPRESSION === "zstd" ? "type=docker,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true" : void 0;
|
|
86213
86213
|
const platform$1 = options.platform ?? "linux/amd64";
|
|
@@ -86231,7 +86231,7 @@ async function constructBuildCommand(options) {
|
|
|
86231
86231
|
dockerfile
|
|
86232
86232
|
};
|
|
86233
86233
|
}
|
|
86234
|
-
__name$
|
|
86234
|
+
__name$1(constructBuildCommand, "constructBuildCommand");
|
|
86235
86235
|
async function startContainerBuild({ build, pathToDocker, verifyDockerIsRunning }) {
|
|
86236
86236
|
if (process.env.WRANGLER_CONTAINER_IMAGE_COMPRESSION === "zstd") {
|
|
86237
86237
|
if (!runDockerCmdWithOutput(pathToDocker, [
|
|
@@ -86247,25 +86247,25 @@ async function startContainerBuild({ build, pathToDocker, verifyDockerIsRunning
|
|
|
86247
86247
|
verifyDockerIsRunning
|
|
86248
86248
|
});
|
|
86249
86249
|
}
|
|
86250
|
-
__name$
|
|
86250
|
+
__name$1(startContainerBuild, "startContainerBuild");
|
|
86251
86251
|
var DIGEST_SUFFIX_REGEXP = /@[A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*:[a-fA-F0-9]{32,}$/;
|
|
86252
86252
|
var DIGEST_VALUE_REGEXP = /^[A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*:[a-fA-F0-9]{32,}$/;
|
|
86253
86253
|
var TAG_SUFFIX_REGEXP = /:[\w][\w.-]{0,127}$/;
|
|
86254
86254
|
function getRepositoryOnly(externalAccountId, imageTag, complianceConfig) {
|
|
86255
86255
|
return resolveImageName(externalAccountId, imageTag, complianceConfig).replace(DIGEST_SUFFIX_REGEXP, "").replace(TAG_SUFFIX_REGEXP, "");
|
|
86256
86256
|
}
|
|
86257
|
-
__name$
|
|
86257
|
+
__name$1(getRepositoryOnly, "getRepositoryOnly");
|
|
86258
86258
|
function imageRefWithDigest(externalAccountId, imageTag, digest, complianceConfig) {
|
|
86259
86259
|
if (!DIGEST_VALUE_REGEXP.test(digest)) throw new Error(`Expected image digest to match algorithm:hex format, got ${digest}`);
|
|
86260
86260
|
return `${getRepositoryOnly(externalAccountId, imageTag, complianceConfig)}@${digest}`;
|
|
86261
86261
|
}
|
|
86262
|
-
__name$
|
|
86262
|
+
__name$1(imageRefWithDigest, "imageRefWithDigest");
|
|
86263
86263
|
function findManifestDigest(manifestOutput) {
|
|
86264
86264
|
const digest = JSON.parse(manifestOutput)?.Descriptor?.digest;
|
|
86265
86265
|
if (typeof digest !== "string" || digest.length === 0) throw new Error(`Expected docker manifest inspect output to include Descriptor.digest, got ${manifestOutput}`);
|
|
86266
86266
|
return digest;
|
|
86267
86267
|
}
|
|
86268
|
-
__name$
|
|
86268
|
+
__name$1(findManifestDigest, "findManifestDigest");
|
|
86269
86269
|
function findRemoteDigest(repoDigestsJson, externalAccountId, imageTag, complianceConfig) {
|
|
86270
86270
|
const parsedDigests = JSON.parse(repoDigestsJson);
|
|
86271
86271
|
if (!Array.isArray(parsedDigests)) throw new Error(`Expected RepoDigests from docker inspect to be an array but got ${JSON.stringify(parsedDigests)}`);
|
|
@@ -86282,11 +86282,11 @@ function findRemoteDigest(repoDigestsJson, externalAccountId, imageTag, complian
|
|
|
86282
86282
|
assertString(hash$1, `Expected digest "${digest}" to include a hash`);
|
|
86283
86283
|
return imageRefWithDigest(externalAccountId, imageTag, hash$1, complianceConfig);
|
|
86284
86284
|
}
|
|
86285
|
-
__name$
|
|
86285
|
+
__name$1(findRemoteDigest, "findRemoteDigest");
|
|
86286
86286
|
function assertString(value, message) {
|
|
86287
86287
|
if (value === void 0) throw new Error(message);
|
|
86288
86288
|
}
|
|
86289
|
-
__name$
|
|
86289
|
+
__name$1(assertString, "assertString");
|
|
86290
86290
|
async function tagAndPushImage({ pathToDocker, sourceTag, targetTag, externalAccountId, complianceConfig, cleanupSourceTag }) {
|
|
86291
86291
|
const namespacedImageTag = resolveImageName(externalAccountId, targetTag, complianceConfig);
|
|
86292
86292
|
await runDockerCmd(pathToDocker, [
|
|
@@ -86305,7 +86305,7 @@ async function tagAndPushImage({ pathToDocker, sourceTag, targetTag, externalAcc
|
|
|
86305
86305
|
}
|
|
86306
86306
|
return namespacedImageTag;
|
|
86307
86307
|
}
|
|
86308
|
-
__name$
|
|
86308
|
+
__name$1(tagAndPushImage, "tagAndPushImage");
|
|
86309
86309
|
async function pushImageIfChanged({ pathToDocker, sourceTag, targetTag, containerConfig, accountId, complianceConfig, cleanupSourceTag }) {
|
|
86310
86310
|
const imageInfo = await dockerImageInspect(pathToDocker, {
|
|
86311
86311
|
imageTag: sourceTag,
|
|
@@ -86372,7 +86372,7 @@ async function pushImageIfChanged({ pathToDocker, sourceTag, targetTag, containe
|
|
|
86372
86372
|
}
|
|
86373
86373
|
return { remoteDigest };
|
|
86374
86374
|
}
|
|
86375
|
-
__name$
|
|
86375
|
+
__name$1(pushImageIfChanged, "pushImageIfChanged");
|
|
86376
86376
|
async function buildCommand(args, complianceConfig) {
|
|
86377
86377
|
if (existsSync(args.PATH) && !isDirectory(args.PATH)) throw new UserError(`${args.PATH} is not a directory. Please specify a valid directory path.`, { telemetryMessage: "container build invalid path" });
|
|
86378
86378
|
if (args.platform !== void 0 && args.platform !== "linux/amd64") throw new UserError(`Unsupported platform: Platform "${args.platform}" is unsupported. Please use "linux/amd64" instead.`, { telemetryMessage: "container build unsupported platform" });
|
|
@@ -86402,7 +86402,7 @@ async function buildCommand(args, complianceConfig) {
|
|
|
86402
86402
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container build unknown error" });
|
|
86403
86403
|
}
|
|
86404
86404
|
}
|
|
86405
|
-
__name$
|
|
86405
|
+
__name$1(buildCommand, "buildCommand");
|
|
86406
86406
|
async function pushCommand(args, accountId, complianceConfig) {
|
|
86407
86407
|
try {
|
|
86408
86408
|
const dockerPath = args.pathToDocker ?? getDockerPath();
|
|
@@ -86421,7 +86421,7 @@ async function pushCommand(args, accountId, complianceConfig) {
|
|
|
86421
86421
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container push unknown error" });
|
|
86422
86422
|
}
|
|
86423
86423
|
}
|
|
86424
|
-
__name$
|
|
86424
|
+
__name$1(pushCommand, "pushCommand");
|
|
86425
86425
|
async function checkImagePlatform(pathToDocker, imageTag, expectedPlatform = "linux/amd64") {
|
|
86426
86426
|
const platform$1 = await dockerImageInspect(pathToDocker, {
|
|
86427
86427
|
imageTag,
|
|
@@ -86429,7 +86429,7 @@ async function checkImagePlatform(pathToDocker, imageTag, expectedPlatform = "li
|
|
|
86429
86429
|
});
|
|
86430
86430
|
if (platform$1 !== expectedPlatform) throw new Error(`Unsupported platform: Image platform (${platform$1}) does not match the expected platform (${expectedPlatform})`);
|
|
86431
86431
|
}
|
|
86432
|
-
__name$
|
|
86432
|
+
__name$1(checkImagePlatform, "checkImagePlatform");
|
|
86433
86433
|
async function buildAndMaybePush(args, pathToDocker, push, containerConfig, verifyDockerIsRunning, complianceConfig) {
|
|
86434
86434
|
try {
|
|
86435
86435
|
await (await startContainerBuild({
|
|
@@ -86454,7 +86454,7 @@ async function buildAndMaybePush(args, pathToDocker, push, containerConfig, veri
|
|
|
86454
86454
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container build unknown error" });
|
|
86455
86455
|
}
|
|
86456
86456
|
}
|
|
86457
|
-
__name$
|
|
86457
|
+
__name$1(buildAndMaybePush, "buildAndMaybePush");
|
|
86458
86458
|
async function buildContainerImage(containerConfig, pathToDocker, verifyDockerIsRunning) {
|
|
86459
86459
|
const localTag = `${getContainerImageRepositoryName(containerConfig)}:wrangler-${crypto2.randomUUID()}`;
|
|
86460
86460
|
logger$1.log("Building image", localTag);
|
|
@@ -86481,7 +86481,7 @@ async function buildContainerImage(containerConfig, pathToDocker, verifyDockerIs
|
|
|
86481
86481
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container build unknown error" });
|
|
86482
86482
|
}
|
|
86483
86483
|
}
|
|
86484
|
-
__name$
|
|
86484
|
+
__name$1(buildContainerImage, "buildContainerImage");
|
|
86485
86485
|
async function buildContainerImages(containers, pathToDocker, verifyDockerIsRunning) {
|
|
86486
86486
|
const builtImages = [];
|
|
86487
86487
|
try {
|
|
@@ -86492,7 +86492,7 @@ async function buildContainerImages(containers, pathToDocker, verifyDockerIsRunn
|
|
|
86492
86492
|
}
|
|
86493
86493
|
return builtImages;
|
|
86494
86494
|
}
|
|
86495
|
-
__name$
|
|
86495
|
+
__name$1(buildContainerImages, "buildContainerImages");
|
|
86496
86496
|
async function pushBuiltContainerImage(builtImage, versionId, pathToDocker, accountId, complianceConfig) {
|
|
86497
86497
|
try {
|
|
86498
86498
|
return await pushImageIfChanged({
|
|
@@ -86512,7 +86512,7 @@ async function pushBuiltContainerImage(builtImage, versionId, pathToDocker, acco
|
|
|
86512
86512
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container build unknown error" });
|
|
86513
86513
|
}
|
|
86514
86514
|
}
|
|
86515
|
-
__name$
|
|
86515
|
+
__name$1(pushBuiltContainerImage, "pushBuiltContainerImage");
|
|
86516
86516
|
async function cleanupBuiltImages(builtImages, pathToDocker) {
|
|
86517
86517
|
const aliasesByTag = /* @__PURE__ */ new Map();
|
|
86518
86518
|
for (const builtImage of builtImages) {
|
|
@@ -86535,15 +86535,15 @@ async function cleanupBuiltImages(builtImages, pathToDocker) {
|
|
|
86535
86535
|
for (const alias of aliases) alias.localTagCleaned = true;
|
|
86536
86536
|
}
|
|
86537
86537
|
}
|
|
86538
|
-
__name$
|
|
86538
|
+
__name$1(cleanupBuiltImages, "cleanupBuiltImages");
|
|
86539
86539
|
function getContainerImageTag(containerConfig, imageTag) {
|
|
86540
86540
|
return `${getContainerImageRepositoryName(containerConfig)}:${imageTag.split("-")[0]}`;
|
|
86541
86541
|
}
|
|
86542
|
-
__name$
|
|
86542
|
+
__name$1(getContainerImageTag, "getContainerImageTag");
|
|
86543
86543
|
function getContainerImageRepositoryName(containerConfig) {
|
|
86544
86544
|
return containerConfig.name.toLowerCase();
|
|
86545
86545
|
}
|
|
86546
|
-
__name$
|
|
86546
|
+
__name$1(getContainerImageRepositoryName, "getContainerImageRepositoryName");
|
|
86547
86547
|
async function dockerBuild(dockerPath, options) {
|
|
86548
86548
|
if (options.verifyDockerIsRunning !== false) await verifyDockerInstalled({
|
|
86549
86549
|
dockerPath,
|
|
@@ -86583,7 +86583,7 @@ async function dockerBuild(dockerPath, options) {
|
|
|
86583
86583
|
}
|
|
86584
86584
|
});
|
|
86585
86585
|
return {
|
|
86586
|
-
abort: /* @__PURE__ */ __name$
|
|
86586
|
+
abort: /* @__PURE__ */ __name$1(() => {
|
|
86587
86587
|
child.unref();
|
|
86588
86588
|
if (child.pid !== void 0) if (process.platform === "win32") child.kill();
|
|
86589
86589
|
else process.kill(-child.pid);
|
|
@@ -86591,7 +86591,7 @@ async function dockerBuild(dockerPath, options) {
|
|
|
86591
86591
|
ready
|
|
86592
86592
|
};
|
|
86593
86593
|
}
|
|
86594
|
-
__name$
|
|
86594
|
+
__name$1(dockerBuild, "dockerBuild");
|
|
86595
86595
|
function resolveInputContainerImage(options) {
|
|
86596
86596
|
if ("reference" in options.image) return { reference: options.image.reference };
|
|
86597
86597
|
const dockerfile = path__default.resolve(options.root, options.image.dockerfile);
|
|
@@ -86601,7 +86601,7 @@ function resolveInputContainerImage(options) {
|
|
|
86601
86601
|
buildVars: options.image.buildVars
|
|
86602
86602
|
};
|
|
86603
86603
|
}
|
|
86604
|
-
__name$
|
|
86604
|
+
__name$1(resolveInputContainerImage, "resolveInputContainerImage");
|
|
86605
86605
|
var BUILD_OUTPUT_IMAGE_NAMESPACE = "cloudflare-build";
|
|
86606
86606
|
var DOCKER_REPOSITORY_NAME_LENGTH = 255;
|
|
86607
86607
|
async function buildAndWriteContainerOutput(options) {
|
|
@@ -86641,7 +86641,7 @@ async function buildAndWriteContainerOutput(options) {
|
|
|
86641
86641
|
throw error$3;
|
|
86642
86642
|
}
|
|
86643
86643
|
}
|
|
86644
|
-
__name$
|
|
86644
|
+
__name$1(buildAndWriteContainerOutput, "buildAndWriteContainerOutput");
|
|
86645
86645
|
function resolveContainerDirectories(containers) {
|
|
86646
86646
|
const containerNameByDirectory = /* @__PURE__ */ new Map();
|
|
86647
86647
|
return containers.map((config$3) => {
|
|
@@ -86655,7 +86655,7 @@ function resolveContainerDirectories(containers) {
|
|
|
86655
86655
|
};
|
|
86656
86656
|
});
|
|
86657
86657
|
}
|
|
86658
|
-
__name$
|
|
86658
|
+
__name$1(resolveContainerDirectories, "resolveContainerDirectories");
|
|
86659
86659
|
async function buildContainerOutputConfig(options) {
|
|
86660
86660
|
if (options.config.schedulingPolicy === "durable-object") {
|
|
86661
86661
|
if (options.config.images === void 0) return {
|
|
@@ -86689,7 +86689,7 @@ async function buildContainerOutputConfig(options) {
|
|
|
86689
86689
|
image
|
|
86690
86690
|
};
|
|
86691
86691
|
}
|
|
86692
|
-
__name$
|
|
86692
|
+
__name$1(buildContainerOutputConfig, "buildContainerOutputConfig");
|
|
86693
86693
|
async function buildContainerImage2(options) {
|
|
86694
86694
|
const image = resolveInputContainerImage({
|
|
86695
86695
|
image: options.image,
|
|
@@ -86716,13 +86716,13 @@ async function buildContainerImage2(options) {
|
|
|
86716
86716
|
options.localTags.add(localTag);
|
|
86717
86717
|
return { localReference: localTag };
|
|
86718
86718
|
}
|
|
86719
|
-
__name$
|
|
86719
|
+
__name$1(buildContainerImage2, "buildContainerImage");
|
|
86720
86720
|
function createBuildOutputImageTag(options) {
|
|
86721
86721
|
const repositoryPrefix = getBuildOutputImageRepositoryPrefix(options.root);
|
|
86722
86722
|
const maxNameLength = DOCKER_REPOSITORY_NAME_LENGTH - repositoryPrefix.length;
|
|
86723
86723
|
return `${repositoryPrefix}${normalizeContainerImageRepositoryName(options.repositoryName).slice(0, maxNameLength).replace(/[._-]+$/g, "")}:${options.buildId}`;
|
|
86724
86724
|
}
|
|
86725
|
-
__name$
|
|
86725
|
+
__name$1(createBuildOutputImageTag, "createBuildOutputImageTag");
|
|
86726
86726
|
async function cleanupPreviousBuildOutputImageTags(options) {
|
|
86727
86727
|
const repositoryPrefix = getBuildOutputImageRepositoryPrefix(options.root);
|
|
86728
86728
|
let existingTags;
|
|
@@ -86741,26 +86741,26 @@ async function cleanupPreviousBuildOutputImageTags(options) {
|
|
|
86741
86741
|
}
|
|
86742
86742
|
if (existingTags.length > 0) await cleanupBuiltImages(existingTags.map((localTag) => ({ localTag })), options.pathToDocker);
|
|
86743
86743
|
}
|
|
86744
|
-
__name$
|
|
86744
|
+
__name$1(cleanupPreviousBuildOutputImageTags, "cleanupPreviousBuildOutputImageTags");
|
|
86745
86745
|
function getBuildOutputImageRepositoryPrefix(root) {
|
|
86746
86746
|
return `${BUILD_OUTPUT_IMAGE_NAMESPACE}/${shortHash(path__default.resolve(root))}/`;
|
|
86747
86747
|
}
|
|
86748
|
-
__name$
|
|
86748
|
+
__name$1(getBuildOutputImageRepositoryPrefix, "getBuildOutputImageRepositoryPrefix");
|
|
86749
86749
|
function shortHash(value) {
|
|
86750
86750
|
return crypto2.createHash("sha256").update(value).digest("hex").slice(0, 12);
|
|
86751
86751
|
}
|
|
86752
|
-
__name$
|
|
86752
|
+
__name$1(shortHash, "shortHash");
|
|
86753
86753
|
function createBuildId() {
|
|
86754
86754
|
return crypto2.randomUUID().replaceAll("-", "").slice(0, 12);
|
|
86755
86755
|
}
|
|
86756
|
-
__name$
|
|
86756
|
+
__name$1(createBuildId, "createBuildId");
|
|
86757
86757
|
function countDockerfiles(containers) {
|
|
86758
86758
|
let count = 0;
|
|
86759
86759
|
for (const config$3 of containers) if (config$3.schedulingPolicy === "durable-object") count += Object.values(config$3.images ?? {}).filter((image) => "dockerfile" in image).length;
|
|
86760
86760
|
else if ("dockerfile" in config$3.image) count++;
|
|
86761
86761
|
return count;
|
|
86762
86762
|
}
|
|
86763
|
-
__name$
|
|
86763
|
+
__name$1(countDockerfiles, "countDockerfiles");
|
|
86764
86764
|
function throwBuildError(error$3) {
|
|
86765
86765
|
if (error$3 instanceof UserError) throw error$3;
|
|
86766
86766
|
if (error$3 instanceof Error) throw new UserError(error$3.message, {
|
|
@@ -86769,10 +86769,10 @@ function throwBuildError(error$3) {
|
|
|
86769
86769
|
});
|
|
86770
86770
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container build unknown error" });
|
|
86771
86771
|
}
|
|
86772
|
-
__name$
|
|
86772
|
+
__name$1(throwBuildError, "throwBuildError");
|
|
86773
86773
|
var Diff = class {
|
|
86774
86774
|
static {
|
|
86775
|
-
__name$
|
|
86775
|
+
__name$1(this, "Diff");
|
|
86776
86776
|
}
|
|
86777
86777
|
#results = [];
|
|
86778
86778
|
get changes() {
|
|
@@ -86859,15 +86859,15 @@ var Diff = class {
|
|
|
86859
86859
|
*/
|
|
86860
86860
|
get #resultsForPrint() {
|
|
86861
86861
|
const results = [...this.#results.filter((r$1) => !!r$1.value && r$1.value !== "\n")];
|
|
86862
|
-
const swapLines = /* @__PURE__ */ __name$
|
|
86862
|
+
const swapLines = /* @__PURE__ */ __name$1((i$1, j$1) => {
|
|
86863
86863
|
const current = results[i$1];
|
|
86864
86864
|
const adjacent = results[j$1];
|
|
86865
86865
|
if (current === void 0 || adjacent === void 0) return;
|
|
86866
86866
|
results[i$1] = adjacent;
|
|
86867
86867
|
results[j$1] = current;
|
|
86868
86868
|
}, "swapLines");
|
|
86869
|
-
const numOfLines = /* @__PURE__ */ __name$
|
|
86870
|
-
const isLoneResult = /* @__PURE__ */ __name$
|
|
86869
|
+
const numOfLines = /* @__PURE__ */ __name$1((str) => str.split("\n").length, "numOfLines");
|
|
86870
|
+
const isLoneResult = /* @__PURE__ */ __name$1((index, target$1) => {
|
|
86871
86871
|
const currentIdx = index;
|
|
86872
86872
|
const adjacentIdx = currentIdx + target$1;
|
|
86873
86873
|
const nextIdx = currentIdx + target$1 + target$1;
|
|
@@ -86876,7 +86876,7 @@ var Diff = class {
|
|
|
86876
86876
|
const next = results[nextIdx];
|
|
86877
86877
|
if (!current || !adjacent || !next) return false;
|
|
86878
86878
|
const previousIdx = index - target$1;
|
|
86879
|
-
const isAlternation = /* @__PURE__ */ __name$
|
|
86879
|
+
const isAlternation = /* @__PURE__ */ __name$1((type) => current[type] === true && results[previousIdx]?.[type] !== current[type] && adjacent[type === "added" ? "removed" : "added"] === true && next[type] === true, "isAlternation");
|
|
86880
86880
|
if (!isAlternation("added") && !isAlternation("removed")) return false;
|
|
86881
86881
|
return numOfLines(current.value ?? "") === 1 && numOfLines(adjacent.value ?? "") === 1 && numOfLines(next.value ?? "") > 1;
|
|
86882
86882
|
}, "isLoneResult");
|
|
@@ -87018,12 +87018,12 @@ function tokenize(value) {
|
|
|
87018
87018
|
}
|
|
87019
87019
|
return retLines.filter((s) => s !== "");
|
|
87020
87020
|
}
|
|
87021
|
-
__name$
|
|
87021
|
+
__name$1(tokenize, "tokenize");
|
|
87022
87022
|
function stripUndefined(r$1) {
|
|
87023
87023
|
for (const k in r$1) if (r$1[k] === void 0) delete r$1[k];
|
|
87024
87024
|
return r$1;
|
|
87025
87025
|
}
|
|
87026
|
-
__name$
|
|
87026
|
+
__name$1(stripUndefined, "stripUndefined");
|
|
87027
87027
|
function sortObjectKeys(unordered) {
|
|
87028
87028
|
if (Array.isArray(unordered)) return unordered;
|
|
87029
87029
|
return Object.keys(unordered).sort().reduce((obj, key) => {
|
|
@@ -87031,7 +87031,7 @@ function sortObjectKeys(unordered) {
|
|
|
87031
87031
|
return obj;
|
|
87032
87032
|
}, {});
|
|
87033
87033
|
}
|
|
87034
|
-
__name$
|
|
87034
|
+
__name$1(sortObjectKeys, "sortObjectKeys");
|
|
87035
87035
|
function sortObjectRecursive(object$2) {
|
|
87036
87036
|
if (typeof object$2 !== "object") return object$2;
|
|
87037
87037
|
if (Array.isArray(object$2)) return object$2.map((obj) => sortObjectRecursive(obj));
|
|
@@ -87042,7 +87042,7 @@ function sortObjectRecursive(object$2) {
|
|
|
87042
87042
|
}
|
|
87043
87043
|
return sortObjectKeys(objectCopy);
|
|
87044
87044
|
}
|
|
87045
|
-
__name$
|
|
87045
|
+
__name$1(sortObjectRecursive, "sortObjectRecursive");
|
|
87046
87046
|
async function promiseSpinner(promise$1, { message } = { message: "Loading" }) {
|
|
87047
87047
|
if (process.env.CI || !process.stdin.isTTY) return promise$1;
|
|
87048
87048
|
const { start, stop } = spinner();
|
|
@@ -87054,7 +87054,7 @@ async function promiseSpinner(promise$1, { message } = { message: "Loading" }) {
|
|
|
87054
87054
|
stop();
|
|
87055
87055
|
return t$2;
|
|
87056
87056
|
}
|
|
87057
|
-
__name$
|
|
87057
|
+
__name$1(promiseSpinner, "promiseSpinner");
|
|
87058
87058
|
function createDurableObjectNamespaceResolver(config$3, { versionId, accountId, scriptName, dispatchNamespace }) {
|
|
87059
87059
|
const boundDOs = new Set(config$3.durable_objects.bindings.map((binding) => binding.class_name));
|
|
87060
87060
|
let maybeVersionInfo;
|
|
@@ -87072,7 +87072,7 @@ function createDurableObjectNamespaceResolver(config$3, { versionId, accountId,
|
|
|
87072
87072
|
return targetDurableObject.id;
|
|
87073
87073
|
};
|
|
87074
87074
|
}
|
|
87075
|
-
__name$
|
|
87075
|
+
__name$1(createDurableObjectNamespaceResolver, "createDurableObjectNamespaceResolver");
|
|
87076
87076
|
async function deployContainers(config$3, containerDeployments, { versionId, accountId, scriptName, dispatchNamespace, configFileName: configFileName$1, observabilityTargetPercentageField, observabilityTargetCountField }) {
|
|
87077
87077
|
const resolveNamespaceId = createDurableObjectNamespaceResolver(config$3, {
|
|
87078
87078
|
versionId,
|
|
@@ -87088,7 +87088,7 @@ async function deployContainers(config$3, containerDeployments, { versionId, acc
|
|
|
87088
87088
|
observabilityTargetCountField
|
|
87089
87089
|
}, container, config$3, accountId);
|
|
87090
87090
|
}
|
|
87091
|
-
__name$
|
|
87091
|
+
__name$1(deployContainers, "deployContainers");
|
|
87092
87092
|
async function fetchUploadedVersion(config$3, accountId, scriptName, versionId) {
|
|
87093
87093
|
for (let attempt = 0; attempt < 5; attempt++) try {
|
|
87094
87094
|
return await fetchResult$1(config$3, `/accounts/${accountId}/workers/scripts/${scriptName}/versions/${versionId}`);
|
|
@@ -87098,15 +87098,15 @@ async function fetchUploadedVersion(config$3, accountId, scriptName, versionId)
|
|
|
87098
87098
|
}
|
|
87099
87099
|
throw new Error("Unable to fetch uploaded Worker version");
|
|
87100
87100
|
}
|
|
87101
|
-
__name$
|
|
87101
|
+
__name$1(fetchUploadedVersion, "fetchUploadedVersion");
|
|
87102
87102
|
function isUploadedVersionNotReadyError(error$3) {
|
|
87103
87103
|
return error$3 instanceof Error && "code" in error$3 && error$3.code === 100146;
|
|
87104
87104
|
}
|
|
87105
|
-
__name$
|
|
87105
|
+
__name$1(isUploadedVersionNotReadyError, "isUploadedVersionNotReadyError");
|
|
87106
87106
|
async function listDurableObjects(complianceConfig, accountId) {
|
|
87107
87107
|
return await fetchPagedListResult(complianceConfig, `/accounts/${accountId}/workers/durable_objects/namespaces`, {}, new URLSearchParams({ per_page: "1000" }));
|
|
87108
87108
|
}
|
|
87109
|
-
__name$
|
|
87109
|
+
__name$1(listDurableObjects, "listDurableObjects");
|
|
87110
87110
|
function mergeDeep(target$1, source) {
|
|
87111
87111
|
if (typeof target$1 !== "object" || target$1 === null) return source;
|
|
87112
87112
|
if (typeof source !== "object" || source === null) return target$1;
|
|
@@ -87119,11 +87119,11 @@ function mergeDeep(target$1, source) {
|
|
|
87119
87119
|
}
|
|
87120
87120
|
return result;
|
|
87121
87121
|
}
|
|
87122
|
-
__name$
|
|
87122
|
+
__name$1(mergeDeep, "mergeDeep");
|
|
87123
87123
|
function isObject(value) {
|
|
87124
87124
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
87125
87125
|
}
|
|
87126
|
-
__name$
|
|
87126
|
+
__name$1(isObject, "isObject");
|
|
87127
87127
|
function createApplicationToModifyApplication(req) {
|
|
87128
87128
|
return {
|
|
87129
87129
|
configuration: req.configuration,
|
|
@@ -87135,47 +87135,47 @@ function createApplicationToModifyApplication(req) {
|
|
|
87135
87135
|
rollout_active_grace_period: req.rollout_active_grace_period
|
|
87136
87136
|
};
|
|
87137
87137
|
}
|
|
87138
|
-
__name$
|
|
87138
|
+
__name$1(createApplicationToModifyApplication, "createApplicationToModifyApplication");
|
|
87139
87139
|
function isLegacyObservabilityEnabled(observability) {
|
|
87140
87140
|
return observability?.logs?.enabled === true;
|
|
87141
87141
|
}
|
|
87142
|
-
__name$
|
|
87142
|
+
__name$1(isLegacyObservabilityEnabled, "isLegacyObservabilityEnabled");
|
|
87143
87143
|
function hasLegacyRolloutObservabilityEnabled(app) {
|
|
87144
87144
|
return isLegacyObservabilityEnabled(app?.configuration.observability) || isLegacyObservabilityEnabled(app?.scheduling_hint?.target.configuration.observability);
|
|
87145
87145
|
}
|
|
87146
|
-
__name$
|
|
87146
|
+
__name$1(hasLegacyRolloutObservabilityEnabled, "hasLegacyRolloutObservabilityEnabled");
|
|
87147
87147
|
function getLatestLegacyObservabilityState(app) {
|
|
87148
87148
|
return app?.scheduling_hint?.target.configuration.observability ?? app?.configuration.observability;
|
|
87149
87149
|
}
|
|
87150
|
-
__name$
|
|
87150
|
+
__name$1(getLatestLegacyObservabilityState, "getLatestLegacyObservabilityState");
|
|
87151
87151
|
function usesTopLevelObservability(app) {
|
|
87152
87152
|
return app?.observability !== void 0;
|
|
87153
87153
|
}
|
|
87154
|
-
__name$
|
|
87154
|
+
__name$1(usesTopLevelObservability, "usesTopLevelObservability");
|
|
87155
87155
|
function hasTopLevelOnlyObservabilityFields(observability) {
|
|
87156
87156
|
return observability.target_instance_percentage !== void 0 || observability.target_instance_count !== void 0;
|
|
87157
87157
|
}
|
|
87158
|
-
__name$
|
|
87158
|
+
__name$1(hasTopLevelOnlyObservabilityFields, "hasTopLevelOnlyObservabilityFields");
|
|
87159
87159
|
function selectObservabilityWriteTarget(prevApp) {
|
|
87160
87160
|
if (prevApp === void 0) return "top-level";
|
|
87161
87161
|
if (hasLegacyRolloutObservabilityEnabled(prevApp)) return "configuration";
|
|
87162
87162
|
return "top-level";
|
|
87163
87163
|
}
|
|
87164
|
-
__name$
|
|
87164
|
+
__name$1(selectObservabilityWriteTarget, "selectObservabilityWriteTarget");
|
|
87165
87165
|
function hasMixedEnabledObservability(app) {
|
|
87166
87166
|
return app.observability?.logs?.enabled === true && isLegacyObservabilityEnabled(app.configuration.observability);
|
|
87167
87167
|
}
|
|
87168
|
-
__name$
|
|
87168
|
+
__name$1(hasMixedEnabledObservability, "hasMixedEnabledObservability");
|
|
87169
87169
|
function requiresObservabilityMigration(app, observability) {
|
|
87170
87170
|
return hasLegacyRolloutObservabilityEnabled(app) && (app.observability?.logs?.enabled === true || usesTopLevelObservability(app) && observability.logs_enabled);
|
|
87171
87171
|
}
|
|
87172
|
-
__name$
|
|
87172
|
+
__name$1(requiresObservabilityMigration, "requiresObservabilityMigration");
|
|
87173
87173
|
function buildLegacyObservabilityMigrationPatch(app) {
|
|
87174
87174
|
const observability = app.configuration.observability;
|
|
87175
87175
|
assert(observability?.logs?.enabled === true);
|
|
87176
87176
|
return { logs: observability.logs };
|
|
87177
87177
|
}
|
|
87178
|
-
__name$
|
|
87178
|
+
__name$1(buildLegacyObservabilityMigrationPatch, "buildLegacyObservabilityMigrationPatch");
|
|
87179
87179
|
function migrateLegacyObservabilityState(app, observability) {
|
|
87180
87180
|
const configuration = { ...app.configuration };
|
|
87181
87181
|
delete configuration.observability;
|
|
@@ -87185,7 +87185,7 @@ function migrateLegacyObservabilityState(app, observability) {
|
|
|
87185
87185
|
observability
|
|
87186
87186
|
};
|
|
87187
87187
|
}
|
|
87188
|
-
__name$
|
|
87188
|
+
__name$1(migrateLegacyObservabilityState, "migrateLegacyObservabilityState");
|
|
87189
87189
|
function buildTopLevelObservability(observability) {
|
|
87190
87190
|
return stripUndefined({
|
|
87191
87191
|
logs: { enabled: observability.logs_enabled },
|
|
@@ -87193,15 +87193,15 @@ function buildTopLevelObservability(observability) {
|
|
|
87193
87193
|
target_instance_count: observability.target_instance_count
|
|
87194
87194
|
});
|
|
87195
87195
|
}
|
|
87196
|
-
__name$
|
|
87196
|
+
__name$1(buildTopLevelObservability, "buildTopLevelObservability");
|
|
87197
87197
|
function buildConfigurationObservability(observability) {
|
|
87198
87198
|
return { logs: { enabled: observability.logs_enabled } };
|
|
87199
87199
|
}
|
|
87200
|
-
__name$
|
|
87200
|
+
__name$1(buildConfigurationObservability, "buildConfigurationObservability");
|
|
87201
87201
|
function isSameApplicationObservability(left, right) {
|
|
87202
87202
|
return left?.logs?.enabled === right?.logs?.enabled && left?.target_instance_percentage === right?.target_instance_percentage && left?.target_instance_count === right?.target_instance_count;
|
|
87203
87203
|
}
|
|
87204
|
-
__name$
|
|
87204
|
+
__name$1(isSameApplicationObservability, "isSameApplicationObservability");
|
|
87205
87205
|
function buildTopLevelObservabilityPatch(observability, prevApp, writeTarget) {
|
|
87206
87206
|
if (writeTarget === "configuration" && !usesTopLevelObservability(prevApp)) return;
|
|
87207
87207
|
const shouldWriteDisabledTopLevelObservability = prevApp?.observability !== void 0 && (prevApp.observability.logs?.enabled === true || prevApp.observability.target_instance_percentage !== void 0 || prevApp.observability.target_instance_count !== void 0);
|
|
@@ -87209,14 +87209,14 @@ function buildTopLevelObservabilityPatch(observability, prevApp, writeTarget) {
|
|
|
87209
87209
|
const nextObservability = buildTopLevelObservability(observability);
|
|
87210
87210
|
return isSameApplicationObservability(nextObservability, prevApp?.observability) ? void 0 : nextObservability;
|
|
87211
87211
|
}
|
|
87212
|
-
__name$
|
|
87212
|
+
__name$1(buildTopLevelObservabilityPatch, "buildTopLevelObservabilityPatch");
|
|
87213
87213
|
function buildConfigurationObservabilityPatch(observability, prevApp) {
|
|
87214
87214
|
const latestLegacyLogsEnabled = getLatestLegacyObservabilityState(prevApp)?.logs?.enabled;
|
|
87215
87215
|
if (observability.logs_enabled === latestLegacyLogsEnabled) return;
|
|
87216
87216
|
if (!observability.logs_enabled && latestLegacyLogsEnabled === void 0) return;
|
|
87217
87217
|
return buildConfigurationObservability(observability);
|
|
87218
87218
|
}
|
|
87219
|
-
__name$
|
|
87219
|
+
__name$1(buildConfigurationObservabilityPatch, "buildConfigurationObservabilityPatch");
|
|
87220
87220
|
function buildApplicationObservabilityPatch(observability, writeTarget, prevApp) {
|
|
87221
87221
|
const nextTopLevelObservability = buildTopLevelObservabilityPatch(observability, prevApp, writeTarget);
|
|
87222
87222
|
if (writeTarget === "configuration") {
|
|
@@ -87228,13 +87228,13 @@ function buildApplicationObservabilityPatch(observability, writeTarget, prevApp)
|
|
|
87228
87228
|
}
|
|
87229
87229
|
return nextTopLevelObservability !== void 0 ? { observability: nextTopLevelObservability } : {};
|
|
87230
87230
|
}
|
|
87231
|
-
__name$
|
|
87231
|
+
__name$1(buildApplicationObservabilityPatch, "buildApplicationObservabilityPatch");
|
|
87232
87232
|
function assertCanUseApplicationObservabilityTargeting(prevApp, containerConfig, options) {
|
|
87233
87233
|
if (!hasTopLevelOnlyObservabilityFields(containerConfig.observability)) return;
|
|
87234
87234
|
if (!hasLegacyRolloutObservabilityEnabled(prevApp)) return;
|
|
87235
87235
|
throw new UserError(`Application-level observability targeting cannot be enabled for container ${containerConfig.name} while it still uses legacy rollout-based observability. Set containers[].observability.enabled = false in your ${options.configFileName} and deploy once, then deploy again with ${options.observabilityTargetPercentageField} or ${options.observabilityTargetCountField}.`, { telemetryMessage: "containers deploy observability migration blocked" });
|
|
87236
87236
|
}
|
|
87237
|
-
__name$
|
|
87237
|
+
__name$1(assertCanUseApplicationObservabilityTargeting, "assertCanUseApplicationObservabilityTargeting");
|
|
87238
87238
|
function hasRolloutDiff(prevApp, nextApp) {
|
|
87239
87239
|
const normalizedPrevApp = stripUndefined({ ...prevApp });
|
|
87240
87240
|
const normalizedNextApp = stripUndefined({ ...nextApp });
|
|
@@ -87242,7 +87242,7 @@ function hasRolloutDiff(prevApp, nextApp) {
|
|
|
87242
87242
|
delete normalizedNextApp.observability;
|
|
87243
87243
|
return JSON.stringify(sortObjectRecursive(normalizedPrevApp)) !== JSON.stringify(sortObjectRecursive(normalizedNextApp));
|
|
87244
87244
|
}
|
|
87245
|
-
__name$
|
|
87245
|
+
__name$1(hasRolloutDiff, "hasRolloutDiff");
|
|
87246
87246
|
function containerConfigToCreateRequest(accountId, containerApp, imageRef, durableObjectNamespaceId, complianceConfig, observabilityWriteTarget, prevApp) {
|
|
87247
87247
|
const { observability, configurationObservability } = buildApplicationObservabilityPatch(containerApp.observability, observabilityWriteTarget, prevApp);
|
|
87248
87248
|
return {
|
|
@@ -87269,7 +87269,7 @@ function containerConfigToCreateRequest(accountId, containerApp, imageRef, durab
|
|
|
87269
87269
|
rollout_active_grace_period: containerApp.rollout_active_grace_period
|
|
87270
87270
|
};
|
|
87271
87271
|
}
|
|
87272
|
-
__name$
|
|
87272
|
+
__name$1(containerConfigToCreateRequest, "containerConfigToCreateRequest");
|
|
87273
87273
|
function formatContainerSnippetForDisplay(container, configPath) {
|
|
87274
87274
|
const configurationForDisplay = container.configuration === void 0 ? void 0 : Object.fromEntries(Object.entries(container.configuration).map(([key, value]) => [key === "wrangler_ssh" ? "ssh" : key, value]));
|
|
87275
87275
|
return formatConfigSnippet({ containers: [{
|
|
@@ -87277,7 +87277,7 @@ function formatContainerSnippetForDisplay(container, configPath) {
|
|
|
87277
87277
|
configuration: configurationForDisplay
|
|
87278
87278
|
}] }, configPath);
|
|
87279
87279
|
}
|
|
87280
|
-
__name$
|
|
87280
|
+
__name$1(formatContainerSnippetForDisplay, "formatContainerSnippetForDisplay");
|
|
87281
87281
|
async function apply(args, containerConfig, config$3, accountId) {
|
|
87282
87282
|
if (!config$3.containers || config$3.containers.length === 0) return;
|
|
87283
87283
|
startSection("Deploy a container application", "deploy changes to your application");
|
|
@@ -87355,7 +87355,7 @@ async function apply(args, containerConfig, config$3, accountId) {
|
|
|
87355
87355
|
newline();
|
|
87356
87356
|
endSection("Applied changes");
|
|
87357
87357
|
}
|
|
87358
|
-
__name$
|
|
87358
|
+
__name$1(apply, "apply");
|
|
87359
87359
|
function mergeIfUnsafe(fullConfig, containerConfig, name) {
|
|
87360
87360
|
const unsafeContainerConfig = fullConfig.containers?.find((original) => {
|
|
87361
87361
|
return original.name === name && original.unsafe !== void 0;
|
|
@@ -87363,7 +87363,7 @@ function mergeIfUnsafe(fullConfig, containerConfig, name) {
|
|
|
87363
87363
|
if (unsafeContainerConfig) return mergeDeep(containerConfig, unsafeContainerConfig.unsafe);
|
|
87364
87364
|
else return containerConfig;
|
|
87365
87365
|
}
|
|
87366
|
-
__name$
|
|
87366
|
+
__name$1(mergeIfUnsafe, "mergeIfUnsafe");
|
|
87367
87367
|
function formatError(err) {
|
|
87368
87368
|
try {
|
|
87369
87369
|
const maybeError = JSON.parse(err.body.error);
|
|
@@ -87376,8 +87376,8 @@ function formatError(err) {
|
|
|
87376
87376
|
} catch {}
|
|
87377
87377
|
return JSON.stringify(err.body);
|
|
87378
87378
|
}
|
|
87379
|
-
__name$
|
|
87380
|
-
var doAction = /* @__PURE__ */ __name$
|
|
87379
|
+
__name$1(formatError, "formatError");
|
|
87380
|
+
var doAction = /* @__PURE__ */ __name$1(async (action) => {
|
|
87381
87381
|
if (action.action === "create") {
|
|
87382
87382
|
let application;
|
|
87383
87383
|
try {
|
|
@@ -87453,8 +87453,8 @@ function cleanApplicationFromAPI(prev, currentConfig, accountId, observabilityWr
|
|
|
87453
87453
|
}
|
|
87454
87454
|
return cleanedPreviousApp;
|
|
87455
87455
|
}
|
|
87456
|
-
__name$
|
|
87457
|
-
var configRolloutStepsToAPI = /* @__PURE__ */ __name$
|
|
87456
|
+
__name$1(cleanApplicationFromAPI, "cleanApplicationFromAPI");
|
|
87457
|
+
var configRolloutStepsToAPI = /* @__PURE__ */ __name$1((rolloutSteps) => {
|
|
87458
87458
|
if (typeof rolloutSteps === "number") return { step_percentage: rolloutSteps };
|
|
87459
87459
|
else {
|
|
87460
87460
|
const output$1 = [];
|
|
@@ -87478,16 +87478,16 @@ function getNamedContainerImageTag(className, imageName, containerBuildId) {
|
|
|
87478
87478
|
const identityHash = createHash("sha256").update(identity).digest("hex").slice(0, IMAGE_ID_HASH_LENGTH);
|
|
87479
87479
|
return getDevContainerImageName(`${`${classSlug || "container"}-${imageSlug || "image"}`.slice(0, MAX_NAMED_IMAGE_SLUG_LENGTH - identityHash.length - 1).replace(/-+$/g, "")}-${identityHash}`, containerBuildId);
|
|
87480
87480
|
}
|
|
87481
|
-
__name$
|
|
87481
|
+
__name$1(getNamedContainerImageTag, "getNamedContainerImageTag");
|
|
87482
87482
|
function getDockerRepositorySlug(value) {
|
|
87483
87483
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
87484
87484
|
}
|
|
87485
|
-
__name$
|
|
87485
|
+
__name$1(getDockerRepositorySlug, "getDockerRepositorySlug");
|
|
87486
87486
|
function requireContainerBuildId(containerBuildId) {
|
|
87487
87487
|
if (containerBuildId === void 0) throw new Error("Build ID should be set when a Container image requires preparation");
|
|
87488
87488
|
return containerBuildId;
|
|
87489
87489
|
}
|
|
87490
|
-
__name$
|
|
87490
|
+
__name$1(requireContainerBuildId, "requireContainerBuildId");
|
|
87491
87491
|
function createContainerDevPlan(options) {
|
|
87492
87492
|
const { containers, exports: exports$1, containerBuildId, configPath } = options;
|
|
87493
87493
|
if (!containers?.length) return;
|
|
@@ -87551,13 +87551,13 @@ function createContainerDevPlan(options) {
|
|
|
87551
87551
|
containerRuntimeOptions
|
|
87552
87552
|
};
|
|
87553
87553
|
}
|
|
87554
|
-
__name$
|
|
87554
|
+
__name$1(createContainerDevPlan, "createContainerDevPlan");
|
|
87555
87555
|
function createContainerDevPlanForCfConfig(options) {
|
|
87556
87556
|
return createContainerPlanForCfConfig({
|
|
87557
87557
|
containers: options.containers,
|
|
87558
87558
|
exports: options.exports,
|
|
87559
87559
|
containerDescription: "Container",
|
|
87560
|
-
createImagePlan: /* @__PURE__ */ __name$
|
|
87560
|
+
createImagePlan: /* @__PURE__ */ __name$1(({ image, className, imageName }) => {
|
|
87561
87561
|
const buildId = requireContainerBuildId(options.containerBuildId);
|
|
87562
87562
|
const imageTag = imageName === void 0 ? getDevContainerImageName(className, buildId) : getNamedContainerImageTag(className, imageName, buildId);
|
|
87563
87563
|
const resolvedImage = resolveInputContainerImage({
|
|
@@ -87584,13 +87584,13 @@ function createContainerDevPlanForCfConfig(options) {
|
|
|
87584
87584
|
}, "createImagePlan")
|
|
87585
87585
|
});
|
|
87586
87586
|
}
|
|
87587
|
-
__name$
|
|
87587
|
+
__name$1(createContainerDevPlanForCfConfig, "createContainerDevPlanForCfConfig");
|
|
87588
87588
|
function createContainerPreviewPlanForCfConfig(options) {
|
|
87589
87589
|
return createContainerPlanForCfConfig({
|
|
87590
87590
|
containers: options.containers,
|
|
87591
87591
|
exports: options.exports,
|
|
87592
87592
|
containerDescription: "Build Output Container",
|
|
87593
|
-
createImagePlan: /* @__PURE__ */ __name$
|
|
87593
|
+
createImagePlan: /* @__PURE__ */ __name$1(({ image, className, imageName }) => {
|
|
87594
87594
|
const reference = "reference" in image ? image.reference : image.localReference;
|
|
87595
87595
|
if (!("reference" in image)) return { reference };
|
|
87596
87596
|
return {
|
|
@@ -87605,7 +87605,7 @@ function createContainerPreviewPlanForCfConfig(options) {
|
|
|
87605
87605
|
}, "createImagePlan")
|
|
87606
87606
|
});
|
|
87607
87607
|
}
|
|
87608
|
-
__name$
|
|
87608
|
+
__name$1(createContainerPreviewPlanForCfConfig, "createContainerPreviewPlanForCfConfig");
|
|
87609
87609
|
function createMiniflareExports(options) {
|
|
87610
87610
|
const workerExports = {};
|
|
87611
87611
|
for (const [name, workerExport] of Object.entries(options.exports ?? {})) if (workerExport.type === "durable-object" && "storage" in workerExport) {
|
|
@@ -87619,7 +87619,7 @@ function createMiniflareExports(options) {
|
|
|
87619
87619
|
} else workerExports[name] = workerExport;
|
|
87620
87620
|
return workerExports;
|
|
87621
87621
|
}
|
|
87622
|
-
__name$
|
|
87622
|
+
__name$1(createMiniflareExports, "createMiniflareExports");
|
|
87623
87623
|
function createContainerPlanForCfConfig(options) {
|
|
87624
87624
|
const containersByName = indexContainersByName(options.containers);
|
|
87625
87625
|
const containerOptions = [];
|
|
@@ -87655,7 +87655,7 @@ function createContainerPlanForCfConfig(options) {
|
|
|
87655
87655
|
containerRuntimeOptions
|
|
87656
87656
|
};
|
|
87657
87657
|
}
|
|
87658
|
-
__name$
|
|
87658
|
+
__name$1(createContainerPlanForCfConfig, "createContainerPlanForCfConfig");
|
|
87659
87659
|
function getContainerLinks(exports$1) {
|
|
87660
87660
|
const links = [];
|
|
87661
87661
|
for (const [className, workerExport] of Object.entries(exports$1 ?? {})) {
|
|
@@ -87664,7 +87664,7 @@ function getContainerLinks(exports$1) {
|
|
|
87664
87664
|
}
|
|
87665
87665
|
return links;
|
|
87666
87666
|
}
|
|
87667
|
-
__name$
|
|
87667
|
+
__name$1(getContainerLinks, "getContainerLinks");
|
|
87668
87668
|
function indexContainersByName(containers) {
|
|
87669
87669
|
const containersByName = /* @__PURE__ */ new Map();
|
|
87670
87670
|
for (const container of containers) {
|
|
@@ -87673,7 +87673,7 @@ function indexContainersByName(containers) {
|
|
|
87673
87673
|
}
|
|
87674
87674
|
return containersByName;
|
|
87675
87675
|
}
|
|
87676
|
-
__name$
|
|
87676
|
+
__name$1(indexContainersByName, "indexContainersByName");
|
|
87677
87677
|
__toESM(require_stream());
|
|
87678
87678
|
__toESM(require_extension());
|
|
87679
87679
|
__toESM(require_permessage_deflate());
|
|
@@ -87753,7 +87753,7 @@ async function sshCommand(sshArgs, userAgent) {
|
|
|
87753
87753
|
else ws.close();
|
|
87754
87754
|
}
|
|
87755
87755
|
}
|
|
87756
|
-
__name$
|
|
87756
|
+
__name$1(sshCommand, "sshCommand");
|
|
87757
87757
|
function verifySshInstalled(sshPath) {
|
|
87758
87758
|
return new Promise((resolve2, reject) => {
|
|
87759
87759
|
const child = spawn(sshPath, ["-V"]);
|
|
@@ -87773,7 +87773,7 @@ function verifySshInstalled(sshPath) {
|
|
|
87773
87773
|
});
|
|
87774
87774
|
});
|
|
87775
87775
|
}
|
|
87776
|
-
__name$
|
|
87776
|
+
__name$1(verifySshInstalled, "verifySshInstalled");
|
|
87777
87777
|
function tcpProxy(ws) {
|
|
87778
87778
|
let inbound;
|
|
87779
87779
|
const pending = [];
|
|
@@ -87788,7 +87788,7 @@ function tcpProxy(ws) {
|
|
|
87788
87788
|
ws.close();
|
|
87789
87789
|
proxy.close();
|
|
87790
87790
|
});
|
|
87791
|
-
const start = /* @__PURE__ */ __name$
|
|
87791
|
+
const start = /* @__PURE__ */ __name$1(() => socket.on("data", (data$1) => ws.send(data$1)), "start");
|
|
87792
87792
|
if (ws.readyState === import_websocket.default.OPEN) start();
|
|
87793
87793
|
else if (ws.readyState === import_websocket.default.CONNECTING) ws.once("open", start);
|
|
87794
87794
|
else socket.end();
|
|
@@ -87811,16 +87811,16 @@ function tcpProxy(ws) {
|
|
|
87811
87811
|
});
|
|
87812
87812
|
return proxy;
|
|
87813
87813
|
}
|
|
87814
|
-
__name$
|
|
87814
|
+
__name$1(tcpProxy, "tcpProxy");
|
|
87815
87815
|
function stdioProxy(ws) {
|
|
87816
87816
|
return new Promise((resolve2, reject) => {
|
|
87817
|
-
const onData = /* @__PURE__ */ __name$
|
|
87818
|
-
const onEnd = /* @__PURE__ */ __name$
|
|
87819
|
-
const onError$1 = /* @__PURE__ */ __name$
|
|
87817
|
+
const onData = /* @__PURE__ */ __name$1((data$1) => ws.send(data$1), "onData");
|
|
87818
|
+
const onEnd = /* @__PURE__ */ __name$1(() => ws.close(), "onEnd");
|
|
87819
|
+
const onError$1 = /* @__PURE__ */ __name$1((err) => {
|
|
87820
87820
|
ws.close();
|
|
87821
87821
|
reject(err);
|
|
87822
87822
|
}, "onError");
|
|
87823
|
-
const cleanup = /* @__PURE__ */ __name$
|
|
87823
|
+
const cleanup = /* @__PURE__ */ __name$1(() => {
|
|
87824
87824
|
process.stdin.pause();
|
|
87825
87825
|
process.stdin.off("data", onData);
|
|
87826
87826
|
process.stdin.off("end", onEnd);
|
|
@@ -87845,16 +87845,16 @@ function stdioProxy(ws) {
|
|
|
87845
87845
|
});
|
|
87846
87846
|
});
|
|
87847
87847
|
}
|
|
87848
|
-
__name$
|
|
87848
|
+
__name$1(stdioProxy, "stdioProxy");
|
|
87849
87849
|
function formatWebSocketData(data$1) {
|
|
87850
87850
|
if (Array.isArray(data$1)) return Buffer.concat(data$1);
|
|
87851
87851
|
return data$1 instanceof ArrayBuffer ? new Uint8Array(data$1) : data$1;
|
|
87852
87852
|
}
|
|
87853
|
-
__name$
|
|
87853
|
+
__name$1(formatWebSocketData, "formatWebSocketData");
|
|
87854
87854
|
function shouldUseStdio(sshArgs) {
|
|
87855
87855
|
return sshArgs.stdio === true || sshArgs.tty !== true && process.stdin.isTTY !== true && process.stdout.isTTY !== true;
|
|
87856
87856
|
}
|
|
87857
|
-
__name$
|
|
87857
|
+
__name$1(shouldUseStdio, "shouldUseStdio");
|
|
87858
87858
|
function buildContainerSshArgs(sshArgs) {
|
|
87859
87859
|
const flags = [
|
|
87860
87860
|
"-o",
|
|
@@ -87880,7 +87880,7 @@ function buildContainerSshArgs(sshArgs) {
|
|
|
87880
87880
|
if (sshArgs.tag !== void 0) flags.push("-P", sshArgs.tag);
|
|
87881
87881
|
return flags;
|
|
87882
87882
|
}
|
|
87883
|
-
__name$
|
|
87883
|
+
__name$1(buildContainerSshArgs, "buildContainerSshArgs");
|
|
87884
87884
|
var MAX_REPOSITORY_LENGTH = 255;
|
|
87885
87885
|
var REPOSITORY_COMPONENT_REGEXP = /^[a-z0-9]+(?:(?:[._]|__|-+)[a-z0-9]+)*$/;
|
|
87886
87886
|
var TAG_REGEXP = /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$/;
|
|
@@ -87900,7 +87900,7 @@ async function listContainerImages({ accountId, complianceConfig, filter }) {
|
|
|
87900
87900
|
}];
|
|
87901
87901
|
});
|
|
87902
87902
|
}
|
|
87903
|
-
__name$
|
|
87903
|
+
__name$1(listContainerImages, "listContainerImages");
|
|
87904
87904
|
function parseContainerImageTag(image) {
|
|
87905
87905
|
const parts = image.split(":");
|
|
87906
87906
|
const [repository, tag] = parts;
|
|
@@ -87910,7 +87910,7 @@ function parseContainerImageTag(image) {
|
|
|
87910
87910
|
tag
|
|
87911
87911
|
};
|
|
87912
87912
|
}
|
|
87913
|
-
__name$
|
|
87913
|
+
__name$1(parseContainerImageTag, "parseContainerImageTag");
|
|
87914
87914
|
async function deleteContainerImage({ accountId, complianceConfig, image }) {
|
|
87915
87915
|
const { repository, tag } = parseContainerImageTag(image);
|
|
87916
87916
|
const creds = await getCreds(["pull", "push"], complianceConfig);
|
|
@@ -87934,7 +87934,7 @@ async function deleteContainerImage({ accountId, complianceConfig, image }) {
|
|
|
87934
87934
|
}
|
|
87935
87935
|
return { digest };
|
|
87936
87936
|
}
|
|
87937
|
-
__name$
|
|
87937
|
+
__name$1(deleteContainerImage, "deleteContainerImage");
|
|
87938
87938
|
async function listReposWithTags(creds, complianceConfig) {
|
|
87939
87939
|
const url$2 = new URL(`https://${getCloudflareContainerRegistry(complianceConfig)}`);
|
|
87940
87940
|
const catalogUrl = `${url$2.protocol}//${url$2.host}/v2/_catalog?tags=true`;
|
|
@@ -87963,7 +87963,7 @@ async function listReposWithTags(creds, complianceConfig) {
|
|
|
87963
87963
|
}
|
|
87964
87964
|
return Object.fromEntries([...repositories].map(([repository, tags]) => [repository, [...tags]]));
|
|
87965
87965
|
}
|
|
87966
|
-
__name$
|
|
87966
|
+
__name$1(listReposWithTags, "listReposWithTags");
|
|
87967
87967
|
function nextCatalogCursor(header, baseUrl) {
|
|
87968
87968
|
if (!header) return;
|
|
87969
87969
|
const links = header.matchAll(/(?:^|,)\s*(?:<([^>]+)>|([^;,\s]+))((?:;[^,]*)?)/g);
|
|
@@ -87977,7 +87977,7 @@ function nextCatalogCursor(header, baseUrl) {
|
|
|
87977
87977
|
return cursor$1;
|
|
87978
87978
|
}
|
|
87979
87979
|
}
|
|
87980
|
-
__name$
|
|
87980
|
+
__name$1(nextCatalogCursor, "nextCatalogCursor");
|
|
87981
87981
|
async function deleteTag(baseUrl, accountId, image, tag, creds) {
|
|
87982
87982
|
const manifestAcceptHeader = "application/vnd.oci.image.manifest.v1+json, application/vnd.docker.distribution.manifest.v2+json";
|
|
87983
87983
|
const manifestUrl = `${baseUrl}/v2/${accountId}/${image}/manifests/${tag}`;
|
|
@@ -88002,7 +88002,7 @@ async function deleteTag(baseUrl, accountId, image, tag, creds) {
|
|
|
88002
88002
|
if (!deleteResponse.ok) throw new Error(`Failed to delete ${image}:${tag} (digest: ${digest}): ${deleteResponse.status} ${deleteResponse.statusText}`);
|
|
88003
88003
|
return digest;
|
|
88004
88004
|
}
|
|
88005
|
-
__name$
|
|
88005
|
+
__name$1(deleteTag, "deleteTag");
|
|
88006
88006
|
async function getCreds(permissions, complianceConfig) {
|
|
88007
88007
|
const credentials = await ImageRegistriesService.generateImageRegistryCredentials(getCloudflareContainerRegistry(complianceConfig), {
|
|
88008
88008
|
expiration_minutes: 5,
|
|
@@ -88010,11 +88010,11 @@ async function getCreds(permissions, complianceConfig) {
|
|
|
88010
88010
|
});
|
|
88011
88011
|
return Buffer.from(`v1:${credentials.password}`).toString("base64");
|
|
88012
88012
|
}
|
|
88013
|
-
__name$
|
|
88013
|
+
__name$1(getCreds, "getCreds");
|
|
88014
88014
|
function isValidImageTag(value) {
|
|
88015
88015
|
return IMAGE_TAG_REGEXP.test(value);
|
|
88016
88016
|
}
|
|
88017
|
-
__name$
|
|
88017
|
+
__name$1(isValidImageTag, "isValidImageTag");
|
|
88018
88018
|
|
|
88019
88019
|
//#endregion
|
|
88020
88020
|
//#region src/build.ts
|
|
@@ -88823,133 +88823,6 @@ async function prepareContainerImagesForVite(options) {
|
|
|
88823
88823
|
});
|
|
88824
88824
|
}
|
|
88825
88825
|
|
|
88826
|
-
//#endregion
|
|
88827
|
-
//#region ../workers-auth/dist/wrangler/index.mjs
|
|
88828
|
-
createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
|
|
88829
|
-
var DefaultScopes = {
|
|
88830
|
-
"k2.read": "See K2 stream configurations and bind existing streams to Workers.",
|
|
88831
|
-
"k2.write": "Create and manage K2 stream configurations.",
|
|
88832
|
-
"account:read": "See your account info such as account details, analytics, and memberships.",
|
|
88833
|
-
"user:read": "See your user info such as name, email address, and account memberships.",
|
|
88834
|
-
"workers:write": "See and change Cloudflare Workers data such as zones, KV storage, namespaces, scripts, and routes.",
|
|
88835
|
-
"workers_kv:write": "See and change Cloudflare Workers KV Storage data such as keys and namespaces.",
|
|
88836
|
-
"workers_routes:write": "See and change Cloudflare Workers data such as filters and routes.",
|
|
88837
|
-
"workers_scripts:write": "See and change Cloudflare Workers scripts, durable objects, subdomains, triggers, and tail data.",
|
|
88838
|
-
"workers_tail:read": "See Cloudflare Workers tail and script data.",
|
|
88839
|
-
"d1:write": "See and change D1 Databases.",
|
|
88840
|
-
"pages:write": "See and change Cloudflare Pages projects, settings and deployments.",
|
|
88841
|
-
"zone:read": "Grants read level access to account zone.",
|
|
88842
|
-
"ssl_certs:write": "See and manage mTLS certificates for your account",
|
|
88843
|
-
"ai:write": "See and change Workers AI catalog and assets",
|
|
88844
|
-
"ai-search:write": "See and change AI Search data",
|
|
88845
|
-
"ai-search:run": "Run search queries on your AI Search instances",
|
|
88846
|
-
"agent-memory:write": "See and change Agent Memory data such as keys and namespaces.",
|
|
88847
|
-
"queues:write": "See and change Cloudflare Queues settings and data",
|
|
88848
|
-
"pipelines:write": "See and change Cloudflare Pipelines configurations and data",
|
|
88849
|
-
"secrets_store:write": "See and change secrets + stores within the Secrets Store",
|
|
88850
|
-
"artifacts:write": "See and change Cloudflare Artifacts data such as registries and artifacts",
|
|
88851
|
-
"flagship:write": "See and change Flagship feature flags and apps",
|
|
88852
|
-
"containers:write": "Manage Workers Containers",
|
|
88853
|
-
"cloudchamber:write": "Manage Cloudchamber",
|
|
88854
|
-
"connectivity:admin": "See, change, and bind to Connectivity Directory services, including creating services targeting Cloudflare Tunnel.",
|
|
88855
|
-
"email_routing:write": "See and change Email Routing settings, rules, and destination addresses.",
|
|
88856
|
-
"email_sending:write": "See and change Email Sending settings and configuration.",
|
|
88857
|
-
"browser:write": "See and manage Browser Run sessions",
|
|
88858
|
-
"challenge-widgets.write": "See and change Turnstile widgets"
|
|
88859
|
-
};
|
|
88860
|
-
var DefaultScopeKeys = Object.keys(DefaultScopes);
|
|
88861
|
-
function setLoginScopeKeys(scopes) {
|
|
88862
|
-
DefaultScopeKeys = scopes;
|
|
88863
|
-
}
|
|
88864
|
-
__name$1(setLoginScopeKeys, "setLoginScopeKeys");
|
|
88865
|
-
function validateScopeKeys(scopes) {
|
|
88866
|
-
return scopes.every((scope) => scope in DefaultScopes);
|
|
88867
|
-
}
|
|
88868
|
-
__name$1(validateScopeKeys, "validateScopeKeys");
|
|
88869
|
-
var WRANGLER_KEYRING_SERVICE_NAME = "wrangler";
|
|
88870
|
-
var WRANGLER_CLI_NAME = "wrangler";
|
|
88871
|
-
var WRANGLER_DISPLAY_NAME = "Wrangler";
|
|
88872
|
-
var OAUTH_CALLBACK_URL = "http://localhost:8976/oauth/callback";
|
|
88873
|
-
var WRANGLER_CONSENT_PAGES = {
|
|
88874
|
-
granted: { url: "https://welcome.developers.workers.dev/wrangler-oauth-consent-granted" },
|
|
88875
|
-
denied: {
|
|
88876
|
-
url: "https://welcome.developers.workers.dev/wrangler-oauth-consent-denied",
|
|
88877
|
-
error: "Error: Consent denied. You must grant consent to Wrangler in order to login.\nIf you don't want to do this consider passing an API token via the `CLOUDFLARE_API_TOKEN` environment variable"
|
|
88878
|
-
}
|
|
88879
|
-
};
|
|
88880
|
-
var getClientIdFromEnv = getEnvironmentVariableFactory({
|
|
88881
|
-
variableName: "WRANGLER_CLIENT_ID",
|
|
88882
|
-
defaultValue: /* @__PURE__ */ __name$1(() => getCloudflareApiEnvironmentFromEnv() === "staging" ? "4b2ea6cc-9421-4761-874b-ce550e0e3def" : "54d11594-84e4-41aa-b438-e81b8fa78ee7", "defaultValue")
|
|
88883
|
-
});
|
|
88884
|
-
function getTemporaryAccountConfigFile() {
|
|
88885
|
-
const environment = getCloudflareApiEnvironmentFromEnv();
|
|
88886
|
-
return environment === "production" ? "wrangler-temporary-account.toml" : `wrangler-temporary-account.${environment}.toml`;
|
|
88887
|
-
}
|
|
88888
|
-
__name$1(getTemporaryAccountConfigFile, "getTemporaryAccountConfigFile");
|
|
88889
|
-
function getTemporaryPreviewAccountConfigPath() {
|
|
88890
|
-
return path__default.join(getGlobalConfigPath(), getTemporaryAccountConfigFile());
|
|
88891
|
-
}
|
|
88892
|
-
__name$1(getTemporaryPreviewAccountConfigPath, "getTemporaryPreviewAccountConfigPath");
|
|
88893
|
-
function createTomlFileStorage(getPath) {
|
|
88894
|
-
return createFileStorage("toml", getPath);
|
|
88895
|
-
}
|
|
88896
|
-
__name$1(createTomlFileStorage, "createTomlFileStorage");
|
|
88897
|
-
var { getAuthConfigFilePath, getEncryptedAuthConfigFilePath, defaultAuthConfigStorage, readAuthConfigFile, writeAuthConfigFile } = createAuthConfigFileHelpers({
|
|
88898
|
-
getConfigPath: getGlobalConfigPath,
|
|
88899
|
-
format: "toml"
|
|
88900
|
-
});
|
|
88901
|
-
var WRANGLER_CLI = {
|
|
88902
|
-
cliName: WRANGLER_CLI_NAME,
|
|
88903
|
-
displayName: WRANGLER_DISPLAY_NAME,
|
|
88904
|
-
temporaryAccountFlag: "--temporary",
|
|
88905
|
-
commands: {
|
|
88906
|
-
login: "wrangler login",
|
|
88907
|
-
logout: "wrangler logout",
|
|
88908
|
-
whoami: "wrangler whoami",
|
|
88909
|
-
createProfile: "wrangler auth create",
|
|
88910
|
-
deviceLogin: "wrangler login --device"
|
|
88911
|
-
},
|
|
88912
|
-
keyringServiceName: WRANGLER_KEYRING_SERVICE_NAME,
|
|
88913
|
-
clientId: getClientIdFromEnv,
|
|
88914
|
-
consent: WRANGLER_CONSENT_PAGES,
|
|
88915
|
-
redirectUri: OAUTH_CALLBACK_URL,
|
|
88916
|
-
allowGlobalAuthKey: true,
|
|
88917
|
-
getConfigPath: getGlobalConfigPath,
|
|
88918
|
-
getTemporaryAccountConfigPath: getTemporaryPreviewAccountConfigPath,
|
|
88919
|
-
fileFormat: "toml",
|
|
88920
|
-
persistAccountSelection: true,
|
|
88921
|
-
accountCachePrefix: "wrangler-account",
|
|
88922
|
-
getConfigFileLabel: /* @__PURE__ */ __name$1(() => configFileName(void 0), "getConfigFileLabel"),
|
|
88923
|
-
getDefaultScopeKeys: /* @__PURE__ */ __name$1(() => DefaultScopeKeys, "getDefaultScopeKeys")
|
|
88924
|
-
};
|
|
88925
|
-
var wranglerPreferences = createPreferences(getGlobalConfigPath);
|
|
88926
|
-
var { readUserPreferences, updateUserPreferences } = wranglerPreferences;
|
|
88927
|
-
function createWranglerAuth(ctx) {
|
|
88928
|
-
return createCloudflareAuth(WRANGLER_CLI, ctx);
|
|
88929
|
-
}
|
|
88930
|
-
__name$1(createWranglerAuth, "createWranglerAuth");
|
|
88931
|
-
function createWranglerProfileStore(ctx) {
|
|
88932
|
-
return createCloudflareProfileStore({
|
|
88933
|
-
logger: ctx.logger,
|
|
88934
|
-
getConfigPath: getGlobalConfigPath,
|
|
88935
|
-
keyringServiceName: WRANGLER_KEYRING_SERVICE_NAME,
|
|
88936
|
-
format: "toml"
|
|
88937
|
-
});
|
|
88938
|
-
}
|
|
88939
|
-
__name$1(createWranglerProfileStore, "createWranglerProfileStore");
|
|
88940
|
-
var wranglerKeyringPreference = createKeyringPreference({
|
|
88941
|
-
loginCommand: WRANGLER_CLI.commands.login,
|
|
88942
|
-
createProfileCommand: WRANGLER_CLI.commands.createProfile,
|
|
88943
|
-
keyringServiceName: WRANGLER_KEYRING_SERVICE_NAME,
|
|
88944
|
-
getConfigPath: getGlobalConfigPath,
|
|
88945
|
-
format: "toml",
|
|
88946
|
-
preferences: wranglerPreferences
|
|
88947
|
-
});
|
|
88948
|
-
function setKeyringPreference(enabled, ctx) {
|
|
88949
|
-
return wranglerKeyringPreference.setKeyringPreference(enabled, ctx);
|
|
88950
|
-
}
|
|
88951
|
-
__name$1(setKeyringPreference, "setKeyringPreference");
|
|
88952
|
-
|
|
88953
88826
|
//#endregion
|
|
88954
88827
|
//#region ../deploy-helpers/dist/chunk-U6NEESU5.mjs
|
|
88955
88828
|
const require$1 = createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
|
|
@@ -89644,56 +89517,6 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
|
|
|
89644
89517
|
//#endregion
|
|
89645
89518
|
//#region ../remote-bindings/dist/index.mjs
|
|
89646
89519
|
var import_undici = require_undici();
|
|
89647
|
-
var version$1 = "0.0.63";
|
|
89648
|
-
var NoDefaultValueProvided = class extends UserError {
|
|
89649
|
-
constructor() {
|
|
89650
|
-
super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
|
|
89651
|
-
}
|
|
89652
|
-
};
|
|
89653
|
-
function createRemoteBindingsAuth(logger$1$1) {
|
|
89654
|
-
const context = {
|
|
89655
|
-
logger: logger$1$1,
|
|
89656
|
-
userAgent: `remote-bindings/${version$1}`,
|
|
89657
|
-
async prompt(question) {
|
|
89658
|
-
if (isNonInteractiveOrCI()) throw new NoDefaultValueProvided();
|
|
89659
|
-
return inputPrompt({
|
|
89660
|
-
type: "text",
|
|
89661
|
-
question,
|
|
89662
|
-
label: "Answer",
|
|
89663
|
-
throwOnError: true
|
|
89664
|
-
});
|
|
89665
|
-
},
|
|
89666
|
-
async select(question, options) {
|
|
89667
|
-
if (isNonInteractiveOrCI()) throw new NoDefaultValueProvided();
|
|
89668
|
-
return inputPrompt({
|
|
89669
|
-
type: "select",
|
|
89670
|
-
question,
|
|
89671
|
-
label: "Account",
|
|
89672
|
-
options: options.choices.map((choice) => ({
|
|
89673
|
-
label: choice.title,
|
|
89674
|
-
value: choice.value
|
|
89675
|
-
})),
|
|
89676
|
-
throwOnError: true
|
|
89677
|
-
});
|
|
89678
|
-
},
|
|
89679
|
-
isNoDefaultValueProvidedError: (error$3) => error$3 instanceof NoDefaultValueProvided
|
|
89680
|
-
};
|
|
89681
|
-
const useCfAuth = "CLOUDFLARE_CF_AUTH" in process.env;
|
|
89682
|
-
return {
|
|
89683
|
-
auth: useCfAuth ? createCfAuth(context) : createWranglerAuth(context),
|
|
89684
|
-
useCfAuth
|
|
89685
|
-
};
|
|
89686
|
-
}
|
|
89687
|
-
function getRemoteBindingsAuthHook(auth, accountId, profileDir, logger$1$1) {
|
|
89688
|
-
if (auth) return auth;
|
|
89689
|
-
const { auth: remoteBindingsAuth, useCfAuth } = createRemoteBindingsAuth(logger$1$1);
|
|
89690
|
-
const profile = (useCfAuth ? createCfProfileStore({ logger: logger$1$1 }) : createWranglerProfileStore({ logger: logger$1$1 })).resolve({ cwd: profileDir ?? process.cwd() });
|
|
89691
|
-
remoteBindingsAuth.setProfile(profile);
|
|
89692
|
-
return async () => ({
|
|
89693
|
-
accountId: await remoteBindingsAuth.requireAuth(accountId ? { account_id: accountId } : {}),
|
|
89694
|
-
apiToken: remoteBindingsAuth.requireApiToken()
|
|
89695
|
-
});
|
|
89696
|
-
}
|
|
89697
89520
|
/**
|
|
89698
89521
|
* Warns before native-config development accesses deployed data by default.
|
|
89699
89522
|
* Explicit remote settings and sessions with remote bindings disabled are silent.
|
|
@@ -90129,6 +89952,7 @@ var ProxyControllerLogger = class extends Log {
|
|
|
90129
89952
|
super.log(message);
|
|
90130
89953
|
}
|
|
90131
89954
|
};
|
|
89955
|
+
var version$1 = "0.0.64";
|
|
90132
89956
|
const TRACE_VERSION = "trace-v1";
|
|
90133
89957
|
/**
|
|
90134
89958
|
* Maximum time (ms) to wait for an individual preview API request before
|
|
@@ -90261,6 +90085,21 @@ function isAbortError(err) {
|
|
|
90261
90085
|
const abortErrorCheck = err instanceof Error && err.name == "AbortError";
|
|
90262
90086
|
return legacyAbortErroCheck || abortErrorCheck;
|
|
90263
90087
|
}
|
|
90088
|
+
/** The commands each CLI accepts, named in actionable error messages. */
|
|
90089
|
+
const CLI_COMMANDS = {
|
|
90090
|
+
Wrangler: {
|
|
90091
|
+
whoami: "wrangler whoami",
|
|
90092
|
+
login: "wrangler login",
|
|
90093
|
+
logout: "wrangler logout",
|
|
90094
|
+
createFlagshipApp: "wrangler flagship apps create"
|
|
90095
|
+
},
|
|
90096
|
+
cf: {
|
|
90097
|
+
whoami: "cf auth whoami",
|
|
90098
|
+
login: "cf auth login",
|
|
90099
|
+
logout: "cf auth logout",
|
|
90100
|
+
createFlagshipApp: "cf flagship apps create"
|
|
90101
|
+
}
|
|
90102
|
+
};
|
|
90264
90103
|
/**
|
|
90265
90104
|
* Error thrown when a remote dev session fails due to an authentication
|
|
90266
90105
|
* problem. The error message is a user-friendly description with actionable
|
|
@@ -90275,36 +90114,41 @@ var RemoteSessionAuthenticationError = class extends UserError {
|
|
|
90275
90114
|
/**
|
|
90276
90115
|
* @param cause - The original error that triggered the authentication
|
|
90277
90116
|
* failure (e.g. an {@link APIError} with code 9106, 10000, or 10405).
|
|
90117
|
+
* @param cliDisplayName - The CLI whose commands the guidance names.
|
|
90278
90118
|
*/
|
|
90279
|
-
constructor(cause) {
|
|
90119
|
+
constructor(cause, cliDisplayName) {
|
|
90280
90120
|
const envAuth = getAuthFromEnv();
|
|
90121
|
+
const { whoami, login, logout } = CLI_COMMANDS[cliDisplayName];
|
|
90281
90122
|
let errorMessage = "This Worker uses bindings that need to run remotely, even when developing locally, but the remote session could not be authenticated.\n";
|
|
90282
90123
|
if (envAuth !== void 0) {
|
|
90283
90124
|
const method = "apiToken" in envAuth ? "a custom API token (`CLOUDFLARE_API_TOKEN`)" : "a Global API Key (`CLOUDFLARE_API_KEY`)";
|
|
90284
90125
|
errorMessage += `It looks like you are authenticating via ${method} set in an environment variable.\nThe token may be invalid or lack the required permissions for this operation.
|
|
90285
90126
|
|
|
90286
90127
|
To fix this, verify that your token is valid and has the correct permissions.
|
|
90287
|
-
You can also run
|
|
90288
|
-
} else errorMessage +=
|
|
90128
|
+
You can also run \`${whoami}\` to check your current authentication status.`;
|
|
90129
|
+
} else errorMessage += `Your credentials may have expired or been revoked.
|
|
90130
|
+
|
|
90131
|
+
To fix this, try to:
|
|
90132
|
+
- Run \`${whoami}\` to check your current authentication status.\n - Run \`${logout}\` and then \`${login}\` to re-authenticate.`;
|
|
90289
90133
|
super(errorMessage, {
|
|
90290
90134
|
cause,
|
|
90291
90135
|
telemetryMessage: "remote dev authentication error"
|
|
90292
90136
|
});
|
|
90293
90137
|
}
|
|
90294
90138
|
};
|
|
90295
|
-
function handlePreviewSessionUploadError(err, accountId) {
|
|
90139
|
+
function handlePreviewSessionUploadError(err, accountId, cliDisplayName) {
|
|
90296
90140
|
assert(err && typeof err === "object");
|
|
90297
90141
|
if (!isAbortError(err)) {
|
|
90298
90142
|
if ("code" in err && err.code === 10049) {
|
|
90299
90143
|
logger.log("Preview token expired, fetching a new one");
|
|
90300
90144
|
return true;
|
|
90301
|
-
} else if (!handleUserFriendlyError(err, accountId)) logger.error("Error on remote worker:", err);
|
|
90145
|
+
} else if (!handleUserFriendlyError(err, cliDisplayName, accountId)) logger.error("Error on remote worker:", err);
|
|
90302
90146
|
}
|
|
90303
90147
|
return false;
|
|
90304
90148
|
}
|
|
90305
|
-
function handlePreviewSessionCreationError(err, accountId) {
|
|
90149
|
+
function handlePreviewSessionCreationError(err, accountId, cliDisplayName) {
|
|
90306
90150
|
assert(err && typeof err === "object");
|
|
90307
|
-
if (handleUserFriendlyError(err, accountId)) return;
|
|
90151
|
+
if (handleUserFriendlyError(err, cliDisplayName, accountId)) return;
|
|
90308
90152
|
if ("cause" in err && err.cause?.code === "ENOTFOUND") logger.error(`Could not access \`${err.cause.hostname}\`. Make sure the domain is set up to be proxied by Cloudflare.\nFor more details, refer to https://developers.cloudflare.com/workers/configuration/routing/routes/#set-up-a-route`);
|
|
90309
90153
|
else if (err instanceof UserError) logger.error(err.message);
|
|
90310
90154
|
else if (!isAbortError(err)) logger.error("Error while creating remote dev session:", err);
|
|
@@ -90348,11 +90192,11 @@ function createRemoteWorkerInit(props) {
|
|
|
90348
90192
|
* messages, does not perform any logic other than logging errors.
|
|
90349
90193
|
* @returns if the error was handled or not
|
|
90350
90194
|
*/
|
|
90351
|
-
function handleUserFriendlyError(error$3, accountId) {
|
|
90195
|
+
function handleUserFriendlyError(error$3, cliDisplayName, accountId) {
|
|
90352
90196
|
if (error$3 instanceof APIError) switch (error$3.code) {
|
|
90353
90197
|
case 9106:
|
|
90354
90198
|
case 1e4:
|
|
90355
|
-
case 10405: throw new RemoteSessionAuthenticationError(error$3);
|
|
90199
|
+
case 10405: throw new RemoteSessionAuthenticationError(error$3, cliDisplayName);
|
|
90356
90200
|
case 10063: {
|
|
90357
90201
|
const onboardingLink = accountId ? `https://dash.cloudflare.com/${accountId}/workers/onboarding` : "https://dash.cloudflare.com/?to=/:account/workers/onboarding";
|
|
90358
90202
|
logger.error(`You need to register a workers.dev subdomain before running the dev command in remote mode. You can either enable local mode by pressing l, or register a workers.dev subdomain here: ${onboardingLink}`);
|
|
@@ -90386,7 +90230,7 @@ var RemoteRuntimeController = class {
|
|
|
90386
90230
|
return session;
|
|
90387
90231
|
} catch (err) {
|
|
90388
90232
|
if (err instanceof Error && err.name == "AbortError") return;
|
|
90389
|
-
handlePreviewSessionCreationError(err, props.accountId);
|
|
90233
|
+
handlePreviewSessionCreationError(err, props.accountId, props.cliDisplayName);
|
|
90390
90234
|
throw err;
|
|
90391
90235
|
}
|
|
90392
90236
|
}
|
|
@@ -90422,7 +90266,7 @@ var RemoteRuntimeController = class {
|
|
|
90422
90266
|
return workerPreviewToken;
|
|
90423
90267
|
} catch (err) {
|
|
90424
90268
|
if (err instanceof Error && err.name == "AbortError") return;
|
|
90425
|
-
if (handlePreviewSessionUploadError(err, props.accountId)) {
|
|
90269
|
+
if (handlePreviewSessionUploadError(err, props.accountId, props.cliDisplayName)) {
|
|
90426
90270
|
this.#session = await this.#previewSession(props);
|
|
90427
90271
|
return this.#previewToken(props);
|
|
90428
90272
|
}
|
|
@@ -90666,7 +90510,11 @@ function findRemoteSessionAuthError(error$3) {
|
|
|
90666
90510
|
if (error$3 instanceof Error) return findRemoteSessionAuthError(error$3.cause);
|
|
90667
90511
|
}
|
|
90668
90512
|
async function startRemoteProxySession(bindings, options) {
|
|
90669
|
-
for (const [name, binding] of Object.entries(bindings ?? {})) if (binding.type === "flagship" && binding.app_id === void 0)
|
|
90513
|
+
for (const [name, binding] of Object.entries(bindings ?? {})) if (binding.type === "flagship" && binding.app_id === void 0) {
|
|
90514
|
+
const setting = options.cliDisplayName === "cf" ? "id" : "app_id";
|
|
90515
|
+
const { createFlagshipApp } = CLI_COMMANDS[options.cliDisplayName];
|
|
90516
|
+
throw new UserError(`Flagship binding "${name}" has no \`${setting}\` and has not been created, but needs to run remotely. Run \`${createFlagshipApp}\` to create an app.`, { telemetryMessage: "flagship remote binding missing app_id" });
|
|
90517
|
+
}
|
|
90670
90518
|
if (process.versions.bun) throw new UserError("Remote bindings can't work under Bun, because Bun's `fetch()` ignores the undici `dispatcher` that Miniflare routes them through (https://github.com/oven-sh/bun/issues/39247). Run this using Node.js, or turn remote bindings off.", { telemetryMessage: "remote proxy session under bun" });
|
|
90671
90519
|
options.logger.log(source_default.dim("⎔ Establishing remote connection..."));
|
|
90672
90520
|
initLogger(getInternalLogger(options.logger));
|
|
@@ -90679,7 +90527,7 @@ async function startRemoteProxySession(bindings, options) {
|
|
|
90679
90527
|
compatibilityFlags: ["enhanced_error_serialization"],
|
|
90680
90528
|
complianceRegion: options.complianceRegion,
|
|
90681
90529
|
bindings: rawBindings,
|
|
90682
|
-
auth:
|
|
90530
|
+
auth: options.auth,
|
|
90683
90531
|
server: {
|
|
90684
90532
|
port: 0,
|
|
90685
90533
|
secure: false
|
|
@@ -90771,7 +90619,7 @@ function pickRemoteBindings(bindings) {
|
|
|
90771
90619
|
}
|
|
90772
90620
|
/** Potentially starts or updates a remote proxy session. */
|
|
90773
90621
|
async function maybeStartOrUpdateRemoteProxySession(workerConfigObject, preExistingRemoteProxySessionData, auth, context, startSession = startRemoteProxySession) {
|
|
90774
|
-
const { hook, key } =
|
|
90622
|
+
const { hook, key } = "hook" in auth ? auth : { hook: auth };
|
|
90775
90623
|
const bindings = workerConfigObject.target === "cf" ? getRemoteBindings({ env: workerConfigObject.env }) : workerConfigObject.bindings;
|
|
90776
90624
|
if (workerConfigObject.target === "cf") warnForDefaultRemoteBindings(bindings, true, (message) => context.logger.warn(message));
|
|
90777
90625
|
const remoteBindings = pickRemoteBindings(bindings);
|
|
@@ -90784,7 +90632,7 @@ async function maybeStartOrUpdateRemoteProxySession(workerConfigObject, preExist
|
|
|
90784
90632
|
workerName: workerConfigObject.name,
|
|
90785
90633
|
complianceRegion: workerConfigObject.complianceRegion,
|
|
90786
90634
|
cliDisplayName: context.cliDisplayName,
|
|
90787
|
-
auth:
|
|
90635
|
+
auth: hook,
|
|
90788
90636
|
logger: context.logger
|
|
90789
90637
|
});
|
|
90790
90638
|
} else if (!deepStrictEqual(remoteBindings, preExistingRemoteProxySessionData?.remoteBindings)) if (!remoteProxySession) {
|
|
@@ -90792,7 +90640,7 @@ async function maybeStartOrUpdateRemoteProxySession(workerConfigObject, preExist
|
|
|
90792
90640
|
workerName: workerConfigObject.name,
|
|
90793
90641
|
complianceRegion: workerConfigObject.complianceRegion,
|
|
90794
90642
|
cliDisplayName: context.cliDisplayName,
|
|
90795
|
-
auth:
|
|
90643
|
+
auth: hook,
|
|
90796
90644
|
logger: context.logger
|
|
90797
90645
|
});
|
|
90798
90646
|
} else await remoteProxySession.updateBindings(remoteBindings);
|
|
@@ -91070,9 +90918,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
|
|
|
91070
90918
|
name: worker.config.name,
|
|
91071
90919
|
target: "cf",
|
|
91072
90920
|
env: worker.config.env,
|
|
91073
|
-
complianceRegion: toApiComplianceRegion(settings.complianceRegion)
|
|
91074
|
-
account_id: settings.accountId,
|
|
91075
|
-
profileDir: resolvedViteConfig.root
|
|
90921
|
+
complianceRegion: toApiComplianceRegion(settings.complianceRegion)
|
|
91076
90922
|
}, preExistingRemoteProxySession ?? null, getRemoteBindingsAuth(resolvedViteConfig.root, settings.accountId, () => ctx.getCloudflareAuth(resolvedViteConfig.root, createLogger(viteDevServer.config.logger))), {
|
|
91077
90923
|
cliDisplayName: CLI_DISPLAY_NAME,
|
|
91078
90924
|
logger: createRemoteBindingsLogger(viteDevServer.config.logger)
|
|
@@ -91243,9 +91089,7 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
|
|
|
91243
91089
|
name: workerConfig.name,
|
|
91244
91090
|
target: "cf",
|
|
91245
91091
|
env: workerConfig.env,
|
|
91246
|
-
complianceRegion: toApiComplianceRegion(resolvedPluginConfig.settings.complianceRegion)
|
|
91247
|
-
account_id: resolvedPluginConfig.settings.accountId,
|
|
91248
|
-
profileDir: resolvedViteConfig.root
|
|
91092
|
+
complianceRegion: toApiComplianceRegion(resolvedPluginConfig.settings.complianceRegion)
|
|
91249
91093
|
}, preExistingRemoteProxySessionData ?? null, getRemoteBindingsAuth(resolvedViteConfig.root, resolvedPluginConfig.settings.accountId, () => ctx.getCloudflareAuth(resolvedViteConfig.root, createLogger(vitePreviewServer.config.logger))), {
|
|
91250
91094
|
cliDisplayName: CLI_DISPLAY_NAME,
|
|
91251
91095
|
logger: createRemoteBindingsLogger(vitePreviewServer.config.logger)
|