@cloudflare/vite-plugin 2.0.0-beta.v.14 → 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/cf-vite.mjs +0 -6
- package/dist/index.mjs +785 -913
- package/dist/{package-SsjAyYbP.mjs → package-B7yMc3uM.mjs} +1 -1
- package/dist/workers/asset-worker/index.js +21 -11
- package/package.json +11 -11
package/dist/index.mjs
CHANGED
|
@@ -52084,6 +52084,53 @@ function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
|
|
|
52084
52084
|
};
|
|
52085
52085
|
}
|
|
52086
52086
|
__name$3(getWranglerTmpDir, "getWranglerTmpDir");
|
|
52087
|
+
var MetricsRegistry = class {
|
|
52088
|
+
static {
|
|
52089
|
+
__name$3(this, "MetricsRegistry");
|
|
52090
|
+
}
|
|
52091
|
+
counters = [];
|
|
52092
|
+
/**
|
|
52093
|
+
* Create and register a new counter metric.
|
|
52094
|
+
*
|
|
52095
|
+
* @param name - The metric name (e.g. "service_request_total")
|
|
52096
|
+
* @param help - A human-readable description of the metric
|
|
52097
|
+
* @returns A Counter that can be incremented
|
|
52098
|
+
*/
|
|
52099
|
+
createCounter(name, help) {
|
|
52100
|
+
const entry = {
|
|
52101
|
+
name,
|
|
52102
|
+
help,
|
|
52103
|
+
value: 0
|
|
52104
|
+
};
|
|
52105
|
+
this.counters.push(entry);
|
|
52106
|
+
return {
|
|
52107
|
+
inc: /* @__PURE__ */ __name$3(() => {
|
|
52108
|
+
entry.value++;
|
|
52109
|
+
}, "inc"),
|
|
52110
|
+
add: /* @__PURE__ */ __name$3((amount) => {
|
|
52111
|
+
if (amount < 0) throw new Error("Counter value cannot decrease");
|
|
52112
|
+
entry.value += amount;
|
|
52113
|
+
}, "add")
|
|
52114
|
+
};
|
|
52115
|
+
}
|
|
52116
|
+
/**
|
|
52117
|
+
* Serialize all registered metrics in Prometheus text exposition format.
|
|
52118
|
+
*
|
|
52119
|
+
* @see https://prometheus.io/docs/instrumenting/exposition_formats/#text-based-format
|
|
52120
|
+
*/
|
|
52121
|
+
metrics() {
|
|
52122
|
+
return this.counters.map((c$1) => {
|
|
52123
|
+
let result = "";
|
|
52124
|
+
if (c$1.help.length > 0) result += `# HELP ${c$1.name} ${c$1.help}
|
|
52125
|
+
`;
|
|
52126
|
+
result += `# TYPE ${c$1.name} counter
|
|
52127
|
+
`;
|
|
52128
|
+
result += `${c$1.name} ${c$1.value}
|
|
52129
|
+
`;
|
|
52130
|
+
return result;
|
|
52131
|
+
}).join("");
|
|
52132
|
+
}
|
|
52133
|
+
};
|
|
52087
52134
|
function buildDetailedError(message, ...extra) {
|
|
52088
52135
|
return new ParseError({
|
|
52089
52136
|
text: message,
|
|
@@ -64303,7 +64350,7 @@ function isInteractive() {
|
|
|
64303
64350
|
//#region ../workers-auth/dist/chunk-VAZEJK55.mjs
|
|
64304
64351
|
createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
|
|
64305
64352
|
var __defProp$2 = Object.defineProperty;
|
|
64306
|
-
var __name$
|
|
64353
|
+
var __name$2 = (target$1, value) => __defProp$2(target$1, "name", {
|
|
64307
64354
|
value,
|
|
64308
64355
|
configurable: true
|
|
64309
64356
|
});
|
|
@@ -64336,7 +64383,7 @@ If you wish to authenticate via an API token then please set the \`CLOUDFLARE_AP
|
|
|
64336
64383
|
}
|
|
64337
64384
|
return {};
|
|
64338
64385
|
}
|
|
64339
|
-
__name$
|
|
64386
|
+
__name$2(readStoredAuthState, "readStoredAuthState");
|
|
64340
64387
|
var getCloudflareAPITokenFromEnv = getEnvironmentVariableFactory({
|
|
64341
64388
|
variableName: "CLOUDFLARE_API_TOKEN",
|
|
64342
64389
|
deprecatedName: "CF_API_TOKEN"
|
|
@@ -64361,7 +64408,7 @@ function getAuthFromEnv(options) {
|
|
|
64361
64408
|
const apiToken = getCloudflareAPITokenFromEnv();
|
|
64362
64409
|
if (apiToken) return { apiToken };
|
|
64363
64410
|
}
|
|
64364
|
-
__name$
|
|
64411
|
+
__name$2(getAuthFromEnv, "getAuthFromEnv");
|
|
64365
64412
|
function getAPIToken(options) {
|
|
64366
64413
|
const envAuth = getAuthFromEnv(options);
|
|
64367
64414
|
if (envAuth) return envAuth;
|
|
@@ -64372,35 +64419,35 @@ function getAPIToken(options) {
|
|
|
64372
64419
|
if (stored.deprecatedApiToken) return { apiToken: stored.deprecatedApiToken };
|
|
64373
64420
|
if (stored.accessToken?.value) return { apiToken: stored.accessToken.value };
|
|
64374
64421
|
}
|
|
64375
|
-
__name$
|
|
64422
|
+
__name$2(getAPIToken, "getAPIToken");
|
|
64376
64423
|
function requireApiToken(options) {
|
|
64377
64424
|
const credentials = getAPIToken(options);
|
|
64378
64425
|
if (!credentials) throw new UserError("No API token found.", { telemetryMessage: "user auth missing api token" });
|
|
64379
64426
|
return credentials;
|
|
64380
64427
|
}
|
|
64381
|
-
__name$
|
|
64428
|
+
__name$2(requireApiToken, "requireApiToken");
|
|
64382
64429
|
var ACCOUNT_ID_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
64383
64430
|
function validateAccountId(accountId, source) {
|
|
64384
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" });
|
|
64385
64432
|
return accountId;
|
|
64386
64433
|
}
|
|
64387
|
-
__name$
|
|
64434
|
+
__name$2(validateAccountId, "validateAccountId");
|
|
64388
64435
|
var getCloudflareAuthProfileFromEnv = getEnvironmentVariableFactory({ variableName: "CLOUDFLARE_AUTH_PROFILE" });
|
|
64389
64436
|
var getAuthDomainFromEnv = getEnvironmentVariableFactory({
|
|
64390
64437
|
variableName: "WRANGLER_AUTH_DOMAIN",
|
|
64391
|
-
defaultValue: /* @__PURE__ */ __name$
|
|
64438
|
+
defaultValue: /* @__PURE__ */ __name$2(() => getCloudflareApiEnvironmentFromEnv() === "staging" ? "dash.staging.cloudflare.com" : "dash.cloudflare.com", "defaultValue")
|
|
64392
64439
|
});
|
|
64393
64440
|
var getAuthUrlFromEnv = getEnvironmentVariableFactory({
|
|
64394
64441
|
variableName: "WRANGLER_AUTH_URL",
|
|
64395
|
-
defaultValue: /* @__PURE__ */ __name$
|
|
64442
|
+
defaultValue: /* @__PURE__ */ __name$2(() => `https://${getAuthDomainFromEnv()}/oauth2/auth`, "defaultValue")
|
|
64396
64443
|
});
|
|
64397
64444
|
var getTokenUrlFromEnv = getEnvironmentVariableFactory({
|
|
64398
64445
|
variableName: "WRANGLER_TOKEN_URL",
|
|
64399
|
-
defaultValue: /* @__PURE__ */ __name$
|
|
64446
|
+
defaultValue: /* @__PURE__ */ __name$2(() => `https://${getAuthDomainFromEnv()}/oauth2/token`, "defaultValue")
|
|
64400
64447
|
});
|
|
64401
64448
|
var getRevokeUrlFromEnv = getEnvironmentVariableFactory({
|
|
64402
64449
|
variableName: "WRANGLER_REVOKE_URL",
|
|
64403
|
-
defaultValue: /* @__PURE__ */ __name$
|
|
64450
|
+
defaultValue: /* @__PURE__ */ __name$2(() => `https://${getAuthDomainFromEnv()}/oauth2/revoke`, "defaultValue")
|
|
64404
64451
|
});
|
|
64405
64452
|
var readCloudflareAccountIdFromEnv = getEnvironmentVariableFactory({
|
|
64406
64453
|
variableName: "CLOUDFLARE_ACCOUNT_ID",
|
|
@@ -64411,12 +64458,12 @@ function getCloudflareAccountIdFromEnv() {
|
|
|
64411
64458
|
if (!accountId) return;
|
|
64412
64459
|
return validateAccountId(accountId, "set in the `CLOUDFLARE_ACCOUNT_ID` environment variable");
|
|
64413
64460
|
}
|
|
64414
|
-
__name$
|
|
64461
|
+
__name$2(getCloudflareAccountIdFromEnv, "getCloudflareAccountIdFromEnv");
|
|
64415
64462
|
var DEVICE_AUTH_PATH = "/oauth2/device/auth";
|
|
64416
64463
|
function getDeviceAuthUrl() {
|
|
64417
64464
|
return `https://${getAuthDomainFromEnv()}${DEVICE_AUTH_PATH}`;
|
|
64418
64465
|
}
|
|
64419
|
-
__name$
|
|
64466
|
+
__name$2(getDeviceAuthUrl, "getDeviceAuthUrl");
|
|
64420
64467
|
var getAccessClientIdFromEnv = getEnvironmentVariableFactory({ variableName: "CLOUDFLARE_ACCESS_CLIENT_ID" });
|
|
64421
64468
|
var getAccessClientSecretFromEnv = getEnvironmentVariableFactory({ variableName: "CLOUDFLARE_ACCESS_CLIENT_SECRET" });
|
|
64422
64469
|
var getCfAuthorizationTokenFromEnv = getEnvironmentVariableFactory({ variableName: "WRANGLER_CF_AUTHORIZATION_TOKEN" });
|
|
@@ -64428,12 +64475,12 @@ function buildProbeUrl(domain$1, previewToken) {
|
|
|
64428
64475
|
if (previewToken) url2.searchParams.set("cf_workers_preview_token", previewToken);
|
|
64429
64476
|
return url2.toString();
|
|
64430
64477
|
}
|
|
64431
|
-
__name$
|
|
64478
|
+
__name$2(buildProbeUrl, "buildProbeUrl");
|
|
64432
64479
|
function clearAccessCaches() {
|
|
64433
64480
|
for (const key of Object.keys(headersCache)) delete headersCache[key];
|
|
64434
64481
|
usesAccessCache.clear();
|
|
64435
64482
|
}
|
|
64436
|
-
__name$
|
|
64483
|
+
__name$2(clearAccessCaches, "clearAccessCaches");
|
|
64437
64484
|
async function domainUsesAccess(domain$1, logger$2, previewToken) {
|
|
64438
64485
|
logger$2.debug("Checking if domain has Access enabled:", domain$1);
|
|
64439
64486
|
const cacheKey = JSON.stringify([domain$1, Boolean(previewToken)]);
|
|
@@ -64463,7 +64510,7 @@ async function domainUsesAccess(domain$1, logger$2, previewToken) {
|
|
|
64463
64510
|
return false;
|
|
64464
64511
|
}
|
|
64465
64512
|
}
|
|
64466
|
-
__name$
|
|
64513
|
+
__name$2(domainUsesAccess, "domainUsesAccess");
|
|
64467
64514
|
async function getAccessHeaders(domain$1, options) {
|
|
64468
64515
|
const logger$2 = options.logger;
|
|
64469
64516
|
const clientId = getAccessClientIdFromEnv();
|
|
@@ -64499,7 +64546,7 @@ See https://developers.cloudflare.com/cloudflare-one/access-controls/service-cre
|
|
|
64499
64546
|
}
|
|
64500
64547
|
throw new Error("Failed to authenticate with Cloudflare Access");
|
|
64501
64548
|
}
|
|
64502
|
-
__name$
|
|
64549
|
+
__name$2(getAccessHeaders, "getAccessHeaders");
|
|
64503
64550
|
function spawnCloudflaredAccessLogin(loginTarget, signal) {
|
|
64504
64551
|
return new Promise((resolve$3, reject) => {
|
|
64505
64552
|
const child = spawn("cloudflared", [
|
|
@@ -64510,7 +64557,7 @@ function spawnCloudflaredAccessLogin(loginTarget, signal) {
|
|
|
64510
64557
|
const stdoutChunks = [];
|
|
64511
64558
|
child.stdout.on("data", (chunk) => stdoutChunks.push(chunk));
|
|
64512
64559
|
child.stderr.resume();
|
|
64513
|
-
const killChild = /* @__PURE__ */ __name$
|
|
64560
|
+
const killChild = /* @__PURE__ */ __name$2(() => child.kill(), "killChild");
|
|
64514
64561
|
process.once("exit", killChild);
|
|
64515
64562
|
child.on("error", (error$3) => {
|
|
64516
64563
|
process.removeListener("exit", killChild);
|
|
@@ -64533,7 +64580,7 @@ function spawnCloudflaredAccessLogin(loginTarget, signal) {
|
|
|
64533
64580
|
});
|
|
64534
64581
|
});
|
|
64535
64582
|
}
|
|
64536
|
-
__name$
|
|
64583
|
+
__name$2(spawnCloudflaredAccessLogin, "spawnCloudflaredAccessLogin");
|
|
64537
64584
|
async function getCloudflareAccessHeaders(options) {
|
|
64538
64585
|
const cfAuthToken = getCfAuthorizationTokenFromEnv();
|
|
64539
64586
|
if (cfAuthToken !== void 0) {
|
|
@@ -64542,7 +64589,7 @@ async function getCloudflareAccessHeaders(options) {
|
|
|
64542
64589
|
}
|
|
64543
64590
|
return getAccessHeaders(getAuthDomainFromEnv(), options);
|
|
64544
64591
|
}
|
|
64545
|
-
__name$
|
|
64592
|
+
__name$2(getCloudflareAccessHeaders, "getCloudflareAccessHeaders");
|
|
64546
64593
|
var RECOMMENDED_CODE_VERIFIER_LENGTH = 96;
|
|
64547
64594
|
var RECOMMENDED_STATE_LENGTH = 32;
|
|
64548
64595
|
var PKCE_CHARSET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
|
|
@@ -64553,7 +64600,7 @@ function base64urlEncode(value) {
|
|
|
64553
64600
|
base64$3 = base64$3.replace(/=/g, "");
|
|
64554
64601
|
return base64$3;
|
|
64555
64602
|
}
|
|
64556
|
-
__name$
|
|
64603
|
+
__name$2(base64urlEncode, "base64urlEncode");
|
|
64557
64604
|
async function generatePKCECodes() {
|
|
64558
64605
|
const output$1 = new Uint32Array(RECOMMENDED_CODE_VERIFIER_LENGTH);
|
|
64559
64606
|
webcrypto.getRandomValues(output$1);
|
|
@@ -64568,8 +64615,8 @@ async function generatePKCECodes() {
|
|
|
64568
64615
|
codeVerifier
|
|
64569
64616
|
};
|
|
64570
64617
|
}
|
|
64571
|
-
__name$
|
|
64572
|
-
var generateVerificationUrl = /* @__PURE__ */ __name$
|
|
64618
|
+
__name$2(generatePKCECodes, "generatePKCECodes");
|
|
64619
|
+
var generateVerificationUrl = /* @__PURE__ */ __name$2(({ verificationUri, userCode }) => {
|
|
64573
64620
|
const url2 = new URL(verificationUri);
|
|
64574
64621
|
url2.searchParams.set("user_code", userCode);
|
|
64575
64622
|
return url2.toString();
|
|
@@ -64581,15 +64628,15 @@ function parseUrl(value) {
|
|
|
64581
64628
|
return;
|
|
64582
64629
|
}
|
|
64583
64630
|
}
|
|
64584
|
-
__name$
|
|
64631
|
+
__name$2(parseUrl, "parseUrl");
|
|
64585
64632
|
function assertTrustedVerificationUrl(verificationUrl, options) {
|
|
64586
64633
|
const url2 = parseUrl(verificationUrl);
|
|
64587
64634
|
const expected = parseUrl(`https://${options.authDomain}`);
|
|
64588
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}
|
|
64589
64636
|
Expected an \`https\` URL on \`${options.authDomain}\`. Refusing to display or open it.`, { telemetryMessage: "user device-flow untrusted verification url" });
|
|
64590
64637
|
}
|
|
64591
|
-
__name$
|
|
64592
|
-
var generateAuthUrl = /* @__PURE__ */ __name$
|
|
64638
|
+
__name$2(assertTrustedVerificationUrl, "assertTrustedVerificationUrl");
|
|
64639
|
+
var generateAuthUrl = /* @__PURE__ */ __name$2(({ authUrl, clientId, scopes, stateQueryParam, codeChallenge, redirectUri }) => {
|
|
64593
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`;
|
|
64594
64641
|
}, "generateAuthUrl");
|
|
64595
64642
|
function generateRandomState(lengthOfState) {
|
|
@@ -64597,7 +64644,7 @@ function generateRandomState(lengthOfState) {
|
|
|
64597
64644
|
webcrypto.getRandomValues(output$1);
|
|
64598
64645
|
return Array.from(output$1).map((num) => PKCE_CHARSET[num % PKCE_CHARSET.length]).join("");
|
|
64599
64646
|
}
|
|
64600
|
-
__name$
|
|
64647
|
+
__name$2(generateRandomState, "generateRandomState");
|
|
64601
64648
|
var POW_MAX_ITERATIONS = 64e6;
|
|
64602
64649
|
function solvePow(seed, k, g) {
|
|
64603
64650
|
const checkpoints = new Array(k + 1);
|
|
@@ -64609,11 +64656,11 @@ function solvePow(seed, k, g) {
|
|
|
64609
64656
|
}
|
|
64610
64657
|
return checkpoints;
|
|
64611
64658
|
}
|
|
64612
|
-
__name$
|
|
64659
|
+
__name$2(solvePow, "solvePow");
|
|
64613
64660
|
function encodeCheckpoints(checkpoints) {
|
|
64614
64661
|
return Buffer.concat(checkpoints).toString("base64");
|
|
64615
64662
|
}
|
|
64616
|
-
__name$
|
|
64663
|
+
__name$2(encodeCheckpoints, "encodeCheckpoints");
|
|
64617
64664
|
function solveChallenge(challenge) {
|
|
64618
64665
|
const checkpoints = solvePow(Buffer.from(challenge.seed, "base64url"), challenge.k, challenge.g);
|
|
64619
64666
|
return {
|
|
@@ -64621,7 +64668,7 @@ function solveChallenge(challenge) {
|
|
|
64621
64668
|
solution: { checkpoints: encodeCheckpoints(checkpoints) }
|
|
64622
64669
|
};
|
|
64623
64670
|
}
|
|
64624
|
-
__name$
|
|
64671
|
+
__name$2(solveChallenge, "solveChallenge");
|
|
64625
64672
|
var DEFAULT_TEMPORARY_ACCOUNT_FLAG = "--temporary-account";
|
|
64626
64673
|
var TEMPORARY_TERMS_URLS = {
|
|
64627
64674
|
termsOfService: "https://www.cloudflare.com/terms/",
|
|
@@ -64668,7 +64715,7 @@ function getResponseErrorCode(body) {
|
|
|
64668
64715
|
if (typeof error$3 !== "object" || error$3 === null || !("code" in error$3)) return;
|
|
64669
64716
|
return typeof error$3.code === "number" ? error$3.code : void 0;
|
|
64670
64717
|
}
|
|
64671
|
-
__name$
|
|
64718
|
+
__name$2(getResponseErrorCode, "getResponseErrorCode");
|
|
64672
64719
|
async function getEventAccountError(response) {
|
|
64673
64720
|
let body;
|
|
64674
64721
|
try {
|
|
@@ -64684,27 +64731,27 @@ async function getEventAccountError(response) {
|
|
|
64684
64731
|
if (eventError.fatal) return new FatalError(eventError.message, options);
|
|
64685
64732
|
return new UserError(eventError.message, options);
|
|
64686
64733
|
}
|
|
64687
|
-
__name$
|
|
64734
|
+
__name$2(getEventAccountError, "getEventAccountError");
|
|
64688
64735
|
function getTemporaryPreviewUrl() {
|
|
64689
64736
|
return `${getCloudflareApiBaseUrl(COMPLIANCE_REGION_CONFIG_PUBLIC)}/provisioning/previews`;
|
|
64690
64737
|
}
|
|
64691
|
-
__name$
|
|
64738
|
+
__name$2(getTemporaryPreviewUrl, "getTemporaryPreviewUrl");
|
|
64692
64739
|
function getTemporaryPreviewChallengeUrl() {
|
|
64693
64740
|
return `${getTemporaryPreviewUrl()}/challenge`;
|
|
64694
64741
|
}
|
|
64695
|
-
__name$
|
|
64742
|
+
__name$2(getTemporaryPreviewChallengeUrl, "getTemporaryPreviewChallengeUrl");
|
|
64696
64743
|
function isFutureTimestamp(timestamp) {
|
|
64697
64744
|
const parsed = Date.parse(timestamp);
|
|
64698
64745
|
return !Number.isNaN(parsed) && parsed > Date.now();
|
|
64699
64746
|
}
|
|
64700
|
-
__name$
|
|
64747
|
+
__name$2(isFutureTimestamp, "isFutureTimestamp");
|
|
64701
64748
|
function getCachedTemporaryPreviewAccount(storage) {
|
|
64702
64749
|
const temporaryPreviewAccount = storage.read();
|
|
64703
64750
|
if (!temporaryPreviewAccount) return;
|
|
64704
64751
|
if (!temporaryPreviewAccount.account?.id || !temporaryPreviewAccount.account?.apiToken || !temporaryPreviewAccount.account?.name || !temporaryPreviewAccount.claim?.url || !isFutureTimestamp(temporaryPreviewAccount.account?.expiresAt ?? "") || !isFutureTimestamp(temporaryPreviewAccount.claim?.expiresAt ?? "")) return;
|
|
64705
64752
|
return temporaryPreviewAccount;
|
|
64706
64753
|
}
|
|
64707
|
-
__name$
|
|
64754
|
+
__name$2(getCachedTemporaryPreviewAccount, "getCachedTemporaryPreviewAccount");
|
|
64708
64755
|
async function requestPowSolution(temporaryAccountLogger, cliDisplayName) {
|
|
64709
64756
|
const headers = new import_undici$2.Headers({ "Content-Type": "application/json" });
|
|
64710
64757
|
addCustomApiHeaders(headers);
|
|
@@ -64731,7 +64778,7 @@ async function requestPowSolution(temporaryAccountLogger, cliDisplayName) {
|
|
|
64731
64778
|
g
|
|
64732
64779
|
});
|
|
64733
64780
|
}
|
|
64734
|
-
__name$
|
|
64781
|
+
__name$2(requestPowSolution, "requestPowSolution");
|
|
64735
64782
|
async function createTemporaryPreviewAccount(temporaryAccountLogger, request$2, cliDisplayName = "Wrangler") {
|
|
64736
64783
|
const pow = await requestPowSolution(temporaryAccountLogger, cliDisplayName);
|
|
64737
64784
|
const headers = new import_undici$2.Headers({ "Content-Type": "application/json" });
|
|
@@ -64784,7 +64831,7 @@ async function createTemporaryPreviewAccount(temporaryAccountLogger, request$2,
|
|
|
64784
64831
|
}
|
|
64785
64832
|
};
|
|
64786
64833
|
}
|
|
64787
|
-
__name$
|
|
64834
|
+
__name$2(createTemporaryPreviewAccount, "createTemporaryPreviewAccount");
|
|
64788
64835
|
async function getOrCreateTemporaryPreviewAccount(options) {
|
|
64789
64836
|
const cachedPreviewAccount = getCachedTemporaryPreviewAccount(options.storage);
|
|
64790
64837
|
if (cachedPreviewAccount) {
|
|
@@ -64802,7 +64849,7 @@ async function getOrCreateTemporaryPreviewAccount(options) {
|
|
|
64802
64849
|
cached: false
|
|
64803
64850
|
};
|
|
64804
64851
|
}
|
|
64805
|
-
__name$
|
|
64852
|
+
__name$2(getOrCreateTemporaryPreviewAccount, "getOrCreateTemporaryPreviewAccount");
|
|
64806
64853
|
function dedent(templ) {
|
|
64807
64854
|
var values = [];
|
|
64808
64855
|
for (var _i = 1; _i < arguments.length; _i++) values[_i - 1] = arguments[_i];
|
|
@@ -64835,11 +64882,11 @@ function dedent(templ) {
|
|
|
64835
64882
|
});
|
|
64836
64883
|
return string$2;
|
|
64837
64884
|
}
|
|
64838
|
-
__name$
|
|
64885
|
+
__name$2(dedent, "dedent");
|
|
64839
64886
|
var esm_default = dedent;
|
|
64840
64887
|
var ErrorOAuth2 = class extends UserError {
|
|
64841
64888
|
static {
|
|
64842
|
-
__name$
|
|
64889
|
+
__name$2(this, "ErrorOAuth2");
|
|
64843
64890
|
}
|
|
64844
64891
|
/** The OAuth `error` code returned by the provider (e.g. `invalid_scope`). */
|
|
64845
64892
|
code;
|
|
@@ -64853,7 +64900,7 @@ var ErrorOAuth2 = class extends UserError {
|
|
|
64853
64900
|
};
|
|
64854
64901
|
var ErrorUnknown = class extends ErrorOAuth2 {
|
|
64855
64902
|
static {
|
|
64856
|
-
__name$
|
|
64903
|
+
__name$2(this, "ErrorUnknown");
|
|
64857
64904
|
}
|
|
64858
64905
|
toString() {
|
|
64859
64906
|
return "ErrorUnknown";
|
|
@@ -64861,7 +64908,7 @@ var ErrorUnknown = class extends ErrorOAuth2 {
|
|
|
64861
64908
|
};
|
|
64862
64909
|
var ErrorAuthServerUnreachable = class extends ErrorOAuth2 {
|
|
64863
64910
|
static {
|
|
64864
|
-
__name$
|
|
64911
|
+
__name$2(this, "ErrorAuthServerUnreachable");
|
|
64865
64912
|
}
|
|
64866
64913
|
toString() {
|
|
64867
64914
|
return "ErrorAuthServerUnreachable";
|
|
@@ -64869,7 +64916,7 @@ var ErrorAuthServerUnreachable = class extends ErrorOAuth2 {
|
|
|
64869
64916
|
};
|
|
64870
64917
|
var ErrorNoAuthCode = class extends ErrorOAuth2 {
|
|
64871
64918
|
static {
|
|
64872
|
-
__name$
|
|
64919
|
+
__name$2(this, "ErrorNoAuthCode");
|
|
64873
64920
|
}
|
|
64874
64921
|
toString() {
|
|
64875
64922
|
return "ErrorNoAuthCode";
|
|
@@ -64877,7 +64924,7 @@ var ErrorNoAuthCode = class extends ErrorOAuth2 {
|
|
|
64877
64924
|
};
|
|
64878
64925
|
var ErrorInvalidReturnedStateParam = class extends ErrorOAuth2 {
|
|
64879
64926
|
static {
|
|
64880
|
-
__name$
|
|
64927
|
+
__name$2(this, "ErrorInvalidReturnedStateParam");
|
|
64881
64928
|
}
|
|
64882
64929
|
toString() {
|
|
64883
64930
|
return "ErrorInvalidReturnedStateParam";
|
|
@@ -64885,7 +64932,7 @@ var ErrorInvalidReturnedStateParam = class extends ErrorOAuth2 {
|
|
|
64885
64932
|
};
|
|
64886
64933
|
var ErrorInvalidJson = class extends ErrorOAuth2 {
|
|
64887
64934
|
static {
|
|
64888
|
-
__name$
|
|
64935
|
+
__name$2(this, "ErrorInvalidJson");
|
|
64889
64936
|
}
|
|
64890
64937
|
toString() {
|
|
64891
64938
|
return "ErrorInvalidJson";
|
|
@@ -64893,7 +64940,7 @@ var ErrorInvalidJson = class extends ErrorOAuth2 {
|
|
|
64893
64940
|
};
|
|
64894
64941
|
var ErrorInvalidScope = class extends ErrorOAuth2 {
|
|
64895
64942
|
static {
|
|
64896
|
-
__name$
|
|
64943
|
+
__name$2(this, "ErrorInvalidScope");
|
|
64897
64944
|
}
|
|
64898
64945
|
toString() {
|
|
64899
64946
|
return "ErrorInvalidScope";
|
|
@@ -64901,7 +64948,7 @@ var ErrorInvalidScope = class extends ErrorOAuth2 {
|
|
|
64901
64948
|
};
|
|
64902
64949
|
var ErrorInvalidRequest = class extends ErrorOAuth2 {
|
|
64903
64950
|
static {
|
|
64904
|
-
__name$
|
|
64951
|
+
__name$2(this, "ErrorInvalidRequest");
|
|
64905
64952
|
}
|
|
64906
64953
|
toString() {
|
|
64907
64954
|
return "ErrorInvalidRequest";
|
|
@@ -64909,7 +64956,7 @@ var ErrorInvalidRequest = class extends ErrorOAuth2 {
|
|
|
64909
64956
|
};
|
|
64910
64957
|
var ErrorInvalidToken = class extends ErrorOAuth2 {
|
|
64911
64958
|
static {
|
|
64912
|
-
__name$
|
|
64959
|
+
__name$2(this, "ErrorInvalidToken");
|
|
64913
64960
|
}
|
|
64914
64961
|
toString() {
|
|
64915
64962
|
return "ErrorInvalidToken";
|
|
@@ -64917,7 +64964,7 @@ var ErrorInvalidToken = class extends ErrorOAuth2 {
|
|
|
64917
64964
|
};
|
|
64918
64965
|
var ErrorAuthenticationGrant = class extends ErrorOAuth2 {
|
|
64919
64966
|
static {
|
|
64920
|
-
__name$
|
|
64967
|
+
__name$2(this, "ErrorAuthenticationGrant");
|
|
64921
64968
|
}
|
|
64922
64969
|
toString() {
|
|
64923
64970
|
return "ErrorAuthenticationGrant";
|
|
@@ -64925,7 +64972,7 @@ var ErrorAuthenticationGrant = class extends ErrorOAuth2 {
|
|
|
64925
64972
|
};
|
|
64926
64973
|
var ErrorUnauthorizedClient = class extends ErrorAuthenticationGrant {
|
|
64927
64974
|
static {
|
|
64928
|
-
__name$
|
|
64975
|
+
__name$2(this, "ErrorUnauthorizedClient");
|
|
64929
64976
|
}
|
|
64930
64977
|
toString() {
|
|
64931
64978
|
return "ErrorUnauthorizedClient";
|
|
@@ -64933,7 +64980,7 @@ var ErrorUnauthorizedClient = class extends ErrorAuthenticationGrant {
|
|
|
64933
64980
|
};
|
|
64934
64981
|
var ErrorAccessDenied = class extends ErrorAuthenticationGrant {
|
|
64935
64982
|
static {
|
|
64936
|
-
__name$
|
|
64983
|
+
__name$2(this, "ErrorAccessDenied");
|
|
64937
64984
|
}
|
|
64938
64985
|
toString() {
|
|
64939
64986
|
return "ErrorAccessDenied";
|
|
@@ -64941,7 +64988,7 @@ var ErrorAccessDenied = class extends ErrorAuthenticationGrant {
|
|
|
64941
64988
|
};
|
|
64942
64989
|
var ErrorUnsupportedResponseType = class extends ErrorAuthenticationGrant {
|
|
64943
64990
|
static {
|
|
64944
|
-
__name$
|
|
64991
|
+
__name$2(this, "ErrorUnsupportedResponseType");
|
|
64945
64992
|
}
|
|
64946
64993
|
toString() {
|
|
64947
64994
|
return "ErrorUnsupportedResponseType";
|
|
@@ -64949,7 +64996,7 @@ var ErrorUnsupportedResponseType = class extends ErrorAuthenticationGrant {
|
|
|
64949
64996
|
};
|
|
64950
64997
|
var ErrorServerError = class extends ErrorAuthenticationGrant {
|
|
64951
64998
|
static {
|
|
64952
|
-
__name$
|
|
64999
|
+
__name$2(this, "ErrorServerError");
|
|
64953
65000
|
}
|
|
64954
65001
|
toString() {
|
|
64955
65002
|
return "ErrorServerError";
|
|
@@ -64957,7 +65004,7 @@ var ErrorServerError = class extends ErrorAuthenticationGrant {
|
|
|
64957
65004
|
};
|
|
64958
65005
|
var ErrorTemporarilyUnavailable = class extends ErrorAuthenticationGrant {
|
|
64959
65006
|
static {
|
|
64960
|
-
__name$
|
|
65007
|
+
__name$2(this, "ErrorTemporarilyUnavailable");
|
|
64961
65008
|
}
|
|
64962
65009
|
toString() {
|
|
64963
65010
|
return "ErrorTemporarilyUnavailable";
|
|
@@ -64965,7 +65012,7 @@ var ErrorTemporarilyUnavailable = class extends ErrorAuthenticationGrant {
|
|
|
64965
65012
|
};
|
|
64966
65013
|
var ErrorAccessTokenResponse = class extends ErrorOAuth2 {
|
|
64967
65014
|
static {
|
|
64968
|
-
__name$
|
|
65015
|
+
__name$2(this, "ErrorAccessTokenResponse");
|
|
64969
65016
|
}
|
|
64970
65017
|
toString() {
|
|
64971
65018
|
return "ErrorAccessTokenResponse";
|
|
@@ -64973,7 +65020,7 @@ var ErrorAccessTokenResponse = class extends ErrorOAuth2 {
|
|
|
64973
65020
|
};
|
|
64974
65021
|
var ErrorInvalidClient = class extends ErrorAccessTokenResponse {
|
|
64975
65022
|
static {
|
|
64976
|
-
__name$
|
|
65023
|
+
__name$2(this, "ErrorInvalidClient");
|
|
64977
65024
|
}
|
|
64978
65025
|
toString() {
|
|
64979
65026
|
return "ErrorInvalidClient";
|
|
@@ -64981,7 +65028,7 @@ var ErrorInvalidClient = class extends ErrorAccessTokenResponse {
|
|
|
64981
65028
|
};
|
|
64982
65029
|
var ErrorInvalidGrant = class extends ErrorAccessTokenResponse {
|
|
64983
65030
|
static {
|
|
64984
|
-
__name$
|
|
65031
|
+
__name$2(this, "ErrorInvalidGrant");
|
|
64985
65032
|
}
|
|
64986
65033
|
toString() {
|
|
64987
65034
|
return "ErrorInvalidGrant";
|
|
@@ -64989,7 +65036,7 @@ var ErrorInvalidGrant = class extends ErrorAccessTokenResponse {
|
|
|
64989
65036
|
};
|
|
64990
65037
|
var ErrorUnsupportedGrantType = class extends ErrorAccessTokenResponse {
|
|
64991
65038
|
static {
|
|
64992
|
-
__name$
|
|
65039
|
+
__name$2(this, "ErrorUnsupportedGrantType");
|
|
64993
65040
|
}
|
|
64994
65041
|
toString() {
|
|
64995
65042
|
return "ErrorUnsupportedGrantType";
|
|
@@ -65003,11 +65050,11 @@ function formatOAuthErrorMessage(code, description, uri) {
|
|
|
65003
65050
|
See: ${escapeOAuthErrorText(uri)}`;
|
|
65004
65051
|
return message;
|
|
65005
65052
|
}
|
|
65006
|
-
__name$
|
|
65053
|
+
__name$2(formatOAuthErrorMessage, "formatOAuthErrorMessage");
|
|
65007
65054
|
function escapeOAuthErrorText(value) {
|
|
65008
65055
|
return value.replace(/[\u0000-\u001f\u007f-\u009f]/g, (character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
65009
65056
|
}
|
|
65010
|
-
__name$
|
|
65057
|
+
__name$2(escapeOAuthErrorText, "escapeOAuthErrorText");
|
|
65011
65058
|
function toErrorClass(rawError, description, uri) {
|
|
65012
65059
|
const message = formatOAuthErrorMessage(rawError, description, uri);
|
|
65013
65060
|
let error$3;
|
|
@@ -65057,7 +65104,7 @@ function toErrorClass(rawError, description, uri) {
|
|
|
65057
65104
|
error$3.uri = uri;
|
|
65058
65105
|
return error$3;
|
|
65059
65106
|
}
|
|
65060
|
-
__name$
|
|
65107
|
+
__name$2(toErrorClass, "toErrorClass");
|
|
65061
65108
|
var TOKEN_REQUEST_TIMEOUT_MS = 3e4;
|
|
65062
65109
|
function isReturningFromAuthServer(query, state, logger$2) {
|
|
65063
65110
|
const stateQueryParam = query.state;
|
|
@@ -65073,7 +65120,7 @@ function isReturningFromAuthServer(query, state, logger$2) {
|
|
|
65073
65120
|
state.hasAuthCodeBeenExchangedForAccessToken = false;
|
|
65074
65121
|
return true;
|
|
65075
65122
|
}
|
|
65076
|
-
__name$
|
|
65123
|
+
__name$2(isReturningFromAuthServer, "isReturningFromAuthServer");
|
|
65077
65124
|
async function getAuthURL(scopes, clientId, redirectUri, state, generators) {
|
|
65078
65125
|
const { codeChallenge, codeVerifier } = await generatePKCECodes();
|
|
65079
65126
|
const stateQueryParam = generators.generateRandomState(RECOMMENDED_STATE_LENGTH);
|
|
@@ -65091,7 +65138,7 @@ async function getAuthURL(scopes, clientId, redirectUri, state, generators) {
|
|
|
65091
65138
|
redirectUri
|
|
65092
65139
|
});
|
|
65093
65140
|
}
|
|
65094
|
-
__name$
|
|
65141
|
+
__name$2(getAuthURL, "getAuthURL");
|
|
65095
65142
|
async function exchangeRefreshTokenForAccessToken(logger$2, isNonInteractiveOrCI2, clientId, storage, cliDisplayName) {
|
|
65096
65143
|
const storedRefreshToken = readStoredAuthState({
|
|
65097
65144
|
warningLogger: logger$2,
|
|
@@ -65129,7 +65176,7 @@ async function exchangeRefreshTokenForAccessToken(logger$2, isNonInteractiveOrCI
|
|
|
65129
65176
|
else throw error$3;
|
|
65130
65177
|
}
|
|
65131
65178
|
}
|
|
65132
|
-
__name$
|
|
65179
|
+
__name$2(exchangeRefreshTokenForAccessToken, "exchangeRefreshTokenForAccessToken");
|
|
65133
65180
|
async function exchangeAuthCodeForAccessToken(state, logger$2, isNonInteractiveOrCI2, clientId, redirectUri, cliDisplayName) {
|
|
65134
65181
|
const { authorizationCode, codeVerifier = "" } = state;
|
|
65135
65182
|
if (!codeVerifier) logger$2.warn("No code verifier is being sent.");
|
|
@@ -65159,7 +65206,7 @@ async function exchangeAuthCodeForAccessToken(state, logger$2, isNonInteractiveO
|
|
|
65159
65206
|
refreshToken: refresh_token ? { value: refresh_token } : void 0
|
|
65160
65207
|
};
|
|
65161
65208
|
}
|
|
65162
|
-
__name$
|
|
65209
|
+
__name$2(exchangeAuthCodeForAccessToken, "exchangeAuthCodeForAccessToken");
|
|
65163
65210
|
async function fetchAuthToken(body, logger$2, isNonInteractiveOrCI2, cliDisplayName) {
|
|
65164
65211
|
const headers = { "Content-Type": "application/x-www-form-urlencoded" };
|
|
65165
65212
|
logger$2.debug("fetching auth token", `grant_type=${body.get("grant_type") ?? "<unknown>"}`);
|
|
@@ -65192,7 +65239,7 @@ async function fetchAuthToken(body, logger$2, isNonInteractiveOrCI2, cliDisplayN
|
|
|
65192
65239
|
});
|
|
65193
65240
|
}
|
|
65194
65241
|
}
|
|
65195
|
-
__name$
|
|
65242
|
+
__name$2(fetchAuthToken, "fetchAuthToken");
|
|
65196
65243
|
async function getJSONFromResponse(response, logger$2) {
|
|
65197
65244
|
const text = await response.text();
|
|
65198
65245
|
try {
|
|
@@ -65206,9 +65253,9 @@ async function getJSONFromResponse(response, logger$2) {
|
|
|
65206
65253
|
throw new Error(`Invalid JSON in response: status: ${response.status} ${response.statusText}`, { cause: e });
|
|
65207
65254
|
}
|
|
65208
65255
|
}
|
|
65209
|
-
__name$
|
|
65256
|
+
__name$2(getJSONFromResponse, "getJSONFromResponse");
|
|
65210
65257
|
function renderOauthErrorPage(cliDisplayName, detail) {
|
|
65211
|
-
const escape = /* @__PURE__ */ __name$
|
|
65258
|
+
const escape = /* @__PURE__ */ __name$2((value) => value.replace(/[&<>"']/g, (character) => ({
|
|
65212
65259
|
"&": "&",
|
|
65213
65260
|
"<": "<",
|
|
65214
65261
|
">": ">",
|
|
@@ -65241,7 +65288,7 @@ function renderOauthErrorPage(cliDisplayName, detail) {
|
|
|
65241
65288
|
</html>
|
|
65242
65289
|
`;
|
|
65243
65290
|
}
|
|
65244
|
-
__name$
|
|
65291
|
+
__name$2(renderOauthErrorPage, "renderOauthErrorPage");
|
|
65245
65292
|
async function getOauthToken(options, state, ctx, generators) {
|
|
65246
65293
|
const urlToOpen = await getAuthURL(options.scopes, options.clientId, options.redirectUri, state, generators);
|
|
65247
65294
|
const callbackPath = new URL(options.redirectUri).pathname;
|
|
@@ -65267,12 +65314,12 @@ async function getOauthToken(options, state, ctx, generators) {
|
|
|
65267
65314
|
}
|
|
65268
65315
|
});
|
|
65269
65316
|
}
|
|
65270
|
-
__name$
|
|
65317
|
+
__name$2(finish, "finish");
|
|
65271
65318
|
function renderErrorPage(detail) {
|
|
65272
65319
|
res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
|
|
65273
65320
|
res.end(renderOauthErrorPage(ctx.cliDisplayName, detail));
|
|
65274
65321
|
}
|
|
65275
|
-
__name$
|
|
65322
|
+
__name$2(renderErrorPage, "renderErrorPage");
|
|
65276
65323
|
assert(req.url, "This request doesn't have a URL");
|
|
65277
65324
|
const { pathname, query } = url.parse(req.url, true);
|
|
65278
65325
|
if (req.method !== "GET") return res.end("OK");
|
|
@@ -65346,7 +65393,7 @@ If you have changed the callback host or port because you are running in a conta
|
|
|
65346
65393
|
} else ctx.logger.log(`Visit this link to authenticate: ${urlToOpen}`);
|
|
65347
65394
|
return Promise.race([timerPromise, loginPromise]);
|
|
65348
65395
|
}
|
|
65349
|
-
__name$
|
|
65396
|
+
__name$2(getOauthToken, "getOauthToken");
|
|
65350
65397
|
var DEVICE_FLOW_MAX_DURATION_SECONDS = 300;
|
|
65351
65398
|
var DEVICE_FLOW_MIN_POLL_INTERVAL_SECONDS = 1;
|
|
65352
65399
|
function getStringMember(body, key) {
|
|
@@ -65354,23 +65401,23 @@ function getStringMember(body, key) {
|
|
|
65354
65401
|
const value = body[key];
|
|
65355
65402
|
return typeof value === "string" && value !== "" ? value : void 0;
|
|
65356
65403
|
}
|
|
65357
|
-
__name$
|
|
65404
|
+
__name$2(getStringMember, "getStringMember");
|
|
65358
65405
|
function getPositiveNumberMember(body, key) {
|
|
65359
65406
|
if (typeof body !== "object" || body === null) return;
|
|
65360
65407
|
const value = body[key];
|
|
65361
65408
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
|
|
65362
65409
|
}
|
|
65363
|
-
__name$
|
|
65410
|
+
__name$2(getPositiveNumberMember, "getPositiveNumberMember");
|
|
65364
65411
|
function describeUnusableResponse(response, body) {
|
|
65365
65412
|
const status$1 = `HTTP ${response.status} ${response.statusText}`.trim();
|
|
65366
65413
|
const description = getStringMember(body, "error_description");
|
|
65367
65414
|
return description ? `${status$1}: ${description}` : status$1;
|
|
65368
65415
|
}
|
|
65369
|
-
__name$
|
|
65416
|
+
__name$2(describeUnusableResponse, "describeUnusableResponse");
|
|
65370
65417
|
function isRetryableStatus(status$1) {
|
|
65371
65418
|
return status$1 >= 500 || status$1 === 429;
|
|
65372
65419
|
}
|
|
65373
|
-
__name$
|
|
65420
|
+
__name$2(isRetryableStatus, "isRetryableStatus");
|
|
65374
65421
|
function asDeviceAuthorizationResponse(body) {
|
|
65375
65422
|
const deviceCode = getStringMember(body, "device_code");
|
|
65376
65423
|
const userCode = getStringMember(body, "user_code");
|
|
@@ -65386,7 +65433,7 @@ function asDeviceAuthorizationResponse(body) {
|
|
|
65386
65433
|
interval: getPositiveNumberMember(body, "interval")
|
|
65387
65434
|
};
|
|
65388
65435
|
}
|
|
65389
|
-
__name$
|
|
65436
|
+
__name$2(asDeviceAuthorizationResponse, "asDeviceAuthorizationResponse");
|
|
65390
65437
|
async function readJson(response, logger$2) {
|
|
65391
65438
|
const text = await response.text();
|
|
65392
65439
|
try {
|
|
@@ -65400,7 +65447,7 @@ async function readJson(response, logger$2) {
|
|
|
65400
65447
|
throw new Error(`Invalid JSON in response: status: ${response.status} ${response.statusText}`, { cause: e });
|
|
65401
65448
|
}
|
|
65402
65449
|
}
|
|
65403
|
-
__name$
|
|
65450
|
+
__name$2(readJson, "readJson");
|
|
65404
65451
|
async function buildDeviceAuthHeaders(logger$2, isNonInteractiveOrCI2, cliDisplayName) {
|
|
65405
65452
|
const headers = { "Content-Type": "application/x-www-form-urlencoded" };
|
|
65406
65453
|
if (await domainUsesAccess(getAuthDomainFromEnv(), logger$2)) {
|
|
@@ -65413,7 +65460,7 @@ async function buildDeviceAuthHeaders(logger$2, isNonInteractiveOrCI2, cliDispla
|
|
|
65413
65460
|
}
|
|
65414
65461
|
return headers;
|
|
65415
65462
|
}
|
|
65416
|
-
__name$
|
|
65463
|
+
__name$2(buildDeviceAuthHeaders, "buildDeviceAuthHeaders");
|
|
65417
65464
|
async function requestDeviceAuthorization(scopes, clientId, logger$2, isNonInteractiveOrCI2, cliDisplayName) {
|
|
65418
65465
|
const params = new URLSearchParams({
|
|
65419
65466
|
client_id: clientId,
|
|
@@ -65440,7 +65487,7 @@ Enable debug logging to see the full response.`, { telemetryMessage: "user devic
|
|
|
65440
65487
|
}
|
|
65441
65488
|
return deviceAuth;
|
|
65442
65489
|
}
|
|
65443
|
-
__name$
|
|
65490
|
+
__name$2(requestDeviceAuthorization, "requestDeviceAuthorization");
|
|
65444
65491
|
async function pollDeviceToken(deviceCode, clientId, logger$2, isNonInteractiveOrCI2, cliDisplayName) {
|
|
65445
65492
|
const response = await fetchAuthToken(new URLSearchParams({
|
|
65446
65493
|
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
@@ -65473,11 +65520,11 @@ async function pollDeviceToken(deviceCode, clientId, logger$2, isNonInteractiveO
|
|
|
65473
65520
|
}
|
|
65474
65521
|
};
|
|
65475
65522
|
}
|
|
65476
|
-
__name$
|
|
65523
|
+
__name$2(pollDeviceToken, "pollDeviceToken");
|
|
65477
65524
|
function sleep(seconds) {
|
|
65478
65525
|
return new Promise((resolve$3) => setTimeout(resolve$3, seconds * 1e3));
|
|
65479
65526
|
}
|
|
65480
|
-
__name$
|
|
65527
|
+
__name$2(sleep, "sleep");
|
|
65481
65528
|
async function getOauthTokenViaDeviceFlow(options, ctx) {
|
|
65482
65529
|
const { logger: logger$2, openInBrowser: openInBrowser$1, isNonInteractiveOrCI: isNonInteractiveOrCI2 } = ctx;
|
|
65483
65530
|
const deviceAuth = await requestDeviceAuthorization(options.scopes, options.clientId, logger$2, isNonInteractiveOrCI2, ctx.cliDisplayName);
|
|
@@ -65558,7 +65605,7 @@ If you don't want to do this consider passing an API token via the \`CLOUDFLARE_
|
|
|
65558
65605
|
Enable debug logging to see the full response, then run \`${ctx.deviceLoginCommand}\` to try again.`, { telemetryMessage: "user device-flow poll failed" });
|
|
65559
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" });
|
|
65560
65607
|
}
|
|
65561
|
-
__name$
|
|
65608
|
+
__name$2(getOauthTokenViaDeviceFlow, "getOauthTokenViaDeviceFlow");
|
|
65562
65609
|
function toHumanPeriod(seconds) {
|
|
65563
65610
|
if (seconds < 60) return `${seconds} seconds`;
|
|
65564
65611
|
const minutes = Math.floor(seconds / 60);
|
|
@@ -65569,7 +65616,7 @@ function toHumanPeriod(seconds) {
|
|
|
65569
65616
|
if (remainingSeconds == 59) return `${minutes + 1} ${minutesPostfix}`;
|
|
65570
65617
|
return `${minutes} ${minutesPostfix} and ${remainingSeconds} ${secondsPostfix}`;
|
|
65571
65618
|
}
|
|
65572
|
-
__name$
|
|
65619
|
+
__name$2(toHumanPeriod, "toHumanPeriod");
|
|
65573
65620
|
function createOAuthFlow(ctx) {
|
|
65574
65621
|
const oauthFlowState = {};
|
|
65575
65622
|
const generators = {
|
|
@@ -65580,8 +65627,8 @@ function createOAuthFlow(ctx) {
|
|
|
65580
65627
|
function getStorage(profile) {
|
|
65581
65628
|
return ctx.storageFactory(profile ?? activeProfile);
|
|
65582
65629
|
}
|
|
65583
|
-
__name$
|
|
65584
|
-
const getClientId = /* @__PURE__ */ __name$
|
|
65630
|
+
__name$2(getStorage, "getStorage");
|
|
65631
|
+
const getClientId = /* @__PURE__ */ __name$2(() => typeof ctx.clientId === "function" ? ctx.clientId() : ctx.clientId, "getClientId");
|
|
65585
65632
|
const consent = ctx.consent;
|
|
65586
65633
|
let temporaryRequest;
|
|
65587
65634
|
let activeTemporaryAccount;
|
|
@@ -65630,7 +65677,7 @@ function createOAuthFlow(ctx) {
|
|
|
65630
65677
|
ctx.purgeOnLoginOrLogout?.();
|
|
65631
65678
|
return true;
|
|
65632
65679
|
}
|
|
65633
|
-
__name$
|
|
65680
|
+
__name$2(login, "login");
|
|
65634
65681
|
function isRefreshNeeded(profile) {
|
|
65635
65682
|
if (ctx.hasEnvCredentials()) return false;
|
|
65636
65683
|
const { accessToken } = readStoredAuthState({
|
|
@@ -65639,7 +65686,7 @@ function createOAuthFlow(ctx) {
|
|
|
65639
65686
|
});
|
|
65640
65687
|
return Boolean(accessToken && /* @__PURE__ */ new Date() >= new Date(accessToken.expiry));
|
|
65641
65688
|
}
|
|
65642
|
-
__name$
|
|
65689
|
+
__name$2(isRefreshNeeded, "isRefreshNeeded");
|
|
65643
65690
|
async function refreshToken(profile) {
|
|
65644
65691
|
const storage = getStorage(profile);
|
|
65645
65692
|
try {
|
|
@@ -65659,7 +65706,7 @@ function createOAuthFlow(ctx) {
|
|
|
65659
65706
|
return e instanceof ErrorAuthServerUnreachable || e instanceof Error && e.name === "TimeoutError" ? "unreachable" : "rejected";
|
|
65660
65707
|
}
|
|
65661
65708
|
}
|
|
65662
|
-
__name$
|
|
65709
|
+
__name$2(refreshToken, "refreshToken");
|
|
65663
65710
|
async function loginOrRefreshIfRequired(props) {
|
|
65664
65711
|
if (ctx.hasEnvCredentials()) return { loggedIn: true };
|
|
65665
65712
|
const stored = readStoredAuthState({
|
|
@@ -65694,7 +65741,7 @@ function createOAuthFlow(ctx) {
|
|
|
65694
65741
|
};
|
|
65695
65742
|
} else return { loggedIn: true };
|
|
65696
65743
|
}
|
|
65697
|
-
__name$
|
|
65744
|
+
__name$2(loginOrRefreshIfRequired, "loginOrRefreshIfRequired");
|
|
65698
65745
|
async function logout(profile) {
|
|
65699
65746
|
const clearedTemporary = clearTemporaryAccount();
|
|
65700
65747
|
if (ctx.hasEnvCredentials()) {
|
|
@@ -65719,7 +65766,7 @@ function createOAuthFlow(ctx) {
|
|
|
65719
65766
|
ctx.logger.log(`Successfully logged out.`);
|
|
65720
65767
|
ctx.purgeOnLoginOrLogout?.();
|
|
65721
65768
|
}
|
|
65722
|
-
__name$
|
|
65769
|
+
__name$2(logout, "logout");
|
|
65723
65770
|
async function getOAuthTokenFromLocalState() {
|
|
65724
65771
|
let stored = readStoredAuthState({
|
|
65725
65772
|
warningLogger: ctx.logger,
|
|
@@ -65735,7 +65782,7 @@ function createOAuthFlow(ctx) {
|
|
|
65735
65782
|
}
|
|
65736
65783
|
return stored.accessToken?.value;
|
|
65737
65784
|
}
|
|
65738
|
-
__name$
|
|
65785
|
+
__name$2(getOAuthTokenFromLocalState, "getOAuthTokenFromLocalState");
|
|
65739
65786
|
function getAPITokenInternal() {
|
|
65740
65787
|
if (activeTemporaryAccount) return { apiToken: activeTemporaryAccount.account.apiToken };
|
|
65741
65788
|
return getAPIToken({
|
|
@@ -65744,7 +65791,7 @@ function createOAuthFlow(ctx) {
|
|
|
65744
65791
|
allowGlobalAuthKey: ctx.allowGlobalAuthKey
|
|
65745
65792
|
});
|
|
65746
65793
|
}
|
|
65747
|
-
__name$
|
|
65794
|
+
__name$2(getAPITokenInternal, "getAPITokenInternal");
|
|
65748
65795
|
function requireApiTokenInternal() {
|
|
65749
65796
|
if (activeTemporaryAccount) return { apiToken: activeTemporaryAccount.account.apiToken };
|
|
65750
65797
|
return requireApiToken({
|
|
@@ -65753,20 +65800,20 @@ function createOAuthFlow(ctx) {
|
|
|
65753
65800
|
allowGlobalAuthKey: ctx.allowGlobalAuthKey
|
|
65754
65801
|
});
|
|
65755
65802
|
}
|
|
65756
|
-
__name$
|
|
65803
|
+
__name$2(requireApiTokenInternal, "requireApiTokenInternal");
|
|
65757
65804
|
function setTemporaryAllowed(allowed, request$2) {
|
|
65758
65805
|
temporaryRequest = allowed && ctx.temporary !== void 0 ? request$2 ?? {} : void 0;
|
|
65759
65806
|
activeTemporaryAccount = void 0;
|
|
65760
65807
|
}
|
|
65761
|
-
__name$
|
|
65808
|
+
__name$2(setTemporaryAllowed, "setTemporaryAllowed");
|
|
65762
65809
|
function isTemporaryAllowed() {
|
|
65763
65810
|
return temporaryRequest !== void 0;
|
|
65764
65811
|
}
|
|
65765
|
-
__name$
|
|
65812
|
+
__name$2(isTemporaryAllowed, "isTemporaryAllowed");
|
|
65766
65813
|
function getActiveTemporaryAccount() {
|
|
65767
65814
|
return activeTemporaryAccount;
|
|
65768
65815
|
}
|
|
65769
|
-
__name$
|
|
65816
|
+
__name$2(getActiveTemporaryAccount, "getActiveTemporaryAccount");
|
|
65770
65817
|
async function activateTemporaryAccount() {
|
|
65771
65818
|
if (!ctx.temporary) throw new UserError(`Temporary preview accounts are not supported by ${ctx.cliDisplayName}.`, { telemetryMessage: "user temporary account unsupported" });
|
|
65772
65819
|
const result = await getOrCreateTemporaryPreviewAccount({
|
|
@@ -65776,27 +65823,27 @@ function createOAuthFlow(ctx) {
|
|
|
65776
65823
|
activeTemporaryAccount = result.account;
|
|
65777
65824
|
return result;
|
|
65778
65825
|
}
|
|
65779
|
-
__name$
|
|
65826
|
+
__name$2(activateTemporaryAccount, "activateTemporaryAccount");
|
|
65780
65827
|
function clearTemporaryAccount() {
|
|
65781
65828
|
activeTemporaryAccount = void 0;
|
|
65782
65829
|
return ctx.temporary?.storage.clear() ?? false;
|
|
65783
65830
|
}
|
|
65784
|
-
__name$
|
|
65831
|
+
__name$2(clearTemporaryAccount, "clearTemporaryAccount");
|
|
65785
65832
|
function setProfile(profile) {
|
|
65786
65833
|
activeProfile = profile;
|
|
65787
65834
|
}
|
|
65788
|
-
__name$
|
|
65835
|
+
__name$2(setProfile, "setProfile");
|
|
65789
65836
|
function getActiveProfile() {
|
|
65790
65837
|
return activeProfile;
|
|
65791
65838
|
}
|
|
65792
|
-
__name$
|
|
65839
|
+
__name$2(getActiveProfile, "getActiveProfile");
|
|
65793
65840
|
function getScopes() {
|
|
65794
65841
|
return readStoredAuthState({
|
|
65795
65842
|
warningLogger: ctx.logger,
|
|
65796
65843
|
storage: getStorage()
|
|
65797
65844
|
}).scopes;
|
|
65798
65845
|
}
|
|
65799
|
-
__name$
|
|
65846
|
+
__name$2(getScopes, "getScopes");
|
|
65800
65847
|
return {
|
|
65801
65848
|
setProfile,
|
|
65802
65849
|
getActiveProfile,
|
|
@@ -65813,7 +65860,7 @@ function createOAuthFlow(ctx) {
|
|
|
65813
65860
|
activateTemporaryAccount
|
|
65814
65861
|
};
|
|
65815
65862
|
}
|
|
65816
|
-
__name$
|
|
65863
|
+
__name$2(createOAuthFlow, "createOAuthFlow");
|
|
65817
65864
|
var RESERVED_PROFILE_NAMES = ["default", "staging"];
|
|
65818
65865
|
function createProfileStore(args) {
|
|
65819
65866
|
const bindings = {
|
|
@@ -65896,16 +65943,16 @@ function createProfileStore(args) {
|
|
|
65896
65943
|
}
|
|
65897
65944
|
};
|
|
65898
65945
|
}
|
|
65899
|
-
__name$
|
|
65946
|
+
__name$2(createProfileStore, "createProfileStore");
|
|
65900
65947
|
function validateProfileName(name) {
|
|
65901
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" });
|
|
65902
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" });
|
|
65903
65950
|
}
|
|
65904
|
-
__name$
|
|
65951
|
+
__name$2(validateProfileName, "validateProfileName");
|
|
65905
65952
|
function formatDirectoryForUserError(dir$1) {
|
|
65906
65953
|
return path__default.relative(process.cwd(), dir$1) || ".";
|
|
65907
65954
|
}
|
|
65908
|
-
__name$
|
|
65955
|
+
__name$2(formatDirectoryForUserError, "formatDirectoryForUserError");
|
|
65909
65956
|
function getProfileForDirectoryFromBindings(startDir, bindings) {
|
|
65910
65957
|
const normalizedDir = path__default.resolve(startDir);
|
|
65911
65958
|
const sortedEntries = Object.entries(bindings).sort(([a], [b]) => b.length - a.length);
|
|
@@ -65920,7 +65967,7 @@ function getProfileForDirectoryFromBindings(startDir, bindings) {
|
|
|
65920
65967
|
};
|
|
65921
65968
|
}
|
|
65922
65969
|
}
|
|
65923
|
-
__name$
|
|
65970
|
+
__name$2(getProfileForDirectoryFromBindings, "getProfileForDirectoryFromBindings");
|
|
65924
65971
|
var BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
65925
65972
|
var HAS_WELLFORMED = !!"".isWellFormed;
|
|
65926
65973
|
function extendedTypeOf(obj) {
|
|
@@ -65939,26 +65986,26 @@ function extendedTypeOf(obj) {
|
|
|
65939
65986
|
}
|
|
65940
65987
|
return type;
|
|
65941
65988
|
}
|
|
65942
|
-
__name$
|
|
65989
|
+
__name$2(extendedTypeOf, "extendedTypeOf");
|
|
65943
65990
|
function isArrayOfTables(obj) {
|
|
65944
65991
|
for (let i$1 = 0; i$1 < obj.length; i$1++) if (extendedTypeOf(obj[i$1]) !== "object") return false;
|
|
65945
65992
|
return obj.length != 0;
|
|
65946
65993
|
}
|
|
65947
|
-
__name$
|
|
65994
|
+
__name$2(isArrayOfTables, "isArrayOfTables");
|
|
65948
65995
|
function formatWellFormedStringUnchecked(s) {
|
|
65949
65996
|
return JSON.stringify(s).replaceAll("", "\\u007f");
|
|
65950
65997
|
}
|
|
65951
|
-
__name$
|
|
65998
|
+
__name$2(formatWellFormedStringUnchecked, "formatWellFormedStringUnchecked");
|
|
65952
65999
|
function formatString(s) {
|
|
65953
66000
|
return formatWellFormedStringUnchecked(HAS_WELLFORMED ? s.toWellFormed() : s);
|
|
65954
66001
|
}
|
|
65955
|
-
__name$
|
|
66002
|
+
__name$2(formatString, "formatString");
|
|
65956
66003
|
function formatKey(s) {
|
|
65957
66004
|
if (BARE_KEY.test(s)) return s;
|
|
65958
66005
|
if (HAS_WELLFORMED && !s.isWellFormed()) throw new RangeError("key contains illegal lone surrogates");
|
|
65959
66006
|
return formatWellFormedStringUnchecked(s);
|
|
65960
66007
|
}
|
|
65961
|
-
__name$
|
|
66008
|
+
__name$2(formatKey, "formatKey");
|
|
65962
66009
|
function stringifyValue(val, type, depth, numberAsFloat, strictTemporal) {
|
|
65963
66010
|
if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
65964
66011
|
switch (type) {
|
|
@@ -65990,7 +66037,7 @@ function stringifyValue(val, type, depth, numberAsFloat, strictTemporal) {
|
|
|
65990
66037
|
case "temporal/x": throw new TypeError("Unsupported " + val[Symbol.toStringTag]);
|
|
65991
66038
|
}
|
|
65992
66039
|
}
|
|
65993
|
-
__name$
|
|
66040
|
+
__name$2(stringifyValue, "stringifyValue");
|
|
65994
66041
|
function stringifyInlineTable(obj, depth, numberAsFloat, strictTemporal) {
|
|
65995
66042
|
let keys = Object.keys(obj);
|
|
65996
66043
|
if (keys.length === 0) return "{}";
|
|
@@ -66002,7 +66049,7 @@ function stringifyInlineTable(obj, depth, numberAsFloat, strictTemporal) {
|
|
|
66002
66049
|
}
|
|
66003
66050
|
return res + " }";
|
|
66004
66051
|
}
|
|
66005
|
-
__name$
|
|
66052
|
+
__name$2(stringifyInlineTable, "stringifyInlineTable");
|
|
66006
66053
|
function stringifyArray(array$2, depth, numberAsFloat, strictTemporal) {
|
|
66007
66054
|
if (array$2.length === 0) return "[]";
|
|
66008
66055
|
let res = "[ ";
|
|
@@ -66013,7 +66060,7 @@ function stringifyArray(array$2, depth, numberAsFloat, strictTemporal) {
|
|
|
66013
66060
|
}
|
|
66014
66061
|
return res + " ]";
|
|
66015
66062
|
}
|
|
66016
|
-
__name$
|
|
66063
|
+
__name$2(stringifyArray, "stringifyArray");
|
|
66017
66064
|
function stringifyArrayTable(array$2, key, depth, numberAsFloat, strictTemporal) {
|
|
66018
66065
|
if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
66019
66066
|
let res = "";
|
|
@@ -66024,7 +66071,7 @@ function stringifyArrayTable(array$2, key, depth, numberAsFloat, strictTemporal)
|
|
|
66024
66071
|
}
|
|
66025
66072
|
return res;
|
|
66026
66073
|
}
|
|
66027
|
-
__name$
|
|
66074
|
+
__name$2(stringifyArrayTable, "stringifyArrayTable");
|
|
66028
66075
|
function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat, strictTemporal) {
|
|
66029
66076
|
if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
66030
66077
|
let preamble = "";
|
|
@@ -66053,32 +66100,32 @@ ${preamble}` : `[${tableKey}]`;
|
|
|
66053
66100
|
return preamble && tables ? `${preamble}
|
|
66054
66101
|
${tables}` : preamble || tables;
|
|
66055
66102
|
}
|
|
66056
|
-
__name$
|
|
66103
|
+
__name$2(stringifyTable, "stringifyTable");
|
|
66057
66104
|
function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false, strictTemporal = false } = {}) {
|
|
66058
66105
|
if (extendedTypeOf(obj) !== "object") throw new TypeError("stringify can only be called with an object");
|
|
66059
66106
|
let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat, strictTemporal);
|
|
66060
66107
|
if (str[str.length - 1] !== "\n") return str + "\n";
|
|
66061
66108
|
return str;
|
|
66062
66109
|
}
|
|
66063
|
-
__name$
|
|
66110
|
+
__name$2(stringify, "stringify");
|
|
66064
66111
|
var FILE_FORMATS = {
|
|
66065
66112
|
toml: {
|
|
66066
|
-
parse: /* @__PURE__ */ __name$
|
|
66067
|
-
stringify: /* @__PURE__ */ __name$
|
|
66113
|
+
parse: /* @__PURE__ */ __name$2((raw) => parseTOML(raw), "parse"),
|
|
66114
|
+
stringify: /* @__PURE__ */ __name$2((value) => stringify(value), "stringify")
|
|
66068
66115
|
},
|
|
66069
66116
|
json: {
|
|
66070
|
-
parse: /* @__PURE__ */ __name$
|
|
66071
|
-
stringify: /* @__PURE__ */ __name$
|
|
66117
|
+
parse: /* @__PURE__ */ __name$2((raw) => JSON.parse(raw), "parse"),
|
|
66118
|
+
stringify: /* @__PURE__ */ __name$2((value) => JSON.stringify(value, null, " "), "stringify")
|
|
66072
66119
|
}
|
|
66073
66120
|
};
|
|
66074
66121
|
function parseFile(format$3, raw) {
|
|
66075
66122
|
return FILE_FORMATS[format$3].parse(raw);
|
|
66076
66123
|
}
|
|
66077
|
-
__name$
|
|
66124
|
+
__name$2(parseFile, "parseFile");
|
|
66078
66125
|
function stringifyFile(format$3, value) {
|
|
66079
66126
|
return FILE_FORMATS[format$3].stringify(value);
|
|
66080
66127
|
}
|
|
66081
|
-
__name$
|
|
66128
|
+
__name$2(stringifyFile, "stringifyFile");
|
|
66082
66129
|
var USER_AUTH_CONFIG_PATH = "config";
|
|
66083
66130
|
function resolveAuthProfileBaseName(profile) {
|
|
66084
66131
|
if (profile === void 0 || profile === "default") {
|
|
@@ -66088,11 +66135,11 @@ function resolveAuthProfileBaseName(profile) {
|
|
|
66088
66135
|
validateProfileName(profile);
|
|
66089
66136
|
return profile;
|
|
66090
66137
|
}
|
|
66091
|
-
__name$
|
|
66092
|
-
function getAuthConfigFilePath$
|
|
66138
|
+
__name$2(resolveAuthProfileBaseName, "resolveAuthProfileBaseName");
|
|
66139
|
+
function getAuthConfigFilePath$1(configPath, profile, extension = "toml") {
|
|
66093
66140
|
return path__default.join(configPath, USER_AUTH_CONFIG_PATH, `${resolveAuthProfileBaseName(profile)}.${extension}`);
|
|
66094
66141
|
}
|
|
66095
|
-
__name$
|
|
66142
|
+
__name$2(getAuthConfigFilePath$1, "getAuthConfigFilePath");
|
|
66096
66143
|
var FileCredentialStore = class {
|
|
66097
66144
|
/**
|
|
66098
66145
|
* @param configPath consumer-provided global config directory (the CLI
|
|
@@ -66108,11 +66155,11 @@ var FileCredentialStore = class {
|
|
|
66108
66155
|
this.format = format$3;
|
|
66109
66156
|
}
|
|
66110
66157
|
static {
|
|
66111
|
-
__name$
|
|
66158
|
+
__name$2(this, "FileCredentialStore");
|
|
66112
66159
|
}
|
|
66113
66160
|
kind = "file";
|
|
66114
66161
|
filePath() {
|
|
66115
|
-
return getAuthConfigFilePath$
|
|
66162
|
+
return getAuthConfigFilePath$1(this.configPath, this.profile, this.format);
|
|
66116
66163
|
}
|
|
66117
66164
|
read() {
|
|
66118
66165
|
const filePath = this.filePath();
|
|
@@ -66149,7 +66196,7 @@ var CIPHER_NAME = "aes-256-gcm";
|
|
|
66149
66196
|
function generateKey() {
|
|
66150
66197
|
return new Uint8Array(randomBytes(KEY_LENGTH_BYTES));
|
|
66151
66198
|
}
|
|
66152
|
-
__name$
|
|
66199
|
+
__name$2(generateKey, "generateKey");
|
|
66153
66200
|
function encryptString(plaintext, key) {
|
|
66154
66201
|
if (key.length !== KEY_LENGTH_BYTES) throw new Error(`AES-256-GCM requires a ${KEY_LENGTH_BYTES}-byte key (got ${key.length} bytes).`);
|
|
66155
66202
|
const iv = randomBytes(IV_LENGTH_BYTES);
|
|
@@ -66164,7 +66211,7 @@ function encryptString(plaintext, key) {
|
|
|
66164
66211
|
ciphertext: ciphertext.toString("base64")
|
|
66165
66212
|
};
|
|
66166
66213
|
}
|
|
66167
|
-
__name$
|
|
66214
|
+
__name$2(encryptString, "encryptString");
|
|
66168
66215
|
function decryptString(envelope, key) {
|
|
66169
66216
|
if (key.length !== KEY_LENGTH_BYTES) throw new Error(`AES-256-GCM requires a ${KEY_LENGTH_BYTES}-byte key (got ${key.length} bytes).`);
|
|
66170
66217
|
if (envelope.v !== 1) throw new Error(`Unsupported encrypted envelope version: ${envelope.v}.`);
|
|
@@ -66177,18 +66224,18 @@ function decryptString(envelope, key) {
|
|
|
66177
66224
|
decipher.setAuthTag(tag);
|
|
66178
66225
|
return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString("utf-8");
|
|
66179
66226
|
}
|
|
66180
|
-
__name$
|
|
66227
|
+
__name$2(decryptString, "decryptString");
|
|
66181
66228
|
function parseEncryptedEnvelope(raw) {
|
|
66182
66229
|
if (typeof raw !== "object" || raw === null) return;
|
|
66183
66230
|
const candidate = raw;
|
|
66184
66231
|
if (candidate.v !== 1 || candidate.alg !== ALGORITHM_LABEL || typeof candidate.iv !== "string" || typeof candidate.tag !== "string" || typeof candidate.ciphertext !== "string") return;
|
|
66185
66232
|
return candidate;
|
|
66186
66233
|
}
|
|
66187
|
-
__name$
|
|
66188
|
-
function getEncryptedAuthConfigFilePath$
|
|
66234
|
+
__name$2(parseEncryptedEnvelope, "parseEncryptedEnvelope");
|
|
66235
|
+
function getEncryptedAuthConfigFilePath$1(configPath, profile) {
|
|
66189
66236
|
return path__default.join(configPath, "config", `${resolveAuthProfileBaseName(profile)}.enc`);
|
|
66190
66237
|
}
|
|
66191
|
-
__name$
|
|
66238
|
+
__name$2(getEncryptedAuthConfigFilePath$1, "getEncryptedAuthConfigFilePath");
|
|
66192
66239
|
var EncryptedFileCredentialStore = class {
|
|
66193
66240
|
/**
|
|
66194
66241
|
* @param configPath consumer-provided global config directory (the CLI
|
|
@@ -66209,14 +66256,14 @@ var EncryptedFileCredentialStore = class {
|
|
|
66209
66256
|
this.format = format$3;
|
|
66210
66257
|
}
|
|
66211
66258
|
static {
|
|
66212
|
-
__name$
|
|
66259
|
+
__name$2(this, "EncryptedFileCredentialStore");
|
|
66213
66260
|
}
|
|
66214
66261
|
kind = "encrypted-file";
|
|
66215
66262
|
plaintextPath() {
|
|
66216
|
-
return getAuthConfigFilePath$
|
|
66263
|
+
return getAuthConfigFilePath$1(this.configPath, this.profile, this.format);
|
|
66217
66264
|
}
|
|
66218
66265
|
read() {
|
|
66219
|
-
const encryptedPath = getEncryptedAuthConfigFilePath$
|
|
66266
|
+
const encryptedPath = getEncryptedAuthConfigFilePath$1(this.configPath, this.profile);
|
|
66220
66267
|
if (existsSync(encryptedPath)) return this.readEncryptedFile(encryptedPath);
|
|
66221
66268
|
const plaintextPath = this.plaintextPath();
|
|
66222
66269
|
if (existsSync(plaintextPath)) return this.migrateFromPlaintext(plaintextPath, encryptedPath);
|
|
@@ -66224,7 +66271,7 @@ var EncryptedFileCredentialStore = class {
|
|
|
66224
66271
|
write(config$3) {
|
|
66225
66272
|
const key = this.ensureKey();
|
|
66226
66273
|
const envelope = encryptString(stringifyFile(this.format, config$3), key);
|
|
66227
|
-
const encryptedPath = getEncryptedAuthConfigFilePath$
|
|
66274
|
+
const encryptedPath = getEncryptedAuthConfigFilePath$1(this.configPath, this.profile);
|
|
66228
66275
|
mkdirSync(path__default.dirname(encryptedPath), { recursive: true });
|
|
66229
66276
|
writeFileSync(encryptedPath, JSON.stringify(envelope, null, " "), {
|
|
66230
66277
|
encoding: "utf-8",
|
|
@@ -66235,7 +66282,7 @@ var EncryptedFileCredentialStore = class {
|
|
|
66235
66282
|
if (existsSync(plaintextPath)) rmSync(plaintextPath);
|
|
66236
66283
|
}
|
|
66237
66284
|
clear() {
|
|
66238
|
-
const encryptedPath = getEncryptedAuthConfigFilePath$
|
|
66285
|
+
const encryptedPath = getEncryptedAuthConfigFilePath$1(this.configPath, this.profile);
|
|
66239
66286
|
const plaintextPath = this.plaintextPath();
|
|
66240
66287
|
let existed = false;
|
|
66241
66288
|
if (existsSync(encryptedPath)) {
|
|
@@ -66252,10 +66299,10 @@ var EncryptedFileCredentialStore = class {
|
|
|
66252
66299
|
return existed;
|
|
66253
66300
|
}
|
|
66254
66301
|
path() {
|
|
66255
|
-
return getEncryptedAuthConfigFilePath$
|
|
66302
|
+
return getEncryptedAuthConfigFilePath$1(this.configPath, this.profile);
|
|
66256
66303
|
}
|
|
66257
66304
|
describe() {
|
|
66258
|
-
return `Encrypted file (${getEncryptedAuthConfigFilePath$
|
|
66305
|
+
return `Encrypted file (${getEncryptedAuthConfigFilePath$1(this.configPath, this.profile)}) with key in ${this.keyProvider.describe()}`;
|
|
66259
66306
|
}
|
|
66260
66307
|
readEncryptedFile(encryptedPath) {
|
|
66261
66308
|
const key = this.keyProvider.getKey();
|
|
@@ -66333,22 +66380,22 @@ function defaultNpmRunner(args) {
|
|
|
66333
66380
|
}
|
|
66334
66381
|
return spawnSync("npm", args, options);
|
|
66335
66382
|
}
|
|
66336
|
-
__name$
|
|
66383
|
+
__name$2(defaultNpmRunner, "defaultNpmRunner");
|
|
66337
66384
|
var npmRunner = defaultNpmRunner;
|
|
66338
66385
|
var cachedBindingPathByDir = /* @__PURE__ */ new Map();
|
|
66339
66386
|
function setNpmRunner(fn) {
|
|
66340
66387
|
npmRunner = fn ?? defaultNpmRunner;
|
|
66341
66388
|
cachedBindingPathByDir.clear();
|
|
66342
66389
|
}
|
|
66343
|
-
__name$
|
|
66390
|
+
__name$2(setNpmRunner, "setNpmRunner");
|
|
66344
66391
|
function getKeyringInstallDir(configPath) {
|
|
66345
66392
|
return path__default.join(configPath, "native", "keyring");
|
|
66346
66393
|
}
|
|
66347
|
-
__name$
|
|
66394
|
+
__name$2(getKeyringInstallDir, "getKeyringInstallDir");
|
|
66348
66395
|
function getInstalledBindingPath(installDir) {
|
|
66349
66396
|
return path__default.join(installDir, "node_modules", "@napi-rs", "keyring");
|
|
66350
66397
|
}
|
|
66351
|
-
__name$
|
|
66398
|
+
__name$2(getInstalledBindingPath, "getInstalledBindingPath");
|
|
66352
66399
|
function canLoadKeyringBinding(candidate) {
|
|
66353
66400
|
try {
|
|
66354
66401
|
createRequire(candidate)(candidate);
|
|
@@ -66357,7 +66404,7 @@ function canLoadKeyringBinding(candidate) {
|
|
|
66357
66404
|
return false;
|
|
66358
66405
|
}
|
|
66359
66406
|
}
|
|
66360
|
-
__name$
|
|
66407
|
+
__name$2(canLoadKeyringBinding, "canLoadKeyringBinding");
|
|
66361
66408
|
function findKeyringBinding(installDir) {
|
|
66362
66409
|
const cached$2 = cachedBindingPathByDir.get(installDir);
|
|
66363
66410
|
if (cached$2 !== void 0) return cached$2;
|
|
@@ -66379,7 +66426,7 @@ function findKeyringBinding(installDir) {
|
|
|
66379
66426
|
cachedBindingPathByDir.set(installDir, null);
|
|
66380
66427
|
return null;
|
|
66381
66428
|
}
|
|
66382
|
-
__name$
|
|
66429
|
+
__name$2(findKeyringBinding, "findKeyringBinding");
|
|
66383
66430
|
function installKeyringBindingSync(installDir) {
|
|
66384
66431
|
const dir$1 = installDir;
|
|
66385
66432
|
mkdirSync(dir$1, { recursive: true });
|
|
@@ -66420,12 +66467,12 @@ Its platform-specific binary ships as a separate optional package, so a download
|
|
|
66420
66467
|
Retry once the underlying issue is fixed, or install the binding globally:
|
|
66421
66468
|
npm install -g @napi-rs/keyring@${PINNED_KEYRING_VERSION}`, { telemetryMessage: "workers-auth keyring install incomplete" });
|
|
66422
66469
|
}
|
|
66423
|
-
__name$
|
|
66470
|
+
__name$2(installKeyringBindingSync, "installKeyringBindingSync");
|
|
66424
66471
|
var entryFactoryOverride;
|
|
66425
66472
|
function setKeyringEntryFactory(factory$1) {
|
|
66426
66473
|
entryFactoryOverride = factory$1;
|
|
66427
66474
|
}
|
|
66428
|
-
__name$
|
|
66475
|
+
__name$2(setKeyringEntryFactory, "setKeyringEntryFactory");
|
|
66429
66476
|
function resolveKeyringEntryFactory(installDir) {
|
|
66430
66477
|
if (entryFactoryOverride !== void 0) return entryFactoryOverride;
|
|
66431
66478
|
const bindingPath = findKeyringBinding(installDir);
|
|
@@ -66436,11 +66483,11 @@ Retry the command, or install the binding globally:
|
|
|
66436
66483
|
const mod$1 = createRequire(bindingPath)(bindingPath);
|
|
66437
66484
|
return (service, account) => new mod$1.Entry(service, account);
|
|
66438
66485
|
}
|
|
66439
|
-
__name$
|
|
66486
|
+
__name$2(resolveKeyringEntryFactory, "resolveKeyringEntryFactory");
|
|
66440
66487
|
function getKeyringAccountName(profile) {
|
|
66441
66488
|
return resolveAuthProfileBaseName(profile);
|
|
66442
66489
|
}
|
|
66443
|
-
__name$
|
|
66490
|
+
__name$2(getKeyringAccountName, "getKeyringAccountName");
|
|
66444
66491
|
function encodeKeyEnvelope(key) {
|
|
66445
66492
|
const envelope = {
|
|
66446
66493
|
v: 1,
|
|
@@ -66449,7 +66496,7 @@ function encodeKeyEnvelope(key) {
|
|
|
66449
66496
|
};
|
|
66450
66497
|
return JSON.stringify(envelope);
|
|
66451
66498
|
}
|
|
66452
|
-
__name$
|
|
66499
|
+
__name$2(encodeKeyEnvelope, "encodeKeyEnvelope");
|
|
66453
66500
|
function decodeKeyEnvelope(raw) {
|
|
66454
66501
|
if (raw === "") return;
|
|
66455
66502
|
let parsed;
|
|
@@ -66467,21 +66514,21 @@ function decodeKeyEnvelope(raw) {
|
|
|
66467
66514
|
return;
|
|
66468
66515
|
}
|
|
66469
66516
|
}
|
|
66470
|
-
__name$
|
|
66517
|
+
__name$2(decodeKeyEnvelope, "decodeKeyEnvelope");
|
|
66471
66518
|
function defaultRunner(args, options = {}) {
|
|
66472
66519
|
return spawnSync("secret-tool", args, {
|
|
66473
66520
|
encoding: "utf-8",
|
|
66474
66521
|
input: options.input
|
|
66475
66522
|
});
|
|
66476
66523
|
}
|
|
66477
|
-
__name$
|
|
66524
|
+
__name$2(defaultRunner, "defaultRunner");
|
|
66478
66525
|
var runner = defaultRunner;
|
|
66479
66526
|
var cachedProbeResult = void 0;
|
|
66480
66527
|
function setLinuxSecretToolRunner(fn) {
|
|
66481
66528
|
runner = fn ?? defaultRunner;
|
|
66482
66529
|
cachedProbeResult = void 0;
|
|
66483
66530
|
}
|
|
66484
|
-
__name$
|
|
66531
|
+
__name$2(setLinuxSecretToolRunner, "setLinuxSecretToolRunner");
|
|
66485
66532
|
function probeSecretTool() {
|
|
66486
66533
|
if (cachedProbeResult !== void 0) return cachedProbeResult;
|
|
66487
66534
|
let result;
|
|
@@ -66493,14 +66540,14 @@ function probeSecretTool() {
|
|
|
66493
66540
|
cachedProbeResult = result;
|
|
66494
66541
|
return result;
|
|
66495
66542
|
}
|
|
66496
|
-
__name$
|
|
66543
|
+
__name$2(probeSecretTool, "probeSecretTool");
|
|
66497
66544
|
var LinuxSecretToolKeyProvider = class {
|
|
66498
66545
|
constructor(serviceName, profile) {
|
|
66499
66546
|
this.serviceName = serviceName;
|
|
66500
66547
|
this.profile = profile;
|
|
66501
66548
|
}
|
|
66502
66549
|
static {
|
|
66503
|
-
__name$
|
|
66550
|
+
__name$2(this, "LinuxSecretToolKeyProvider");
|
|
66504
66551
|
}
|
|
66505
66552
|
getKey() {
|
|
66506
66553
|
const r$1 = runner([
|
|
@@ -66546,19 +66593,19 @@ function defaultRunner2(args, options = {}) {
|
|
|
66546
66593
|
input: options.input
|
|
66547
66594
|
});
|
|
66548
66595
|
}
|
|
66549
|
-
__name$
|
|
66596
|
+
__name$2(defaultRunner2, "defaultRunner");
|
|
66550
66597
|
var runner2 = defaultRunner2;
|
|
66551
66598
|
function setMacSecurityCommandRunner(fn) {
|
|
66552
66599
|
runner2 = fn ?? defaultRunner2;
|
|
66553
66600
|
}
|
|
66554
|
-
__name$
|
|
66601
|
+
__name$2(setMacSecurityCommandRunner, "setMacSecurityCommandRunner");
|
|
66555
66602
|
var MacSecurityKeyProvider = class {
|
|
66556
66603
|
constructor(serviceName, profile) {
|
|
66557
66604
|
this.serviceName = serviceName;
|
|
66558
66605
|
this.profile = profile;
|
|
66559
66606
|
}
|
|
66560
66607
|
static {
|
|
66561
|
-
__name$
|
|
66608
|
+
__name$2(this, "MacSecurityKeyProvider");
|
|
66562
66609
|
}
|
|
66563
66610
|
getKey() {
|
|
66564
66611
|
const r$1 = runner2([
|
|
@@ -66614,7 +66661,7 @@ var NapiKeyringKeyProvider = class {
|
|
|
66614
66661
|
this.profile = profile;
|
|
66615
66662
|
}
|
|
66616
66663
|
static {
|
|
66617
|
-
__name$
|
|
66664
|
+
__name$2(this, "NapiKeyringKeyProvider");
|
|
66618
66665
|
}
|
|
66619
66666
|
entry() {
|
|
66620
66667
|
return resolveKeyringEntryFactory(this.installDir)(this.serviceName, getKeyringAccountName(this.profile));
|
|
@@ -66640,7 +66687,7 @@ var testProviderFactory;
|
|
|
66640
66687
|
function setKeyProviderFactoryForTesting(factory$1) {
|
|
66641
66688
|
testProviderFactory = factory$1;
|
|
66642
66689
|
}
|
|
66643
|
-
__name$
|
|
66690
|
+
__name$2(setKeyProviderFactoryForTesting, "setKeyProviderFactoryForTesting");
|
|
66644
66691
|
function resolveKeyProvider(serviceName, profile, configPath) {
|
|
66645
66692
|
if (testProviderFactory !== void 0) return {
|
|
66646
66693
|
kind: "available",
|
|
@@ -66665,14 +66712,14 @@ function resolveKeyProvider(serviceName, profile, configPath) {
|
|
|
66665
66712
|
};
|
|
66666
66713
|
return {
|
|
66667
66714
|
kind: "needs-install",
|
|
66668
|
-
install: /* @__PURE__ */ __name$
|
|
66669
|
-
afterInstall: /* @__PURE__ */ __name$
|
|
66715
|
+
install: /* @__PURE__ */ __name$2(() => installKeyringBindingSync(installDir), "install"),
|
|
66716
|
+
afterInstall: /* @__PURE__ */ __name$2(() => new NapiKeyringKeyProvider(serviceName, installDir, profile), "afterInstall")
|
|
66670
66717
|
};
|
|
66671
66718
|
}
|
|
66672
66719
|
default: return { kind: "unsupported" };
|
|
66673
66720
|
}
|
|
66674
66721
|
}
|
|
66675
|
-
__name$
|
|
66722
|
+
__name$2(resolveKeyProvider, "resolveKeyProvider");
|
|
66676
66723
|
var sessionFlags = {
|
|
66677
66724
|
installFailedThisSession: false,
|
|
66678
66725
|
hasWarnedAboutKeyringFallback: false,
|
|
@@ -66681,13 +66728,13 @@ var sessionFlags = {
|
|
|
66681
66728
|
function getResolverSessionFlags() {
|
|
66682
66729
|
return sessionFlags;
|
|
66683
66730
|
}
|
|
66684
|
-
__name$
|
|
66731
|
+
__name$2(getResolverSessionFlags, "getResolverSessionFlags");
|
|
66685
66732
|
function resetCredentialStorageState() {
|
|
66686
66733
|
sessionFlags.installFailedThisSession = false;
|
|
66687
66734
|
sessionFlags.hasWarnedAboutKeyringFallback = false;
|
|
66688
66735
|
sessionFlags.hasWarnedAboutSecretToolMissing = false;
|
|
66689
66736
|
}
|
|
66690
|
-
__name$
|
|
66737
|
+
__name$2(resetCredentialStorageState, "resetCredentialStorageState");
|
|
66691
66738
|
function createCredentialStorageContext(context) {
|
|
66692
66739
|
const config$3 = {
|
|
66693
66740
|
...context,
|
|
@@ -66697,22 +66744,22 @@ function createCredentialStorageContext(context) {
|
|
|
66697
66744
|
function getActiveStore(profile) {
|
|
66698
66745
|
return resolveActiveCredentialStore(config$3, profile);
|
|
66699
66746
|
}
|
|
66700
|
-
__name$
|
|
66747
|
+
__name$2(getActiveStore, "getActiveStore");
|
|
66701
66748
|
function storageFactory(profile) {
|
|
66702
66749
|
return {
|
|
66703
|
-
read: /* @__PURE__ */ __name$
|
|
66704
|
-
write: /* @__PURE__ */ __name$
|
|
66705
|
-
clear: /* @__PURE__ */ __name$
|
|
66706
|
-
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")
|
|
66707
66754
|
};
|
|
66708
66755
|
}
|
|
66709
|
-
__name$
|
|
66756
|
+
__name$2(storageFactory, "storageFactory");
|
|
66710
66757
|
return {
|
|
66711
66758
|
storageFactory,
|
|
66712
66759
|
getActiveStore
|
|
66713
66760
|
};
|
|
66714
66761
|
}
|
|
66715
|
-
__name$
|
|
66762
|
+
__name$2(createCredentialStorageContext, "createCredentialStorageContext");
|
|
66716
66763
|
function resolveActiveCredentialStore(config$3, profile) {
|
|
66717
66764
|
const envOverride = getCloudflareAuthUseKeyringFromEnv();
|
|
66718
66765
|
const configPath = config$3.getConfigPath();
|
|
@@ -66726,13 +66773,13 @@ function resolveActiveCredentialStore(config$3, profile) {
|
|
|
66726
66773
|
case "unsupported": return handleUnsupported(forcedByEnvVar, config$3, profile);
|
|
66727
66774
|
}
|
|
66728
66775
|
}
|
|
66729
|
-
__name$
|
|
66776
|
+
__name$2(resolveActiveCredentialStore, "resolveActiveCredentialStore");
|
|
66730
66777
|
function buildMigrationLogger(config$3) {
|
|
66731
66778
|
return (result) => {
|
|
66732
66779
|
config$3.logger.warn(`Migrated credentials from ${result.plaintextPath} into ${result.encryptedPath} (key in ${result.keyProviderDescription}). The plaintext file has been deleted.`);
|
|
66733
66780
|
};
|
|
66734
66781
|
}
|
|
66735
|
-
__name$
|
|
66782
|
+
__name$2(buildMigrationLogger, "buildMigrationLogger");
|
|
66736
66783
|
function handleNeedsInstall(resolution, forcedByEnvVar, config$3, profile) {
|
|
66737
66784
|
const flags = getResolverSessionFlags();
|
|
66738
66785
|
if (flags.installFailedThisSession) {
|
|
@@ -66750,7 +66797,7 @@ function handleNeedsInstall(resolution, forcedByEnvVar, config$3, profile) {
|
|
|
66750
66797
|
}
|
|
66751
66798
|
return new EncryptedFileCredentialStore(config$3.getConfigPath(), resolution.afterInstall(), buildMigrationLogger(config$3), profile, config$3.format);
|
|
66752
66799
|
}
|
|
66753
|
-
__name$
|
|
66800
|
+
__name$2(handleNeedsInstall, "handleNeedsInstall");
|
|
66754
66801
|
function handleUnsupported(forcedByEnvVar, config$3, profile) {
|
|
66755
66802
|
const platform$1 = process.platform;
|
|
66756
66803
|
const linuxMissingTool = platform$1 === "linux";
|
|
@@ -66769,7 +66816,7 @@ Falling back to the plaintext credentials file for this session.`);
|
|
|
66769
66816
|
}
|
|
66770
66817
|
return fallbackToFileWithWarning(message, config$3, profile);
|
|
66771
66818
|
}
|
|
66772
|
-
__name$
|
|
66819
|
+
__name$2(handleUnsupported, "handleUnsupported");
|
|
66773
66820
|
function fallbackToFileWithWarning(message, config$3, profile) {
|
|
66774
66821
|
const flags = getResolverSessionFlags();
|
|
66775
66822
|
if (!flags.hasWarnedAboutKeyringFallback) {
|
|
@@ -66778,7 +66825,7 @@ function fallbackToFileWithWarning(message, config$3, profile) {
|
|
|
66778
66825
|
}
|
|
66779
66826
|
return new FileCredentialStore(config$3.getConfigPath(), profile, config$3.format);
|
|
66780
66827
|
}
|
|
66781
|
-
__name$
|
|
66828
|
+
__name$2(fallbackToFileWithWarning, "fallbackToFileWithWarning");
|
|
66782
66829
|
function secretToolMissingMessage(loginCommand) {
|
|
66783
66830
|
return `\`secret-tool\` is required for OS keyring storage on Linux but is not installed.
|
|
66784
66831
|
|
|
@@ -66790,7 +66837,7 @@ Install it via your package manager:
|
|
|
66790
66837
|
|
|
66791
66838
|
Or disable keyring storage: \`${loginCommand} --no-use-keyring\`.`;
|
|
66792
66839
|
}
|
|
66793
|
-
__name$
|
|
66840
|
+
__name$2(secretToolMissingMessage, "secretToolMissingMessage");
|
|
66794
66841
|
function windowsBindingMissingMessage(loginCommand) {
|
|
66795
66842
|
return `\`@napi-rs/keyring\` is required for OS keyring storage on Windows but is not installed.
|
|
66796
66843
|
|
|
@@ -66800,9 +66847,9 @@ Run \`${loginCommand} --use-keyring\` interactively to install it automatically,
|
|
|
66800
66847
|
|
|
66801
66848
|
Or disable keyring storage: \`${loginCommand} --no-use-keyring\`.`;
|
|
66802
66849
|
}
|
|
66803
|
-
__name$
|
|
66850
|
+
__name$2(windowsBindingMissingMessage, "windowsBindingMissingMessage");
|
|
66804
66851
|
function scrubEncryptedCredentials(options) {
|
|
66805
|
-
const encryptedPath = getEncryptedAuthConfigFilePath$
|
|
66852
|
+
const encryptedPath = getEncryptedAuthConfigFilePath$1(options.configPath, options.profile);
|
|
66806
66853
|
const encryptedFileExisted = existsSync(encryptedPath);
|
|
66807
66854
|
const resolution = resolveKeyProvider(options.serviceName, options.profile, options.configPath);
|
|
66808
66855
|
if (resolution.kind === "available") {
|
|
@@ -66818,14 +66865,14 @@ function scrubEncryptedCredentials(options) {
|
|
|
66818
66865
|
encryptedFileExisted
|
|
66819
66866
|
};
|
|
66820
66867
|
}
|
|
66821
|
-
__name$
|
|
66868
|
+
__name$2(scrubEncryptedCredentials, "scrubEncryptedCredentials");
|
|
66822
66869
|
var AuthenticationError = class extends UserError {
|
|
66823
66870
|
constructor(message, reason, telemetryMessage) {
|
|
66824
66871
|
super(message, { telemetryMessage });
|
|
66825
66872
|
this.reason = reason;
|
|
66826
66873
|
}
|
|
66827
66874
|
static {
|
|
66828
|
-
__name$
|
|
66875
|
+
__name$2(this, "AuthenticationError");
|
|
66829
66876
|
}
|
|
66830
66877
|
};
|
|
66831
66878
|
|
|
@@ -66836,8 +66883,8 @@ function createPreferences(getConfigPath) {
|
|
|
66836
66883
|
function getUserPreferencesPath() {
|
|
66837
66884
|
return path__default.resolve(getConfigPath(), "preferences.json");
|
|
66838
66885
|
}
|
|
66839
|
-
__name$
|
|
66840
|
-
function readUserPreferences$
|
|
66886
|
+
__name$2(getUserPreferencesPath, "getUserPreferencesPath");
|
|
66887
|
+
function readUserPreferences$1() {
|
|
66841
66888
|
try {
|
|
66842
66889
|
const raw = readFileSync(getUserPreferencesPath(), "utf8");
|
|
66843
66890
|
const parsed = JSON.parse(raw);
|
|
@@ -66847,23 +66894,23 @@ function createPreferences(getConfigPath) {
|
|
|
66847
66894
|
return {};
|
|
66848
66895
|
}
|
|
66849
66896
|
}
|
|
66850
|
-
__name$
|
|
66851
|
-
function updateUserPreferences$
|
|
66897
|
+
__name$2(readUserPreferences$1, "readUserPreferences");
|
|
66898
|
+
function updateUserPreferences$1(update) {
|
|
66852
66899
|
const next = {
|
|
66853
|
-
...readUserPreferences$
|
|
66900
|
+
...readUserPreferences$1(),
|
|
66854
66901
|
...update
|
|
66855
66902
|
};
|
|
66856
66903
|
const filePath = getUserPreferencesPath();
|
|
66857
66904
|
mkdirSync(path__default.dirname(filePath), { recursive: true });
|
|
66858
66905
|
writeFileSync(filePath, JSON.stringify(next, null, " "), { encoding: "utf-8" });
|
|
66859
66906
|
}
|
|
66860
|
-
__name$
|
|
66907
|
+
__name$2(updateUserPreferences$1, "updateUserPreferences");
|
|
66861
66908
|
return {
|
|
66862
|
-
readUserPreferences: readUserPreferences$
|
|
66863
|
-
updateUserPreferences: updateUserPreferences$
|
|
66909
|
+
readUserPreferences: readUserPreferences$1,
|
|
66910
|
+
updateUserPreferences: updateUserPreferences$1
|
|
66864
66911
|
};
|
|
66865
66912
|
}
|
|
66866
|
-
__name$
|
|
66913
|
+
__name$2(createPreferences, "createPreferences");
|
|
66867
66914
|
var millisecondsInMinute = 6e4;
|
|
66868
66915
|
var minutesInYear = 525600;
|
|
66869
66916
|
var minutesInMonth = 43200;
|
|
@@ -66875,46 +66922,46 @@ function constructFrom(date$2, value) {
|
|
|
66875
66922
|
if (date$2 instanceof Date) return new date$2.constructor(value);
|
|
66876
66923
|
return new Date(value);
|
|
66877
66924
|
}
|
|
66878
|
-
__name$
|
|
66925
|
+
__name$2(constructFrom, "constructFrom");
|
|
66879
66926
|
function toDate(argument, context) {
|
|
66880
66927
|
return constructFrom(context || argument, argument);
|
|
66881
66928
|
}
|
|
66882
|
-
__name$
|
|
66929
|
+
__name$2(toDate, "toDate");
|
|
66883
66930
|
var defaultOptions$1 = {};
|
|
66884
66931
|
function getDefaultOptions() {
|
|
66885
66932
|
return defaultOptions$1;
|
|
66886
66933
|
}
|
|
66887
|
-
__name$
|
|
66934
|
+
__name$2(getDefaultOptions, "getDefaultOptions");
|
|
66888
66935
|
function getTimezoneOffsetInMilliseconds(date$2) {
|
|
66889
66936
|
const _date$1 = toDate(date$2);
|
|
66890
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()));
|
|
66891
66938
|
utcDate.setUTCFullYear(_date$1.getFullYear());
|
|
66892
66939
|
return +date$2 - +utcDate;
|
|
66893
66940
|
}
|
|
66894
|
-
__name$
|
|
66941
|
+
__name$2(getTimezoneOffsetInMilliseconds, "getTimezoneOffsetInMilliseconds");
|
|
66895
66942
|
function normalizeDates(context, ...dates) {
|
|
66896
66943
|
const normalize$1 = constructFrom.bind(null, context || dates.find((date$2) => typeof date$2 === "object"));
|
|
66897
66944
|
return dates.map(normalize$1);
|
|
66898
66945
|
}
|
|
66899
|
-
__name$
|
|
66946
|
+
__name$2(normalizeDates, "normalizeDates");
|
|
66900
66947
|
function compareAsc(dateLeft, dateRight) {
|
|
66901
66948
|
const diff = +toDate(dateLeft) - +toDate(dateRight);
|
|
66902
66949
|
if (diff < 0) return -1;
|
|
66903
66950
|
else if (diff > 0) return 1;
|
|
66904
66951
|
return diff;
|
|
66905
66952
|
}
|
|
66906
|
-
__name$
|
|
66953
|
+
__name$2(compareAsc, "compareAsc");
|
|
66907
66954
|
function constructNow(date$2) {
|
|
66908
66955
|
return constructFrom(date$2, Date.now());
|
|
66909
66956
|
}
|
|
66910
|
-
__name$
|
|
66957
|
+
__name$2(constructNow, "constructNow");
|
|
66911
66958
|
function getRoundingMethod(method) {
|
|
66912
66959
|
return (number$3) => {
|
|
66913
66960
|
const result = (method ? Math[method] : Math.trunc)(number$3);
|
|
66914
66961
|
return result === 0 ? 0 : result;
|
|
66915
66962
|
};
|
|
66916
66963
|
}
|
|
66917
|
-
__name$
|
|
66964
|
+
__name$2(getRoundingMethod, "getRoundingMethod");
|
|
66918
66965
|
var formatDistanceLocale = {
|
|
66919
66966
|
lessThanXSeconds: {
|
|
66920
66967
|
one: "less than a second",
|
|
@@ -66978,7 +67025,7 @@ var formatDistanceLocale = {
|
|
|
66978
67025
|
other: "almost {{count}} years"
|
|
66979
67026
|
}
|
|
66980
67027
|
};
|
|
66981
|
-
var formatDistance = /* @__PURE__ */ __name$
|
|
67028
|
+
var formatDistance = /* @__PURE__ */ __name$2((token, count, options) => {
|
|
66982
67029
|
let result;
|
|
66983
67030
|
const tokenValue = formatDistanceLocale[token];
|
|
66984
67031
|
if (typeof tokenValue === "string") result = tokenValue;
|
|
@@ -66994,7 +67041,7 @@ function buildFormatLongFn(args) {
|
|
|
66994
67041
|
return args.formats[width] || args.formats[args.defaultWidth];
|
|
66995
67042
|
};
|
|
66996
67043
|
}
|
|
66997
|
-
__name$
|
|
67044
|
+
__name$2(buildFormatLongFn, "buildFormatLongFn");
|
|
66998
67045
|
var formatLong = {
|
|
66999
67046
|
date: buildFormatLongFn({
|
|
67000
67047
|
formats: {
|
|
@@ -67032,7 +67079,7 @@ var formatRelativeLocale = {
|
|
|
67032
67079
|
nextWeek: "eeee 'at' p",
|
|
67033
67080
|
other: "P"
|
|
67034
67081
|
};
|
|
67035
|
-
var formatRelative = /* @__PURE__ */ __name$
|
|
67082
|
+
var formatRelative = /* @__PURE__ */ __name$2((token, _date$1, _baseDate, _options) => formatRelativeLocale[token], "formatRelative");
|
|
67036
67083
|
function buildLocalizeFn(args) {
|
|
67037
67084
|
return (value, options) => {
|
|
67038
67085
|
const context = options?.context ? String(options.context) : "standalone";
|
|
@@ -67050,9 +67097,9 @@ function buildLocalizeFn(args) {
|
|
|
67050
67097
|
return valuesArray[index];
|
|
67051
67098
|
};
|
|
67052
67099
|
}
|
|
67053
|
-
__name$
|
|
67100
|
+
__name$2(buildLocalizeFn, "buildLocalizeFn");
|
|
67054
67101
|
var localize = {
|
|
67055
|
-
ordinalNumber: /* @__PURE__ */ __name$
|
|
67102
|
+
ordinalNumber: /* @__PURE__ */ __name$2((dirtyNumber, _options) => {
|
|
67056
67103
|
const number$3 = Number(dirtyNumber);
|
|
67057
67104
|
const rem100 = number$3 % 100;
|
|
67058
67105
|
if (rem100 > 20 || rem100 < 10) switch (rem100 % 10) {
|
|
@@ -67092,7 +67139,7 @@ var localize = {
|
|
|
67092
67139
|
]
|
|
67093
67140
|
},
|
|
67094
67141
|
defaultWidth: "wide",
|
|
67095
|
-
argumentCallback: /* @__PURE__ */ __name$
|
|
67142
|
+
argumentCallback: /* @__PURE__ */ __name$2((quarter) => quarter - 1, "argumentCallback")
|
|
67096
67143
|
}),
|
|
67097
67144
|
month: buildLocalizeFn({
|
|
67098
67145
|
values: {
|
|
@@ -67270,15 +67317,15 @@ function buildMatchFn(args) {
|
|
|
67270
67317
|
};
|
|
67271
67318
|
};
|
|
67272
67319
|
}
|
|
67273
|
-
__name$
|
|
67320
|
+
__name$2(buildMatchFn, "buildMatchFn");
|
|
67274
67321
|
function findKey(object$2, predicate) {
|
|
67275
67322
|
for (const key in object$2) if (Object.prototype.hasOwnProperty.call(object$2, key) && predicate(object$2[key])) return key;
|
|
67276
67323
|
}
|
|
67277
|
-
__name$
|
|
67324
|
+
__name$2(findKey, "findKey");
|
|
67278
67325
|
function findIndex(array$2, predicate) {
|
|
67279
67326
|
for (let key = 0; key < array$2.length; key++) if (predicate(array$2[key])) return key;
|
|
67280
67327
|
}
|
|
67281
|
-
__name$
|
|
67328
|
+
__name$2(findIndex, "findIndex");
|
|
67282
67329
|
function buildMatchPatternFn(args) {
|
|
67283
67330
|
return (string$2, options = {}) => {
|
|
67284
67331
|
const matchResult = string$2.match(args.matchPattern);
|
|
@@ -67295,7 +67342,7 @@ function buildMatchPatternFn(args) {
|
|
|
67295
67342
|
};
|
|
67296
67343
|
};
|
|
67297
67344
|
}
|
|
67298
|
-
__name$
|
|
67345
|
+
__name$2(buildMatchPatternFn, "buildMatchPatternFn");
|
|
67299
67346
|
var enUS = {
|
|
67300
67347
|
code: "en-US",
|
|
67301
67348
|
formatDistance,
|
|
@@ -67306,7 +67353,7 @@ var enUS = {
|
|
|
67306
67353
|
ordinalNumber: buildMatchPatternFn({
|
|
67307
67354
|
matchPattern: /^(\d+)(th|st|nd|rd)?/i,
|
|
67308
67355
|
parsePattern: /\d+/i,
|
|
67309
|
-
valueCallback: /* @__PURE__ */ __name$
|
|
67356
|
+
valueCallback: /* @__PURE__ */ __name$2((value) => parseInt(value, 10), "valueCallback")
|
|
67310
67357
|
}),
|
|
67311
67358
|
era: buildMatchFn({
|
|
67312
67359
|
matchPatterns: {
|
|
@@ -67332,7 +67379,7 @@ var enUS = {
|
|
|
67332
67379
|
/4/i
|
|
67333
67380
|
] },
|
|
67334
67381
|
defaultParseWidth: "any",
|
|
67335
|
-
valueCallback: /* @__PURE__ */ __name$
|
|
67382
|
+
valueCallback: /* @__PURE__ */ __name$2((index) => index + 1, "valueCallback")
|
|
67336
67383
|
}),
|
|
67337
67384
|
month: buildMatchFn({
|
|
67338
67385
|
matchPatterns: {
|
|
@@ -67470,14 +67517,14 @@ function formatDistanceStrict(laterDate, earlierDate, options) {
|
|
|
67470
67517
|
return locale.formatDistance("xYears", years, localizeOptions);
|
|
67471
67518
|
}
|
|
67472
67519
|
}
|
|
67473
|
-
__name$
|
|
67520
|
+
__name$2(formatDistanceStrict, "formatDistanceStrict");
|
|
67474
67521
|
function formatDistanceToNowStrict(date$2, options) {
|
|
67475
67522
|
return formatDistanceStrict(date$2, constructNow(date$2), options);
|
|
67476
67523
|
}
|
|
67477
|
-
__name$
|
|
67524
|
+
__name$2(formatDistanceToNowStrict, "formatDistanceToNowStrict");
|
|
67478
67525
|
function createFileStorage(format$3, getPath) {
|
|
67479
67526
|
return {
|
|
67480
|
-
read: /* @__PURE__ */ __name$
|
|
67527
|
+
read: /* @__PURE__ */ __name$2(() => {
|
|
67481
67528
|
const filePath = getPath();
|
|
67482
67529
|
if (!existsSync(filePath)) return;
|
|
67483
67530
|
const contents = readFileSync$1(filePath);
|
|
@@ -67505,10 +67552,10 @@ function createFileStorage(format$3, getPath) {
|
|
|
67505
67552
|
path: getPath
|
|
67506
67553
|
};
|
|
67507
67554
|
}
|
|
67508
|
-
__name$
|
|
67555
|
+
__name$2(createFileStorage, "createFileStorage");
|
|
67509
67556
|
function createTemporaryTermsPrompt(deps) {
|
|
67510
67557
|
const { temporaryAccountLogger, prompt } = deps;
|
|
67511
|
-
return /* @__PURE__ */ __name$
|
|
67558
|
+
return /* @__PURE__ */ __name$2(async function ensureTemporaryTermsAccepted(question, notice) {
|
|
67512
67559
|
if (isNonInteractiveOrCI()) {
|
|
67513
67560
|
temporaryAccountLogger.log(notice);
|
|
67514
67561
|
return true;
|
|
@@ -67517,17 +67564,17 @@ function createTemporaryTermsPrompt(deps) {
|
|
|
67517
67564
|
return typeof answer === "string" && answer.trim().toLowerCase() === "yes";
|
|
67518
67565
|
}, "ensureTemporaryTermsAccepted");
|
|
67519
67566
|
}
|
|
67520
|
-
__name$
|
|
67567
|
+
__name$2(createTemporaryTermsPrompt, "createTemporaryTermsPrompt");
|
|
67521
67568
|
var MEMBERSHIPS_INACCESSIBLE_CODES = [9106, 1e4];
|
|
67522
67569
|
function getErrorCode(err) {
|
|
67523
67570
|
return err?.code;
|
|
67524
67571
|
}
|
|
67525
|
-
__name$
|
|
67572
|
+
__name$2(getErrorCode, "getErrorCode");
|
|
67526
67573
|
function isMembershipsInaccessible(err) {
|
|
67527
67574
|
const code = getErrorCode(err);
|
|
67528
67575
|
return code !== void 0 && MEMBERSHIPS_INACCESSIBLE_CODES.includes(code);
|
|
67529
67576
|
}
|
|
67530
|
-
__name$
|
|
67577
|
+
__name$2(isMembershipsInaccessible, "isMembershipsInaccessible");
|
|
67531
67578
|
function notLoggedInErrorBodies(loginCommand) {
|
|
67532
67579
|
return {
|
|
67533
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.`,
|
|
@@ -67537,7 +67584,7 @@ function notLoggedInErrorBodies(loginCommand) {
|
|
|
67537
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.`
|
|
67538
67585
|
};
|
|
67539
67586
|
}
|
|
67540
|
-
__name$
|
|
67587
|
+
__name$2(notLoggedInErrorBodies, "notLoggedInErrorBodies");
|
|
67541
67588
|
function logTemporaryPreviewAccount(temporaryAccountLogger, temporaryPreviewAccount, cached$2) {
|
|
67542
67589
|
const claimExpiresAt = new Date(temporaryPreviewAccount.claim.expiresAt);
|
|
67543
67590
|
temporaryAccountLogger.log(dedent`
|
|
@@ -67547,7 +67594,7 @@ function logTemporaryPreviewAccount(temporaryAccountLogger, temporaryPreviewAcco
|
|
|
67547
67594
|
Claim URL: ${temporaryPreviewAccount.claim.url}
|
|
67548
67595
|
`);
|
|
67549
67596
|
}
|
|
67550
|
-
__name$
|
|
67597
|
+
__name$2(logTemporaryPreviewAccount, "logTemporaryPreviewAccount");
|
|
67551
67598
|
function createCloudflareAuth(descriptor, ctx) {
|
|
67552
67599
|
const { logger: logger$2 } = ctx;
|
|
67553
67600
|
const temporaryAccountLogger = ctx.temporaryAccountLogger ?? logger$2;
|
|
@@ -67564,16 +67611,16 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67564
67611
|
function clearAccountSelection() {
|
|
67565
67612
|
accountSelection = void 0;
|
|
67566
67613
|
}
|
|
67567
|
-
__name$
|
|
67614
|
+
__name$2(clearAccountSelection, "clearAccountSelection");
|
|
67568
67615
|
function purgeAccountCaches() {
|
|
67569
67616
|
clearAccountSelection();
|
|
67570
67617
|
configCache.purgeConfigCaches();
|
|
67571
67618
|
}
|
|
67572
|
-
__name$
|
|
67619
|
+
__name$2(purgeAccountCaches, "purgeAccountCaches");
|
|
67573
67620
|
const credentialStorage = createCredentialStorageContext({
|
|
67574
67621
|
serviceName: descriptor.keyringServiceName,
|
|
67575
67622
|
getConfigPath: descriptor.getConfigPath,
|
|
67576
|
-
isKeyringEnabled: /* @__PURE__ */ __name$
|
|
67623
|
+
isKeyringEnabled: /* @__PURE__ */ __name$2(() => preferences.readUserPreferences().keyring_enabled === true, "isKeyringEnabled"),
|
|
67577
67624
|
logger: logger$2,
|
|
67578
67625
|
isNonInteractiveOrCI,
|
|
67579
67626
|
loginCommand: descriptor.commands.login,
|
|
@@ -67583,8 +67630,8 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67583
67630
|
const oauthFlow = createOAuthFlow({
|
|
67584
67631
|
logger: logger$2,
|
|
67585
67632
|
isNonInteractiveOrCI,
|
|
67586
|
-
openInBrowser: /* @__PURE__ */ __name$
|
|
67587
|
-
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"),
|
|
67588
67635
|
purgeOnLoginOrLogout: purgeAccountCaches,
|
|
67589
67636
|
clientId: descriptor.clientId,
|
|
67590
67637
|
consent: descriptor.consent,
|
|
@@ -67608,27 +67655,27 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67608
67655
|
function setProfile(profile) {
|
|
67609
67656
|
oauthFlow.setProfile(profile);
|
|
67610
67657
|
}
|
|
67611
|
-
__name$
|
|
67658
|
+
__name$2(setProfile, "setProfile");
|
|
67612
67659
|
function getActiveProfile() {
|
|
67613
67660
|
return oauthFlow.getActiveProfile();
|
|
67614
67661
|
}
|
|
67615
|
-
__name$
|
|
67662
|
+
__name$2(getActiveProfile, "getActiveProfile");
|
|
67616
67663
|
function getCredentialStore() {
|
|
67617
67664
|
return credentialStorage.getActiveStore(oauthFlow.getActiveProfile());
|
|
67618
67665
|
}
|
|
67619
|
-
__name$
|
|
67666
|
+
__name$2(getCredentialStore, "getCredentialStore");
|
|
67620
67667
|
function setTemporaryAllowed(allowed, request$2) {
|
|
67621
67668
|
oauthFlow.setTemporaryAllowed(allowed, request$2);
|
|
67622
67669
|
}
|
|
67623
|
-
__name$
|
|
67670
|
+
__name$2(setTemporaryAllowed, "setTemporaryAllowed");
|
|
67624
67671
|
function getAPIToken$1() {
|
|
67625
67672
|
return oauthFlow.getAPIToken();
|
|
67626
67673
|
}
|
|
67627
|
-
__name$
|
|
67674
|
+
__name$2(getAPIToken$1, "getAPIToken");
|
|
67628
67675
|
function requireApiToken$1() {
|
|
67629
67676
|
return oauthFlow.requireApiToken();
|
|
67630
67677
|
}
|
|
67631
|
-
__name$
|
|
67678
|
+
__name$2(requireApiToken$1, "requireApiToken");
|
|
67632
67679
|
function withLoginDefaults(complianceConfig, props) {
|
|
67633
67680
|
return {
|
|
67634
67681
|
complianceConfig,
|
|
@@ -67640,43 +67687,43 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67640
67687
|
device: props?.device ?? descriptor.useDeviceFlowByDefault ?? false
|
|
67641
67688
|
};
|
|
67642
67689
|
}
|
|
67643
|
-
__name$
|
|
67690
|
+
__name$2(withLoginDefaults, "withLoginDefaults");
|
|
67644
67691
|
async function login(complianceConfig, props) {
|
|
67645
67692
|
return oauthFlow.login(withLoginDefaults(complianceConfig, props));
|
|
67646
67693
|
}
|
|
67647
|
-
__name$
|
|
67694
|
+
__name$2(login, "login");
|
|
67648
67695
|
async function logout(profile) {
|
|
67649
67696
|
return oauthFlow.logout(profile);
|
|
67650
67697
|
}
|
|
67651
|
-
__name$
|
|
67698
|
+
__name$2(logout, "logout");
|
|
67652
67699
|
async function loginOrRefreshIfRequired(complianceConfig, props) {
|
|
67653
67700
|
if (oauthFlow.getActiveTemporaryAccount()) return { loggedIn: true };
|
|
67654
67701
|
return oauthFlow.loginOrRefreshIfRequired(withLoginDefaults(complianceConfig, props));
|
|
67655
67702
|
}
|
|
67656
|
-
__name$
|
|
67703
|
+
__name$2(loginOrRefreshIfRequired, "loginOrRefreshIfRequired");
|
|
67657
67704
|
async function getOAuthTokenFromLocalState() {
|
|
67658
67705
|
return oauthFlow.getOAuthTokenFromLocalState();
|
|
67659
67706
|
}
|
|
67660
|
-
__name$
|
|
67707
|
+
__name$2(getOAuthTokenFromLocalState, "getOAuthTokenFromLocalState");
|
|
67661
67708
|
function getScopes() {
|
|
67662
67709
|
return oauthFlow.getScopes();
|
|
67663
67710
|
}
|
|
67664
|
-
__name$
|
|
67711
|
+
__name$2(getScopes, "getScopes");
|
|
67665
67712
|
function readAuthCredentials() {
|
|
67666
67713
|
return credentialStorage.storageFactory(getActiveProfile()).read();
|
|
67667
67714
|
}
|
|
67668
|
-
__name$
|
|
67715
|
+
__name$2(readAuthCredentials, "readAuthCredentials");
|
|
67669
67716
|
function writeAuthCredentials(config$3) {
|
|
67670
67717
|
clearAccountSelection();
|
|
67671
67718
|
credentialStorage.storageFactory(getActiveProfile()).write(config$3);
|
|
67672
67719
|
}
|
|
67673
|
-
__name$
|
|
67720
|
+
__name$2(writeAuthCredentials, "writeAuthCredentials");
|
|
67674
67721
|
function getAccountCacheFileName() {
|
|
67675
67722
|
const profile = oauthFlow.getActiveProfile();
|
|
67676
67723
|
if (profile === "default") return `${descriptor.accountCachePrefix}.json`;
|
|
67677
67724
|
return `${descriptor.accountCachePrefix}-${profile}.json`;
|
|
67678
67725
|
}
|
|
67679
|
-
__name$
|
|
67726
|
+
__name$2(getAccountCacheFileName, "getAccountCacheFileName");
|
|
67680
67727
|
function retainAccountSelection(account) {
|
|
67681
67728
|
accountSelection = {
|
|
67682
67729
|
account,
|
|
@@ -67684,7 +67731,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67684
67731
|
};
|
|
67685
67732
|
if (persistAccountSelection) configCache.saveToConfigCache(getAccountCacheFileName(), { account });
|
|
67686
67733
|
}
|
|
67687
|
-
__name$
|
|
67734
|
+
__name$2(retainAccountSelection, "retainAccountSelection");
|
|
67688
67735
|
function resolveAccountSelection() {
|
|
67689
67736
|
const profile = getActiveProfile();
|
|
67690
67737
|
if (persistAccountSelection) {
|
|
@@ -67696,12 +67743,12 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67696
67743
|
} else if (accountSelection?.profile !== profile) clearAccountSelection();
|
|
67697
67744
|
return accountSelection?.account;
|
|
67698
67745
|
}
|
|
67699
|
-
__name$
|
|
67746
|
+
__name$2(resolveAccountSelection, "resolveAccountSelection");
|
|
67700
67747
|
function getAccountFromCache() {
|
|
67701
67748
|
if (!persistAccountSelection) return;
|
|
67702
67749
|
return configCache.getConfigCache(getAccountCacheFileName()).account;
|
|
67703
67750
|
}
|
|
67704
|
-
__name$
|
|
67751
|
+
__name$2(getAccountFromCache, "getAccountFromCache");
|
|
67705
67752
|
async function fetchAccountsPaged(complianceConfig, resource, credentials) {
|
|
67706
67753
|
const results = [];
|
|
67707
67754
|
let getMoreResults = true;
|
|
@@ -67719,7 +67766,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67719
67766
|
}
|
|
67720
67767
|
return results;
|
|
67721
67768
|
}
|
|
67722
|
-
__name$
|
|
67769
|
+
__name$2(fetchAccountsPaged, "fetchAccountsPaged");
|
|
67723
67770
|
async function fetchAllAccounts(complianceConfig, options = {}) {
|
|
67724
67771
|
const { throwOnEmpty = true } = options;
|
|
67725
67772
|
const loginResult = await loginOrRefreshIfRequired(complianceConfig);
|
|
@@ -67743,7 +67790,7 @@ In a non-interactive environment, it is mandatory to specify an account ID, eith
|
|
|
67743
67790
|
Alternatively, try running \`${descriptor.commands.login}\` to re-authenticate.`, { telemetryMessage: "user account fetch empty" });
|
|
67744
67791
|
return usableAccounts;
|
|
67745
67792
|
}
|
|
67746
|
-
__name$
|
|
67793
|
+
__name$2(fetchAllAccounts, "fetchAllAccounts");
|
|
67747
67794
|
function getActiveAccountId(config$3) {
|
|
67748
67795
|
const temporaryAccount = oauthFlow.getActiveTemporaryAccount();
|
|
67749
67796
|
if (temporaryAccount) return temporaryAccount.account.id;
|
|
@@ -67752,7 +67799,7 @@ Alternatively, try running \`${descriptor.commands.login}\` to re-authenticate.`
|
|
|
67752
67799
|
if (envAccountId) return envAccountId;
|
|
67753
67800
|
return resolveAccountSelection()?.id;
|
|
67754
67801
|
}
|
|
67755
|
-
__name$
|
|
67802
|
+
__name$2(getActiveAccountId, "getActiveAccountId");
|
|
67756
67803
|
async function selectAccountId(config$3) {
|
|
67757
67804
|
const accounts = await fetchAllAccounts(config$3);
|
|
67758
67805
|
if (accounts.length === 1) {
|
|
@@ -67785,7 +67832,7 @@ ${accounts.map((account) => ` \`${redactAccountName ? "(redacted)" : account.na
|
|
|
67785
67832
|
throw e;
|
|
67786
67833
|
}
|
|
67787
67834
|
}
|
|
67788
|
-
__name$
|
|
67835
|
+
__name$2(selectAccountId, "selectAccountId");
|
|
67789
67836
|
async function getOrSelectAccountId(config$3) {
|
|
67790
67837
|
const activeAccountId = getActiveAccountId(config$3);
|
|
67791
67838
|
if (activeAccountId) return activeAccountId;
|
|
@@ -67794,7 +67841,7 @@ ${accounts.map((account) => ` \`${redactAccountName ? "(redacted)" : account.na
|
|
|
67794
67841
|
});
|
|
67795
67842
|
return accountSelectionPromise;
|
|
67796
67843
|
}
|
|
67797
|
-
__name$
|
|
67844
|
+
__name$2(getOrSelectAccountId, "getOrSelectAccountId");
|
|
67798
67845
|
async function requireAuth(config$3) {
|
|
67799
67846
|
if (oauthFlow.isTemporaryAllowed()) {
|
|
67800
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" });
|
|
@@ -67813,7 +67860,7 @@ ${accounts.map((account) => ` \`${redactAccountName ? "(redacted)" : account.na
|
|
|
67813
67860
|
if (!accountId) throw new UserError("No account id found, quitting...", { telemetryMessage: "user auth missing account id" });
|
|
67814
67861
|
return accountId;
|
|
67815
67862
|
}
|
|
67816
|
-
__name$
|
|
67863
|
+
__name$2(requireAuth, "requireAuth");
|
|
67817
67864
|
return {
|
|
67818
67865
|
setProfile,
|
|
67819
67866
|
getActiveProfile,
|
|
@@ -67835,24 +67882,24 @@ ${accounts.map((account) => ` \`${redactAccountName ? "(redacted)" : account.na
|
|
|
67835
67882
|
requireAuth
|
|
67836
67883
|
};
|
|
67837
67884
|
}
|
|
67838
|
-
__name$
|
|
67885
|
+
__name$2(createCloudflareAuth, "createCloudflareAuth");
|
|
67839
67886
|
var DIRECTORY_BINDINGS_FILE = "profiles/directory-bindings.json";
|
|
67840
67887
|
var ENCRYPTED_PROFILE_CONFIG_EXTENSION = ".enc";
|
|
67841
67888
|
function createCloudflareProfileStore(ctx) {
|
|
67842
67889
|
const { logger: logger$2, getConfigPath, keyringServiceName, format: format$3 } = ctx;
|
|
67843
67890
|
const plaintextExtension = `.${format$3}`;
|
|
67844
67891
|
function plaintextPath(profile) {
|
|
67845
|
-
return getAuthConfigFilePath$
|
|
67892
|
+
return getAuthConfigFilePath$1(getConfigPath(), profile, format$3);
|
|
67846
67893
|
}
|
|
67847
|
-
__name$
|
|
67894
|
+
__name$2(plaintextPath, "plaintextPath");
|
|
67848
67895
|
function encryptedPath(profile) {
|
|
67849
|
-
return getEncryptedAuthConfigFilePath$
|
|
67896
|
+
return getEncryptedAuthConfigFilePath$1(getConfigPath(), profile);
|
|
67850
67897
|
}
|
|
67851
|
-
__name$
|
|
67898
|
+
__name$2(encryptedPath, "encryptedPath");
|
|
67852
67899
|
function getProfileConfigDirectory() {
|
|
67853
67900
|
return path__default.dirname(plaintextPath("default"));
|
|
67854
67901
|
}
|
|
67855
|
-
__name$
|
|
67902
|
+
__name$2(getProfileConfigDirectory, "getProfileConfigDirectory");
|
|
67856
67903
|
const configs = {
|
|
67857
67904
|
exists(profile) {
|
|
67858
67905
|
return existsSync(plaintextPath(profile)) || existsSync(encryptedPath(profile));
|
|
@@ -67879,7 +67926,7 @@ function createCloudflareProfileStore(ctx) {
|
|
|
67879
67926
|
function getDirectoryBindingsPath() {
|
|
67880
67927
|
return path__default.join(getConfigPath(), DIRECTORY_BINDINGS_FILE);
|
|
67881
67928
|
}
|
|
67882
|
-
__name$
|
|
67929
|
+
__name$2(getDirectoryBindingsPath, "getDirectoryBindingsPath");
|
|
67883
67930
|
return createProfileStore({
|
|
67884
67931
|
configs,
|
|
67885
67932
|
bindings: {
|
|
@@ -67899,17 +67946,17 @@ function createCloudflareProfileStore(ctx) {
|
|
|
67899
67946
|
}
|
|
67900
67947
|
});
|
|
67901
67948
|
}
|
|
67902
|
-
__name$
|
|
67949
|
+
__name$2(createCloudflareProfileStore, "createCloudflareProfileStore");
|
|
67903
67950
|
function createKeyringPreference(deps) {
|
|
67904
67951
|
const { loginCommand, createProfileCommand, keyringServiceName, getConfigPath, format: format$3, preferences } = deps;
|
|
67905
|
-
const { readUserPreferences: readUserPreferences$
|
|
67952
|
+
const { readUserPreferences: readUserPreferences$1, updateUserPreferences: updateUserPreferences$1 } = preferences;
|
|
67906
67953
|
function describeProfile(profile) {
|
|
67907
67954
|
return profile ?? "default";
|
|
67908
67955
|
}
|
|
67909
|
-
__name$
|
|
67956
|
+
__name$2(describeProfile, "describeProfile");
|
|
67910
67957
|
function listEncryptedProfiles(logger$2) {
|
|
67911
67958
|
const encrypted = [];
|
|
67912
|
-
if (existsSync(getEncryptedAuthConfigFilePath$
|
|
67959
|
+
if (existsSync(getEncryptedAuthConfigFilePath$1(getConfigPath()))) encrypted.push(void 0);
|
|
67913
67960
|
const profileStore = createCloudflareProfileStore({
|
|
67914
67961
|
logger: logger$2,
|
|
67915
67962
|
getConfigPath,
|
|
@@ -67922,11 +67969,11 @@ function createKeyringPreference(deps) {
|
|
|
67922
67969
|
} catch {
|
|
67923
67970
|
continue;
|
|
67924
67971
|
}
|
|
67925
|
-
if (existsSync(getEncryptedAuthConfigFilePath$
|
|
67972
|
+
if (existsSync(getEncryptedAuthConfigFilePath$1(getConfigPath(), name))) encrypted.push(name);
|
|
67926
67973
|
}
|
|
67927
67974
|
return encrypted;
|
|
67928
67975
|
}
|
|
67929
|
-
__name$
|
|
67976
|
+
__name$2(listEncryptedProfiles, "listEncryptedProfiles");
|
|
67930
67977
|
function scrubAllEncryptedProfiles(logger$2) {
|
|
67931
67978
|
const encryptedProfiles = listEncryptedProfiles(logger$2);
|
|
67932
67979
|
if (encryptedProfiles.length === 0) return;
|
|
@@ -67950,60 +67997,60 @@ function createKeyringPreference(deps) {
|
|
|
67950
67997
|
}
|
|
67951
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.`);
|
|
67952
67999
|
}
|
|
67953
|
-
__name$
|
|
67954
|
-
function setKeyringPreference$
|
|
68000
|
+
__name$2(scrubAllEncryptedProfiles, "scrubAllEncryptedProfiles");
|
|
68001
|
+
function setKeyringPreference$1(enabled, ctx) {
|
|
67955
68002
|
const { logger: logger$2, getCredentialStore } = ctx;
|
|
67956
|
-
const previouslyEnabled = readUserPreferences$
|
|
68003
|
+
const previouslyEnabled = readUserPreferences$1().keyring_enabled === true;
|
|
67957
68004
|
const envOverride = getCloudflareAuthUseKeyringFromEnv();
|
|
67958
68005
|
if (envOverride !== void 0 && envOverride !== enabled) logger$2.warn(`CLOUDFLARE_AUTH_USE_KEYRING=${envOverride} overrides ${enabled ? "enabling" : "disabling"} keyring storage for this command.`);
|
|
67959
68006
|
if (!enabled && envOverride !== true) scrubAllEncryptedProfiles(logger$2);
|
|
67960
|
-
updateUserPreferences$
|
|
68007
|
+
updateUserPreferences$1({ keyring_enabled: enabled });
|
|
67961
68008
|
if (enabled && envOverride !== false) try {
|
|
67962
68009
|
if (getCredentialStore().kind !== "encrypted-file") {
|
|
67963
|
-
updateUserPreferences$
|
|
68010
|
+
updateUserPreferences$1({ keyring_enabled: previouslyEnabled });
|
|
67964
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.");
|
|
67965
68012
|
}
|
|
67966
68013
|
} catch (e) {
|
|
67967
|
-
updateUserPreferences$
|
|
68014
|
+
updateUserPreferences$1({ keyring_enabled: previouslyEnabled });
|
|
67968
68015
|
throw e;
|
|
67969
68016
|
}
|
|
67970
|
-
return { enabled: readUserPreferences$
|
|
68017
|
+
return { enabled: readUserPreferences$1().keyring_enabled === true };
|
|
67971
68018
|
}
|
|
67972
|
-
__name$
|
|
67973
|
-
return { setKeyringPreference: setKeyringPreference$
|
|
68019
|
+
__name$2(setKeyringPreference$1, "setKeyringPreference");
|
|
68020
|
+
return { setKeyringPreference: setKeyringPreference$1 };
|
|
67974
68021
|
}
|
|
67975
|
-
__name$
|
|
68022
|
+
__name$2(createKeyringPreference, "createKeyringPreference");
|
|
67976
68023
|
function createAuthConfigFileHelpers(deps) {
|
|
67977
68024
|
const { getConfigPath, format: format$3 } = deps;
|
|
67978
68025
|
function getAuthConfigFilePath2(profile) {
|
|
67979
|
-
return getAuthConfigFilePath$
|
|
68026
|
+
return getAuthConfigFilePath$1(getConfigPath(), profile, format$3);
|
|
67980
68027
|
}
|
|
67981
|
-
__name$
|
|
68028
|
+
__name$2(getAuthConfigFilePath2, "getAuthConfigFilePath");
|
|
67982
68029
|
function getEncryptedAuthConfigFilePath2(profile) {
|
|
67983
|
-
return getEncryptedAuthConfigFilePath$
|
|
68030
|
+
return getEncryptedAuthConfigFilePath$1(getConfigPath(), profile);
|
|
67984
68031
|
}
|
|
67985
|
-
__name$
|
|
67986
|
-
function defaultAuthConfigStorage$
|
|
68032
|
+
__name$2(getEncryptedAuthConfigFilePath2, "getEncryptedAuthConfigFilePath");
|
|
68033
|
+
function defaultAuthConfigStorage$1(profile) {
|
|
67987
68034
|
return createFileStorage(format$3, () => getAuthConfigFilePath2(profile));
|
|
67988
68035
|
}
|
|
67989
|
-
__name$
|
|
67990
|
-
function writeAuthConfigFile$
|
|
67991
|
-
defaultAuthConfigStorage$
|
|
68036
|
+
__name$2(defaultAuthConfigStorage$1, "defaultAuthConfigStorage");
|
|
68037
|
+
function writeAuthConfigFile$1(config$3, profile) {
|
|
68038
|
+
defaultAuthConfigStorage$1(profile).write(config$3);
|
|
67992
68039
|
}
|
|
67993
|
-
__name$
|
|
67994
|
-
function readAuthConfigFile$
|
|
67995
|
-
return defaultAuthConfigStorage$
|
|
68040
|
+
__name$2(writeAuthConfigFile$1, "writeAuthConfigFile");
|
|
68041
|
+
function readAuthConfigFile$1(profile) {
|
|
68042
|
+
return defaultAuthConfigStorage$1(profile).read();
|
|
67996
68043
|
}
|
|
67997
|
-
__name$
|
|
68044
|
+
__name$2(readAuthConfigFile$1, "readAuthConfigFile");
|
|
67998
68045
|
return {
|
|
67999
68046
|
getAuthConfigFilePath: getAuthConfigFilePath2,
|
|
68000
68047
|
getEncryptedAuthConfigFilePath: getEncryptedAuthConfigFilePath2,
|
|
68001
|
-
defaultAuthConfigStorage: defaultAuthConfigStorage$
|
|
68002
|
-
readAuthConfigFile: readAuthConfigFile$
|
|
68003
|
-
writeAuthConfigFile: writeAuthConfigFile$
|
|
68048
|
+
defaultAuthConfigStorage: defaultAuthConfigStorage$1,
|
|
68049
|
+
readAuthConfigFile: readAuthConfigFile$1,
|
|
68050
|
+
writeAuthConfigFile: writeAuthConfigFile$1
|
|
68004
68051
|
};
|
|
68005
68052
|
}
|
|
68006
|
-
__name$
|
|
68053
|
+
__name$2(createAuthConfigFileHelpers, "createAuthConfigFileHelpers");
|
|
68007
68054
|
|
|
68008
68055
|
//#endregion
|
|
68009
68056
|
//#region ../workers-auth/dist/cf/index.mjs
|
|
@@ -68019,9 +68066,9 @@ var CF_CONSENT_PAGES = {
|
|
|
68019
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"
|
|
68020
68067
|
}
|
|
68021
68068
|
};
|
|
68022
|
-
var getClientIdFromEnv
|
|
68069
|
+
var getClientIdFromEnv = getEnvironmentVariableFactory({
|
|
68023
68070
|
variableName: "CLOUDFLARE_CLIENT_ID",
|
|
68024
|
-
defaultValue: /* @__PURE__ */ __name$
|
|
68071
|
+
defaultValue: /* @__PURE__ */ __name$2(() => "cbca97e7-c331-4cdd-8fd8-e25a451b98bf", "defaultValue")
|
|
68025
68072
|
});
|
|
68026
68073
|
function getCfConfigPath() {
|
|
68027
68074
|
return getGlobalConfigPath({
|
|
@@ -68030,7 +68077,7 @@ function getCfConfigPath() {
|
|
|
68030
68077
|
useLegacyHomeDir: false
|
|
68031
68078
|
});
|
|
68032
68079
|
}
|
|
68033
|
-
__name$
|
|
68080
|
+
__name$2(getCfConfigPath, "getCfConfigPath");
|
|
68034
68081
|
var CF_CLIENT_REGISTERED_SCOPES = [
|
|
68035
68082
|
"access:read",
|
|
68036
68083
|
"access:write",
|
|
@@ -68525,30 +68572,30 @@ var CF_UNGRANTABLE_SCOPE_SET = new Set([
|
|
|
68525
68572
|
"oauth_account_ssl_and_certificates_write"
|
|
68526
68573
|
]);
|
|
68527
68574
|
var CF_REQUESTABLE_SCOPES = CF_CLIENT_REGISTERED_SCOPES.filter((scope) => !CF_UNGRANTABLE_SCOPE_SET.has(scope));
|
|
68528
|
-
var DefaultScopeKeys
|
|
68529
|
-
function setLoginScopeKeys
|
|
68530
|
-
DefaultScopeKeys
|
|
68575
|
+
var DefaultScopeKeys = [...CF_REQUESTABLE_SCOPES];
|
|
68576
|
+
function setLoginScopeKeys(scopes) {
|
|
68577
|
+
DefaultScopeKeys = scopes;
|
|
68531
68578
|
}
|
|
68532
|
-
__name$
|
|
68579
|
+
__name$2(setLoginScopeKeys, "setLoginScopeKeys");
|
|
68533
68580
|
var CF_SCOPE_SET = new Set(CF_REQUESTABLE_SCOPES);
|
|
68534
|
-
function validateScopeKeys
|
|
68581
|
+
function validateScopeKeys(scopes) {
|
|
68535
68582
|
return scopes.every((scope) => CF_SCOPE_SET.has(scope));
|
|
68536
68583
|
}
|
|
68537
|
-
__name$
|
|
68538
|
-
function getTemporaryAccountConfigFile
|
|
68584
|
+
__name$2(validateScopeKeys, "validateScopeKeys");
|
|
68585
|
+
function getTemporaryAccountConfigFile() {
|
|
68539
68586
|
const environment = getCloudflareApiEnvironmentFromEnv();
|
|
68540
68587
|
return environment === "production" ? "cloudflare-temporary-account.json" : `cloudflare-temporary-account.${environment}.json`;
|
|
68541
68588
|
}
|
|
68542
|
-
__name$
|
|
68589
|
+
__name$2(getTemporaryAccountConfigFile, "getTemporaryAccountConfigFile");
|
|
68543
68590
|
function getCfTemporaryAccountConfigPath() {
|
|
68544
|
-
return path__default.join(getCfConfigPath(), getTemporaryAccountConfigFile
|
|
68591
|
+
return path__default.join(getCfConfigPath(), getTemporaryAccountConfigFile());
|
|
68545
68592
|
}
|
|
68546
|
-
__name$
|
|
68593
|
+
__name$2(getCfTemporaryAccountConfigPath, "getCfTemporaryAccountConfigPath");
|
|
68547
68594
|
function createJsonFileStorage(getPath) {
|
|
68548
68595
|
return createFileStorage("json", getPath);
|
|
68549
68596
|
}
|
|
68550
|
-
__name$
|
|
68551
|
-
var { getAuthConfigFilePath
|
|
68597
|
+
__name$2(createJsonFileStorage, "createJsonFileStorage");
|
|
68598
|
+
var { getAuthConfigFilePath, getEncryptedAuthConfigFilePath, defaultAuthConfigStorage, readAuthConfigFile, writeAuthConfigFile } = createAuthConfigFileHelpers({
|
|
68552
68599
|
getConfigPath: getCfConfigPath,
|
|
68553
68600
|
format: "json"
|
|
68554
68601
|
});
|
|
@@ -68564,7 +68611,7 @@ var CF_CLI = {
|
|
|
68564
68611
|
deviceLogin: "cf auth login"
|
|
68565
68612
|
},
|
|
68566
68613
|
keyringServiceName: CF_KEYRING_SERVICE_NAME,
|
|
68567
|
-
clientId: getClientIdFromEnv
|
|
68614
|
+
clientId: getClientIdFromEnv,
|
|
68568
68615
|
consent: CF_CONSENT_PAGES,
|
|
68569
68616
|
redirectUri: CF_OAUTH_CALLBACK_URL,
|
|
68570
68617
|
useDeviceFlowByDefault: true,
|
|
@@ -68574,15 +68621,15 @@ var CF_CLI = {
|
|
|
68574
68621
|
fileFormat: "json",
|
|
68575
68622
|
accountCachePrefix: "cloudflare-account",
|
|
68576
68623
|
cacheNamespace: "cloudflare",
|
|
68577
|
-
getConfigFileLabel: /* @__PURE__ */ __name$
|
|
68578
|
-
getDefaultScopeKeys: /* @__PURE__ */ __name$
|
|
68624
|
+
getConfigFileLabel: /* @__PURE__ */ __name$2(() => "cloudflare.config.ts", "getConfigFileLabel"),
|
|
68625
|
+
getDefaultScopeKeys: /* @__PURE__ */ __name$2(() => DefaultScopeKeys, "getDefaultScopeKeys")
|
|
68579
68626
|
};
|
|
68580
68627
|
var cfPreferences = createPreferences(getCfConfigPath);
|
|
68581
|
-
var { readUserPreferences
|
|
68628
|
+
var { readUserPreferences, updateUserPreferences } = cfPreferences;
|
|
68582
68629
|
function createCfAuth(ctx) {
|
|
68583
68630
|
return createCloudflareAuth(CF_CLI, ctx);
|
|
68584
68631
|
}
|
|
68585
|
-
__name$
|
|
68632
|
+
__name$2(createCfAuth, "createCfAuth");
|
|
68586
68633
|
function createCfProfileStore(ctx) {
|
|
68587
68634
|
return createCloudflareProfileStore({
|
|
68588
68635
|
logger: ctx.logger,
|
|
@@ -68591,7 +68638,7 @@ function createCfProfileStore(ctx) {
|
|
|
68591
68638
|
format: "json"
|
|
68592
68639
|
});
|
|
68593
68640
|
}
|
|
68594
|
-
__name$
|
|
68641
|
+
__name$2(createCfProfileStore, "createCfProfileStore");
|
|
68595
68642
|
var cfKeyringPreference = createKeyringPreference({
|
|
68596
68643
|
loginCommand: CF_CLI.commands.login,
|
|
68597
68644
|
createProfileCommand: CF_CLI.commands.createProfile,
|
|
@@ -68600,10 +68647,10 @@ var cfKeyringPreference = createKeyringPreference({
|
|
|
68600
68647
|
format: "json",
|
|
68601
68648
|
preferences: cfPreferences
|
|
68602
68649
|
});
|
|
68603
|
-
function setKeyringPreference
|
|
68650
|
+
function setKeyringPreference(enabled, ctx) {
|
|
68604
68651
|
return cfKeyringPreference.setKeyringPreference(enabled, ctx);
|
|
68605
68652
|
}
|
|
68606
|
-
__name$
|
|
68653
|
+
__name$2(setKeyringPreference, "setKeyringPreference");
|
|
68607
68654
|
|
|
68608
68655
|
//#endregion
|
|
68609
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
|
|
@@ -69035,6 +69082,8 @@ const ROUTER_WORKER_NAME = "__router-worker__";
|
|
|
69035
69082
|
const ASSET_WORKER_NAME = "__asset-worker__";
|
|
69036
69083
|
const VITE_PROXY_WORKER_NAME = "__vite_proxy_worker__";
|
|
69037
69084
|
const PROXY_SHARED_SECRET = randomUUID();
|
|
69085
|
+
/** The CLI named in actionable messages. The plugin is only compatible with `cf`. */
|
|
69086
|
+
const CLI_DISPLAY_NAME = "cf";
|
|
69038
69087
|
const kRequestType = Symbol("kRequestType");
|
|
69039
69088
|
|
|
69040
69089
|
//#endregion
|
|
@@ -71944,14 +71993,8 @@ const PRERENDER_WORKER_DIRECTORY_NAME = "prerender";
|
|
|
71944
71993
|
|
|
71945
71994
|
//#endregion
|
|
71946
71995
|
//#region src/build-output-env.ts
|
|
71947
|
-
/** Internal caller name set by the `cf-vite` delegate. */
|
|
71948
|
-
const CLI_DISPLAY_NAME_ENV_VAR = "CLOUDFLARE_VITE_CLI_DISPLAY_NAME";
|
|
71949
71996
|
/** Shared build context flag set by Cloudflare tooling for Preview builds. */
|
|
71950
71997
|
const PREVIEW_BUILD_ENV_VAR = "CLOUDFLARE_PREVIEW_BUILD";
|
|
71951
|
-
/** Return the CLI name used in actionable messages. */
|
|
71952
|
-
function getCliDisplayName() {
|
|
71953
|
-
return process.env[CLI_DISPLAY_NAME_ENV_VAR] === "cf" ? "cf" : "Wrangler";
|
|
71954
|
-
}
|
|
71955
71998
|
/** Whether Cloudflare tooling requested Preview Build Output. */
|
|
71956
71999
|
function isPreviewBuild() {
|
|
71957
72000
|
return process.env[PREVIEW_BUILD_ENV_VAR] === "true";
|
|
@@ -78642,7 +78685,6 @@ async function resolvePluginConfig(pluginConfig, userConfig, viteEnv) {
|
|
|
78642
78685
|
Object.assign(process.env, Object.fromEntries(Object.entries(localEnv.values).filter(([name]) => name.startsWith("CLOUDFLARE_"))));
|
|
78643
78686
|
const types$5 = normalizeTypes(pluginConfig.types);
|
|
78644
78687
|
const shared = {
|
|
78645
|
-
cliDisplayName: getCliDisplayName(),
|
|
78646
78688
|
persistState: pluginConfig.persistState ?? true,
|
|
78647
78689
|
inspectorPort: pluginConfig.inspectorPort,
|
|
78648
78690
|
types: types$5,
|
|
@@ -80528,7 +80570,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
80528
80570
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
80529
80571
|
var __getProtoOf = Object.getPrototypeOf;
|
|
80530
80572
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
80531
|
-
var __name$
|
|
80573
|
+
var __name$1 = (target$1, value) => __defProp$1(target$1, "name", {
|
|
80532
80574
|
value,
|
|
80533
80575
|
configurable: true
|
|
80534
80576
|
});
|
|
@@ -80570,7 +80612,7 @@ var require_constants = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
80570
80612
|
kListener: Symbol("kListener"),
|
|
80571
80613
|
kStatusCode: Symbol("status-code"),
|
|
80572
80614
|
kWebSocket: Symbol("websocket"),
|
|
80573
|
-
NOOP: /* @__PURE__ */ __name$
|
|
80615
|
+
NOOP: /* @__PURE__ */ __name$1(() => {}, "NOOP")
|
|
80574
80616
|
};
|
|
80575
80617
|
} });
|
|
80576
80618
|
var require_buffer_util = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/buffer-util.js"(exports$1, module$1) {
|
|
@@ -80589,20 +80631,20 @@ var require_buffer_util = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_
|
|
|
80589
80631
|
if (offset < totalLength) return new FastBuffer$1(target$1.buffer, target$1.byteOffset, offset);
|
|
80590
80632
|
return target$1;
|
|
80591
80633
|
}
|
|
80592
|
-
__name$
|
|
80634
|
+
__name$1(concat, "concat");
|
|
80593
80635
|
function _mask(source, mask, output$1, offset, length) {
|
|
80594
80636
|
for (let i$1 = 0; i$1 < length; i$1++) output$1[offset + i$1] = source[i$1] ^ mask[i$1 & 3];
|
|
80595
80637
|
}
|
|
80596
|
-
__name$
|
|
80638
|
+
__name$1(_mask, "_mask");
|
|
80597
80639
|
function _unmask(buffer$3, mask) {
|
|
80598
80640
|
for (let i$1 = 0; i$1 < buffer$3.length; i$1++) buffer$3[i$1] ^= mask[i$1 & 3];
|
|
80599
80641
|
}
|
|
80600
|
-
__name$
|
|
80642
|
+
__name$1(_unmask, "_unmask");
|
|
80601
80643
|
function toArrayBuffer$2(buf) {
|
|
80602
80644
|
if (buf.length === buf.buffer.byteLength) return buf.buffer;
|
|
80603
80645
|
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);
|
|
80604
80646
|
}
|
|
80605
|
-
__name$
|
|
80647
|
+
__name$1(toArrayBuffer$2, "toArrayBuffer");
|
|
80606
80648
|
function toBuffer$1(data$1) {
|
|
80607
80649
|
toBuffer$1.readOnly = true;
|
|
80608
80650
|
if (Buffer.isBuffer(data$1)) return data$1;
|
|
@@ -80615,7 +80657,7 @@ var require_buffer_util = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_
|
|
|
80615
80657
|
}
|
|
80616
80658
|
return buf;
|
|
80617
80659
|
}
|
|
80618
|
-
__name$
|
|
80660
|
+
__name$1(toBuffer$1, "toBuffer");
|
|
80619
80661
|
module$1.exports = {
|
|
80620
80662
|
concat,
|
|
80621
80663
|
mask: _mask,
|
|
@@ -80640,7 +80682,7 @@ var require_limiter = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modu
|
|
|
80640
80682
|
var kRun = Symbol("kRun");
|
|
80641
80683
|
var Limiter = class {
|
|
80642
80684
|
static {
|
|
80643
|
-
__name$
|
|
80685
|
+
__name$1(this, "Limiter");
|
|
80644
80686
|
}
|
|
80645
80687
|
/**
|
|
80646
80688
|
* Creates a new `Limiter`.
|
|
@@ -80703,7 +80745,7 @@ var require_permessage_deflate = __commonJS({ "../../node_modules/.pnpm/ws@8.21.
|
|
|
80703
80745
|
var zlibLimiter;
|
|
80704
80746
|
var PerMessageDeflate2 = class {
|
|
80705
80747
|
static {
|
|
80706
|
-
__name$
|
|
80748
|
+
__name$1(this, "PerMessageDeflate");
|
|
80707
80749
|
}
|
|
80708
80750
|
/**
|
|
80709
80751
|
* Creates a PerMessageDeflate instance.
|
|
@@ -80974,7 +81016,7 @@ var require_permessage_deflate = __commonJS({ "../../node_modules/.pnpm/ws@8.21.
|
|
|
80974
81016
|
this[kBuffers].push(chunk);
|
|
80975
81017
|
this[kTotalLength] += chunk.length;
|
|
80976
81018
|
}
|
|
80977
|
-
__name$
|
|
81019
|
+
__name$1(deflateOnData, "deflateOnData");
|
|
80978
81020
|
function inflateOnData(chunk) {
|
|
80979
81021
|
this[kTotalLength] += chunk.length;
|
|
80980
81022
|
if (this[kPerMessageDeflate]._maxPayload < 1 || this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload) {
|
|
@@ -80987,7 +81029,7 @@ var require_permessage_deflate = __commonJS({ "../../node_modules/.pnpm/ws@8.21.
|
|
|
80987
81029
|
this.removeListener("data", inflateOnData);
|
|
80988
81030
|
this.reset();
|
|
80989
81031
|
}
|
|
80990
|
-
__name$
|
|
81032
|
+
__name$1(inflateOnData, "inflateOnData");
|
|
80991
81033
|
function inflateOnError(err) {
|
|
80992
81034
|
this[kPerMessageDeflate]._inflate = null;
|
|
80993
81035
|
if (this[kError$3]) {
|
|
@@ -80997,7 +81039,7 @@ var require_permessage_deflate = __commonJS({ "../../node_modules/.pnpm/ws@8.21.
|
|
|
80997
81039
|
err[kStatusCode] = 1007;
|
|
80998
81040
|
this[kCallback](err);
|
|
80999
81041
|
}
|
|
81000
|
-
__name$
|
|
81042
|
+
__name$1(inflateOnError, "inflateOnError");
|
|
81001
81043
|
} });
|
|
81002
81044
|
var require_validation = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/validation.js"(exports$1, module$1) {
|
|
81003
81045
|
var { isUtf8: isUtf8$1 } = __require("buffer");
|
|
@@ -81135,7 +81177,7 @@ var require_validation = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_m
|
|
|
81135
81177
|
function isValidStatusCode$2(code) {
|
|
81136
81178
|
return code >= 1e3 && code <= 1014 && code !== 1004 && code !== 1005 && code !== 1006 || code >= 3e3 && code <= 4999;
|
|
81137
81179
|
}
|
|
81138
|
-
__name$
|
|
81180
|
+
__name$1(isValidStatusCode$2, "isValidStatusCode");
|
|
81139
81181
|
function _isValidUTF8(buf) {
|
|
81140
81182
|
const len = buf.length;
|
|
81141
81183
|
let i$1 = 0;
|
|
@@ -81152,11 +81194,11 @@ var require_validation = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_m
|
|
|
81152
81194
|
} else return false;
|
|
81153
81195
|
return true;
|
|
81154
81196
|
}
|
|
81155
|
-
__name$
|
|
81197
|
+
__name$1(_isValidUTF8, "_isValidUTF8");
|
|
81156
81198
|
function isBlob2(value) {
|
|
81157
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");
|
|
81158
81200
|
}
|
|
81159
|
-
__name$
|
|
81201
|
+
__name$1(isBlob2, "isBlob");
|
|
81160
81202
|
module$1.exports = {
|
|
81161
81203
|
isBlob: isBlob2,
|
|
81162
81204
|
isValidStatusCode: isValidStatusCode$2,
|
|
@@ -81189,7 +81231,7 @@ var require_receiver = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mod
|
|
|
81189
81231
|
var DEFER_EVENT = 6;
|
|
81190
81232
|
var Receiver2 = class extends Writable$3 {
|
|
81191
81233
|
static {
|
|
81192
|
-
__name$
|
|
81234
|
+
__name$1(this, "Receiver");
|
|
81193
81235
|
}
|
|
81194
81236
|
/**
|
|
81195
81237
|
* Creates a Receiver instance.
|
|
@@ -81652,7 +81694,7 @@ var require_sender = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
81652
81694
|
var GET_BLOB_DATA = 2;
|
|
81653
81695
|
module$1.exports = class _Sender {
|
|
81654
81696
|
static {
|
|
81655
|
-
__name$
|
|
81697
|
+
__name$1(this, "Sender");
|
|
81656
81698
|
}
|
|
81657
81699
|
/**
|
|
81658
81700
|
* Creates a Sender instance.
|
|
@@ -82106,12 +82148,12 @@ var require_sender = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
82106
82148
|
if (typeof callback === "function") callback(err);
|
|
82107
82149
|
}
|
|
82108
82150
|
}
|
|
82109
|
-
__name$
|
|
82151
|
+
__name$1(callCallbacks, "callCallbacks");
|
|
82110
82152
|
function onError$1(sender, err, cb) {
|
|
82111
82153
|
callCallbacks(sender, err, cb);
|
|
82112
82154
|
sender.onerror(err);
|
|
82113
82155
|
}
|
|
82114
|
-
__name$
|
|
82156
|
+
__name$1(onError$1, "onError");
|
|
82115
82157
|
} });
|
|
82116
82158
|
var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/event-target.js"(exports$1, module$1) {
|
|
82117
82159
|
var { kForOnEventAttribute, kListener: kListener$1 } = require_constants();
|
|
@@ -82125,7 +82167,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82125
82167
|
var kWasClean = Symbol("kWasClean");
|
|
82126
82168
|
var Event$1 = class {
|
|
82127
82169
|
static {
|
|
82128
|
-
__name$
|
|
82170
|
+
__name$1(this, "Event");
|
|
82129
82171
|
}
|
|
82130
82172
|
/**
|
|
82131
82173
|
* Create a new `Event`.
|
|
@@ -82154,7 +82196,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82154
82196
|
Object.defineProperty(Event$1.prototype, "type", { enumerable: true });
|
|
82155
82197
|
var CloseEvent$3 = class extends Event$1 {
|
|
82156
82198
|
static {
|
|
82157
|
-
__name$
|
|
82199
|
+
__name$1(this, "CloseEvent");
|
|
82158
82200
|
}
|
|
82159
82201
|
/**
|
|
82160
82202
|
* Create a new `CloseEvent`.
|
|
@@ -82199,7 +82241,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82199
82241
|
Object.defineProperty(CloseEvent$3.prototype, "wasClean", { enumerable: true });
|
|
82200
82242
|
var ErrorEvent$3 = class extends Event$1 {
|
|
82201
82243
|
static {
|
|
82202
|
-
__name$
|
|
82244
|
+
__name$1(this, "ErrorEvent");
|
|
82203
82245
|
}
|
|
82204
82246
|
/**
|
|
82205
82247
|
* Create a new `ErrorEvent`.
|
|
@@ -82232,7 +82274,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82232
82274
|
Object.defineProperty(ErrorEvent$3.prototype, "message", { enumerable: true });
|
|
82233
82275
|
var MessageEvent$2 = class extends Event$1 {
|
|
82234
82276
|
static {
|
|
82235
|
-
__name$
|
|
82277
|
+
__name$1(this, "MessageEvent");
|
|
82236
82278
|
}
|
|
82237
82279
|
/**
|
|
82238
82280
|
* Create a new `MessageEvent`.
|
|
@@ -82262,12 +82304,12 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82262
82304
|
addEventListener(type, handler, options = {}) {
|
|
82263
82305
|
for (const listener of this.listeners(type)) if (!options[kForOnEventAttribute] && listener[kListener$1] === handler && !listener[kForOnEventAttribute]) return;
|
|
82264
82306
|
let wrapper;
|
|
82265
|
-
if (type === "message") wrapper = /* @__PURE__ */ __name$
|
|
82307
|
+
if (type === "message") wrapper = /* @__PURE__ */ __name$1(function onMessage(data$1, isBinary) {
|
|
82266
82308
|
const event = new MessageEvent$2("message", { data: isBinary ? data$1 : data$1.toString() });
|
|
82267
82309
|
event[kTarget] = this;
|
|
82268
82310
|
callListener(handler, this, event);
|
|
82269
82311
|
}, "onMessage");
|
|
82270
|
-
else if (type === "close") wrapper = /* @__PURE__ */ __name$
|
|
82312
|
+
else if (type === "close") wrapper = /* @__PURE__ */ __name$1(function onClose(code, message) {
|
|
82271
82313
|
const event = new CloseEvent$3("close", {
|
|
82272
82314
|
code,
|
|
82273
82315
|
reason: message.toString(),
|
|
@@ -82276,7 +82318,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82276
82318
|
event[kTarget] = this;
|
|
82277
82319
|
callListener(handler, this, event);
|
|
82278
82320
|
}, "onClose");
|
|
82279
|
-
else if (type === "error") wrapper = /* @__PURE__ */ __name$
|
|
82321
|
+
else if (type === "error") wrapper = /* @__PURE__ */ __name$1(function onError$1(error$3) {
|
|
82280
82322
|
const event = new ErrorEvent$3("error", {
|
|
82281
82323
|
error: error$3,
|
|
82282
82324
|
message: error$3.message
|
|
@@ -82284,7 +82326,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82284
82326
|
event[kTarget] = this;
|
|
82285
82327
|
callListener(handler, this, event);
|
|
82286
82328
|
}, "onError");
|
|
82287
|
-
else if (type === "open") wrapper = /* @__PURE__ */ __name$
|
|
82329
|
+
else if (type === "open") wrapper = /* @__PURE__ */ __name$1(function onOpen() {
|
|
82288
82330
|
const event = new Event$1("open");
|
|
82289
82331
|
event[kTarget] = this;
|
|
82290
82332
|
callListener(handler, this, event);
|
|
@@ -82308,7 +82350,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82308
82350
|
if (typeof listener === "object" && listener.handleEvent) listener.handleEvent.call(listener, event);
|
|
82309
82351
|
else listener.call(thisArg, event);
|
|
82310
82352
|
}
|
|
82311
|
-
__name$
|
|
82353
|
+
__name$1(callListener, "callListener");
|
|
82312
82354
|
} });
|
|
82313
82355
|
var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/extension.js"(exports$1, module$1) {
|
|
82314
82356
|
var { tokenChars } = require_validation();
|
|
@@ -82316,7 +82358,7 @@ var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
82316
82358
|
if (dest[name] === void 0) dest[name] = [elem];
|
|
82317
82359
|
else dest[name].push(elem);
|
|
82318
82360
|
}
|
|
82319
|
-
__name$
|
|
82361
|
+
__name$1(push, "push");
|
|
82320
82362
|
function parse$6(header) {
|
|
82321
82363
|
const offers = /* @__PURE__ */ Object.create(null);
|
|
82322
82364
|
let params = /* @__PURE__ */ Object.create(null);
|
|
@@ -82410,7 +82452,7 @@ var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
82410
82452
|
}
|
|
82411
82453
|
return offers;
|
|
82412
82454
|
}
|
|
82413
|
-
__name$
|
|
82455
|
+
__name$1(parse$6, "parse");
|
|
82414
82456
|
function format$3(extensions) {
|
|
82415
82457
|
return Object.keys(extensions).map((extension2) => {
|
|
82416
82458
|
let configurations = extensions[extension2];
|
|
@@ -82424,7 +82466,7 @@ var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
82424
82466
|
}).join(", ");
|
|
82425
82467
|
}).join(", ");
|
|
82426
82468
|
}
|
|
82427
|
-
__name$
|
|
82469
|
+
__name$1(format$3, "format");
|
|
82428
82470
|
module$1.exports = {
|
|
82429
82471
|
format: format$3,
|
|
82430
82472
|
parse: parse$6
|
|
@@ -82458,7 +82500,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
82458
82500
|
var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
82459
82501
|
var WebSocket2 = class _WebSocket extends EventEmitter$4 {
|
|
82460
82502
|
static {
|
|
82461
|
-
__name$
|
|
82503
|
+
__name$1(this, "WebSocket");
|
|
82462
82504
|
}
|
|
82463
82505
|
/**
|
|
82464
82506
|
* Create a new `WebSocket`.
|
|
@@ -83084,25 +83126,25 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83084
83126
|
if (opts.finishRequest) opts.finishRequest(req, websocket);
|
|
83085
83127
|
else req.end();
|
|
83086
83128
|
}
|
|
83087
|
-
__name$
|
|
83129
|
+
__name$1(initAsClient, "initAsClient");
|
|
83088
83130
|
function emitErrorAndClose(websocket, err) {
|
|
83089
83131
|
websocket._readyState = WebSocket2.CLOSING;
|
|
83090
83132
|
websocket._errorEmitted = true;
|
|
83091
83133
|
websocket.emit("error", err);
|
|
83092
83134
|
websocket.emitClose();
|
|
83093
83135
|
}
|
|
83094
|
-
__name$
|
|
83136
|
+
__name$1(emitErrorAndClose, "emitErrorAndClose");
|
|
83095
83137
|
function netConnect(options) {
|
|
83096
83138
|
options.path = options.socketPath;
|
|
83097
83139
|
return net$5.connect(options);
|
|
83098
83140
|
}
|
|
83099
|
-
__name$
|
|
83141
|
+
__name$1(netConnect, "netConnect");
|
|
83100
83142
|
function tlsConnect(options) {
|
|
83101
83143
|
options.path = void 0;
|
|
83102
83144
|
if (!options.servername && options.servername !== "") options.servername = net$5.isIP(options.host) ? "" : options.host;
|
|
83103
83145
|
return tls$2.connect(options);
|
|
83104
83146
|
}
|
|
83105
|
-
__name$
|
|
83147
|
+
__name$1(tlsConnect, "tlsConnect");
|
|
83106
83148
|
function abortHandshake(websocket, stream$2, message) {
|
|
83107
83149
|
websocket._readyState = WebSocket2.CLOSING;
|
|
83108
83150
|
const err = new Error(message);
|
|
@@ -83118,7 +83160,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83118
83160
|
stream$2.once("close", websocket.emitClose.bind(websocket));
|
|
83119
83161
|
}
|
|
83120
83162
|
}
|
|
83121
|
-
__name$
|
|
83163
|
+
__name$1(abortHandshake, "abortHandshake");
|
|
83122
83164
|
function sendAfterClose(websocket, data$1, cb) {
|
|
83123
83165
|
if (data$1) {
|
|
83124
83166
|
const length = isBlob2(data$1) ? data$1.size : toBuffer$1(data$1).length;
|
|
@@ -83130,7 +83172,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83130
83172
|
process.nextTick(cb, err);
|
|
83131
83173
|
}
|
|
83132
83174
|
}
|
|
83133
|
-
__name$
|
|
83175
|
+
__name$1(sendAfterClose, "sendAfterClose");
|
|
83134
83176
|
function receiverOnConclude(code, reason) {
|
|
83135
83177
|
const websocket = this[kWebSocket];
|
|
83136
83178
|
websocket._closeFrameReceived = true;
|
|
@@ -83142,12 +83184,12 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83142
83184
|
if (code === 1005) websocket.close();
|
|
83143
83185
|
else websocket.close(code, reason);
|
|
83144
83186
|
}
|
|
83145
|
-
__name$
|
|
83187
|
+
__name$1(receiverOnConclude, "receiverOnConclude");
|
|
83146
83188
|
function receiverOnDrain() {
|
|
83147
83189
|
const websocket = this[kWebSocket];
|
|
83148
83190
|
if (!websocket.isPaused) websocket._socket.resume();
|
|
83149
83191
|
}
|
|
83150
|
-
__name$
|
|
83192
|
+
__name$1(receiverOnDrain, "receiverOnDrain");
|
|
83151
83193
|
function receiverOnError(err) {
|
|
83152
83194
|
const websocket = this[kWebSocket];
|
|
83153
83195
|
if (websocket._socket[kWebSocket] !== void 0) {
|
|
@@ -83160,29 +83202,29 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83160
83202
|
websocket.emit("error", err);
|
|
83161
83203
|
}
|
|
83162
83204
|
}
|
|
83163
|
-
__name$
|
|
83205
|
+
__name$1(receiverOnError, "receiverOnError");
|
|
83164
83206
|
function receiverOnFinish() {
|
|
83165
83207
|
this[kWebSocket].emitClose();
|
|
83166
83208
|
}
|
|
83167
|
-
__name$
|
|
83209
|
+
__name$1(receiverOnFinish, "receiverOnFinish");
|
|
83168
83210
|
function receiverOnMessage(data$1, isBinary) {
|
|
83169
83211
|
this[kWebSocket].emit("message", data$1, isBinary);
|
|
83170
83212
|
}
|
|
83171
|
-
__name$
|
|
83213
|
+
__name$1(receiverOnMessage, "receiverOnMessage");
|
|
83172
83214
|
function receiverOnPing(data$1) {
|
|
83173
83215
|
const websocket = this[kWebSocket];
|
|
83174
83216
|
if (websocket._autoPong) websocket.pong(data$1, !this._isServer, NOOP);
|
|
83175
83217
|
websocket.emit("ping", data$1);
|
|
83176
83218
|
}
|
|
83177
|
-
__name$
|
|
83219
|
+
__name$1(receiverOnPing, "receiverOnPing");
|
|
83178
83220
|
function receiverOnPong(data$1) {
|
|
83179
83221
|
this[kWebSocket].emit("pong", data$1);
|
|
83180
83222
|
}
|
|
83181
|
-
__name$
|
|
83223
|
+
__name$1(receiverOnPong, "receiverOnPong");
|
|
83182
83224
|
function resume$1(stream$2) {
|
|
83183
83225
|
stream$2.resume();
|
|
83184
83226
|
}
|
|
83185
|
-
__name$
|
|
83227
|
+
__name$1(resume$1, "resume");
|
|
83186
83228
|
function senderOnError(err) {
|
|
83187
83229
|
const websocket = this[kWebSocket];
|
|
83188
83230
|
if (websocket.readyState === WebSocket2.CLOSED) return;
|
|
@@ -83196,11 +83238,11 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83196
83238
|
websocket.emit("error", err);
|
|
83197
83239
|
}
|
|
83198
83240
|
}
|
|
83199
|
-
__name$
|
|
83241
|
+
__name$1(senderOnError, "senderOnError");
|
|
83200
83242
|
function setCloseTimer(websocket) {
|
|
83201
83243
|
websocket._closeTimer = setTimeout(websocket._socket.destroy.bind(websocket._socket), websocket._closeTimeout);
|
|
83202
83244
|
}
|
|
83203
|
-
__name$
|
|
83245
|
+
__name$1(setCloseTimer, "setCloseTimer");
|
|
83204
83246
|
function socketOnClose() {
|
|
83205
83247
|
const websocket = this[kWebSocket];
|
|
83206
83248
|
this.removeListener("close", socketOnClose);
|
|
@@ -83220,18 +83262,18 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83220
83262
|
websocket._receiver.on("finish", receiverOnFinish);
|
|
83221
83263
|
}
|
|
83222
83264
|
}
|
|
83223
|
-
__name$
|
|
83265
|
+
__name$1(socketOnClose, "socketOnClose");
|
|
83224
83266
|
function socketOnData(chunk) {
|
|
83225
83267
|
if (!this[kWebSocket]._receiver.write(chunk)) this.pause();
|
|
83226
83268
|
}
|
|
83227
|
-
__name$
|
|
83269
|
+
__name$1(socketOnData, "socketOnData");
|
|
83228
83270
|
function socketOnEnd() {
|
|
83229
83271
|
const websocket = this[kWebSocket];
|
|
83230
83272
|
websocket._readyState = WebSocket2.CLOSING;
|
|
83231
83273
|
websocket._receiver.end();
|
|
83232
83274
|
this.end();
|
|
83233
83275
|
}
|
|
83234
|
-
__name$
|
|
83276
|
+
__name$1(socketOnEnd, "socketOnEnd");
|
|
83235
83277
|
function socketOnError() {
|
|
83236
83278
|
const websocket = this[kWebSocket];
|
|
83237
83279
|
this.removeListener("error", socketOnError);
|
|
@@ -83241,7 +83283,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83241
83283
|
this.destroy();
|
|
83242
83284
|
}
|
|
83243
83285
|
}
|
|
83244
|
-
__name$
|
|
83286
|
+
__name$1(socketOnError, "socketOnError");
|
|
83245
83287
|
} });
|
|
83246
83288
|
var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/stream.js"(exports$1, module$1) {
|
|
83247
83289
|
require_websocket();
|
|
@@ -83249,17 +83291,17 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83249
83291
|
function emitClose(stream$2) {
|
|
83250
83292
|
stream$2.emit("close");
|
|
83251
83293
|
}
|
|
83252
|
-
__name$
|
|
83294
|
+
__name$1(emitClose, "emitClose");
|
|
83253
83295
|
function duplexOnEnd() {
|
|
83254
83296
|
if (!this.destroyed && this._writableState.finished) this.destroy();
|
|
83255
83297
|
}
|
|
83256
|
-
__name$
|
|
83298
|
+
__name$1(duplexOnEnd, "duplexOnEnd");
|
|
83257
83299
|
function duplexOnError(err) {
|
|
83258
83300
|
this.removeListener("error", duplexOnError);
|
|
83259
83301
|
this.destroy();
|
|
83260
83302
|
if (this.listenerCount("error") === 0) this.emit("error", err);
|
|
83261
83303
|
}
|
|
83262
|
-
__name$
|
|
83304
|
+
__name$1(duplexOnError, "duplexOnError");
|
|
83263
83305
|
function createWebSocketStream2(ws, options) {
|
|
83264
83306
|
let terminateOnDestroy = true;
|
|
83265
83307
|
const duplex = new Duplex$1({
|
|
@@ -83269,16 +83311,16 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83269
83311
|
objectMode: false,
|
|
83270
83312
|
writableObjectMode: false
|
|
83271
83313
|
});
|
|
83272
|
-
ws.on("message", /* @__PURE__ */ __name$
|
|
83314
|
+
ws.on("message", /* @__PURE__ */ __name$1(function message(msg, isBinary) {
|
|
83273
83315
|
const data$1 = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
83274
83316
|
if (!duplex.push(data$1)) ws.pause();
|
|
83275
83317
|
}, "message"));
|
|
83276
|
-
ws.once("error", /* @__PURE__ */ __name$
|
|
83318
|
+
ws.once("error", /* @__PURE__ */ __name$1(function error$3(err) {
|
|
83277
83319
|
if (duplex.destroyed) return;
|
|
83278
83320
|
terminateOnDestroy = false;
|
|
83279
83321
|
duplex.destroy(err);
|
|
83280
83322
|
}, "error"));
|
|
83281
|
-
ws.once("close", /* @__PURE__ */ __name$
|
|
83323
|
+
ws.once("close", /* @__PURE__ */ __name$1(function close() {
|
|
83282
83324
|
if (duplex.destroyed) return;
|
|
83283
83325
|
duplex.push(null);
|
|
83284
83326
|
}, "close"));
|
|
@@ -83289,11 +83331,11 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83289
83331
|
return;
|
|
83290
83332
|
}
|
|
83291
83333
|
let called = false;
|
|
83292
|
-
ws.once("error", /* @__PURE__ */ __name$
|
|
83334
|
+
ws.once("error", /* @__PURE__ */ __name$1(function error$3(err2) {
|
|
83293
83335
|
called = true;
|
|
83294
83336
|
callback(err2);
|
|
83295
83337
|
}, "error"));
|
|
83296
|
-
ws.once("close", /* @__PURE__ */ __name$
|
|
83338
|
+
ws.once("close", /* @__PURE__ */ __name$1(function close() {
|
|
83297
83339
|
if (!called) callback(err);
|
|
83298
83340
|
process.nextTick(emitClose, duplex);
|
|
83299
83341
|
}, "close"));
|
|
@@ -83301,7 +83343,7 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83301
83343
|
};
|
|
83302
83344
|
duplex._final = function(callback) {
|
|
83303
83345
|
if (ws.readyState === ws.CONNECTING) {
|
|
83304
|
-
ws.once("open", /* @__PURE__ */ __name$
|
|
83346
|
+
ws.once("open", /* @__PURE__ */ __name$1(function open$3() {
|
|
83305
83347
|
duplex._final(callback);
|
|
83306
83348
|
}, "open"));
|
|
83307
83349
|
return;
|
|
@@ -83311,7 +83353,7 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83311
83353
|
callback();
|
|
83312
83354
|
if (duplex._readableState.endEmitted) duplex.destroy();
|
|
83313
83355
|
} else {
|
|
83314
|
-
ws._socket.once("finish", /* @__PURE__ */ __name$
|
|
83356
|
+
ws._socket.once("finish", /* @__PURE__ */ __name$1(function finish() {
|
|
83315
83357
|
callback();
|
|
83316
83358
|
}, "finish"));
|
|
83317
83359
|
ws.close();
|
|
@@ -83322,7 +83364,7 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83322
83364
|
};
|
|
83323
83365
|
duplex._write = function(chunk, encoding, callback) {
|
|
83324
83366
|
if (ws.readyState === ws.CONNECTING) {
|
|
83325
|
-
ws.once("open", /* @__PURE__ */ __name$
|
|
83367
|
+
ws.once("open", /* @__PURE__ */ __name$1(function open$3() {
|
|
83326
83368
|
duplex._write(chunk, encoding, callback);
|
|
83327
83369
|
}, "open"));
|
|
83328
83370
|
return;
|
|
@@ -83333,7 +83375,7 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83333
83375
|
duplex.on("error", duplexOnError);
|
|
83334
83376
|
return duplex;
|
|
83335
83377
|
}
|
|
83336
|
-
__name$
|
|
83378
|
+
__name$1(createWebSocketStream2, "createWebSocketStream");
|
|
83337
83379
|
module$1.exports = createWebSocketStream2;
|
|
83338
83380
|
} });
|
|
83339
83381
|
var require_subprotocol = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/subprotocol.js"(exports$1, module$1) {
|
|
@@ -83364,7 +83406,7 @@ var require_subprotocol = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_
|
|
|
83364
83406
|
protocols.add(protocol);
|
|
83365
83407
|
return protocols;
|
|
83366
83408
|
}
|
|
83367
|
-
__name$
|
|
83409
|
+
__name$1(parse$6, "parse");
|
|
83368
83410
|
module$1.exports = { parse: parse$6 };
|
|
83369
83411
|
} });
|
|
83370
83412
|
var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket-server.js"(exports$1, module$1) {
|
|
@@ -83383,7 +83425,7 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/
|
|
|
83383
83425
|
var CLOSED$1 = 2;
|
|
83384
83426
|
var WebSocketServer2 = class extends EventEmitter$4 {
|
|
83385
83427
|
static {
|
|
83386
|
-
__name$
|
|
83428
|
+
__name$1(this, "WebSocketServer");
|
|
83387
83429
|
}
|
|
83388
83430
|
/**
|
|
83389
83431
|
* Create a `WebSocketServer` instance.
|
|
@@ -83463,7 +83505,7 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/
|
|
|
83463
83505
|
this._removeListeners = addListeners(this._server, {
|
|
83464
83506
|
listening: this.emit.bind(this, "listening"),
|
|
83465
83507
|
error: this.emit.bind(this, "error"),
|
|
83466
|
-
upgrade: /* @__PURE__ */ __name$
|
|
83508
|
+
upgrade: /* @__PURE__ */ __name$1((req, socket, head) => {
|
|
83467
83509
|
this.handleUpgrade(req, socket, head, emitConnection);
|
|
83468
83510
|
}, "upgrade")
|
|
83469
83511
|
});
|
|
@@ -83677,20 +83719,20 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/
|
|
|
83677
83719
|
module$1.exports = WebSocketServer2;
|
|
83678
83720
|
function addListeners(server, map$1) {
|
|
83679
83721
|
for (const event of Object.keys(map$1)) server.on(event, map$1[event]);
|
|
83680
|
-
return /* @__PURE__ */ __name$
|
|
83722
|
+
return /* @__PURE__ */ __name$1(function removeListeners() {
|
|
83681
83723
|
for (const event of Object.keys(map$1)) server.removeListener(event, map$1[event]);
|
|
83682
83724
|
}, "removeListeners");
|
|
83683
83725
|
}
|
|
83684
|
-
__name$
|
|
83726
|
+
__name$1(addListeners, "addListeners");
|
|
83685
83727
|
function emitClose(server) {
|
|
83686
83728
|
server._state = CLOSED$1;
|
|
83687
83729
|
server.emit("close");
|
|
83688
83730
|
}
|
|
83689
|
-
__name$
|
|
83731
|
+
__name$1(emitClose, "emitClose");
|
|
83690
83732
|
function socketOnError() {
|
|
83691
83733
|
this.destroy();
|
|
83692
83734
|
}
|
|
83693
|
-
__name$
|
|
83735
|
+
__name$1(socketOnError, "socketOnError");
|
|
83694
83736
|
function abortHandshake(socket, code, message, headers) {
|
|
83695
83737
|
message = message || http$2.STATUS_CODES[code];
|
|
83696
83738
|
headers = {
|
|
@@ -83703,7 +83745,7 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/
|
|
|
83703
83745
|
socket.end(`HTTP/1.1 ${code} ${http$2.STATUS_CODES[code]}\r
|
|
83704
83746
|
` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message);
|
|
83705
83747
|
}
|
|
83706
|
-
__name$
|
|
83748
|
+
__name$1(abortHandshake, "abortHandshake");
|
|
83707
83749
|
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message, headers) {
|
|
83708
83750
|
if (server.listenerCount("wsClientError")) {
|
|
83709
83751
|
const err = new Error(message);
|
|
@@ -83711,11 +83753,11 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/
|
|
|
83711
83753
|
server.emit("wsClientError", err, socket, req);
|
|
83712
83754
|
} else abortHandshake(socket, code, message, headers);
|
|
83713
83755
|
}
|
|
83714
|
-
__name$
|
|
83756
|
+
__name$1(abortHandshakeOrEmitwsClientError, "abortHandshakeOrEmitwsClientError");
|
|
83715
83757
|
} });
|
|
83716
83758
|
var ApiError = class extends Error {
|
|
83717
83759
|
static {
|
|
83718
|
-
__name$
|
|
83760
|
+
__name$1(this, "ApiError");
|
|
83719
83761
|
}
|
|
83720
83762
|
url;
|
|
83721
83763
|
status;
|
|
@@ -83734,7 +83776,7 @@ var ApiError = class extends Error {
|
|
|
83734
83776
|
};
|
|
83735
83777
|
var CancelError = class extends Error {
|
|
83736
83778
|
static {
|
|
83737
|
-
__name$
|
|
83779
|
+
__name$1(this, "CancelError");
|
|
83738
83780
|
}
|
|
83739
83781
|
constructor(message) {
|
|
83740
83782
|
super(message);
|
|
@@ -83746,7 +83788,7 @@ var CancelError = class extends Error {
|
|
|
83746
83788
|
};
|
|
83747
83789
|
var CancelablePromise = class {
|
|
83748
83790
|
static {
|
|
83749
|
-
__name$
|
|
83791
|
+
__name$1(this, "CancelablePromise");
|
|
83750
83792
|
}
|
|
83751
83793
|
#isResolved;
|
|
83752
83794
|
#isRejected;
|
|
@@ -83763,23 +83805,23 @@ var CancelablePromise = class {
|
|
|
83763
83805
|
this.#promise = new Promise((resolve2, reject) => {
|
|
83764
83806
|
this.#resolve = resolve2;
|
|
83765
83807
|
this.#reject = reject;
|
|
83766
|
-
const onResolve = /* @__PURE__ */ __name$
|
|
83808
|
+
const onResolve = /* @__PURE__ */ __name$1((value) => {
|
|
83767
83809
|
if (this.#isResolved || this.#isRejected || this.#isCancelled) return;
|
|
83768
83810
|
this.#isResolved = true;
|
|
83769
83811
|
this.#resolve?.(value);
|
|
83770
83812
|
}, "onResolve");
|
|
83771
|
-
const onReject = /* @__PURE__ */ __name$
|
|
83813
|
+
const onReject = /* @__PURE__ */ __name$1((reason) => {
|
|
83772
83814
|
if (this.#isResolved || this.#isRejected || this.#isCancelled) return;
|
|
83773
83815
|
this.#isRejected = true;
|
|
83774
83816
|
this.#reject?.(reason);
|
|
83775
83817
|
}, "onReject");
|
|
83776
|
-
const onCancel = /* @__PURE__ */ __name$
|
|
83818
|
+
const onCancel = /* @__PURE__ */ __name$1((cancelHandler) => {
|
|
83777
83819
|
if (this.#isResolved || this.#isRejected || this.#isCancelled) return;
|
|
83778
83820
|
this.#cancelHandlers.push(cancelHandler);
|
|
83779
83821
|
}, "onCancel");
|
|
83780
|
-
Object.defineProperty(onCancel, "isResolved", { get: /* @__PURE__ */ __name$
|
|
83781
|
-
Object.defineProperty(onCancel, "isRejected", { get: /* @__PURE__ */ __name$
|
|
83782
|
-
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") });
|
|
83783
83825
|
return executor(onResolve, onReject, onCancel);
|
|
83784
83826
|
});
|
|
83785
83827
|
}
|
|
@@ -83823,34 +83865,34 @@ var OpenAPI = {
|
|
|
83823
83865
|
ENCODE_PATH: void 0,
|
|
83824
83866
|
LOGGER: void 0
|
|
83825
83867
|
};
|
|
83826
|
-
var isDefined = /* @__PURE__ */ __name$
|
|
83868
|
+
var isDefined = /* @__PURE__ */ __name$1((value) => {
|
|
83827
83869
|
return value !== void 0 && value !== null;
|
|
83828
83870
|
}, "isDefined");
|
|
83829
|
-
var isString = /* @__PURE__ */ __name$
|
|
83871
|
+
var isString = /* @__PURE__ */ __name$1((value) => {
|
|
83830
83872
|
return typeof value === "string";
|
|
83831
83873
|
}, "isString");
|
|
83832
|
-
var isStringWithValue = /* @__PURE__ */ __name$
|
|
83874
|
+
var isStringWithValue = /* @__PURE__ */ __name$1((value) => {
|
|
83833
83875
|
return isString(value) && value !== "";
|
|
83834
83876
|
}, "isStringWithValue");
|
|
83835
|
-
var isBlob = /* @__PURE__ */ __name$
|
|
83877
|
+
var isBlob = /* @__PURE__ */ __name$1((value) => {
|
|
83836
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]);
|
|
83837
83879
|
}, "isBlob");
|
|
83838
|
-
var isErrorResponse = /* @__PURE__ */ __name$
|
|
83880
|
+
var isErrorResponse = /* @__PURE__ */ __name$1((value) => {
|
|
83839
83881
|
return typeof value === "object" && value !== null && "error" in value && typeof value.error === "string";
|
|
83840
83882
|
}, "isErrorResponse");
|
|
83841
|
-
var base64 = /* @__PURE__ */ __name$
|
|
83883
|
+
var base64 = /* @__PURE__ */ __name$1((str) => {
|
|
83842
83884
|
try {
|
|
83843
83885
|
return btoa(str);
|
|
83844
83886
|
} catch (err) {
|
|
83845
83887
|
return Buffer.from(str).toString("base64");
|
|
83846
83888
|
}
|
|
83847
83889
|
}, "base64");
|
|
83848
|
-
var getQueryString = /* @__PURE__ */ __name$
|
|
83890
|
+
var getQueryString = /* @__PURE__ */ __name$1((params) => {
|
|
83849
83891
|
const qs = [];
|
|
83850
|
-
const append = /* @__PURE__ */ __name$
|
|
83892
|
+
const append = /* @__PURE__ */ __name$1((key, value) => {
|
|
83851
83893
|
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
83852
83894
|
}, "append");
|
|
83853
|
-
const process2$1 = /* @__PURE__ */ __name$
|
|
83895
|
+
const process2$1 = /* @__PURE__ */ __name$1((key, value) => {
|
|
83854
83896
|
if (isDefined(value)) if (Array.isArray(value)) value.forEach((v) => {
|
|
83855
83897
|
process2$1(key, v);
|
|
83856
83898
|
});
|
|
@@ -83865,7 +83907,7 @@ var getQueryString = /* @__PURE__ */ __name$2((params) => {
|
|
|
83865
83907
|
if (qs.length > 0) return `?${qs.join("&")}`;
|
|
83866
83908
|
return "";
|
|
83867
83909
|
}, "getQueryString");
|
|
83868
|
-
var getUrl = /* @__PURE__ */ __name$
|
|
83910
|
+
var getUrl = /* @__PURE__ */ __name$1((config$3, options) => {
|
|
83869
83911
|
const encoder$1 = config$3.ENCODE_PATH || encodeURI;
|
|
83870
83912
|
const path4 = options.url.replace("{api-version}", config$3.VERSION).replace(/{(.*?)}/g, (substring, group) => {
|
|
83871
83913
|
if (options.path?.hasOwnProperty(group)) return encoder$1(String(options.path[group]));
|
|
@@ -83875,10 +83917,10 @@ var getUrl = /* @__PURE__ */ __name$2((config$3, options) => {
|
|
|
83875
83917
|
if (options.query) return `${url$2}${getQueryString(options.query)}`;
|
|
83876
83918
|
return url$2;
|
|
83877
83919
|
}, "getUrl");
|
|
83878
|
-
var getFormData = /* @__PURE__ */ __name$
|
|
83920
|
+
var getFormData = /* @__PURE__ */ __name$1((options) => {
|
|
83879
83921
|
if (options.formData) {
|
|
83880
83922
|
const formData = new FormData();
|
|
83881
|
-
const process2$1 = /* @__PURE__ */ __name$
|
|
83923
|
+
const process2$1 = /* @__PURE__ */ __name$1(async (key, value) => {
|
|
83882
83924
|
if (isString(value)) formData.append(key, value);
|
|
83883
83925
|
else formData.append(key, JSON.stringify(value));
|
|
83884
83926
|
}, "process");
|
|
@@ -83889,11 +83931,11 @@ var getFormData = /* @__PURE__ */ __name$2((options) => {
|
|
|
83889
83931
|
return formData;
|
|
83890
83932
|
}
|
|
83891
83933
|
}, "getFormData");
|
|
83892
|
-
var resolve$1 = /* @__PURE__ */ __name$
|
|
83934
|
+
var resolve$1 = /* @__PURE__ */ __name$1(async (options, resolver) => {
|
|
83893
83935
|
if (typeof resolver === "function") return resolver(options);
|
|
83894
83936
|
return resolver;
|
|
83895
83937
|
}, "resolve");
|
|
83896
|
-
var getHeaders = /* @__PURE__ */ __name$
|
|
83938
|
+
var getHeaders = /* @__PURE__ */ __name$1(async (config$3, options) => {
|
|
83897
83939
|
const token = await resolve$1(options, config$3.TOKEN);
|
|
83898
83940
|
const username = await resolve$1(options, config$3.USERNAME);
|
|
83899
83941
|
const password = await resolve$1(options, config$3.PASSWORD);
|
|
@@ -83916,15 +83958,15 @@ var getHeaders = /* @__PURE__ */ __name$2(async (config$3, options) => {
|
|
|
83916
83958
|
addCustomApiHeaders(requestHeaders);
|
|
83917
83959
|
return requestHeaders;
|
|
83918
83960
|
}, "getHeaders");
|
|
83919
|
-
var getRequestBody = /* @__PURE__ */ __name$
|
|
83961
|
+
var getRequestBody = /* @__PURE__ */ __name$1((options) => {
|
|
83920
83962
|
if (options.body !== void 0) if (options.mediaType?.includes("/json")) return JSON.stringify(options.body);
|
|
83921
83963
|
else if (isString(options.body) || isBlob(options.body)) return options.body;
|
|
83922
83964
|
else return JSON.stringify(options.body);
|
|
83923
83965
|
}, "getRequestBody");
|
|
83924
|
-
var isResponseSchemaV4 = /* @__PURE__ */ __name$
|
|
83966
|
+
var isResponseSchemaV4 = /* @__PURE__ */ __name$1((config$3, _options) => {
|
|
83925
83967
|
return config$3.BASE.endsWith("/containers");
|
|
83926
83968
|
}, "isResponseSchemaV4");
|
|
83927
|
-
var parseResponseSchemaV4 = /* @__PURE__ */ __name$
|
|
83969
|
+
var parseResponseSchemaV4 = /* @__PURE__ */ __name$1((url$2, response, responseHeader, responseBody) => {
|
|
83928
83970
|
const fetchResult2 = typeof responseBody === "object" ? responseBody : JSON.parse(responseBody);
|
|
83929
83971
|
const ok = response.ok && fetchResult2.success;
|
|
83930
83972
|
let result;
|
|
@@ -83940,7 +83982,7 @@ var parseResponseSchemaV4 = /* @__PURE__ */ __name$2((url$2, response, responseH
|
|
|
83940
83982
|
body: responseHeader ?? result
|
|
83941
83983
|
};
|
|
83942
83984
|
}, "parseResponseSchemaV4");
|
|
83943
|
-
var sendRequest = /* @__PURE__ */ __name$
|
|
83985
|
+
var sendRequest = /* @__PURE__ */ __name$1(async (config$3, options, url$2, body, formData, headers, onCancel) => {
|
|
83944
83986
|
const controller = new AbortController();
|
|
83945
83987
|
const request2 = {
|
|
83946
83988
|
headers,
|
|
@@ -83952,13 +83994,13 @@ var sendRequest = /* @__PURE__ */ __name$2(async (config$3, options, url$2, body
|
|
|
83952
83994
|
onCancel(() => controller.abort());
|
|
83953
83995
|
return await fetch(url$2, request2);
|
|
83954
83996
|
}, "sendRequest");
|
|
83955
|
-
var getResponseHeader = /* @__PURE__ */ __name$
|
|
83997
|
+
var getResponseHeader = /* @__PURE__ */ __name$1((response, responseHeader) => {
|
|
83956
83998
|
if (responseHeader) {
|
|
83957
83999
|
const content = response.headers.get(responseHeader);
|
|
83958
84000
|
if (isString(content)) return content;
|
|
83959
84001
|
}
|
|
83960
84002
|
}, "getResponseHeader");
|
|
83961
|
-
var getResponseBody = /* @__PURE__ */ __name$
|
|
84003
|
+
var getResponseBody = /* @__PURE__ */ __name$1(async (response) => {
|
|
83962
84004
|
if (response.status !== 204) try {
|
|
83963
84005
|
const contentType = response.headers.get("Content-Type");
|
|
83964
84006
|
if (contentType) if (["application/json", "application/problem+json"].some((type) => contentType.toLowerCase().startsWith(type))) return await response.json();
|
|
@@ -83967,7 +84009,7 @@ var getResponseBody = /* @__PURE__ */ __name$2(async (response) => {
|
|
|
83967
84009
|
console.error(error$3);
|
|
83968
84010
|
}
|
|
83969
84011
|
}, "getResponseBody");
|
|
83970
|
-
var catchErrorCodes = /* @__PURE__ */ __name$
|
|
84012
|
+
var catchErrorCodes = /* @__PURE__ */ __name$1((options, result) => {
|
|
83971
84013
|
const error$3 = {
|
|
83972
84014
|
400: "Bad Request",
|
|
83973
84015
|
401: "Unauthorized",
|
|
@@ -83981,7 +84023,7 @@ var catchErrorCodes = /* @__PURE__ */ __name$2((options, result) => {
|
|
|
83981
84023
|
if (error$3) throw new ApiError(options, result, error$3);
|
|
83982
84024
|
if (!result.ok) throw new ApiError(options, result, "Generic Error");
|
|
83983
84025
|
}, "catchErrorCodes");
|
|
83984
|
-
var executeRequest = /* @__PURE__ */ __name$
|
|
84026
|
+
var executeRequest = /* @__PURE__ */ __name$1(async (config$3, options, onCancel) => {
|
|
83985
84027
|
const url$2 = getUrl(config$3, options);
|
|
83986
84028
|
const formData = getFormData(options);
|
|
83987
84029
|
const body = getRequestBody(options);
|
|
@@ -83996,7 +84038,7 @@ var executeRequest = /* @__PURE__ */ __name$2(async (config$3, options, onCancel
|
|
|
83996
84038
|
responseHeader: getResponseHeader(response, options.responseHeader)
|
|
83997
84039
|
};
|
|
83998
84040
|
}, "executeRequest");
|
|
83999
|
-
var buildApiResult = /* @__PURE__ */ __name$
|
|
84041
|
+
var buildApiResult = /* @__PURE__ */ __name$1((config$3, options, req) => {
|
|
84000
84042
|
if (isResponseSchemaV4(config$3, options)) return parseResponseSchemaV4(req.url, req.response, req.responseHeader, req.responseBody);
|
|
84001
84043
|
return {
|
|
84002
84044
|
url: req.url,
|
|
@@ -84006,7 +84048,7 @@ var buildApiResult = /* @__PURE__ */ __name$2((config$3, options, req) => {
|
|
|
84006
84048
|
body: req.responseHeader ?? req.responseBody
|
|
84007
84049
|
};
|
|
84008
84050
|
}, "buildApiResult");
|
|
84009
|
-
var request = /* @__PURE__ */ __name$
|
|
84051
|
+
var request = /* @__PURE__ */ __name$1((config$3, options) => {
|
|
84010
84052
|
return new CancelablePromise(async (resolve2, reject, onCancel) => {
|
|
84011
84053
|
try {
|
|
84012
84054
|
const req = await executeRequest(config$3, options, onCancel);
|
|
@@ -84020,7 +84062,7 @@ var request = /* @__PURE__ */ __name$2((config$3, options) => {
|
|
|
84020
84062
|
}
|
|
84021
84063
|
});
|
|
84022
84064
|
}, "request");
|
|
84023
|
-
var requestPaginated = /* @__PURE__ */ __name$
|
|
84065
|
+
var requestPaginated = /* @__PURE__ */ __name$1((config$3, options) => {
|
|
84024
84066
|
return new CancelablePromise(async (resolve2, reject, onCancel) => {
|
|
84025
84067
|
try {
|
|
84026
84068
|
const req = await executeRequest(config$3, options, onCancel);
|
|
@@ -84039,13 +84081,13 @@ var requestPaginated = /* @__PURE__ */ __name$2((config$3, options) => {
|
|
|
84039
84081
|
}
|
|
84040
84082
|
});
|
|
84041
84083
|
}, "requestPaginated");
|
|
84042
|
-
var debugLogRequest = /* @__PURE__ */ __name$
|
|
84084
|
+
var debugLogRequest = /* @__PURE__ */ __name$1(async (config$3, url$2, headers, body) => {
|
|
84043
84085
|
config$3.LOGGER?.debug(`-- START CF API REQUEST: ${url$2}`);
|
|
84044
84086
|
config$3.LOGGER?.debugWithSanitization("HEADERS:", JSON.stringify(sanitizeHeaders(headers), null, 2));
|
|
84045
84087
|
config$3.LOGGER?.debugWithSanitization("BODY:", JSON.stringify(body instanceof FormData ? await new Response(body).text() : body, null, 2));
|
|
84046
84088
|
config$3.LOGGER?.debug("-- END CF API REQUEST");
|
|
84047
84089
|
}, "debugLogRequest");
|
|
84048
|
-
var debugLogResponse = /* @__PURE__ */ __name$
|
|
84090
|
+
var debugLogResponse = /* @__PURE__ */ __name$1((config$3, response) => {
|
|
84049
84091
|
config$3.LOGGER?.debug("-- START CF API RESPONSE:", response.statusText, response.status);
|
|
84050
84092
|
config$3.LOGGER?.debugWithSanitization("RESPONSE:", response.body);
|
|
84051
84093
|
config$3.LOGGER?.debug("-- END CF API RESPONSE");
|
|
@@ -84185,7 +84227,7 @@ var UpdateApplicationRolloutRequest;
|
|
|
84185
84227
|
})(UpdateApplicationRolloutRequest || (UpdateApplicationRolloutRequest = {}));
|
|
84186
84228
|
var AccountService = class {
|
|
84187
84229
|
static {
|
|
84188
|
-
__name$
|
|
84230
|
+
__name$1(this, "AccountService");
|
|
84189
84231
|
}
|
|
84190
84232
|
/**
|
|
84191
84233
|
* Get complete account details related to Cloudchamber
|
|
@@ -84226,7 +84268,7 @@ var AccountService = class {
|
|
|
84226
84268
|
};
|
|
84227
84269
|
var ApplicationsService = class {
|
|
84228
84270
|
static {
|
|
84229
|
-
__name$
|
|
84271
|
+
__name$1(this, "ApplicationsService");
|
|
84230
84272
|
}
|
|
84231
84273
|
/**
|
|
84232
84274
|
* Create a new application
|
|
@@ -84691,7 +84733,7 @@ var ApplicationsService = class {
|
|
|
84691
84733
|
};
|
|
84692
84734
|
var ContainerImagePreparationsService = class {
|
|
84693
84735
|
static {
|
|
84694
|
-
__name$
|
|
84736
|
+
__name$1(this, "ContainerImagePreparationsService");
|
|
84695
84737
|
}
|
|
84696
84738
|
/**
|
|
84697
84739
|
* Prepare a digest-pinned managed image for the Containers runtime.
|
|
@@ -84713,7 +84755,7 @@ var ContainerImagePreparationsService = class {
|
|
|
84713
84755
|
};
|
|
84714
84756
|
var DeploymentsService = class {
|
|
84715
84757
|
static {
|
|
84716
|
-
__name$
|
|
84758
|
+
__name$1(this, "DeploymentsService");
|
|
84717
84759
|
}
|
|
84718
84760
|
/**
|
|
84719
84761
|
* Get a specific deployment within an application
|
|
@@ -84952,7 +84994,7 @@ var DeploymentsService = class {
|
|
|
84952
84994
|
};
|
|
84953
84995
|
var ImageRegistriesService = class {
|
|
84954
84996
|
static {
|
|
84955
|
-
__name$
|
|
84997
|
+
__name$1(this, "ImageRegistriesService");
|
|
84956
84998
|
}
|
|
84957
84999
|
/**
|
|
84958
85000
|
* Create an image registry protocol that resolves to multiple domains.
|
|
@@ -85102,7 +85144,7 @@ var ImageRegistriesService = class {
|
|
|
85102
85144
|
};
|
|
85103
85145
|
var IPsService = class {
|
|
85104
85146
|
static {
|
|
85105
|
-
__name$
|
|
85147
|
+
__name$1(this, "IPsService");
|
|
85106
85148
|
}
|
|
85107
85149
|
/**
|
|
85108
85150
|
* List IPs
|
|
@@ -85133,7 +85175,7 @@ var IPsService = class {
|
|
|
85133
85175
|
};
|
|
85134
85176
|
var JobsService = class {
|
|
85135
85177
|
static {
|
|
85136
|
-
__name$
|
|
85178
|
+
__name$1(this, "JobsService");
|
|
85137
85179
|
}
|
|
85138
85180
|
/**
|
|
85139
85181
|
* Application queue status
|
|
@@ -85253,7 +85295,7 @@ var JobsService = class {
|
|
|
85253
85295
|
};
|
|
85254
85296
|
var PlacementsService = class {
|
|
85255
85297
|
static {
|
|
85256
|
-
__name$
|
|
85298
|
+
__name$1(this, "PlacementsService");
|
|
85257
85299
|
}
|
|
85258
85300
|
/**
|
|
85259
85301
|
* List placements
|
|
@@ -85321,7 +85363,7 @@ var PlacementsService = class {
|
|
|
85321
85363
|
};
|
|
85322
85364
|
var RolloutsService = class {
|
|
85323
85365
|
static {
|
|
85324
|
-
__name$
|
|
85366
|
+
__name$1(this, "RolloutsService");
|
|
85325
85367
|
}
|
|
85326
85368
|
/**
|
|
85327
85369
|
* Create a new rollout for an application
|
|
@@ -85447,7 +85489,7 @@ var RolloutsService = class {
|
|
|
85447
85489
|
};
|
|
85448
85490
|
var SecretsService = class {
|
|
85449
85491
|
static {
|
|
85450
|
-
__name$
|
|
85492
|
+
__name$1(this, "SecretsService");
|
|
85451
85493
|
}
|
|
85452
85494
|
/**
|
|
85453
85495
|
* Add a new secret to the account
|
|
@@ -85543,7 +85585,7 @@ var SecretsService = class {
|
|
|
85543
85585
|
};
|
|
85544
85586
|
var SshPublicKeysService = class {
|
|
85545
85587
|
static {
|
|
85546
|
-
__name$
|
|
85588
|
+
__name$1(this, "SshPublicKeysService");
|
|
85547
85589
|
}
|
|
85548
85590
|
/**
|
|
85549
85591
|
* Add SSH public key
|
|
@@ -85600,7 +85642,7 @@ var SshPublicKeysService = class {
|
|
|
85600
85642
|
});
|
|
85601
85643
|
}
|
|
85602
85644
|
};
|
|
85603
|
-
var noop = /* @__PURE__ */ __name$
|
|
85645
|
+
var noop = /* @__PURE__ */ __name$1(() => {}, "noop");
|
|
85604
85646
|
var logger$1 = {
|
|
85605
85647
|
debug: noop,
|
|
85606
85648
|
log: noop,
|
|
@@ -85608,10 +85650,10 @@ var logger$1 = {
|
|
|
85608
85650
|
warn: noop,
|
|
85609
85651
|
error: noop
|
|
85610
85652
|
};
|
|
85611
|
-
var fetchResult$1 = /* @__PURE__ */ __name$
|
|
85653
|
+
var fetchResult$1 = /* @__PURE__ */ __name$1(() => {
|
|
85612
85654
|
throw new Error("initContainersSharedContext() must be called first");
|
|
85613
85655
|
}, "fetchResult");
|
|
85614
|
-
var fetchPagedListResult = /* @__PURE__ */ __name$
|
|
85656
|
+
var fetchPagedListResult = /* @__PURE__ */ __name$1(() => {
|
|
85615
85657
|
throw new Error("initContainersSharedContext() must be called first");
|
|
85616
85658
|
}, "fetchPagedListResult");
|
|
85617
85659
|
function initContainersSharedContext(ctx) {
|
|
@@ -85619,8 +85661,8 @@ function initContainersSharedContext(ctx) {
|
|
|
85619
85661
|
fetchResult$1 = ctx.fetchResult;
|
|
85620
85662
|
if (ctx.fetchPagedListResult !== void 0) fetchPagedListResult = ctx.fetchPagedListResult;
|
|
85621
85663
|
}
|
|
85622
|
-
__name$
|
|
85623
|
-
var getCloudflareRegistryWithAccountNamespace = /* @__PURE__ */ __name$
|
|
85664
|
+
__name$1(initContainersSharedContext, "initContainersSharedContext");
|
|
85665
|
+
var getCloudflareRegistryWithAccountNamespace = /* @__PURE__ */ __name$1((accountID, tag, complianceConfig) => {
|
|
85624
85666
|
return `${getCloudflareContainerRegistry(complianceConfig)}/${accountID}/${tag}`;
|
|
85625
85667
|
}, "getCloudflareRegistryWithAccountNamespace");
|
|
85626
85668
|
var MF_DEV_CONTAINER_PREFIX = "cloudflare-dev";
|
|
@@ -85628,8 +85670,8 @@ function getCloudflareContainerRegistry(complianceConfig = COMPLIANCE_REGION_CON
|
|
|
85628
85670
|
if (process.env.CLOUDFLARE_CONTAINER_REGISTRY) return process.env.CLOUDFLARE_CONTAINER_REGISTRY;
|
|
85629
85671
|
return `${process.env.WRANGLER_API_ENVIRONMENT === "staging" ? "staging." : ""}registry${getComplianceRegionSubdomain(complianceConfig)}.cloudflare.com`;
|
|
85630
85672
|
}
|
|
85631
|
-
__name$
|
|
85632
|
-
var getDevContainerImageName = /* @__PURE__ */ __name$
|
|
85673
|
+
__name$1(getCloudflareContainerRegistry, "getCloudflareContainerRegistry");
|
|
85674
|
+
var getDevContainerImageName = /* @__PURE__ */ __name$1((name, tag) => {
|
|
85633
85675
|
return `${MF_DEV_CONTAINER_PREFIX}/${name.toLowerCase()}:${tag}`;
|
|
85634
85676
|
}, "getDevContainerImageName");
|
|
85635
85677
|
function configureOpenAPIForContainerPull(accountId, apiToken, apiBase = "https://api.cloudflare.com/client/v4") {
|
|
@@ -85640,7 +85682,7 @@ function configureOpenAPIForContainerPull(accountId, apiToken, apiBase = "https:
|
|
|
85640
85682
|
Authorization: `Bearer ${apiToken}`
|
|
85641
85683
|
};
|
|
85642
85684
|
}
|
|
85643
|
-
__name$
|
|
85685
|
+
__name$1(configureOpenAPIForContainerPull, "configureOpenAPIForContainerPull");
|
|
85644
85686
|
async function dockerLoginImageRegistry(pathToDocker, domain$1) {
|
|
85645
85687
|
const credentials = await ImageRegistriesService.generateImageRegistryCredentials(domain$1, {
|
|
85646
85688
|
expiration_minutes: 15,
|
|
@@ -85668,8 +85710,8 @@ async function dockerLoginImageRegistry(pathToDocker, domain$1) {
|
|
|
85668
85710
|
});
|
|
85669
85711
|
});
|
|
85670
85712
|
}
|
|
85671
|
-
__name$
|
|
85672
|
-
var runDockerCmd = /* @__PURE__ */ __name$
|
|
85713
|
+
__name$1(dockerLoginImageRegistry, "dockerLoginImageRegistry");
|
|
85714
|
+
var runDockerCmd = /* @__PURE__ */ __name$1((dockerPath, args, stdio) => {
|
|
85673
85715
|
let aborted$2 = false;
|
|
85674
85716
|
let resolve2;
|
|
85675
85717
|
let reject;
|
|
@@ -85697,17 +85739,17 @@ var runDockerCmd = /* @__PURE__ */ __name$2((dockerPath, args, stdio) => {
|
|
|
85697
85739
|
}
|
|
85698
85740
|
});
|
|
85699
85741
|
return {
|
|
85700
|
-
abort: /* @__PURE__ */ __name$
|
|
85742
|
+
abort: /* @__PURE__ */ __name$1(() => {
|
|
85701
85743
|
aborted$2 = true;
|
|
85702
85744
|
child.unref();
|
|
85703
85745
|
if (child.pid !== void 0) if (process.platform === "win32") child.kill();
|
|
85704
85746
|
else process.kill(-child.pid);
|
|
85705
85747
|
}, "abort"),
|
|
85706
85748
|
ready,
|
|
85707
|
-
then: /* @__PURE__ */ __name$
|
|
85749
|
+
then: /* @__PURE__ */ __name$1(async (onResolve, onReject) => ready.then(onResolve).catch(onReject), "then")
|
|
85708
85750
|
};
|
|
85709
85751
|
}, "runDockerCmd");
|
|
85710
|
-
var runDockerCmdWithOutput = /* @__PURE__ */ __name$
|
|
85752
|
+
var runDockerCmdWithOutput = /* @__PURE__ */ __name$1((dockerPath, args) => {
|
|
85711
85753
|
try {
|
|
85712
85754
|
return execFileSync(dockerPath, args, {
|
|
85713
85755
|
encoding: "utf8",
|
|
@@ -85726,7 +85768,7 @@ async function containerPrivilegesAllowed(dockerHost, dockerPath = "docker") {
|
|
|
85726
85768
|
const localRootlessLinux = platform$1 === "linux" && existsSync("/dev/fuse") && rootless;
|
|
85727
85769
|
return localVm || localRootlessLinux;
|
|
85728
85770
|
}
|
|
85729
|
-
__name$
|
|
85771
|
+
__name$1(containerPrivilegesAllowed, "containerPrivilegesAllowed");
|
|
85730
85772
|
function isLocalDockerEndpoint(dockerHost) {
|
|
85731
85773
|
try {
|
|
85732
85774
|
const url$2 = new URL(dockerHost);
|
|
@@ -85735,7 +85777,7 @@ function isLocalDockerEndpoint(dockerHost) {
|
|
|
85735
85777
|
return false;
|
|
85736
85778
|
}
|
|
85737
85779
|
}
|
|
85738
|
-
__name$
|
|
85780
|
+
__name$1(isLocalDockerEndpoint, "isLocalDockerEndpoint");
|
|
85739
85781
|
async function getDockerSecurityOptions(dockerPath, dockerHost) {
|
|
85740
85782
|
const output$1 = await new Promise((resolve2, reject) => {
|
|
85741
85783
|
execFile(dockerPath, [
|
|
@@ -85754,12 +85796,12 @@ async function getDockerSecurityOptions(dockerPath, dockerHost) {
|
|
|
85754
85796
|
});
|
|
85755
85797
|
return JSON.parse(output$1);
|
|
85756
85798
|
}
|
|
85757
|
-
__name$
|
|
85799
|
+
__name$1(getDockerSecurityOptions, "getDockerSecurityOptions");
|
|
85758
85800
|
function detectWsl() {
|
|
85759
85801
|
return process.platform === "linux" && release().toLowerCase().includes("microsoft");
|
|
85760
85802
|
}
|
|
85761
|
-
__name$
|
|
85762
|
-
var isDockerRunning = /* @__PURE__ */ __name$
|
|
85803
|
+
__name$1(detectWsl, "detectWsl");
|
|
85804
|
+
var isDockerRunning = /* @__PURE__ */ __name$1(async (dockerPath) => {
|
|
85763
85805
|
try {
|
|
85764
85806
|
await runDockerCmd(dockerPath, ["info"], [
|
|
85765
85807
|
"inherit",
|
|
@@ -85771,7 +85813,7 @@ var isDockerRunning = /* @__PURE__ */ __name$2(async (dockerPath) => {
|
|
|
85771
85813
|
}
|
|
85772
85814
|
return true;
|
|
85773
85815
|
}, "isDockerRunning");
|
|
85774
|
-
var verifyDockerInstalled = /* @__PURE__ */ __name$
|
|
85816
|
+
var verifyDockerInstalled = /* @__PURE__ */ __name$1(async ({ dockerPath, operation, imageNoun, hint }) => {
|
|
85775
85817
|
if (!await isDockerRunning(dockerPath)) throw new UserError(getFailedToRunDockerErrorMessage({
|
|
85776
85818
|
operation,
|
|
85777
85819
|
imageNoun,
|
|
@@ -85798,11 +85840,11 @@ Note: Other container tooling that is compatible with the Docker CLI and engine
|
|
|
85798
85840
|
${hint}`;
|
|
85799
85841
|
return message;
|
|
85800
85842
|
}
|
|
85801
|
-
__name$
|
|
85843
|
+
__name$1(getFailedToRunDockerErrorMessage, "getFailedToRunDockerErrorMessage");
|
|
85802
85844
|
function generateContainerBuildId() {
|
|
85803
85845
|
return randomUUID().slice(0, 8);
|
|
85804
85846
|
}
|
|
85805
|
-
__name$
|
|
85847
|
+
__name$1(generateContainerBuildId, "generateContainerBuildId");
|
|
85806
85848
|
function getDockerSocketFromContext(dockerPath) {
|
|
85807
85849
|
try {
|
|
85808
85850
|
const currentContext = runDockerCmdWithOutput(dockerPath, [
|
|
@@ -85815,7 +85857,7 @@ function getDockerSocketFromContext(dockerPath) {
|
|
|
85815
85857
|
} catch {}
|
|
85816
85858
|
return null;
|
|
85817
85859
|
}
|
|
85818
|
-
__name$
|
|
85860
|
+
__name$1(getDockerSocketFromContext, "getDockerSocketFromContext");
|
|
85819
85861
|
function resolveDockerHost(dockerPath) {
|
|
85820
85862
|
if (process.env.WRANGLER_DOCKER_HOST) return process.env.WRANGLER_DOCKER_HOST;
|
|
85821
85863
|
if (process.env.DOCKER_HOST) return process.env.DOCKER_HOST;
|
|
@@ -85823,16 +85865,16 @@ function resolveDockerHost(dockerPath) {
|
|
|
85823
85865
|
if (contextSocket) return contextSocket;
|
|
85824
85866
|
return process.platform === "win32" ? "//./pipe/docker_engine" : "unix:///var/run/docker.sock";
|
|
85825
85867
|
}
|
|
85826
|
-
__name$
|
|
85868
|
+
__name$1(resolveDockerHost, "resolveDockerHost");
|
|
85827
85869
|
var DEFAULT_CONTAINER_EGRESS_INTERCEPTOR_IMAGE = "cloudflare/proxy-everything:3cb1195@sha256:0ef6716c52430096900b150d84a3302057d6cd2319dae7987128c85d0733e3c8";
|
|
85828
85870
|
function getEgressInterceptorPlatform() {
|
|
85829
85871
|
return process.env.MINIFLARE_CONTAINER_EGRESS_IMAGE_PLATFORM;
|
|
85830
85872
|
}
|
|
85831
|
-
__name$
|
|
85873
|
+
__name$1(getEgressInterceptorPlatform, "getEgressInterceptorPlatform");
|
|
85832
85874
|
function getEgressInterceptorImage() {
|
|
85833
85875
|
return process.env.MINIFLARE_CONTAINER_EGRESS_IMAGE ?? DEFAULT_CONTAINER_EGRESS_INTERCEPTOR_IMAGE;
|
|
85834
85876
|
}
|
|
85835
|
-
__name$
|
|
85877
|
+
__name$1(getEgressInterceptorImage, "getEgressInterceptorImage");
|
|
85836
85878
|
async function pullEgressInterceptorImage(dockerPath) {
|
|
85837
85879
|
const image = getEgressInterceptorImage();
|
|
85838
85880
|
const platform$1 = getEgressInterceptorPlatform();
|
|
@@ -85840,7 +85882,7 @@ async function pullEgressInterceptorImage(dockerPath) {
|
|
|
85840
85882
|
if (platform$1 !== void 0) args.push("--platform", platform$1);
|
|
85841
85883
|
await runDockerCmd(dockerPath, args);
|
|
85842
85884
|
}
|
|
85843
|
-
__name$
|
|
85885
|
+
__name$1(pullEgressInterceptorImage, "pullEgressInterceptorImage");
|
|
85844
85886
|
async function pullImage(dockerPath, options, logger2, complianceConfig, registryConfigureCommand) {
|
|
85845
85887
|
const domain$1 = new URL(`http://${options.image_uri}`).hostname;
|
|
85846
85888
|
const isExternalRegistry = domain$1 !== getCloudflareContainerRegistry(complianceConfig);
|
|
@@ -85867,13 +85909,13 @@ Attempting to pull image anyway...`);
|
|
|
85867
85909
|
return { aborted: aborted$2 };
|
|
85868
85910
|
});
|
|
85869
85911
|
return {
|
|
85870
|
-
abort: /* @__PURE__ */ __name$
|
|
85912
|
+
abort: /* @__PURE__ */ __name$1(() => {
|
|
85871
85913
|
pull.abort();
|
|
85872
85914
|
}, "abort"),
|
|
85873
85915
|
ready
|
|
85874
85916
|
};
|
|
85875
85917
|
}
|
|
85876
|
-
__name$
|
|
85918
|
+
__name$1(pullImage, "pullImage");
|
|
85877
85919
|
async function prepareContainerImagesForDev(args) {
|
|
85878
85920
|
const { dockerPath, containerOptions, onContainerImagePreparationStart, onContainerImagePreparationEnd } = args;
|
|
85879
85921
|
let aborted$2 = false;
|
|
@@ -85882,7 +85924,7 @@ async function prepareContainerImagesForDev(args) {
|
|
|
85882
85924
|
dockerPath,
|
|
85883
85925
|
operation: args.operation ?? "running dev",
|
|
85884
85926
|
imageNoun: containerOptions.length !== 1 ? "the configured images" : "the configured image",
|
|
85885
|
-
hint: args.
|
|
85927
|
+
hint: args.dockerUnavailableHint
|
|
85886
85928
|
});
|
|
85887
85929
|
for (const options of containerOptions) {
|
|
85888
85930
|
if ("dockerfile" in options) {
|
|
@@ -85899,7 +85941,7 @@ async function prepareContainerImagesForDev(args) {
|
|
|
85899
85941
|
});
|
|
85900
85942
|
onContainerImagePreparationStart({
|
|
85901
85943
|
containerOptions: options,
|
|
85902
|
-
abort: /* @__PURE__ */ __name$
|
|
85944
|
+
abort: /* @__PURE__ */ __name$1(() => {
|
|
85903
85945
|
aborted$2 = true;
|
|
85904
85946
|
build.abort();
|
|
85905
85947
|
}, "abort")
|
|
@@ -85910,7 +85952,7 @@ async function prepareContainerImagesForDev(args) {
|
|
|
85910
85952
|
const pull = await pullImage(dockerPath, options, args.logger, args.complianceConfig, args.registryConfigureCommand);
|
|
85911
85953
|
onContainerImagePreparationStart({
|
|
85912
85954
|
containerOptions: options,
|
|
85913
|
-
abort: /* @__PURE__ */ __name$
|
|
85955
|
+
abort: /* @__PURE__ */ __name$1(() => {
|
|
85914
85956
|
aborted$2 = true;
|
|
85915
85957
|
pull.abort();
|
|
85916
85958
|
}, "abort")
|
|
@@ -85924,7 +85966,7 @@ async function prepareContainerImagesForDev(args) {
|
|
|
85924
85966
|
if (!aborted$2) await pullEgressInterceptorImage(dockerPath);
|
|
85925
85967
|
return { aborted: aborted$2 };
|
|
85926
85968
|
}
|
|
85927
|
-
__name$
|
|
85969
|
+
__name$1(prepareContainerImagesForDev, "prepareContainerImagesForDev");
|
|
85928
85970
|
function isCloudflareRegistryImage(image, complianceConfig) {
|
|
85929
85971
|
let url$2;
|
|
85930
85972
|
try {
|
|
@@ -85932,7 +85974,7 @@ function isCloudflareRegistryImage(image, complianceConfig) {
|
|
|
85932
85974
|
} catch {}
|
|
85933
85975
|
return url$2 === void 0 || !url$2.host.match(/[:.]/) && url$2.hostname !== "localhost" || url$2.hostname === getCloudflareContainerRegistry(complianceConfig);
|
|
85934
85976
|
}
|
|
85935
|
-
__name$
|
|
85977
|
+
__name$1(isCloudflareRegistryImage, "isCloudflareRegistryImage");
|
|
85936
85978
|
function resolveImageName(accountId, image, complianceConfig) {
|
|
85937
85979
|
let url$2;
|
|
85938
85980
|
try {
|
|
@@ -85951,11 +85993,11 @@ Current account: "${accountId}"`);
|
|
|
85951
85993
|
}
|
|
85952
85994
|
return `${url$2.hostname}/${accountId}${url$2.pathname}`;
|
|
85953
85995
|
}
|
|
85954
|
-
__name$
|
|
85996
|
+
__name$1(resolveImageName, "resolveImageName");
|
|
85955
85997
|
function invalidGarCredentialError() {
|
|
85956
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" });
|
|
85957
85999
|
}
|
|
85958
|
-
__name$
|
|
86000
|
+
__name$1(invalidGarCredentialError, "invalidGarCredentialError");
|
|
85959
86001
|
function tryParseJson(value) {
|
|
85960
86002
|
try {
|
|
85961
86003
|
return JSON.parse(value);
|
|
@@ -85963,12 +86005,12 @@ function tryParseJson(value) {
|
|
|
85963
86005
|
return;
|
|
85964
86006
|
}
|
|
85965
86007
|
}
|
|
85966
|
-
__name$
|
|
86008
|
+
__name$1(tryParseJson, "tryParseJson");
|
|
85967
86009
|
function assertJsonObject(parsed) {
|
|
85968
86010
|
if (typeof parsed !== "object" || parsed === null) throw invalidGarCredentialError();
|
|
85969
86011
|
return parsed;
|
|
85970
86012
|
}
|
|
85971
|
-
__name$
|
|
86013
|
+
__name$1(assertJsonObject, "assertJsonObject");
|
|
85972
86014
|
function validateServiceAccountKey(accountKey) {
|
|
85973
86015
|
const privateKey = accountKey.private_key;
|
|
85974
86016
|
const clientEmail = accountKey.client_email;
|
|
@@ -85985,7 +86027,7 @@ function validateServiceAccountKey(accountKey) {
|
|
|
85985
86027
|
private_key_id: privateKeyId
|
|
85986
86028
|
};
|
|
85987
86029
|
}
|
|
85988
|
-
__name$
|
|
86030
|
+
__name$1(validateServiceAccountKey, "validateServiceAccountKey");
|
|
85989
86031
|
function validateAndEncodeGarKey(rawKey, expectedEmail) {
|
|
85990
86032
|
const trimmed = rawKey.trim();
|
|
85991
86033
|
let base64Key;
|
|
@@ -86005,7 +86047,7 @@ function validateAndEncodeGarKey(rawKey, expectedEmail) {
|
|
|
86005
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" });
|
|
86006
86048
|
return base64Key;
|
|
86007
86049
|
}
|
|
86008
|
-
__name$
|
|
86050
|
+
__name$1(validateAndEncodeGarKey, "validateAndEncodeGarKey");
|
|
86009
86051
|
async function dockerImageInspect(dockerPath, options) {
|
|
86010
86052
|
return new Promise((resolve2, reject) => {
|
|
86011
86053
|
const proc = spawn(dockerPath, [
|
|
@@ -86030,7 +86072,7 @@ async function dockerImageInspect(dockerPath, options) {
|
|
|
86030
86072
|
proc.on("error", (err) => reject(err));
|
|
86031
86073
|
});
|
|
86032
86074
|
}
|
|
86033
|
-
__name$
|
|
86075
|
+
__name$1(dockerImageInspect, "dockerImageInspect");
|
|
86034
86076
|
var MB = 1e3 * 1e3;
|
|
86035
86077
|
var MiB = 1024 * 1024;
|
|
86036
86078
|
var instanceTypes = {
|
|
@@ -86087,7 +86129,7 @@ function configToUsage(containerConfig) {
|
|
|
86087
86129
|
disk_mb: containerConfig.disk_bytes / MB
|
|
86088
86130
|
};
|
|
86089
86131
|
}
|
|
86090
|
-
__name$
|
|
86132
|
+
__name$1(configToUsage, "configToUsage");
|
|
86091
86133
|
function accountToLimits(account) {
|
|
86092
86134
|
return {
|
|
86093
86135
|
vcpu: account.limits.vcpu_per_deployment,
|
|
@@ -86095,15 +86137,15 @@ function accountToLimits(account) {
|
|
|
86095
86137
|
disk_mb: account.limits.disk_mb_per_deployment
|
|
86096
86138
|
};
|
|
86097
86139
|
}
|
|
86098
|
-
__name$
|
|
86140
|
+
__name$1(accountToLimits, "accountToLimits");
|
|
86099
86141
|
function getInstanceTypeUsage(instanceType) {
|
|
86100
86142
|
return instanceTypes[instanceType];
|
|
86101
86143
|
}
|
|
86102
|
-
__name$
|
|
86144
|
+
__name$1(getInstanceTypeUsage, "getInstanceTypeUsage");
|
|
86103
86145
|
function inferInstanceType(config$3) {
|
|
86104
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;
|
|
86105
86147
|
}
|
|
86106
|
-
__name$
|
|
86148
|
+
__name$1(inferInstanceType, "inferInstanceType");
|
|
86107
86149
|
function cleanForInstanceType(app) {
|
|
86108
86150
|
if (!("configuration" in app)) return app;
|
|
86109
86151
|
const instance_type = inferInstanceType(app.configuration);
|
|
@@ -86114,7 +86156,7 @@ function cleanForInstanceType(app) {
|
|
|
86114
86156
|
delete app.configuration.vcpu;
|
|
86115
86157
|
return app;
|
|
86116
86158
|
}
|
|
86117
|
-
__name$
|
|
86159
|
+
__name$1(cleanForInstanceType, "cleanForInstanceType");
|
|
86118
86160
|
async function ensureContainerLimits(options) {
|
|
86119
86161
|
const limits = accountToLimits(options.account);
|
|
86120
86162
|
if (!options.containerConfig) {
|
|
@@ -86137,7 +86179,7 @@ async function ensureContainerLimits(options) {
|
|
|
86137
86179
|
imageTag: options.imageTag
|
|
86138
86180
|
});
|
|
86139
86181
|
}
|
|
86140
|
-
__name$
|
|
86182
|
+
__name$1(ensureContainerLimits, "ensureContainerLimits");
|
|
86141
86183
|
async function ensureImageFitsLimits(options) {
|
|
86142
86184
|
const inspectOutput = await dockerImageInspect(options.pathToDocker, {
|
|
86143
86185
|
imageTag: options.imageTag,
|
|
@@ -86151,21 +86193,21 @@ async function ensureImageFitsLimits(options) {
|
|
|
86151
86193
|
logger$1.debug(`Disk size limits when building container image: availableSize=${Math.ceil(options.availableSizeInBytes / MB)}MB, requiredSize=${Math.ceil(requiredSizeInBytes / MB)}MB`);
|
|
86152
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" });
|
|
86153
86195
|
}
|
|
86154
|
-
__name$
|
|
86196
|
+
__name$1(ensureImageFitsLimits, "ensureImageFitsLimits");
|
|
86155
86197
|
async function getContainerAccount(accountId, complianceConfig) {
|
|
86156
86198
|
if (accountId === void 0) return await AccountService.getMe();
|
|
86157
86199
|
return await fetchResult$1(complianceConfig ?? {}, `/accounts/${accountId}/containers/me`);
|
|
86158
86200
|
}
|
|
86159
|
-
__name$
|
|
86201
|
+
__name$1(getContainerAccount, "getContainerAccount");
|
|
86160
86202
|
var MAX_DOCKER_REPOSITORY_NAME_LENGTH = 255;
|
|
86161
86203
|
function normalizeContainerImageRepositoryName(value) {
|
|
86162
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";
|
|
86163
86205
|
}
|
|
86164
|
-
__name$
|
|
86206
|
+
__name$1(normalizeContainerImageRepositoryName, "normalizeContainerImageRepositoryName");
|
|
86165
86207
|
function isDockerfileContainerConfig(container) {
|
|
86166
86208
|
return "dockerfile" in container;
|
|
86167
86209
|
}
|
|
86168
|
-
__name$
|
|
86210
|
+
__name$1(isDockerfileContainerConfig, "isDockerfileContainerConfig");
|
|
86169
86211
|
async function constructBuildCommand(options) {
|
|
86170
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;
|
|
86171
86213
|
const platform$1 = options.platform ?? "linux/amd64";
|
|
@@ -86189,7 +86231,7 @@ async function constructBuildCommand(options) {
|
|
|
86189
86231
|
dockerfile
|
|
86190
86232
|
};
|
|
86191
86233
|
}
|
|
86192
|
-
__name$
|
|
86234
|
+
__name$1(constructBuildCommand, "constructBuildCommand");
|
|
86193
86235
|
async function startContainerBuild({ build, pathToDocker, verifyDockerIsRunning }) {
|
|
86194
86236
|
if (process.env.WRANGLER_CONTAINER_IMAGE_COMPRESSION === "zstd") {
|
|
86195
86237
|
if (!runDockerCmdWithOutput(pathToDocker, [
|
|
@@ -86205,25 +86247,25 @@ async function startContainerBuild({ build, pathToDocker, verifyDockerIsRunning
|
|
|
86205
86247
|
verifyDockerIsRunning
|
|
86206
86248
|
});
|
|
86207
86249
|
}
|
|
86208
|
-
__name$
|
|
86250
|
+
__name$1(startContainerBuild, "startContainerBuild");
|
|
86209
86251
|
var DIGEST_SUFFIX_REGEXP = /@[A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*:[a-fA-F0-9]{32,}$/;
|
|
86210
86252
|
var DIGEST_VALUE_REGEXP = /^[A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*:[a-fA-F0-9]{32,}$/;
|
|
86211
86253
|
var TAG_SUFFIX_REGEXP = /:[\w][\w.-]{0,127}$/;
|
|
86212
86254
|
function getRepositoryOnly(externalAccountId, imageTag, complianceConfig) {
|
|
86213
86255
|
return resolveImageName(externalAccountId, imageTag, complianceConfig).replace(DIGEST_SUFFIX_REGEXP, "").replace(TAG_SUFFIX_REGEXP, "");
|
|
86214
86256
|
}
|
|
86215
|
-
__name$
|
|
86257
|
+
__name$1(getRepositoryOnly, "getRepositoryOnly");
|
|
86216
86258
|
function imageRefWithDigest(externalAccountId, imageTag, digest, complianceConfig) {
|
|
86217
86259
|
if (!DIGEST_VALUE_REGEXP.test(digest)) throw new Error(`Expected image digest to match algorithm:hex format, got ${digest}`);
|
|
86218
86260
|
return `${getRepositoryOnly(externalAccountId, imageTag, complianceConfig)}@${digest}`;
|
|
86219
86261
|
}
|
|
86220
|
-
__name$
|
|
86262
|
+
__name$1(imageRefWithDigest, "imageRefWithDigest");
|
|
86221
86263
|
function findManifestDigest(manifestOutput) {
|
|
86222
86264
|
const digest = JSON.parse(manifestOutput)?.Descriptor?.digest;
|
|
86223
86265
|
if (typeof digest !== "string" || digest.length === 0) throw new Error(`Expected docker manifest inspect output to include Descriptor.digest, got ${manifestOutput}`);
|
|
86224
86266
|
return digest;
|
|
86225
86267
|
}
|
|
86226
|
-
__name$
|
|
86268
|
+
__name$1(findManifestDigest, "findManifestDigest");
|
|
86227
86269
|
function findRemoteDigest(repoDigestsJson, externalAccountId, imageTag, complianceConfig) {
|
|
86228
86270
|
const parsedDigests = JSON.parse(repoDigestsJson);
|
|
86229
86271
|
if (!Array.isArray(parsedDigests)) throw new Error(`Expected RepoDigests from docker inspect to be an array but got ${JSON.stringify(parsedDigests)}`);
|
|
@@ -86240,11 +86282,11 @@ function findRemoteDigest(repoDigestsJson, externalAccountId, imageTag, complian
|
|
|
86240
86282
|
assertString(hash$1, `Expected digest "${digest}" to include a hash`);
|
|
86241
86283
|
return imageRefWithDigest(externalAccountId, imageTag, hash$1, complianceConfig);
|
|
86242
86284
|
}
|
|
86243
|
-
__name$
|
|
86285
|
+
__name$1(findRemoteDigest, "findRemoteDigest");
|
|
86244
86286
|
function assertString(value, message) {
|
|
86245
86287
|
if (value === void 0) throw new Error(message);
|
|
86246
86288
|
}
|
|
86247
|
-
__name$
|
|
86289
|
+
__name$1(assertString, "assertString");
|
|
86248
86290
|
async function tagAndPushImage({ pathToDocker, sourceTag, targetTag, externalAccountId, complianceConfig, cleanupSourceTag }) {
|
|
86249
86291
|
const namespacedImageTag = resolveImageName(externalAccountId, targetTag, complianceConfig);
|
|
86250
86292
|
await runDockerCmd(pathToDocker, [
|
|
@@ -86263,7 +86305,7 @@ async function tagAndPushImage({ pathToDocker, sourceTag, targetTag, externalAcc
|
|
|
86263
86305
|
}
|
|
86264
86306
|
return namespacedImageTag;
|
|
86265
86307
|
}
|
|
86266
|
-
__name$
|
|
86308
|
+
__name$1(tagAndPushImage, "tagAndPushImage");
|
|
86267
86309
|
async function pushImageIfChanged({ pathToDocker, sourceTag, targetTag, containerConfig, accountId, complianceConfig, cleanupSourceTag }) {
|
|
86268
86310
|
const imageInfo = await dockerImageInspect(pathToDocker, {
|
|
86269
86311
|
imageTag: sourceTag,
|
|
@@ -86330,7 +86372,7 @@ async function pushImageIfChanged({ pathToDocker, sourceTag, targetTag, containe
|
|
|
86330
86372
|
}
|
|
86331
86373
|
return { remoteDigest };
|
|
86332
86374
|
}
|
|
86333
|
-
__name$
|
|
86375
|
+
__name$1(pushImageIfChanged, "pushImageIfChanged");
|
|
86334
86376
|
async function buildCommand(args, complianceConfig) {
|
|
86335
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" });
|
|
86336
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" });
|
|
@@ -86360,7 +86402,7 @@ async function buildCommand(args, complianceConfig) {
|
|
|
86360
86402
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container build unknown error" });
|
|
86361
86403
|
}
|
|
86362
86404
|
}
|
|
86363
|
-
__name$
|
|
86405
|
+
__name$1(buildCommand, "buildCommand");
|
|
86364
86406
|
async function pushCommand(args, accountId, complianceConfig) {
|
|
86365
86407
|
try {
|
|
86366
86408
|
const dockerPath = args.pathToDocker ?? getDockerPath();
|
|
@@ -86379,7 +86421,7 @@ async function pushCommand(args, accountId, complianceConfig) {
|
|
|
86379
86421
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container push unknown error" });
|
|
86380
86422
|
}
|
|
86381
86423
|
}
|
|
86382
|
-
__name$
|
|
86424
|
+
__name$1(pushCommand, "pushCommand");
|
|
86383
86425
|
async function checkImagePlatform(pathToDocker, imageTag, expectedPlatform = "linux/amd64") {
|
|
86384
86426
|
const platform$1 = await dockerImageInspect(pathToDocker, {
|
|
86385
86427
|
imageTag,
|
|
@@ -86387,7 +86429,7 @@ async function checkImagePlatform(pathToDocker, imageTag, expectedPlatform = "li
|
|
|
86387
86429
|
});
|
|
86388
86430
|
if (platform$1 !== expectedPlatform) throw new Error(`Unsupported platform: Image platform (${platform$1}) does not match the expected platform (${expectedPlatform})`);
|
|
86389
86431
|
}
|
|
86390
|
-
__name$
|
|
86432
|
+
__name$1(checkImagePlatform, "checkImagePlatform");
|
|
86391
86433
|
async function buildAndMaybePush(args, pathToDocker, push, containerConfig, verifyDockerIsRunning, complianceConfig) {
|
|
86392
86434
|
try {
|
|
86393
86435
|
await (await startContainerBuild({
|
|
@@ -86412,7 +86454,7 @@ async function buildAndMaybePush(args, pathToDocker, push, containerConfig, veri
|
|
|
86412
86454
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container build unknown error" });
|
|
86413
86455
|
}
|
|
86414
86456
|
}
|
|
86415
|
-
__name$
|
|
86457
|
+
__name$1(buildAndMaybePush, "buildAndMaybePush");
|
|
86416
86458
|
async function buildContainerImage(containerConfig, pathToDocker, verifyDockerIsRunning) {
|
|
86417
86459
|
const localTag = `${getContainerImageRepositoryName(containerConfig)}:wrangler-${crypto2.randomUUID()}`;
|
|
86418
86460
|
logger$1.log("Building image", localTag);
|
|
@@ -86439,7 +86481,7 @@ async function buildContainerImage(containerConfig, pathToDocker, verifyDockerIs
|
|
|
86439
86481
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container build unknown error" });
|
|
86440
86482
|
}
|
|
86441
86483
|
}
|
|
86442
|
-
__name$
|
|
86484
|
+
__name$1(buildContainerImage, "buildContainerImage");
|
|
86443
86485
|
async function buildContainerImages(containers, pathToDocker, verifyDockerIsRunning) {
|
|
86444
86486
|
const builtImages = [];
|
|
86445
86487
|
try {
|
|
@@ -86450,7 +86492,7 @@ async function buildContainerImages(containers, pathToDocker, verifyDockerIsRunn
|
|
|
86450
86492
|
}
|
|
86451
86493
|
return builtImages;
|
|
86452
86494
|
}
|
|
86453
|
-
__name$
|
|
86495
|
+
__name$1(buildContainerImages, "buildContainerImages");
|
|
86454
86496
|
async function pushBuiltContainerImage(builtImage, versionId, pathToDocker, accountId, complianceConfig) {
|
|
86455
86497
|
try {
|
|
86456
86498
|
return await pushImageIfChanged({
|
|
@@ -86470,7 +86512,7 @@ async function pushBuiltContainerImage(builtImage, versionId, pathToDocker, acco
|
|
|
86470
86512
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container build unknown error" });
|
|
86471
86513
|
}
|
|
86472
86514
|
}
|
|
86473
|
-
__name$
|
|
86515
|
+
__name$1(pushBuiltContainerImage, "pushBuiltContainerImage");
|
|
86474
86516
|
async function cleanupBuiltImages(builtImages, pathToDocker) {
|
|
86475
86517
|
const aliasesByTag = /* @__PURE__ */ new Map();
|
|
86476
86518
|
for (const builtImage of builtImages) {
|
|
@@ -86493,15 +86535,15 @@ async function cleanupBuiltImages(builtImages, pathToDocker) {
|
|
|
86493
86535
|
for (const alias of aliases) alias.localTagCleaned = true;
|
|
86494
86536
|
}
|
|
86495
86537
|
}
|
|
86496
|
-
__name$
|
|
86538
|
+
__name$1(cleanupBuiltImages, "cleanupBuiltImages");
|
|
86497
86539
|
function getContainerImageTag(containerConfig, imageTag) {
|
|
86498
86540
|
return `${getContainerImageRepositoryName(containerConfig)}:${imageTag.split("-")[0]}`;
|
|
86499
86541
|
}
|
|
86500
|
-
__name$
|
|
86542
|
+
__name$1(getContainerImageTag, "getContainerImageTag");
|
|
86501
86543
|
function getContainerImageRepositoryName(containerConfig) {
|
|
86502
86544
|
return containerConfig.name.toLowerCase();
|
|
86503
86545
|
}
|
|
86504
|
-
__name$
|
|
86546
|
+
__name$1(getContainerImageRepositoryName, "getContainerImageRepositoryName");
|
|
86505
86547
|
async function dockerBuild(dockerPath, options) {
|
|
86506
86548
|
if (options.verifyDockerIsRunning !== false) await verifyDockerInstalled({
|
|
86507
86549
|
dockerPath,
|
|
@@ -86541,7 +86583,7 @@ async function dockerBuild(dockerPath, options) {
|
|
|
86541
86583
|
}
|
|
86542
86584
|
});
|
|
86543
86585
|
return {
|
|
86544
|
-
abort: /* @__PURE__ */ __name$
|
|
86586
|
+
abort: /* @__PURE__ */ __name$1(() => {
|
|
86545
86587
|
child.unref();
|
|
86546
86588
|
if (child.pid !== void 0) if (process.platform === "win32") child.kill();
|
|
86547
86589
|
else process.kill(-child.pid);
|
|
@@ -86549,7 +86591,7 @@ async function dockerBuild(dockerPath, options) {
|
|
|
86549
86591
|
ready
|
|
86550
86592
|
};
|
|
86551
86593
|
}
|
|
86552
|
-
__name$
|
|
86594
|
+
__name$1(dockerBuild, "dockerBuild");
|
|
86553
86595
|
function resolveInputContainerImage(options) {
|
|
86554
86596
|
if ("reference" in options.image) return { reference: options.image.reference };
|
|
86555
86597
|
const dockerfile = path__default.resolve(options.root, options.image.dockerfile);
|
|
@@ -86559,7 +86601,7 @@ function resolveInputContainerImage(options) {
|
|
|
86559
86601
|
buildVars: options.image.buildVars
|
|
86560
86602
|
};
|
|
86561
86603
|
}
|
|
86562
|
-
__name$
|
|
86604
|
+
__name$1(resolveInputContainerImage, "resolveInputContainerImage");
|
|
86563
86605
|
var BUILD_OUTPUT_IMAGE_NAMESPACE = "cloudflare-build";
|
|
86564
86606
|
var DOCKER_REPOSITORY_NAME_LENGTH = 255;
|
|
86565
86607
|
async function buildAndWriteContainerOutput(options) {
|
|
@@ -86599,7 +86641,7 @@ async function buildAndWriteContainerOutput(options) {
|
|
|
86599
86641
|
throw error$3;
|
|
86600
86642
|
}
|
|
86601
86643
|
}
|
|
86602
|
-
__name$
|
|
86644
|
+
__name$1(buildAndWriteContainerOutput, "buildAndWriteContainerOutput");
|
|
86603
86645
|
function resolveContainerDirectories(containers) {
|
|
86604
86646
|
const containerNameByDirectory = /* @__PURE__ */ new Map();
|
|
86605
86647
|
return containers.map((config$3) => {
|
|
@@ -86613,7 +86655,7 @@ function resolveContainerDirectories(containers) {
|
|
|
86613
86655
|
};
|
|
86614
86656
|
});
|
|
86615
86657
|
}
|
|
86616
|
-
__name$
|
|
86658
|
+
__name$1(resolveContainerDirectories, "resolveContainerDirectories");
|
|
86617
86659
|
async function buildContainerOutputConfig(options) {
|
|
86618
86660
|
if (options.config.schedulingPolicy === "durable-object") {
|
|
86619
86661
|
if (options.config.images === void 0) return {
|
|
@@ -86647,7 +86689,7 @@ async function buildContainerOutputConfig(options) {
|
|
|
86647
86689
|
image
|
|
86648
86690
|
};
|
|
86649
86691
|
}
|
|
86650
|
-
__name$
|
|
86692
|
+
__name$1(buildContainerOutputConfig, "buildContainerOutputConfig");
|
|
86651
86693
|
async function buildContainerImage2(options) {
|
|
86652
86694
|
const image = resolveInputContainerImage({
|
|
86653
86695
|
image: options.image,
|
|
@@ -86674,13 +86716,13 @@ async function buildContainerImage2(options) {
|
|
|
86674
86716
|
options.localTags.add(localTag);
|
|
86675
86717
|
return { localReference: localTag };
|
|
86676
86718
|
}
|
|
86677
|
-
__name$
|
|
86719
|
+
__name$1(buildContainerImage2, "buildContainerImage");
|
|
86678
86720
|
function createBuildOutputImageTag(options) {
|
|
86679
86721
|
const repositoryPrefix = getBuildOutputImageRepositoryPrefix(options.root);
|
|
86680
86722
|
const maxNameLength = DOCKER_REPOSITORY_NAME_LENGTH - repositoryPrefix.length;
|
|
86681
86723
|
return `${repositoryPrefix}${normalizeContainerImageRepositoryName(options.repositoryName).slice(0, maxNameLength).replace(/[._-]+$/g, "")}:${options.buildId}`;
|
|
86682
86724
|
}
|
|
86683
|
-
__name$
|
|
86725
|
+
__name$1(createBuildOutputImageTag, "createBuildOutputImageTag");
|
|
86684
86726
|
async function cleanupPreviousBuildOutputImageTags(options) {
|
|
86685
86727
|
const repositoryPrefix = getBuildOutputImageRepositoryPrefix(options.root);
|
|
86686
86728
|
let existingTags;
|
|
@@ -86699,26 +86741,26 @@ async function cleanupPreviousBuildOutputImageTags(options) {
|
|
|
86699
86741
|
}
|
|
86700
86742
|
if (existingTags.length > 0) await cleanupBuiltImages(existingTags.map((localTag) => ({ localTag })), options.pathToDocker);
|
|
86701
86743
|
}
|
|
86702
|
-
__name$
|
|
86744
|
+
__name$1(cleanupPreviousBuildOutputImageTags, "cleanupPreviousBuildOutputImageTags");
|
|
86703
86745
|
function getBuildOutputImageRepositoryPrefix(root) {
|
|
86704
86746
|
return `${BUILD_OUTPUT_IMAGE_NAMESPACE}/${shortHash(path__default.resolve(root))}/`;
|
|
86705
86747
|
}
|
|
86706
|
-
__name$
|
|
86748
|
+
__name$1(getBuildOutputImageRepositoryPrefix, "getBuildOutputImageRepositoryPrefix");
|
|
86707
86749
|
function shortHash(value) {
|
|
86708
86750
|
return crypto2.createHash("sha256").update(value).digest("hex").slice(0, 12);
|
|
86709
86751
|
}
|
|
86710
|
-
__name$
|
|
86752
|
+
__name$1(shortHash, "shortHash");
|
|
86711
86753
|
function createBuildId() {
|
|
86712
86754
|
return crypto2.randomUUID().replaceAll("-", "").slice(0, 12);
|
|
86713
86755
|
}
|
|
86714
|
-
__name$
|
|
86756
|
+
__name$1(createBuildId, "createBuildId");
|
|
86715
86757
|
function countDockerfiles(containers) {
|
|
86716
86758
|
let count = 0;
|
|
86717
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;
|
|
86718
86760
|
else if ("dockerfile" in config$3.image) count++;
|
|
86719
86761
|
return count;
|
|
86720
86762
|
}
|
|
86721
|
-
__name$
|
|
86763
|
+
__name$1(countDockerfiles, "countDockerfiles");
|
|
86722
86764
|
function throwBuildError(error$3) {
|
|
86723
86765
|
if (error$3 instanceof UserError) throw error$3;
|
|
86724
86766
|
if (error$3 instanceof Error) throw new UserError(error$3.message, {
|
|
@@ -86727,10 +86769,10 @@ function throwBuildError(error$3) {
|
|
|
86727
86769
|
});
|
|
86728
86770
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container build unknown error" });
|
|
86729
86771
|
}
|
|
86730
|
-
__name$
|
|
86772
|
+
__name$1(throwBuildError, "throwBuildError");
|
|
86731
86773
|
var Diff = class {
|
|
86732
86774
|
static {
|
|
86733
|
-
__name$
|
|
86775
|
+
__name$1(this, "Diff");
|
|
86734
86776
|
}
|
|
86735
86777
|
#results = [];
|
|
86736
86778
|
get changes() {
|
|
@@ -86817,15 +86859,15 @@ var Diff = class {
|
|
|
86817
86859
|
*/
|
|
86818
86860
|
get #resultsForPrint() {
|
|
86819
86861
|
const results = [...this.#results.filter((r$1) => !!r$1.value && r$1.value !== "\n")];
|
|
86820
|
-
const swapLines = /* @__PURE__ */ __name$
|
|
86862
|
+
const swapLines = /* @__PURE__ */ __name$1((i$1, j$1) => {
|
|
86821
86863
|
const current = results[i$1];
|
|
86822
86864
|
const adjacent = results[j$1];
|
|
86823
86865
|
if (current === void 0 || adjacent === void 0) return;
|
|
86824
86866
|
results[i$1] = adjacent;
|
|
86825
86867
|
results[j$1] = current;
|
|
86826
86868
|
}, "swapLines");
|
|
86827
|
-
const numOfLines = /* @__PURE__ */ __name$
|
|
86828
|
-
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) => {
|
|
86829
86871
|
const currentIdx = index;
|
|
86830
86872
|
const adjacentIdx = currentIdx + target$1;
|
|
86831
86873
|
const nextIdx = currentIdx + target$1 + target$1;
|
|
@@ -86834,7 +86876,7 @@ var Diff = class {
|
|
|
86834
86876
|
const next = results[nextIdx];
|
|
86835
86877
|
if (!current || !adjacent || !next) return false;
|
|
86836
86878
|
const previousIdx = index - target$1;
|
|
86837
|
-
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");
|
|
86838
86880
|
if (!isAlternation("added") && !isAlternation("removed")) return false;
|
|
86839
86881
|
return numOfLines(current.value ?? "") === 1 && numOfLines(adjacent.value ?? "") === 1 && numOfLines(next.value ?? "") > 1;
|
|
86840
86882
|
}, "isLoneResult");
|
|
@@ -86976,12 +87018,12 @@ function tokenize(value) {
|
|
|
86976
87018
|
}
|
|
86977
87019
|
return retLines.filter((s) => s !== "");
|
|
86978
87020
|
}
|
|
86979
|
-
__name$
|
|
87021
|
+
__name$1(tokenize, "tokenize");
|
|
86980
87022
|
function stripUndefined(r$1) {
|
|
86981
87023
|
for (const k in r$1) if (r$1[k] === void 0) delete r$1[k];
|
|
86982
87024
|
return r$1;
|
|
86983
87025
|
}
|
|
86984
|
-
__name$
|
|
87026
|
+
__name$1(stripUndefined, "stripUndefined");
|
|
86985
87027
|
function sortObjectKeys(unordered) {
|
|
86986
87028
|
if (Array.isArray(unordered)) return unordered;
|
|
86987
87029
|
return Object.keys(unordered).sort().reduce((obj, key) => {
|
|
@@ -86989,7 +87031,7 @@ function sortObjectKeys(unordered) {
|
|
|
86989
87031
|
return obj;
|
|
86990
87032
|
}, {});
|
|
86991
87033
|
}
|
|
86992
|
-
__name$
|
|
87034
|
+
__name$1(sortObjectKeys, "sortObjectKeys");
|
|
86993
87035
|
function sortObjectRecursive(object$2) {
|
|
86994
87036
|
if (typeof object$2 !== "object") return object$2;
|
|
86995
87037
|
if (Array.isArray(object$2)) return object$2.map((obj) => sortObjectRecursive(obj));
|
|
@@ -87000,7 +87042,7 @@ function sortObjectRecursive(object$2) {
|
|
|
87000
87042
|
}
|
|
87001
87043
|
return sortObjectKeys(objectCopy);
|
|
87002
87044
|
}
|
|
87003
|
-
__name$
|
|
87045
|
+
__name$1(sortObjectRecursive, "sortObjectRecursive");
|
|
87004
87046
|
async function promiseSpinner(promise$1, { message } = { message: "Loading" }) {
|
|
87005
87047
|
if (process.env.CI || !process.stdin.isTTY) return promise$1;
|
|
87006
87048
|
const { start, stop } = spinner();
|
|
@@ -87012,7 +87054,7 @@ async function promiseSpinner(promise$1, { message } = { message: "Loading" }) {
|
|
|
87012
87054
|
stop();
|
|
87013
87055
|
return t$2;
|
|
87014
87056
|
}
|
|
87015
|
-
__name$
|
|
87057
|
+
__name$1(promiseSpinner, "promiseSpinner");
|
|
87016
87058
|
function createDurableObjectNamespaceResolver(config$3, { versionId, accountId, scriptName, dispatchNamespace }) {
|
|
87017
87059
|
const boundDOs = new Set(config$3.durable_objects.bindings.map((binding) => binding.class_name));
|
|
87018
87060
|
let maybeVersionInfo;
|
|
@@ -87030,7 +87072,7 @@ function createDurableObjectNamespaceResolver(config$3, { versionId, accountId,
|
|
|
87030
87072
|
return targetDurableObject.id;
|
|
87031
87073
|
};
|
|
87032
87074
|
}
|
|
87033
|
-
__name$
|
|
87075
|
+
__name$1(createDurableObjectNamespaceResolver, "createDurableObjectNamespaceResolver");
|
|
87034
87076
|
async function deployContainers(config$3, containerDeployments, { versionId, accountId, scriptName, dispatchNamespace, configFileName: configFileName$1, observabilityTargetPercentageField, observabilityTargetCountField }) {
|
|
87035
87077
|
const resolveNamespaceId = createDurableObjectNamespaceResolver(config$3, {
|
|
87036
87078
|
versionId,
|
|
@@ -87046,7 +87088,7 @@ async function deployContainers(config$3, containerDeployments, { versionId, acc
|
|
|
87046
87088
|
observabilityTargetCountField
|
|
87047
87089
|
}, container, config$3, accountId);
|
|
87048
87090
|
}
|
|
87049
|
-
__name$
|
|
87091
|
+
__name$1(deployContainers, "deployContainers");
|
|
87050
87092
|
async function fetchUploadedVersion(config$3, accountId, scriptName, versionId) {
|
|
87051
87093
|
for (let attempt = 0; attempt < 5; attempt++) try {
|
|
87052
87094
|
return await fetchResult$1(config$3, `/accounts/${accountId}/workers/scripts/${scriptName}/versions/${versionId}`);
|
|
@@ -87056,15 +87098,15 @@ async function fetchUploadedVersion(config$3, accountId, scriptName, versionId)
|
|
|
87056
87098
|
}
|
|
87057
87099
|
throw new Error("Unable to fetch uploaded Worker version");
|
|
87058
87100
|
}
|
|
87059
|
-
__name$
|
|
87101
|
+
__name$1(fetchUploadedVersion, "fetchUploadedVersion");
|
|
87060
87102
|
function isUploadedVersionNotReadyError(error$3) {
|
|
87061
87103
|
return error$3 instanceof Error && "code" in error$3 && error$3.code === 100146;
|
|
87062
87104
|
}
|
|
87063
|
-
__name$
|
|
87105
|
+
__name$1(isUploadedVersionNotReadyError, "isUploadedVersionNotReadyError");
|
|
87064
87106
|
async function listDurableObjects(complianceConfig, accountId) {
|
|
87065
87107
|
return await fetchPagedListResult(complianceConfig, `/accounts/${accountId}/workers/durable_objects/namespaces`, {}, new URLSearchParams({ per_page: "1000" }));
|
|
87066
87108
|
}
|
|
87067
|
-
__name$
|
|
87109
|
+
__name$1(listDurableObjects, "listDurableObjects");
|
|
87068
87110
|
function mergeDeep(target$1, source) {
|
|
87069
87111
|
if (typeof target$1 !== "object" || target$1 === null) return source;
|
|
87070
87112
|
if (typeof source !== "object" || source === null) return target$1;
|
|
@@ -87077,11 +87119,11 @@ function mergeDeep(target$1, source) {
|
|
|
87077
87119
|
}
|
|
87078
87120
|
return result;
|
|
87079
87121
|
}
|
|
87080
|
-
__name$
|
|
87122
|
+
__name$1(mergeDeep, "mergeDeep");
|
|
87081
87123
|
function isObject(value) {
|
|
87082
87124
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
87083
87125
|
}
|
|
87084
|
-
__name$
|
|
87126
|
+
__name$1(isObject, "isObject");
|
|
87085
87127
|
function createApplicationToModifyApplication(req) {
|
|
87086
87128
|
return {
|
|
87087
87129
|
configuration: req.configuration,
|
|
@@ -87093,47 +87135,47 @@ function createApplicationToModifyApplication(req) {
|
|
|
87093
87135
|
rollout_active_grace_period: req.rollout_active_grace_period
|
|
87094
87136
|
};
|
|
87095
87137
|
}
|
|
87096
|
-
__name$
|
|
87138
|
+
__name$1(createApplicationToModifyApplication, "createApplicationToModifyApplication");
|
|
87097
87139
|
function isLegacyObservabilityEnabled(observability) {
|
|
87098
87140
|
return observability?.logs?.enabled === true;
|
|
87099
87141
|
}
|
|
87100
|
-
__name$
|
|
87142
|
+
__name$1(isLegacyObservabilityEnabled, "isLegacyObservabilityEnabled");
|
|
87101
87143
|
function hasLegacyRolloutObservabilityEnabled(app) {
|
|
87102
87144
|
return isLegacyObservabilityEnabled(app?.configuration.observability) || isLegacyObservabilityEnabled(app?.scheduling_hint?.target.configuration.observability);
|
|
87103
87145
|
}
|
|
87104
|
-
__name$
|
|
87146
|
+
__name$1(hasLegacyRolloutObservabilityEnabled, "hasLegacyRolloutObservabilityEnabled");
|
|
87105
87147
|
function getLatestLegacyObservabilityState(app) {
|
|
87106
87148
|
return app?.scheduling_hint?.target.configuration.observability ?? app?.configuration.observability;
|
|
87107
87149
|
}
|
|
87108
|
-
__name$
|
|
87150
|
+
__name$1(getLatestLegacyObservabilityState, "getLatestLegacyObservabilityState");
|
|
87109
87151
|
function usesTopLevelObservability(app) {
|
|
87110
87152
|
return app?.observability !== void 0;
|
|
87111
87153
|
}
|
|
87112
|
-
__name$
|
|
87154
|
+
__name$1(usesTopLevelObservability, "usesTopLevelObservability");
|
|
87113
87155
|
function hasTopLevelOnlyObservabilityFields(observability) {
|
|
87114
87156
|
return observability.target_instance_percentage !== void 0 || observability.target_instance_count !== void 0;
|
|
87115
87157
|
}
|
|
87116
|
-
__name$
|
|
87158
|
+
__name$1(hasTopLevelOnlyObservabilityFields, "hasTopLevelOnlyObservabilityFields");
|
|
87117
87159
|
function selectObservabilityWriteTarget(prevApp) {
|
|
87118
87160
|
if (prevApp === void 0) return "top-level";
|
|
87119
87161
|
if (hasLegacyRolloutObservabilityEnabled(prevApp)) return "configuration";
|
|
87120
87162
|
return "top-level";
|
|
87121
87163
|
}
|
|
87122
|
-
__name$
|
|
87164
|
+
__name$1(selectObservabilityWriteTarget, "selectObservabilityWriteTarget");
|
|
87123
87165
|
function hasMixedEnabledObservability(app) {
|
|
87124
87166
|
return app.observability?.logs?.enabled === true && isLegacyObservabilityEnabled(app.configuration.observability);
|
|
87125
87167
|
}
|
|
87126
|
-
__name$
|
|
87168
|
+
__name$1(hasMixedEnabledObservability, "hasMixedEnabledObservability");
|
|
87127
87169
|
function requiresObservabilityMigration(app, observability) {
|
|
87128
87170
|
return hasLegacyRolloutObservabilityEnabled(app) && (app.observability?.logs?.enabled === true || usesTopLevelObservability(app) && observability.logs_enabled);
|
|
87129
87171
|
}
|
|
87130
|
-
__name$
|
|
87172
|
+
__name$1(requiresObservabilityMigration, "requiresObservabilityMigration");
|
|
87131
87173
|
function buildLegacyObservabilityMigrationPatch(app) {
|
|
87132
87174
|
const observability = app.configuration.observability;
|
|
87133
87175
|
assert(observability?.logs?.enabled === true);
|
|
87134
87176
|
return { logs: observability.logs };
|
|
87135
87177
|
}
|
|
87136
|
-
__name$
|
|
87178
|
+
__name$1(buildLegacyObservabilityMigrationPatch, "buildLegacyObservabilityMigrationPatch");
|
|
87137
87179
|
function migrateLegacyObservabilityState(app, observability) {
|
|
87138
87180
|
const configuration = { ...app.configuration };
|
|
87139
87181
|
delete configuration.observability;
|
|
@@ -87143,7 +87185,7 @@ function migrateLegacyObservabilityState(app, observability) {
|
|
|
87143
87185
|
observability
|
|
87144
87186
|
};
|
|
87145
87187
|
}
|
|
87146
|
-
__name$
|
|
87188
|
+
__name$1(migrateLegacyObservabilityState, "migrateLegacyObservabilityState");
|
|
87147
87189
|
function buildTopLevelObservability(observability) {
|
|
87148
87190
|
return stripUndefined({
|
|
87149
87191
|
logs: { enabled: observability.logs_enabled },
|
|
@@ -87151,15 +87193,15 @@ function buildTopLevelObservability(observability) {
|
|
|
87151
87193
|
target_instance_count: observability.target_instance_count
|
|
87152
87194
|
});
|
|
87153
87195
|
}
|
|
87154
|
-
__name$
|
|
87196
|
+
__name$1(buildTopLevelObservability, "buildTopLevelObservability");
|
|
87155
87197
|
function buildConfigurationObservability(observability) {
|
|
87156
87198
|
return { logs: { enabled: observability.logs_enabled } };
|
|
87157
87199
|
}
|
|
87158
|
-
__name$
|
|
87200
|
+
__name$1(buildConfigurationObservability, "buildConfigurationObservability");
|
|
87159
87201
|
function isSameApplicationObservability(left, right) {
|
|
87160
87202
|
return left?.logs?.enabled === right?.logs?.enabled && left?.target_instance_percentage === right?.target_instance_percentage && left?.target_instance_count === right?.target_instance_count;
|
|
87161
87203
|
}
|
|
87162
|
-
__name$
|
|
87204
|
+
__name$1(isSameApplicationObservability, "isSameApplicationObservability");
|
|
87163
87205
|
function buildTopLevelObservabilityPatch(observability, prevApp, writeTarget) {
|
|
87164
87206
|
if (writeTarget === "configuration" && !usesTopLevelObservability(prevApp)) return;
|
|
87165
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);
|
|
@@ -87167,14 +87209,14 @@ function buildTopLevelObservabilityPatch(observability, prevApp, writeTarget) {
|
|
|
87167
87209
|
const nextObservability = buildTopLevelObservability(observability);
|
|
87168
87210
|
return isSameApplicationObservability(nextObservability, prevApp?.observability) ? void 0 : nextObservability;
|
|
87169
87211
|
}
|
|
87170
|
-
__name$
|
|
87212
|
+
__name$1(buildTopLevelObservabilityPatch, "buildTopLevelObservabilityPatch");
|
|
87171
87213
|
function buildConfigurationObservabilityPatch(observability, prevApp) {
|
|
87172
87214
|
const latestLegacyLogsEnabled = getLatestLegacyObservabilityState(prevApp)?.logs?.enabled;
|
|
87173
87215
|
if (observability.logs_enabled === latestLegacyLogsEnabled) return;
|
|
87174
87216
|
if (!observability.logs_enabled && latestLegacyLogsEnabled === void 0) return;
|
|
87175
87217
|
return buildConfigurationObservability(observability);
|
|
87176
87218
|
}
|
|
87177
|
-
__name$
|
|
87219
|
+
__name$1(buildConfigurationObservabilityPatch, "buildConfigurationObservabilityPatch");
|
|
87178
87220
|
function buildApplicationObservabilityPatch(observability, writeTarget, prevApp) {
|
|
87179
87221
|
const nextTopLevelObservability = buildTopLevelObservabilityPatch(observability, prevApp, writeTarget);
|
|
87180
87222
|
if (writeTarget === "configuration") {
|
|
@@ -87186,13 +87228,13 @@ function buildApplicationObservabilityPatch(observability, writeTarget, prevApp)
|
|
|
87186
87228
|
}
|
|
87187
87229
|
return nextTopLevelObservability !== void 0 ? { observability: nextTopLevelObservability } : {};
|
|
87188
87230
|
}
|
|
87189
|
-
__name$
|
|
87231
|
+
__name$1(buildApplicationObservabilityPatch, "buildApplicationObservabilityPatch");
|
|
87190
87232
|
function assertCanUseApplicationObservabilityTargeting(prevApp, containerConfig, options) {
|
|
87191
87233
|
if (!hasTopLevelOnlyObservabilityFields(containerConfig.observability)) return;
|
|
87192
87234
|
if (!hasLegacyRolloutObservabilityEnabled(prevApp)) return;
|
|
87193
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" });
|
|
87194
87236
|
}
|
|
87195
|
-
__name$
|
|
87237
|
+
__name$1(assertCanUseApplicationObservabilityTargeting, "assertCanUseApplicationObservabilityTargeting");
|
|
87196
87238
|
function hasRolloutDiff(prevApp, nextApp) {
|
|
87197
87239
|
const normalizedPrevApp = stripUndefined({ ...prevApp });
|
|
87198
87240
|
const normalizedNextApp = stripUndefined({ ...nextApp });
|
|
@@ -87200,7 +87242,7 @@ function hasRolloutDiff(prevApp, nextApp) {
|
|
|
87200
87242
|
delete normalizedNextApp.observability;
|
|
87201
87243
|
return JSON.stringify(sortObjectRecursive(normalizedPrevApp)) !== JSON.stringify(sortObjectRecursive(normalizedNextApp));
|
|
87202
87244
|
}
|
|
87203
|
-
__name$
|
|
87245
|
+
__name$1(hasRolloutDiff, "hasRolloutDiff");
|
|
87204
87246
|
function containerConfigToCreateRequest(accountId, containerApp, imageRef, durableObjectNamespaceId, complianceConfig, observabilityWriteTarget, prevApp) {
|
|
87205
87247
|
const { observability, configurationObservability } = buildApplicationObservabilityPatch(containerApp.observability, observabilityWriteTarget, prevApp);
|
|
87206
87248
|
return {
|
|
@@ -87227,7 +87269,7 @@ function containerConfigToCreateRequest(accountId, containerApp, imageRef, durab
|
|
|
87227
87269
|
rollout_active_grace_period: containerApp.rollout_active_grace_period
|
|
87228
87270
|
};
|
|
87229
87271
|
}
|
|
87230
|
-
__name$
|
|
87272
|
+
__name$1(containerConfigToCreateRequest, "containerConfigToCreateRequest");
|
|
87231
87273
|
function formatContainerSnippetForDisplay(container, configPath) {
|
|
87232
87274
|
const configurationForDisplay = container.configuration === void 0 ? void 0 : Object.fromEntries(Object.entries(container.configuration).map(([key, value]) => [key === "wrangler_ssh" ? "ssh" : key, value]));
|
|
87233
87275
|
return formatConfigSnippet({ containers: [{
|
|
@@ -87235,7 +87277,7 @@ function formatContainerSnippetForDisplay(container, configPath) {
|
|
|
87235
87277
|
configuration: configurationForDisplay
|
|
87236
87278
|
}] }, configPath);
|
|
87237
87279
|
}
|
|
87238
|
-
__name$
|
|
87280
|
+
__name$1(formatContainerSnippetForDisplay, "formatContainerSnippetForDisplay");
|
|
87239
87281
|
async function apply(args, containerConfig, config$3, accountId) {
|
|
87240
87282
|
if (!config$3.containers || config$3.containers.length === 0) return;
|
|
87241
87283
|
startSection("Deploy a container application", "deploy changes to your application");
|
|
@@ -87313,7 +87355,7 @@ async function apply(args, containerConfig, config$3, accountId) {
|
|
|
87313
87355
|
newline();
|
|
87314
87356
|
endSection("Applied changes");
|
|
87315
87357
|
}
|
|
87316
|
-
__name$
|
|
87358
|
+
__name$1(apply, "apply");
|
|
87317
87359
|
function mergeIfUnsafe(fullConfig, containerConfig, name) {
|
|
87318
87360
|
const unsafeContainerConfig = fullConfig.containers?.find((original) => {
|
|
87319
87361
|
return original.name === name && original.unsafe !== void 0;
|
|
@@ -87321,7 +87363,7 @@ function mergeIfUnsafe(fullConfig, containerConfig, name) {
|
|
|
87321
87363
|
if (unsafeContainerConfig) return mergeDeep(containerConfig, unsafeContainerConfig.unsafe);
|
|
87322
87364
|
else return containerConfig;
|
|
87323
87365
|
}
|
|
87324
|
-
__name$
|
|
87366
|
+
__name$1(mergeIfUnsafe, "mergeIfUnsafe");
|
|
87325
87367
|
function formatError(err) {
|
|
87326
87368
|
try {
|
|
87327
87369
|
const maybeError = JSON.parse(err.body.error);
|
|
@@ -87334,8 +87376,8 @@ function formatError(err) {
|
|
|
87334
87376
|
} catch {}
|
|
87335
87377
|
return JSON.stringify(err.body);
|
|
87336
87378
|
}
|
|
87337
|
-
__name$
|
|
87338
|
-
var doAction = /* @__PURE__ */ __name$
|
|
87379
|
+
__name$1(formatError, "formatError");
|
|
87380
|
+
var doAction = /* @__PURE__ */ __name$1(async (action) => {
|
|
87339
87381
|
if (action.action === "create") {
|
|
87340
87382
|
let application;
|
|
87341
87383
|
try {
|
|
@@ -87411,8 +87453,8 @@ function cleanApplicationFromAPI(prev, currentConfig, accountId, observabilityWr
|
|
|
87411
87453
|
}
|
|
87412
87454
|
return cleanedPreviousApp;
|
|
87413
87455
|
}
|
|
87414
|
-
__name$
|
|
87415
|
-
var configRolloutStepsToAPI = /* @__PURE__ */ __name$
|
|
87456
|
+
__name$1(cleanApplicationFromAPI, "cleanApplicationFromAPI");
|
|
87457
|
+
var configRolloutStepsToAPI = /* @__PURE__ */ __name$1((rolloutSteps) => {
|
|
87416
87458
|
if (typeof rolloutSteps === "number") return { step_percentage: rolloutSteps };
|
|
87417
87459
|
else {
|
|
87418
87460
|
const output$1 = [];
|
|
@@ -87436,16 +87478,16 @@ function getNamedContainerImageTag(className, imageName, containerBuildId) {
|
|
|
87436
87478
|
const identityHash = createHash("sha256").update(identity).digest("hex").slice(0, IMAGE_ID_HASH_LENGTH);
|
|
87437
87479
|
return getDevContainerImageName(`${`${classSlug || "container"}-${imageSlug || "image"}`.slice(0, MAX_NAMED_IMAGE_SLUG_LENGTH - identityHash.length - 1).replace(/-+$/g, "")}-${identityHash}`, containerBuildId);
|
|
87438
87480
|
}
|
|
87439
|
-
__name$
|
|
87481
|
+
__name$1(getNamedContainerImageTag, "getNamedContainerImageTag");
|
|
87440
87482
|
function getDockerRepositorySlug(value) {
|
|
87441
87483
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
87442
87484
|
}
|
|
87443
|
-
__name$
|
|
87485
|
+
__name$1(getDockerRepositorySlug, "getDockerRepositorySlug");
|
|
87444
87486
|
function requireContainerBuildId(containerBuildId) {
|
|
87445
87487
|
if (containerBuildId === void 0) throw new Error("Build ID should be set when a Container image requires preparation");
|
|
87446
87488
|
return containerBuildId;
|
|
87447
87489
|
}
|
|
87448
|
-
__name$
|
|
87490
|
+
__name$1(requireContainerBuildId, "requireContainerBuildId");
|
|
87449
87491
|
function createContainerDevPlan(options) {
|
|
87450
87492
|
const { containers, exports: exports$1, containerBuildId, configPath } = options;
|
|
87451
87493
|
if (!containers?.length) return;
|
|
@@ -87509,13 +87551,13 @@ function createContainerDevPlan(options) {
|
|
|
87509
87551
|
containerRuntimeOptions
|
|
87510
87552
|
};
|
|
87511
87553
|
}
|
|
87512
|
-
__name$
|
|
87554
|
+
__name$1(createContainerDevPlan, "createContainerDevPlan");
|
|
87513
87555
|
function createContainerDevPlanForCfConfig(options) {
|
|
87514
87556
|
return createContainerPlanForCfConfig({
|
|
87515
87557
|
containers: options.containers,
|
|
87516
87558
|
exports: options.exports,
|
|
87517
87559
|
containerDescription: "Container",
|
|
87518
|
-
createImagePlan: /* @__PURE__ */ __name$
|
|
87560
|
+
createImagePlan: /* @__PURE__ */ __name$1(({ image, className, imageName }) => {
|
|
87519
87561
|
const buildId = requireContainerBuildId(options.containerBuildId);
|
|
87520
87562
|
const imageTag = imageName === void 0 ? getDevContainerImageName(className, buildId) : getNamedContainerImageTag(className, imageName, buildId);
|
|
87521
87563
|
const resolvedImage = resolveInputContainerImage({
|
|
@@ -87542,13 +87584,13 @@ function createContainerDevPlanForCfConfig(options) {
|
|
|
87542
87584
|
}, "createImagePlan")
|
|
87543
87585
|
});
|
|
87544
87586
|
}
|
|
87545
|
-
__name$
|
|
87587
|
+
__name$1(createContainerDevPlanForCfConfig, "createContainerDevPlanForCfConfig");
|
|
87546
87588
|
function createContainerPreviewPlanForCfConfig(options) {
|
|
87547
87589
|
return createContainerPlanForCfConfig({
|
|
87548
87590
|
containers: options.containers,
|
|
87549
87591
|
exports: options.exports,
|
|
87550
87592
|
containerDescription: "Build Output Container",
|
|
87551
|
-
createImagePlan: /* @__PURE__ */ __name$
|
|
87593
|
+
createImagePlan: /* @__PURE__ */ __name$1(({ image, className, imageName }) => {
|
|
87552
87594
|
const reference = "reference" in image ? image.reference : image.localReference;
|
|
87553
87595
|
if (!("reference" in image)) return { reference };
|
|
87554
87596
|
return {
|
|
@@ -87563,7 +87605,21 @@ function createContainerPreviewPlanForCfConfig(options) {
|
|
|
87563
87605
|
}, "createImagePlan")
|
|
87564
87606
|
});
|
|
87565
87607
|
}
|
|
87566
|
-
__name$
|
|
87608
|
+
__name$1(createContainerPreviewPlanForCfConfig, "createContainerPreviewPlanForCfConfig");
|
|
87609
|
+
function createMiniflareExports(options) {
|
|
87610
|
+
const workerExports = {};
|
|
87611
|
+
for (const [name, workerExport] of Object.entries(options.exports ?? {})) if (workerExport.type === "durable-object" && "storage" in workerExport) {
|
|
87612
|
+
const containerName = "container" in workerExport ? workerExport.container : void 0;
|
|
87613
|
+
const container = containerName === void 0 ? void 0 : options.containerRuntimeOptions?.get(name);
|
|
87614
|
+
assert(containerName === void 0 || container !== void 0, `Expected runtime options for Container-backed Durable Object export "${name}".`);
|
|
87615
|
+
workerExports[name] = {
|
|
87616
|
+
...workerExport,
|
|
87617
|
+
container
|
|
87618
|
+
};
|
|
87619
|
+
} else workerExports[name] = workerExport;
|
|
87620
|
+
return workerExports;
|
|
87621
|
+
}
|
|
87622
|
+
__name$1(createMiniflareExports, "createMiniflareExports");
|
|
87567
87623
|
function createContainerPlanForCfConfig(options) {
|
|
87568
87624
|
const containersByName = indexContainersByName(options.containers);
|
|
87569
87625
|
const containerOptions = [];
|
|
@@ -87599,7 +87655,7 @@ function createContainerPlanForCfConfig(options) {
|
|
|
87599
87655
|
containerRuntimeOptions
|
|
87600
87656
|
};
|
|
87601
87657
|
}
|
|
87602
|
-
__name$
|
|
87658
|
+
__name$1(createContainerPlanForCfConfig, "createContainerPlanForCfConfig");
|
|
87603
87659
|
function getContainerLinks(exports$1) {
|
|
87604
87660
|
const links = [];
|
|
87605
87661
|
for (const [className, workerExport] of Object.entries(exports$1 ?? {})) {
|
|
@@ -87608,7 +87664,7 @@ function getContainerLinks(exports$1) {
|
|
|
87608
87664
|
}
|
|
87609
87665
|
return links;
|
|
87610
87666
|
}
|
|
87611
|
-
__name$
|
|
87667
|
+
__name$1(getContainerLinks, "getContainerLinks");
|
|
87612
87668
|
function indexContainersByName(containers) {
|
|
87613
87669
|
const containersByName = /* @__PURE__ */ new Map();
|
|
87614
87670
|
for (const container of containers) {
|
|
@@ -87617,7 +87673,7 @@ function indexContainersByName(containers) {
|
|
|
87617
87673
|
}
|
|
87618
87674
|
return containersByName;
|
|
87619
87675
|
}
|
|
87620
|
-
__name$
|
|
87676
|
+
__name$1(indexContainersByName, "indexContainersByName");
|
|
87621
87677
|
__toESM(require_stream());
|
|
87622
87678
|
__toESM(require_extension());
|
|
87623
87679
|
__toESM(require_permessage_deflate());
|
|
@@ -87697,7 +87753,7 @@ async function sshCommand(sshArgs, userAgent) {
|
|
|
87697
87753
|
else ws.close();
|
|
87698
87754
|
}
|
|
87699
87755
|
}
|
|
87700
|
-
__name$
|
|
87756
|
+
__name$1(sshCommand, "sshCommand");
|
|
87701
87757
|
function verifySshInstalled(sshPath) {
|
|
87702
87758
|
return new Promise((resolve2, reject) => {
|
|
87703
87759
|
const child = spawn(sshPath, ["-V"]);
|
|
@@ -87717,7 +87773,7 @@ function verifySshInstalled(sshPath) {
|
|
|
87717
87773
|
});
|
|
87718
87774
|
});
|
|
87719
87775
|
}
|
|
87720
|
-
__name$
|
|
87776
|
+
__name$1(verifySshInstalled, "verifySshInstalled");
|
|
87721
87777
|
function tcpProxy(ws) {
|
|
87722
87778
|
let inbound;
|
|
87723
87779
|
const pending = [];
|
|
@@ -87732,7 +87788,7 @@ function tcpProxy(ws) {
|
|
|
87732
87788
|
ws.close();
|
|
87733
87789
|
proxy.close();
|
|
87734
87790
|
});
|
|
87735
|
-
const start = /* @__PURE__ */ __name$
|
|
87791
|
+
const start = /* @__PURE__ */ __name$1(() => socket.on("data", (data$1) => ws.send(data$1)), "start");
|
|
87736
87792
|
if (ws.readyState === import_websocket.default.OPEN) start();
|
|
87737
87793
|
else if (ws.readyState === import_websocket.default.CONNECTING) ws.once("open", start);
|
|
87738
87794
|
else socket.end();
|
|
@@ -87755,16 +87811,16 @@ function tcpProxy(ws) {
|
|
|
87755
87811
|
});
|
|
87756
87812
|
return proxy;
|
|
87757
87813
|
}
|
|
87758
|
-
__name$
|
|
87814
|
+
__name$1(tcpProxy, "tcpProxy");
|
|
87759
87815
|
function stdioProxy(ws) {
|
|
87760
87816
|
return new Promise((resolve2, reject) => {
|
|
87761
|
-
const onData = /* @__PURE__ */ __name$
|
|
87762
|
-
const onEnd = /* @__PURE__ */ __name$
|
|
87763
|
-
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) => {
|
|
87764
87820
|
ws.close();
|
|
87765
87821
|
reject(err);
|
|
87766
87822
|
}, "onError");
|
|
87767
|
-
const cleanup = /* @__PURE__ */ __name$
|
|
87823
|
+
const cleanup = /* @__PURE__ */ __name$1(() => {
|
|
87768
87824
|
process.stdin.pause();
|
|
87769
87825
|
process.stdin.off("data", onData);
|
|
87770
87826
|
process.stdin.off("end", onEnd);
|
|
@@ -87789,16 +87845,16 @@ function stdioProxy(ws) {
|
|
|
87789
87845
|
});
|
|
87790
87846
|
});
|
|
87791
87847
|
}
|
|
87792
|
-
__name$
|
|
87848
|
+
__name$1(stdioProxy, "stdioProxy");
|
|
87793
87849
|
function formatWebSocketData(data$1) {
|
|
87794
87850
|
if (Array.isArray(data$1)) return Buffer.concat(data$1);
|
|
87795
87851
|
return data$1 instanceof ArrayBuffer ? new Uint8Array(data$1) : data$1;
|
|
87796
87852
|
}
|
|
87797
|
-
__name$
|
|
87853
|
+
__name$1(formatWebSocketData, "formatWebSocketData");
|
|
87798
87854
|
function shouldUseStdio(sshArgs) {
|
|
87799
87855
|
return sshArgs.stdio === true || sshArgs.tty !== true && process.stdin.isTTY !== true && process.stdout.isTTY !== true;
|
|
87800
87856
|
}
|
|
87801
|
-
__name$
|
|
87857
|
+
__name$1(shouldUseStdio, "shouldUseStdio");
|
|
87802
87858
|
function buildContainerSshArgs(sshArgs) {
|
|
87803
87859
|
const flags = [
|
|
87804
87860
|
"-o",
|
|
@@ -87824,7 +87880,7 @@ function buildContainerSshArgs(sshArgs) {
|
|
|
87824
87880
|
if (sshArgs.tag !== void 0) flags.push("-P", sshArgs.tag);
|
|
87825
87881
|
return flags;
|
|
87826
87882
|
}
|
|
87827
|
-
__name$
|
|
87883
|
+
__name$1(buildContainerSshArgs, "buildContainerSshArgs");
|
|
87828
87884
|
var MAX_REPOSITORY_LENGTH = 255;
|
|
87829
87885
|
var REPOSITORY_COMPONENT_REGEXP = /^[a-z0-9]+(?:(?:[._]|__|-+)[a-z0-9]+)*$/;
|
|
87830
87886
|
var TAG_REGEXP = /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$/;
|
|
@@ -87844,7 +87900,7 @@ async function listContainerImages({ accountId, complianceConfig, filter }) {
|
|
|
87844
87900
|
}];
|
|
87845
87901
|
});
|
|
87846
87902
|
}
|
|
87847
|
-
__name$
|
|
87903
|
+
__name$1(listContainerImages, "listContainerImages");
|
|
87848
87904
|
function parseContainerImageTag(image) {
|
|
87849
87905
|
const parts = image.split(":");
|
|
87850
87906
|
const [repository, tag] = parts;
|
|
@@ -87854,7 +87910,7 @@ function parseContainerImageTag(image) {
|
|
|
87854
87910
|
tag
|
|
87855
87911
|
};
|
|
87856
87912
|
}
|
|
87857
|
-
__name$
|
|
87913
|
+
__name$1(parseContainerImageTag, "parseContainerImageTag");
|
|
87858
87914
|
async function deleteContainerImage({ accountId, complianceConfig, image }) {
|
|
87859
87915
|
const { repository, tag } = parseContainerImageTag(image);
|
|
87860
87916
|
const creds = await getCreds(["pull", "push"], complianceConfig);
|
|
@@ -87878,7 +87934,7 @@ async function deleteContainerImage({ accountId, complianceConfig, image }) {
|
|
|
87878
87934
|
}
|
|
87879
87935
|
return { digest };
|
|
87880
87936
|
}
|
|
87881
|
-
__name$
|
|
87937
|
+
__name$1(deleteContainerImage, "deleteContainerImage");
|
|
87882
87938
|
async function listReposWithTags(creds, complianceConfig) {
|
|
87883
87939
|
const url$2 = new URL(`https://${getCloudflareContainerRegistry(complianceConfig)}`);
|
|
87884
87940
|
const catalogUrl = `${url$2.protocol}//${url$2.host}/v2/_catalog?tags=true`;
|
|
@@ -87907,7 +87963,7 @@ async function listReposWithTags(creds, complianceConfig) {
|
|
|
87907
87963
|
}
|
|
87908
87964
|
return Object.fromEntries([...repositories].map(([repository, tags]) => [repository, [...tags]]));
|
|
87909
87965
|
}
|
|
87910
|
-
__name$
|
|
87966
|
+
__name$1(listReposWithTags, "listReposWithTags");
|
|
87911
87967
|
function nextCatalogCursor(header, baseUrl) {
|
|
87912
87968
|
if (!header) return;
|
|
87913
87969
|
const links = header.matchAll(/(?:^|,)\s*(?:<([^>]+)>|([^;,\s]+))((?:;[^,]*)?)/g);
|
|
@@ -87921,7 +87977,7 @@ function nextCatalogCursor(header, baseUrl) {
|
|
|
87921
87977
|
return cursor$1;
|
|
87922
87978
|
}
|
|
87923
87979
|
}
|
|
87924
|
-
__name$
|
|
87980
|
+
__name$1(nextCatalogCursor, "nextCatalogCursor");
|
|
87925
87981
|
async function deleteTag(baseUrl, accountId, image, tag, creds) {
|
|
87926
87982
|
const manifestAcceptHeader = "application/vnd.oci.image.manifest.v1+json, application/vnd.docker.distribution.manifest.v2+json";
|
|
87927
87983
|
const manifestUrl = `${baseUrl}/v2/${accountId}/${image}/manifests/${tag}`;
|
|
@@ -87946,7 +88002,7 @@ async function deleteTag(baseUrl, accountId, image, tag, creds) {
|
|
|
87946
88002
|
if (!deleteResponse.ok) throw new Error(`Failed to delete ${image}:${tag} (digest: ${digest}): ${deleteResponse.status} ${deleteResponse.statusText}`);
|
|
87947
88003
|
return digest;
|
|
87948
88004
|
}
|
|
87949
|
-
__name$
|
|
88005
|
+
__name$1(deleteTag, "deleteTag");
|
|
87950
88006
|
async function getCreds(permissions, complianceConfig) {
|
|
87951
88007
|
const credentials = await ImageRegistriesService.generateImageRegistryCredentials(getCloudflareContainerRegistry(complianceConfig), {
|
|
87952
88008
|
expiration_minutes: 5,
|
|
@@ -87954,11 +88010,83 @@ async function getCreds(permissions, complianceConfig) {
|
|
|
87954
88010
|
});
|
|
87955
88011
|
return Buffer.from(`v1:${credentials.password}`).toString("base64");
|
|
87956
88012
|
}
|
|
87957
|
-
__name$
|
|
88013
|
+
__name$1(getCreds, "getCreds");
|
|
87958
88014
|
function isValidImageTag(value) {
|
|
87959
88015
|
return IMAGE_TAG_REGEXP.test(value);
|
|
87960
88016
|
}
|
|
87961
|
-
__name$
|
|
88017
|
+
__name$1(isValidImageTag, "isValidImageTag");
|
|
88018
|
+
|
|
88019
|
+
//#endregion
|
|
88020
|
+
//#region src/build.ts
|
|
88021
|
+
var import_picocolors$4 = /* @__PURE__ */ __toESM$2(require_picocolors(), 1);
|
|
88022
|
+
const CLIENT_FALLBACK_ENTRY_NAME = "__cloudflare_fallback_entry__";
|
|
88023
|
+
/** Build the remaining Worker and client environments and transfer imported assets. */
|
|
88024
|
+
async function buildApp(builder, resolvedPluginConfig, environmentNameToImportedAssetPaths) {
|
|
88025
|
+
const clientEnvironment = builder.environments.client;
|
|
88026
|
+
assert(clientEnvironment, `No "client" environment`);
|
|
88027
|
+
const defaultHtmlPath = path.resolve(builder.config.root, "index.html");
|
|
88028
|
+
const hasClientEntry = clientEnvironment.config.build.rollupOptions.input || fs$3.existsSync(defaultHtmlPath);
|
|
88029
|
+
const workerEnvironments = [...resolvedPluginConfig.environmentNameToWorkerMap.entries()].filter(([_, worker]) => !resolveDevOnly(worker.devOnly)).map(([environmentName]) => {
|
|
88030
|
+
const environment = builder.environments[environmentName];
|
|
88031
|
+
assert(environment, `"${environmentName}" environment not found`);
|
|
88032
|
+
return environment;
|
|
88033
|
+
});
|
|
88034
|
+
await Promise.all(workerEnvironments.filter((environment) => !environment.isBuilt).map((environment) => builder.build(environment)));
|
|
88035
|
+
const assetEnvironments = workerEnvironments.filter((environment) => environment.name === resolvedPluginConfig.prerenderWorkerEnvironmentName || resolvedPluginConfig.type === "workers" && environment.name === resolvedPluginConfig.entryWorkerEnvironmentName).flatMap((environment) => {
|
|
88036
|
+
return [environment, ...(resolvedPluginConfig.environmentNameToChildEnvironmentNamesMap.get(environment.name) ?? []).map((name) => {
|
|
88037
|
+
const childEnvironment = builder.environments[name];
|
|
88038
|
+
assert(childEnvironment, `"${name}" environment not found`);
|
|
88039
|
+
return childEnvironment;
|
|
88040
|
+
}).filter((childEnvironment) => childEnvironment.isBuilt)].map((assetEnvironment) => ({
|
|
88041
|
+
environment: assetEnvironment,
|
|
88042
|
+
preserveOriginalAssets: environment.name === resolvedPluginConfig.prerenderWorkerEnvironmentName
|
|
88043
|
+
}));
|
|
88044
|
+
});
|
|
88045
|
+
if (!clientEnvironment.isBuilt) {
|
|
88046
|
+
if (hasClientEntry) await builder.build(clientEnvironment);
|
|
88047
|
+
else if (assetEnvironments.some(({ environment }) => environmentNameToImportedAssetPaths.get(environment.name)?.size) || getHasPublicAssets(builder.config) || resolvedPluginConfig.prerenderWorkerEnvironmentName) await fallbackBuild(builder, clientEnvironment);
|
|
88048
|
+
}
|
|
88049
|
+
if (!clientEnvironment.isBuilt) return;
|
|
88050
|
+
const clientBuildDirectory = path.resolve(builder.config.root, clientEnvironment.config.build.outDir);
|
|
88051
|
+
for (const { environment, preserveOriginalAssets } of assetEnvironments) {
|
|
88052
|
+
const importedAssetPaths = environmentNameToImportedAssetPaths.get(environment.name);
|
|
88053
|
+
if (!importedAssetPaths?.size) continue;
|
|
88054
|
+
const workerBuildDirectory = path.resolve(builder.config.root, environment.config.build.outDir);
|
|
88055
|
+
const transferredAssetPaths = [];
|
|
88056
|
+
for (const assetPath of importedAssetPaths) {
|
|
88057
|
+
const src$1 = path.join(workerBuildDirectory, assetPath);
|
|
88058
|
+
const dest = path.join(clientBuildDirectory, assetPath);
|
|
88059
|
+
if (!fs$3.existsSync(src$1)) continue;
|
|
88060
|
+
if (fs$3.existsSync(dest)) {
|
|
88061
|
+
if (!preserveOriginalAssets) fs$3.unlinkSync(src$1);
|
|
88062
|
+
} else {
|
|
88063
|
+
const destDir = path.dirname(dest);
|
|
88064
|
+
fs$3.mkdirSync(destDir, { recursive: true });
|
|
88065
|
+
if (preserveOriginalAssets) fs$3.copyFileSync(src$1, dest);
|
|
88066
|
+
else fs$3.renameSync(src$1, dest);
|
|
88067
|
+
transferredAssetPaths.push(dest);
|
|
88068
|
+
}
|
|
88069
|
+
}
|
|
88070
|
+
if (transferredAssetPaths.length) builder.config.logger.info([`${import_picocolors$4.default.green("✓")} ${transferredAssetPaths.length} asset${transferredAssetPaths.length > 1 ? "s" : ""} ${preserveOriginalAssets ? "copied" : "moved"} from "${environment.name}" to "client" build output.`, ...transferredAssetPaths.map((assetPath) => import_picocolors$4.default.dim(path.relative(builder.config.root, assetPath)))].join("\n"));
|
|
88071
|
+
}
|
|
88072
|
+
}
|
|
88073
|
+
function getHasPublicAssets({ publicDir }) {
|
|
88074
|
+
let hasPublicAssets = false;
|
|
88075
|
+
if (publicDir) try {
|
|
88076
|
+
if (fs$3.readdirSync(publicDir).length) hasPublicAssets = true;
|
|
88077
|
+
} catch {}
|
|
88078
|
+
return hasPublicAssets;
|
|
88079
|
+
}
|
|
88080
|
+
async function fallbackBuild(builder, environment) {
|
|
88081
|
+
environment.config.build.rollupOptions = {
|
|
88082
|
+
input: VIRTUAL_CLIENT_FALLBACK_ENTRY,
|
|
88083
|
+
logLevel: "silent",
|
|
88084
|
+
output: { entryFileNames: CLIENT_FALLBACK_ENTRY_NAME }
|
|
88085
|
+
};
|
|
88086
|
+
await builder.build(environment);
|
|
88087
|
+
const fallbackEntryPath = path.resolve(builder.config.root, environment.config.build.outDir, CLIENT_FALLBACK_ENTRY_NAME);
|
|
88088
|
+
fs$3.unlinkSync(fallbackEntryPath);
|
|
88089
|
+
}
|
|
87962
88090
|
|
|
87963
88091
|
//#endregion
|
|
87964
88092
|
//#region src/cloudflare-environment.ts
|
|
@@ -88123,7 +88251,6 @@ function createCloudflareEnvironmentOptions({ workerConfig, userConfig, mode, en
|
|
|
88123
88251
|
target,
|
|
88124
88252
|
cssTarget: getWorkerCssTarget(userConfig, environmentName),
|
|
88125
88253
|
emitAssets: true,
|
|
88126
|
-
manifest: isParentEnvironment,
|
|
88127
88254
|
outDir: getOutputDirectory(userConfig, environmentName),
|
|
88128
88255
|
sourcemap: getWorkerSourcemap(userConfig, environmentName),
|
|
88129
88256
|
copyPublicDir: false,
|
|
@@ -88246,15 +88373,21 @@ function initRunners(resolvedPluginConfig, viteDevServer, miniflare) {
|
|
|
88246
88373
|
/** Emits Workers using the Build Output Specification after every environment has built. */
|
|
88247
88374
|
const buildOutputPlugin = createPlugin("build-output", (ctx) => {
|
|
88248
88375
|
const environmentNameToMainModule = /* @__PURE__ */ new Map();
|
|
88376
|
+
const environmentNameToImportedAssetPaths = /* @__PURE__ */ new Map();
|
|
88249
88377
|
return {
|
|
88250
88378
|
writeBundle(_options, bundle) {
|
|
88251
|
-
|
|
88379
|
+
const importedAssetPaths = ctx.getWorkerConfig(this.environment.name) ? /* @__PURE__ */ new Set() : void 0;
|
|
88380
|
+
if (importedAssetPaths) environmentNameToImportedAssetPaths.set(this.environment.name, importedAssetPaths);
|
|
88381
|
+
for (const output$1 of Object.values(bundle)) {
|
|
88382
|
+
if (importedAssetPaths) for (const assetPath of output$1.viteMetadata?.importedAssets ?? []) importedAssetPaths.add(assetPath);
|
|
88383
|
+
if (output$1.type === "chunk" && output$1.isEntry && output$1.name === MAIN_ENTRY_NAME) environmentNameToMainModule.set(this.environment.name, output$1.fileName);
|
|
88384
|
+
}
|
|
88252
88385
|
},
|
|
88253
88386
|
buildApp: {
|
|
88254
88387
|
order: "post",
|
|
88255
88388
|
async handler(builder) {
|
|
88256
88389
|
assertIsNotPreview(ctx);
|
|
88257
|
-
await
|
|
88390
|
+
await buildApp(builder, ctx.resolvedPluginConfig, environmentNameToImportedAssetPaths);
|
|
88258
88391
|
if (ctx.resolvedPluginConfig.type === "assets-only") await writeWorkerConfig({
|
|
88259
88392
|
root: builder.config.root,
|
|
88260
88393
|
config: ctx.resolvedPluginConfig.config
|
|
@@ -88272,15 +88405,6 @@ const buildOutputPlugin = createPlugin("build-output", (ctx) => {
|
|
|
88272
88405
|
}
|
|
88273
88406
|
}
|
|
88274
88407
|
};
|
|
88275
|
-
async function buildUnbuiltWorkerEnvironments(builder) {
|
|
88276
|
-
if (ctx.resolvedPluginConfig.type === "preview") return;
|
|
88277
|
-
const workerEnvironments = [...ctx.resolvedPluginConfig.environmentNameToWorkerMap.entries()].filter(([_, worker]) => !resolveDevOnly(worker.devOnly)).map(([environmentName]) => {
|
|
88278
|
-
const environment = builder.environments[environmentName];
|
|
88279
|
-
assert(environment, `"${environmentName}" environment not found`);
|
|
88280
|
-
return environment;
|
|
88281
|
-
});
|
|
88282
|
-
await Promise.all(workerEnvironments.filter((environment) => !environment.isBuilt).map((environment) => builder.build(environment)));
|
|
88283
|
-
}
|
|
88284
88408
|
async function writeWorkerConfig$1(builder, environmentName, workerDirectoryName) {
|
|
88285
88409
|
const workerConfig = ctx.getWorkerNewConfig(environmentName);
|
|
88286
88410
|
assert(workerConfig, `No config found for "${environmentName}" environment`);
|
|
@@ -88347,79 +88471,6 @@ const buildOutputPlugin = createPlugin("build-output", (ctx) => {
|
|
|
88347
88471
|
}
|
|
88348
88472
|
});
|
|
88349
88473
|
|
|
88350
|
-
//#endregion
|
|
88351
|
-
//#region src/build.ts
|
|
88352
|
-
var import_picocolors$4 = /* @__PURE__ */ __toESM$2(require_picocolors(), 1);
|
|
88353
|
-
const CLIENT_FALLBACK_ENTRY_NAME = "__cloudflare_fallback_entry__";
|
|
88354
|
-
function createBuildApp(resolvedPluginConfig) {
|
|
88355
|
-
return async (builder) => {
|
|
88356
|
-
const clientEnvironment = builder.environments.client;
|
|
88357
|
-
assert(clientEnvironment, `No "client" environment`);
|
|
88358
|
-
const defaultHtmlPath = path.resolve(builder.config.root, "index.html");
|
|
88359
|
-
const hasClientEntry = clientEnvironment.config.build.rollupOptions.input || fs$3.existsSync(defaultHtmlPath);
|
|
88360
|
-
const workerEnvironments = [...resolvedPluginConfig.environmentNameToWorkerMap.entries()].filter(([_, worker]) => !resolveDevOnly(worker.devOnly)).map(([environmentName]) => {
|
|
88361
|
-
const environment = builder.environments[environmentName];
|
|
88362
|
-
assert(environment, `"${environmentName}" environment not found`);
|
|
88363
|
-
return environment;
|
|
88364
|
-
});
|
|
88365
|
-
await Promise.all(workerEnvironments.map((environment) => builder.build(environment)));
|
|
88366
|
-
if (resolvedPluginConfig.type === "assets-only" || !workerEnvironments.some((environment) => environment.name === resolvedPluginConfig.entryWorkerEnvironmentName)) {
|
|
88367
|
-
if (hasClientEntry) await builder.build(clientEnvironment);
|
|
88368
|
-
else if (getHasPublicAssets(builder.config) || resolvedPluginConfig.prerenderWorkerEnvironmentName) await fallbackBuild(builder, clientEnvironment);
|
|
88369
|
-
return;
|
|
88370
|
-
}
|
|
88371
|
-
const { entryWorkerEnvironmentName } = resolvedPluginConfig;
|
|
88372
|
-
const entryWorkerEnvironment = builder.environments[entryWorkerEnvironmentName];
|
|
88373
|
-
assert(entryWorkerEnvironment, `No "${entryWorkerEnvironmentName}" environment`);
|
|
88374
|
-
const entryWorkerBuildDirectory = path.resolve(builder.config.root, entryWorkerEnvironment.config.build.outDir);
|
|
88375
|
-
const importedAssetPaths = getImportedAssetPaths(loadViteManifest(entryWorkerBuildDirectory));
|
|
88376
|
-
if (hasClientEntry) await builder.build(clientEnvironment);
|
|
88377
|
-
else if (importedAssetPaths.size || getHasPublicAssets(builder.config) || resolvedPluginConfig.prerenderWorkerEnvironmentName) await fallbackBuild(builder, clientEnvironment);
|
|
88378
|
-
else return;
|
|
88379
|
-
const clientBuildDirectory = path.resolve(builder.config.root, clientEnvironment.config.build.outDir);
|
|
88380
|
-
const movedAssetPaths = [];
|
|
88381
|
-
for (const assetPath of importedAssetPaths) {
|
|
88382
|
-
const src$1 = path.join(entryWorkerBuildDirectory, assetPath);
|
|
88383
|
-
const dest = path.join(clientBuildDirectory, assetPath);
|
|
88384
|
-
if (!fs$3.existsSync(src$1)) continue;
|
|
88385
|
-
if (fs$3.existsSync(dest)) fs$3.unlinkSync(src$1);
|
|
88386
|
-
else {
|
|
88387
|
-
const destDir = path.dirname(dest);
|
|
88388
|
-
fs$3.mkdirSync(destDir, { recursive: true });
|
|
88389
|
-
fs$3.renameSync(src$1, dest);
|
|
88390
|
-
movedAssetPaths.push(dest);
|
|
88391
|
-
}
|
|
88392
|
-
}
|
|
88393
|
-
if (movedAssetPaths.length) builder.config.logger.info([`${import_picocolors$4.default.green("✓")} ${movedAssetPaths.length} asset${movedAssetPaths.length > 1 ? "s" : ""} moved from "${entryWorkerEnvironmentName}" to "client" build output.`, ...movedAssetPaths.map((assetPath) => import_picocolors$4.default.dim(path.relative(builder.config.root, assetPath)))].join("\n"));
|
|
88394
|
-
};
|
|
88395
|
-
}
|
|
88396
|
-
function getHasPublicAssets({ publicDir }) {
|
|
88397
|
-
let hasPublicAssets = false;
|
|
88398
|
-
if (publicDir) try {
|
|
88399
|
-
if (fs$3.readdirSync(publicDir).length) hasPublicAssets = true;
|
|
88400
|
-
} catch {}
|
|
88401
|
-
return hasPublicAssets;
|
|
88402
|
-
}
|
|
88403
|
-
async function fallbackBuild(builder, environment) {
|
|
88404
|
-
environment.config.build.rollupOptions = {
|
|
88405
|
-
input: VIRTUAL_CLIENT_FALLBACK_ENTRY,
|
|
88406
|
-
logLevel: "silent",
|
|
88407
|
-
output: { entryFileNames: CLIENT_FALLBACK_ENTRY_NAME }
|
|
88408
|
-
};
|
|
88409
|
-
await builder.build(environment);
|
|
88410
|
-
const fallbackEntryPath = path.resolve(builder.config.root, environment.config.build.outDir, CLIENT_FALLBACK_ENTRY_NAME);
|
|
88411
|
-
fs$3.unlinkSync(fallbackEntryPath);
|
|
88412
|
-
}
|
|
88413
|
-
/** Read the Vite manifest emitted for a completed environment build. */
|
|
88414
|
-
function loadViteManifest(directory) {
|
|
88415
|
-
const contents = fs$3.readFileSync(path.resolve(directory, ".vite", "manifest.json"), "utf-8");
|
|
88416
|
-
return JSON.parse(contents);
|
|
88417
|
-
}
|
|
88418
|
-
function getImportedAssetPaths(viteManifest) {
|
|
88419
|
-
const assetPaths = Object.values(viteManifest).flatMap((chunk) => chunk.assets ?? []);
|
|
88420
|
-
return new Set(assetPaths);
|
|
88421
|
-
}
|
|
88422
|
-
|
|
88423
88474
|
//#endregion
|
|
88424
88475
|
//#region src/vite-config.ts
|
|
88425
88476
|
const NODE_BUILTIN_SET = new Set([...builtinModules, ...builtinModules.filter((m) => !m.startsWith("node:")).map((m) => `node:${m}`)]);
|
|
@@ -88510,7 +88561,7 @@ const configPlugin = createPlugin("config", (ctx) => {
|
|
|
88510
88561
|
], ...Array.from(ctx.resolvedPluginConfig.configPaths, (configPath) => normalizePath(configPath))] }
|
|
88511
88562
|
},
|
|
88512
88563
|
environments: getEnvironmentsConfig(ctx, userConfig, env$3.mode),
|
|
88513
|
-
builder: {
|
|
88564
|
+
builder: {}
|
|
88514
88565
|
};
|
|
88515
88566
|
},
|
|
88516
88567
|
configEnvironment: {
|
|
@@ -88768,138 +88819,10 @@ async function prepareContainerImagesForVite(options) {
|
|
|
88768
88819
|
onContainerImagePreparationEnd: () => {},
|
|
88769
88820
|
logger: options.logger,
|
|
88770
88821
|
complianceConfig,
|
|
88771
|
-
|
|
88772
|
-
registryConfigureCommand: options.cliDisplayName === "cf" ? "cf containers registries create" : "wrangler containers registries configure"
|
|
88822
|
+
registryConfigureCommand: "cf containers registries create"
|
|
88773
88823
|
});
|
|
88774
88824
|
}
|
|
88775
88825
|
|
|
88776
|
-
//#endregion
|
|
88777
|
-
//#region ../workers-auth/dist/wrangler/index.mjs
|
|
88778
|
-
createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
|
|
88779
|
-
var DefaultScopes = {
|
|
88780
|
-
"k2.read": "See K2 stream configurations and bind existing streams to Workers.",
|
|
88781
|
-
"k2.write": "Create and manage K2 stream configurations.",
|
|
88782
|
-
"account:read": "See your account info such as account details, analytics, and memberships.",
|
|
88783
|
-
"user:read": "See your user info such as name, email address, and account memberships.",
|
|
88784
|
-
"workers:write": "See and change Cloudflare Workers data such as zones, KV storage, namespaces, scripts, and routes.",
|
|
88785
|
-
"workers_kv:write": "See and change Cloudflare Workers KV Storage data such as keys and namespaces.",
|
|
88786
|
-
"workers_routes:write": "See and change Cloudflare Workers data such as filters and routes.",
|
|
88787
|
-
"workers_scripts:write": "See and change Cloudflare Workers scripts, durable objects, subdomains, triggers, and tail data.",
|
|
88788
|
-
"workers_tail:read": "See Cloudflare Workers tail and script data.",
|
|
88789
|
-
"d1:write": "See and change D1 Databases.",
|
|
88790
|
-
"pages:write": "See and change Cloudflare Pages projects, settings and deployments.",
|
|
88791
|
-
"zone:read": "Grants read level access to account zone.",
|
|
88792
|
-
"ssl_certs:write": "See and manage mTLS certificates for your account",
|
|
88793
|
-
"ai:write": "See and change Workers AI catalog and assets",
|
|
88794
|
-
"ai-search:write": "See and change AI Search data",
|
|
88795
|
-
"ai-search:run": "Run search queries on your AI Search instances",
|
|
88796
|
-
"agent-memory:write": "See and change Agent Memory data such as keys and namespaces.",
|
|
88797
|
-
"queues:write": "See and change Cloudflare Queues settings and data",
|
|
88798
|
-
"pipelines:write": "See and change Cloudflare Pipelines configurations and data",
|
|
88799
|
-
"secrets_store:write": "See and change secrets + stores within the Secrets Store",
|
|
88800
|
-
"artifacts:write": "See and change Cloudflare Artifacts data such as registries and artifacts",
|
|
88801
|
-
"flagship:write": "See and change Flagship feature flags and apps",
|
|
88802
|
-
"containers:write": "Manage Workers Containers",
|
|
88803
|
-
"cloudchamber:write": "Manage Cloudchamber",
|
|
88804
|
-
"connectivity:admin": "See, change, and bind to Connectivity Directory services, including creating services targeting Cloudflare Tunnel.",
|
|
88805
|
-
"email_routing:write": "See and change Email Routing settings, rules, and destination addresses.",
|
|
88806
|
-
"email_sending:write": "See and change Email Sending settings and configuration.",
|
|
88807
|
-
"browser:write": "See and manage Browser Run sessions",
|
|
88808
|
-
"challenge-widgets.write": "See and change Turnstile widgets"
|
|
88809
|
-
};
|
|
88810
|
-
var DefaultScopeKeys = Object.keys(DefaultScopes);
|
|
88811
|
-
function setLoginScopeKeys(scopes) {
|
|
88812
|
-
DefaultScopeKeys = scopes;
|
|
88813
|
-
}
|
|
88814
|
-
__name$1(setLoginScopeKeys, "setLoginScopeKeys");
|
|
88815
|
-
function validateScopeKeys(scopes) {
|
|
88816
|
-
return scopes.every((scope) => scope in DefaultScopes);
|
|
88817
|
-
}
|
|
88818
|
-
__name$1(validateScopeKeys, "validateScopeKeys");
|
|
88819
|
-
var WRANGLER_KEYRING_SERVICE_NAME = "wrangler";
|
|
88820
|
-
var WRANGLER_CLI_NAME = "wrangler";
|
|
88821
|
-
var WRANGLER_DISPLAY_NAME = "Wrangler";
|
|
88822
|
-
var OAUTH_CALLBACK_URL = "http://localhost:8976/oauth/callback";
|
|
88823
|
-
var WRANGLER_CONSENT_PAGES = {
|
|
88824
|
-
granted: { url: "https://welcome.developers.workers.dev/wrangler-oauth-consent-granted" },
|
|
88825
|
-
denied: {
|
|
88826
|
-
url: "https://welcome.developers.workers.dev/wrangler-oauth-consent-denied",
|
|
88827
|
-
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"
|
|
88828
|
-
}
|
|
88829
|
-
};
|
|
88830
|
-
var getClientIdFromEnv = getEnvironmentVariableFactory({
|
|
88831
|
-
variableName: "WRANGLER_CLIENT_ID",
|
|
88832
|
-
defaultValue: /* @__PURE__ */ __name$1(() => getCloudflareApiEnvironmentFromEnv() === "staging" ? "4b2ea6cc-9421-4761-874b-ce550e0e3def" : "54d11594-84e4-41aa-b438-e81b8fa78ee7", "defaultValue")
|
|
88833
|
-
});
|
|
88834
|
-
function getTemporaryAccountConfigFile() {
|
|
88835
|
-
const environment = getCloudflareApiEnvironmentFromEnv();
|
|
88836
|
-
return environment === "production" ? "wrangler-temporary-account.toml" : `wrangler-temporary-account.${environment}.toml`;
|
|
88837
|
-
}
|
|
88838
|
-
__name$1(getTemporaryAccountConfigFile, "getTemporaryAccountConfigFile");
|
|
88839
|
-
function getTemporaryPreviewAccountConfigPath() {
|
|
88840
|
-
return path__default.join(getGlobalConfigPath(), getTemporaryAccountConfigFile());
|
|
88841
|
-
}
|
|
88842
|
-
__name$1(getTemporaryPreviewAccountConfigPath, "getTemporaryPreviewAccountConfigPath");
|
|
88843
|
-
function createTomlFileStorage(getPath) {
|
|
88844
|
-
return createFileStorage("toml", getPath);
|
|
88845
|
-
}
|
|
88846
|
-
__name$1(createTomlFileStorage, "createTomlFileStorage");
|
|
88847
|
-
var { getAuthConfigFilePath, getEncryptedAuthConfigFilePath, defaultAuthConfigStorage, readAuthConfigFile, writeAuthConfigFile } = createAuthConfigFileHelpers({
|
|
88848
|
-
getConfigPath: getGlobalConfigPath,
|
|
88849
|
-
format: "toml"
|
|
88850
|
-
});
|
|
88851
|
-
var WRANGLER_CLI = {
|
|
88852
|
-
cliName: WRANGLER_CLI_NAME,
|
|
88853
|
-
displayName: WRANGLER_DISPLAY_NAME,
|
|
88854
|
-
temporaryAccountFlag: "--temporary",
|
|
88855
|
-
commands: {
|
|
88856
|
-
login: "wrangler login",
|
|
88857
|
-
logout: "wrangler logout",
|
|
88858
|
-
whoami: "wrangler whoami",
|
|
88859
|
-
createProfile: "wrangler auth create",
|
|
88860
|
-
deviceLogin: "wrangler login --device"
|
|
88861
|
-
},
|
|
88862
|
-
keyringServiceName: WRANGLER_KEYRING_SERVICE_NAME,
|
|
88863
|
-
clientId: getClientIdFromEnv,
|
|
88864
|
-
consent: WRANGLER_CONSENT_PAGES,
|
|
88865
|
-
redirectUri: OAUTH_CALLBACK_URL,
|
|
88866
|
-
allowGlobalAuthKey: true,
|
|
88867
|
-
getConfigPath: getGlobalConfigPath,
|
|
88868
|
-
getTemporaryAccountConfigPath: getTemporaryPreviewAccountConfigPath,
|
|
88869
|
-
fileFormat: "toml",
|
|
88870
|
-
persistAccountSelection: true,
|
|
88871
|
-
accountCachePrefix: "wrangler-account",
|
|
88872
|
-
getConfigFileLabel: /* @__PURE__ */ __name$1(() => configFileName(void 0), "getConfigFileLabel"),
|
|
88873
|
-
getDefaultScopeKeys: /* @__PURE__ */ __name$1(() => DefaultScopeKeys, "getDefaultScopeKeys")
|
|
88874
|
-
};
|
|
88875
|
-
var wranglerPreferences = createPreferences(getGlobalConfigPath);
|
|
88876
|
-
var { readUserPreferences, updateUserPreferences } = wranglerPreferences;
|
|
88877
|
-
function createWranglerAuth(ctx) {
|
|
88878
|
-
return createCloudflareAuth(WRANGLER_CLI, ctx);
|
|
88879
|
-
}
|
|
88880
|
-
__name$1(createWranglerAuth, "createWranglerAuth");
|
|
88881
|
-
function createWranglerProfileStore(ctx) {
|
|
88882
|
-
return createCloudflareProfileStore({
|
|
88883
|
-
logger: ctx.logger,
|
|
88884
|
-
getConfigPath: getGlobalConfigPath,
|
|
88885
|
-
keyringServiceName: WRANGLER_KEYRING_SERVICE_NAME,
|
|
88886
|
-
format: "toml"
|
|
88887
|
-
});
|
|
88888
|
-
}
|
|
88889
|
-
__name$1(createWranglerProfileStore, "createWranglerProfileStore");
|
|
88890
|
-
var wranglerKeyringPreference = createKeyringPreference({
|
|
88891
|
-
loginCommand: WRANGLER_CLI.commands.login,
|
|
88892
|
-
createProfileCommand: WRANGLER_CLI.commands.createProfile,
|
|
88893
|
-
keyringServiceName: WRANGLER_KEYRING_SERVICE_NAME,
|
|
88894
|
-
getConfigPath: getGlobalConfigPath,
|
|
88895
|
-
format: "toml",
|
|
88896
|
-
preferences: wranglerPreferences
|
|
88897
|
-
});
|
|
88898
|
-
function setKeyringPreference(enabled, ctx) {
|
|
88899
|
-
return wranglerKeyringPreference.setKeyringPreference(enabled, ctx);
|
|
88900
|
-
}
|
|
88901
|
-
__name$1(setKeyringPreference, "setKeyringPreference");
|
|
88902
|
-
|
|
88903
88826
|
//#endregion
|
|
88904
88827
|
//#region ../deploy-helpers/dist/chunk-U6NEESU5.mjs
|
|
88905
88828
|
const require$1 = createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
|
|
@@ -89594,56 +89517,6 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
|
|
|
89594
89517
|
//#endregion
|
|
89595
89518
|
//#region ../remote-bindings/dist/index.mjs
|
|
89596
89519
|
var import_undici = require_undici();
|
|
89597
|
-
var version$1 = "0.0.62";
|
|
89598
|
-
var NoDefaultValueProvided = class extends UserError {
|
|
89599
|
-
constructor() {
|
|
89600
|
-
super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
|
|
89601
|
-
}
|
|
89602
|
-
};
|
|
89603
|
-
function createRemoteBindingsAuth(logger$1$1) {
|
|
89604
|
-
const context = {
|
|
89605
|
-
logger: logger$1$1,
|
|
89606
|
-
userAgent: `remote-bindings/${version$1}`,
|
|
89607
|
-
async prompt(question) {
|
|
89608
|
-
if (isNonInteractiveOrCI()) throw new NoDefaultValueProvided();
|
|
89609
|
-
return inputPrompt({
|
|
89610
|
-
type: "text",
|
|
89611
|
-
question,
|
|
89612
|
-
label: "Answer",
|
|
89613
|
-
throwOnError: true
|
|
89614
|
-
});
|
|
89615
|
-
},
|
|
89616
|
-
async select(question, options) {
|
|
89617
|
-
if (isNonInteractiveOrCI()) throw new NoDefaultValueProvided();
|
|
89618
|
-
return inputPrompt({
|
|
89619
|
-
type: "select",
|
|
89620
|
-
question,
|
|
89621
|
-
label: "Account",
|
|
89622
|
-
options: options.choices.map((choice) => ({
|
|
89623
|
-
label: choice.title,
|
|
89624
|
-
value: choice.value
|
|
89625
|
-
})),
|
|
89626
|
-
throwOnError: true
|
|
89627
|
-
});
|
|
89628
|
-
},
|
|
89629
|
-
isNoDefaultValueProvidedError: (error$3) => error$3 instanceof NoDefaultValueProvided
|
|
89630
|
-
};
|
|
89631
|
-
const useCfAuth = "CLOUDFLARE_CF_AUTH" in process.env;
|
|
89632
|
-
return {
|
|
89633
|
-
auth: useCfAuth ? createCfAuth(context) : createWranglerAuth(context),
|
|
89634
|
-
useCfAuth
|
|
89635
|
-
};
|
|
89636
|
-
}
|
|
89637
|
-
function getRemoteBindingsAuthHook(auth, accountId, profileDir, logger$1$1) {
|
|
89638
|
-
if (auth) return auth;
|
|
89639
|
-
const { auth: remoteBindingsAuth, useCfAuth } = createRemoteBindingsAuth(logger$1$1);
|
|
89640
|
-
const profile = (useCfAuth ? createCfProfileStore({ logger: logger$1$1 }) : createWranglerProfileStore({ logger: logger$1$1 })).resolve({ cwd: profileDir ?? process.cwd() });
|
|
89641
|
-
remoteBindingsAuth.setProfile(profile);
|
|
89642
|
-
return async () => ({
|
|
89643
|
-
accountId: await remoteBindingsAuth.requireAuth(accountId ? { account_id: accountId } : {}),
|
|
89644
|
-
apiToken: remoteBindingsAuth.requireApiToken()
|
|
89645
|
-
});
|
|
89646
|
-
}
|
|
89647
89520
|
/**
|
|
89648
89521
|
* Warns before native-config development accesses deployed data by default.
|
|
89649
89522
|
* Explicit remote settings and sessions with remote bindings disabled are silent.
|
|
@@ -90079,6 +89952,7 @@ var ProxyControllerLogger = class extends Log {
|
|
|
90079
89952
|
super.log(message);
|
|
90080
89953
|
}
|
|
90081
89954
|
};
|
|
89955
|
+
var version$1 = "0.0.64";
|
|
90082
89956
|
const TRACE_VERSION = "trace-v1";
|
|
90083
89957
|
/**
|
|
90084
89958
|
* Maximum time (ms) to wait for an individual preview API request before
|
|
@@ -90211,6 +90085,21 @@ function isAbortError(err) {
|
|
|
90211
90085
|
const abortErrorCheck = err instanceof Error && err.name == "AbortError";
|
|
90212
90086
|
return legacyAbortErroCheck || abortErrorCheck;
|
|
90213
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
|
+
};
|
|
90214
90103
|
/**
|
|
90215
90104
|
* Error thrown when a remote dev session fails due to an authentication
|
|
90216
90105
|
* problem. The error message is a user-friendly description with actionable
|
|
@@ -90225,36 +90114,41 @@ var RemoteSessionAuthenticationError = class extends UserError {
|
|
|
90225
90114
|
/**
|
|
90226
90115
|
* @param cause - The original error that triggered the authentication
|
|
90227
90116
|
* failure (e.g. an {@link APIError} with code 9106, 10000, or 10405).
|
|
90117
|
+
* @param cliDisplayName - The CLI whose commands the guidance names.
|
|
90228
90118
|
*/
|
|
90229
|
-
constructor(cause) {
|
|
90119
|
+
constructor(cause, cliDisplayName) {
|
|
90230
90120
|
const envAuth = getAuthFromEnv();
|
|
90121
|
+
const { whoami, login, logout } = CLI_COMMANDS[cliDisplayName];
|
|
90231
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";
|
|
90232
90123
|
if (envAuth !== void 0) {
|
|
90233
90124
|
const method = "apiToken" in envAuth ? "a custom API token (`CLOUDFLARE_API_TOKEN`)" : "a Global API Key (`CLOUDFLARE_API_KEY`)";
|
|
90234
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.
|
|
90235
90126
|
|
|
90236
90127
|
To fix this, verify that your token is valid and has the correct permissions.
|
|
90237
|
-
You can also run
|
|
90238
|
-
} 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.`;
|
|
90239
90133
|
super(errorMessage, {
|
|
90240
90134
|
cause,
|
|
90241
90135
|
telemetryMessage: "remote dev authentication error"
|
|
90242
90136
|
});
|
|
90243
90137
|
}
|
|
90244
90138
|
};
|
|
90245
|
-
function handlePreviewSessionUploadError(err, accountId) {
|
|
90139
|
+
function handlePreviewSessionUploadError(err, accountId, cliDisplayName) {
|
|
90246
90140
|
assert(err && typeof err === "object");
|
|
90247
90141
|
if (!isAbortError(err)) {
|
|
90248
90142
|
if ("code" in err && err.code === 10049) {
|
|
90249
90143
|
logger.log("Preview token expired, fetching a new one");
|
|
90250
90144
|
return true;
|
|
90251
|
-
} 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);
|
|
90252
90146
|
}
|
|
90253
90147
|
return false;
|
|
90254
90148
|
}
|
|
90255
|
-
function handlePreviewSessionCreationError(err, accountId) {
|
|
90149
|
+
function handlePreviewSessionCreationError(err, accountId, cliDisplayName) {
|
|
90256
90150
|
assert(err && typeof err === "object");
|
|
90257
|
-
if (handleUserFriendlyError(err, accountId)) return;
|
|
90151
|
+
if (handleUserFriendlyError(err, cliDisplayName, accountId)) return;
|
|
90258
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`);
|
|
90259
90153
|
else if (err instanceof UserError) logger.error(err.message);
|
|
90260
90154
|
else if (!isAbortError(err)) logger.error("Error while creating remote dev session:", err);
|
|
@@ -90298,11 +90192,11 @@ function createRemoteWorkerInit(props) {
|
|
|
90298
90192
|
* messages, does not perform any logic other than logging errors.
|
|
90299
90193
|
* @returns if the error was handled or not
|
|
90300
90194
|
*/
|
|
90301
|
-
function handleUserFriendlyError(error$3, accountId) {
|
|
90195
|
+
function handleUserFriendlyError(error$3, cliDisplayName, accountId) {
|
|
90302
90196
|
if (error$3 instanceof APIError) switch (error$3.code) {
|
|
90303
90197
|
case 9106:
|
|
90304
90198
|
case 1e4:
|
|
90305
|
-
case 10405: throw new RemoteSessionAuthenticationError(error$3);
|
|
90199
|
+
case 10405: throw new RemoteSessionAuthenticationError(error$3, cliDisplayName);
|
|
90306
90200
|
case 10063: {
|
|
90307
90201
|
const onboardingLink = accountId ? `https://dash.cloudflare.com/${accountId}/workers/onboarding` : "https://dash.cloudflare.com/?to=/:account/workers/onboarding";
|
|
90308
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}`);
|
|
@@ -90336,7 +90230,7 @@ var RemoteRuntimeController = class {
|
|
|
90336
90230
|
return session;
|
|
90337
90231
|
} catch (err) {
|
|
90338
90232
|
if (err instanceof Error && err.name == "AbortError") return;
|
|
90339
|
-
handlePreviewSessionCreationError(err, props.accountId);
|
|
90233
|
+
handlePreviewSessionCreationError(err, props.accountId, props.cliDisplayName);
|
|
90340
90234
|
throw err;
|
|
90341
90235
|
}
|
|
90342
90236
|
}
|
|
@@ -90372,7 +90266,7 @@ var RemoteRuntimeController = class {
|
|
|
90372
90266
|
return workerPreviewToken;
|
|
90373
90267
|
} catch (err) {
|
|
90374
90268
|
if (err instanceof Error && err.name == "AbortError") return;
|
|
90375
|
-
if (handlePreviewSessionUploadError(err, props.accountId)) {
|
|
90269
|
+
if (handlePreviewSessionUploadError(err, props.accountId, props.cliDisplayName)) {
|
|
90376
90270
|
this.#session = await this.#previewSession(props);
|
|
90377
90271
|
return this.#previewToken(props);
|
|
90378
90272
|
}
|
|
@@ -90616,7 +90510,11 @@ function findRemoteSessionAuthError(error$3) {
|
|
|
90616
90510
|
if (error$3 instanceof Error) return findRemoteSessionAuthError(error$3.cause);
|
|
90617
90511
|
}
|
|
90618
90512
|
async function startRemoteProxySession(bindings, options) {
|
|
90619
|
-
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
|
+
}
|
|
90620
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" });
|
|
90621
90519
|
options.logger.log(source_default.dim("⎔ Establishing remote connection..."));
|
|
90622
90520
|
initLogger(getInternalLogger(options.logger));
|
|
@@ -90629,7 +90527,7 @@ async function startRemoteProxySession(bindings, options) {
|
|
|
90629
90527
|
compatibilityFlags: ["enhanced_error_serialization"],
|
|
90630
90528
|
complianceRegion: options.complianceRegion,
|
|
90631
90529
|
bindings: rawBindings,
|
|
90632
|
-
auth:
|
|
90530
|
+
auth: options.auth,
|
|
90633
90531
|
server: {
|
|
90634
90532
|
port: 0,
|
|
90635
90533
|
secure: false
|
|
@@ -90721,7 +90619,7 @@ function pickRemoteBindings(bindings) {
|
|
|
90721
90619
|
}
|
|
90722
90620
|
/** Potentially starts or updates a remote proxy session. */
|
|
90723
90621
|
async function maybeStartOrUpdateRemoteProxySession(workerConfigObject, preExistingRemoteProxySessionData, auth, context, startSession = startRemoteProxySession) {
|
|
90724
|
-
const { hook, key } =
|
|
90622
|
+
const { hook, key } = "hook" in auth ? auth : { hook: auth };
|
|
90725
90623
|
const bindings = workerConfigObject.target === "cf" ? getRemoteBindings({ env: workerConfigObject.env }) : workerConfigObject.bindings;
|
|
90726
90624
|
if (workerConfigObject.target === "cf") warnForDefaultRemoteBindings(bindings, true, (message) => context.logger.warn(message));
|
|
90727
90625
|
const remoteBindings = pickRemoteBindings(bindings);
|
|
@@ -90734,7 +90632,7 @@ async function maybeStartOrUpdateRemoteProxySession(workerConfigObject, preExist
|
|
|
90734
90632
|
workerName: workerConfigObject.name,
|
|
90735
90633
|
complianceRegion: workerConfigObject.complianceRegion,
|
|
90736
90634
|
cliDisplayName: context.cliDisplayName,
|
|
90737
|
-
auth:
|
|
90635
|
+
auth: hook,
|
|
90738
90636
|
logger: context.logger
|
|
90739
90637
|
});
|
|
90740
90638
|
} else if (!deepStrictEqual(remoteBindings, preExistingRemoteProxySessionData?.remoteBindings)) if (!remoteProxySession) {
|
|
@@ -90742,7 +90640,7 @@ async function maybeStartOrUpdateRemoteProxySession(workerConfigObject, preExist
|
|
|
90742
90640
|
workerName: workerConfigObject.name,
|
|
90743
90641
|
complianceRegion: workerConfigObject.complianceRegion,
|
|
90744
90642
|
cliDisplayName: context.cliDisplayName,
|
|
90745
|
-
auth:
|
|
90643
|
+
auth: hook,
|
|
90746
90644
|
logger: context.logger
|
|
90747
90645
|
});
|
|
90748
90646
|
} else await remoteProxySession.updateBindings(remoteBindings);
|
|
@@ -91020,11 +90918,9 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
|
|
|
91020
90918
|
name: worker.config.name,
|
|
91021
90919
|
target: "cf",
|
|
91022
90920
|
env: worker.config.env,
|
|
91023
|
-
complianceRegion: toApiComplianceRegion(settings.complianceRegion)
|
|
91024
|
-
account_id: settings.accountId,
|
|
91025
|
-
profileDir: resolvedViteConfig.root
|
|
90921
|
+
complianceRegion: toApiComplianceRegion(settings.complianceRegion)
|
|
91026
90922
|
}, preExistingRemoteProxySession ?? null, getRemoteBindingsAuth(resolvedViteConfig.root, settings.accountId, () => ctx.getCloudflareAuth(resolvedViteConfig.root, createLogger(viteDevServer.config.logger))), {
|
|
91027
|
-
cliDisplayName:
|
|
90923
|
+
cliDisplayName: CLI_DISPLAY_NAME,
|
|
91028
90924
|
logger: createRemoteBindingsLogger(viteDevServer.config.logger)
|
|
91029
90925
|
});
|
|
91030
90926
|
if (remoteProxySessionData) remoteProxySessionsDataMap.set(worker.config.name, remoteProxySessionData);
|
|
@@ -91193,11 +91089,9 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
|
|
|
91193
91089
|
name: workerConfig.name,
|
|
91194
91090
|
target: "cf",
|
|
91195
91091
|
env: workerConfig.env,
|
|
91196
|
-
complianceRegion: toApiComplianceRegion(resolvedPluginConfig.settings.complianceRegion)
|
|
91197
|
-
account_id: resolvedPluginConfig.settings.accountId,
|
|
91198
|
-
profileDir: resolvedViteConfig.root
|
|
91092
|
+
complianceRegion: toApiComplianceRegion(resolvedPluginConfig.settings.complianceRegion)
|
|
91199
91093
|
}, preExistingRemoteProxySessionData ?? null, getRemoteBindingsAuth(resolvedViteConfig.root, resolvedPluginConfig.settings.accountId, () => ctx.getCloudflareAuth(resolvedViteConfig.root, createLogger(vitePreviewServer.config.logger))), {
|
|
91200
|
-
cliDisplayName:
|
|
91094
|
+
cliDisplayName: CLI_DISPLAY_NAME,
|
|
91201
91095
|
logger: createRemoteBindingsLogger(vitePreviewServer.config.logger)
|
|
91202
91096
|
});
|
|
91203
91097
|
if (remoteProxySessionData) remoteProxySessionsDataMap.set(workerConfig.name, remoteProxySessionData);
|
|
@@ -91254,26 +91148,6 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
|
|
|
91254
91148
|
containerOptions: containerPlansByWorkerName.size === 0 ? void 0 : containerOptions
|
|
91255
91149
|
};
|
|
91256
91150
|
}
|
|
91257
|
-
/**
|
|
91258
|
-
* Replaces authored Container names on Durable Object exports with workerd's
|
|
91259
|
-
* local Container runtime metadata.
|
|
91260
|
-
*
|
|
91261
|
-
* @param options - Worker exports and their planned local Container metadata.
|
|
91262
|
-
* @returns Exports accepted by Miniflare's native Worker config schema.
|
|
91263
|
-
*/
|
|
91264
|
-
function createMiniflareExports(options) {
|
|
91265
|
-
const workerExports = {};
|
|
91266
|
-
for (const [name, workerExport] of Object.entries(options.exports ?? {})) if (workerExport.type === "durable-object" && "storage" in workerExport) {
|
|
91267
|
-
const containerName = "container" in workerExport ? workerExport.container : void 0;
|
|
91268
|
-
const container = containerName === void 0 ? void 0 : options.containerRuntimeOptions?.get(name);
|
|
91269
|
-
assert(containerName === void 0 || container !== void 0, `Expected runtime options for Container-backed Durable Object export "${name}".`);
|
|
91270
|
-
workerExports[name] = {
|
|
91271
|
-
...workerExport,
|
|
91272
|
-
container
|
|
91273
|
-
};
|
|
91274
|
-
} else workerExports[name] = workerExport;
|
|
91275
|
-
return workerExports;
|
|
91276
|
-
}
|
|
91277
91151
|
function resolveLocalBindingsByWorkerName(workerConfigs, localEnv, devVars, remoteBindings, mode, logger$2) {
|
|
91278
91152
|
const resolvedLocalBindingsByWorkerName = /* @__PURE__ */ new Map();
|
|
91279
91153
|
for (const config$3 of workerConfigs) resolvedLocalBindingsByWorkerName.set(config$3.name, resolveLocalBindings(config$3.env, {
|
|
@@ -91514,8 +91388,7 @@ const devPlugin = createPlugin("dev", (ctx) => {
|
|
|
91514
91388
|
dockerPath,
|
|
91515
91389
|
containerOptions,
|
|
91516
91390
|
settings: ctx.resolvedPluginConfig.settings,
|
|
91517
|
-
logger: viteDevServer.config.logger
|
|
91518
|
-
cliDisplayName: ctx.resolvedPluginConfig.cliDisplayName
|
|
91391
|
+
logger: viteDevServer.config.logger
|
|
91519
91392
|
});
|
|
91520
91393
|
viteDevServer.config.logger.info(import_picocolors$2.default.dim(import_picocolors$2.default.yellow("\n⚡️ Containers successfully built. To rebuild your containers during development, restart the Vite dev server (r + enter).")));
|
|
91521
91394
|
}
|
|
@@ -91660,8 +91533,7 @@ const previewPlugin = createPlugin("preview", (ctx) => {
|
|
|
91660
91533
|
dockerPath: getDockerPath(),
|
|
91661
91534
|
containerOptions,
|
|
91662
91535
|
settings: ctx.resolvedPluginConfig.settings,
|
|
91663
|
-
logger: vitePreviewServer.config.logger
|
|
91664
|
-
cliDisplayName: ctx.resolvedPluginConfig.cliDisplayName
|
|
91536
|
+
logger: vitePreviewServer.config.logger
|
|
91665
91537
|
});
|
|
91666
91538
|
}
|
|
91667
91539
|
if (vitePreviewServer.httpServer) vitePreviewServer.httpServer.on("listening", () => {
|