@cloudflare/vite-plugin 2.0.0-beta.v.15 → 2.0.0-beta.v.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs
CHANGED
|
@@ -50476,7 +50476,7 @@ var BINDING_LOCAL_SUPPORT = {
|
|
|
50476
50476
|
service: "local-and-remote",
|
|
50477
50477
|
queue: "local-and-remote",
|
|
50478
50478
|
flagship: "local-and-remote",
|
|
50479
|
-
artifacts: "
|
|
50479
|
+
artifacts: "local-and-remote",
|
|
50480
50480
|
analytics_engine: "local-and-remote",
|
|
50481
50481
|
vectorize: "remote",
|
|
50482
50482
|
mtls_certificate: "remote",
|
|
@@ -50500,19 +50500,14 @@ function resolveBindingRemote(type, remote, { remoteBindingsDisabled = false } =
|
|
|
50500
50500
|
switch (getBindingLocalSupport(type)) {
|
|
50501
50501
|
case "DO-NOT-USE-this-resource-will-never-have-a-local-simulator": return true;
|
|
50502
50502
|
case "local-only": return false;
|
|
50503
|
-
case "remote-default-with-local-opt-in": return !remoteBindingsDisabled && remote !== false;
|
|
50504
50503
|
case "local-and-remote":
|
|
50505
50504
|
case "remote": return !remoteBindingsDisabled && remote === true;
|
|
50506
50505
|
}
|
|
50507
50506
|
}
|
|
50508
50507
|
__name$3(resolveBindingRemote, "resolveBindingRemote");
|
|
50509
|
-
function validateBindingRemoteSetting(type, remote, warn
|
|
50510
|
-
const remoteSetting = /* @__PURE__ */ __name$3((value) => configFormat2 === "cloudflare-config" ? `\`dev: { remote: ${value} }\`` : `\`remote: ${value}\``, "remoteSetting");
|
|
50508
|
+
function validateBindingRemoteSetting(type, remote, warn) {
|
|
50511
50509
|
switch (getBindingLocalSupport(type)) {
|
|
50512
50510
|
case "local-and-remote": return;
|
|
50513
|
-
case "remote-default-with-local-opt-in":
|
|
50514
|
-
if (remote === void 0 && !remoteBindingsDisabled) warn(`${binding === void 0 ? `${getBindingTypeFriendlyName(type)} bindings use` : `${getBindingTypeFriendlyName(type)} binding ${binding} uses`} the deployed resource. Set ${remoteSetting(false)} to use the local simulator, or ${remoteSetting(true)} to silence this warning.`);
|
|
50515
|
-
return;
|
|
50516
50511
|
case "local-only":
|
|
50517
50512
|
if (remote === true) throw new UserError(`${getBindingTypeFriendlyName(type)} bindings do not support accessing remote resources.`, { telemetryMessage: "utils bindings unsupported remote resources" });
|
|
50518
50513
|
return;
|
|
@@ -50527,6 +50522,23 @@ function validateBindingRemoteSetting(type, remote, warn, { binding, remoteBindi
|
|
|
50527
50522
|
}
|
|
50528
50523
|
}
|
|
50529
50524
|
__name$3(validateBindingRemoteSetting, "validateBindingRemoteSetting");
|
|
50525
|
+
function createArtifactsLocalDefaultWarner(configFormat2) {
|
|
50526
|
+
const remoteSetting = /* @__PURE__ */ __name$3((value) => configFormat2 === "cloudflare-config" ? `\`dev: { remote: ${value} }\`` : `\`remote: ${value}\``, "remoteSetting");
|
|
50527
|
+
const warned$1 = /* @__PURE__ */ new Set();
|
|
50528
|
+
return ({ id, bindings }, warn) => {
|
|
50529
|
+
for (const { name, remote, worker } of bindings) {
|
|
50530
|
+
const key = JSON.stringify([
|
|
50531
|
+
id,
|
|
50532
|
+
worker ?? null,
|
|
50533
|
+
name
|
|
50534
|
+
]);
|
|
50535
|
+
if (remote !== void 0 || warned$1.has(key)) continue;
|
|
50536
|
+
warned$1.add(key);
|
|
50537
|
+
warn(`Artifacts binding ${worker === void 0 ? name : `${name} in Worker ${worker}`} uses the local simulator by default. Set ${remoteSetting(true)} to use deployed repos, or ${remoteSetting(false)} to silence this warning.`);
|
|
50538
|
+
}
|
|
50539
|
+
};
|
|
50540
|
+
}
|
|
50541
|
+
__name$3(createArtifactsLocalDefaultWarner, "createArtifactsLocalDefaultWarner");
|
|
50530
50542
|
var supportedPagesConfigFields = [
|
|
50531
50543
|
"pages_build_output_dir",
|
|
50532
50544
|
"name",
|
|
@@ -50629,9 +50641,8 @@ function getInstalledPackageVersion(packageName, projectPath, opts = {}) {
|
|
|
50629
50641
|
try {
|
|
50630
50642
|
const packagePath = getPackagePath(packageName, projectPath);
|
|
50631
50643
|
if (!packagePath) return;
|
|
50632
|
-
const
|
|
50633
|
-
if (!
|
|
50634
|
-
const packageJson = parsePackageJSON(readFileSync$1(packageJsonPath), packageJsonPath);
|
|
50644
|
+
const packageJson = findPackageRootManifest(packagePath, opts.stopAtProjectPath === true ? projectPath : void 0);
|
|
50645
|
+
if (!packageJson) return;
|
|
50635
50646
|
if (packageJson.name !== packageName) {
|
|
50636
50647
|
const bundledVersion = packageJson.bundledVersions?.[packageName];
|
|
50637
50648
|
if (bundledVersion !== void 0) return bundledVersion;
|
|
@@ -50640,21 +50651,20 @@ function getInstalledPackageVersion(packageName, projectPath, opts = {}) {
|
|
|
50640
50651
|
} catch {}
|
|
50641
50652
|
}
|
|
50642
50653
|
__name$3(getInstalledPackageVersion, "getInstalledPackageVersion");
|
|
50643
|
-
function
|
|
50654
|
+
function findPackageRootManifest(startDir, lastDir) {
|
|
50644
50655
|
let dir2 = startDir;
|
|
50645
|
-
const root = path__default.parse(dir2).root;
|
|
50646
50656
|
while (true) {
|
|
50647
|
-
const
|
|
50648
|
-
|
|
50649
|
-
|
|
50650
|
-
|
|
50651
|
-
|
|
50657
|
+
const packageJsonPath = path__default.join(dir2, "package.json");
|
|
50658
|
+
if (statSync(packageJsonPath, { throwIfNoEntry: false })?.isFile()) {
|
|
50659
|
+
const packageJson = parsePackageJSON(readFileSync$1(packageJsonPath), packageJsonPath);
|
|
50660
|
+
if (packageJson.name !== void 0) return packageJson.version !== void 0 ? packageJson : void 0;
|
|
50661
|
+
}
|
|
50652
50662
|
const parent = path__default.dirname(dir2);
|
|
50653
|
-
if (parent === dir2 ||
|
|
50663
|
+
if (dir2 === lastDir || parent === dir2 || path__default.basename(parent) === "node_modules" || path__default.basename(parent).startsWith("@") && path__default.basename(path__default.dirname(parent)) === "node_modules") return;
|
|
50654
50664
|
dir2 = parent;
|
|
50655
50665
|
}
|
|
50656
50666
|
}
|
|
50657
|
-
__name$3(
|
|
50667
|
+
__name$3(findPackageRootManifest, "findPackageRootManifest");
|
|
50658
50668
|
function mapWorkerMetadataBindings(bindings) {
|
|
50659
50669
|
return bindings.filter((binding) => binding.type !== "secret_text").reduce((configObj, binding) => {
|
|
50660
50670
|
switch (binding.type) {
|
|
@@ -50913,7 +50923,7 @@ function mapWorkerMetadataBindings(bindings) {
|
|
|
50913
50923
|
}, {});
|
|
50914
50924
|
}
|
|
50915
50925
|
__name$3(mapWorkerMetadataBindings, "mapWorkerMetadataBindings");
|
|
50916
|
-
var DEFAULT_COMPAT_DATE = "2026-11-
|
|
50926
|
+
var DEFAULT_COMPAT_DATE = "2026-11-13";
|
|
50917
50927
|
function constructWranglerConfig(config$3) {
|
|
50918
50928
|
const mappedBindings = mapWorkerMetadataBindings(config$3.bindings);
|
|
50919
50929
|
const durableObjectClassNames = config$3.bindings.filter((binding) => binding.type === "durable_object_namespace" && binding.script_name === config$3.name).map((durableObject) => durableObject.class_name);
|
|
@@ -64350,7 +64360,7 @@ function isInteractive() {
|
|
|
64350
64360
|
//#region ../workers-auth/dist/chunk-VAZEJK55.mjs
|
|
64351
64361
|
createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
|
|
64352
64362
|
var __defProp$2 = Object.defineProperty;
|
|
64353
|
-
var __name$
|
|
64363
|
+
var __name$2 = (target$1, value) => __defProp$2(target$1, "name", {
|
|
64354
64364
|
value,
|
|
64355
64365
|
configurable: true
|
|
64356
64366
|
});
|
|
@@ -64383,7 +64393,7 @@ If you wish to authenticate via an API token then please set the \`CLOUDFLARE_AP
|
|
|
64383
64393
|
}
|
|
64384
64394
|
return {};
|
|
64385
64395
|
}
|
|
64386
|
-
__name$
|
|
64396
|
+
__name$2(readStoredAuthState, "readStoredAuthState");
|
|
64387
64397
|
var getCloudflareAPITokenFromEnv = getEnvironmentVariableFactory({
|
|
64388
64398
|
variableName: "CLOUDFLARE_API_TOKEN",
|
|
64389
64399
|
deprecatedName: "CF_API_TOKEN"
|
|
@@ -64408,7 +64418,7 @@ function getAuthFromEnv(options) {
|
|
|
64408
64418
|
const apiToken = getCloudflareAPITokenFromEnv();
|
|
64409
64419
|
if (apiToken) return { apiToken };
|
|
64410
64420
|
}
|
|
64411
|
-
__name$
|
|
64421
|
+
__name$2(getAuthFromEnv, "getAuthFromEnv");
|
|
64412
64422
|
function getAPIToken(options) {
|
|
64413
64423
|
const envAuth = getAuthFromEnv(options);
|
|
64414
64424
|
if (envAuth) return envAuth;
|
|
@@ -64419,35 +64429,35 @@ function getAPIToken(options) {
|
|
|
64419
64429
|
if (stored.deprecatedApiToken) return { apiToken: stored.deprecatedApiToken };
|
|
64420
64430
|
if (stored.accessToken?.value) return { apiToken: stored.accessToken.value };
|
|
64421
64431
|
}
|
|
64422
|
-
__name$
|
|
64432
|
+
__name$2(getAPIToken, "getAPIToken");
|
|
64423
64433
|
function requireApiToken(options) {
|
|
64424
64434
|
const credentials = getAPIToken(options);
|
|
64425
64435
|
if (!credentials) throw new UserError("No API token found.", { telemetryMessage: "user auth missing api token" });
|
|
64426
64436
|
return credentials;
|
|
64427
64437
|
}
|
|
64428
|
-
__name$
|
|
64438
|
+
__name$2(requireApiToken, "requireApiToken");
|
|
64429
64439
|
var ACCOUNT_ID_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
64430
64440
|
function validateAccountId(accountId, source) {
|
|
64431
64441
|
if (!ACCOUNT_ID_PATTERN.test(accountId)) throw new UserError(`Invalid account ID "${accountId}" ${source}. Account IDs may only contain alphanumeric characters, hyphens, and underscores.`, { telemetryMessage: "user account id invalid characters" });
|
|
64432
64442
|
return accountId;
|
|
64433
64443
|
}
|
|
64434
|
-
__name$
|
|
64444
|
+
__name$2(validateAccountId, "validateAccountId");
|
|
64435
64445
|
var getCloudflareAuthProfileFromEnv = getEnvironmentVariableFactory({ variableName: "CLOUDFLARE_AUTH_PROFILE" });
|
|
64436
64446
|
var getAuthDomainFromEnv = getEnvironmentVariableFactory({
|
|
64437
64447
|
variableName: "WRANGLER_AUTH_DOMAIN",
|
|
64438
|
-
defaultValue: /* @__PURE__ */ __name$
|
|
64448
|
+
defaultValue: /* @__PURE__ */ __name$2(() => getCloudflareApiEnvironmentFromEnv() === "staging" ? "dash.staging.cloudflare.com" : "dash.cloudflare.com", "defaultValue")
|
|
64439
64449
|
});
|
|
64440
64450
|
var getAuthUrlFromEnv = getEnvironmentVariableFactory({
|
|
64441
64451
|
variableName: "WRANGLER_AUTH_URL",
|
|
64442
|
-
defaultValue: /* @__PURE__ */ __name$
|
|
64452
|
+
defaultValue: /* @__PURE__ */ __name$2(() => `https://${getAuthDomainFromEnv()}/oauth2/auth`, "defaultValue")
|
|
64443
64453
|
});
|
|
64444
64454
|
var getTokenUrlFromEnv = getEnvironmentVariableFactory({
|
|
64445
64455
|
variableName: "WRANGLER_TOKEN_URL",
|
|
64446
|
-
defaultValue: /* @__PURE__ */ __name$
|
|
64456
|
+
defaultValue: /* @__PURE__ */ __name$2(() => `https://${getAuthDomainFromEnv()}/oauth2/token`, "defaultValue")
|
|
64447
64457
|
});
|
|
64448
64458
|
var getRevokeUrlFromEnv = getEnvironmentVariableFactory({
|
|
64449
64459
|
variableName: "WRANGLER_REVOKE_URL",
|
|
64450
|
-
defaultValue: /* @__PURE__ */ __name$
|
|
64460
|
+
defaultValue: /* @__PURE__ */ __name$2(() => `https://${getAuthDomainFromEnv()}/oauth2/revoke`, "defaultValue")
|
|
64451
64461
|
});
|
|
64452
64462
|
var readCloudflareAccountIdFromEnv = getEnvironmentVariableFactory({
|
|
64453
64463
|
variableName: "CLOUDFLARE_ACCOUNT_ID",
|
|
@@ -64458,12 +64468,12 @@ function getCloudflareAccountIdFromEnv() {
|
|
|
64458
64468
|
if (!accountId) return;
|
|
64459
64469
|
return validateAccountId(accountId, "set in the `CLOUDFLARE_ACCOUNT_ID` environment variable");
|
|
64460
64470
|
}
|
|
64461
|
-
__name$
|
|
64471
|
+
__name$2(getCloudflareAccountIdFromEnv, "getCloudflareAccountIdFromEnv");
|
|
64462
64472
|
var DEVICE_AUTH_PATH = "/oauth2/device/auth";
|
|
64463
64473
|
function getDeviceAuthUrl() {
|
|
64464
64474
|
return `https://${getAuthDomainFromEnv()}${DEVICE_AUTH_PATH}`;
|
|
64465
64475
|
}
|
|
64466
|
-
__name$
|
|
64476
|
+
__name$2(getDeviceAuthUrl, "getDeviceAuthUrl");
|
|
64467
64477
|
var getAccessClientIdFromEnv = getEnvironmentVariableFactory({ variableName: "CLOUDFLARE_ACCESS_CLIENT_ID" });
|
|
64468
64478
|
var getAccessClientSecretFromEnv = getEnvironmentVariableFactory({ variableName: "CLOUDFLARE_ACCESS_CLIENT_SECRET" });
|
|
64469
64479
|
var getCfAuthorizationTokenFromEnv = getEnvironmentVariableFactory({ variableName: "WRANGLER_CF_AUTHORIZATION_TOKEN" });
|
|
@@ -64475,12 +64485,12 @@ function buildProbeUrl(domain$1, previewToken) {
|
|
|
64475
64485
|
if (previewToken) url2.searchParams.set("cf_workers_preview_token", previewToken);
|
|
64476
64486
|
return url2.toString();
|
|
64477
64487
|
}
|
|
64478
|
-
__name$
|
|
64488
|
+
__name$2(buildProbeUrl, "buildProbeUrl");
|
|
64479
64489
|
function clearAccessCaches() {
|
|
64480
64490
|
for (const key of Object.keys(headersCache)) delete headersCache[key];
|
|
64481
64491
|
usesAccessCache.clear();
|
|
64482
64492
|
}
|
|
64483
|
-
__name$
|
|
64493
|
+
__name$2(clearAccessCaches, "clearAccessCaches");
|
|
64484
64494
|
async function domainUsesAccess(domain$1, logger$2, previewToken) {
|
|
64485
64495
|
logger$2.debug("Checking if domain has Access enabled:", domain$1);
|
|
64486
64496
|
const cacheKey = JSON.stringify([domain$1, Boolean(previewToken)]);
|
|
@@ -64510,7 +64520,7 @@ async function domainUsesAccess(domain$1, logger$2, previewToken) {
|
|
|
64510
64520
|
return false;
|
|
64511
64521
|
}
|
|
64512
64522
|
}
|
|
64513
|
-
__name$
|
|
64523
|
+
__name$2(domainUsesAccess, "domainUsesAccess");
|
|
64514
64524
|
async function getAccessHeaders(domain$1, options) {
|
|
64515
64525
|
const logger$2 = options.logger;
|
|
64516
64526
|
const clientId = getAccessClientIdFromEnv();
|
|
@@ -64546,7 +64556,7 @@ See https://developers.cloudflare.com/cloudflare-one/access-controls/service-cre
|
|
|
64546
64556
|
}
|
|
64547
64557
|
throw new Error("Failed to authenticate with Cloudflare Access");
|
|
64548
64558
|
}
|
|
64549
|
-
__name$
|
|
64559
|
+
__name$2(getAccessHeaders, "getAccessHeaders");
|
|
64550
64560
|
function spawnCloudflaredAccessLogin(loginTarget, signal) {
|
|
64551
64561
|
return new Promise((resolve$3, reject) => {
|
|
64552
64562
|
const child = spawn("cloudflared", [
|
|
@@ -64557,7 +64567,7 @@ function spawnCloudflaredAccessLogin(loginTarget, signal) {
|
|
|
64557
64567
|
const stdoutChunks = [];
|
|
64558
64568
|
child.stdout.on("data", (chunk) => stdoutChunks.push(chunk));
|
|
64559
64569
|
child.stderr.resume();
|
|
64560
|
-
const killChild = /* @__PURE__ */ __name$
|
|
64570
|
+
const killChild = /* @__PURE__ */ __name$2(() => child.kill(), "killChild");
|
|
64561
64571
|
process.once("exit", killChild);
|
|
64562
64572
|
child.on("error", (error$3) => {
|
|
64563
64573
|
process.removeListener("exit", killChild);
|
|
@@ -64580,7 +64590,7 @@ function spawnCloudflaredAccessLogin(loginTarget, signal) {
|
|
|
64580
64590
|
});
|
|
64581
64591
|
});
|
|
64582
64592
|
}
|
|
64583
|
-
__name$
|
|
64593
|
+
__name$2(spawnCloudflaredAccessLogin, "spawnCloudflaredAccessLogin");
|
|
64584
64594
|
async function getCloudflareAccessHeaders(options) {
|
|
64585
64595
|
const cfAuthToken = getCfAuthorizationTokenFromEnv();
|
|
64586
64596
|
if (cfAuthToken !== void 0) {
|
|
@@ -64589,7 +64599,7 @@ async function getCloudflareAccessHeaders(options) {
|
|
|
64589
64599
|
}
|
|
64590
64600
|
return getAccessHeaders(getAuthDomainFromEnv(), options);
|
|
64591
64601
|
}
|
|
64592
|
-
__name$
|
|
64602
|
+
__name$2(getCloudflareAccessHeaders, "getCloudflareAccessHeaders");
|
|
64593
64603
|
var RECOMMENDED_CODE_VERIFIER_LENGTH = 96;
|
|
64594
64604
|
var RECOMMENDED_STATE_LENGTH = 32;
|
|
64595
64605
|
var PKCE_CHARSET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
|
|
@@ -64600,7 +64610,7 @@ function base64urlEncode(value) {
|
|
|
64600
64610
|
base64$3 = base64$3.replace(/=/g, "");
|
|
64601
64611
|
return base64$3;
|
|
64602
64612
|
}
|
|
64603
|
-
__name$
|
|
64613
|
+
__name$2(base64urlEncode, "base64urlEncode");
|
|
64604
64614
|
async function generatePKCECodes() {
|
|
64605
64615
|
const output$1 = new Uint32Array(RECOMMENDED_CODE_VERIFIER_LENGTH);
|
|
64606
64616
|
webcrypto.getRandomValues(output$1);
|
|
@@ -64615,8 +64625,8 @@ async function generatePKCECodes() {
|
|
|
64615
64625
|
codeVerifier
|
|
64616
64626
|
};
|
|
64617
64627
|
}
|
|
64618
|
-
__name$
|
|
64619
|
-
var generateVerificationUrl = /* @__PURE__ */ __name$
|
|
64628
|
+
__name$2(generatePKCECodes, "generatePKCECodes");
|
|
64629
|
+
var generateVerificationUrl = /* @__PURE__ */ __name$2(({ verificationUri, userCode }) => {
|
|
64620
64630
|
const url2 = new URL(verificationUri);
|
|
64621
64631
|
url2.searchParams.set("user_code", userCode);
|
|
64622
64632
|
return url2.toString();
|
|
@@ -64628,15 +64638,15 @@ function parseUrl(value) {
|
|
|
64628
64638
|
return;
|
|
64629
64639
|
}
|
|
64630
64640
|
}
|
|
64631
|
-
__name$
|
|
64641
|
+
__name$2(parseUrl, "parseUrl");
|
|
64632
64642
|
function assertTrustedVerificationUrl(verificationUrl, options) {
|
|
64633
64643
|
const url2 = parseUrl(verificationUrl);
|
|
64634
64644
|
const expected = parseUrl(`https://${options.authDomain}`);
|
|
64635
64645
|
if (!(url2 !== void 0 && expected !== void 0 && url2.protocol === "https:" && url2.username === "" && url2.password === "" && url2.host === expected.host)) throw new UserError(`The authorization server returned an untrusted \`${options.field}\`: ${verificationUrl}
|
|
64636
64646
|
Expected an \`https\` URL on \`${options.authDomain}\`. Refusing to display or open it.`, { telemetryMessage: "user device-flow untrusted verification url" });
|
|
64637
64647
|
}
|
|
64638
|
-
__name$
|
|
64639
|
-
var generateAuthUrl = /* @__PURE__ */ __name$
|
|
64648
|
+
__name$2(assertTrustedVerificationUrl, "assertTrustedVerificationUrl");
|
|
64649
|
+
var generateAuthUrl = /* @__PURE__ */ __name$2(({ authUrl, clientId, scopes, stateQueryParam, codeChallenge, redirectUri }) => {
|
|
64640
64650
|
return authUrl + `?response_type=code&client_id=${encodeURIComponent(clientId)}&redirect_uri=${encodeURIComponent(redirectUri)}&scope=${encodeURIComponent([...scopes, "offline_access"].join(" "))}&state=${stateQueryParam}&code_challenge=${encodeURIComponent(codeChallenge)}&code_challenge_method=S256`;
|
|
64641
64651
|
}, "generateAuthUrl");
|
|
64642
64652
|
function generateRandomState(lengthOfState) {
|
|
@@ -64644,7 +64654,7 @@ function generateRandomState(lengthOfState) {
|
|
|
64644
64654
|
webcrypto.getRandomValues(output$1);
|
|
64645
64655
|
return Array.from(output$1).map((num) => PKCE_CHARSET[num % PKCE_CHARSET.length]).join("");
|
|
64646
64656
|
}
|
|
64647
|
-
__name$
|
|
64657
|
+
__name$2(generateRandomState, "generateRandomState");
|
|
64648
64658
|
var POW_MAX_ITERATIONS = 64e6;
|
|
64649
64659
|
function solvePow(seed, k, g) {
|
|
64650
64660
|
const checkpoints = new Array(k + 1);
|
|
@@ -64656,11 +64666,11 @@ function solvePow(seed, k, g) {
|
|
|
64656
64666
|
}
|
|
64657
64667
|
return checkpoints;
|
|
64658
64668
|
}
|
|
64659
|
-
__name$
|
|
64669
|
+
__name$2(solvePow, "solvePow");
|
|
64660
64670
|
function encodeCheckpoints(checkpoints) {
|
|
64661
64671
|
return Buffer.concat(checkpoints).toString("base64");
|
|
64662
64672
|
}
|
|
64663
|
-
__name$
|
|
64673
|
+
__name$2(encodeCheckpoints, "encodeCheckpoints");
|
|
64664
64674
|
function solveChallenge(challenge) {
|
|
64665
64675
|
const checkpoints = solvePow(Buffer.from(challenge.seed, "base64url"), challenge.k, challenge.g);
|
|
64666
64676
|
return {
|
|
@@ -64668,7 +64678,7 @@ function solveChallenge(challenge) {
|
|
|
64668
64678
|
solution: { checkpoints: encodeCheckpoints(checkpoints) }
|
|
64669
64679
|
};
|
|
64670
64680
|
}
|
|
64671
|
-
__name$
|
|
64681
|
+
__name$2(solveChallenge, "solveChallenge");
|
|
64672
64682
|
var DEFAULT_TEMPORARY_ACCOUNT_FLAG = "--temporary-account";
|
|
64673
64683
|
var TEMPORARY_TERMS_URLS = {
|
|
64674
64684
|
termsOfService: "https://www.cloudflare.com/terms/",
|
|
@@ -64715,7 +64725,7 @@ function getResponseErrorCode(body) {
|
|
|
64715
64725
|
if (typeof error$3 !== "object" || error$3 === null || !("code" in error$3)) return;
|
|
64716
64726
|
return typeof error$3.code === "number" ? error$3.code : void 0;
|
|
64717
64727
|
}
|
|
64718
|
-
__name$
|
|
64728
|
+
__name$2(getResponseErrorCode, "getResponseErrorCode");
|
|
64719
64729
|
async function getEventAccountError(response) {
|
|
64720
64730
|
let body;
|
|
64721
64731
|
try {
|
|
@@ -64731,27 +64741,27 @@ async function getEventAccountError(response) {
|
|
|
64731
64741
|
if (eventError.fatal) return new FatalError(eventError.message, options);
|
|
64732
64742
|
return new UserError(eventError.message, options);
|
|
64733
64743
|
}
|
|
64734
|
-
__name$
|
|
64744
|
+
__name$2(getEventAccountError, "getEventAccountError");
|
|
64735
64745
|
function getTemporaryPreviewUrl() {
|
|
64736
64746
|
return `${getCloudflareApiBaseUrl(COMPLIANCE_REGION_CONFIG_PUBLIC)}/provisioning/previews`;
|
|
64737
64747
|
}
|
|
64738
|
-
__name$
|
|
64748
|
+
__name$2(getTemporaryPreviewUrl, "getTemporaryPreviewUrl");
|
|
64739
64749
|
function getTemporaryPreviewChallengeUrl() {
|
|
64740
64750
|
return `${getTemporaryPreviewUrl()}/challenge`;
|
|
64741
64751
|
}
|
|
64742
|
-
__name$
|
|
64752
|
+
__name$2(getTemporaryPreviewChallengeUrl, "getTemporaryPreviewChallengeUrl");
|
|
64743
64753
|
function isFutureTimestamp(timestamp) {
|
|
64744
64754
|
const parsed = Date.parse(timestamp);
|
|
64745
64755
|
return !Number.isNaN(parsed) && parsed > Date.now();
|
|
64746
64756
|
}
|
|
64747
|
-
__name$
|
|
64757
|
+
__name$2(isFutureTimestamp, "isFutureTimestamp");
|
|
64748
64758
|
function getCachedTemporaryPreviewAccount(storage) {
|
|
64749
64759
|
const temporaryPreviewAccount = storage.read();
|
|
64750
64760
|
if (!temporaryPreviewAccount) return;
|
|
64751
64761
|
if (!temporaryPreviewAccount.account?.id || !temporaryPreviewAccount.account?.apiToken || !temporaryPreviewAccount.account?.name || !temporaryPreviewAccount.claim?.url || !isFutureTimestamp(temporaryPreviewAccount.account?.expiresAt ?? "") || !isFutureTimestamp(temporaryPreviewAccount.claim?.expiresAt ?? "")) return;
|
|
64752
64762
|
return temporaryPreviewAccount;
|
|
64753
64763
|
}
|
|
64754
|
-
__name$
|
|
64764
|
+
__name$2(getCachedTemporaryPreviewAccount, "getCachedTemporaryPreviewAccount");
|
|
64755
64765
|
async function requestPowSolution(temporaryAccountLogger, cliDisplayName) {
|
|
64756
64766
|
const headers = new import_undici$2.Headers({ "Content-Type": "application/json" });
|
|
64757
64767
|
addCustomApiHeaders(headers);
|
|
@@ -64778,7 +64788,7 @@ async function requestPowSolution(temporaryAccountLogger, cliDisplayName) {
|
|
|
64778
64788
|
g
|
|
64779
64789
|
});
|
|
64780
64790
|
}
|
|
64781
|
-
__name$
|
|
64791
|
+
__name$2(requestPowSolution, "requestPowSolution");
|
|
64782
64792
|
async function createTemporaryPreviewAccount(temporaryAccountLogger, request$2, cliDisplayName = "Wrangler") {
|
|
64783
64793
|
const pow = await requestPowSolution(temporaryAccountLogger, cliDisplayName);
|
|
64784
64794
|
const headers = new import_undici$2.Headers({ "Content-Type": "application/json" });
|
|
@@ -64831,7 +64841,7 @@ async function createTemporaryPreviewAccount(temporaryAccountLogger, request$2,
|
|
|
64831
64841
|
}
|
|
64832
64842
|
};
|
|
64833
64843
|
}
|
|
64834
|
-
__name$
|
|
64844
|
+
__name$2(createTemporaryPreviewAccount, "createTemporaryPreviewAccount");
|
|
64835
64845
|
async function getOrCreateTemporaryPreviewAccount(options) {
|
|
64836
64846
|
const cachedPreviewAccount = getCachedTemporaryPreviewAccount(options.storage);
|
|
64837
64847
|
if (cachedPreviewAccount) {
|
|
@@ -64849,7 +64859,7 @@ async function getOrCreateTemporaryPreviewAccount(options) {
|
|
|
64849
64859
|
cached: false
|
|
64850
64860
|
};
|
|
64851
64861
|
}
|
|
64852
|
-
__name$
|
|
64862
|
+
__name$2(getOrCreateTemporaryPreviewAccount, "getOrCreateTemporaryPreviewAccount");
|
|
64853
64863
|
function dedent(templ) {
|
|
64854
64864
|
var values = [];
|
|
64855
64865
|
for (var _i = 1; _i < arguments.length; _i++) values[_i - 1] = arguments[_i];
|
|
@@ -64882,11 +64892,11 @@ function dedent(templ) {
|
|
|
64882
64892
|
});
|
|
64883
64893
|
return string$2;
|
|
64884
64894
|
}
|
|
64885
|
-
__name$
|
|
64895
|
+
__name$2(dedent, "dedent");
|
|
64886
64896
|
var esm_default = dedent;
|
|
64887
64897
|
var ErrorOAuth2 = class extends UserError {
|
|
64888
64898
|
static {
|
|
64889
|
-
__name$
|
|
64899
|
+
__name$2(this, "ErrorOAuth2");
|
|
64890
64900
|
}
|
|
64891
64901
|
/** The OAuth `error` code returned by the provider (e.g. `invalid_scope`). */
|
|
64892
64902
|
code;
|
|
@@ -64900,7 +64910,7 @@ var ErrorOAuth2 = class extends UserError {
|
|
|
64900
64910
|
};
|
|
64901
64911
|
var ErrorUnknown = class extends ErrorOAuth2 {
|
|
64902
64912
|
static {
|
|
64903
|
-
__name$
|
|
64913
|
+
__name$2(this, "ErrorUnknown");
|
|
64904
64914
|
}
|
|
64905
64915
|
toString() {
|
|
64906
64916
|
return "ErrorUnknown";
|
|
@@ -64908,7 +64918,7 @@ var ErrorUnknown = class extends ErrorOAuth2 {
|
|
|
64908
64918
|
};
|
|
64909
64919
|
var ErrorAuthServerUnreachable = class extends ErrorOAuth2 {
|
|
64910
64920
|
static {
|
|
64911
|
-
__name$
|
|
64921
|
+
__name$2(this, "ErrorAuthServerUnreachable");
|
|
64912
64922
|
}
|
|
64913
64923
|
toString() {
|
|
64914
64924
|
return "ErrorAuthServerUnreachable";
|
|
@@ -64916,7 +64926,7 @@ var ErrorAuthServerUnreachable = class extends ErrorOAuth2 {
|
|
|
64916
64926
|
};
|
|
64917
64927
|
var ErrorNoAuthCode = class extends ErrorOAuth2 {
|
|
64918
64928
|
static {
|
|
64919
|
-
__name$
|
|
64929
|
+
__name$2(this, "ErrorNoAuthCode");
|
|
64920
64930
|
}
|
|
64921
64931
|
toString() {
|
|
64922
64932
|
return "ErrorNoAuthCode";
|
|
@@ -64924,7 +64934,7 @@ var ErrorNoAuthCode = class extends ErrorOAuth2 {
|
|
|
64924
64934
|
};
|
|
64925
64935
|
var ErrorInvalidReturnedStateParam = class extends ErrorOAuth2 {
|
|
64926
64936
|
static {
|
|
64927
|
-
__name$
|
|
64937
|
+
__name$2(this, "ErrorInvalidReturnedStateParam");
|
|
64928
64938
|
}
|
|
64929
64939
|
toString() {
|
|
64930
64940
|
return "ErrorInvalidReturnedStateParam";
|
|
@@ -64932,7 +64942,7 @@ var ErrorInvalidReturnedStateParam = class extends ErrorOAuth2 {
|
|
|
64932
64942
|
};
|
|
64933
64943
|
var ErrorInvalidJson = class extends ErrorOAuth2 {
|
|
64934
64944
|
static {
|
|
64935
|
-
__name$
|
|
64945
|
+
__name$2(this, "ErrorInvalidJson");
|
|
64936
64946
|
}
|
|
64937
64947
|
toString() {
|
|
64938
64948
|
return "ErrorInvalidJson";
|
|
@@ -64940,7 +64950,7 @@ var ErrorInvalidJson = class extends ErrorOAuth2 {
|
|
|
64940
64950
|
};
|
|
64941
64951
|
var ErrorInvalidScope = class extends ErrorOAuth2 {
|
|
64942
64952
|
static {
|
|
64943
|
-
__name$
|
|
64953
|
+
__name$2(this, "ErrorInvalidScope");
|
|
64944
64954
|
}
|
|
64945
64955
|
toString() {
|
|
64946
64956
|
return "ErrorInvalidScope";
|
|
@@ -64948,7 +64958,7 @@ var ErrorInvalidScope = class extends ErrorOAuth2 {
|
|
|
64948
64958
|
};
|
|
64949
64959
|
var ErrorInvalidRequest = class extends ErrorOAuth2 {
|
|
64950
64960
|
static {
|
|
64951
|
-
__name$
|
|
64961
|
+
__name$2(this, "ErrorInvalidRequest");
|
|
64952
64962
|
}
|
|
64953
64963
|
toString() {
|
|
64954
64964
|
return "ErrorInvalidRequest";
|
|
@@ -64956,7 +64966,7 @@ var ErrorInvalidRequest = class extends ErrorOAuth2 {
|
|
|
64956
64966
|
};
|
|
64957
64967
|
var ErrorInvalidToken = class extends ErrorOAuth2 {
|
|
64958
64968
|
static {
|
|
64959
|
-
__name$
|
|
64969
|
+
__name$2(this, "ErrorInvalidToken");
|
|
64960
64970
|
}
|
|
64961
64971
|
toString() {
|
|
64962
64972
|
return "ErrorInvalidToken";
|
|
@@ -64964,7 +64974,7 @@ var ErrorInvalidToken = class extends ErrorOAuth2 {
|
|
|
64964
64974
|
};
|
|
64965
64975
|
var ErrorAuthenticationGrant = class extends ErrorOAuth2 {
|
|
64966
64976
|
static {
|
|
64967
|
-
__name$
|
|
64977
|
+
__name$2(this, "ErrorAuthenticationGrant");
|
|
64968
64978
|
}
|
|
64969
64979
|
toString() {
|
|
64970
64980
|
return "ErrorAuthenticationGrant";
|
|
@@ -64972,7 +64982,7 @@ var ErrorAuthenticationGrant = class extends ErrorOAuth2 {
|
|
|
64972
64982
|
};
|
|
64973
64983
|
var ErrorUnauthorizedClient = class extends ErrorAuthenticationGrant {
|
|
64974
64984
|
static {
|
|
64975
|
-
__name$
|
|
64985
|
+
__name$2(this, "ErrorUnauthorizedClient");
|
|
64976
64986
|
}
|
|
64977
64987
|
toString() {
|
|
64978
64988
|
return "ErrorUnauthorizedClient";
|
|
@@ -64980,7 +64990,7 @@ var ErrorUnauthorizedClient = class extends ErrorAuthenticationGrant {
|
|
|
64980
64990
|
};
|
|
64981
64991
|
var ErrorAccessDenied = class extends ErrorAuthenticationGrant {
|
|
64982
64992
|
static {
|
|
64983
|
-
__name$
|
|
64993
|
+
__name$2(this, "ErrorAccessDenied");
|
|
64984
64994
|
}
|
|
64985
64995
|
toString() {
|
|
64986
64996
|
return "ErrorAccessDenied";
|
|
@@ -64988,7 +64998,7 @@ var ErrorAccessDenied = class extends ErrorAuthenticationGrant {
|
|
|
64988
64998
|
};
|
|
64989
64999
|
var ErrorUnsupportedResponseType = class extends ErrorAuthenticationGrant {
|
|
64990
65000
|
static {
|
|
64991
|
-
__name$
|
|
65001
|
+
__name$2(this, "ErrorUnsupportedResponseType");
|
|
64992
65002
|
}
|
|
64993
65003
|
toString() {
|
|
64994
65004
|
return "ErrorUnsupportedResponseType";
|
|
@@ -64996,7 +65006,7 @@ var ErrorUnsupportedResponseType = class extends ErrorAuthenticationGrant {
|
|
|
64996
65006
|
};
|
|
64997
65007
|
var ErrorServerError = class extends ErrorAuthenticationGrant {
|
|
64998
65008
|
static {
|
|
64999
|
-
__name$
|
|
65009
|
+
__name$2(this, "ErrorServerError");
|
|
65000
65010
|
}
|
|
65001
65011
|
toString() {
|
|
65002
65012
|
return "ErrorServerError";
|
|
@@ -65004,7 +65014,7 @@ var ErrorServerError = class extends ErrorAuthenticationGrant {
|
|
|
65004
65014
|
};
|
|
65005
65015
|
var ErrorTemporarilyUnavailable = class extends ErrorAuthenticationGrant {
|
|
65006
65016
|
static {
|
|
65007
|
-
__name$
|
|
65017
|
+
__name$2(this, "ErrorTemporarilyUnavailable");
|
|
65008
65018
|
}
|
|
65009
65019
|
toString() {
|
|
65010
65020
|
return "ErrorTemporarilyUnavailable";
|
|
@@ -65012,7 +65022,7 @@ var ErrorTemporarilyUnavailable = class extends ErrorAuthenticationGrant {
|
|
|
65012
65022
|
};
|
|
65013
65023
|
var ErrorAccessTokenResponse = class extends ErrorOAuth2 {
|
|
65014
65024
|
static {
|
|
65015
|
-
__name$
|
|
65025
|
+
__name$2(this, "ErrorAccessTokenResponse");
|
|
65016
65026
|
}
|
|
65017
65027
|
toString() {
|
|
65018
65028
|
return "ErrorAccessTokenResponse";
|
|
@@ -65020,7 +65030,7 @@ var ErrorAccessTokenResponse = class extends ErrorOAuth2 {
|
|
|
65020
65030
|
};
|
|
65021
65031
|
var ErrorInvalidClient = class extends ErrorAccessTokenResponse {
|
|
65022
65032
|
static {
|
|
65023
|
-
__name$
|
|
65033
|
+
__name$2(this, "ErrorInvalidClient");
|
|
65024
65034
|
}
|
|
65025
65035
|
toString() {
|
|
65026
65036
|
return "ErrorInvalidClient";
|
|
@@ -65028,7 +65038,7 @@ var ErrorInvalidClient = class extends ErrorAccessTokenResponse {
|
|
|
65028
65038
|
};
|
|
65029
65039
|
var ErrorInvalidGrant = class extends ErrorAccessTokenResponse {
|
|
65030
65040
|
static {
|
|
65031
|
-
__name$
|
|
65041
|
+
__name$2(this, "ErrorInvalidGrant");
|
|
65032
65042
|
}
|
|
65033
65043
|
toString() {
|
|
65034
65044
|
return "ErrorInvalidGrant";
|
|
@@ -65036,7 +65046,7 @@ var ErrorInvalidGrant = class extends ErrorAccessTokenResponse {
|
|
|
65036
65046
|
};
|
|
65037
65047
|
var ErrorUnsupportedGrantType = class extends ErrorAccessTokenResponse {
|
|
65038
65048
|
static {
|
|
65039
|
-
__name$
|
|
65049
|
+
__name$2(this, "ErrorUnsupportedGrantType");
|
|
65040
65050
|
}
|
|
65041
65051
|
toString() {
|
|
65042
65052
|
return "ErrorUnsupportedGrantType";
|
|
@@ -65050,11 +65060,11 @@ function formatOAuthErrorMessage(code, description, uri) {
|
|
|
65050
65060
|
See: ${escapeOAuthErrorText(uri)}`;
|
|
65051
65061
|
return message;
|
|
65052
65062
|
}
|
|
65053
|
-
__name$
|
|
65063
|
+
__name$2(formatOAuthErrorMessage, "formatOAuthErrorMessage");
|
|
65054
65064
|
function escapeOAuthErrorText(value) {
|
|
65055
65065
|
return value.replace(/[\u0000-\u001f\u007f-\u009f]/g, (character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
65056
65066
|
}
|
|
65057
|
-
__name$
|
|
65067
|
+
__name$2(escapeOAuthErrorText, "escapeOAuthErrorText");
|
|
65058
65068
|
function toErrorClass(rawError, description, uri) {
|
|
65059
65069
|
const message = formatOAuthErrorMessage(rawError, description, uri);
|
|
65060
65070
|
let error$3;
|
|
@@ -65104,7 +65114,7 @@ function toErrorClass(rawError, description, uri) {
|
|
|
65104
65114
|
error$3.uri = uri;
|
|
65105
65115
|
return error$3;
|
|
65106
65116
|
}
|
|
65107
|
-
__name$
|
|
65117
|
+
__name$2(toErrorClass, "toErrorClass");
|
|
65108
65118
|
var TOKEN_REQUEST_TIMEOUT_MS = 3e4;
|
|
65109
65119
|
function isReturningFromAuthServer(query, state, logger$2) {
|
|
65110
65120
|
const stateQueryParam = query.state;
|
|
@@ -65120,7 +65130,7 @@ function isReturningFromAuthServer(query, state, logger$2) {
|
|
|
65120
65130
|
state.hasAuthCodeBeenExchangedForAccessToken = false;
|
|
65121
65131
|
return true;
|
|
65122
65132
|
}
|
|
65123
|
-
__name$
|
|
65133
|
+
__name$2(isReturningFromAuthServer, "isReturningFromAuthServer");
|
|
65124
65134
|
async function getAuthURL(scopes, clientId, redirectUri, state, generators) {
|
|
65125
65135
|
const { codeChallenge, codeVerifier } = await generatePKCECodes();
|
|
65126
65136
|
const stateQueryParam = generators.generateRandomState(RECOMMENDED_STATE_LENGTH);
|
|
@@ -65138,7 +65148,7 @@ async function getAuthURL(scopes, clientId, redirectUri, state, generators) {
|
|
|
65138
65148
|
redirectUri
|
|
65139
65149
|
});
|
|
65140
65150
|
}
|
|
65141
|
-
__name$
|
|
65151
|
+
__name$2(getAuthURL, "getAuthURL");
|
|
65142
65152
|
async function exchangeRefreshTokenForAccessToken(logger$2, isNonInteractiveOrCI2, clientId, storage, cliDisplayName) {
|
|
65143
65153
|
const storedRefreshToken = readStoredAuthState({
|
|
65144
65154
|
warningLogger: logger$2,
|
|
@@ -65176,7 +65186,7 @@ async function exchangeRefreshTokenForAccessToken(logger$2, isNonInteractiveOrCI
|
|
|
65176
65186
|
else throw error$3;
|
|
65177
65187
|
}
|
|
65178
65188
|
}
|
|
65179
|
-
__name$
|
|
65189
|
+
__name$2(exchangeRefreshTokenForAccessToken, "exchangeRefreshTokenForAccessToken");
|
|
65180
65190
|
async function exchangeAuthCodeForAccessToken(state, logger$2, isNonInteractiveOrCI2, clientId, redirectUri, cliDisplayName) {
|
|
65181
65191
|
const { authorizationCode, codeVerifier = "" } = state;
|
|
65182
65192
|
if (!codeVerifier) logger$2.warn("No code verifier is being sent.");
|
|
@@ -65206,7 +65216,7 @@ async function exchangeAuthCodeForAccessToken(state, logger$2, isNonInteractiveO
|
|
|
65206
65216
|
refreshToken: refresh_token ? { value: refresh_token } : void 0
|
|
65207
65217
|
};
|
|
65208
65218
|
}
|
|
65209
|
-
__name$
|
|
65219
|
+
__name$2(exchangeAuthCodeForAccessToken, "exchangeAuthCodeForAccessToken");
|
|
65210
65220
|
async function fetchAuthToken(body, logger$2, isNonInteractiveOrCI2, cliDisplayName) {
|
|
65211
65221
|
const headers = { "Content-Type": "application/x-www-form-urlencoded" };
|
|
65212
65222
|
logger$2.debug("fetching auth token", `grant_type=${body.get("grant_type") ?? "<unknown>"}`);
|
|
@@ -65239,7 +65249,7 @@ async function fetchAuthToken(body, logger$2, isNonInteractiveOrCI2, cliDisplayN
|
|
|
65239
65249
|
});
|
|
65240
65250
|
}
|
|
65241
65251
|
}
|
|
65242
|
-
__name$
|
|
65252
|
+
__name$2(fetchAuthToken, "fetchAuthToken");
|
|
65243
65253
|
async function getJSONFromResponse(response, logger$2) {
|
|
65244
65254
|
const text = await response.text();
|
|
65245
65255
|
try {
|
|
@@ -65253,9 +65263,9 @@ async function getJSONFromResponse(response, logger$2) {
|
|
|
65253
65263
|
throw new Error(`Invalid JSON in response: status: ${response.status} ${response.statusText}`, { cause: e });
|
|
65254
65264
|
}
|
|
65255
65265
|
}
|
|
65256
|
-
__name$
|
|
65266
|
+
__name$2(getJSONFromResponse, "getJSONFromResponse");
|
|
65257
65267
|
function renderOauthErrorPage(cliDisplayName, detail) {
|
|
65258
|
-
const escape = /* @__PURE__ */ __name$
|
|
65268
|
+
const escape = /* @__PURE__ */ __name$2((value) => value.replace(/[&<>"']/g, (character) => ({
|
|
65259
65269
|
"&": "&",
|
|
65260
65270
|
"<": "<",
|
|
65261
65271
|
">": ">",
|
|
@@ -65288,7 +65298,7 @@ function renderOauthErrorPage(cliDisplayName, detail) {
|
|
|
65288
65298
|
</html>
|
|
65289
65299
|
`;
|
|
65290
65300
|
}
|
|
65291
|
-
__name$
|
|
65301
|
+
__name$2(renderOauthErrorPage, "renderOauthErrorPage");
|
|
65292
65302
|
async function getOauthToken(options, state, ctx, generators) {
|
|
65293
65303
|
const urlToOpen = await getAuthURL(options.scopes, options.clientId, options.redirectUri, state, generators);
|
|
65294
65304
|
const callbackPath = new URL(options.redirectUri).pathname;
|
|
@@ -65314,12 +65324,12 @@ async function getOauthToken(options, state, ctx, generators) {
|
|
|
65314
65324
|
}
|
|
65315
65325
|
});
|
|
65316
65326
|
}
|
|
65317
|
-
__name$
|
|
65327
|
+
__name$2(finish, "finish");
|
|
65318
65328
|
function renderErrorPage(detail) {
|
|
65319
65329
|
res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
|
|
65320
65330
|
res.end(renderOauthErrorPage(ctx.cliDisplayName, detail));
|
|
65321
65331
|
}
|
|
65322
|
-
__name$
|
|
65332
|
+
__name$2(renderErrorPage, "renderErrorPage");
|
|
65323
65333
|
assert(req.url, "This request doesn't have a URL");
|
|
65324
65334
|
const { pathname, query } = url.parse(req.url, true);
|
|
65325
65335
|
if (req.method !== "GET") return res.end("OK");
|
|
@@ -65393,7 +65403,7 @@ If you have changed the callback host or port because you are running in a conta
|
|
|
65393
65403
|
} else ctx.logger.log(`Visit this link to authenticate: ${urlToOpen}`);
|
|
65394
65404
|
return Promise.race([timerPromise, loginPromise]);
|
|
65395
65405
|
}
|
|
65396
|
-
__name$
|
|
65406
|
+
__name$2(getOauthToken, "getOauthToken");
|
|
65397
65407
|
var DEVICE_FLOW_MAX_DURATION_SECONDS = 300;
|
|
65398
65408
|
var DEVICE_FLOW_MIN_POLL_INTERVAL_SECONDS = 1;
|
|
65399
65409
|
function getStringMember(body, key) {
|
|
@@ -65401,23 +65411,23 @@ function getStringMember(body, key) {
|
|
|
65401
65411
|
const value = body[key];
|
|
65402
65412
|
return typeof value === "string" && value !== "" ? value : void 0;
|
|
65403
65413
|
}
|
|
65404
|
-
__name$
|
|
65414
|
+
__name$2(getStringMember, "getStringMember");
|
|
65405
65415
|
function getPositiveNumberMember(body, key) {
|
|
65406
65416
|
if (typeof body !== "object" || body === null) return;
|
|
65407
65417
|
const value = body[key];
|
|
65408
65418
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
|
|
65409
65419
|
}
|
|
65410
|
-
__name$
|
|
65420
|
+
__name$2(getPositiveNumberMember, "getPositiveNumberMember");
|
|
65411
65421
|
function describeUnusableResponse(response, body) {
|
|
65412
65422
|
const status$1 = `HTTP ${response.status} ${response.statusText}`.trim();
|
|
65413
65423
|
const description = getStringMember(body, "error_description");
|
|
65414
65424
|
return description ? `${status$1}: ${description}` : status$1;
|
|
65415
65425
|
}
|
|
65416
|
-
__name$
|
|
65426
|
+
__name$2(describeUnusableResponse, "describeUnusableResponse");
|
|
65417
65427
|
function isRetryableStatus(status$1) {
|
|
65418
65428
|
return status$1 >= 500 || status$1 === 429;
|
|
65419
65429
|
}
|
|
65420
|
-
__name$
|
|
65430
|
+
__name$2(isRetryableStatus, "isRetryableStatus");
|
|
65421
65431
|
function asDeviceAuthorizationResponse(body) {
|
|
65422
65432
|
const deviceCode = getStringMember(body, "device_code");
|
|
65423
65433
|
const userCode = getStringMember(body, "user_code");
|
|
@@ -65433,7 +65443,7 @@ function asDeviceAuthorizationResponse(body) {
|
|
|
65433
65443
|
interval: getPositiveNumberMember(body, "interval")
|
|
65434
65444
|
};
|
|
65435
65445
|
}
|
|
65436
|
-
__name$
|
|
65446
|
+
__name$2(asDeviceAuthorizationResponse, "asDeviceAuthorizationResponse");
|
|
65437
65447
|
async function readJson(response, logger$2) {
|
|
65438
65448
|
const text = await response.text();
|
|
65439
65449
|
try {
|
|
@@ -65447,7 +65457,7 @@ async function readJson(response, logger$2) {
|
|
|
65447
65457
|
throw new Error(`Invalid JSON in response: status: ${response.status} ${response.statusText}`, { cause: e });
|
|
65448
65458
|
}
|
|
65449
65459
|
}
|
|
65450
|
-
__name$
|
|
65460
|
+
__name$2(readJson, "readJson");
|
|
65451
65461
|
async function buildDeviceAuthHeaders(logger$2, isNonInteractiveOrCI2, cliDisplayName) {
|
|
65452
65462
|
const headers = { "Content-Type": "application/x-www-form-urlencoded" };
|
|
65453
65463
|
if (await domainUsesAccess(getAuthDomainFromEnv(), logger$2)) {
|
|
@@ -65460,7 +65470,7 @@ async function buildDeviceAuthHeaders(logger$2, isNonInteractiveOrCI2, cliDispla
|
|
|
65460
65470
|
}
|
|
65461
65471
|
return headers;
|
|
65462
65472
|
}
|
|
65463
|
-
__name$
|
|
65473
|
+
__name$2(buildDeviceAuthHeaders, "buildDeviceAuthHeaders");
|
|
65464
65474
|
async function requestDeviceAuthorization(scopes, clientId, logger$2, isNonInteractiveOrCI2, cliDisplayName) {
|
|
65465
65475
|
const params = new URLSearchParams({
|
|
65466
65476
|
client_id: clientId,
|
|
@@ -65487,7 +65497,7 @@ Enable debug logging to see the full response.`, { telemetryMessage: "user devic
|
|
|
65487
65497
|
}
|
|
65488
65498
|
return deviceAuth;
|
|
65489
65499
|
}
|
|
65490
|
-
__name$
|
|
65500
|
+
__name$2(requestDeviceAuthorization, "requestDeviceAuthorization");
|
|
65491
65501
|
async function pollDeviceToken(deviceCode, clientId, logger$2, isNonInteractiveOrCI2, cliDisplayName) {
|
|
65492
65502
|
const response = await fetchAuthToken(new URLSearchParams({
|
|
65493
65503
|
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
@@ -65520,11 +65530,11 @@ async function pollDeviceToken(deviceCode, clientId, logger$2, isNonInteractiveO
|
|
|
65520
65530
|
}
|
|
65521
65531
|
};
|
|
65522
65532
|
}
|
|
65523
|
-
__name$
|
|
65533
|
+
__name$2(pollDeviceToken, "pollDeviceToken");
|
|
65524
65534
|
function sleep(seconds) {
|
|
65525
65535
|
return new Promise((resolve$3) => setTimeout(resolve$3, seconds * 1e3));
|
|
65526
65536
|
}
|
|
65527
|
-
__name$
|
|
65537
|
+
__name$2(sleep, "sleep");
|
|
65528
65538
|
async function getOauthTokenViaDeviceFlow(options, ctx) {
|
|
65529
65539
|
const { logger: logger$2, openInBrowser: openInBrowser$1, isNonInteractiveOrCI: isNonInteractiveOrCI2 } = ctx;
|
|
65530
65540
|
const deviceAuth = await requestDeviceAuthorization(options.scopes, options.clientId, logger$2, isNonInteractiveOrCI2, ctx.cliDisplayName);
|
|
@@ -65605,7 +65615,7 @@ If you don't want to do this consider passing an API token via the \`CLOUDFLARE_
|
|
|
65605
65615
|
Enable debug logging to see the full response, then run \`${ctx.deviceLoginCommand}\` to try again.`, { telemetryMessage: "user device-flow poll failed" });
|
|
65606
65616
|
throw new UserError(`Device authorization timed out after ${toHumanPeriod(maxDurationSeconds)}. Please run \`${ctx.deviceLoginCommand}\` again to obtain a new code.`, { telemetryMessage: "user device-flow authorization timeout" });
|
|
65607
65617
|
}
|
|
65608
|
-
__name$
|
|
65618
|
+
__name$2(getOauthTokenViaDeviceFlow, "getOauthTokenViaDeviceFlow");
|
|
65609
65619
|
function toHumanPeriod(seconds) {
|
|
65610
65620
|
if (seconds < 60) return `${seconds} seconds`;
|
|
65611
65621
|
const minutes = Math.floor(seconds / 60);
|
|
@@ -65616,7 +65626,7 @@ function toHumanPeriod(seconds) {
|
|
|
65616
65626
|
if (remainingSeconds == 59) return `${minutes + 1} ${minutesPostfix}`;
|
|
65617
65627
|
return `${minutes} ${minutesPostfix} and ${remainingSeconds} ${secondsPostfix}`;
|
|
65618
65628
|
}
|
|
65619
|
-
__name$
|
|
65629
|
+
__name$2(toHumanPeriod, "toHumanPeriod");
|
|
65620
65630
|
function createOAuthFlow(ctx) {
|
|
65621
65631
|
const oauthFlowState = {};
|
|
65622
65632
|
const generators = {
|
|
@@ -65627,8 +65637,8 @@ function createOAuthFlow(ctx) {
|
|
|
65627
65637
|
function getStorage(profile) {
|
|
65628
65638
|
return ctx.storageFactory(profile ?? activeProfile);
|
|
65629
65639
|
}
|
|
65630
|
-
__name$
|
|
65631
|
-
const getClientId = /* @__PURE__ */ __name$
|
|
65640
|
+
__name$2(getStorage, "getStorage");
|
|
65641
|
+
const getClientId = /* @__PURE__ */ __name$2(() => typeof ctx.clientId === "function" ? ctx.clientId() : ctx.clientId, "getClientId");
|
|
65632
65642
|
const consent = ctx.consent;
|
|
65633
65643
|
let temporaryRequest;
|
|
65634
65644
|
let activeTemporaryAccount;
|
|
@@ -65677,7 +65687,7 @@ function createOAuthFlow(ctx) {
|
|
|
65677
65687
|
ctx.purgeOnLoginOrLogout?.();
|
|
65678
65688
|
return true;
|
|
65679
65689
|
}
|
|
65680
|
-
__name$
|
|
65690
|
+
__name$2(login, "login");
|
|
65681
65691
|
function isRefreshNeeded(profile) {
|
|
65682
65692
|
if (ctx.hasEnvCredentials()) return false;
|
|
65683
65693
|
const { accessToken } = readStoredAuthState({
|
|
@@ -65686,7 +65696,7 @@ function createOAuthFlow(ctx) {
|
|
|
65686
65696
|
});
|
|
65687
65697
|
return Boolean(accessToken && /* @__PURE__ */ new Date() >= new Date(accessToken.expiry));
|
|
65688
65698
|
}
|
|
65689
|
-
__name$
|
|
65699
|
+
__name$2(isRefreshNeeded, "isRefreshNeeded");
|
|
65690
65700
|
async function refreshToken(profile) {
|
|
65691
65701
|
const storage = getStorage(profile);
|
|
65692
65702
|
try {
|
|
@@ -65706,7 +65716,7 @@ function createOAuthFlow(ctx) {
|
|
|
65706
65716
|
return e instanceof ErrorAuthServerUnreachable || e instanceof Error && e.name === "TimeoutError" ? "unreachable" : "rejected";
|
|
65707
65717
|
}
|
|
65708
65718
|
}
|
|
65709
|
-
__name$
|
|
65719
|
+
__name$2(refreshToken, "refreshToken");
|
|
65710
65720
|
async function loginOrRefreshIfRequired(props) {
|
|
65711
65721
|
if (ctx.hasEnvCredentials()) return { loggedIn: true };
|
|
65712
65722
|
const stored = readStoredAuthState({
|
|
@@ -65741,7 +65751,7 @@ function createOAuthFlow(ctx) {
|
|
|
65741
65751
|
};
|
|
65742
65752
|
} else return { loggedIn: true };
|
|
65743
65753
|
}
|
|
65744
|
-
__name$
|
|
65754
|
+
__name$2(loginOrRefreshIfRequired, "loginOrRefreshIfRequired");
|
|
65745
65755
|
async function logout(profile) {
|
|
65746
65756
|
const clearedTemporary = clearTemporaryAccount();
|
|
65747
65757
|
if (ctx.hasEnvCredentials()) {
|
|
@@ -65766,7 +65776,7 @@ function createOAuthFlow(ctx) {
|
|
|
65766
65776
|
ctx.logger.log(`Successfully logged out.`);
|
|
65767
65777
|
ctx.purgeOnLoginOrLogout?.();
|
|
65768
65778
|
}
|
|
65769
|
-
__name$
|
|
65779
|
+
__name$2(logout, "logout");
|
|
65770
65780
|
async function getOAuthTokenFromLocalState() {
|
|
65771
65781
|
let stored = readStoredAuthState({
|
|
65772
65782
|
warningLogger: ctx.logger,
|
|
@@ -65782,7 +65792,7 @@ function createOAuthFlow(ctx) {
|
|
|
65782
65792
|
}
|
|
65783
65793
|
return stored.accessToken?.value;
|
|
65784
65794
|
}
|
|
65785
|
-
__name$
|
|
65795
|
+
__name$2(getOAuthTokenFromLocalState, "getOAuthTokenFromLocalState");
|
|
65786
65796
|
function getAPITokenInternal() {
|
|
65787
65797
|
if (activeTemporaryAccount) return { apiToken: activeTemporaryAccount.account.apiToken };
|
|
65788
65798
|
return getAPIToken({
|
|
@@ -65791,7 +65801,7 @@ function createOAuthFlow(ctx) {
|
|
|
65791
65801
|
allowGlobalAuthKey: ctx.allowGlobalAuthKey
|
|
65792
65802
|
});
|
|
65793
65803
|
}
|
|
65794
|
-
__name$
|
|
65804
|
+
__name$2(getAPITokenInternal, "getAPITokenInternal");
|
|
65795
65805
|
function requireApiTokenInternal() {
|
|
65796
65806
|
if (activeTemporaryAccount) return { apiToken: activeTemporaryAccount.account.apiToken };
|
|
65797
65807
|
return requireApiToken({
|
|
@@ -65800,20 +65810,20 @@ function createOAuthFlow(ctx) {
|
|
|
65800
65810
|
allowGlobalAuthKey: ctx.allowGlobalAuthKey
|
|
65801
65811
|
});
|
|
65802
65812
|
}
|
|
65803
|
-
__name$
|
|
65813
|
+
__name$2(requireApiTokenInternal, "requireApiTokenInternal");
|
|
65804
65814
|
function setTemporaryAllowed(allowed, request$2) {
|
|
65805
65815
|
temporaryRequest = allowed && ctx.temporary !== void 0 ? request$2 ?? {} : void 0;
|
|
65806
65816
|
activeTemporaryAccount = void 0;
|
|
65807
65817
|
}
|
|
65808
|
-
__name$
|
|
65818
|
+
__name$2(setTemporaryAllowed, "setTemporaryAllowed");
|
|
65809
65819
|
function isTemporaryAllowed() {
|
|
65810
65820
|
return temporaryRequest !== void 0;
|
|
65811
65821
|
}
|
|
65812
|
-
__name$
|
|
65822
|
+
__name$2(isTemporaryAllowed, "isTemporaryAllowed");
|
|
65813
65823
|
function getActiveTemporaryAccount() {
|
|
65814
65824
|
return activeTemporaryAccount;
|
|
65815
65825
|
}
|
|
65816
|
-
__name$
|
|
65826
|
+
__name$2(getActiveTemporaryAccount, "getActiveTemporaryAccount");
|
|
65817
65827
|
async function activateTemporaryAccount() {
|
|
65818
65828
|
if (!ctx.temporary) throw new UserError(`Temporary preview accounts are not supported by ${ctx.cliDisplayName}.`, { telemetryMessage: "user temporary account unsupported" });
|
|
65819
65829
|
const result = await getOrCreateTemporaryPreviewAccount({
|
|
@@ -65823,27 +65833,27 @@ function createOAuthFlow(ctx) {
|
|
|
65823
65833
|
activeTemporaryAccount = result.account;
|
|
65824
65834
|
return result;
|
|
65825
65835
|
}
|
|
65826
|
-
__name$
|
|
65836
|
+
__name$2(activateTemporaryAccount, "activateTemporaryAccount");
|
|
65827
65837
|
function clearTemporaryAccount() {
|
|
65828
65838
|
activeTemporaryAccount = void 0;
|
|
65829
65839
|
return ctx.temporary?.storage.clear() ?? false;
|
|
65830
65840
|
}
|
|
65831
|
-
__name$
|
|
65841
|
+
__name$2(clearTemporaryAccount, "clearTemporaryAccount");
|
|
65832
65842
|
function setProfile(profile) {
|
|
65833
65843
|
activeProfile = profile;
|
|
65834
65844
|
}
|
|
65835
|
-
__name$
|
|
65845
|
+
__name$2(setProfile, "setProfile");
|
|
65836
65846
|
function getActiveProfile() {
|
|
65837
65847
|
return activeProfile;
|
|
65838
65848
|
}
|
|
65839
|
-
__name$
|
|
65849
|
+
__name$2(getActiveProfile, "getActiveProfile");
|
|
65840
65850
|
function getScopes() {
|
|
65841
65851
|
return readStoredAuthState({
|
|
65842
65852
|
warningLogger: ctx.logger,
|
|
65843
65853
|
storage: getStorage()
|
|
65844
65854
|
}).scopes;
|
|
65845
65855
|
}
|
|
65846
|
-
__name$
|
|
65856
|
+
__name$2(getScopes, "getScopes");
|
|
65847
65857
|
return {
|
|
65848
65858
|
setProfile,
|
|
65849
65859
|
getActiveProfile,
|
|
@@ -65860,7 +65870,7 @@ function createOAuthFlow(ctx) {
|
|
|
65860
65870
|
activateTemporaryAccount
|
|
65861
65871
|
};
|
|
65862
65872
|
}
|
|
65863
|
-
__name$
|
|
65873
|
+
__name$2(createOAuthFlow, "createOAuthFlow");
|
|
65864
65874
|
var RESERVED_PROFILE_NAMES = ["default", "staging"];
|
|
65865
65875
|
function createProfileStore(args) {
|
|
65866
65876
|
const bindings = {
|
|
@@ -65943,16 +65953,16 @@ function createProfileStore(args) {
|
|
|
65943
65953
|
}
|
|
65944
65954
|
};
|
|
65945
65955
|
}
|
|
65946
|
-
__name$
|
|
65956
|
+
__name$2(createProfileStore, "createProfileStore");
|
|
65947
65957
|
function validateProfileName(name) {
|
|
65948
65958
|
if (RESERVED_PROFILE_NAMES.includes(name.toLowerCase())) throw new UserError(`"${name}" is a reserved profile name. Use the login and logout commands to manage the default profile, which applies as a global fallback.`, { telemetryMessage: "auth profile reserved name" });
|
|
65949
65959
|
if (!/^[a-zA-Z0-9_-]+$/.test(name)) throw new UserError(`Invalid profile name "${name}". Profile names may only contain alphanumeric characters, hyphens, and underscores.`, { telemetryMessage: "auth profile invalid name" });
|
|
65950
65960
|
}
|
|
65951
|
-
__name$
|
|
65961
|
+
__name$2(validateProfileName, "validateProfileName");
|
|
65952
65962
|
function formatDirectoryForUserError(dir$1) {
|
|
65953
65963
|
return path__default.relative(process.cwd(), dir$1) || ".";
|
|
65954
65964
|
}
|
|
65955
|
-
__name$
|
|
65965
|
+
__name$2(formatDirectoryForUserError, "formatDirectoryForUserError");
|
|
65956
65966
|
function getProfileForDirectoryFromBindings(startDir, bindings) {
|
|
65957
65967
|
const normalizedDir = path__default.resolve(startDir);
|
|
65958
65968
|
const sortedEntries = Object.entries(bindings).sort(([a], [b]) => b.length - a.length);
|
|
@@ -65967,7 +65977,7 @@ function getProfileForDirectoryFromBindings(startDir, bindings) {
|
|
|
65967
65977
|
};
|
|
65968
65978
|
}
|
|
65969
65979
|
}
|
|
65970
|
-
__name$
|
|
65980
|
+
__name$2(getProfileForDirectoryFromBindings, "getProfileForDirectoryFromBindings");
|
|
65971
65981
|
var BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
65972
65982
|
var HAS_WELLFORMED = !!"".isWellFormed;
|
|
65973
65983
|
function extendedTypeOf(obj) {
|
|
@@ -65986,26 +65996,26 @@ function extendedTypeOf(obj) {
|
|
|
65986
65996
|
}
|
|
65987
65997
|
return type;
|
|
65988
65998
|
}
|
|
65989
|
-
__name$
|
|
65999
|
+
__name$2(extendedTypeOf, "extendedTypeOf");
|
|
65990
66000
|
function isArrayOfTables(obj) {
|
|
65991
66001
|
for (let i$1 = 0; i$1 < obj.length; i$1++) if (extendedTypeOf(obj[i$1]) !== "object") return false;
|
|
65992
66002
|
return obj.length != 0;
|
|
65993
66003
|
}
|
|
65994
|
-
__name$
|
|
66004
|
+
__name$2(isArrayOfTables, "isArrayOfTables");
|
|
65995
66005
|
function formatWellFormedStringUnchecked(s) {
|
|
65996
66006
|
return JSON.stringify(s).replaceAll("", "\\u007f");
|
|
65997
66007
|
}
|
|
65998
|
-
__name$
|
|
66008
|
+
__name$2(formatWellFormedStringUnchecked, "formatWellFormedStringUnchecked");
|
|
65999
66009
|
function formatString(s) {
|
|
66000
66010
|
return formatWellFormedStringUnchecked(HAS_WELLFORMED ? s.toWellFormed() : s);
|
|
66001
66011
|
}
|
|
66002
|
-
__name$
|
|
66012
|
+
__name$2(formatString, "formatString");
|
|
66003
66013
|
function formatKey(s) {
|
|
66004
66014
|
if (BARE_KEY.test(s)) return s;
|
|
66005
66015
|
if (HAS_WELLFORMED && !s.isWellFormed()) throw new RangeError("key contains illegal lone surrogates");
|
|
66006
66016
|
return formatWellFormedStringUnchecked(s);
|
|
66007
66017
|
}
|
|
66008
|
-
__name$
|
|
66018
|
+
__name$2(formatKey, "formatKey");
|
|
66009
66019
|
function stringifyValue(val, type, depth, numberAsFloat, strictTemporal) {
|
|
66010
66020
|
if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
66011
66021
|
switch (type) {
|
|
@@ -66037,7 +66047,7 @@ function stringifyValue(val, type, depth, numberAsFloat, strictTemporal) {
|
|
|
66037
66047
|
case "temporal/x": throw new TypeError("Unsupported " + val[Symbol.toStringTag]);
|
|
66038
66048
|
}
|
|
66039
66049
|
}
|
|
66040
|
-
__name$
|
|
66050
|
+
__name$2(stringifyValue, "stringifyValue");
|
|
66041
66051
|
function stringifyInlineTable(obj, depth, numberAsFloat, strictTemporal) {
|
|
66042
66052
|
let keys = Object.keys(obj);
|
|
66043
66053
|
if (keys.length === 0) return "{}";
|
|
@@ -66049,7 +66059,7 @@ function stringifyInlineTable(obj, depth, numberAsFloat, strictTemporal) {
|
|
|
66049
66059
|
}
|
|
66050
66060
|
return res + " }";
|
|
66051
66061
|
}
|
|
66052
|
-
__name$
|
|
66062
|
+
__name$2(stringifyInlineTable, "stringifyInlineTable");
|
|
66053
66063
|
function stringifyArray(array$2, depth, numberAsFloat, strictTemporal) {
|
|
66054
66064
|
if (array$2.length === 0) return "[]";
|
|
66055
66065
|
let res = "[ ";
|
|
@@ -66060,7 +66070,7 @@ function stringifyArray(array$2, depth, numberAsFloat, strictTemporal) {
|
|
|
66060
66070
|
}
|
|
66061
66071
|
return res + " ]";
|
|
66062
66072
|
}
|
|
66063
|
-
__name$
|
|
66073
|
+
__name$2(stringifyArray, "stringifyArray");
|
|
66064
66074
|
function stringifyArrayTable(array$2, key, depth, numberAsFloat, strictTemporal) {
|
|
66065
66075
|
if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
66066
66076
|
let res = "";
|
|
@@ -66071,7 +66081,7 @@ function stringifyArrayTable(array$2, key, depth, numberAsFloat, strictTemporal)
|
|
|
66071
66081
|
}
|
|
66072
66082
|
return res;
|
|
66073
66083
|
}
|
|
66074
|
-
__name$
|
|
66084
|
+
__name$2(stringifyArrayTable, "stringifyArrayTable");
|
|
66075
66085
|
function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat, strictTemporal) {
|
|
66076
66086
|
if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
66077
66087
|
let preamble = "";
|
|
@@ -66100,32 +66110,32 @@ ${preamble}` : `[${tableKey}]`;
|
|
|
66100
66110
|
return preamble && tables ? `${preamble}
|
|
66101
66111
|
${tables}` : preamble || tables;
|
|
66102
66112
|
}
|
|
66103
|
-
__name$
|
|
66113
|
+
__name$2(stringifyTable, "stringifyTable");
|
|
66104
66114
|
function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false, strictTemporal = false } = {}) {
|
|
66105
66115
|
if (extendedTypeOf(obj) !== "object") throw new TypeError("stringify can only be called with an object");
|
|
66106
66116
|
let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat, strictTemporal);
|
|
66107
66117
|
if (str[str.length - 1] !== "\n") return str + "\n";
|
|
66108
66118
|
return str;
|
|
66109
66119
|
}
|
|
66110
|
-
__name$
|
|
66120
|
+
__name$2(stringify, "stringify");
|
|
66111
66121
|
var FILE_FORMATS = {
|
|
66112
66122
|
toml: {
|
|
66113
|
-
parse: /* @__PURE__ */ __name$
|
|
66114
|
-
stringify: /* @__PURE__ */ __name$
|
|
66123
|
+
parse: /* @__PURE__ */ __name$2((raw) => parseTOML(raw), "parse"),
|
|
66124
|
+
stringify: /* @__PURE__ */ __name$2((value) => stringify(value), "stringify")
|
|
66115
66125
|
},
|
|
66116
66126
|
json: {
|
|
66117
|
-
parse: /* @__PURE__ */ __name$
|
|
66118
|
-
stringify: /* @__PURE__ */ __name$
|
|
66127
|
+
parse: /* @__PURE__ */ __name$2((raw) => JSON.parse(raw), "parse"),
|
|
66128
|
+
stringify: /* @__PURE__ */ __name$2((value) => JSON.stringify(value, null, " "), "stringify")
|
|
66119
66129
|
}
|
|
66120
66130
|
};
|
|
66121
66131
|
function parseFile(format$3, raw) {
|
|
66122
66132
|
return FILE_FORMATS[format$3].parse(raw);
|
|
66123
66133
|
}
|
|
66124
|
-
__name$
|
|
66134
|
+
__name$2(parseFile, "parseFile");
|
|
66125
66135
|
function stringifyFile(format$3, value) {
|
|
66126
66136
|
return FILE_FORMATS[format$3].stringify(value);
|
|
66127
66137
|
}
|
|
66128
|
-
__name$
|
|
66138
|
+
__name$2(stringifyFile, "stringifyFile");
|
|
66129
66139
|
var USER_AUTH_CONFIG_PATH = "config";
|
|
66130
66140
|
function resolveAuthProfileBaseName(profile) {
|
|
66131
66141
|
if (profile === void 0 || profile === "default") {
|
|
@@ -66135,11 +66145,11 @@ function resolveAuthProfileBaseName(profile) {
|
|
|
66135
66145
|
validateProfileName(profile);
|
|
66136
66146
|
return profile;
|
|
66137
66147
|
}
|
|
66138
|
-
__name$
|
|
66139
|
-
function getAuthConfigFilePath$
|
|
66148
|
+
__name$2(resolveAuthProfileBaseName, "resolveAuthProfileBaseName");
|
|
66149
|
+
function getAuthConfigFilePath$1(configPath, profile, extension = "toml") {
|
|
66140
66150
|
return path__default.join(configPath, USER_AUTH_CONFIG_PATH, `${resolveAuthProfileBaseName(profile)}.${extension}`);
|
|
66141
66151
|
}
|
|
66142
|
-
__name$
|
|
66152
|
+
__name$2(getAuthConfigFilePath$1, "getAuthConfigFilePath");
|
|
66143
66153
|
var FileCredentialStore = class {
|
|
66144
66154
|
/**
|
|
66145
66155
|
* @param configPath consumer-provided global config directory (the CLI
|
|
@@ -66155,11 +66165,11 @@ var FileCredentialStore = class {
|
|
|
66155
66165
|
this.format = format$3;
|
|
66156
66166
|
}
|
|
66157
66167
|
static {
|
|
66158
|
-
__name$
|
|
66168
|
+
__name$2(this, "FileCredentialStore");
|
|
66159
66169
|
}
|
|
66160
66170
|
kind = "file";
|
|
66161
66171
|
filePath() {
|
|
66162
|
-
return getAuthConfigFilePath$
|
|
66172
|
+
return getAuthConfigFilePath$1(this.configPath, this.profile, this.format);
|
|
66163
66173
|
}
|
|
66164
66174
|
read() {
|
|
66165
66175
|
const filePath = this.filePath();
|
|
@@ -66196,7 +66206,7 @@ var CIPHER_NAME = "aes-256-gcm";
|
|
|
66196
66206
|
function generateKey() {
|
|
66197
66207
|
return new Uint8Array(randomBytes(KEY_LENGTH_BYTES));
|
|
66198
66208
|
}
|
|
66199
|
-
__name$
|
|
66209
|
+
__name$2(generateKey, "generateKey");
|
|
66200
66210
|
function encryptString(plaintext, key) {
|
|
66201
66211
|
if (key.length !== KEY_LENGTH_BYTES) throw new Error(`AES-256-GCM requires a ${KEY_LENGTH_BYTES}-byte key (got ${key.length} bytes).`);
|
|
66202
66212
|
const iv = randomBytes(IV_LENGTH_BYTES);
|
|
@@ -66211,7 +66221,7 @@ function encryptString(plaintext, key) {
|
|
|
66211
66221
|
ciphertext: ciphertext.toString("base64")
|
|
66212
66222
|
};
|
|
66213
66223
|
}
|
|
66214
|
-
__name$
|
|
66224
|
+
__name$2(encryptString, "encryptString");
|
|
66215
66225
|
function decryptString(envelope, key) {
|
|
66216
66226
|
if (key.length !== KEY_LENGTH_BYTES) throw new Error(`AES-256-GCM requires a ${KEY_LENGTH_BYTES}-byte key (got ${key.length} bytes).`);
|
|
66217
66227
|
if (envelope.v !== 1) throw new Error(`Unsupported encrypted envelope version: ${envelope.v}.`);
|
|
@@ -66224,18 +66234,18 @@ function decryptString(envelope, key) {
|
|
|
66224
66234
|
decipher.setAuthTag(tag);
|
|
66225
66235
|
return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString("utf-8");
|
|
66226
66236
|
}
|
|
66227
|
-
__name$
|
|
66237
|
+
__name$2(decryptString, "decryptString");
|
|
66228
66238
|
function parseEncryptedEnvelope(raw) {
|
|
66229
66239
|
if (typeof raw !== "object" || raw === null) return;
|
|
66230
66240
|
const candidate = raw;
|
|
66231
66241
|
if (candidate.v !== 1 || candidate.alg !== ALGORITHM_LABEL || typeof candidate.iv !== "string" || typeof candidate.tag !== "string" || typeof candidate.ciphertext !== "string") return;
|
|
66232
66242
|
return candidate;
|
|
66233
66243
|
}
|
|
66234
|
-
__name$
|
|
66235
|
-
function getEncryptedAuthConfigFilePath$
|
|
66244
|
+
__name$2(parseEncryptedEnvelope, "parseEncryptedEnvelope");
|
|
66245
|
+
function getEncryptedAuthConfigFilePath$1(configPath, profile) {
|
|
66236
66246
|
return path__default.join(configPath, "config", `${resolveAuthProfileBaseName(profile)}.enc`);
|
|
66237
66247
|
}
|
|
66238
|
-
__name$
|
|
66248
|
+
__name$2(getEncryptedAuthConfigFilePath$1, "getEncryptedAuthConfigFilePath");
|
|
66239
66249
|
var EncryptedFileCredentialStore = class {
|
|
66240
66250
|
/**
|
|
66241
66251
|
* @param configPath consumer-provided global config directory (the CLI
|
|
@@ -66256,14 +66266,14 @@ var EncryptedFileCredentialStore = class {
|
|
|
66256
66266
|
this.format = format$3;
|
|
66257
66267
|
}
|
|
66258
66268
|
static {
|
|
66259
|
-
__name$
|
|
66269
|
+
__name$2(this, "EncryptedFileCredentialStore");
|
|
66260
66270
|
}
|
|
66261
66271
|
kind = "encrypted-file";
|
|
66262
66272
|
plaintextPath() {
|
|
66263
|
-
return getAuthConfigFilePath$
|
|
66273
|
+
return getAuthConfigFilePath$1(this.configPath, this.profile, this.format);
|
|
66264
66274
|
}
|
|
66265
66275
|
read() {
|
|
66266
|
-
const encryptedPath = getEncryptedAuthConfigFilePath$
|
|
66276
|
+
const encryptedPath = getEncryptedAuthConfigFilePath$1(this.configPath, this.profile);
|
|
66267
66277
|
if (existsSync(encryptedPath)) return this.readEncryptedFile(encryptedPath);
|
|
66268
66278
|
const plaintextPath = this.plaintextPath();
|
|
66269
66279
|
if (existsSync(plaintextPath)) return this.migrateFromPlaintext(plaintextPath, encryptedPath);
|
|
@@ -66271,7 +66281,7 @@ var EncryptedFileCredentialStore = class {
|
|
|
66271
66281
|
write(config$3) {
|
|
66272
66282
|
const key = this.ensureKey();
|
|
66273
66283
|
const envelope = encryptString(stringifyFile(this.format, config$3), key);
|
|
66274
|
-
const encryptedPath = getEncryptedAuthConfigFilePath$
|
|
66284
|
+
const encryptedPath = getEncryptedAuthConfigFilePath$1(this.configPath, this.profile);
|
|
66275
66285
|
mkdirSync(path__default.dirname(encryptedPath), { recursive: true });
|
|
66276
66286
|
writeFileSync(encryptedPath, JSON.stringify(envelope, null, " "), {
|
|
66277
66287
|
encoding: "utf-8",
|
|
@@ -66282,7 +66292,7 @@ var EncryptedFileCredentialStore = class {
|
|
|
66282
66292
|
if (existsSync(plaintextPath)) rmSync(plaintextPath);
|
|
66283
66293
|
}
|
|
66284
66294
|
clear() {
|
|
66285
|
-
const encryptedPath = getEncryptedAuthConfigFilePath$
|
|
66295
|
+
const encryptedPath = getEncryptedAuthConfigFilePath$1(this.configPath, this.profile);
|
|
66286
66296
|
const plaintextPath = this.plaintextPath();
|
|
66287
66297
|
let existed = false;
|
|
66288
66298
|
if (existsSync(encryptedPath)) {
|
|
@@ -66299,10 +66309,10 @@ var EncryptedFileCredentialStore = class {
|
|
|
66299
66309
|
return existed;
|
|
66300
66310
|
}
|
|
66301
66311
|
path() {
|
|
66302
|
-
return getEncryptedAuthConfigFilePath$
|
|
66312
|
+
return getEncryptedAuthConfigFilePath$1(this.configPath, this.profile);
|
|
66303
66313
|
}
|
|
66304
66314
|
describe() {
|
|
66305
|
-
return `Encrypted file (${getEncryptedAuthConfigFilePath$
|
|
66315
|
+
return `Encrypted file (${getEncryptedAuthConfigFilePath$1(this.configPath, this.profile)}) with key in ${this.keyProvider.describe()}`;
|
|
66306
66316
|
}
|
|
66307
66317
|
readEncryptedFile(encryptedPath) {
|
|
66308
66318
|
const key = this.keyProvider.getKey();
|
|
@@ -66380,22 +66390,22 @@ function defaultNpmRunner(args) {
|
|
|
66380
66390
|
}
|
|
66381
66391
|
return spawnSync("npm", args, options);
|
|
66382
66392
|
}
|
|
66383
|
-
__name$
|
|
66393
|
+
__name$2(defaultNpmRunner, "defaultNpmRunner");
|
|
66384
66394
|
var npmRunner = defaultNpmRunner;
|
|
66385
66395
|
var cachedBindingPathByDir = /* @__PURE__ */ new Map();
|
|
66386
66396
|
function setNpmRunner(fn) {
|
|
66387
66397
|
npmRunner = fn ?? defaultNpmRunner;
|
|
66388
66398
|
cachedBindingPathByDir.clear();
|
|
66389
66399
|
}
|
|
66390
|
-
__name$
|
|
66400
|
+
__name$2(setNpmRunner, "setNpmRunner");
|
|
66391
66401
|
function getKeyringInstallDir(configPath) {
|
|
66392
66402
|
return path__default.join(configPath, "native", "keyring");
|
|
66393
66403
|
}
|
|
66394
|
-
__name$
|
|
66404
|
+
__name$2(getKeyringInstallDir, "getKeyringInstallDir");
|
|
66395
66405
|
function getInstalledBindingPath(installDir) {
|
|
66396
66406
|
return path__default.join(installDir, "node_modules", "@napi-rs", "keyring");
|
|
66397
66407
|
}
|
|
66398
|
-
__name$
|
|
66408
|
+
__name$2(getInstalledBindingPath, "getInstalledBindingPath");
|
|
66399
66409
|
function canLoadKeyringBinding(candidate) {
|
|
66400
66410
|
try {
|
|
66401
66411
|
createRequire(candidate)(candidate);
|
|
@@ -66404,7 +66414,7 @@ function canLoadKeyringBinding(candidate) {
|
|
|
66404
66414
|
return false;
|
|
66405
66415
|
}
|
|
66406
66416
|
}
|
|
66407
|
-
__name$
|
|
66417
|
+
__name$2(canLoadKeyringBinding, "canLoadKeyringBinding");
|
|
66408
66418
|
function findKeyringBinding(installDir) {
|
|
66409
66419
|
const cached$2 = cachedBindingPathByDir.get(installDir);
|
|
66410
66420
|
if (cached$2 !== void 0) return cached$2;
|
|
@@ -66426,7 +66436,7 @@ function findKeyringBinding(installDir) {
|
|
|
66426
66436
|
cachedBindingPathByDir.set(installDir, null);
|
|
66427
66437
|
return null;
|
|
66428
66438
|
}
|
|
66429
|
-
__name$
|
|
66439
|
+
__name$2(findKeyringBinding, "findKeyringBinding");
|
|
66430
66440
|
function installKeyringBindingSync(installDir) {
|
|
66431
66441
|
const dir$1 = installDir;
|
|
66432
66442
|
mkdirSync(dir$1, { recursive: true });
|
|
@@ -66467,12 +66477,12 @@ Its platform-specific binary ships as a separate optional package, so a download
|
|
|
66467
66477
|
Retry once the underlying issue is fixed, or install the binding globally:
|
|
66468
66478
|
npm install -g @napi-rs/keyring@${PINNED_KEYRING_VERSION}`, { telemetryMessage: "workers-auth keyring install incomplete" });
|
|
66469
66479
|
}
|
|
66470
|
-
__name$
|
|
66480
|
+
__name$2(installKeyringBindingSync, "installKeyringBindingSync");
|
|
66471
66481
|
var entryFactoryOverride;
|
|
66472
66482
|
function setKeyringEntryFactory(factory$1) {
|
|
66473
66483
|
entryFactoryOverride = factory$1;
|
|
66474
66484
|
}
|
|
66475
|
-
__name$
|
|
66485
|
+
__name$2(setKeyringEntryFactory, "setKeyringEntryFactory");
|
|
66476
66486
|
function resolveKeyringEntryFactory(installDir) {
|
|
66477
66487
|
if (entryFactoryOverride !== void 0) return entryFactoryOverride;
|
|
66478
66488
|
const bindingPath = findKeyringBinding(installDir);
|
|
@@ -66483,11 +66493,11 @@ Retry the command, or install the binding globally:
|
|
|
66483
66493
|
const mod$1 = createRequire(bindingPath)(bindingPath);
|
|
66484
66494
|
return (service, account) => new mod$1.Entry(service, account);
|
|
66485
66495
|
}
|
|
66486
|
-
__name$
|
|
66496
|
+
__name$2(resolveKeyringEntryFactory, "resolveKeyringEntryFactory");
|
|
66487
66497
|
function getKeyringAccountName(profile) {
|
|
66488
66498
|
return resolveAuthProfileBaseName(profile);
|
|
66489
66499
|
}
|
|
66490
|
-
__name$
|
|
66500
|
+
__name$2(getKeyringAccountName, "getKeyringAccountName");
|
|
66491
66501
|
function encodeKeyEnvelope(key) {
|
|
66492
66502
|
const envelope = {
|
|
66493
66503
|
v: 1,
|
|
@@ -66496,7 +66506,7 @@ function encodeKeyEnvelope(key) {
|
|
|
66496
66506
|
};
|
|
66497
66507
|
return JSON.stringify(envelope);
|
|
66498
66508
|
}
|
|
66499
|
-
__name$
|
|
66509
|
+
__name$2(encodeKeyEnvelope, "encodeKeyEnvelope");
|
|
66500
66510
|
function decodeKeyEnvelope(raw) {
|
|
66501
66511
|
if (raw === "") return;
|
|
66502
66512
|
let parsed;
|
|
@@ -66514,21 +66524,21 @@ function decodeKeyEnvelope(raw) {
|
|
|
66514
66524
|
return;
|
|
66515
66525
|
}
|
|
66516
66526
|
}
|
|
66517
|
-
__name$
|
|
66527
|
+
__name$2(decodeKeyEnvelope, "decodeKeyEnvelope");
|
|
66518
66528
|
function defaultRunner(args, options = {}) {
|
|
66519
66529
|
return spawnSync("secret-tool", args, {
|
|
66520
66530
|
encoding: "utf-8",
|
|
66521
66531
|
input: options.input
|
|
66522
66532
|
});
|
|
66523
66533
|
}
|
|
66524
|
-
__name$
|
|
66534
|
+
__name$2(defaultRunner, "defaultRunner");
|
|
66525
66535
|
var runner = defaultRunner;
|
|
66526
66536
|
var cachedProbeResult = void 0;
|
|
66527
66537
|
function setLinuxSecretToolRunner(fn) {
|
|
66528
66538
|
runner = fn ?? defaultRunner;
|
|
66529
66539
|
cachedProbeResult = void 0;
|
|
66530
66540
|
}
|
|
66531
|
-
__name$
|
|
66541
|
+
__name$2(setLinuxSecretToolRunner, "setLinuxSecretToolRunner");
|
|
66532
66542
|
function probeSecretTool() {
|
|
66533
66543
|
if (cachedProbeResult !== void 0) return cachedProbeResult;
|
|
66534
66544
|
let result;
|
|
@@ -66540,14 +66550,14 @@ function probeSecretTool() {
|
|
|
66540
66550
|
cachedProbeResult = result;
|
|
66541
66551
|
return result;
|
|
66542
66552
|
}
|
|
66543
|
-
__name$
|
|
66553
|
+
__name$2(probeSecretTool, "probeSecretTool");
|
|
66544
66554
|
var LinuxSecretToolKeyProvider = class {
|
|
66545
66555
|
constructor(serviceName, profile) {
|
|
66546
66556
|
this.serviceName = serviceName;
|
|
66547
66557
|
this.profile = profile;
|
|
66548
66558
|
}
|
|
66549
66559
|
static {
|
|
66550
|
-
__name$
|
|
66560
|
+
__name$2(this, "LinuxSecretToolKeyProvider");
|
|
66551
66561
|
}
|
|
66552
66562
|
getKey() {
|
|
66553
66563
|
const r$1 = runner([
|
|
@@ -66593,19 +66603,19 @@ function defaultRunner2(args, options = {}) {
|
|
|
66593
66603
|
input: options.input
|
|
66594
66604
|
});
|
|
66595
66605
|
}
|
|
66596
|
-
__name$
|
|
66606
|
+
__name$2(defaultRunner2, "defaultRunner");
|
|
66597
66607
|
var runner2 = defaultRunner2;
|
|
66598
66608
|
function setMacSecurityCommandRunner(fn) {
|
|
66599
66609
|
runner2 = fn ?? defaultRunner2;
|
|
66600
66610
|
}
|
|
66601
|
-
__name$
|
|
66611
|
+
__name$2(setMacSecurityCommandRunner, "setMacSecurityCommandRunner");
|
|
66602
66612
|
var MacSecurityKeyProvider = class {
|
|
66603
66613
|
constructor(serviceName, profile) {
|
|
66604
66614
|
this.serviceName = serviceName;
|
|
66605
66615
|
this.profile = profile;
|
|
66606
66616
|
}
|
|
66607
66617
|
static {
|
|
66608
|
-
__name$
|
|
66618
|
+
__name$2(this, "MacSecurityKeyProvider");
|
|
66609
66619
|
}
|
|
66610
66620
|
getKey() {
|
|
66611
66621
|
const r$1 = runner2([
|
|
@@ -66661,7 +66671,7 @@ var NapiKeyringKeyProvider = class {
|
|
|
66661
66671
|
this.profile = profile;
|
|
66662
66672
|
}
|
|
66663
66673
|
static {
|
|
66664
|
-
__name$
|
|
66674
|
+
__name$2(this, "NapiKeyringKeyProvider");
|
|
66665
66675
|
}
|
|
66666
66676
|
entry() {
|
|
66667
66677
|
return resolveKeyringEntryFactory(this.installDir)(this.serviceName, getKeyringAccountName(this.profile));
|
|
@@ -66687,7 +66697,7 @@ var testProviderFactory;
|
|
|
66687
66697
|
function setKeyProviderFactoryForTesting(factory$1) {
|
|
66688
66698
|
testProviderFactory = factory$1;
|
|
66689
66699
|
}
|
|
66690
|
-
__name$
|
|
66700
|
+
__name$2(setKeyProviderFactoryForTesting, "setKeyProviderFactoryForTesting");
|
|
66691
66701
|
function resolveKeyProvider(serviceName, profile, configPath) {
|
|
66692
66702
|
if (testProviderFactory !== void 0) return {
|
|
66693
66703
|
kind: "available",
|
|
@@ -66712,14 +66722,14 @@ function resolveKeyProvider(serviceName, profile, configPath) {
|
|
|
66712
66722
|
};
|
|
66713
66723
|
return {
|
|
66714
66724
|
kind: "needs-install",
|
|
66715
|
-
install: /* @__PURE__ */ __name$
|
|
66716
|
-
afterInstall: /* @__PURE__ */ __name$
|
|
66725
|
+
install: /* @__PURE__ */ __name$2(() => installKeyringBindingSync(installDir), "install"),
|
|
66726
|
+
afterInstall: /* @__PURE__ */ __name$2(() => new NapiKeyringKeyProvider(serviceName, installDir, profile), "afterInstall")
|
|
66717
66727
|
};
|
|
66718
66728
|
}
|
|
66719
66729
|
default: return { kind: "unsupported" };
|
|
66720
66730
|
}
|
|
66721
66731
|
}
|
|
66722
|
-
__name$
|
|
66732
|
+
__name$2(resolveKeyProvider, "resolveKeyProvider");
|
|
66723
66733
|
var sessionFlags = {
|
|
66724
66734
|
installFailedThisSession: false,
|
|
66725
66735
|
hasWarnedAboutKeyringFallback: false,
|
|
@@ -66728,13 +66738,13 @@ var sessionFlags = {
|
|
|
66728
66738
|
function getResolverSessionFlags() {
|
|
66729
66739
|
return sessionFlags;
|
|
66730
66740
|
}
|
|
66731
|
-
__name$
|
|
66741
|
+
__name$2(getResolverSessionFlags, "getResolverSessionFlags");
|
|
66732
66742
|
function resetCredentialStorageState() {
|
|
66733
66743
|
sessionFlags.installFailedThisSession = false;
|
|
66734
66744
|
sessionFlags.hasWarnedAboutKeyringFallback = false;
|
|
66735
66745
|
sessionFlags.hasWarnedAboutSecretToolMissing = false;
|
|
66736
66746
|
}
|
|
66737
|
-
__name$
|
|
66747
|
+
__name$2(resetCredentialStorageState, "resetCredentialStorageState");
|
|
66738
66748
|
function createCredentialStorageContext(context) {
|
|
66739
66749
|
const config$3 = {
|
|
66740
66750
|
...context,
|
|
@@ -66744,22 +66754,22 @@ function createCredentialStorageContext(context) {
|
|
|
66744
66754
|
function getActiveStore(profile) {
|
|
66745
66755
|
return resolveActiveCredentialStore(config$3, profile);
|
|
66746
66756
|
}
|
|
66747
|
-
__name$
|
|
66757
|
+
__name$2(getActiveStore, "getActiveStore");
|
|
66748
66758
|
function storageFactory(profile) {
|
|
66749
66759
|
return {
|
|
66750
|
-
read: /* @__PURE__ */ __name$
|
|
66751
|
-
write: /* @__PURE__ */ __name$
|
|
66752
|
-
clear: /* @__PURE__ */ __name$
|
|
66753
|
-
path: /* @__PURE__ */ __name$
|
|
66760
|
+
read: /* @__PURE__ */ __name$2(() => getActiveStore(profile).read(), "read"),
|
|
66761
|
+
write: /* @__PURE__ */ __name$2((value) => getActiveStore(profile).write(value), "write"),
|
|
66762
|
+
clear: /* @__PURE__ */ __name$2(() => getActiveStore(profile).clear(), "clear"),
|
|
66763
|
+
path: /* @__PURE__ */ __name$2(() => getActiveStore(profile).path(), "path")
|
|
66754
66764
|
};
|
|
66755
66765
|
}
|
|
66756
|
-
__name$
|
|
66766
|
+
__name$2(storageFactory, "storageFactory");
|
|
66757
66767
|
return {
|
|
66758
66768
|
storageFactory,
|
|
66759
66769
|
getActiveStore
|
|
66760
66770
|
};
|
|
66761
66771
|
}
|
|
66762
|
-
__name$
|
|
66772
|
+
__name$2(createCredentialStorageContext, "createCredentialStorageContext");
|
|
66763
66773
|
function resolveActiveCredentialStore(config$3, profile) {
|
|
66764
66774
|
const envOverride = getCloudflareAuthUseKeyringFromEnv();
|
|
66765
66775
|
const configPath = config$3.getConfigPath();
|
|
@@ -66773,13 +66783,13 @@ function resolveActiveCredentialStore(config$3, profile) {
|
|
|
66773
66783
|
case "unsupported": return handleUnsupported(forcedByEnvVar, config$3, profile);
|
|
66774
66784
|
}
|
|
66775
66785
|
}
|
|
66776
|
-
__name$
|
|
66786
|
+
__name$2(resolveActiveCredentialStore, "resolveActiveCredentialStore");
|
|
66777
66787
|
function buildMigrationLogger(config$3) {
|
|
66778
66788
|
return (result) => {
|
|
66779
66789
|
config$3.logger.warn(`Migrated credentials from ${result.plaintextPath} into ${result.encryptedPath} (key in ${result.keyProviderDescription}). The plaintext file has been deleted.`);
|
|
66780
66790
|
};
|
|
66781
66791
|
}
|
|
66782
|
-
__name$
|
|
66792
|
+
__name$2(buildMigrationLogger, "buildMigrationLogger");
|
|
66783
66793
|
function handleNeedsInstall(resolution, forcedByEnvVar, config$3, profile) {
|
|
66784
66794
|
const flags = getResolverSessionFlags();
|
|
66785
66795
|
if (flags.installFailedThisSession) {
|
|
@@ -66797,7 +66807,7 @@ function handleNeedsInstall(resolution, forcedByEnvVar, config$3, profile) {
|
|
|
66797
66807
|
}
|
|
66798
66808
|
return new EncryptedFileCredentialStore(config$3.getConfigPath(), resolution.afterInstall(), buildMigrationLogger(config$3), profile, config$3.format);
|
|
66799
66809
|
}
|
|
66800
|
-
__name$
|
|
66810
|
+
__name$2(handleNeedsInstall, "handleNeedsInstall");
|
|
66801
66811
|
function handleUnsupported(forcedByEnvVar, config$3, profile) {
|
|
66802
66812
|
const platform$1 = process.platform;
|
|
66803
66813
|
const linuxMissingTool = platform$1 === "linux";
|
|
@@ -66816,7 +66826,7 @@ Falling back to the plaintext credentials file for this session.`);
|
|
|
66816
66826
|
}
|
|
66817
66827
|
return fallbackToFileWithWarning(message, config$3, profile);
|
|
66818
66828
|
}
|
|
66819
|
-
__name$
|
|
66829
|
+
__name$2(handleUnsupported, "handleUnsupported");
|
|
66820
66830
|
function fallbackToFileWithWarning(message, config$3, profile) {
|
|
66821
66831
|
const flags = getResolverSessionFlags();
|
|
66822
66832
|
if (!flags.hasWarnedAboutKeyringFallback) {
|
|
@@ -66825,7 +66835,7 @@ function fallbackToFileWithWarning(message, config$3, profile) {
|
|
|
66825
66835
|
}
|
|
66826
66836
|
return new FileCredentialStore(config$3.getConfigPath(), profile, config$3.format);
|
|
66827
66837
|
}
|
|
66828
|
-
__name$
|
|
66838
|
+
__name$2(fallbackToFileWithWarning, "fallbackToFileWithWarning");
|
|
66829
66839
|
function secretToolMissingMessage(loginCommand) {
|
|
66830
66840
|
return `\`secret-tool\` is required for OS keyring storage on Linux but is not installed.
|
|
66831
66841
|
|
|
@@ -66837,7 +66847,7 @@ Install it via your package manager:
|
|
|
66837
66847
|
|
|
66838
66848
|
Or disable keyring storage: \`${loginCommand} --no-use-keyring\`.`;
|
|
66839
66849
|
}
|
|
66840
|
-
__name$
|
|
66850
|
+
__name$2(secretToolMissingMessage, "secretToolMissingMessage");
|
|
66841
66851
|
function windowsBindingMissingMessage(loginCommand) {
|
|
66842
66852
|
return `\`@napi-rs/keyring\` is required for OS keyring storage on Windows but is not installed.
|
|
66843
66853
|
|
|
@@ -66847,9 +66857,9 @@ Run \`${loginCommand} --use-keyring\` interactively to install it automatically,
|
|
|
66847
66857
|
|
|
66848
66858
|
Or disable keyring storage: \`${loginCommand} --no-use-keyring\`.`;
|
|
66849
66859
|
}
|
|
66850
|
-
__name$
|
|
66860
|
+
__name$2(windowsBindingMissingMessage, "windowsBindingMissingMessage");
|
|
66851
66861
|
function scrubEncryptedCredentials(options) {
|
|
66852
|
-
const encryptedPath = getEncryptedAuthConfigFilePath$
|
|
66862
|
+
const encryptedPath = getEncryptedAuthConfigFilePath$1(options.configPath, options.profile);
|
|
66853
66863
|
const encryptedFileExisted = existsSync(encryptedPath);
|
|
66854
66864
|
const resolution = resolveKeyProvider(options.serviceName, options.profile, options.configPath);
|
|
66855
66865
|
if (resolution.kind === "available") {
|
|
@@ -66865,14 +66875,14 @@ function scrubEncryptedCredentials(options) {
|
|
|
66865
66875
|
encryptedFileExisted
|
|
66866
66876
|
};
|
|
66867
66877
|
}
|
|
66868
|
-
__name$
|
|
66878
|
+
__name$2(scrubEncryptedCredentials, "scrubEncryptedCredentials");
|
|
66869
66879
|
var AuthenticationError = class extends UserError {
|
|
66870
66880
|
constructor(message, reason, telemetryMessage) {
|
|
66871
66881
|
super(message, { telemetryMessage });
|
|
66872
66882
|
this.reason = reason;
|
|
66873
66883
|
}
|
|
66874
66884
|
static {
|
|
66875
|
-
__name$
|
|
66885
|
+
__name$2(this, "AuthenticationError");
|
|
66876
66886
|
}
|
|
66877
66887
|
};
|
|
66878
66888
|
|
|
@@ -66883,8 +66893,8 @@ function createPreferences(getConfigPath) {
|
|
|
66883
66893
|
function getUserPreferencesPath() {
|
|
66884
66894
|
return path__default.resolve(getConfigPath(), "preferences.json");
|
|
66885
66895
|
}
|
|
66886
|
-
__name$
|
|
66887
|
-
function readUserPreferences$
|
|
66896
|
+
__name$2(getUserPreferencesPath, "getUserPreferencesPath");
|
|
66897
|
+
function readUserPreferences$1() {
|
|
66888
66898
|
try {
|
|
66889
66899
|
const raw = readFileSync(getUserPreferencesPath(), "utf8");
|
|
66890
66900
|
const parsed = JSON.parse(raw);
|
|
@@ -66894,23 +66904,23 @@ function createPreferences(getConfigPath) {
|
|
|
66894
66904
|
return {};
|
|
66895
66905
|
}
|
|
66896
66906
|
}
|
|
66897
|
-
__name$
|
|
66898
|
-
function updateUserPreferences$
|
|
66907
|
+
__name$2(readUserPreferences$1, "readUserPreferences");
|
|
66908
|
+
function updateUserPreferences$1(update) {
|
|
66899
66909
|
const next = {
|
|
66900
|
-
...readUserPreferences$
|
|
66910
|
+
...readUserPreferences$1(),
|
|
66901
66911
|
...update
|
|
66902
66912
|
};
|
|
66903
66913
|
const filePath = getUserPreferencesPath();
|
|
66904
66914
|
mkdirSync(path__default.dirname(filePath), { recursive: true });
|
|
66905
66915
|
writeFileSync(filePath, JSON.stringify(next, null, " "), { encoding: "utf-8" });
|
|
66906
66916
|
}
|
|
66907
|
-
__name$
|
|
66917
|
+
__name$2(updateUserPreferences$1, "updateUserPreferences");
|
|
66908
66918
|
return {
|
|
66909
|
-
readUserPreferences: readUserPreferences$
|
|
66910
|
-
updateUserPreferences: updateUserPreferences$
|
|
66919
|
+
readUserPreferences: readUserPreferences$1,
|
|
66920
|
+
updateUserPreferences: updateUserPreferences$1
|
|
66911
66921
|
};
|
|
66912
66922
|
}
|
|
66913
|
-
__name$
|
|
66923
|
+
__name$2(createPreferences, "createPreferences");
|
|
66914
66924
|
var millisecondsInMinute = 6e4;
|
|
66915
66925
|
var minutesInYear = 525600;
|
|
66916
66926
|
var minutesInMonth = 43200;
|
|
@@ -66922,46 +66932,46 @@ function constructFrom(date$2, value) {
|
|
|
66922
66932
|
if (date$2 instanceof Date) return new date$2.constructor(value);
|
|
66923
66933
|
return new Date(value);
|
|
66924
66934
|
}
|
|
66925
|
-
__name$
|
|
66935
|
+
__name$2(constructFrom, "constructFrom");
|
|
66926
66936
|
function toDate(argument, context) {
|
|
66927
66937
|
return constructFrom(context || argument, argument);
|
|
66928
66938
|
}
|
|
66929
|
-
__name$
|
|
66939
|
+
__name$2(toDate, "toDate");
|
|
66930
66940
|
var defaultOptions$1 = {};
|
|
66931
66941
|
function getDefaultOptions() {
|
|
66932
66942
|
return defaultOptions$1;
|
|
66933
66943
|
}
|
|
66934
|
-
__name$
|
|
66944
|
+
__name$2(getDefaultOptions, "getDefaultOptions");
|
|
66935
66945
|
function getTimezoneOffsetInMilliseconds(date$2) {
|
|
66936
66946
|
const _date$1 = toDate(date$2);
|
|
66937
66947
|
const utcDate = new Date(Date.UTC(_date$1.getFullYear(), _date$1.getMonth(), _date$1.getDate(), _date$1.getHours(), _date$1.getMinutes(), _date$1.getSeconds(), _date$1.getMilliseconds()));
|
|
66938
66948
|
utcDate.setUTCFullYear(_date$1.getFullYear());
|
|
66939
66949
|
return +date$2 - +utcDate;
|
|
66940
66950
|
}
|
|
66941
|
-
__name$
|
|
66951
|
+
__name$2(getTimezoneOffsetInMilliseconds, "getTimezoneOffsetInMilliseconds");
|
|
66942
66952
|
function normalizeDates(context, ...dates) {
|
|
66943
66953
|
const normalize$1 = constructFrom.bind(null, context || dates.find((date$2) => typeof date$2 === "object"));
|
|
66944
66954
|
return dates.map(normalize$1);
|
|
66945
66955
|
}
|
|
66946
|
-
__name$
|
|
66956
|
+
__name$2(normalizeDates, "normalizeDates");
|
|
66947
66957
|
function compareAsc(dateLeft, dateRight) {
|
|
66948
66958
|
const diff = +toDate(dateLeft) - +toDate(dateRight);
|
|
66949
66959
|
if (diff < 0) return -1;
|
|
66950
66960
|
else if (diff > 0) return 1;
|
|
66951
66961
|
return diff;
|
|
66952
66962
|
}
|
|
66953
|
-
__name$
|
|
66963
|
+
__name$2(compareAsc, "compareAsc");
|
|
66954
66964
|
function constructNow(date$2) {
|
|
66955
66965
|
return constructFrom(date$2, Date.now());
|
|
66956
66966
|
}
|
|
66957
|
-
__name$
|
|
66967
|
+
__name$2(constructNow, "constructNow");
|
|
66958
66968
|
function getRoundingMethod(method) {
|
|
66959
66969
|
return (number$3) => {
|
|
66960
66970
|
const result = (method ? Math[method] : Math.trunc)(number$3);
|
|
66961
66971
|
return result === 0 ? 0 : result;
|
|
66962
66972
|
};
|
|
66963
66973
|
}
|
|
66964
|
-
__name$
|
|
66974
|
+
__name$2(getRoundingMethod, "getRoundingMethod");
|
|
66965
66975
|
var formatDistanceLocale = {
|
|
66966
66976
|
lessThanXSeconds: {
|
|
66967
66977
|
one: "less than a second",
|
|
@@ -67025,7 +67035,7 @@ var formatDistanceLocale = {
|
|
|
67025
67035
|
other: "almost {{count}} years"
|
|
67026
67036
|
}
|
|
67027
67037
|
};
|
|
67028
|
-
var formatDistance = /* @__PURE__ */ __name$
|
|
67038
|
+
var formatDistance = /* @__PURE__ */ __name$2((token, count, options) => {
|
|
67029
67039
|
let result;
|
|
67030
67040
|
const tokenValue = formatDistanceLocale[token];
|
|
67031
67041
|
if (typeof tokenValue === "string") result = tokenValue;
|
|
@@ -67041,7 +67051,7 @@ function buildFormatLongFn(args) {
|
|
|
67041
67051
|
return args.formats[width] || args.formats[args.defaultWidth];
|
|
67042
67052
|
};
|
|
67043
67053
|
}
|
|
67044
|
-
__name$
|
|
67054
|
+
__name$2(buildFormatLongFn, "buildFormatLongFn");
|
|
67045
67055
|
var formatLong = {
|
|
67046
67056
|
date: buildFormatLongFn({
|
|
67047
67057
|
formats: {
|
|
@@ -67079,7 +67089,7 @@ var formatRelativeLocale = {
|
|
|
67079
67089
|
nextWeek: "eeee 'at' p",
|
|
67080
67090
|
other: "P"
|
|
67081
67091
|
};
|
|
67082
|
-
var formatRelative = /* @__PURE__ */ __name$
|
|
67092
|
+
var formatRelative = /* @__PURE__ */ __name$2((token, _date$1, _baseDate, _options) => formatRelativeLocale[token], "formatRelative");
|
|
67083
67093
|
function buildLocalizeFn(args) {
|
|
67084
67094
|
return (value, options) => {
|
|
67085
67095
|
const context = options?.context ? String(options.context) : "standalone";
|
|
@@ -67097,9 +67107,9 @@ function buildLocalizeFn(args) {
|
|
|
67097
67107
|
return valuesArray[index];
|
|
67098
67108
|
};
|
|
67099
67109
|
}
|
|
67100
|
-
__name$
|
|
67110
|
+
__name$2(buildLocalizeFn, "buildLocalizeFn");
|
|
67101
67111
|
var localize = {
|
|
67102
|
-
ordinalNumber: /* @__PURE__ */ __name$
|
|
67112
|
+
ordinalNumber: /* @__PURE__ */ __name$2((dirtyNumber, _options) => {
|
|
67103
67113
|
const number$3 = Number(dirtyNumber);
|
|
67104
67114
|
const rem100 = number$3 % 100;
|
|
67105
67115
|
if (rem100 > 20 || rem100 < 10) switch (rem100 % 10) {
|
|
@@ -67139,7 +67149,7 @@ var localize = {
|
|
|
67139
67149
|
]
|
|
67140
67150
|
},
|
|
67141
67151
|
defaultWidth: "wide",
|
|
67142
|
-
argumentCallback: /* @__PURE__ */ __name$
|
|
67152
|
+
argumentCallback: /* @__PURE__ */ __name$2((quarter) => quarter - 1, "argumentCallback")
|
|
67143
67153
|
}),
|
|
67144
67154
|
month: buildLocalizeFn({
|
|
67145
67155
|
values: {
|
|
@@ -67317,15 +67327,15 @@ function buildMatchFn(args) {
|
|
|
67317
67327
|
};
|
|
67318
67328
|
};
|
|
67319
67329
|
}
|
|
67320
|
-
__name$
|
|
67330
|
+
__name$2(buildMatchFn, "buildMatchFn");
|
|
67321
67331
|
function findKey(object$2, predicate) {
|
|
67322
67332
|
for (const key in object$2) if (Object.prototype.hasOwnProperty.call(object$2, key) && predicate(object$2[key])) return key;
|
|
67323
67333
|
}
|
|
67324
|
-
__name$
|
|
67334
|
+
__name$2(findKey, "findKey");
|
|
67325
67335
|
function findIndex(array$2, predicate) {
|
|
67326
67336
|
for (let key = 0; key < array$2.length; key++) if (predicate(array$2[key])) return key;
|
|
67327
67337
|
}
|
|
67328
|
-
__name$
|
|
67338
|
+
__name$2(findIndex, "findIndex");
|
|
67329
67339
|
function buildMatchPatternFn(args) {
|
|
67330
67340
|
return (string$2, options = {}) => {
|
|
67331
67341
|
const matchResult = string$2.match(args.matchPattern);
|
|
@@ -67342,7 +67352,7 @@ function buildMatchPatternFn(args) {
|
|
|
67342
67352
|
};
|
|
67343
67353
|
};
|
|
67344
67354
|
}
|
|
67345
|
-
__name$
|
|
67355
|
+
__name$2(buildMatchPatternFn, "buildMatchPatternFn");
|
|
67346
67356
|
var enUS = {
|
|
67347
67357
|
code: "en-US",
|
|
67348
67358
|
formatDistance,
|
|
@@ -67353,7 +67363,7 @@ var enUS = {
|
|
|
67353
67363
|
ordinalNumber: buildMatchPatternFn({
|
|
67354
67364
|
matchPattern: /^(\d+)(th|st|nd|rd)?/i,
|
|
67355
67365
|
parsePattern: /\d+/i,
|
|
67356
|
-
valueCallback: /* @__PURE__ */ __name$
|
|
67366
|
+
valueCallback: /* @__PURE__ */ __name$2((value) => parseInt(value, 10), "valueCallback")
|
|
67357
67367
|
}),
|
|
67358
67368
|
era: buildMatchFn({
|
|
67359
67369
|
matchPatterns: {
|
|
@@ -67379,7 +67389,7 @@ var enUS = {
|
|
|
67379
67389
|
/4/i
|
|
67380
67390
|
] },
|
|
67381
67391
|
defaultParseWidth: "any",
|
|
67382
|
-
valueCallback: /* @__PURE__ */ __name$
|
|
67392
|
+
valueCallback: /* @__PURE__ */ __name$2((index) => index + 1, "valueCallback")
|
|
67383
67393
|
}),
|
|
67384
67394
|
month: buildMatchFn({
|
|
67385
67395
|
matchPatterns: {
|
|
@@ -67517,14 +67527,14 @@ function formatDistanceStrict(laterDate, earlierDate, options) {
|
|
|
67517
67527
|
return locale.formatDistance("xYears", years, localizeOptions);
|
|
67518
67528
|
}
|
|
67519
67529
|
}
|
|
67520
|
-
__name$
|
|
67530
|
+
__name$2(formatDistanceStrict, "formatDistanceStrict");
|
|
67521
67531
|
function formatDistanceToNowStrict(date$2, options) {
|
|
67522
67532
|
return formatDistanceStrict(date$2, constructNow(date$2), options);
|
|
67523
67533
|
}
|
|
67524
|
-
__name$
|
|
67534
|
+
__name$2(formatDistanceToNowStrict, "formatDistanceToNowStrict");
|
|
67525
67535
|
function createFileStorage(format$3, getPath) {
|
|
67526
67536
|
return {
|
|
67527
|
-
read: /* @__PURE__ */ __name$
|
|
67537
|
+
read: /* @__PURE__ */ __name$2(() => {
|
|
67528
67538
|
const filePath = getPath();
|
|
67529
67539
|
if (!existsSync(filePath)) return;
|
|
67530
67540
|
const contents = readFileSync$1(filePath);
|
|
@@ -67552,10 +67562,10 @@ function createFileStorage(format$3, getPath) {
|
|
|
67552
67562
|
path: getPath
|
|
67553
67563
|
};
|
|
67554
67564
|
}
|
|
67555
|
-
__name$
|
|
67565
|
+
__name$2(createFileStorage, "createFileStorage");
|
|
67556
67566
|
function createTemporaryTermsPrompt(deps) {
|
|
67557
67567
|
const { temporaryAccountLogger, prompt } = deps;
|
|
67558
|
-
return /* @__PURE__ */ __name$
|
|
67568
|
+
return /* @__PURE__ */ __name$2(async function ensureTemporaryTermsAccepted(question, notice) {
|
|
67559
67569
|
if (isNonInteractiveOrCI()) {
|
|
67560
67570
|
temporaryAccountLogger.log(notice);
|
|
67561
67571
|
return true;
|
|
@@ -67564,17 +67574,17 @@ function createTemporaryTermsPrompt(deps) {
|
|
|
67564
67574
|
return typeof answer === "string" && answer.trim().toLowerCase() === "yes";
|
|
67565
67575
|
}, "ensureTemporaryTermsAccepted");
|
|
67566
67576
|
}
|
|
67567
|
-
__name$
|
|
67577
|
+
__name$2(createTemporaryTermsPrompt, "createTemporaryTermsPrompt");
|
|
67568
67578
|
var MEMBERSHIPS_INACCESSIBLE_CODES = [9106, 1e4];
|
|
67569
67579
|
function getErrorCode(err) {
|
|
67570
67580
|
return err?.code;
|
|
67571
67581
|
}
|
|
67572
|
-
__name$
|
|
67582
|
+
__name$2(getErrorCode, "getErrorCode");
|
|
67573
67583
|
function isMembershipsInaccessible(err) {
|
|
67574
67584
|
const code = getErrorCode(err);
|
|
67575
67585
|
return code !== void 0 && MEMBERSHIPS_INACCESSIBLE_CODES.includes(code);
|
|
67576
67586
|
}
|
|
67577
|
-
__name$
|
|
67587
|
+
__name$2(isMembershipsInaccessible, "isMembershipsInaccessible");
|
|
67578
67588
|
function notLoggedInErrorBodies(loginCommand) {
|
|
67579
67589
|
return {
|
|
67580
67590
|
"no-credentials-non-interactive": `Could not authenticate because no credentials were found and the environment is non-interactive. Set a CLOUDFLARE_API_TOKEN environment variable or run \`${loginCommand}\` in an interactive terminal first.`,
|
|
@@ -67584,7 +67594,7 @@ function notLoggedInErrorBodies(loginCommand) {
|
|
|
67584
67594
|
"token-refresh-unreachable": `Your auth token has expired and could not be refreshed because the Cloudflare auth server could not be reached. This is usually a network problem (connectivity, proxy, or IPv6), not an invalid login: your stored credentials were left unchanged. Check your connection and try again.`
|
|
67585
67595
|
};
|
|
67586
67596
|
}
|
|
67587
|
-
__name$
|
|
67597
|
+
__name$2(notLoggedInErrorBodies, "notLoggedInErrorBodies");
|
|
67588
67598
|
function logTemporaryPreviewAccount(temporaryAccountLogger, temporaryPreviewAccount, cached$2) {
|
|
67589
67599
|
const claimExpiresAt = new Date(temporaryPreviewAccount.claim.expiresAt);
|
|
67590
67600
|
temporaryAccountLogger.log(dedent`
|
|
@@ -67594,7 +67604,7 @@ function logTemporaryPreviewAccount(temporaryAccountLogger, temporaryPreviewAcco
|
|
|
67594
67604
|
Claim URL: ${temporaryPreviewAccount.claim.url}
|
|
67595
67605
|
`);
|
|
67596
67606
|
}
|
|
67597
|
-
__name$
|
|
67607
|
+
__name$2(logTemporaryPreviewAccount, "logTemporaryPreviewAccount");
|
|
67598
67608
|
function createCloudflareAuth(descriptor, ctx) {
|
|
67599
67609
|
const { logger: logger$2 } = ctx;
|
|
67600
67610
|
const temporaryAccountLogger = ctx.temporaryAccountLogger ?? logger$2;
|
|
@@ -67611,16 +67621,16 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67611
67621
|
function clearAccountSelection() {
|
|
67612
67622
|
accountSelection = void 0;
|
|
67613
67623
|
}
|
|
67614
|
-
__name$
|
|
67624
|
+
__name$2(clearAccountSelection, "clearAccountSelection");
|
|
67615
67625
|
function purgeAccountCaches() {
|
|
67616
67626
|
clearAccountSelection();
|
|
67617
67627
|
configCache.purgeConfigCaches();
|
|
67618
67628
|
}
|
|
67619
|
-
__name$
|
|
67629
|
+
__name$2(purgeAccountCaches, "purgeAccountCaches");
|
|
67620
67630
|
const credentialStorage = createCredentialStorageContext({
|
|
67621
67631
|
serviceName: descriptor.keyringServiceName,
|
|
67622
67632
|
getConfigPath: descriptor.getConfigPath,
|
|
67623
|
-
isKeyringEnabled: /* @__PURE__ */ __name$
|
|
67633
|
+
isKeyringEnabled: /* @__PURE__ */ __name$2(() => preferences.readUserPreferences().keyring_enabled === true, "isKeyringEnabled"),
|
|
67624
67634
|
logger: logger$2,
|
|
67625
67635
|
isNonInteractiveOrCI,
|
|
67626
67636
|
loginCommand: descriptor.commands.login,
|
|
@@ -67630,8 +67640,8 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67630
67640
|
const oauthFlow = createOAuthFlow({
|
|
67631
67641
|
logger: logger$2,
|
|
67632
67642
|
isNonInteractiveOrCI,
|
|
67633
|
-
openInBrowser: /* @__PURE__ */ __name$
|
|
67634
|
-
hasEnvCredentials: /* @__PURE__ */ __name$
|
|
67643
|
+
openInBrowser: /* @__PURE__ */ __name$2((url$2) => openInBrowser(url$2, logger$2), "openInBrowser"),
|
|
67644
|
+
hasEnvCredentials: /* @__PURE__ */ __name$2(() => getAuthFromEnv({ allowGlobalAuthKey }) !== void 0, "hasEnvCredentials"),
|
|
67635
67645
|
purgeOnLoginOrLogout: purgeAccountCaches,
|
|
67636
67646
|
clientId: descriptor.clientId,
|
|
67637
67647
|
consent: descriptor.consent,
|
|
@@ -67655,27 +67665,27 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67655
67665
|
function setProfile(profile) {
|
|
67656
67666
|
oauthFlow.setProfile(profile);
|
|
67657
67667
|
}
|
|
67658
|
-
__name$
|
|
67668
|
+
__name$2(setProfile, "setProfile");
|
|
67659
67669
|
function getActiveProfile() {
|
|
67660
67670
|
return oauthFlow.getActiveProfile();
|
|
67661
67671
|
}
|
|
67662
|
-
__name$
|
|
67672
|
+
__name$2(getActiveProfile, "getActiveProfile");
|
|
67663
67673
|
function getCredentialStore() {
|
|
67664
67674
|
return credentialStorage.getActiveStore(oauthFlow.getActiveProfile());
|
|
67665
67675
|
}
|
|
67666
|
-
__name$
|
|
67676
|
+
__name$2(getCredentialStore, "getCredentialStore");
|
|
67667
67677
|
function setTemporaryAllowed(allowed, request$2) {
|
|
67668
67678
|
oauthFlow.setTemporaryAllowed(allowed, request$2);
|
|
67669
67679
|
}
|
|
67670
|
-
__name$
|
|
67680
|
+
__name$2(setTemporaryAllowed, "setTemporaryAllowed");
|
|
67671
67681
|
function getAPIToken$1() {
|
|
67672
67682
|
return oauthFlow.getAPIToken();
|
|
67673
67683
|
}
|
|
67674
|
-
__name$
|
|
67684
|
+
__name$2(getAPIToken$1, "getAPIToken");
|
|
67675
67685
|
function requireApiToken$1() {
|
|
67676
67686
|
return oauthFlow.requireApiToken();
|
|
67677
67687
|
}
|
|
67678
|
-
__name$
|
|
67688
|
+
__name$2(requireApiToken$1, "requireApiToken");
|
|
67679
67689
|
function withLoginDefaults(complianceConfig, props) {
|
|
67680
67690
|
return {
|
|
67681
67691
|
complianceConfig,
|
|
@@ -67687,43 +67697,43 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67687
67697
|
device: props?.device ?? descriptor.useDeviceFlowByDefault ?? false
|
|
67688
67698
|
};
|
|
67689
67699
|
}
|
|
67690
|
-
__name$
|
|
67700
|
+
__name$2(withLoginDefaults, "withLoginDefaults");
|
|
67691
67701
|
async function login(complianceConfig, props) {
|
|
67692
67702
|
return oauthFlow.login(withLoginDefaults(complianceConfig, props));
|
|
67693
67703
|
}
|
|
67694
|
-
__name$
|
|
67704
|
+
__name$2(login, "login");
|
|
67695
67705
|
async function logout(profile) {
|
|
67696
67706
|
return oauthFlow.logout(profile);
|
|
67697
67707
|
}
|
|
67698
|
-
__name$
|
|
67708
|
+
__name$2(logout, "logout");
|
|
67699
67709
|
async function loginOrRefreshIfRequired(complianceConfig, props) {
|
|
67700
67710
|
if (oauthFlow.getActiveTemporaryAccount()) return { loggedIn: true };
|
|
67701
67711
|
return oauthFlow.loginOrRefreshIfRequired(withLoginDefaults(complianceConfig, props));
|
|
67702
67712
|
}
|
|
67703
|
-
__name$
|
|
67713
|
+
__name$2(loginOrRefreshIfRequired, "loginOrRefreshIfRequired");
|
|
67704
67714
|
async function getOAuthTokenFromLocalState() {
|
|
67705
67715
|
return oauthFlow.getOAuthTokenFromLocalState();
|
|
67706
67716
|
}
|
|
67707
|
-
__name$
|
|
67717
|
+
__name$2(getOAuthTokenFromLocalState, "getOAuthTokenFromLocalState");
|
|
67708
67718
|
function getScopes() {
|
|
67709
67719
|
return oauthFlow.getScopes();
|
|
67710
67720
|
}
|
|
67711
|
-
__name$
|
|
67721
|
+
__name$2(getScopes, "getScopes");
|
|
67712
67722
|
function readAuthCredentials() {
|
|
67713
67723
|
return credentialStorage.storageFactory(getActiveProfile()).read();
|
|
67714
67724
|
}
|
|
67715
|
-
__name$
|
|
67725
|
+
__name$2(readAuthCredentials, "readAuthCredentials");
|
|
67716
67726
|
function writeAuthCredentials(config$3) {
|
|
67717
67727
|
clearAccountSelection();
|
|
67718
67728
|
credentialStorage.storageFactory(getActiveProfile()).write(config$3);
|
|
67719
67729
|
}
|
|
67720
|
-
__name$
|
|
67730
|
+
__name$2(writeAuthCredentials, "writeAuthCredentials");
|
|
67721
67731
|
function getAccountCacheFileName() {
|
|
67722
67732
|
const profile = oauthFlow.getActiveProfile();
|
|
67723
67733
|
if (profile === "default") return `${descriptor.accountCachePrefix}.json`;
|
|
67724
67734
|
return `${descriptor.accountCachePrefix}-${profile}.json`;
|
|
67725
67735
|
}
|
|
67726
|
-
__name$
|
|
67736
|
+
__name$2(getAccountCacheFileName, "getAccountCacheFileName");
|
|
67727
67737
|
function retainAccountSelection(account) {
|
|
67728
67738
|
accountSelection = {
|
|
67729
67739
|
account,
|
|
@@ -67731,7 +67741,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67731
67741
|
};
|
|
67732
67742
|
if (persistAccountSelection) configCache.saveToConfigCache(getAccountCacheFileName(), { account });
|
|
67733
67743
|
}
|
|
67734
|
-
__name$
|
|
67744
|
+
__name$2(retainAccountSelection, "retainAccountSelection");
|
|
67735
67745
|
function resolveAccountSelection() {
|
|
67736
67746
|
const profile = getActiveProfile();
|
|
67737
67747
|
if (persistAccountSelection) {
|
|
@@ -67743,12 +67753,12 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67743
67753
|
} else if (accountSelection?.profile !== profile) clearAccountSelection();
|
|
67744
67754
|
return accountSelection?.account;
|
|
67745
67755
|
}
|
|
67746
|
-
__name$
|
|
67756
|
+
__name$2(resolveAccountSelection, "resolveAccountSelection");
|
|
67747
67757
|
function getAccountFromCache() {
|
|
67748
67758
|
if (!persistAccountSelection) return;
|
|
67749
67759
|
return configCache.getConfigCache(getAccountCacheFileName()).account;
|
|
67750
67760
|
}
|
|
67751
|
-
__name$
|
|
67761
|
+
__name$2(getAccountFromCache, "getAccountFromCache");
|
|
67752
67762
|
async function fetchAccountsPaged(complianceConfig, resource, credentials) {
|
|
67753
67763
|
const results = [];
|
|
67754
67764
|
let getMoreResults = true;
|
|
@@ -67766,7 +67776,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
67766
67776
|
}
|
|
67767
67777
|
return results;
|
|
67768
67778
|
}
|
|
67769
|
-
__name$
|
|
67779
|
+
__name$2(fetchAccountsPaged, "fetchAccountsPaged");
|
|
67770
67780
|
async function fetchAllAccounts(complianceConfig, options = {}) {
|
|
67771
67781
|
const { throwOnEmpty = true } = options;
|
|
67772
67782
|
const loginResult = await loginOrRefreshIfRequired(complianceConfig);
|
|
@@ -67790,7 +67800,7 @@ In a non-interactive environment, it is mandatory to specify an account ID, eith
|
|
|
67790
67800
|
Alternatively, try running \`${descriptor.commands.login}\` to re-authenticate.`, { telemetryMessage: "user account fetch empty" });
|
|
67791
67801
|
return usableAccounts;
|
|
67792
67802
|
}
|
|
67793
|
-
__name$
|
|
67803
|
+
__name$2(fetchAllAccounts, "fetchAllAccounts");
|
|
67794
67804
|
function getActiveAccountId(config$3) {
|
|
67795
67805
|
const temporaryAccount = oauthFlow.getActiveTemporaryAccount();
|
|
67796
67806
|
if (temporaryAccount) return temporaryAccount.account.id;
|
|
@@ -67799,7 +67809,7 @@ Alternatively, try running \`${descriptor.commands.login}\` to re-authenticate.`
|
|
|
67799
67809
|
if (envAccountId) return envAccountId;
|
|
67800
67810
|
return resolveAccountSelection()?.id;
|
|
67801
67811
|
}
|
|
67802
|
-
__name$
|
|
67812
|
+
__name$2(getActiveAccountId, "getActiveAccountId");
|
|
67803
67813
|
async function selectAccountId(config$3) {
|
|
67804
67814
|
const accounts = await fetchAllAccounts(config$3);
|
|
67805
67815
|
if (accounts.length === 1) {
|
|
@@ -67832,7 +67842,7 @@ ${accounts.map((account) => ` \`${redactAccountName ? "(redacted)" : account.na
|
|
|
67832
67842
|
throw e;
|
|
67833
67843
|
}
|
|
67834
67844
|
}
|
|
67835
|
-
__name$
|
|
67845
|
+
__name$2(selectAccountId, "selectAccountId");
|
|
67836
67846
|
async function getOrSelectAccountId(config$3) {
|
|
67837
67847
|
const activeAccountId = getActiveAccountId(config$3);
|
|
67838
67848
|
if (activeAccountId) return activeAccountId;
|
|
@@ -67841,7 +67851,7 @@ ${accounts.map((account) => ` \`${redactAccountName ? "(redacted)" : account.na
|
|
|
67841
67851
|
});
|
|
67842
67852
|
return accountSelectionPromise;
|
|
67843
67853
|
}
|
|
67844
|
-
__name$
|
|
67854
|
+
__name$2(getOrSelectAccountId, "getOrSelectAccountId");
|
|
67845
67855
|
async function requireAuth(config$3) {
|
|
67846
67856
|
if (oauthFlow.isTemporaryAllowed()) {
|
|
67847
67857
|
if (getCloudflareComplianceRegion(config$3) !== "public") throw new UserError("Temporary accounts aren't available when the compliance region is not set to public.", { telemetryMessage: "user temporary account unavailable in compliance region" });
|
|
@@ -67860,7 +67870,7 @@ ${accounts.map((account) => ` \`${redactAccountName ? "(redacted)" : account.na
|
|
|
67860
67870
|
if (!accountId) throw new UserError("No account id found, quitting...", { telemetryMessage: "user auth missing account id" });
|
|
67861
67871
|
return accountId;
|
|
67862
67872
|
}
|
|
67863
|
-
__name$
|
|
67873
|
+
__name$2(requireAuth, "requireAuth");
|
|
67864
67874
|
return {
|
|
67865
67875
|
setProfile,
|
|
67866
67876
|
getActiveProfile,
|
|
@@ -67882,24 +67892,24 @@ ${accounts.map((account) => ` \`${redactAccountName ? "(redacted)" : account.na
|
|
|
67882
67892
|
requireAuth
|
|
67883
67893
|
};
|
|
67884
67894
|
}
|
|
67885
|
-
__name$
|
|
67895
|
+
__name$2(createCloudflareAuth, "createCloudflareAuth");
|
|
67886
67896
|
var DIRECTORY_BINDINGS_FILE = "profiles/directory-bindings.json";
|
|
67887
67897
|
var ENCRYPTED_PROFILE_CONFIG_EXTENSION = ".enc";
|
|
67888
67898
|
function createCloudflareProfileStore(ctx) {
|
|
67889
67899
|
const { logger: logger$2, getConfigPath, keyringServiceName, format: format$3 } = ctx;
|
|
67890
67900
|
const plaintextExtension = `.${format$3}`;
|
|
67891
67901
|
function plaintextPath(profile) {
|
|
67892
|
-
return getAuthConfigFilePath$
|
|
67902
|
+
return getAuthConfigFilePath$1(getConfigPath(), profile, format$3);
|
|
67893
67903
|
}
|
|
67894
|
-
__name$
|
|
67904
|
+
__name$2(plaintextPath, "plaintextPath");
|
|
67895
67905
|
function encryptedPath(profile) {
|
|
67896
|
-
return getEncryptedAuthConfigFilePath$
|
|
67906
|
+
return getEncryptedAuthConfigFilePath$1(getConfigPath(), profile);
|
|
67897
67907
|
}
|
|
67898
|
-
__name$
|
|
67908
|
+
__name$2(encryptedPath, "encryptedPath");
|
|
67899
67909
|
function getProfileConfigDirectory() {
|
|
67900
67910
|
return path__default.dirname(plaintextPath("default"));
|
|
67901
67911
|
}
|
|
67902
|
-
__name$
|
|
67912
|
+
__name$2(getProfileConfigDirectory, "getProfileConfigDirectory");
|
|
67903
67913
|
const configs = {
|
|
67904
67914
|
exists(profile) {
|
|
67905
67915
|
return existsSync(plaintextPath(profile)) || existsSync(encryptedPath(profile));
|
|
@@ -67926,7 +67936,7 @@ function createCloudflareProfileStore(ctx) {
|
|
|
67926
67936
|
function getDirectoryBindingsPath() {
|
|
67927
67937
|
return path__default.join(getConfigPath(), DIRECTORY_BINDINGS_FILE);
|
|
67928
67938
|
}
|
|
67929
|
-
__name$
|
|
67939
|
+
__name$2(getDirectoryBindingsPath, "getDirectoryBindingsPath");
|
|
67930
67940
|
return createProfileStore({
|
|
67931
67941
|
configs,
|
|
67932
67942
|
bindings: {
|
|
@@ -67946,17 +67956,17 @@ function createCloudflareProfileStore(ctx) {
|
|
|
67946
67956
|
}
|
|
67947
67957
|
});
|
|
67948
67958
|
}
|
|
67949
|
-
__name$
|
|
67959
|
+
__name$2(createCloudflareProfileStore, "createCloudflareProfileStore");
|
|
67950
67960
|
function createKeyringPreference(deps) {
|
|
67951
67961
|
const { loginCommand, createProfileCommand, keyringServiceName, getConfigPath, format: format$3, preferences } = deps;
|
|
67952
|
-
const { readUserPreferences: readUserPreferences$
|
|
67962
|
+
const { readUserPreferences: readUserPreferences$1, updateUserPreferences: updateUserPreferences$1 } = preferences;
|
|
67953
67963
|
function describeProfile(profile) {
|
|
67954
67964
|
return profile ?? "default";
|
|
67955
67965
|
}
|
|
67956
|
-
__name$
|
|
67966
|
+
__name$2(describeProfile, "describeProfile");
|
|
67957
67967
|
function listEncryptedProfiles(logger$2) {
|
|
67958
67968
|
const encrypted = [];
|
|
67959
|
-
if (existsSync(getEncryptedAuthConfigFilePath$
|
|
67969
|
+
if (existsSync(getEncryptedAuthConfigFilePath$1(getConfigPath()))) encrypted.push(void 0);
|
|
67960
67970
|
const profileStore = createCloudflareProfileStore({
|
|
67961
67971
|
logger: logger$2,
|
|
67962
67972
|
getConfigPath,
|
|
@@ -67969,11 +67979,11 @@ function createKeyringPreference(deps) {
|
|
|
67969
67979
|
} catch {
|
|
67970
67980
|
continue;
|
|
67971
67981
|
}
|
|
67972
|
-
if (existsSync(getEncryptedAuthConfigFilePath$
|
|
67982
|
+
if (existsSync(getEncryptedAuthConfigFilePath$1(getConfigPath(), name))) encrypted.push(name);
|
|
67973
67983
|
}
|
|
67974
67984
|
return encrypted;
|
|
67975
67985
|
}
|
|
67976
|
-
__name$
|
|
67986
|
+
__name$2(listEncryptedProfiles, "listEncryptedProfiles");
|
|
67977
67987
|
function scrubAllEncryptedProfiles(logger$2) {
|
|
67978
67988
|
const encryptedProfiles = listEncryptedProfiles(logger$2);
|
|
67979
67989
|
if (encryptedProfiles.length === 0) return;
|
|
@@ -67997,60 +68007,60 @@ function createKeyringPreference(deps) {
|
|
|
67997
68007
|
}
|
|
67998
68008
|
if (unreachable.length > 0) logger$2.warn(`The keyring backend was not reachable on this host, so the keyring entry for ${unreachable.map((p$2) => `"${p$2}"`).join(", ")} could not be cleared. Clear it manually if it persists.`);
|
|
67999
68009
|
}
|
|
68000
|
-
__name$
|
|
68001
|
-
function setKeyringPreference$
|
|
68010
|
+
__name$2(scrubAllEncryptedProfiles, "scrubAllEncryptedProfiles");
|
|
68011
|
+
function setKeyringPreference$1(enabled, ctx) {
|
|
68002
68012
|
const { logger: logger$2, getCredentialStore } = ctx;
|
|
68003
|
-
const previouslyEnabled = readUserPreferences$
|
|
68013
|
+
const previouslyEnabled = readUserPreferences$1().keyring_enabled === true;
|
|
68004
68014
|
const envOverride = getCloudflareAuthUseKeyringFromEnv();
|
|
68005
68015
|
if (envOverride !== void 0 && envOverride !== enabled) logger$2.warn(`CLOUDFLARE_AUTH_USE_KEYRING=${envOverride} overrides ${enabled ? "enabling" : "disabling"} keyring storage for this command.`);
|
|
68006
68016
|
if (!enabled && envOverride !== true) scrubAllEncryptedProfiles(logger$2);
|
|
68007
|
-
updateUserPreferences$
|
|
68017
|
+
updateUserPreferences$1({ keyring_enabled: enabled });
|
|
68008
68018
|
if (enabled && envOverride !== false) try {
|
|
68009
68019
|
if (getCredentialStore().kind !== "encrypted-file") {
|
|
68010
|
-
updateUserPreferences$
|
|
68020
|
+
updateUserPreferences$1({ keyring_enabled: previouslyEnabled });
|
|
68011
68021
|
logger$2.warn("Keyring storage isn't available on this host (see warning above), so it was not enabled. Try again once the keyring backend is reachable.");
|
|
68012
68022
|
}
|
|
68013
68023
|
} catch (e) {
|
|
68014
|
-
updateUserPreferences$
|
|
68024
|
+
updateUserPreferences$1({ keyring_enabled: previouslyEnabled });
|
|
68015
68025
|
throw e;
|
|
68016
68026
|
}
|
|
68017
|
-
return { enabled: readUserPreferences$
|
|
68027
|
+
return { enabled: readUserPreferences$1().keyring_enabled === true };
|
|
68018
68028
|
}
|
|
68019
|
-
__name$
|
|
68020
|
-
return { setKeyringPreference: setKeyringPreference$
|
|
68029
|
+
__name$2(setKeyringPreference$1, "setKeyringPreference");
|
|
68030
|
+
return { setKeyringPreference: setKeyringPreference$1 };
|
|
68021
68031
|
}
|
|
68022
|
-
__name$
|
|
68032
|
+
__name$2(createKeyringPreference, "createKeyringPreference");
|
|
68023
68033
|
function createAuthConfigFileHelpers(deps) {
|
|
68024
68034
|
const { getConfigPath, format: format$3 } = deps;
|
|
68025
68035
|
function getAuthConfigFilePath2(profile) {
|
|
68026
|
-
return getAuthConfigFilePath$
|
|
68036
|
+
return getAuthConfigFilePath$1(getConfigPath(), profile, format$3);
|
|
68027
68037
|
}
|
|
68028
|
-
__name$
|
|
68038
|
+
__name$2(getAuthConfigFilePath2, "getAuthConfigFilePath");
|
|
68029
68039
|
function getEncryptedAuthConfigFilePath2(profile) {
|
|
68030
|
-
return getEncryptedAuthConfigFilePath$
|
|
68040
|
+
return getEncryptedAuthConfigFilePath$1(getConfigPath(), profile);
|
|
68031
68041
|
}
|
|
68032
|
-
__name$
|
|
68033
|
-
function defaultAuthConfigStorage$
|
|
68042
|
+
__name$2(getEncryptedAuthConfigFilePath2, "getEncryptedAuthConfigFilePath");
|
|
68043
|
+
function defaultAuthConfigStorage$1(profile) {
|
|
68034
68044
|
return createFileStorage(format$3, () => getAuthConfigFilePath2(profile));
|
|
68035
68045
|
}
|
|
68036
|
-
__name$
|
|
68037
|
-
function writeAuthConfigFile$
|
|
68038
|
-
defaultAuthConfigStorage$
|
|
68046
|
+
__name$2(defaultAuthConfigStorage$1, "defaultAuthConfigStorage");
|
|
68047
|
+
function writeAuthConfigFile$1(config$3, profile) {
|
|
68048
|
+
defaultAuthConfigStorage$1(profile).write(config$3);
|
|
68039
68049
|
}
|
|
68040
|
-
__name$
|
|
68041
|
-
function readAuthConfigFile$
|
|
68042
|
-
return defaultAuthConfigStorage$
|
|
68050
|
+
__name$2(writeAuthConfigFile$1, "writeAuthConfigFile");
|
|
68051
|
+
function readAuthConfigFile$1(profile) {
|
|
68052
|
+
return defaultAuthConfigStorage$1(profile).read();
|
|
68043
68053
|
}
|
|
68044
|
-
__name$
|
|
68054
|
+
__name$2(readAuthConfigFile$1, "readAuthConfigFile");
|
|
68045
68055
|
return {
|
|
68046
68056
|
getAuthConfigFilePath: getAuthConfigFilePath2,
|
|
68047
68057
|
getEncryptedAuthConfigFilePath: getEncryptedAuthConfigFilePath2,
|
|
68048
|
-
defaultAuthConfigStorage: defaultAuthConfigStorage$
|
|
68049
|
-
readAuthConfigFile: readAuthConfigFile$
|
|
68050
|
-
writeAuthConfigFile: writeAuthConfigFile$
|
|
68058
|
+
defaultAuthConfigStorage: defaultAuthConfigStorage$1,
|
|
68059
|
+
readAuthConfigFile: readAuthConfigFile$1,
|
|
68060
|
+
writeAuthConfigFile: writeAuthConfigFile$1
|
|
68051
68061
|
};
|
|
68052
68062
|
}
|
|
68053
|
-
__name$
|
|
68063
|
+
__name$2(createAuthConfigFileHelpers, "createAuthConfigFileHelpers");
|
|
68054
68064
|
|
|
68055
68065
|
//#endregion
|
|
68056
68066
|
//#region ../workers-auth/dist/cf/index.mjs
|
|
@@ -68066,9 +68076,9 @@ var CF_CONSENT_PAGES = {
|
|
|
68066
68076
|
error: "Error: Consent denied. You must grant consent to cf in order to login.\nIf you don't want to do this consider passing an API token via the `CLOUDFLARE_API_TOKEN` environment variable"
|
|
68067
68077
|
}
|
|
68068
68078
|
};
|
|
68069
|
-
var getClientIdFromEnv
|
|
68079
|
+
var getClientIdFromEnv = getEnvironmentVariableFactory({
|
|
68070
68080
|
variableName: "CLOUDFLARE_CLIENT_ID",
|
|
68071
|
-
defaultValue: /* @__PURE__ */ __name$
|
|
68081
|
+
defaultValue: /* @__PURE__ */ __name$2(() => "cbca97e7-c331-4cdd-8fd8-e25a451b98bf", "defaultValue")
|
|
68072
68082
|
});
|
|
68073
68083
|
function getCfConfigPath() {
|
|
68074
68084
|
return getGlobalConfigPath({
|
|
@@ -68077,7 +68087,7 @@ function getCfConfigPath() {
|
|
|
68077
68087
|
useLegacyHomeDir: false
|
|
68078
68088
|
});
|
|
68079
68089
|
}
|
|
68080
|
-
__name$
|
|
68090
|
+
__name$2(getCfConfigPath, "getCfConfigPath");
|
|
68081
68091
|
var CF_CLIENT_REGISTERED_SCOPES = [
|
|
68082
68092
|
"access:read",
|
|
68083
68093
|
"access:write",
|
|
@@ -68572,30 +68582,30 @@ var CF_UNGRANTABLE_SCOPE_SET = new Set([
|
|
|
68572
68582
|
"oauth_account_ssl_and_certificates_write"
|
|
68573
68583
|
]);
|
|
68574
68584
|
var CF_REQUESTABLE_SCOPES = CF_CLIENT_REGISTERED_SCOPES.filter((scope) => !CF_UNGRANTABLE_SCOPE_SET.has(scope));
|
|
68575
|
-
var DefaultScopeKeys
|
|
68576
|
-
function setLoginScopeKeys
|
|
68577
|
-
DefaultScopeKeys
|
|
68585
|
+
var DefaultScopeKeys = [...CF_REQUESTABLE_SCOPES];
|
|
68586
|
+
function setLoginScopeKeys(scopes) {
|
|
68587
|
+
DefaultScopeKeys = scopes;
|
|
68578
68588
|
}
|
|
68579
|
-
__name$
|
|
68589
|
+
__name$2(setLoginScopeKeys, "setLoginScopeKeys");
|
|
68580
68590
|
var CF_SCOPE_SET = new Set(CF_REQUESTABLE_SCOPES);
|
|
68581
|
-
function validateScopeKeys
|
|
68591
|
+
function validateScopeKeys(scopes) {
|
|
68582
68592
|
return scopes.every((scope) => CF_SCOPE_SET.has(scope));
|
|
68583
68593
|
}
|
|
68584
|
-
__name$
|
|
68585
|
-
function getTemporaryAccountConfigFile
|
|
68594
|
+
__name$2(validateScopeKeys, "validateScopeKeys");
|
|
68595
|
+
function getTemporaryAccountConfigFile() {
|
|
68586
68596
|
const environment = getCloudflareApiEnvironmentFromEnv();
|
|
68587
68597
|
return environment === "production" ? "cloudflare-temporary-account.json" : `cloudflare-temporary-account.${environment}.json`;
|
|
68588
68598
|
}
|
|
68589
|
-
__name$
|
|
68599
|
+
__name$2(getTemporaryAccountConfigFile, "getTemporaryAccountConfigFile");
|
|
68590
68600
|
function getCfTemporaryAccountConfigPath() {
|
|
68591
|
-
return path__default.join(getCfConfigPath(), getTemporaryAccountConfigFile
|
|
68601
|
+
return path__default.join(getCfConfigPath(), getTemporaryAccountConfigFile());
|
|
68592
68602
|
}
|
|
68593
|
-
__name$
|
|
68603
|
+
__name$2(getCfTemporaryAccountConfigPath, "getCfTemporaryAccountConfigPath");
|
|
68594
68604
|
function createJsonFileStorage(getPath) {
|
|
68595
68605
|
return createFileStorage("json", getPath);
|
|
68596
68606
|
}
|
|
68597
|
-
__name$
|
|
68598
|
-
var { getAuthConfigFilePath
|
|
68607
|
+
__name$2(createJsonFileStorage, "createJsonFileStorage");
|
|
68608
|
+
var { getAuthConfigFilePath, getEncryptedAuthConfigFilePath, defaultAuthConfigStorage, readAuthConfigFile, writeAuthConfigFile } = createAuthConfigFileHelpers({
|
|
68599
68609
|
getConfigPath: getCfConfigPath,
|
|
68600
68610
|
format: "json"
|
|
68601
68611
|
});
|
|
@@ -68611,7 +68621,7 @@ var CF_CLI = {
|
|
|
68611
68621
|
deviceLogin: "cf auth login"
|
|
68612
68622
|
},
|
|
68613
68623
|
keyringServiceName: CF_KEYRING_SERVICE_NAME,
|
|
68614
|
-
clientId: getClientIdFromEnv
|
|
68624
|
+
clientId: getClientIdFromEnv,
|
|
68615
68625
|
consent: CF_CONSENT_PAGES,
|
|
68616
68626
|
redirectUri: CF_OAUTH_CALLBACK_URL,
|
|
68617
68627
|
useDeviceFlowByDefault: true,
|
|
@@ -68621,15 +68631,15 @@ var CF_CLI = {
|
|
|
68621
68631
|
fileFormat: "json",
|
|
68622
68632
|
accountCachePrefix: "cloudflare-account",
|
|
68623
68633
|
cacheNamespace: "cloudflare",
|
|
68624
|
-
getConfigFileLabel: /* @__PURE__ */ __name$
|
|
68625
|
-
getDefaultScopeKeys: /* @__PURE__ */ __name$
|
|
68634
|
+
getConfigFileLabel: /* @__PURE__ */ __name$2(() => "cloudflare.config.ts", "getConfigFileLabel"),
|
|
68635
|
+
getDefaultScopeKeys: /* @__PURE__ */ __name$2(() => DefaultScopeKeys, "getDefaultScopeKeys")
|
|
68626
68636
|
};
|
|
68627
68637
|
var cfPreferences = createPreferences(getCfConfigPath);
|
|
68628
|
-
var { readUserPreferences
|
|
68638
|
+
var { readUserPreferences, updateUserPreferences } = cfPreferences;
|
|
68629
68639
|
function createCfAuth(ctx) {
|
|
68630
68640
|
return createCloudflareAuth(CF_CLI, ctx);
|
|
68631
68641
|
}
|
|
68632
|
-
__name$
|
|
68642
|
+
__name$2(createCfAuth, "createCfAuth");
|
|
68633
68643
|
function createCfProfileStore(ctx) {
|
|
68634
68644
|
return createCloudflareProfileStore({
|
|
68635
68645
|
logger: ctx.logger,
|
|
@@ -68638,7 +68648,7 @@ function createCfProfileStore(ctx) {
|
|
|
68638
68648
|
format: "json"
|
|
68639
68649
|
});
|
|
68640
68650
|
}
|
|
68641
|
-
__name$
|
|
68651
|
+
__name$2(createCfProfileStore, "createCfProfileStore");
|
|
68642
68652
|
var cfKeyringPreference = createKeyringPreference({
|
|
68643
68653
|
loginCommand: CF_CLI.commands.login,
|
|
68644
68654
|
createProfileCommand: CF_CLI.commands.createProfile,
|
|
@@ -68647,10 +68657,10 @@ var cfKeyringPreference = createKeyringPreference({
|
|
|
68647
68657
|
format: "json",
|
|
68648
68658
|
preferences: cfPreferences
|
|
68649
68659
|
});
|
|
68650
|
-
function setKeyringPreference
|
|
68660
|
+
function setKeyringPreference(enabled, ctx) {
|
|
68651
68661
|
return cfKeyringPreference.setKeyringPreference(enabled, ctx);
|
|
68652
68662
|
}
|
|
68653
|
-
__name$
|
|
68663
|
+
__name$2(setKeyringPreference, "setKeyringPreference");
|
|
68654
68664
|
|
|
68655
68665
|
//#endregion
|
|
68656
68666
|
//#region ../../node_modules/.pnpm/@remix-run+node-fetch-server@1.0.0/node_modules/@remix-run/node-fetch-server/dist/lib/request-listener.js
|
|
@@ -80570,7 +80580,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
80570
80580
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
80571
80581
|
var __getProtoOf = Object.getPrototypeOf;
|
|
80572
80582
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
80573
|
-
var __name$
|
|
80583
|
+
var __name$1 = (target$1, value) => __defProp$1(target$1, "name", {
|
|
80574
80584
|
value,
|
|
80575
80585
|
configurable: true
|
|
80576
80586
|
});
|
|
@@ -80612,7 +80622,7 @@ var require_constants = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
80612
80622
|
kListener: Symbol("kListener"),
|
|
80613
80623
|
kStatusCode: Symbol("status-code"),
|
|
80614
80624
|
kWebSocket: Symbol("websocket"),
|
|
80615
|
-
NOOP: /* @__PURE__ */ __name$
|
|
80625
|
+
NOOP: /* @__PURE__ */ __name$1(() => {}, "NOOP")
|
|
80616
80626
|
};
|
|
80617
80627
|
} });
|
|
80618
80628
|
var require_buffer_util = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/buffer-util.js"(exports$1, module$1) {
|
|
@@ -80631,20 +80641,20 @@ var require_buffer_util = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_
|
|
|
80631
80641
|
if (offset < totalLength) return new FastBuffer$1(target$1.buffer, target$1.byteOffset, offset);
|
|
80632
80642
|
return target$1;
|
|
80633
80643
|
}
|
|
80634
|
-
__name$
|
|
80644
|
+
__name$1(concat, "concat");
|
|
80635
80645
|
function _mask(source, mask, output$1, offset, length) {
|
|
80636
80646
|
for (let i$1 = 0; i$1 < length; i$1++) output$1[offset + i$1] = source[i$1] ^ mask[i$1 & 3];
|
|
80637
80647
|
}
|
|
80638
|
-
__name$
|
|
80648
|
+
__name$1(_mask, "_mask");
|
|
80639
80649
|
function _unmask(buffer$3, mask) {
|
|
80640
80650
|
for (let i$1 = 0; i$1 < buffer$3.length; i$1++) buffer$3[i$1] ^= mask[i$1 & 3];
|
|
80641
80651
|
}
|
|
80642
|
-
__name$
|
|
80652
|
+
__name$1(_unmask, "_unmask");
|
|
80643
80653
|
function toArrayBuffer$2(buf) {
|
|
80644
80654
|
if (buf.length === buf.buffer.byteLength) return buf.buffer;
|
|
80645
80655
|
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);
|
|
80646
80656
|
}
|
|
80647
|
-
__name$
|
|
80657
|
+
__name$1(toArrayBuffer$2, "toArrayBuffer");
|
|
80648
80658
|
function toBuffer$1(data$1) {
|
|
80649
80659
|
toBuffer$1.readOnly = true;
|
|
80650
80660
|
if (Buffer.isBuffer(data$1)) return data$1;
|
|
@@ -80657,7 +80667,7 @@ var require_buffer_util = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_
|
|
|
80657
80667
|
}
|
|
80658
80668
|
return buf;
|
|
80659
80669
|
}
|
|
80660
|
-
__name$
|
|
80670
|
+
__name$1(toBuffer$1, "toBuffer");
|
|
80661
80671
|
module$1.exports = {
|
|
80662
80672
|
concat,
|
|
80663
80673
|
mask: _mask,
|
|
@@ -80682,7 +80692,7 @@ var require_limiter = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modu
|
|
|
80682
80692
|
var kRun = Symbol("kRun");
|
|
80683
80693
|
var Limiter = class {
|
|
80684
80694
|
static {
|
|
80685
|
-
__name$
|
|
80695
|
+
__name$1(this, "Limiter");
|
|
80686
80696
|
}
|
|
80687
80697
|
/**
|
|
80688
80698
|
* Creates a new `Limiter`.
|
|
@@ -80745,7 +80755,7 @@ var require_permessage_deflate = __commonJS({ "../../node_modules/.pnpm/ws@8.21.
|
|
|
80745
80755
|
var zlibLimiter;
|
|
80746
80756
|
var PerMessageDeflate2 = class {
|
|
80747
80757
|
static {
|
|
80748
|
-
__name$
|
|
80758
|
+
__name$1(this, "PerMessageDeflate");
|
|
80749
80759
|
}
|
|
80750
80760
|
/**
|
|
80751
80761
|
* Creates a PerMessageDeflate instance.
|
|
@@ -81016,7 +81026,7 @@ var require_permessage_deflate = __commonJS({ "../../node_modules/.pnpm/ws@8.21.
|
|
|
81016
81026
|
this[kBuffers].push(chunk);
|
|
81017
81027
|
this[kTotalLength] += chunk.length;
|
|
81018
81028
|
}
|
|
81019
|
-
__name$
|
|
81029
|
+
__name$1(deflateOnData, "deflateOnData");
|
|
81020
81030
|
function inflateOnData(chunk) {
|
|
81021
81031
|
this[kTotalLength] += chunk.length;
|
|
81022
81032
|
if (this[kPerMessageDeflate]._maxPayload < 1 || this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload) {
|
|
@@ -81029,7 +81039,7 @@ var require_permessage_deflate = __commonJS({ "../../node_modules/.pnpm/ws@8.21.
|
|
|
81029
81039
|
this.removeListener("data", inflateOnData);
|
|
81030
81040
|
this.reset();
|
|
81031
81041
|
}
|
|
81032
|
-
__name$
|
|
81042
|
+
__name$1(inflateOnData, "inflateOnData");
|
|
81033
81043
|
function inflateOnError(err) {
|
|
81034
81044
|
this[kPerMessageDeflate]._inflate = null;
|
|
81035
81045
|
if (this[kError$3]) {
|
|
@@ -81039,7 +81049,7 @@ var require_permessage_deflate = __commonJS({ "../../node_modules/.pnpm/ws@8.21.
|
|
|
81039
81049
|
err[kStatusCode] = 1007;
|
|
81040
81050
|
this[kCallback](err);
|
|
81041
81051
|
}
|
|
81042
|
-
__name$
|
|
81052
|
+
__name$1(inflateOnError, "inflateOnError");
|
|
81043
81053
|
} });
|
|
81044
81054
|
var require_validation = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/validation.js"(exports$1, module$1) {
|
|
81045
81055
|
var { isUtf8: isUtf8$1 } = __require("buffer");
|
|
@@ -81177,7 +81187,7 @@ var require_validation = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_m
|
|
|
81177
81187
|
function isValidStatusCode$2(code) {
|
|
81178
81188
|
return code >= 1e3 && code <= 1014 && code !== 1004 && code !== 1005 && code !== 1006 || code >= 3e3 && code <= 4999;
|
|
81179
81189
|
}
|
|
81180
|
-
__name$
|
|
81190
|
+
__name$1(isValidStatusCode$2, "isValidStatusCode");
|
|
81181
81191
|
function _isValidUTF8(buf) {
|
|
81182
81192
|
const len = buf.length;
|
|
81183
81193
|
let i$1 = 0;
|
|
@@ -81194,11 +81204,11 @@ var require_validation = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_m
|
|
|
81194
81204
|
} else return false;
|
|
81195
81205
|
return true;
|
|
81196
81206
|
}
|
|
81197
|
-
__name$
|
|
81207
|
+
__name$1(_isValidUTF8, "_isValidUTF8");
|
|
81198
81208
|
function isBlob2(value) {
|
|
81199
81209
|
return hasBlob && typeof value === "object" && typeof value.arrayBuffer === "function" && typeof value.type === "string" && typeof value.stream === "function" && (value[Symbol.toStringTag] === "Blob" || value[Symbol.toStringTag] === "File");
|
|
81200
81210
|
}
|
|
81201
|
-
__name$
|
|
81211
|
+
__name$1(isBlob2, "isBlob");
|
|
81202
81212
|
module$1.exports = {
|
|
81203
81213
|
isBlob: isBlob2,
|
|
81204
81214
|
isValidStatusCode: isValidStatusCode$2,
|
|
@@ -81231,7 +81241,7 @@ var require_receiver = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mod
|
|
|
81231
81241
|
var DEFER_EVENT = 6;
|
|
81232
81242
|
var Receiver2 = class extends Writable$3 {
|
|
81233
81243
|
static {
|
|
81234
|
-
__name$
|
|
81244
|
+
__name$1(this, "Receiver");
|
|
81235
81245
|
}
|
|
81236
81246
|
/**
|
|
81237
81247
|
* Creates a Receiver instance.
|
|
@@ -81694,7 +81704,7 @@ var require_sender = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
81694
81704
|
var GET_BLOB_DATA = 2;
|
|
81695
81705
|
module$1.exports = class _Sender {
|
|
81696
81706
|
static {
|
|
81697
|
-
__name$
|
|
81707
|
+
__name$1(this, "Sender");
|
|
81698
81708
|
}
|
|
81699
81709
|
/**
|
|
81700
81710
|
* Creates a Sender instance.
|
|
@@ -82148,12 +82158,12 @@ var require_sender = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
82148
82158
|
if (typeof callback === "function") callback(err);
|
|
82149
82159
|
}
|
|
82150
82160
|
}
|
|
82151
|
-
__name$
|
|
82161
|
+
__name$1(callCallbacks, "callCallbacks");
|
|
82152
82162
|
function onError$1(sender, err, cb) {
|
|
82153
82163
|
callCallbacks(sender, err, cb);
|
|
82154
82164
|
sender.onerror(err);
|
|
82155
82165
|
}
|
|
82156
|
-
__name$
|
|
82166
|
+
__name$1(onError$1, "onError");
|
|
82157
82167
|
} });
|
|
82158
82168
|
var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/event-target.js"(exports$1, module$1) {
|
|
82159
82169
|
var { kForOnEventAttribute, kListener: kListener$1 } = require_constants();
|
|
@@ -82167,7 +82177,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82167
82177
|
var kWasClean = Symbol("kWasClean");
|
|
82168
82178
|
var Event$1 = class {
|
|
82169
82179
|
static {
|
|
82170
|
-
__name$
|
|
82180
|
+
__name$1(this, "Event");
|
|
82171
82181
|
}
|
|
82172
82182
|
/**
|
|
82173
82183
|
* Create a new `Event`.
|
|
@@ -82196,7 +82206,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82196
82206
|
Object.defineProperty(Event$1.prototype, "type", { enumerable: true });
|
|
82197
82207
|
var CloseEvent$3 = class extends Event$1 {
|
|
82198
82208
|
static {
|
|
82199
|
-
__name$
|
|
82209
|
+
__name$1(this, "CloseEvent");
|
|
82200
82210
|
}
|
|
82201
82211
|
/**
|
|
82202
82212
|
* Create a new `CloseEvent`.
|
|
@@ -82241,7 +82251,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82241
82251
|
Object.defineProperty(CloseEvent$3.prototype, "wasClean", { enumerable: true });
|
|
82242
82252
|
var ErrorEvent$3 = class extends Event$1 {
|
|
82243
82253
|
static {
|
|
82244
|
-
__name$
|
|
82254
|
+
__name$1(this, "ErrorEvent");
|
|
82245
82255
|
}
|
|
82246
82256
|
/**
|
|
82247
82257
|
* Create a new `ErrorEvent`.
|
|
@@ -82274,7 +82284,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82274
82284
|
Object.defineProperty(ErrorEvent$3.prototype, "message", { enumerable: true });
|
|
82275
82285
|
var MessageEvent$2 = class extends Event$1 {
|
|
82276
82286
|
static {
|
|
82277
|
-
__name$
|
|
82287
|
+
__name$1(this, "MessageEvent");
|
|
82278
82288
|
}
|
|
82279
82289
|
/**
|
|
82280
82290
|
* Create a new `MessageEvent`.
|
|
@@ -82304,12 +82314,12 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82304
82314
|
addEventListener(type, handler, options = {}) {
|
|
82305
82315
|
for (const listener of this.listeners(type)) if (!options[kForOnEventAttribute] && listener[kListener$1] === handler && !listener[kForOnEventAttribute]) return;
|
|
82306
82316
|
let wrapper;
|
|
82307
|
-
if (type === "message") wrapper = /* @__PURE__ */ __name$
|
|
82317
|
+
if (type === "message") wrapper = /* @__PURE__ */ __name$1(function onMessage(data$1, isBinary) {
|
|
82308
82318
|
const event = new MessageEvent$2("message", { data: isBinary ? data$1 : data$1.toString() });
|
|
82309
82319
|
event[kTarget] = this;
|
|
82310
82320
|
callListener(handler, this, event);
|
|
82311
82321
|
}, "onMessage");
|
|
82312
|
-
else if (type === "close") wrapper = /* @__PURE__ */ __name$
|
|
82322
|
+
else if (type === "close") wrapper = /* @__PURE__ */ __name$1(function onClose(code, message) {
|
|
82313
82323
|
const event = new CloseEvent$3("close", {
|
|
82314
82324
|
code,
|
|
82315
82325
|
reason: message.toString(),
|
|
@@ -82318,7 +82328,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82318
82328
|
event[kTarget] = this;
|
|
82319
82329
|
callListener(handler, this, event);
|
|
82320
82330
|
}, "onClose");
|
|
82321
|
-
else if (type === "error") wrapper = /* @__PURE__ */ __name$
|
|
82331
|
+
else if (type === "error") wrapper = /* @__PURE__ */ __name$1(function onError$1(error$3) {
|
|
82322
82332
|
const event = new ErrorEvent$3("error", {
|
|
82323
82333
|
error: error$3,
|
|
82324
82334
|
message: error$3.message
|
|
@@ -82326,7 +82336,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82326
82336
|
event[kTarget] = this;
|
|
82327
82337
|
callListener(handler, this, event);
|
|
82328
82338
|
}, "onError");
|
|
82329
|
-
else if (type === "open") wrapper = /* @__PURE__ */ __name$
|
|
82339
|
+
else if (type === "open") wrapper = /* @__PURE__ */ __name$1(function onOpen() {
|
|
82330
82340
|
const event = new Event$1("open");
|
|
82331
82341
|
event[kTarget] = this;
|
|
82332
82342
|
callListener(handler, this, event);
|
|
@@ -82350,7 +82360,7 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node
|
|
|
82350
82360
|
if (typeof listener === "object" && listener.handleEvent) listener.handleEvent.call(listener, event);
|
|
82351
82361
|
else listener.call(thisArg, event);
|
|
82352
82362
|
}
|
|
82353
|
-
__name$
|
|
82363
|
+
__name$1(callListener, "callListener");
|
|
82354
82364
|
} });
|
|
82355
82365
|
var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/extension.js"(exports$1, module$1) {
|
|
82356
82366
|
var { tokenChars } = require_validation();
|
|
@@ -82358,7 +82368,7 @@ var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
82358
82368
|
if (dest[name] === void 0) dest[name] = [elem];
|
|
82359
82369
|
else dest[name].push(elem);
|
|
82360
82370
|
}
|
|
82361
|
-
__name$
|
|
82371
|
+
__name$1(push, "push");
|
|
82362
82372
|
function parse$6(header) {
|
|
82363
82373
|
const offers = /* @__PURE__ */ Object.create(null);
|
|
82364
82374
|
let params = /* @__PURE__ */ Object.create(null);
|
|
@@ -82452,7 +82462,7 @@ var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
82452
82462
|
}
|
|
82453
82463
|
return offers;
|
|
82454
82464
|
}
|
|
82455
|
-
__name$
|
|
82465
|
+
__name$1(parse$6, "parse");
|
|
82456
82466
|
function format$3(extensions) {
|
|
82457
82467
|
return Object.keys(extensions).map((extension2) => {
|
|
82458
82468
|
let configurations = extensions[extension2];
|
|
@@ -82466,7 +82476,7 @@ var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
82466
82476
|
}).join(", ");
|
|
82467
82477
|
}).join(", ");
|
|
82468
82478
|
}
|
|
82469
|
-
__name$
|
|
82479
|
+
__name$1(format$3, "format");
|
|
82470
82480
|
module$1.exports = {
|
|
82471
82481
|
format: format$3,
|
|
82472
82482
|
parse: parse$6
|
|
@@ -82500,7 +82510,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
82500
82510
|
var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
82501
82511
|
var WebSocket2 = class _WebSocket extends EventEmitter$4 {
|
|
82502
82512
|
static {
|
|
82503
|
-
__name$
|
|
82513
|
+
__name$1(this, "WebSocket");
|
|
82504
82514
|
}
|
|
82505
82515
|
/**
|
|
82506
82516
|
* Create a new `WebSocket`.
|
|
@@ -83126,25 +83136,25 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83126
83136
|
if (opts.finishRequest) opts.finishRequest(req, websocket);
|
|
83127
83137
|
else req.end();
|
|
83128
83138
|
}
|
|
83129
|
-
__name$
|
|
83139
|
+
__name$1(initAsClient, "initAsClient");
|
|
83130
83140
|
function emitErrorAndClose(websocket, err) {
|
|
83131
83141
|
websocket._readyState = WebSocket2.CLOSING;
|
|
83132
83142
|
websocket._errorEmitted = true;
|
|
83133
83143
|
websocket.emit("error", err);
|
|
83134
83144
|
websocket.emitClose();
|
|
83135
83145
|
}
|
|
83136
|
-
__name$
|
|
83146
|
+
__name$1(emitErrorAndClose, "emitErrorAndClose");
|
|
83137
83147
|
function netConnect(options) {
|
|
83138
83148
|
options.path = options.socketPath;
|
|
83139
83149
|
return net$5.connect(options);
|
|
83140
83150
|
}
|
|
83141
|
-
__name$
|
|
83151
|
+
__name$1(netConnect, "netConnect");
|
|
83142
83152
|
function tlsConnect(options) {
|
|
83143
83153
|
options.path = void 0;
|
|
83144
83154
|
if (!options.servername && options.servername !== "") options.servername = net$5.isIP(options.host) ? "" : options.host;
|
|
83145
83155
|
return tls$2.connect(options);
|
|
83146
83156
|
}
|
|
83147
|
-
__name$
|
|
83157
|
+
__name$1(tlsConnect, "tlsConnect");
|
|
83148
83158
|
function abortHandshake(websocket, stream$2, message) {
|
|
83149
83159
|
websocket._readyState = WebSocket2.CLOSING;
|
|
83150
83160
|
const err = new Error(message);
|
|
@@ -83160,7 +83170,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83160
83170
|
stream$2.once("close", websocket.emitClose.bind(websocket));
|
|
83161
83171
|
}
|
|
83162
83172
|
}
|
|
83163
|
-
__name$
|
|
83173
|
+
__name$1(abortHandshake, "abortHandshake");
|
|
83164
83174
|
function sendAfterClose(websocket, data$1, cb) {
|
|
83165
83175
|
if (data$1) {
|
|
83166
83176
|
const length = isBlob2(data$1) ? data$1.size : toBuffer$1(data$1).length;
|
|
@@ -83172,7 +83182,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83172
83182
|
process.nextTick(cb, err);
|
|
83173
83183
|
}
|
|
83174
83184
|
}
|
|
83175
|
-
__name$
|
|
83185
|
+
__name$1(sendAfterClose, "sendAfterClose");
|
|
83176
83186
|
function receiverOnConclude(code, reason) {
|
|
83177
83187
|
const websocket = this[kWebSocket];
|
|
83178
83188
|
websocket._closeFrameReceived = true;
|
|
@@ -83184,12 +83194,12 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83184
83194
|
if (code === 1005) websocket.close();
|
|
83185
83195
|
else websocket.close(code, reason);
|
|
83186
83196
|
}
|
|
83187
|
-
__name$
|
|
83197
|
+
__name$1(receiverOnConclude, "receiverOnConclude");
|
|
83188
83198
|
function receiverOnDrain() {
|
|
83189
83199
|
const websocket = this[kWebSocket];
|
|
83190
83200
|
if (!websocket.isPaused) websocket._socket.resume();
|
|
83191
83201
|
}
|
|
83192
|
-
__name$
|
|
83202
|
+
__name$1(receiverOnDrain, "receiverOnDrain");
|
|
83193
83203
|
function receiverOnError(err) {
|
|
83194
83204
|
const websocket = this[kWebSocket];
|
|
83195
83205
|
if (websocket._socket[kWebSocket] !== void 0) {
|
|
@@ -83202,29 +83212,29 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83202
83212
|
websocket.emit("error", err);
|
|
83203
83213
|
}
|
|
83204
83214
|
}
|
|
83205
|
-
__name$
|
|
83215
|
+
__name$1(receiverOnError, "receiverOnError");
|
|
83206
83216
|
function receiverOnFinish() {
|
|
83207
83217
|
this[kWebSocket].emitClose();
|
|
83208
83218
|
}
|
|
83209
|
-
__name$
|
|
83219
|
+
__name$1(receiverOnFinish, "receiverOnFinish");
|
|
83210
83220
|
function receiverOnMessage(data$1, isBinary) {
|
|
83211
83221
|
this[kWebSocket].emit("message", data$1, isBinary);
|
|
83212
83222
|
}
|
|
83213
|
-
__name$
|
|
83223
|
+
__name$1(receiverOnMessage, "receiverOnMessage");
|
|
83214
83224
|
function receiverOnPing(data$1) {
|
|
83215
83225
|
const websocket = this[kWebSocket];
|
|
83216
83226
|
if (websocket._autoPong) websocket.pong(data$1, !this._isServer, NOOP);
|
|
83217
83227
|
websocket.emit("ping", data$1);
|
|
83218
83228
|
}
|
|
83219
|
-
__name$
|
|
83229
|
+
__name$1(receiverOnPing, "receiverOnPing");
|
|
83220
83230
|
function receiverOnPong(data$1) {
|
|
83221
83231
|
this[kWebSocket].emit("pong", data$1);
|
|
83222
83232
|
}
|
|
83223
|
-
__name$
|
|
83233
|
+
__name$1(receiverOnPong, "receiverOnPong");
|
|
83224
83234
|
function resume$1(stream$2) {
|
|
83225
83235
|
stream$2.resume();
|
|
83226
83236
|
}
|
|
83227
|
-
__name$
|
|
83237
|
+
__name$1(resume$1, "resume");
|
|
83228
83238
|
function senderOnError(err) {
|
|
83229
83239
|
const websocket = this[kWebSocket];
|
|
83230
83240
|
if (websocket.readyState === WebSocket2.CLOSED) return;
|
|
@@ -83238,11 +83248,11 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83238
83248
|
websocket.emit("error", err);
|
|
83239
83249
|
}
|
|
83240
83250
|
}
|
|
83241
|
-
__name$
|
|
83251
|
+
__name$1(senderOnError, "senderOnError");
|
|
83242
83252
|
function setCloseTimer(websocket) {
|
|
83243
83253
|
websocket._closeTimer = setTimeout(websocket._socket.destroy.bind(websocket._socket), websocket._closeTimeout);
|
|
83244
83254
|
}
|
|
83245
|
-
__name$
|
|
83255
|
+
__name$1(setCloseTimer, "setCloseTimer");
|
|
83246
83256
|
function socketOnClose() {
|
|
83247
83257
|
const websocket = this[kWebSocket];
|
|
83248
83258
|
this.removeListener("close", socketOnClose);
|
|
@@ -83262,18 +83272,18 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83262
83272
|
websocket._receiver.on("finish", receiverOnFinish);
|
|
83263
83273
|
}
|
|
83264
83274
|
}
|
|
83265
|
-
__name$
|
|
83275
|
+
__name$1(socketOnClose, "socketOnClose");
|
|
83266
83276
|
function socketOnData(chunk) {
|
|
83267
83277
|
if (!this[kWebSocket]._receiver.write(chunk)) this.pause();
|
|
83268
83278
|
}
|
|
83269
|
-
__name$
|
|
83279
|
+
__name$1(socketOnData, "socketOnData");
|
|
83270
83280
|
function socketOnEnd() {
|
|
83271
83281
|
const websocket = this[kWebSocket];
|
|
83272
83282
|
websocket._readyState = WebSocket2.CLOSING;
|
|
83273
83283
|
websocket._receiver.end();
|
|
83274
83284
|
this.end();
|
|
83275
83285
|
}
|
|
83276
|
-
__name$
|
|
83286
|
+
__name$1(socketOnEnd, "socketOnEnd");
|
|
83277
83287
|
function socketOnError() {
|
|
83278
83288
|
const websocket = this[kWebSocket];
|
|
83279
83289
|
this.removeListener("error", socketOnError);
|
|
@@ -83283,7 +83293,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_mo
|
|
|
83283
83293
|
this.destroy();
|
|
83284
83294
|
}
|
|
83285
83295
|
}
|
|
83286
|
-
__name$
|
|
83296
|
+
__name$1(socketOnError, "socketOnError");
|
|
83287
83297
|
} });
|
|
83288
83298
|
var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/stream.js"(exports$1, module$1) {
|
|
83289
83299
|
require_websocket();
|
|
@@ -83291,17 +83301,17 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83291
83301
|
function emitClose(stream$2) {
|
|
83292
83302
|
stream$2.emit("close");
|
|
83293
83303
|
}
|
|
83294
|
-
__name$
|
|
83304
|
+
__name$1(emitClose, "emitClose");
|
|
83295
83305
|
function duplexOnEnd() {
|
|
83296
83306
|
if (!this.destroyed && this._writableState.finished) this.destroy();
|
|
83297
83307
|
}
|
|
83298
|
-
__name$
|
|
83308
|
+
__name$1(duplexOnEnd, "duplexOnEnd");
|
|
83299
83309
|
function duplexOnError(err) {
|
|
83300
83310
|
this.removeListener("error", duplexOnError);
|
|
83301
83311
|
this.destroy();
|
|
83302
83312
|
if (this.listenerCount("error") === 0) this.emit("error", err);
|
|
83303
83313
|
}
|
|
83304
|
-
__name$
|
|
83314
|
+
__name$1(duplexOnError, "duplexOnError");
|
|
83305
83315
|
function createWebSocketStream2(ws, options) {
|
|
83306
83316
|
let terminateOnDestroy = true;
|
|
83307
83317
|
const duplex = new Duplex$1({
|
|
@@ -83311,16 +83321,16 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83311
83321
|
objectMode: false,
|
|
83312
83322
|
writableObjectMode: false
|
|
83313
83323
|
});
|
|
83314
|
-
ws.on("message", /* @__PURE__ */ __name$
|
|
83324
|
+
ws.on("message", /* @__PURE__ */ __name$1(function message(msg, isBinary) {
|
|
83315
83325
|
const data$1 = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
83316
83326
|
if (!duplex.push(data$1)) ws.pause();
|
|
83317
83327
|
}, "message"));
|
|
83318
|
-
ws.once("error", /* @__PURE__ */ __name$
|
|
83328
|
+
ws.once("error", /* @__PURE__ */ __name$1(function error$3(err) {
|
|
83319
83329
|
if (duplex.destroyed) return;
|
|
83320
83330
|
terminateOnDestroy = false;
|
|
83321
83331
|
duplex.destroy(err);
|
|
83322
83332
|
}, "error"));
|
|
83323
|
-
ws.once("close", /* @__PURE__ */ __name$
|
|
83333
|
+
ws.once("close", /* @__PURE__ */ __name$1(function close() {
|
|
83324
83334
|
if (duplex.destroyed) return;
|
|
83325
83335
|
duplex.push(null);
|
|
83326
83336
|
}, "close"));
|
|
@@ -83331,11 +83341,11 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83331
83341
|
return;
|
|
83332
83342
|
}
|
|
83333
83343
|
let called = false;
|
|
83334
|
-
ws.once("error", /* @__PURE__ */ __name$
|
|
83344
|
+
ws.once("error", /* @__PURE__ */ __name$1(function error$3(err2) {
|
|
83335
83345
|
called = true;
|
|
83336
83346
|
callback(err2);
|
|
83337
83347
|
}, "error"));
|
|
83338
|
-
ws.once("close", /* @__PURE__ */ __name$
|
|
83348
|
+
ws.once("close", /* @__PURE__ */ __name$1(function close() {
|
|
83339
83349
|
if (!called) callback(err);
|
|
83340
83350
|
process.nextTick(emitClose, duplex);
|
|
83341
83351
|
}, "close"));
|
|
@@ -83343,7 +83353,7 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83343
83353
|
};
|
|
83344
83354
|
duplex._final = function(callback) {
|
|
83345
83355
|
if (ws.readyState === ws.CONNECTING) {
|
|
83346
|
-
ws.once("open", /* @__PURE__ */ __name$
|
|
83356
|
+
ws.once("open", /* @__PURE__ */ __name$1(function open$3() {
|
|
83347
83357
|
duplex._final(callback);
|
|
83348
83358
|
}, "open"));
|
|
83349
83359
|
return;
|
|
@@ -83353,7 +83363,7 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83353
83363
|
callback();
|
|
83354
83364
|
if (duplex._readableState.endEmitted) duplex.destroy();
|
|
83355
83365
|
} else {
|
|
83356
|
-
ws._socket.once("finish", /* @__PURE__ */ __name$
|
|
83366
|
+
ws._socket.once("finish", /* @__PURE__ */ __name$1(function finish() {
|
|
83357
83367
|
callback();
|
|
83358
83368
|
}, "finish"));
|
|
83359
83369
|
ws.close();
|
|
@@ -83364,7 +83374,7 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83364
83374
|
};
|
|
83365
83375
|
duplex._write = function(chunk, encoding, callback) {
|
|
83366
83376
|
if (ws.readyState === ws.CONNECTING) {
|
|
83367
|
-
ws.once("open", /* @__PURE__ */ __name$
|
|
83377
|
+
ws.once("open", /* @__PURE__ */ __name$1(function open$3() {
|
|
83368
83378
|
duplex._write(chunk, encoding, callback);
|
|
83369
83379
|
}, "open"));
|
|
83370
83380
|
return;
|
|
@@ -83375,7 +83385,7 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modul
|
|
|
83375
83385
|
duplex.on("error", duplexOnError);
|
|
83376
83386
|
return duplex;
|
|
83377
83387
|
}
|
|
83378
|
-
__name$
|
|
83388
|
+
__name$1(createWebSocketStream2, "createWebSocketStream");
|
|
83379
83389
|
module$1.exports = createWebSocketStream2;
|
|
83380
83390
|
} });
|
|
83381
83391
|
var require_subprotocol = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/subprotocol.js"(exports$1, module$1) {
|
|
@@ -83406,7 +83416,7 @@ var require_subprotocol = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_
|
|
|
83406
83416
|
protocols.add(protocol);
|
|
83407
83417
|
return protocols;
|
|
83408
83418
|
}
|
|
83409
|
-
__name$
|
|
83419
|
+
__name$1(parse$6, "parse");
|
|
83410
83420
|
module$1.exports = { parse: parse$6 };
|
|
83411
83421
|
} });
|
|
83412
83422
|
var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket-server.js"(exports$1, module$1) {
|
|
@@ -83425,7 +83435,7 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/
|
|
|
83425
83435
|
var CLOSED$1 = 2;
|
|
83426
83436
|
var WebSocketServer2 = class extends EventEmitter$4 {
|
|
83427
83437
|
static {
|
|
83428
|
-
__name$
|
|
83438
|
+
__name$1(this, "WebSocketServer");
|
|
83429
83439
|
}
|
|
83430
83440
|
/**
|
|
83431
83441
|
* Create a `WebSocketServer` instance.
|
|
@@ -83505,7 +83515,7 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/
|
|
|
83505
83515
|
this._removeListeners = addListeners(this._server, {
|
|
83506
83516
|
listening: this.emit.bind(this, "listening"),
|
|
83507
83517
|
error: this.emit.bind(this, "error"),
|
|
83508
|
-
upgrade: /* @__PURE__ */ __name$
|
|
83518
|
+
upgrade: /* @__PURE__ */ __name$1((req, socket, head) => {
|
|
83509
83519
|
this.handleUpgrade(req, socket, head, emitConnection);
|
|
83510
83520
|
}, "upgrade")
|
|
83511
83521
|
});
|
|
@@ -83719,20 +83729,20 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/
|
|
|
83719
83729
|
module$1.exports = WebSocketServer2;
|
|
83720
83730
|
function addListeners(server, map$1) {
|
|
83721
83731
|
for (const event of Object.keys(map$1)) server.on(event, map$1[event]);
|
|
83722
|
-
return /* @__PURE__ */ __name$
|
|
83732
|
+
return /* @__PURE__ */ __name$1(function removeListeners() {
|
|
83723
83733
|
for (const event of Object.keys(map$1)) server.removeListener(event, map$1[event]);
|
|
83724
83734
|
}, "removeListeners");
|
|
83725
83735
|
}
|
|
83726
|
-
__name$
|
|
83736
|
+
__name$1(addListeners, "addListeners");
|
|
83727
83737
|
function emitClose(server) {
|
|
83728
83738
|
server._state = CLOSED$1;
|
|
83729
83739
|
server.emit("close");
|
|
83730
83740
|
}
|
|
83731
|
-
__name$
|
|
83741
|
+
__name$1(emitClose, "emitClose");
|
|
83732
83742
|
function socketOnError() {
|
|
83733
83743
|
this.destroy();
|
|
83734
83744
|
}
|
|
83735
|
-
__name$
|
|
83745
|
+
__name$1(socketOnError, "socketOnError");
|
|
83736
83746
|
function abortHandshake(socket, code, message, headers) {
|
|
83737
83747
|
message = message || http$2.STATUS_CODES[code];
|
|
83738
83748
|
headers = {
|
|
@@ -83745,7 +83755,7 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/
|
|
|
83745
83755
|
socket.end(`HTTP/1.1 ${code} ${http$2.STATUS_CODES[code]}\r
|
|
83746
83756
|
` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message);
|
|
83747
83757
|
}
|
|
83748
|
-
__name$
|
|
83758
|
+
__name$1(abortHandshake, "abortHandshake");
|
|
83749
83759
|
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message, headers) {
|
|
83750
83760
|
if (server.listenerCount("wsClientError")) {
|
|
83751
83761
|
const err = new Error(message);
|
|
@@ -83753,11 +83763,11 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.21.0/
|
|
|
83753
83763
|
server.emit("wsClientError", err, socket, req);
|
|
83754
83764
|
} else abortHandshake(socket, code, message, headers);
|
|
83755
83765
|
}
|
|
83756
|
-
__name$
|
|
83766
|
+
__name$1(abortHandshakeOrEmitwsClientError, "abortHandshakeOrEmitwsClientError");
|
|
83757
83767
|
} });
|
|
83758
83768
|
var ApiError = class extends Error {
|
|
83759
83769
|
static {
|
|
83760
|
-
__name$
|
|
83770
|
+
__name$1(this, "ApiError");
|
|
83761
83771
|
}
|
|
83762
83772
|
url;
|
|
83763
83773
|
status;
|
|
@@ -83776,7 +83786,7 @@ var ApiError = class extends Error {
|
|
|
83776
83786
|
};
|
|
83777
83787
|
var CancelError = class extends Error {
|
|
83778
83788
|
static {
|
|
83779
|
-
__name$
|
|
83789
|
+
__name$1(this, "CancelError");
|
|
83780
83790
|
}
|
|
83781
83791
|
constructor(message) {
|
|
83782
83792
|
super(message);
|
|
@@ -83788,7 +83798,7 @@ var CancelError = class extends Error {
|
|
|
83788
83798
|
};
|
|
83789
83799
|
var CancelablePromise = class {
|
|
83790
83800
|
static {
|
|
83791
|
-
__name$
|
|
83801
|
+
__name$1(this, "CancelablePromise");
|
|
83792
83802
|
}
|
|
83793
83803
|
#isResolved;
|
|
83794
83804
|
#isRejected;
|
|
@@ -83805,23 +83815,23 @@ var CancelablePromise = class {
|
|
|
83805
83815
|
this.#promise = new Promise((resolve2, reject) => {
|
|
83806
83816
|
this.#resolve = resolve2;
|
|
83807
83817
|
this.#reject = reject;
|
|
83808
|
-
const onResolve = /* @__PURE__ */ __name$
|
|
83818
|
+
const onResolve = /* @__PURE__ */ __name$1((value) => {
|
|
83809
83819
|
if (this.#isResolved || this.#isRejected || this.#isCancelled) return;
|
|
83810
83820
|
this.#isResolved = true;
|
|
83811
83821
|
this.#resolve?.(value);
|
|
83812
83822
|
}, "onResolve");
|
|
83813
|
-
const onReject = /* @__PURE__ */ __name$
|
|
83823
|
+
const onReject = /* @__PURE__ */ __name$1((reason) => {
|
|
83814
83824
|
if (this.#isResolved || this.#isRejected || this.#isCancelled) return;
|
|
83815
83825
|
this.#isRejected = true;
|
|
83816
83826
|
this.#reject?.(reason);
|
|
83817
83827
|
}, "onReject");
|
|
83818
|
-
const onCancel = /* @__PURE__ */ __name$
|
|
83828
|
+
const onCancel = /* @__PURE__ */ __name$1((cancelHandler) => {
|
|
83819
83829
|
if (this.#isResolved || this.#isRejected || this.#isCancelled) return;
|
|
83820
83830
|
this.#cancelHandlers.push(cancelHandler);
|
|
83821
83831
|
}, "onCancel");
|
|
83822
|
-
Object.defineProperty(onCancel, "isResolved", { get: /* @__PURE__ */ __name$
|
|
83823
|
-
Object.defineProperty(onCancel, "isRejected", { get: /* @__PURE__ */ __name$
|
|
83824
|
-
Object.defineProperty(onCancel, "isCancelled", { get: /* @__PURE__ */ __name$
|
|
83832
|
+
Object.defineProperty(onCancel, "isResolved", { get: /* @__PURE__ */ __name$1(() => this.#isResolved, "get") });
|
|
83833
|
+
Object.defineProperty(onCancel, "isRejected", { get: /* @__PURE__ */ __name$1(() => this.#isRejected, "get") });
|
|
83834
|
+
Object.defineProperty(onCancel, "isCancelled", { get: /* @__PURE__ */ __name$1(() => this.#isCancelled, "get") });
|
|
83825
83835
|
return executor(onResolve, onReject, onCancel);
|
|
83826
83836
|
});
|
|
83827
83837
|
}
|
|
@@ -83865,34 +83875,34 @@ var OpenAPI = {
|
|
|
83865
83875
|
ENCODE_PATH: void 0,
|
|
83866
83876
|
LOGGER: void 0
|
|
83867
83877
|
};
|
|
83868
|
-
var isDefined = /* @__PURE__ */ __name$
|
|
83878
|
+
var isDefined = /* @__PURE__ */ __name$1((value) => {
|
|
83869
83879
|
return value !== void 0 && value !== null;
|
|
83870
83880
|
}, "isDefined");
|
|
83871
|
-
var isString = /* @__PURE__ */ __name$
|
|
83881
|
+
var isString = /* @__PURE__ */ __name$1((value) => {
|
|
83872
83882
|
return typeof value === "string";
|
|
83873
83883
|
}, "isString");
|
|
83874
|
-
var isStringWithValue = /* @__PURE__ */ __name$
|
|
83884
|
+
var isStringWithValue = /* @__PURE__ */ __name$1((value) => {
|
|
83875
83885
|
return isString(value) && value !== "";
|
|
83876
83886
|
}, "isStringWithValue");
|
|
83877
|
-
var isBlob = /* @__PURE__ */ __name$
|
|
83887
|
+
var isBlob = /* @__PURE__ */ __name$1((value) => {
|
|
83878
83888
|
return typeof value === "object" && typeof value.type === "string" && typeof value.stream === "function" && typeof value.arrayBuffer === "function" && typeof value.constructor === "function" && typeof value.constructor.name === "string" && /^(Blob|File)$/.test(value.constructor.name) && /^(Blob|File)$/.test(value[Symbol.toStringTag]);
|
|
83879
83889
|
}, "isBlob");
|
|
83880
|
-
var isErrorResponse = /* @__PURE__ */ __name$
|
|
83890
|
+
var isErrorResponse = /* @__PURE__ */ __name$1((value) => {
|
|
83881
83891
|
return typeof value === "object" && value !== null && "error" in value && typeof value.error === "string";
|
|
83882
83892
|
}, "isErrorResponse");
|
|
83883
|
-
var base64 = /* @__PURE__ */ __name$
|
|
83893
|
+
var base64 = /* @__PURE__ */ __name$1((str) => {
|
|
83884
83894
|
try {
|
|
83885
83895
|
return btoa(str);
|
|
83886
83896
|
} catch (err) {
|
|
83887
83897
|
return Buffer.from(str).toString("base64");
|
|
83888
83898
|
}
|
|
83889
83899
|
}, "base64");
|
|
83890
|
-
var getQueryString = /* @__PURE__ */ __name$
|
|
83900
|
+
var getQueryString = /* @__PURE__ */ __name$1((params) => {
|
|
83891
83901
|
const qs = [];
|
|
83892
|
-
const append = /* @__PURE__ */ __name$
|
|
83902
|
+
const append = /* @__PURE__ */ __name$1((key, value) => {
|
|
83893
83903
|
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
83894
83904
|
}, "append");
|
|
83895
|
-
const process2$1 = /* @__PURE__ */ __name$
|
|
83905
|
+
const process2$1 = /* @__PURE__ */ __name$1((key, value) => {
|
|
83896
83906
|
if (isDefined(value)) if (Array.isArray(value)) value.forEach((v) => {
|
|
83897
83907
|
process2$1(key, v);
|
|
83898
83908
|
});
|
|
@@ -83907,7 +83917,7 @@ var getQueryString = /* @__PURE__ */ __name$2((params) => {
|
|
|
83907
83917
|
if (qs.length > 0) return `?${qs.join("&")}`;
|
|
83908
83918
|
return "";
|
|
83909
83919
|
}, "getQueryString");
|
|
83910
|
-
var getUrl = /* @__PURE__ */ __name$
|
|
83920
|
+
var getUrl = /* @__PURE__ */ __name$1((config$3, options) => {
|
|
83911
83921
|
const encoder$1 = config$3.ENCODE_PATH || encodeURI;
|
|
83912
83922
|
const path4 = options.url.replace("{api-version}", config$3.VERSION).replace(/{(.*?)}/g, (substring, group) => {
|
|
83913
83923
|
if (options.path?.hasOwnProperty(group)) return encoder$1(String(options.path[group]));
|
|
@@ -83917,10 +83927,10 @@ var getUrl = /* @__PURE__ */ __name$2((config$3, options) => {
|
|
|
83917
83927
|
if (options.query) return `${url$2}${getQueryString(options.query)}`;
|
|
83918
83928
|
return url$2;
|
|
83919
83929
|
}, "getUrl");
|
|
83920
|
-
var getFormData = /* @__PURE__ */ __name$
|
|
83930
|
+
var getFormData = /* @__PURE__ */ __name$1((options) => {
|
|
83921
83931
|
if (options.formData) {
|
|
83922
83932
|
const formData = new FormData();
|
|
83923
|
-
const process2$1 = /* @__PURE__ */ __name$
|
|
83933
|
+
const process2$1 = /* @__PURE__ */ __name$1(async (key, value) => {
|
|
83924
83934
|
if (isString(value)) formData.append(key, value);
|
|
83925
83935
|
else formData.append(key, JSON.stringify(value));
|
|
83926
83936
|
}, "process");
|
|
@@ -83931,11 +83941,11 @@ var getFormData = /* @__PURE__ */ __name$2((options) => {
|
|
|
83931
83941
|
return formData;
|
|
83932
83942
|
}
|
|
83933
83943
|
}, "getFormData");
|
|
83934
|
-
var resolve$1 = /* @__PURE__ */ __name$
|
|
83944
|
+
var resolve$1 = /* @__PURE__ */ __name$1(async (options, resolver) => {
|
|
83935
83945
|
if (typeof resolver === "function") return resolver(options);
|
|
83936
83946
|
return resolver;
|
|
83937
83947
|
}, "resolve");
|
|
83938
|
-
var getHeaders = /* @__PURE__ */ __name$
|
|
83948
|
+
var getHeaders = /* @__PURE__ */ __name$1(async (config$3, options) => {
|
|
83939
83949
|
const token = await resolve$1(options, config$3.TOKEN);
|
|
83940
83950
|
const username = await resolve$1(options, config$3.USERNAME);
|
|
83941
83951
|
const password = await resolve$1(options, config$3.PASSWORD);
|
|
@@ -83958,15 +83968,15 @@ var getHeaders = /* @__PURE__ */ __name$2(async (config$3, options) => {
|
|
|
83958
83968
|
addCustomApiHeaders(requestHeaders);
|
|
83959
83969
|
return requestHeaders;
|
|
83960
83970
|
}, "getHeaders");
|
|
83961
|
-
var getRequestBody = /* @__PURE__ */ __name$
|
|
83971
|
+
var getRequestBody = /* @__PURE__ */ __name$1((options) => {
|
|
83962
83972
|
if (options.body !== void 0) if (options.mediaType?.includes("/json")) return JSON.stringify(options.body);
|
|
83963
83973
|
else if (isString(options.body) || isBlob(options.body)) return options.body;
|
|
83964
83974
|
else return JSON.stringify(options.body);
|
|
83965
83975
|
}, "getRequestBody");
|
|
83966
|
-
var isResponseSchemaV4 = /* @__PURE__ */ __name$
|
|
83976
|
+
var isResponseSchemaV4 = /* @__PURE__ */ __name$1((config$3, _options) => {
|
|
83967
83977
|
return config$3.BASE.endsWith("/containers");
|
|
83968
83978
|
}, "isResponseSchemaV4");
|
|
83969
|
-
var parseResponseSchemaV4 = /* @__PURE__ */ __name$
|
|
83979
|
+
var parseResponseSchemaV4 = /* @__PURE__ */ __name$1((url$2, response, responseHeader, responseBody) => {
|
|
83970
83980
|
const fetchResult2 = typeof responseBody === "object" ? responseBody : JSON.parse(responseBody);
|
|
83971
83981
|
const ok = response.ok && fetchResult2.success;
|
|
83972
83982
|
let result;
|
|
@@ -83982,7 +83992,7 @@ var parseResponseSchemaV4 = /* @__PURE__ */ __name$2((url$2, response, responseH
|
|
|
83982
83992
|
body: responseHeader ?? result
|
|
83983
83993
|
};
|
|
83984
83994
|
}, "parseResponseSchemaV4");
|
|
83985
|
-
var sendRequest = /* @__PURE__ */ __name$
|
|
83995
|
+
var sendRequest = /* @__PURE__ */ __name$1(async (config$3, options, url$2, body, formData, headers, onCancel) => {
|
|
83986
83996
|
const controller = new AbortController();
|
|
83987
83997
|
const request2 = {
|
|
83988
83998
|
headers,
|
|
@@ -83994,13 +84004,13 @@ var sendRequest = /* @__PURE__ */ __name$2(async (config$3, options, url$2, body
|
|
|
83994
84004
|
onCancel(() => controller.abort());
|
|
83995
84005
|
return await fetch(url$2, request2);
|
|
83996
84006
|
}, "sendRequest");
|
|
83997
|
-
var getResponseHeader = /* @__PURE__ */ __name$
|
|
84007
|
+
var getResponseHeader = /* @__PURE__ */ __name$1((response, responseHeader) => {
|
|
83998
84008
|
if (responseHeader) {
|
|
83999
84009
|
const content = response.headers.get(responseHeader);
|
|
84000
84010
|
if (isString(content)) return content;
|
|
84001
84011
|
}
|
|
84002
84012
|
}, "getResponseHeader");
|
|
84003
|
-
var getResponseBody = /* @__PURE__ */ __name$
|
|
84013
|
+
var getResponseBody = /* @__PURE__ */ __name$1(async (response) => {
|
|
84004
84014
|
if (response.status !== 204) try {
|
|
84005
84015
|
const contentType = response.headers.get("Content-Type");
|
|
84006
84016
|
if (contentType) if (["application/json", "application/problem+json"].some((type) => contentType.toLowerCase().startsWith(type))) return await response.json();
|
|
@@ -84009,7 +84019,7 @@ var getResponseBody = /* @__PURE__ */ __name$2(async (response) => {
|
|
|
84009
84019
|
console.error(error$3);
|
|
84010
84020
|
}
|
|
84011
84021
|
}, "getResponseBody");
|
|
84012
|
-
var catchErrorCodes = /* @__PURE__ */ __name$
|
|
84022
|
+
var catchErrorCodes = /* @__PURE__ */ __name$1((options, result) => {
|
|
84013
84023
|
const error$3 = {
|
|
84014
84024
|
400: "Bad Request",
|
|
84015
84025
|
401: "Unauthorized",
|
|
@@ -84023,7 +84033,7 @@ var catchErrorCodes = /* @__PURE__ */ __name$2((options, result) => {
|
|
|
84023
84033
|
if (error$3) throw new ApiError(options, result, error$3);
|
|
84024
84034
|
if (!result.ok) throw new ApiError(options, result, "Generic Error");
|
|
84025
84035
|
}, "catchErrorCodes");
|
|
84026
|
-
var executeRequest = /* @__PURE__ */ __name$
|
|
84036
|
+
var executeRequest = /* @__PURE__ */ __name$1(async (config$3, options, onCancel) => {
|
|
84027
84037
|
const url$2 = getUrl(config$3, options);
|
|
84028
84038
|
const formData = getFormData(options);
|
|
84029
84039
|
const body = getRequestBody(options);
|
|
@@ -84038,7 +84048,7 @@ var executeRequest = /* @__PURE__ */ __name$2(async (config$3, options, onCancel
|
|
|
84038
84048
|
responseHeader: getResponseHeader(response, options.responseHeader)
|
|
84039
84049
|
};
|
|
84040
84050
|
}, "executeRequest");
|
|
84041
|
-
var buildApiResult = /* @__PURE__ */ __name$
|
|
84051
|
+
var buildApiResult = /* @__PURE__ */ __name$1((config$3, options, req) => {
|
|
84042
84052
|
if (isResponseSchemaV4(config$3, options)) return parseResponseSchemaV4(req.url, req.response, req.responseHeader, req.responseBody);
|
|
84043
84053
|
return {
|
|
84044
84054
|
url: req.url,
|
|
@@ -84048,7 +84058,7 @@ var buildApiResult = /* @__PURE__ */ __name$2((config$3, options, req) => {
|
|
|
84048
84058
|
body: req.responseHeader ?? req.responseBody
|
|
84049
84059
|
};
|
|
84050
84060
|
}, "buildApiResult");
|
|
84051
|
-
var request = /* @__PURE__ */ __name$
|
|
84061
|
+
var request = /* @__PURE__ */ __name$1((config$3, options) => {
|
|
84052
84062
|
return new CancelablePromise(async (resolve2, reject, onCancel) => {
|
|
84053
84063
|
try {
|
|
84054
84064
|
const req = await executeRequest(config$3, options, onCancel);
|
|
@@ -84062,7 +84072,7 @@ var request = /* @__PURE__ */ __name$2((config$3, options) => {
|
|
|
84062
84072
|
}
|
|
84063
84073
|
});
|
|
84064
84074
|
}, "request");
|
|
84065
|
-
var requestPaginated = /* @__PURE__ */ __name$
|
|
84075
|
+
var requestPaginated = /* @__PURE__ */ __name$1((config$3, options) => {
|
|
84066
84076
|
return new CancelablePromise(async (resolve2, reject, onCancel) => {
|
|
84067
84077
|
try {
|
|
84068
84078
|
const req = await executeRequest(config$3, options, onCancel);
|
|
@@ -84081,13 +84091,13 @@ var requestPaginated = /* @__PURE__ */ __name$2((config$3, options) => {
|
|
|
84081
84091
|
}
|
|
84082
84092
|
});
|
|
84083
84093
|
}, "requestPaginated");
|
|
84084
|
-
var debugLogRequest = /* @__PURE__ */ __name$
|
|
84094
|
+
var debugLogRequest = /* @__PURE__ */ __name$1(async (config$3, url$2, headers, body) => {
|
|
84085
84095
|
config$3.LOGGER?.debug(`-- START CF API REQUEST: ${url$2}`);
|
|
84086
84096
|
config$3.LOGGER?.debugWithSanitization("HEADERS:", JSON.stringify(sanitizeHeaders(headers), null, 2));
|
|
84087
84097
|
config$3.LOGGER?.debugWithSanitization("BODY:", JSON.stringify(body instanceof FormData ? await new Response(body).text() : body, null, 2));
|
|
84088
84098
|
config$3.LOGGER?.debug("-- END CF API REQUEST");
|
|
84089
84099
|
}, "debugLogRequest");
|
|
84090
|
-
var debugLogResponse = /* @__PURE__ */ __name$
|
|
84100
|
+
var debugLogResponse = /* @__PURE__ */ __name$1((config$3, response) => {
|
|
84091
84101
|
config$3.LOGGER?.debug("-- START CF API RESPONSE:", response.statusText, response.status);
|
|
84092
84102
|
config$3.LOGGER?.debugWithSanitization("RESPONSE:", response.body);
|
|
84093
84103
|
config$3.LOGGER?.debug("-- END CF API RESPONSE");
|
|
@@ -84227,7 +84237,7 @@ var UpdateApplicationRolloutRequest;
|
|
|
84227
84237
|
})(UpdateApplicationRolloutRequest || (UpdateApplicationRolloutRequest = {}));
|
|
84228
84238
|
var AccountService = class {
|
|
84229
84239
|
static {
|
|
84230
|
-
__name$
|
|
84240
|
+
__name$1(this, "AccountService");
|
|
84231
84241
|
}
|
|
84232
84242
|
/**
|
|
84233
84243
|
* Get complete account details related to Cloudchamber
|
|
@@ -84268,7 +84278,7 @@ var AccountService = class {
|
|
|
84268
84278
|
};
|
|
84269
84279
|
var ApplicationsService = class {
|
|
84270
84280
|
static {
|
|
84271
|
-
__name$
|
|
84281
|
+
__name$1(this, "ApplicationsService");
|
|
84272
84282
|
}
|
|
84273
84283
|
/**
|
|
84274
84284
|
* Create a new application
|
|
@@ -84733,7 +84743,7 @@ var ApplicationsService = class {
|
|
|
84733
84743
|
};
|
|
84734
84744
|
var ContainerImagePreparationsService = class {
|
|
84735
84745
|
static {
|
|
84736
|
-
__name$
|
|
84746
|
+
__name$1(this, "ContainerImagePreparationsService");
|
|
84737
84747
|
}
|
|
84738
84748
|
/**
|
|
84739
84749
|
* Prepare a digest-pinned managed image for the Containers runtime.
|
|
@@ -84755,7 +84765,7 @@ var ContainerImagePreparationsService = class {
|
|
|
84755
84765
|
};
|
|
84756
84766
|
var DeploymentsService = class {
|
|
84757
84767
|
static {
|
|
84758
|
-
__name$
|
|
84768
|
+
__name$1(this, "DeploymentsService");
|
|
84759
84769
|
}
|
|
84760
84770
|
/**
|
|
84761
84771
|
* Get a specific deployment within an application
|
|
@@ -84994,7 +85004,7 @@ var DeploymentsService = class {
|
|
|
84994
85004
|
};
|
|
84995
85005
|
var ImageRegistriesService = class {
|
|
84996
85006
|
static {
|
|
84997
|
-
__name$
|
|
85007
|
+
__name$1(this, "ImageRegistriesService");
|
|
84998
85008
|
}
|
|
84999
85009
|
/**
|
|
85000
85010
|
* Create an image registry protocol that resolves to multiple domains.
|
|
@@ -85144,7 +85154,7 @@ var ImageRegistriesService = class {
|
|
|
85144
85154
|
};
|
|
85145
85155
|
var IPsService = class {
|
|
85146
85156
|
static {
|
|
85147
|
-
__name$
|
|
85157
|
+
__name$1(this, "IPsService");
|
|
85148
85158
|
}
|
|
85149
85159
|
/**
|
|
85150
85160
|
* List IPs
|
|
@@ -85175,7 +85185,7 @@ var IPsService = class {
|
|
|
85175
85185
|
};
|
|
85176
85186
|
var JobsService = class {
|
|
85177
85187
|
static {
|
|
85178
|
-
__name$
|
|
85188
|
+
__name$1(this, "JobsService");
|
|
85179
85189
|
}
|
|
85180
85190
|
/**
|
|
85181
85191
|
* Application queue status
|
|
@@ -85295,7 +85305,7 @@ var JobsService = class {
|
|
|
85295
85305
|
};
|
|
85296
85306
|
var PlacementsService = class {
|
|
85297
85307
|
static {
|
|
85298
|
-
__name$
|
|
85308
|
+
__name$1(this, "PlacementsService");
|
|
85299
85309
|
}
|
|
85300
85310
|
/**
|
|
85301
85311
|
* List placements
|
|
@@ -85363,7 +85373,7 @@ var PlacementsService = class {
|
|
|
85363
85373
|
};
|
|
85364
85374
|
var RolloutsService = class {
|
|
85365
85375
|
static {
|
|
85366
|
-
__name$
|
|
85376
|
+
__name$1(this, "RolloutsService");
|
|
85367
85377
|
}
|
|
85368
85378
|
/**
|
|
85369
85379
|
* Create a new rollout for an application
|
|
@@ -85489,7 +85499,7 @@ var RolloutsService = class {
|
|
|
85489
85499
|
};
|
|
85490
85500
|
var SecretsService = class {
|
|
85491
85501
|
static {
|
|
85492
|
-
__name$
|
|
85502
|
+
__name$1(this, "SecretsService");
|
|
85493
85503
|
}
|
|
85494
85504
|
/**
|
|
85495
85505
|
* Add a new secret to the account
|
|
@@ -85585,7 +85595,7 @@ var SecretsService = class {
|
|
|
85585
85595
|
};
|
|
85586
85596
|
var SshPublicKeysService = class {
|
|
85587
85597
|
static {
|
|
85588
|
-
__name$
|
|
85598
|
+
__name$1(this, "SshPublicKeysService");
|
|
85589
85599
|
}
|
|
85590
85600
|
/**
|
|
85591
85601
|
* Add SSH public key
|
|
@@ -85642,7 +85652,7 @@ var SshPublicKeysService = class {
|
|
|
85642
85652
|
});
|
|
85643
85653
|
}
|
|
85644
85654
|
};
|
|
85645
|
-
var noop = /* @__PURE__ */ __name$
|
|
85655
|
+
var noop = /* @__PURE__ */ __name$1(() => {}, "noop");
|
|
85646
85656
|
var logger$1 = {
|
|
85647
85657
|
debug: noop,
|
|
85648
85658
|
log: noop,
|
|
@@ -85650,10 +85660,10 @@ var logger$1 = {
|
|
|
85650
85660
|
warn: noop,
|
|
85651
85661
|
error: noop
|
|
85652
85662
|
};
|
|
85653
|
-
var fetchResult$1 = /* @__PURE__ */ __name$
|
|
85663
|
+
var fetchResult$1 = /* @__PURE__ */ __name$1(() => {
|
|
85654
85664
|
throw new Error("initContainersSharedContext() must be called first");
|
|
85655
85665
|
}, "fetchResult");
|
|
85656
|
-
var fetchPagedListResult = /* @__PURE__ */ __name$
|
|
85666
|
+
var fetchPagedListResult = /* @__PURE__ */ __name$1(() => {
|
|
85657
85667
|
throw new Error("initContainersSharedContext() must be called first");
|
|
85658
85668
|
}, "fetchPagedListResult");
|
|
85659
85669
|
function initContainersSharedContext(ctx) {
|
|
@@ -85661,8 +85671,8 @@ function initContainersSharedContext(ctx) {
|
|
|
85661
85671
|
fetchResult$1 = ctx.fetchResult;
|
|
85662
85672
|
if (ctx.fetchPagedListResult !== void 0) fetchPagedListResult = ctx.fetchPagedListResult;
|
|
85663
85673
|
}
|
|
85664
|
-
__name$
|
|
85665
|
-
var getCloudflareRegistryWithAccountNamespace = /* @__PURE__ */ __name$
|
|
85674
|
+
__name$1(initContainersSharedContext, "initContainersSharedContext");
|
|
85675
|
+
var getCloudflareRegistryWithAccountNamespace = /* @__PURE__ */ __name$1((accountID, tag, complianceConfig) => {
|
|
85666
85676
|
return `${getCloudflareContainerRegistry(complianceConfig)}/${accountID}/${tag}`;
|
|
85667
85677
|
}, "getCloudflareRegistryWithAccountNamespace");
|
|
85668
85678
|
var MF_DEV_CONTAINER_PREFIX = "cloudflare-dev";
|
|
@@ -85670,8 +85680,8 @@ function getCloudflareContainerRegistry(complianceConfig = COMPLIANCE_REGION_CON
|
|
|
85670
85680
|
if (process.env.CLOUDFLARE_CONTAINER_REGISTRY) return process.env.CLOUDFLARE_CONTAINER_REGISTRY;
|
|
85671
85681
|
return `${process.env.WRANGLER_API_ENVIRONMENT === "staging" ? "staging." : ""}registry${getComplianceRegionSubdomain(complianceConfig)}.cloudflare.com`;
|
|
85672
85682
|
}
|
|
85673
|
-
__name$
|
|
85674
|
-
var getDevContainerImageName = /* @__PURE__ */ __name$
|
|
85683
|
+
__name$1(getCloudflareContainerRegistry, "getCloudflareContainerRegistry");
|
|
85684
|
+
var getDevContainerImageName = /* @__PURE__ */ __name$1((name, tag) => {
|
|
85675
85685
|
return `${MF_DEV_CONTAINER_PREFIX}/${name.toLowerCase()}:${tag}`;
|
|
85676
85686
|
}, "getDevContainerImageName");
|
|
85677
85687
|
function configureOpenAPIForContainerPull(accountId, apiToken, apiBase = "https://api.cloudflare.com/client/v4") {
|
|
@@ -85682,7 +85692,7 @@ function configureOpenAPIForContainerPull(accountId, apiToken, apiBase = "https:
|
|
|
85682
85692
|
Authorization: `Bearer ${apiToken}`
|
|
85683
85693
|
};
|
|
85684
85694
|
}
|
|
85685
|
-
__name$
|
|
85695
|
+
__name$1(configureOpenAPIForContainerPull, "configureOpenAPIForContainerPull");
|
|
85686
85696
|
async function dockerLoginImageRegistry(pathToDocker, domain$1) {
|
|
85687
85697
|
const credentials = await ImageRegistriesService.generateImageRegistryCredentials(domain$1, {
|
|
85688
85698
|
expiration_minutes: 15,
|
|
@@ -85710,8 +85720,8 @@ async function dockerLoginImageRegistry(pathToDocker, domain$1) {
|
|
|
85710
85720
|
});
|
|
85711
85721
|
});
|
|
85712
85722
|
}
|
|
85713
|
-
__name$
|
|
85714
|
-
var runDockerCmd = /* @__PURE__ */ __name$
|
|
85723
|
+
__name$1(dockerLoginImageRegistry, "dockerLoginImageRegistry");
|
|
85724
|
+
var runDockerCmd = /* @__PURE__ */ __name$1((dockerPath, args, stdio) => {
|
|
85715
85725
|
let aborted$2 = false;
|
|
85716
85726
|
let resolve2;
|
|
85717
85727
|
let reject;
|
|
@@ -85739,17 +85749,17 @@ var runDockerCmd = /* @__PURE__ */ __name$2((dockerPath, args, stdio) => {
|
|
|
85739
85749
|
}
|
|
85740
85750
|
});
|
|
85741
85751
|
return {
|
|
85742
|
-
abort: /* @__PURE__ */ __name$
|
|
85752
|
+
abort: /* @__PURE__ */ __name$1(() => {
|
|
85743
85753
|
aborted$2 = true;
|
|
85744
85754
|
child.unref();
|
|
85745
85755
|
if (child.pid !== void 0) if (process.platform === "win32") child.kill();
|
|
85746
85756
|
else process.kill(-child.pid);
|
|
85747
85757
|
}, "abort"),
|
|
85748
85758
|
ready,
|
|
85749
|
-
then: /* @__PURE__ */ __name$
|
|
85759
|
+
then: /* @__PURE__ */ __name$1(async (onResolve, onReject) => ready.then(onResolve).catch(onReject), "then")
|
|
85750
85760
|
};
|
|
85751
85761
|
}, "runDockerCmd");
|
|
85752
|
-
var runDockerCmdWithOutput = /* @__PURE__ */ __name$
|
|
85762
|
+
var runDockerCmdWithOutput = /* @__PURE__ */ __name$1((dockerPath, args) => {
|
|
85753
85763
|
try {
|
|
85754
85764
|
return execFileSync(dockerPath, args, {
|
|
85755
85765
|
encoding: "utf8",
|
|
@@ -85768,7 +85778,7 @@ async function containerPrivilegesAllowed(dockerHost, dockerPath = "docker") {
|
|
|
85768
85778
|
const localRootlessLinux = platform$1 === "linux" && existsSync("/dev/fuse") && rootless;
|
|
85769
85779
|
return localVm || localRootlessLinux;
|
|
85770
85780
|
}
|
|
85771
|
-
__name$
|
|
85781
|
+
__name$1(containerPrivilegesAllowed, "containerPrivilegesAllowed");
|
|
85772
85782
|
function isLocalDockerEndpoint(dockerHost) {
|
|
85773
85783
|
try {
|
|
85774
85784
|
const url$2 = new URL(dockerHost);
|
|
@@ -85777,7 +85787,7 @@ function isLocalDockerEndpoint(dockerHost) {
|
|
|
85777
85787
|
return false;
|
|
85778
85788
|
}
|
|
85779
85789
|
}
|
|
85780
|
-
__name$
|
|
85790
|
+
__name$1(isLocalDockerEndpoint, "isLocalDockerEndpoint");
|
|
85781
85791
|
async function getDockerSecurityOptions(dockerPath, dockerHost) {
|
|
85782
85792
|
const output$1 = await new Promise((resolve2, reject) => {
|
|
85783
85793
|
execFile(dockerPath, [
|
|
@@ -85796,12 +85806,12 @@ async function getDockerSecurityOptions(dockerPath, dockerHost) {
|
|
|
85796
85806
|
});
|
|
85797
85807
|
return JSON.parse(output$1);
|
|
85798
85808
|
}
|
|
85799
|
-
__name$
|
|
85809
|
+
__name$1(getDockerSecurityOptions, "getDockerSecurityOptions");
|
|
85800
85810
|
function detectWsl() {
|
|
85801
85811
|
return process.platform === "linux" && release().toLowerCase().includes("microsoft");
|
|
85802
85812
|
}
|
|
85803
|
-
__name$
|
|
85804
|
-
var isDockerRunning = /* @__PURE__ */ __name$
|
|
85813
|
+
__name$1(detectWsl, "detectWsl");
|
|
85814
|
+
var isDockerRunning = /* @__PURE__ */ __name$1(async (dockerPath) => {
|
|
85805
85815
|
try {
|
|
85806
85816
|
await runDockerCmd(dockerPath, ["info"], [
|
|
85807
85817
|
"inherit",
|
|
@@ -85813,7 +85823,7 @@ var isDockerRunning = /* @__PURE__ */ __name$2(async (dockerPath) => {
|
|
|
85813
85823
|
}
|
|
85814
85824
|
return true;
|
|
85815
85825
|
}, "isDockerRunning");
|
|
85816
|
-
var verifyDockerInstalled = /* @__PURE__ */ __name$
|
|
85826
|
+
var verifyDockerInstalled = /* @__PURE__ */ __name$1(async ({ dockerPath, operation, imageNoun, hint }) => {
|
|
85817
85827
|
if (!await isDockerRunning(dockerPath)) throw new UserError(getFailedToRunDockerErrorMessage({
|
|
85818
85828
|
operation,
|
|
85819
85829
|
imageNoun,
|
|
@@ -85840,11 +85850,11 @@ Note: Other container tooling that is compatible with the Docker CLI and engine
|
|
|
85840
85850
|
${hint}`;
|
|
85841
85851
|
return message;
|
|
85842
85852
|
}
|
|
85843
|
-
__name$
|
|
85853
|
+
__name$1(getFailedToRunDockerErrorMessage, "getFailedToRunDockerErrorMessage");
|
|
85844
85854
|
function generateContainerBuildId() {
|
|
85845
85855
|
return randomUUID().slice(0, 8);
|
|
85846
85856
|
}
|
|
85847
|
-
__name$
|
|
85857
|
+
__name$1(generateContainerBuildId, "generateContainerBuildId");
|
|
85848
85858
|
function getDockerSocketFromContext(dockerPath) {
|
|
85849
85859
|
try {
|
|
85850
85860
|
const currentContext = runDockerCmdWithOutput(dockerPath, [
|
|
@@ -85857,7 +85867,7 @@ function getDockerSocketFromContext(dockerPath) {
|
|
|
85857
85867
|
} catch {}
|
|
85858
85868
|
return null;
|
|
85859
85869
|
}
|
|
85860
|
-
__name$
|
|
85870
|
+
__name$1(getDockerSocketFromContext, "getDockerSocketFromContext");
|
|
85861
85871
|
function resolveDockerHost(dockerPath) {
|
|
85862
85872
|
if (process.env.WRANGLER_DOCKER_HOST) return process.env.WRANGLER_DOCKER_HOST;
|
|
85863
85873
|
if (process.env.DOCKER_HOST) return process.env.DOCKER_HOST;
|
|
@@ -85865,16 +85875,16 @@ function resolveDockerHost(dockerPath) {
|
|
|
85865
85875
|
if (contextSocket) return contextSocket;
|
|
85866
85876
|
return process.platform === "win32" ? "//./pipe/docker_engine" : "unix:///var/run/docker.sock";
|
|
85867
85877
|
}
|
|
85868
|
-
__name$
|
|
85878
|
+
__name$1(resolveDockerHost, "resolveDockerHost");
|
|
85869
85879
|
var DEFAULT_CONTAINER_EGRESS_INTERCEPTOR_IMAGE = "cloudflare/proxy-everything:3cb1195@sha256:0ef6716c52430096900b150d84a3302057d6cd2319dae7987128c85d0733e3c8";
|
|
85870
85880
|
function getEgressInterceptorPlatform() {
|
|
85871
85881
|
return process.env.MINIFLARE_CONTAINER_EGRESS_IMAGE_PLATFORM;
|
|
85872
85882
|
}
|
|
85873
|
-
__name$
|
|
85883
|
+
__name$1(getEgressInterceptorPlatform, "getEgressInterceptorPlatform");
|
|
85874
85884
|
function getEgressInterceptorImage() {
|
|
85875
85885
|
return process.env.MINIFLARE_CONTAINER_EGRESS_IMAGE ?? DEFAULT_CONTAINER_EGRESS_INTERCEPTOR_IMAGE;
|
|
85876
85886
|
}
|
|
85877
|
-
__name$
|
|
85887
|
+
__name$1(getEgressInterceptorImage, "getEgressInterceptorImage");
|
|
85878
85888
|
async function pullEgressInterceptorImage(dockerPath) {
|
|
85879
85889
|
const image = getEgressInterceptorImage();
|
|
85880
85890
|
const platform$1 = getEgressInterceptorPlatform();
|
|
@@ -85882,7 +85892,7 @@ async function pullEgressInterceptorImage(dockerPath) {
|
|
|
85882
85892
|
if (platform$1 !== void 0) args.push("--platform", platform$1);
|
|
85883
85893
|
await runDockerCmd(dockerPath, args);
|
|
85884
85894
|
}
|
|
85885
|
-
__name$
|
|
85895
|
+
__name$1(pullEgressInterceptorImage, "pullEgressInterceptorImage");
|
|
85886
85896
|
async function pullImage(dockerPath, options, logger2, complianceConfig, registryConfigureCommand) {
|
|
85887
85897
|
const domain$1 = new URL(`http://${options.image_uri}`).hostname;
|
|
85888
85898
|
const isExternalRegistry = domain$1 !== getCloudflareContainerRegistry(complianceConfig);
|
|
@@ -85909,13 +85919,13 @@ Attempting to pull image anyway...`);
|
|
|
85909
85919
|
return { aborted: aborted$2 };
|
|
85910
85920
|
});
|
|
85911
85921
|
return {
|
|
85912
|
-
abort: /* @__PURE__ */ __name$
|
|
85922
|
+
abort: /* @__PURE__ */ __name$1(() => {
|
|
85913
85923
|
pull.abort();
|
|
85914
85924
|
}, "abort"),
|
|
85915
85925
|
ready
|
|
85916
85926
|
};
|
|
85917
85927
|
}
|
|
85918
|
-
__name$
|
|
85928
|
+
__name$1(pullImage, "pullImage");
|
|
85919
85929
|
async function prepareContainerImagesForDev(args) {
|
|
85920
85930
|
const { dockerPath, containerOptions, onContainerImagePreparationStart, onContainerImagePreparationEnd } = args;
|
|
85921
85931
|
let aborted$2 = false;
|
|
@@ -85941,7 +85951,7 @@ async function prepareContainerImagesForDev(args) {
|
|
|
85941
85951
|
});
|
|
85942
85952
|
onContainerImagePreparationStart({
|
|
85943
85953
|
containerOptions: options,
|
|
85944
|
-
abort: /* @__PURE__ */ __name$
|
|
85954
|
+
abort: /* @__PURE__ */ __name$1(() => {
|
|
85945
85955
|
aborted$2 = true;
|
|
85946
85956
|
build.abort();
|
|
85947
85957
|
}, "abort")
|
|
@@ -85952,7 +85962,7 @@ async function prepareContainerImagesForDev(args) {
|
|
|
85952
85962
|
const pull = await pullImage(dockerPath, options, args.logger, args.complianceConfig, args.registryConfigureCommand);
|
|
85953
85963
|
onContainerImagePreparationStart({
|
|
85954
85964
|
containerOptions: options,
|
|
85955
|
-
abort: /* @__PURE__ */ __name$
|
|
85965
|
+
abort: /* @__PURE__ */ __name$1(() => {
|
|
85956
85966
|
aborted$2 = true;
|
|
85957
85967
|
pull.abort();
|
|
85958
85968
|
}, "abort")
|
|
@@ -85966,7 +85976,7 @@ async function prepareContainerImagesForDev(args) {
|
|
|
85966
85976
|
if (!aborted$2) await pullEgressInterceptorImage(dockerPath);
|
|
85967
85977
|
return { aborted: aborted$2 };
|
|
85968
85978
|
}
|
|
85969
|
-
__name$
|
|
85979
|
+
__name$1(prepareContainerImagesForDev, "prepareContainerImagesForDev");
|
|
85970
85980
|
function isCloudflareRegistryImage(image, complianceConfig) {
|
|
85971
85981
|
let url$2;
|
|
85972
85982
|
try {
|
|
@@ -85974,7 +85984,7 @@ function isCloudflareRegistryImage(image, complianceConfig) {
|
|
|
85974
85984
|
} catch {}
|
|
85975
85985
|
return url$2 === void 0 || !url$2.host.match(/[:.]/) && url$2.hostname !== "localhost" || url$2.hostname === getCloudflareContainerRegistry(complianceConfig);
|
|
85976
85986
|
}
|
|
85977
|
-
__name$
|
|
85987
|
+
__name$1(isCloudflareRegistryImage, "isCloudflareRegistryImage");
|
|
85978
85988
|
function resolveImageName(accountId, image, complianceConfig) {
|
|
85979
85989
|
let url$2;
|
|
85980
85990
|
try {
|
|
@@ -85993,11 +86003,11 @@ Current account: "${accountId}"`);
|
|
|
85993
86003
|
}
|
|
85994
86004
|
return `${url$2.hostname}/${accountId}${url$2.pathname}`;
|
|
85995
86005
|
}
|
|
85996
|
-
__name$
|
|
86006
|
+
__name$1(resolveImageName, "resolveImageName");
|
|
85997
86007
|
function invalidGarCredentialError() {
|
|
85998
86008
|
return new UserError("The Google service account key must be a JSON key file or its base64-encoded form.", { telemetryMessage: "containers registries configure invalid gar credential" });
|
|
85999
86009
|
}
|
|
86000
|
-
__name$
|
|
86010
|
+
__name$1(invalidGarCredentialError, "invalidGarCredentialError");
|
|
86001
86011
|
function tryParseJson(value) {
|
|
86002
86012
|
try {
|
|
86003
86013
|
return JSON.parse(value);
|
|
@@ -86005,12 +86015,12 @@ function tryParseJson(value) {
|
|
|
86005
86015
|
return;
|
|
86006
86016
|
}
|
|
86007
86017
|
}
|
|
86008
|
-
__name$
|
|
86018
|
+
__name$1(tryParseJson, "tryParseJson");
|
|
86009
86019
|
function assertJsonObject(parsed) {
|
|
86010
86020
|
if (typeof parsed !== "object" || parsed === null) throw invalidGarCredentialError();
|
|
86011
86021
|
return parsed;
|
|
86012
86022
|
}
|
|
86013
|
-
__name$
|
|
86023
|
+
__name$1(assertJsonObject, "assertJsonObject");
|
|
86014
86024
|
function validateServiceAccountKey(accountKey) {
|
|
86015
86025
|
const privateKey = accountKey.private_key;
|
|
86016
86026
|
const clientEmail = accountKey.client_email;
|
|
@@ -86027,7 +86037,7 @@ function validateServiceAccountKey(accountKey) {
|
|
|
86027
86037
|
private_key_id: privateKeyId
|
|
86028
86038
|
};
|
|
86029
86039
|
}
|
|
86030
|
-
__name$
|
|
86040
|
+
__name$1(validateServiceAccountKey, "validateServiceAccountKey");
|
|
86031
86041
|
function validateAndEncodeGarKey(rawKey, expectedEmail) {
|
|
86032
86042
|
const trimmed = rawKey.trim();
|
|
86033
86043
|
let base64Key;
|
|
@@ -86047,7 +86057,7 @@ function validateAndEncodeGarKey(rawKey, expectedEmail) {
|
|
|
86047
86057
|
if (key.client_email !== expectedEmail) throw new UserError(`The provided --gar-email "${expectedEmail}" does not match the service account email "${key.client_email}" in the key.`, { telemetryMessage: "containers registries configure gar email mismatch" });
|
|
86048
86058
|
return base64Key;
|
|
86049
86059
|
}
|
|
86050
|
-
__name$
|
|
86060
|
+
__name$1(validateAndEncodeGarKey, "validateAndEncodeGarKey");
|
|
86051
86061
|
async function dockerImageInspect(dockerPath, options) {
|
|
86052
86062
|
return new Promise((resolve2, reject) => {
|
|
86053
86063
|
const proc = spawn(dockerPath, [
|
|
@@ -86072,7 +86082,7 @@ async function dockerImageInspect(dockerPath, options) {
|
|
|
86072
86082
|
proc.on("error", (err) => reject(err));
|
|
86073
86083
|
});
|
|
86074
86084
|
}
|
|
86075
|
-
__name$
|
|
86085
|
+
__name$1(dockerImageInspect, "dockerImageInspect");
|
|
86076
86086
|
var MB = 1e3 * 1e3;
|
|
86077
86087
|
var MiB = 1024 * 1024;
|
|
86078
86088
|
var instanceTypes = {
|
|
@@ -86129,7 +86139,7 @@ function configToUsage(containerConfig) {
|
|
|
86129
86139
|
disk_mb: containerConfig.disk_bytes / MB
|
|
86130
86140
|
};
|
|
86131
86141
|
}
|
|
86132
|
-
__name$
|
|
86142
|
+
__name$1(configToUsage, "configToUsage");
|
|
86133
86143
|
function accountToLimits(account) {
|
|
86134
86144
|
return {
|
|
86135
86145
|
vcpu: account.limits.vcpu_per_deployment,
|
|
@@ -86137,15 +86147,15 @@ function accountToLimits(account) {
|
|
|
86137
86147
|
disk_mb: account.limits.disk_mb_per_deployment
|
|
86138
86148
|
};
|
|
86139
86149
|
}
|
|
86140
|
-
__name$
|
|
86150
|
+
__name$1(accountToLimits, "accountToLimits");
|
|
86141
86151
|
function getInstanceTypeUsage(instanceType) {
|
|
86142
86152
|
return instanceTypes[instanceType];
|
|
86143
86153
|
}
|
|
86144
|
-
__name$
|
|
86154
|
+
__name$1(getInstanceTypeUsage, "getInstanceTypeUsage");
|
|
86145
86155
|
function inferInstanceType(config$3) {
|
|
86146
86156
|
for (const [instanceType, configuration] of Object.entries(instanceTypes)) if (config$3.vcpu === configuration.vcpu && config$3.memory_mib === configuration.memory_mib && config$3.disk?.size_mb === configuration.disk_mb) return (instanceType in LEGACY_TO_CANONICAL ? LEGACY_TO_CANONICAL[instanceType] : void 0) ?? instanceType;
|
|
86147
86157
|
}
|
|
86148
|
-
__name$
|
|
86158
|
+
__name$1(inferInstanceType, "inferInstanceType");
|
|
86149
86159
|
function cleanForInstanceType(app) {
|
|
86150
86160
|
if (!("configuration" in app)) return app;
|
|
86151
86161
|
const instance_type = inferInstanceType(app.configuration);
|
|
@@ -86156,7 +86166,7 @@ function cleanForInstanceType(app) {
|
|
|
86156
86166
|
delete app.configuration.vcpu;
|
|
86157
86167
|
return app;
|
|
86158
86168
|
}
|
|
86159
|
-
__name$
|
|
86169
|
+
__name$1(cleanForInstanceType, "cleanForInstanceType");
|
|
86160
86170
|
async function ensureContainerLimits(options) {
|
|
86161
86171
|
const limits = accountToLimits(options.account);
|
|
86162
86172
|
if (!options.containerConfig) {
|
|
@@ -86179,7 +86189,7 @@ async function ensureContainerLimits(options) {
|
|
|
86179
86189
|
imageTag: options.imageTag
|
|
86180
86190
|
});
|
|
86181
86191
|
}
|
|
86182
|
-
__name$
|
|
86192
|
+
__name$1(ensureContainerLimits, "ensureContainerLimits");
|
|
86183
86193
|
async function ensureImageFitsLimits(options) {
|
|
86184
86194
|
const inspectOutput = await dockerImageInspect(options.pathToDocker, {
|
|
86185
86195
|
imageTag: options.imageTag,
|
|
@@ -86193,21 +86203,21 @@ async function ensureImageFitsLimits(options) {
|
|
|
86193
86203
|
logger$1.debug(`Disk size limits when building container image: availableSize=${Math.ceil(options.availableSizeInBytes / MB)}MB, requiredSize=${Math.ceil(requiredSizeInBytes / MB)}MB`);
|
|
86194
86204
|
if (options.availableSizeInBytes < requiredSizeInBytes) throw new UserError(`Image too large: needs ${Math.ceil(requiredSizeInBytes / MB)}MB, but your app is limited to images with size ${options.availableSizeInBytes / MB}MB. You need more disk for this image.`, { telemetryMessage: "cloudchamber limits image too large" });
|
|
86195
86205
|
}
|
|
86196
|
-
__name$
|
|
86206
|
+
__name$1(ensureImageFitsLimits, "ensureImageFitsLimits");
|
|
86197
86207
|
async function getContainerAccount(accountId, complianceConfig) {
|
|
86198
86208
|
if (accountId === void 0) return await AccountService.getMe();
|
|
86199
86209
|
return await fetchResult$1(complianceConfig ?? {}, `/accounts/${accountId}/containers/me`);
|
|
86200
86210
|
}
|
|
86201
|
-
__name$
|
|
86211
|
+
__name$1(getContainerAccount, "getContainerAccount");
|
|
86202
86212
|
var MAX_DOCKER_REPOSITORY_NAME_LENGTH = 255;
|
|
86203
86213
|
function normalizeContainerImageRepositoryName(value) {
|
|
86204
86214
|
return value.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/[._-]+/g, (separators) => separators === "." || separators === "_" || separators === "__" || /^-+$/.test(separators) ? separators : "-").replace(/^[._-]+|[._-]+$/g, "").slice(0, MAX_DOCKER_REPOSITORY_NAME_LENGTH).replace(/[._-]+$/g, "") || "container";
|
|
86205
86215
|
}
|
|
86206
|
-
__name$
|
|
86216
|
+
__name$1(normalizeContainerImageRepositoryName, "normalizeContainerImageRepositoryName");
|
|
86207
86217
|
function isDockerfileContainerConfig(container) {
|
|
86208
86218
|
return "dockerfile" in container;
|
|
86209
86219
|
}
|
|
86210
|
-
__name$
|
|
86220
|
+
__name$1(isDockerfileContainerConfig, "isDockerfileContainerConfig");
|
|
86211
86221
|
async function constructBuildCommand(options) {
|
|
86212
86222
|
const imageOutput = process.env.WRANGLER_CONTAINER_IMAGE_COMPRESSION === "zstd" ? "type=docker,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true" : void 0;
|
|
86213
86223
|
const platform$1 = options.platform ?? "linux/amd64";
|
|
@@ -86231,7 +86241,7 @@ async function constructBuildCommand(options) {
|
|
|
86231
86241
|
dockerfile
|
|
86232
86242
|
};
|
|
86233
86243
|
}
|
|
86234
|
-
__name$
|
|
86244
|
+
__name$1(constructBuildCommand, "constructBuildCommand");
|
|
86235
86245
|
async function startContainerBuild({ build, pathToDocker, verifyDockerIsRunning }) {
|
|
86236
86246
|
if (process.env.WRANGLER_CONTAINER_IMAGE_COMPRESSION === "zstd") {
|
|
86237
86247
|
if (!runDockerCmdWithOutput(pathToDocker, [
|
|
@@ -86247,25 +86257,25 @@ async function startContainerBuild({ build, pathToDocker, verifyDockerIsRunning
|
|
|
86247
86257
|
verifyDockerIsRunning
|
|
86248
86258
|
});
|
|
86249
86259
|
}
|
|
86250
|
-
__name$
|
|
86260
|
+
__name$1(startContainerBuild, "startContainerBuild");
|
|
86251
86261
|
var DIGEST_SUFFIX_REGEXP = /@[A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*:[a-fA-F0-9]{32,}$/;
|
|
86252
86262
|
var DIGEST_VALUE_REGEXP = /^[A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*:[a-fA-F0-9]{32,}$/;
|
|
86253
86263
|
var TAG_SUFFIX_REGEXP = /:[\w][\w.-]{0,127}$/;
|
|
86254
86264
|
function getRepositoryOnly(externalAccountId, imageTag, complianceConfig) {
|
|
86255
86265
|
return resolveImageName(externalAccountId, imageTag, complianceConfig).replace(DIGEST_SUFFIX_REGEXP, "").replace(TAG_SUFFIX_REGEXP, "");
|
|
86256
86266
|
}
|
|
86257
|
-
__name$
|
|
86267
|
+
__name$1(getRepositoryOnly, "getRepositoryOnly");
|
|
86258
86268
|
function imageRefWithDigest(externalAccountId, imageTag, digest, complianceConfig) {
|
|
86259
86269
|
if (!DIGEST_VALUE_REGEXP.test(digest)) throw new Error(`Expected image digest to match algorithm:hex format, got ${digest}`);
|
|
86260
86270
|
return `${getRepositoryOnly(externalAccountId, imageTag, complianceConfig)}@${digest}`;
|
|
86261
86271
|
}
|
|
86262
|
-
__name$
|
|
86272
|
+
__name$1(imageRefWithDigest, "imageRefWithDigest");
|
|
86263
86273
|
function findManifestDigest(manifestOutput) {
|
|
86264
86274
|
const digest = JSON.parse(manifestOutput)?.Descriptor?.digest;
|
|
86265
86275
|
if (typeof digest !== "string" || digest.length === 0) throw new Error(`Expected docker manifest inspect output to include Descriptor.digest, got ${manifestOutput}`);
|
|
86266
86276
|
return digest;
|
|
86267
86277
|
}
|
|
86268
|
-
__name$
|
|
86278
|
+
__name$1(findManifestDigest, "findManifestDigest");
|
|
86269
86279
|
function findRemoteDigest(repoDigestsJson, externalAccountId, imageTag, complianceConfig) {
|
|
86270
86280
|
const parsedDigests = JSON.parse(repoDigestsJson);
|
|
86271
86281
|
if (!Array.isArray(parsedDigests)) throw new Error(`Expected RepoDigests from docker inspect to be an array but got ${JSON.stringify(parsedDigests)}`);
|
|
@@ -86282,11 +86292,11 @@ function findRemoteDigest(repoDigestsJson, externalAccountId, imageTag, complian
|
|
|
86282
86292
|
assertString(hash$1, `Expected digest "${digest}" to include a hash`);
|
|
86283
86293
|
return imageRefWithDigest(externalAccountId, imageTag, hash$1, complianceConfig);
|
|
86284
86294
|
}
|
|
86285
|
-
__name$
|
|
86295
|
+
__name$1(findRemoteDigest, "findRemoteDigest");
|
|
86286
86296
|
function assertString(value, message) {
|
|
86287
86297
|
if (value === void 0) throw new Error(message);
|
|
86288
86298
|
}
|
|
86289
|
-
__name$
|
|
86299
|
+
__name$1(assertString, "assertString");
|
|
86290
86300
|
async function tagAndPushImage({ pathToDocker, sourceTag, targetTag, externalAccountId, complianceConfig, cleanupSourceTag }) {
|
|
86291
86301
|
const namespacedImageTag = resolveImageName(externalAccountId, targetTag, complianceConfig);
|
|
86292
86302
|
await runDockerCmd(pathToDocker, [
|
|
@@ -86305,7 +86315,7 @@ async function tagAndPushImage({ pathToDocker, sourceTag, targetTag, externalAcc
|
|
|
86305
86315
|
}
|
|
86306
86316
|
return namespacedImageTag;
|
|
86307
86317
|
}
|
|
86308
|
-
__name$
|
|
86318
|
+
__name$1(tagAndPushImage, "tagAndPushImage");
|
|
86309
86319
|
async function pushImageIfChanged({ pathToDocker, sourceTag, targetTag, containerConfig, accountId, complianceConfig, cleanupSourceTag }) {
|
|
86310
86320
|
const imageInfo = await dockerImageInspect(pathToDocker, {
|
|
86311
86321
|
imageTag: sourceTag,
|
|
@@ -86372,7 +86382,7 @@ async function pushImageIfChanged({ pathToDocker, sourceTag, targetTag, containe
|
|
|
86372
86382
|
}
|
|
86373
86383
|
return { remoteDigest };
|
|
86374
86384
|
}
|
|
86375
|
-
__name$
|
|
86385
|
+
__name$1(pushImageIfChanged, "pushImageIfChanged");
|
|
86376
86386
|
async function buildCommand(args, complianceConfig) {
|
|
86377
86387
|
if (existsSync(args.PATH) && !isDirectory(args.PATH)) throw new UserError(`${args.PATH} is not a directory. Please specify a valid directory path.`, { telemetryMessage: "container build invalid path" });
|
|
86378
86388
|
if (args.platform !== void 0 && args.platform !== "linux/amd64") throw new UserError(`Unsupported platform: Platform "${args.platform}" is unsupported. Please use "linux/amd64" instead.`, { telemetryMessage: "container build unsupported platform" });
|
|
@@ -86402,7 +86412,7 @@ async function buildCommand(args, complianceConfig) {
|
|
|
86402
86412
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container build unknown error" });
|
|
86403
86413
|
}
|
|
86404
86414
|
}
|
|
86405
|
-
__name$
|
|
86415
|
+
__name$1(buildCommand, "buildCommand");
|
|
86406
86416
|
async function pushCommand(args, accountId, complianceConfig) {
|
|
86407
86417
|
try {
|
|
86408
86418
|
const dockerPath = args.pathToDocker ?? getDockerPath();
|
|
@@ -86421,7 +86431,7 @@ async function pushCommand(args, accountId, complianceConfig) {
|
|
|
86421
86431
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container push unknown error" });
|
|
86422
86432
|
}
|
|
86423
86433
|
}
|
|
86424
|
-
__name$
|
|
86434
|
+
__name$1(pushCommand, "pushCommand");
|
|
86425
86435
|
async function checkImagePlatform(pathToDocker, imageTag, expectedPlatform = "linux/amd64") {
|
|
86426
86436
|
const platform$1 = await dockerImageInspect(pathToDocker, {
|
|
86427
86437
|
imageTag,
|
|
@@ -86429,7 +86439,7 @@ async function checkImagePlatform(pathToDocker, imageTag, expectedPlatform = "li
|
|
|
86429
86439
|
});
|
|
86430
86440
|
if (platform$1 !== expectedPlatform) throw new Error(`Unsupported platform: Image platform (${platform$1}) does not match the expected platform (${expectedPlatform})`);
|
|
86431
86441
|
}
|
|
86432
|
-
__name$
|
|
86442
|
+
__name$1(checkImagePlatform, "checkImagePlatform");
|
|
86433
86443
|
async function buildAndMaybePush(args, pathToDocker, push, containerConfig, verifyDockerIsRunning, complianceConfig) {
|
|
86434
86444
|
try {
|
|
86435
86445
|
await (await startContainerBuild({
|
|
@@ -86454,7 +86464,7 @@ async function buildAndMaybePush(args, pathToDocker, push, containerConfig, veri
|
|
|
86454
86464
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container build unknown error" });
|
|
86455
86465
|
}
|
|
86456
86466
|
}
|
|
86457
|
-
__name$
|
|
86467
|
+
__name$1(buildAndMaybePush, "buildAndMaybePush");
|
|
86458
86468
|
async function buildContainerImage(containerConfig, pathToDocker, verifyDockerIsRunning) {
|
|
86459
86469
|
const localTag = `${getContainerImageRepositoryName(containerConfig)}:wrangler-${crypto2.randomUUID()}`;
|
|
86460
86470
|
logger$1.log("Building image", localTag);
|
|
@@ -86481,7 +86491,7 @@ async function buildContainerImage(containerConfig, pathToDocker, verifyDockerIs
|
|
|
86481
86491
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container build unknown error" });
|
|
86482
86492
|
}
|
|
86483
86493
|
}
|
|
86484
|
-
__name$
|
|
86494
|
+
__name$1(buildContainerImage, "buildContainerImage");
|
|
86485
86495
|
async function buildContainerImages(containers, pathToDocker, verifyDockerIsRunning) {
|
|
86486
86496
|
const builtImages = [];
|
|
86487
86497
|
try {
|
|
@@ -86492,7 +86502,7 @@ async function buildContainerImages(containers, pathToDocker, verifyDockerIsRunn
|
|
|
86492
86502
|
}
|
|
86493
86503
|
return builtImages;
|
|
86494
86504
|
}
|
|
86495
|
-
__name$
|
|
86505
|
+
__name$1(buildContainerImages, "buildContainerImages");
|
|
86496
86506
|
async function pushBuiltContainerImage(builtImage, versionId, pathToDocker, accountId, complianceConfig) {
|
|
86497
86507
|
try {
|
|
86498
86508
|
return await pushImageIfChanged({
|
|
@@ -86512,7 +86522,7 @@ async function pushBuiltContainerImage(builtImage, versionId, pathToDocker, acco
|
|
|
86512
86522
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container build unknown error" });
|
|
86513
86523
|
}
|
|
86514
86524
|
}
|
|
86515
|
-
__name$
|
|
86525
|
+
__name$1(pushBuiltContainerImage, "pushBuiltContainerImage");
|
|
86516
86526
|
async function cleanupBuiltImages(builtImages, pathToDocker) {
|
|
86517
86527
|
const aliasesByTag = /* @__PURE__ */ new Map();
|
|
86518
86528
|
for (const builtImage of builtImages) {
|
|
@@ -86535,15 +86545,15 @@ async function cleanupBuiltImages(builtImages, pathToDocker) {
|
|
|
86535
86545
|
for (const alias of aliases) alias.localTagCleaned = true;
|
|
86536
86546
|
}
|
|
86537
86547
|
}
|
|
86538
|
-
__name$
|
|
86548
|
+
__name$1(cleanupBuiltImages, "cleanupBuiltImages");
|
|
86539
86549
|
function getContainerImageTag(containerConfig, imageTag) {
|
|
86540
86550
|
return `${getContainerImageRepositoryName(containerConfig)}:${imageTag.split("-")[0]}`;
|
|
86541
86551
|
}
|
|
86542
|
-
__name$
|
|
86552
|
+
__name$1(getContainerImageTag, "getContainerImageTag");
|
|
86543
86553
|
function getContainerImageRepositoryName(containerConfig) {
|
|
86544
86554
|
return containerConfig.name.toLowerCase();
|
|
86545
86555
|
}
|
|
86546
|
-
__name$
|
|
86556
|
+
__name$1(getContainerImageRepositoryName, "getContainerImageRepositoryName");
|
|
86547
86557
|
async function dockerBuild(dockerPath, options) {
|
|
86548
86558
|
if (options.verifyDockerIsRunning !== false) await verifyDockerInstalled({
|
|
86549
86559
|
dockerPath,
|
|
@@ -86583,7 +86593,7 @@ async function dockerBuild(dockerPath, options) {
|
|
|
86583
86593
|
}
|
|
86584
86594
|
});
|
|
86585
86595
|
return {
|
|
86586
|
-
abort: /* @__PURE__ */ __name$
|
|
86596
|
+
abort: /* @__PURE__ */ __name$1(() => {
|
|
86587
86597
|
child.unref();
|
|
86588
86598
|
if (child.pid !== void 0) if (process.platform === "win32") child.kill();
|
|
86589
86599
|
else process.kill(-child.pid);
|
|
@@ -86591,7 +86601,7 @@ async function dockerBuild(dockerPath, options) {
|
|
|
86591
86601
|
ready
|
|
86592
86602
|
};
|
|
86593
86603
|
}
|
|
86594
|
-
__name$
|
|
86604
|
+
__name$1(dockerBuild, "dockerBuild");
|
|
86595
86605
|
function resolveInputContainerImage(options) {
|
|
86596
86606
|
if ("reference" in options.image) return { reference: options.image.reference };
|
|
86597
86607
|
const dockerfile = path__default.resolve(options.root, options.image.dockerfile);
|
|
@@ -86601,7 +86611,7 @@ function resolveInputContainerImage(options) {
|
|
|
86601
86611
|
buildVars: options.image.buildVars
|
|
86602
86612
|
};
|
|
86603
86613
|
}
|
|
86604
|
-
__name$
|
|
86614
|
+
__name$1(resolveInputContainerImage, "resolveInputContainerImage");
|
|
86605
86615
|
var BUILD_OUTPUT_IMAGE_NAMESPACE = "cloudflare-build";
|
|
86606
86616
|
var DOCKER_REPOSITORY_NAME_LENGTH = 255;
|
|
86607
86617
|
async function buildAndWriteContainerOutput(options) {
|
|
@@ -86641,7 +86651,7 @@ async function buildAndWriteContainerOutput(options) {
|
|
|
86641
86651
|
throw error$3;
|
|
86642
86652
|
}
|
|
86643
86653
|
}
|
|
86644
|
-
__name$
|
|
86654
|
+
__name$1(buildAndWriteContainerOutput, "buildAndWriteContainerOutput");
|
|
86645
86655
|
function resolveContainerDirectories(containers) {
|
|
86646
86656
|
const containerNameByDirectory = /* @__PURE__ */ new Map();
|
|
86647
86657
|
return containers.map((config$3) => {
|
|
@@ -86655,7 +86665,7 @@ function resolveContainerDirectories(containers) {
|
|
|
86655
86665
|
};
|
|
86656
86666
|
});
|
|
86657
86667
|
}
|
|
86658
|
-
__name$
|
|
86668
|
+
__name$1(resolveContainerDirectories, "resolveContainerDirectories");
|
|
86659
86669
|
async function buildContainerOutputConfig(options) {
|
|
86660
86670
|
if (options.config.schedulingPolicy === "durable-object") {
|
|
86661
86671
|
if (options.config.images === void 0) return {
|
|
@@ -86689,7 +86699,7 @@ async function buildContainerOutputConfig(options) {
|
|
|
86689
86699
|
image
|
|
86690
86700
|
};
|
|
86691
86701
|
}
|
|
86692
|
-
__name$
|
|
86702
|
+
__name$1(buildContainerOutputConfig, "buildContainerOutputConfig");
|
|
86693
86703
|
async function buildContainerImage2(options) {
|
|
86694
86704
|
const image = resolveInputContainerImage({
|
|
86695
86705
|
image: options.image,
|
|
@@ -86716,13 +86726,13 @@ async function buildContainerImage2(options) {
|
|
|
86716
86726
|
options.localTags.add(localTag);
|
|
86717
86727
|
return { localReference: localTag };
|
|
86718
86728
|
}
|
|
86719
|
-
__name$
|
|
86729
|
+
__name$1(buildContainerImage2, "buildContainerImage");
|
|
86720
86730
|
function createBuildOutputImageTag(options) {
|
|
86721
86731
|
const repositoryPrefix = getBuildOutputImageRepositoryPrefix(options.root);
|
|
86722
86732
|
const maxNameLength = DOCKER_REPOSITORY_NAME_LENGTH - repositoryPrefix.length;
|
|
86723
86733
|
return `${repositoryPrefix}${normalizeContainerImageRepositoryName(options.repositoryName).slice(0, maxNameLength).replace(/[._-]+$/g, "")}:${options.buildId}`;
|
|
86724
86734
|
}
|
|
86725
|
-
__name$
|
|
86735
|
+
__name$1(createBuildOutputImageTag, "createBuildOutputImageTag");
|
|
86726
86736
|
async function cleanupPreviousBuildOutputImageTags(options) {
|
|
86727
86737
|
const repositoryPrefix = getBuildOutputImageRepositoryPrefix(options.root);
|
|
86728
86738
|
let existingTags;
|
|
@@ -86741,26 +86751,26 @@ async function cleanupPreviousBuildOutputImageTags(options) {
|
|
|
86741
86751
|
}
|
|
86742
86752
|
if (existingTags.length > 0) await cleanupBuiltImages(existingTags.map((localTag) => ({ localTag })), options.pathToDocker);
|
|
86743
86753
|
}
|
|
86744
|
-
__name$
|
|
86754
|
+
__name$1(cleanupPreviousBuildOutputImageTags, "cleanupPreviousBuildOutputImageTags");
|
|
86745
86755
|
function getBuildOutputImageRepositoryPrefix(root) {
|
|
86746
86756
|
return `${BUILD_OUTPUT_IMAGE_NAMESPACE}/${shortHash(path__default.resolve(root))}/`;
|
|
86747
86757
|
}
|
|
86748
|
-
__name$
|
|
86758
|
+
__name$1(getBuildOutputImageRepositoryPrefix, "getBuildOutputImageRepositoryPrefix");
|
|
86749
86759
|
function shortHash(value) {
|
|
86750
86760
|
return crypto2.createHash("sha256").update(value).digest("hex").slice(0, 12);
|
|
86751
86761
|
}
|
|
86752
|
-
__name$
|
|
86762
|
+
__name$1(shortHash, "shortHash");
|
|
86753
86763
|
function createBuildId() {
|
|
86754
86764
|
return crypto2.randomUUID().replaceAll("-", "").slice(0, 12);
|
|
86755
86765
|
}
|
|
86756
|
-
__name$
|
|
86766
|
+
__name$1(createBuildId, "createBuildId");
|
|
86757
86767
|
function countDockerfiles(containers) {
|
|
86758
86768
|
let count = 0;
|
|
86759
86769
|
for (const config$3 of containers) if (config$3.schedulingPolicy === "durable-object") count += Object.values(config$3.images ?? {}).filter((image) => "dockerfile" in image).length;
|
|
86760
86770
|
else if ("dockerfile" in config$3.image) count++;
|
|
86761
86771
|
return count;
|
|
86762
86772
|
}
|
|
86763
|
-
__name$
|
|
86773
|
+
__name$1(countDockerfiles, "countDockerfiles");
|
|
86764
86774
|
function throwBuildError(error$3) {
|
|
86765
86775
|
if (error$3 instanceof UserError) throw error$3;
|
|
86766
86776
|
if (error$3 instanceof Error) throw new UserError(error$3.message, {
|
|
@@ -86769,10 +86779,10 @@ function throwBuildError(error$3) {
|
|
|
86769
86779
|
});
|
|
86770
86780
|
throw new UserError("An unknown error occurred", { telemetryMessage: "container build unknown error" });
|
|
86771
86781
|
}
|
|
86772
|
-
__name$
|
|
86782
|
+
__name$1(throwBuildError, "throwBuildError");
|
|
86773
86783
|
var Diff = class {
|
|
86774
86784
|
static {
|
|
86775
|
-
__name$
|
|
86785
|
+
__name$1(this, "Diff");
|
|
86776
86786
|
}
|
|
86777
86787
|
#results = [];
|
|
86778
86788
|
get changes() {
|
|
@@ -86859,15 +86869,15 @@ var Diff = class {
|
|
|
86859
86869
|
*/
|
|
86860
86870
|
get #resultsForPrint() {
|
|
86861
86871
|
const results = [...this.#results.filter((r$1) => !!r$1.value && r$1.value !== "\n")];
|
|
86862
|
-
const swapLines = /* @__PURE__ */ __name$
|
|
86872
|
+
const swapLines = /* @__PURE__ */ __name$1((i$1, j$1) => {
|
|
86863
86873
|
const current = results[i$1];
|
|
86864
86874
|
const adjacent = results[j$1];
|
|
86865
86875
|
if (current === void 0 || adjacent === void 0) return;
|
|
86866
86876
|
results[i$1] = adjacent;
|
|
86867
86877
|
results[j$1] = current;
|
|
86868
86878
|
}, "swapLines");
|
|
86869
|
-
const numOfLines = /* @__PURE__ */ __name$
|
|
86870
|
-
const isLoneResult = /* @__PURE__ */ __name$
|
|
86879
|
+
const numOfLines = /* @__PURE__ */ __name$1((str) => str.split("\n").length, "numOfLines");
|
|
86880
|
+
const isLoneResult = /* @__PURE__ */ __name$1((index, target$1) => {
|
|
86871
86881
|
const currentIdx = index;
|
|
86872
86882
|
const adjacentIdx = currentIdx + target$1;
|
|
86873
86883
|
const nextIdx = currentIdx + target$1 + target$1;
|
|
@@ -86876,7 +86886,7 @@ var Diff = class {
|
|
|
86876
86886
|
const next = results[nextIdx];
|
|
86877
86887
|
if (!current || !adjacent || !next) return false;
|
|
86878
86888
|
const previousIdx = index - target$1;
|
|
86879
|
-
const isAlternation = /* @__PURE__ */ __name$
|
|
86889
|
+
const isAlternation = /* @__PURE__ */ __name$1((type) => current[type] === true && results[previousIdx]?.[type] !== current[type] && adjacent[type === "added" ? "removed" : "added"] === true && next[type] === true, "isAlternation");
|
|
86880
86890
|
if (!isAlternation("added") && !isAlternation("removed")) return false;
|
|
86881
86891
|
return numOfLines(current.value ?? "") === 1 && numOfLines(adjacent.value ?? "") === 1 && numOfLines(next.value ?? "") > 1;
|
|
86882
86892
|
}, "isLoneResult");
|
|
@@ -87018,12 +87028,12 @@ function tokenize(value) {
|
|
|
87018
87028
|
}
|
|
87019
87029
|
return retLines.filter((s) => s !== "");
|
|
87020
87030
|
}
|
|
87021
|
-
__name$
|
|
87031
|
+
__name$1(tokenize, "tokenize");
|
|
87022
87032
|
function stripUndefined(r$1) {
|
|
87023
87033
|
for (const k in r$1) if (r$1[k] === void 0) delete r$1[k];
|
|
87024
87034
|
return r$1;
|
|
87025
87035
|
}
|
|
87026
|
-
__name$
|
|
87036
|
+
__name$1(stripUndefined, "stripUndefined");
|
|
87027
87037
|
function sortObjectKeys(unordered) {
|
|
87028
87038
|
if (Array.isArray(unordered)) return unordered;
|
|
87029
87039
|
return Object.keys(unordered).sort().reduce((obj, key) => {
|
|
@@ -87031,7 +87041,7 @@ function sortObjectKeys(unordered) {
|
|
|
87031
87041
|
return obj;
|
|
87032
87042
|
}, {});
|
|
87033
87043
|
}
|
|
87034
|
-
__name$
|
|
87044
|
+
__name$1(sortObjectKeys, "sortObjectKeys");
|
|
87035
87045
|
function sortObjectRecursive(object$2) {
|
|
87036
87046
|
if (typeof object$2 !== "object") return object$2;
|
|
87037
87047
|
if (Array.isArray(object$2)) return object$2.map((obj) => sortObjectRecursive(obj));
|
|
@@ -87042,7 +87052,7 @@ function sortObjectRecursive(object$2) {
|
|
|
87042
87052
|
}
|
|
87043
87053
|
return sortObjectKeys(objectCopy);
|
|
87044
87054
|
}
|
|
87045
|
-
__name$
|
|
87055
|
+
__name$1(sortObjectRecursive, "sortObjectRecursive");
|
|
87046
87056
|
async function promiseSpinner(promise$1, { message } = { message: "Loading" }) {
|
|
87047
87057
|
if (process.env.CI || !process.stdin.isTTY) return promise$1;
|
|
87048
87058
|
const { start, stop } = spinner();
|
|
@@ -87054,7 +87064,7 @@ async function promiseSpinner(promise$1, { message } = { message: "Loading" }) {
|
|
|
87054
87064
|
stop();
|
|
87055
87065
|
return t$2;
|
|
87056
87066
|
}
|
|
87057
|
-
__name$
|
|
87067
|
+
__name$1(promiseSpinner, "promiseSpinner");
|
|
87058
87068
|
function createDurableObjectNamespaceResolver(config$3, { versionId, accountId, scriptName, dispatchNamespace }) {
|
|
87059
87069
|
const boundDOs = new Set(config$3.durable_objects.bindings.map((binding) => binding.class_name));
|
|
87060
87070
|
let maybeVersionInfo;
|
|
@@ -87072,7 +87082,7 @@ function createDurableObjectNamespaceResolver(config$3, { versionId, accountId,
|
|
|
87072
87082
|
return targetDurableObject.id;
|
|
87073
87083
|
};
|
|
87074
87084
|
}
|
|
87075
|
-
__name$
|
|
87085
|
+
__name$1(createDurableObjectNamespaceResolver, "createDurableObjectNamespaceResolver");
|
|
87076
87086
|
async function deployContainers(config$3, containerDeployments, { versionId, accountId, scriptName, dispatchNamespace, configFileName: configFileName$1, observabilityTargetPercentageField, observabilityTargetCountField }) {
|
|
87077
87087
|
const resolveNamespaceId = createDurableObjectNamespaceResolver(config$3, {
|
|
87078
87088
|
versionId,
|
|
@@ -87088,7 +87098,7 @@ async function deployContainers(config$3, containerDeployments, { versionId, acc
|
|
|
87088
87098
|
observabilityTargetCountField
|
|
87089
87099
|
}, container, config$3, accountId);
|
|
87090
87100
|
}
|
|
87091
|
-
__name$
|
|
87101
|
+
__name$1(deployContainers, "deployContainers");
|
|
87092
87102
|
async function fetchUploadedVersion(config$3, accountId, scriptName, versionId) {
|
|
87093
87103
|
for (let attempt = 0; attempt < 5; attempt++) try {
|
|
87094
87104
|
return await fetchResult$1(config$3, `/accounts/${accountId}/workers/scripts/${scriptName}/versions/${versionId}`);
|
|
@@ -87098,15 +87108,15 @@ async function fetchUploadedVersion(config$3, accountId, scriptName, versionId)
|
|
|
87098
87108
|
}
|
|
87099
87109
|
throw new Error("Unable to fetch uploaded Worker version");
|
|
87100
87110
|
}
|
|
87101
|
-
__name$
|
|
87111
|
+
__name$1(fetchUploadedVersion, "fetchUploadedVersion");
|
|
87102
87112
|
function isUploadedVersionNotReadyError(error$3) {
|
|
87103
87113
|
return error$3 instanceof Error && "code" in error$3 && error$3.code === 100146;
|
|
87104
87114
|
}
|
|
87105
|
-
__name$
|
|
87115
|
+
__name$1(isUploadedVersionNotReadyError, "isUploadedVersionNotReadyError");
|
|
87106
87116
|
async function listDurableObjects(complianceConfig, accountId) {
|
|
87107
87117
|
return await fetchPagedListResult(complianceConfig, `/accounts/${accountId}/workers/durable_objects/namespaces`, {}, new URLSearchParams({ per_page: "1000" }));
|
|
87108
87118
|
}
|
|
87109
|
-
__name$
|
|
87119
|
+
__name$1(listDurableObjects, "listDurableObjects");
|
|
87110
87120
|
function mergeDeep(target$1, source) {
|
|
87111
87121
|
if (typeof target$1 !== "object" || target$1 === null) return source;
|
|
87112
87122
|
if (typeof source !== "object" || source === null) return target$1;
|
|
@@ -87119,11 +87129,11 @@ function mergeDeep(target$1, source) {
|
|
|
87119
87129
|
}
|
|
87120
87130
|
return result;
|
|
87121
87131
|
}
|
|
87122
|
-
__name$
|
|
87132
|
+
__name$1(mergeDeep, "mergeDeep");
|
|
87123
87133
|
function isObject(value) {
|
|
87124
87134
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
87125
87135
|
}
|
|
87126
|
-
__name$
|
|
87136
|
+
__name$1(isObject, "isObject");
|
|
87127
87137
|
function createApplicationToModifyApplication(req) {
|
|
87128
87138
|
return {
|
|
87129
87139
|
configuration: req.configuration,
|
|
@@ -87135,47 +87145,47 @@ function createApplicationToModifyApplication(req) {
|
|
|
87135
87145
|
rollout_active_grace_period: req.rollout_active_grace_period
|
|
87136
87146
|
};
|
|
87137
87147
|
}
|
|
87138
|
-
__name$
|
|
87148
|
+
__name$1(createApplicationToModifyApplication, "createApplicationToModifyApplication");
|
|
87139
87149
|
function isLegacyObservabilityEnabled(observability) {
|
|
87140
87150
|
return observability?.logs?.enabled === true;
|
|
87141
87151
|
}
|
|
87142
|
-
__name$
|
|
87152
|
+
__name$1(isLegacyObservabilityEnabled, "isLegacyObservabilityEnabled");
|
|
87143
87153
|
function hasLegacyRolloutObservabilityEnabled(app) {
|
|
87144
87154
|
return isLegacyObservabilityEnabled(app?.configuration.observability) || isLegacyObservabilityEnabled(app?.scheduling_hint?.target.configuration.observability);
|
|
87145
87155
|
}
|
|
87146
|
-
__name$
|
|
87156
|
+
__name$1(hasLegacyRolloutObservabilityEnabled, "hasLegacyRolloutObservabilityEnabled");
|
|
87147
87157
|
function getLatestLegacyObservabilityState(app) {
|
|
87148
87158
|
return app?.scheduling_hint?.target.configuration.observability ?? app?.configuration.observability;
|
|
87149
87159
|
}
|
|
87150
|
-
__name$
|
|
87160
|
+
__name$1(getLatestLegacyObservabilityState, "getLatestLegacyObservabilityState");
|
|
87151
87161
|
function usesTopLevelObservability(app) {
|
|
87152
87162
|
return app?.observability !== void 0;
|
|
87153
87163
|
}
|
|
87154
|
-
__name$
|
|
87164
|
+
__name$1(usesTopLevelObservability, "usesTopLevelObservability");
|
|
87155
87165
|
function hasTopLevelOnlyObservabilityFields(observability) {
|
|
87156
87166
|
return observability.target_instance_percentage !== void 0 || observability.target_instance_count !== void 0;
|
|
87157
87167
|
}
|
|
87158
|
-
__name$
|
|
87168
|
+
__name$1(hasTopLevelOnlyObservabilityFields, "hasTopLevelOnlyObservabilityFields");
|
|
87159
87169
|
function selectObservabilityWriteTarget(prevApp) {
|
|
87160
87170
|
if (prevApp === void 0) return "top-level";
|
|
87161
87171
|
if (hasLegacyRolloutObservabilityEnabled(prevApp)) return "configuration";
|
|
87162
87172
|
return "top-level";
|
|
87163
87173
|
}
|
|
87164
|
-
__name$
|
|
87174
|
+
__name$1(selectObservabilityWriteTarget, "selectObservabilityWriteTarget");
|
|
87165
87175
|
function hasMixedEnabledObservability(app) {
|
|
87166
87176
|
return app.observability?.logs?.enabled === true && isLegacyObservabilityEnabled(app.configuration.observability);
|
|
87167
87177
|
}
|
|
87168
|
-
__name$
|
|
87178
|
+
__name$1(hasMixedEnabledObservability, "hasMixedEnabledObservability");
|
|
87169
87179
|
function requiresObservabilityMigration(app, observability) {
|
|
87170
87180
|
return hasLegacyRolloutObservabilityEnabled(app) && (app.observability?.logs?.enabled === true || usesTopLevelObservability(app) && observability.logs_enabled);
|
|
87171
87181
|
}
|
|
87172
|
-
__name$
|
|
87182
|
+
__name$1(requiresObservabilityMigration, "requiresObservabilityMigration");
|
|
87173
87183
|
function buildLegacyObservabilityMigrationPatch(app) {
|
|
87174
87184
|
const observability = app.configuration.observability;
|
|
87175
87185
|
assert(observability?.logs?.enabled === true);
|
|
87176
87186
|
return { logs: observability.logs };
|
|
87177
87187
|
}
|
|
87178
|
-
__name$
|
|
87188
|
+
__name$1(buildLegacyObservabilityMigrationPatch, "buildLegacyObservabilityMigrationPatch");
|
|
87179
87189
|
function migrateLegacyObservabilityState(app, observability) {
|
|
87180
87190
|
const configuration = { ...app.configuration };
|
|
87181
87191
|
delete configuration.observability;
|
|
@@ -87185,7 +87195,7 @@ function migrateLegacyObservabilityState(app, observability) {
|
|
|
87185
87195
|
observability
|
|
87186
87196
|
};
|
|
87187
87197
|
}
|
|
87188
|
-
__name$
|
|
87198
|
+
__name$1(migrateLegacyObservabilityState, "migrateLegacyObservabilityState");
|
|
87189
87199
|
function buildTopLevelObservability(observability) {
|
|
87190
87200
|
return stripUndefined({
|
|
87191
87201
|
logs: { enabled: observability.logs_enabled },
|
|
@@ -87193,15 +87203,15 @@ function buildTopLevelObservability(observability) {
|
|
|
87193
87203
|
target_instance_count: observability.target_instance_count
|
|
87194
87204
|
});
|
|
87195
87205
|
}
|
|
87196
|
-
__name$
|
|
87206
|
+
__name$1(buildTopLevelObservability, "buildTopLevelObservability");
|
|
87197
87207
|
function buildConfigurationObservability(observability) {
|
|
87198
87208
|
return { logs: { enabled: observability.logs_enabled } };
|
|
87199
87209
|
}
|
|
87200
|
-
__name$
|
|
87210
|
+
__name$1(buildConfigurationObservability, "buildConfigurationObservability");
|
|
87201
87211
|
function isSameApplicationObservability(left, right) {
|
|
87202
87212
|
return left?.logs?.enabled === right?.logs?.enabled && left?.target_instance_percentage === right?.target_instance_percentage && left?.target_instance_count === right?.target_instance_count;
|
|
87203
87213
|
}
|
|
87204
|
-
__name$
|
|
87214
|
+
__name$1(isSameApplicationObservability, "isSameApplicationObservability");
|
|
87205
87215
|
function buildTopLevelObservabilityPatch(observability, prevApp, writeTarget) {
|
|
87206
87216
|
if (writeTarget === "configuration" && !usesTopLevelObservability(prevApp)) return;
|
|
87207
87217
|
const shouldWriteDisabledTopLevelObservability = prevApp?.observability !== void 0 && (prevApp.observability.logs?.enabled === true || prevApp.observability.target_instance_percentage !== void 0 || prevApp.observability.target_instance_count !== void 0);
|
|
@@ -87209,14 +87219,14 @@ function buildTopLevelObservabilityPatch(observability, prevApp, writeTarget) {
|
|
|
87209
87219
|
const nextObservability = buildTopLevelObservability(observability);
|
|
87210
87220
|
return isSameApplicationObservability(nextObservability, prevApp?.observability) ? void 0 : nextObservability;
|
|
87211
87221
|
}
|
|
87212
|
-
__name$
|
|
87222
|
+
__name$1(buildTopLevelObservabilityPatch, "buildTopLevelObservabilityPatch");
|
|
87213
87223
|
function buildConfigurationObservabilityPatch(observability, prevApp) {
|
|
87214
87224
|
const latestLegacyLogsEnabled = getLatestLegacyObservabilityState(prevApp)?.logs?.enabled;
|
|
87215
87225
|
if (observability.logs_enabled === latestLegacyLogsEnabled) return;
|
|
87216
87226
|
if (!observability.logs_enabled && latestLegacyLogsEnabled === void 0) return;
|
|
87217
87227
|
return buildConfigurationObservability(observability);
|
|
87218
87228
|
}
|
|
87219
|
-
__name$
|
|
87229
|
+
__name$1(buildConfigurationObservabilityPatch, "buildConfigurationObservabilityPatch");
|
|
87220
87230
|
function buildApplicationObservabilityPatch(observability, writeTarget, prevApp) {
|
|
87221
87231
|
const nextTopLevelObservability = buildTopLevelObservabilityPatch(observability, prevApp, writeTarget);
|
|
87222
87232
|
if (writeTarget === "configuration") {
|
|
@@ -87228,13 +87238,13 @@ function buildApplicationObservabilityPatch(observability, writeTarget, prevApp)
|
|
|
87228
87238
|
}
|
|
87229
87239
|
return nextTopLevelObservability !== void 0 ? { observability: nextTopLevelObservability } : {};
|
|
87230
87240
|
}
|
|
87231
|
-
__name$
|
|
87241
|
+
__name$1(buildApplicationObservabilityPatch, "buildApplicationObservabilityPatch");
|
|
87232
87242
|
function assertCanUseApplicationObservabilityTargeting(prevApp, containerConfig, options) {
|
|
87233
87243
|
if (!hasTopLevelOnlyObservabilityFields(containerConfig.observability)) return;
|
|
87234
87244
|
if (!hasLegacyRolloutObservabilityEnabled(prevApp)) return;
|
|
87235
87245
|
throw new UserError(`Application-level observability targeting cannot be enabled for container ${containerConfig.name} while it still uses legacy rollout-based observability. Set containers[].observability.enabled = false in your ${options.configFileName} and deploy once, then deploy again with ${options.observabilityTargetPercentageField} or ${options.observabilityTargetCountField}.`, { telemetryMessage: "containers deploy observability migration blocked" });
|
|
87236
87246
|
}
|
|
87237
|
-
__name$
|
|
87247
|
+
__name$1(assertCanUseApplicationObservabilityTargeting, "assertCanUseApplicationObservabilityTargeting");
|
|
87238
87248
|
function hasRolloutDiff(prevApp, nextApp) {
|
|
87239
87249
|
const normalizedPrevApp = stripUndefined({ ...prevApp });
|
|
87240
87250
|
const normalizedNextApp = stripUndefined({ ...nextApp });
|
|
@@ -87242,7 +87252,7 @@ function hasRolloutDiff(prevApp, nextApp) {
|
|
|
87242
87252
|
delete normalizedNextApp.observability;
|
|
87243
87253
|
return JSON.stringify(sortObjectRecursive(normalizedPrevApp)) !== JSON.stringify(sortObjectRecursive(normalizedNextApp));
|
|
87244
87254
|
}
|
|
87245
|
-
__name$
|
|
87255
|
+
__name$1(hasRolloutDiff, "hasRolloutDiff");
|
|
87246
87256
|
function containerConfigToCreateRequest(accountId, containerApp, imageRef, durableObjectNamespaceId, complianceConfig, observabilityWriteTarget, prevApp) {
|
|
87247
87257
|
const { observability, configurationObservability } = buildApplicationObservabilityPatch(containerApp.observability, observabilityWriteTarget, prevApp);
|
|
87248
87258
|
return {
|
|
@@ -87269,7 +87279,7 @@ function containerConfigToCreateRequest(accountId, containerApp, imageRef, durab
|
|
|
87269
87279
|
rollout_active_grace_period: containerApp.rollout_active_grace_period
|
|
87270
87280
|
};
|
|
87271
87281
|
}
|
|
87272
|
-
__name$
|
|
87282
|
+
__name$1(containerConfigToCreateRequest, "containerConfigToCreateRequest");
|
|
87273
87283
|
function formatContainerSnippetForDisplay(container, configPath) {
|
|
87274
87284
|
const configurationForDisplay = container.configuration === void 0 ? void 0 : Object.fromEntries(Object.entries(container.configuration).map(([key, value]) => [key === "wrangler_ssh" ? "ssh" : key, value]));
|
|
87275
87285
|
return formatConfigSnippet({ containers: [{
|
|
@@ -87277,7 +87287,7 @@ function formatContainerSnippetForDisplay(container, configPath) {
|
|
|
87277
87287
|
configuration: configurationForDisplay
|
|
87278
87288
|
}] }, configPath);
|
|
87279
87289
|
}
|
|
87280
|
-
__name$
|
|
87290
|
+
__name$1(formatContainerSnippetForDisplay, "formatContainerSnippetForDisplay");
|
|
87281
87291
|
async function apply(args, containerConfig, config$3, accountId) {
|
|
87282
87292
|
if (!config$3.containers || config$3.containers.length === 0) return;
|
|
87283
87293
|
startSection("Deploy a container application", "deploy changes to your application");
|
|
@@ -87355,7 +87365,7 @@ async function apply(args, containerConfig, config$3, accountId) {
|
|
|
87355
87365
|
newline();
|
|
87356
87366
|
endSection("Applied changes");
|
|
87357
87367
|
}
|
|
87358
|
-
__name$
|
|
87368
|
+
__name$1(apply, "apply");
|
|
87359
87369
|
function mergeIfUnsafe(fullConfig, containerConfig, name) {
|
|
87360
87370
|
const unsafeContainerConfig = fullConfig.containers?.find((original) => {
|
|
87361
87371
|
return original.name === name && original.unsafe !== void 0;
|
|
@@ -87363,7 +87373,7 @@ function mergeIfUnsafe(fullConfig, containerConfig, name) {
|
|
|
87363
87373
|
if (unsafeContainerConfig) return mergeDeep(containerConfig, unsafeContainerConfig.unsafe);
|
|
87364
87374
|
else return containerConfig;
|
|
87365
87375
|
}
|
|
87366
|
-
__name$
|
|
87376
|
+
__name$1(mergeIfUnsafe, "mergeIfUnsafe");
|
|
87367
87377
|
function formatError(err) {
|
|
87368
87378
|
try {
|
|
87369
87379
|
const maybeError = JSON.parse(err.body.error);
|
|
@@ -87376,8 +87386,8 @@ function formatError(err) {
|
|
|
87376
87386
|
} catch {}
|
|
87377
87387
|
return JSON.stringify(err.body);
|
|
87378
87388
|
}
|
|
87379
|
-
__name$
|
|
87380
|
-
var doAction = /* @__PURE__ */ __name$
|
|
87389
|
+
__name$1(formatError, "formatError");
|
|
87390
|
+
var doAction = /* @__PURE__ */ __name$1(async (action) => {
|
|
87381
87391
|
if (action.action === "create") {
|
|
87382
87392
|
let application;
|
|
87383
87393
|
try {
|
|
@@ -87453,8 +87463,8 @@ function cleanApplicationFromAPI(prev, currentConfig, accountId, observabilityWr
|
|
|
87453
87463
|
}
|
|
87454
87464
|
return cleanedPreviousApp;
|
|
87455
87465
|
}
|
|
87456
|
-
__name$
|
|
87457
|
-
var configRolloutStepsToAPI = /* @__PURE__ */ __name$
|
|
87466
|
+
__name$1(cleanApplicationFromAPI, "cleanApplicationFromAPI");
|
|
87467
|
+
var configRolloutStepsToAPI = /* @__PURE__ */ __name$1((rolloutSteps) => {
|
|
87458
87468
|
if (typeof rolloutSteps === "number") return { step_percentage: rolloutSteps };
|
|
87459
87469
|
else {
|
|
87460
87470
|
const output$1 = [];
|
|
@@ -87478,16 +87488,16 @@ function getNamedContainerImageTag(className, imageName, containerBuildId) {
|
|
|
87478
87488
|
const identityHash = createHash("sha256").update(identity).digest("hex").slice(0, IMAGE_ID_HASH_LENGTH);
|
|
87479
87489
|
return getDevContainerImageName(`${`${classSlug || "container"}-${imageSlug || "image"}`.slice(0, MAX_NAMED_IMAGE_SLUG_LENGTH - identityHash.length - 1).replace(/-+$/g, "")}-${identityHash}`, containerBuildId);
|
|
87480
87490
|
}
|
|
87481
|
-
__name$
|
|
87491
|
+
__name$1(getNamedContainerImageTag, "getNamedContainerImageTag");
|
|
87482
87492
|
function getDockerRepositorySlug(value) {
|
|
87483
87493
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
87484
87494
|
}
|
|
87485
|
-
__name$
|
|
87495
|
+
__name$1(getDockerRepositorySlug, "getDockerRepositorySlug");
|
|
87486
87496
|
function requireContainerBuildId(containerBuildId) {
|
|
87487
87497
|
if (containerBuildId === void 0) throw new Error("Build ID should be set when a Container image requires preparation");
|
|
87488
87498
|
return containerBuildId;
|
|
87489
87499
|
}
|
|
87490
|
-
__name$
|
|
87500
|
+
__name$1(requireContainerBuildId, "requireContainerBuildId");
|
|
87491
87501
|
function createContainerDevPlan(options) {
|
|
87492
87502
|
const { containers, exports: exports$1, containerBuildId, configPath } = options;
|
|
87493
87503
|
if (!containers?.length) return;
|
|
@@ -87551,13 +87561,13 @@ function createContainerDevPlan(options) {
|
|
|
87551
87561
|
containerRuntimeOptions
|
|
87552
87562
|
};
|
|
87553
87563
|
}
|
|
87554
|
-
__name$
|
|
87564
|
+
__name$1(createContainerDevPlan, "createContainerDevPlan");
|
|
87555
87565
|
function createContainerDevPlanForCfConfig(options) {
|
|
87556
87566
|
return createContainerPlanForCfConfig({
|
|
87557
87567
|
containers: options.containers,
|
|
87558
87568
|
exports: options.exports,
|
|
87559
87569
|
containerDescription: "Container",
|
|
87560
|
-
createImagePlan: /* @__PURE__ */ __name$
|
|
87570
|
+
createImagePlan: /* @__PURE__ */ __name$1(({ image, className, imageName }) => {
|
|
87561
87571
|
const buildId = requireContainerBuildId(options.containerBuildId);
|
|
87562
87572
|
const imageTag = imageName === void 0 ? getDevContainerImageName(className, buildId) : getNamedContainerImageTag(className, imageName, buildId);
|
|
87563
87573
|
const resolvedImage = resolveInputContainerImage({
|
|
@@ -87584,13 +87594,13 @@ function createContainerDevPlanForCfConfig(options) {
|
|
|
87584
87594
|
}, "createImagePlan")
|
|
87585
87595
|
});
|
|
87586
87596
|
}
|
|
87587
|
-
__name$
|
|
87597
|
+
__name$1(createContainerDevPlanForCfConfig, "createContainerDevPlanForCfConfig");
|
|
87588
87598
|
function createContainerPreviewPlanForCfConfig(options) {
|
|
87589
87599
|
return createContainerPlanForCfConfig({
|
|
87590
87600
|
containers: options.containers,
|
|
87591
87601
|
exports: options.exports,
|
|
87592
87602
|
containerDescription: "Build Output Container",
|
|
87593
|
-
createImagePlan: /* @__PURE__ */ __name$
|
|
87603
|
+
createImagePlan: /* @__PURE__ */ __name$1(({ image, className, imageName }) => {
|
|
87594
87604
|
const reference = "reference" in image ? image.reference : image.localReference;
|
|
87595
87605
|
if (!("reference" in image)) return { reference };
|
|
87596
87606
|
return {
|
|
@@ -87605,7 +87615,7 @@ function createContainerPreviewPlanForCfConfig(options) {
|
|
|
87605
87615
|
}, "createImagePlan")
|
|
87606
87616
|
});
|
|
87607
87617
|
}
|
|
87608
|
-
__name$
|
|
87618
|
+
__name$1(createContainerPreviewPlanForCfConfig, "createContainerPreviewPlanForCfConfig");
|
|
87609
87619
|
function createMiniflareExports(options) {
|
|
87610
87620
|
const workerExports = {};
|
|
87611
87621
|
for (const [name, workerExport] of Object.entries(options.exports ?? {})) if (workerExport.type === "durable-object" && "storage" in workerExport) {
|
|
@@ -87619,7 +87629,7 @@ function createMiniflareExports(options) {
|
|
|
87619
87629
|
} else workerExports[name] = workerExport;
|
|
87620
87630
|
return workerExports;
|
|
87621
87631
|
}
|
|
87622
|
-
__name$
|
|
87632
|
+
__name$1(createMiniflareExports, "createMiniflareExports");
|
|
87623
87633
|
function createContainerPlanForCfConfig(options) {
|
|
87624
87634
|
const containersByName = indexContainersByName(options.containers);
|
|
87625
87635
|
const containerOptions = [];
|
|
@@ -87655,7 +87665,7 @@ function createContainerPlanForCfConfig(options) {
|
|
|
87655
87665
|
containerRuntimeOptions
|
|
87656
87666
|
};
|
|
87657
87667
|
}
|
|
87658
|
-
__name$
|
|
87668
|
+
__name$1(createContainerPlanForCfConfig, "createContainerPlanForCfConfig");
|
|
87659
87669
|
function getContainerLinks(exports$1) {
|
|
87660
87670
|
const links = [];
|
|
87661
87671
|
for (const [className, workerExport] of Object.entries(exports$1 ?? {})) {
|
|
@@ -87664,7 +87674,7 @@ function getContainerLinks(exports$1) {
|
|
|
87664
87674
|
}
|
|
87665
87675
|
return links;
|
|
87666
87676
|
}
|
|
87667
|
-
__name$
|
|
87677
|
+
__name$1(getContainerLinks, "getContainerLinks");
|
|
87668
87678
|
function indexContainersByName(containers) {
|
|
87669
87679
|
const containersByName = /* @__PURE__ */ new Map();
|
|
87670
87680
|
for (const container of containers) {
|
|
@@ -87673,7 +87683,7 @@ function indexContainersByName(containers) {
|
|
|
87673
87683
|
}
|
|
87674
87684
|
return containersByName;
|
|
87675
87685
|
}
|
|
87676
|
-
__name$
|
|
87686
|
+
__name$1(indexContainersByName, "indexContainersByName");
|
|
87677
87687
|
__toESM(require_stream());
|
|
87678
87688
|
__toESM(require_extension());
|
|
87679
87689
|
__toESM(require_permessage_deflate());
|
|
@@ -87753,7 +87763,7 @@ async function sshCommand(sshArgs, userAgent) {
|
|
|
87753
87763
|
else ws.close();
|
|
87754
87764
|
}
|
|
87755
87765
|
}
|
|
87756
|
-
__name$
|
|
87766
|
+
__name$1(sshCommand, "sshCommand");
|
|
87757
87767
|
function verifySshInstalled(sshPath) {
|
|
87758
87768
|
return new Promise((resolve2, reject) => {
|
|
87759
87769
|
const child = spawn(sshPath, ["-V"]);
|
|
@@ -87773,7 +87783,7 @@ function verifySshInstalled(sshPath) {
|
|
|
87773
87783
|
});
|
|
87774
87784
|
});
|
|
87775
87785
|
}
|
|
87776
|
-
__name$
|
|
87786
|
+
__name$1(verifySshInstalled, "verifySshInstalled");
|
|
87777
87787
|
function tcpProxy(ws) {
|
|
87778
87788
|
let inbound;
|
|
87779
87789
|
const pending = [];
|
|
@@ -87788,7 +87798,7 @@ function tcpProxy(ws) {
|
|
|
87788
87798
|
ws.close();
|
|
87789
87799
|
proxy.close();
|
|
87790
87800
|
});
|
|
87791
|
-
const start = /* @__PURE__ */ __name$
|
|
87801
|
+
const start = /* @__PURE__ */ __name$1(() => socket.on("data", (data$1) => ws.send(data$1)), "start");
|
|
87792
87802
|
if (ws.readyState === import_websocket.default.OPEN) start();
|
|
87793
87803
|
else if (ws.readyState === import_websocket.default.CONNECTING) ws.once("open", start);
|
|
87794
87804
|
else socket.end();
|
|
@@ -87811,16 +87821,16 @@ function tcpProxy(ws) {
|
|
|
87811
87821
|
});
|
|
87812
87822
|
return proxy;
|
|
87813
87823
|
}
|
|
87814
|
-
__name$
|
|
87824
|
+
__name$1(tcpProxy, "tcpProxy");
|
|
87815
87825
|
function stdioProxy(ws) {
|
|
87816
87826
|
return new Promise((resolve2, reject) => {
|
|
87817
|
-
const onData = /* @__PURE__ */ __name$
|
|
87818
|
-
const onEnd = /* @__PURE__ */ __name$
|
|
87819
|
-
const onError$1 = /* @__PURE__ */ __name$
|
|
87827
|
+
const onData = /* @__PURE__ */ __name$1((data$1) => ws.send(data$1), "onData");
|
|
87828
|
+
const onEnd = /* @__PURE__ */ __name$1(() => ws.close(), "onEnd");
|
|
87829
|
+
const onError$1 = /* @__PURE__ */ __name$1((err) => {
|
|
87820
87830
|
ws.close();
|
|
87821
87831
|
reject(err);
|
|
87822
87832
|
}, "onError");
|
|
87823
|
-
const cleanup = /* @__PURE__ */ __name$
|
|
87833
|
+
const cleanup = /* @__PURE__ */ __name$1(() => {
|
|
87824
87834
|
process.stdin.pause();
|
|
87825
87835
|
process.stdin.off("data", onData);
|
|
87826
87836
|
process.stdin.off("end", onEnd);
|
|
@@ -87845,16 +87855,16 @@ function stdioProxy(ws) {
|
|
|
87845
87855
|
});
|
|
87846
87856
|
});
|
|
87847
87857
|
}
|
|
87848
|
-
__name$
|
|
87858
|
+
__name$1(stdioProxy, "stdioProxy");
|
|
87849
87859
|
function formatWebSocketData(data$1) {
|
|
87850
87860
|
if (Array.isArray(data$1)) return Buffer.concat(data$1);
|
|
87851
87861
|
return data$1 instanceof ArrayBuffer ? new Uint8Array(data$1) : data$1;
|
|
87852
87862
|
}
|
|
87853
|
-
__name$
|
|
87863
|
+
__name$1(formatWebSocketData, "formatWebSocketData");
|
|
87854
87864
|
function shouldUseStdio(sshArgs) {
|
|
87855
87865
|
return sshArgs.stdio === true || sshArgs.tty !== true && process.stdin.isTTY !== true && process.stdout.isTTY !== true;
|
|
87856
87866
|
}
|
|
87857
|
-
__name$
|
|
87867
|
+
__name$1(shouldUseStdio, "shouldUseStdio");
|
|
87858
87868
|
function buildContainerSshArgs(sshArgs) {
|
|
87859
87869
|
const flags = [
|
|
87860
87870
|
"-o",
|
|
@@ -87880,7 +87890,7 @@ function buildContainerSshArgs(sshArgs) {
|
|
|
87880
87890
|
if (sshArgs.tag !== void 0) flags.push("-P", sshArgs.tag);
|
|
87881
87891
|
return flags;
|
|
87882
87892
|
}
|
|
87883
|
-
__name$
|
|
87893
|
+
__name$1(buildContainerSshArgs, "buildContainerSshArgs");
|
|
87884
87894
|
var MAX_REPOSITORY_LENGTH = 255;
|
|
87885
87895
|
var REPOSITORY_COMPONENT_REGEXP = /^[a-z0-9]+(?:(?:[._]|__|-+)[a-z0-9]+)*$/;
|
|
87886
87896
|
var TAG_REGEXP = /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$/;
|
|
@@ -87900,7 +87910,7 @@ async function listContainerImages({ accountId, complianceConfig, filter }) {
|
|
|
87900
87910
|
}];
|
|
87901
87911
|
});
|
|
87902
87912
|
}
|
|
87903
|
-
__name$
|
|
87913
|
+
__name$1(listContainerImages, "listContainerImages");
|
|
87904
87914
|
function parseContainerImageTag(image) {
|
|
87905
87915
|
const parts = image.split(":");
|
|
87906
87916
|
const [repository, tag] = parts;
|
|
@@ -87910,7 +87920,7 @@ function parseContainerImageTag(image) {
|
|
|
87910
87920
|
tag
|
|
87911
87921
|
};
|
|
87912
87922
|
}
|
|
87913
|
-
__name$
|
|
87923
|
+
__name$1(parseContainerImageTag, "parseContainerImageTag");
|
|
87914
87924
|
async function deleteContainerImage({ accountId, complianceConfig, image }) {
|
|
87915
87925
|
const { repository, tag } = parseContainerImageTag(image);
|
|
87916
87926
|
const creds = await getCreds(["pull", "push"], complianceConfig);
|
|
@@ -87934,7 +87944,7 @@ async function deleteContainerImage({ accountId, complianceConfig, image }) {
|
|
|
87934
87944
|
}
|
|
87935
87945
|
return { digest };
|
|
87936
87946
|
}
|
|
87937
|
-
__name$
|
|
87947
|
+
__name$1(deleteContainerImage, "deleteContainerImage");
|
|
87938
87948
|
async function listReposWithTags(creds, complianceConfig) {
|
|
87939
87949
|
const url$2 = new URL(`https://${getCloudflareContainerRegistry(complianceConfig)}`);
|
|
87940
87950
|
const catalogUrl = `${url$2.protocol}//${url$2.host}/v2/_catalog?tags=true`;
|
|
@@ -87963,7 +87973,7 @@ async function listReposWithTags(creds, complianceConfig) {
|
|
|
87963
87973
|
}
|
|
87964
87974
|
return Object.fromEntries([...repositories].map(([repository, tags]) => [repository, [...tags]]));
|
|
87965
87975
|
}
|
|
87966
|
-
__name$
|
|
87976
|
+
__name$1(listReposWithTags, "listReposWithTags");
|
|
87967
87977
|
function nextCatalogCursor(header, baseUrl) {
|
|
87968
87978
|
if (!header) return;
|
|
87969
87979
|
const links = header.matchAll(/(?:^|,)\s*(?:<([^>]+)>|([^;,\s]+))((?:;[^,]*)?)/g);
|
|
@@ -87977,7 +87987,7 @@ function nextCatalogCursor(header, baseUrl) {
|
|
|
87977
87987
|
return cursor$1;
|
|
87978
87988
|
}
|
|
87979
87989
|
}
|
|
87980
|
-
__name$
|
|
87990
|
+
__name$1(nextCatalogCursor, "nextCatalogCursor");
|
|
87981
87991
|
async function deleteTag(baseUrl, accountId, image, tag, creds) {
|
|
87982
87992
|
const manifestAcceptHeader = "application/vnd.oci.image.manifest.v1+json, application/vnd.docker.distribution.manifest.v2+json";
|
|
87983
87993
|
const manifestUrl = `${baseUrl}/v2/${accountId}/${image}/manifests/${tag}`;
|
|
@@ -88002,7 +88012,7 @@ async function deleteTag(baseUrl, accountId, image, tag, creds) {
|
|
|
88002
88012
|
if (!deleteResponse.ok) throw new Error(`Failed to delete ${image}:${tag} (digest: ${digest}): ${deleteResponse.status} ${deleteResponse.statusText}`);
|
|
88003
88013
|
return digest;
|
|
88004
88014
|
}
|
|
88005
|
-
__name$
|
|
88015
|
+
__name$1(deleteTag, "deleteTag");
|
|
88006
88016
|
async function getCreds(permissions, complianceConfig) {
|
|
88007
88017
|
const credentials = await ImageRegistriesService.generateImageRegistryCredentials(getCloudflareContainerRegistry(complianceConfig), {
|
|
88008
88018
|
expiration_minutes: 5,
|
|
@@ -88010,11 +88020,11 @@ async function getCreds(permissions, complianceConfig) {
|
|
|
88010
88020
|
});
|
|
88011
88021
|
return Buffer.from(`v1:${credentials.password}`).toString("base64");
|
|
88012
88022
|
}
|
|
88013
|
-
__name$
|
|
88023
|
+
__name$1(getCreds, "getCreds");
|
|
88014
88024
|
function isValidImageTag(value) {
|
|
88015
88025
|
return IMAGE_TAG_REGEXP.test(value);
|
|
88016
88026
|
}
|
|
88017
|
-
__name$
|
|
88027
|
+
__name$1(isValidImageTag, "isValidImageTag");
|
|
88018
88028
|
|
|
88019
88029
|
//#endregion
|
|
88020
88030
|
//#region src/build.ts
|
|
@@ -88823,133 +88833,6 @@ async function prepareContainerImagesForVite(options) {
|
|
|
88823
88833
|
});
|
|
88824
88834
|
}
|
|
88825
88835
|
|
|
88826
|
-
//#endregion
|
|
88827
|
-
//#region ../workers-auth/dist/wrangler/index.mjs
|
|
88828
|
-
createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
|
|
88829
|
-
var DefaultScopes = {
|
|
88830
|
-
"k2.read": "See K2 stream configurations and bind existing streams to Workers.",
|
|
88831
|
-
"k2.write": "Create and manage K2 stream configurations.",
|
|
88832
|
-
"account:read": "See your account info such as account details, analytics, and memberships.",
|
|
88833
|
-
"user:read": "See your user info such as name, email address, and account memberships.",
|
|
88834
|
-
"workers:write": "See and change Cloudflare Workers data such as zones, KV storage, namespaces, scripts, and routes.",
|
|
88835
|
-
"workers_kv:write": "See and change Cloudflare Workers KV Storage data such as keys and namespaces.",
|
|
88836
|
-
"workers_routes:write": "See and change Cloudflare Workers data such as filters and routes.",
|
|
88837
|
-
"workers_scripts:write": "See and change Cloudflare Workers scripts, durable objects, subdomains, triggers, and tail data.",
|
|
88838
|
-
"workers_tail:read": "See Cloudflare Workers tail and script data.",
|
|
88839
|
-
"d1:write": "See and change D1 Databases.",
|
|
88840
|
-
"pages:write": "See and change Cloudflare Pages projects, settings and deployments.",
|
|
88841
|
-
"zone:read": "Grants read level access to account zone.",
|
|
88842
|
-
"ssl_certs:write": "See and manage mTLS certificates for your account",
|
|
88843
|
-
"ai:write": "See and change Workers AI catalog and assets",
|
|
88844
|
-
"ai-search:write": "See and change AI Search data",
|
|
88845
|
-
"ai-search:run": "Run search queries on your AI Search instances",
|
|
88846
|
-
"agent-memory:write": "See and change Agent Memory data such as keys and namespaces.",
|
|
88847
|
-
"queues:write": "See and change Cloudflare Queues settings and data",
|
|
88848
|
-
"pipelines:write": "See and change Cloudflare Pipelines configurations and data",
|
|
88849
|
-
"secrets_store:write": "See and change secrets + stores within the Secrets Store",
|
|
88850
|
-
"artifacts:write": "See and change Cloudflare Artifacts data such as registries and artifacts",
|
|
88851
|
-
"flagship:write": "See and change Flagship feature flags and apps",
|
|
88852
|
-
"containers:write": "Manage Workers Containers",
|
|
88853
|
-
"cloudchamber:write": "Manage Cloudchamber",
|
|
88854
|
-
"connectivity:admin": "See, change, and bind to Connectivity Directory services, including creating services targeting Cloudflare Tunnel.",
|
|
88855
|
-
"email_routing:write": "See and change Email Routing settings, rules, and destination addresses.",
|
|
88856
|
-
"email_sending:write": "See and change Email Sending settings and configuration.",
|
|
88857
|
-
"browser:write": "See and manage Browser Run sessions",
|
|
88858
|
-
"challenge-widgets.write": "See and change Turnstile widgets"
|
|
88859
|
-
};
|
|
88860
|
-
var DefaultScopeKeys = Object.keys(DefaultScopes);
|
|
88861
|
-
function setLoginScopeKeys(scopes) {
|
|
88862
|
-
DefaultScopeKeys = scopes;
|
|
88863
|
-
}
|
|
88864
|
-
__name$1(setLoginScopeKeys, "setLoginScopeKeys");
|
|
88865
|
-
function validateScopeKeys(scopes) {
|
|
88866
|
-
return scopes.every((scope) => scope in DefaultScopes);
|
|
88867
|
-
}
|
|
88868
|
-
__name$1(validateScopeKeys, "validateScopeKeys");
|
|
88869
|
-
var WRANGLER_KEYRING_SERVICE_NAME = "wrangler";
|
|
88870
|
-
var WRANGLER_CLI_NAME = "wrangler";
|
|
88871
|
-
var WRANGLER_DISPLAY_NAME = "Wrangler";
|
|
88872
|
-
var OAUTH_CALLBACK_URL = "http://localhost:8976/oauth/callback";
|
|
88873
|
-
var WRANGLER_CONSENT_PAGES = {
|
|
88874
|
-
granted: { url: "https://welcome.developers.workers.dev/wrangler-oauth-consent-granted" },
|
|
88875
|
-
denied: {
|
|
88876
|
-
url: "https://welcome.developers.workers.dev/wrangler-oauth-consent-denied",
|
|
88877
|
-
error: "Error: Consent denied. You must grant consent to Wrangler in order to login.\nIf you don't want to do this consider passing an API token via the `CLOUDFLARE_API_TOKEN` environment variable"
|
|
88878
|
-
}
|
|
88879
|
-
};
|
|
88880
|
-
var getClientIdFromEnv = getEnvironmentVariableFactory({
|
|
88881
|
-
variableName: "WRANGLER_CLIENT_ID",
|
|
88882
|
-
defaultValue: /* @__PURE__ */ __name$1(() => getCloudflareApiEnvironmentFromEnv() === "staging" ? "4b2ea6cc-9421-4761-874b-ce550e0e3def" : "54d11594-84e4-41aa-b438-e81b8fa78ee7", "defaultValue")
|
|
88883
|
-
});
|
|
88884
|
-
function getTemporaryAccountConfigFile() {
|
|
88885
|
-
const environment = getCloudflareApiEnvironmentFromEnv();
|
|
88886
|
-
return environment === "production" ? "wrangler-temporary-account.toml" : `wrangler-temporary-account.${environment}.toml`;
|
|
88887
|
-
}
|
|
88888
|
-
__name$1(getTemporaryAccountConfigFile, "getTemporaryAccountConfigFile");
|
|
88889
|
-
function getTemporaryPreviewAccountConfigPath() {
|
|
88890
|
-
return path__default.join(getGlobalConfigPath(), getTemporaryAccountConfigFile());
|
|
88891
|
-
}
|
|
88892
|
-
__name$1(getTemporaryPreviewAccountConfigPath, "getTemporaryPreviewAccountConfigPath");
|
|
88893
|
-
function createTomlFileStorage(getPath) {
|
|
88894
|
-
return createFileStorage("toml", getPath);
|
|
88895
|
-
}
|
|
88896
|
-
__name$1(createTomlFileStorage, "createTomlFileStorage");
|
|
88897
|
-
var { getAuthConfigFilePath, getEncryptedAuthConfigFilePath, defaultAuthConfigStorage, readAuthConfigFile, writeAuthConfigFile } = createAuthConfigFileHelpers({
|
|
88898
|
-
getConfigPath: getGlobalConfigPath,
|
|
88899
|
-
format: "toml"
|
|
88900
|
-
});
|
|
88901
|
-
var WRANGLER_CLI = {
|
|
88902
|
-
cliName: WRANGLER_CLI_NAME,
|
|
88903
|
-
displayName: WRANGLER_DISPLAY_NAME,
|
|
88904
|
-
temporaryAccountFlag: "--temporary",
|
|
88905
|
-
commands: {
|
|
88906
|
-
login: "wrangler login",
|
|
88907
|
-
logout: "wrangler logout",
|
|
88908
|
-
whoami: "wrangler whoami",
|
|
88909
|
-
createProfile: "wrangler auth create",
|
|
88910
|
-
deviceLogin: "wrangler login --device"
|
|
88911
|
-
},
|
|
88912
|
-
keyringServiceName: WRANGLER_KEYRING_SERVICE_NAME,
|
|
88913
|
-
clientId: getClientIdFromEnv,
|
|
88914
|
-
consent: WRANGLER_CONSENT_PAGES,
|
|
88915
|
-
redirectUri: OAUTH_CALLBACK_URL,
|
|
88916
|
-
allowGlobalAuthKey: true,
|
|
88917
|
-
getConfigPath: getGlobalConfigPath,
|
|
88918
|
-
getTemporaryAccountConfigPath: getTemporaryPreviewAccountConfigPath,
|
|
88919
|
-
fileFormat: "toml",
|
|
88920
|
-
persistAccountSelection: true,
|
|
88921
|
-
accountCachePrefix: "wrangler-account",
|
|
88922
|
-
getConfigFileLabel: /* @__PURE__ */ __name$1(() => configFileName(void 0), "getConfigFileLabel"),
|
|
88923
|
-
getDefaultScopeKeys: /* @__PURE__ */ __name$1(() => DefaultScopeKeys, "getDefaultScopeKeys")
|
|
88924
|
-
};
|
|
88925
|
-
var wranglerPreferences = createPreferences(getGlobalConfigPath);
|
|
88926
|
-
var { readUserPreferences, updateUserPreferences } = wranglerPreferences;
|
|
88927
|
-
function createWranglerAuth(ctx) {
|
|
88928
|
-
return createCloudflareAuth(WRANGLER_CLI, ctx);
|
|
88929
|
-
}
|
|
88930
|
-
__name$1(createWranglerAuth, "createWranglerAuth");
|
|
88931
|
-
function createWranglerProfileStore(ctx) {
|
|
88932
|
-
return createCloudflareProfileStore({
|
|
88933
|
-
logger: ctx.logger,
|
|
88934
|
-
getConfigPath: getGlobalConfigPath,
|
|
88935
|
-
keyringServiceName: WRANGLER_KEYRING_SERVICE_NAME,
|
|
88936
|
-
format: "toml"
|
|
88937
|
-
});
|
|
88938
|
-
}
|
|
88939
|
-
__name$1(createWranglerProfileStore, "createWranglerProfileStore");
|
|
88940
|
-
var wranglerKeyringPreference = createKeyringPreference({
|
|
88941
|
-
loginCommand: WRANGLER_CLI.commands.login,
|
|
88942
|
-
createProfileCommand: WRANGLER_CLI.commands.createProfile,
|
|
88943
|
-
keyringServiceName: WRANGLER_KEYRING_SERVICE_NAME,
|
|
88944
|
-
getConfigPath: getGlobalConfigPath,
|
|
88945
|
-
format: "toml",
|
|
88946
|
-
preferences: wranglerPreferences
|
|
88947
|
-
});
|
|
88948
|
-
function setKeyringPreference(enabled, ctx) {
|
|
88949
|
-
return wranglerKeyringPreference.setKeyringPreference(enabled, ctx);
|
|
88950
|
-
}
|
|
88951
|
-
__name$1(setKeyringPreference, "setKeyringPreference");
|
|
88952
|
-
|
|
88953
88836
|
//#endregion
|
|
88954
88837
|
//#region ../deploy-helpers/dist/chunk-U6NEESU5.mjs
|
|
88955
88838
|
const require$1 = createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
|
|
@@ -89644,67 +89527,6 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
|
|
|
89644
89527
|
//#endregion
|
|
89645
89528
|
//#region ../remote-bindings/dist/index.mjs
|
|
89646
89529
|
var import_undici = require_undici();
|
|
89647
|
-
var version$1 = "0.0.63";
|
|
89648
|
-
var NoDefaultValueProvided = class extends UserError {
|
|
89649
|
-
constructor() {
|
|
89650
|
-
super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
|
|
89651
|
-
}
|
|
89652
|
-
};
|
|
89653
|
-
function createRemoteBindingsAuth(logger$1$1) {
|
|
89654
|
-
const context = {
|
|
89655
|
-
logger: logger$1$1,
|
|
89656
|
-
userAgent: `remote-bindings/${version$1}`,
|
|
89657
|
-
async prompt(question) {
|
|
89658
|
-
if (isNonInteractiveOrCI()) throw new NoDefaultValueProvided();
|
|
89659
|
-
return inputPrompt({
|
|
89660
|
-
type: "text",
|
|
89661
|
-
question,
|
|
89662
|
-
label: "Answer",
|
|
89663
|
-
throwOnError: true
|
|
89664
|
-
});
|
|
89665
|
-
},
|
|
89666
|
-
async select(question, options) {
|
|
89667
|
-
if (isNonInteractiveOrCI()) throw new NoDefaultValueProvided();
|
|
89668
|
-
return inputPrompt({
|
|
89669
|
-
type: "select",
|
|
89670
|
-
question,
|
|
89671
|
-
label: "Account",
|
|
89672
|
-
options: options.choices.map((choice) => ({
|
|
89673
|
-
label: choice.title,
|
|
89674
|
-
value: choice.value
|
|
89675
|
-
})),
|
|
89676
|
-
throwOnError: true
|
|
89677
|
-
});
|
|
89678
|
-
},
|
|
89679
|
-
isNoDefaultValueProvidedError: (error$3) => error$3 instanceof NoDefaultValueProvided
|
|
89680
|
-
};
|
|
89681
|
-
const useCfAuth = "CLOUDFLARE_CF_AUTH" in process.env;
|
|
89682
|
-
return {
|
|
89683
|
-
auth: useCfAuth ? createCfAuth(context) : createWranglerAuth(context),
|
|
89684
|
-
useCfAuth
|
|
89685
|
-
};
|
|
89686
|
-
}
|
|
89687
|
-
function getRemoteBindingsAuthHook(auth, accountId, profileDir, logger$1$1) {
|
|
89688
|
-
if (auth) return auth;
|
|
89689
|
-
const { auth: remoteBindingsAuth, useCfAuth } = createRemoteBindingsAuth(logger$1$1);
|
|
89690
|
-
const profile = (useCfAuth ? createCfProfileStore({ logger: logger$1$1 }) : createWranglerProfileStore({ logger: logger$1$1 })).resolve({ cwd: profileDir ?? process.cwd() });
|
|
89691
|
-
remoteBindingsAuth.setProfile(profile);
|
|
89692
|
-
return async () => ({
|
|
89693
|
-
accountId: await remoteBindingsAuth.requireAuth(accountId ? { account_id: accountId } : {}),
|
|
89694
|
-
apiToken: remoteBindingsAuth.requireApiToken()
|
|
89695
|
-
});
|
|
89696
|
-
}
|
|
89697
|
-
/**
|
|
89698
|
-
* Warns before native-config development accesses deployed data by default.
|
|
89699
|
-
* Explicit remote settings and sessions with remote bindings disabled are silent.
|
|
89700
|
-
*/
|
|
89701
|
-
function warnForDefaultRemoteBindings(bindings, remoteBindingsEnabled, warn) {
|
|
89702
|
-
for (const [name, binding] of Object.entries(bindings)) if (getBindingLocalSupport(binding.type) === "remote-default-with-local-opt-in") validateBindingRemoteSetting(binding.type, "remote" in binding ? binding.remote : void 0, warn, {
|
|
89703
|
-
binding: name,
|
|
89704
|
-
remoteBindingsDisabled: !remoteBindingsEnabled,
|
|
89705
|
-
configFormat: "cloudflare-config"
|
|
89706
|
-
});
|
|
89707
|
-
}
|
|
89708
89530
|
/**
|
|
89709
89531
|
* Convert native config bindings to the transport shape consumed by the
|
|
89710
89532
|
* remote-bindings session API. Local-only bindings are intentionally omitted.
|
|
@@ -90129,6 +89951,7 @@ var ProxyControllerLogger = class extends Log {
|
|
|
90129
89951
|
super.log(message);
|
|
90130
89952
|
}
|
|
90131
89953
|
};
|
|
89954
|
+
var version$1 = "0.0.65";
|
|
90132
89955
|
const TRACE_VERSION = "trace-v1";
|
|
90133
89956
|
/**
|
|
90134
89957
|
* Maximum time (ms) to wait for an individual preview API request before
|
|
@@ -90261,6 +90084,21 @@ function isAbortError(err) {
|
|
|
90261
90084
|
const abortErrorCheck = err instanceof Error && err.name == "AbortError";
|
|
90262
90085
|
return legacyAbortErroCheck || abortErrorCheck;
|
|
90263
90086
|
}
|
|
90087
|
+
/** The commands each CLI accepts, named in actionable error messages. */
|
|
90088
|
+
const CLI_COMMANDS = {
|
|
90089
|
+
Wrangler: {
|
|
90090
|
+
whoami: "wrangler whoami",
|
|
90091
|
+
login: "wrangler login",
|
|
90092
|
+
logout: "wrangler logout",
|
|
90093
|
+
createFlagshipApp: "wrangler flagship apps create"
|
|
90094
|
+
},
|
|
90095
|
+
cf: {
|
|
90096
|
+
whoami: "cf auth whoami",
|
|
90097
|
+
login: "cf auth login",
|
|
90098
|
+
logout: "cf auth logout",
|
|
90099
|
+
createFlagshipApp: "cf flagship apps create"
|
|
90100
|
+
}
|
|
90101
|
+
};
|
|
90264
90102
|
/**
|
|
90265
90103
|
* Error thrown when a remote dev session fails due to an authentication
|
|
90266
90104
|
* problem. The error message is a user-friendly description with actionable
|
|
@@ -90275,36 +90113,41 @@ var RemoteSessionAuthenticationError = class extends UserError {
|
|
|
90275
90113
|
/**
|
|
90276
90114
|
* @param cause - The original error that triggered the authentication
|
|
90277
90115
|
* failure (e.g. an {@link APIError} with code 9106, 10000, or 10405).
|
|
90116
|
+
* @param cliDisplayName - The CLI whose commands the guidance names.
|
|
90278
90117
|
*/
|
|
90279
|
-
constructor(cause) {
|
|
90118
|
+
constructor(cause, cliDisplayName) {
|
|
90280
90119
|
const envAuth = getAuthFromEnv();
|
|
90120
|
+
const { whoami, login, logout } = CLI_COMMANDS[cliDisplayName];
|
|
90281
90121
|
let errorMessage = "This Worker uses bindings that need to run remotely, even when developing locally, but the remote session could not be authenticated.\n";
|
|
90282
90122
|
if (envAuth !== void 0) {
|
|
90283
90123
|
const method = "apiToken" in envAuth ? "a custom API token (`CLOUDFLARE_API_TOKEN`)" : "a Global API Key (`CLOUDFLARE_API_KEY`)";
|
|
90284
90124
|
errorMessage += `It looks like you are authenticating via ${method} set in an environment variable.\nThe token may be invalid or lack the required permissions for this operation.
|
|
90285
90125
|
|
|
90286
90126
|
To fix this, verify that your token is valid and has the correct permissions.
|
|
90287
|
-
You can also run
|
|
90288
|
-
} else errorMessage +=
|
|
90127
|
+
You can also run \`${whoami}\` to check your current authentication status.`;
|
|
90128
|
+
} else errorMessage += `Your credentials may have expired or been revoked.
|
|
90129
|
+
|
|
90130
|
+
To fix this, try to:
|
|
90131
|
+
- Run \`${whoami}\` to check your current authentication status.\n - Run \`${logout}\` and then \`${login}\` to re-authenticate.`;
|
|
90289
90132
|
super(errorMessage, {
|
|
90290
90133
|
cause,
|
|
90291
90134
|
telemetryMessage: "remote dev authentication error"
|
|
90292
90135
|
});
|
|
90293
90136
|
}
|
|
90294
90137
|
};
|
|
90295
|
-
function handlePreviewSessionUploadError(err, accountId) {
|
|
90138
|
+
function handlePreviewSessionUploadError(err, accountId, cliDisplayName) {
|
|
90296
90139
|
assert(err && typeof err === "object");
|
|
90297
90140
|
if (!isAbortError(err)) {
|
|
90298
90141
|
if ("code" in err && err.code === 10049) {
|
|
90299
90142
|
logger.log("Preview token expired, fetching a new one");
|
|
90300
90143
|
return true;
|
|
90301
|
-
} else if (!handleUserFriendlyError(err, accountId)) logger.error("Error on remote worker:", err);
|
|
90144
|
+
} else if (!handleUserFriendlyError(err, cliDisplayName, accountId)) logger.error("Error on remote worker:", err);
|
|
90302
90145
|
}
|
|
90303
90146
|
return false;
|
|
90304
90147
|
}
|
|
90305
|
-
function handlePreviewSessionCreationError(err, accountId) {
|
|
90148
|
+
function handlePreviewSessionCreationError(err, accountId, cliDisplayName) {
|
|
90306
90149
|
assert(err && typeof err === "object");
|
|
90307
|
-
if (handleUserFriendlyError(err, accountId)) return;
|
|
90150
|
+
if (handleUserFriendlyError(err, cliDisplayName, accountId)) return;
|
|
90308
90151
|
if ("cause" in err && err.cause?.code === "ENOTFOUND") logger.error(`Could not access \`${err.cause.hostname}\`. Make sure the domain is set up to be proxied by Cloudflare.\nFor more details, refer to https://developers.cloudflare.com/workers/configuration/routing/routes/#set-up-a-route`);
|
|
90309
90152
|
else if (err instanceof UserError) logger.error(err.message);
|
|
90310
90153
|
else if (!isAbortError(err)) logger.error("Error while creating remote dev session:", err);
|
|
@@ -90348,11 +90191,11 @@ function createRemoteWorkerInit(props) {
|
|
|
90348
90191
|
* messages, does not perform any logic other than logging errors.
|
|
90349
90192
|
* @returns if the error was handled or not
|
|
90350
90193
|
*/
|
|
90351
|
-
function handleUserFriendlyError(error$3, accountId) {
|
|
90194
|
+
function handleUserFriendlyError(error$3, cliDisplayName, accountId) {
|
|
90352
90195
|
if (error$3 instanceof APIError) switch (error$3.code) {
|
|
90353
90196
|
case 9106:
|
|
90354
90197
|
case 1e4:
|
|
90355
|
-
case 10405: throw new RemoteSessionAuthenticationError(error$3);
|
|
90198
|
+
case 10405: throw new RemoteSessionAuthenticationError(error$3, cliDisplayName);
|
|
90356
90199
|
case 10063: {
|
|
90357
90200
|
const onboardingLink = accountId ? `https://dash.cloudflare.com/${accountId}/workers/onboarding` : "https://dash.cloudflare.com/?to=/:account/workers/onboarding";
|
|
90358
90201
|
logger.error(`You need to register a workers.dev subdomain before running the dev command in remote mode. You can either enable local mode by pressing l, or register a workers.dev subdomain here: ${onboardingLink}`);
|
|
@@ -90386,7 +90229,7 @@ var RemoteRuntimeController = class {
|
|
|
90386
90229
|
return session;
|
|
90387
90230
|
} catch (err) {
|
|
90388
90231
|
if (err instanceof Error && err.name == "AbortError") return;
|
|
90389
|
-
handlePreviewSessionCreationError(err, props.accountId);
|
|
90232
|
+
handlePreviewSessionCreationError(err, props.accountId, props.cliDisplayName);
|
|
90390
90233
|
throw err;
|
|
90391
90234
|
}
|
|
90392
90235
|
}
|
|
@@ -90422,7 +90265,7 @@ var RemoteRuntimeController = class {
|
|
|
90422
90265
|
return workerPreviewToken;
|
|
90423
90266
|
} catch (err) {
|
|
90424
90267
|
if (err instanceof Error && err.name == "AbortError") return;
|
|
90425
|
-
if (handlePreviewSessionUploadError(err, props.accountId)) {
|
|
90268
|
+
if (handlePreviewSessionUploadError(err, props.accountId, props.cliDisplayName)) {
|
|
90426
90269
|
this.#session = await this.#previewSession(props);
|
|
90427
90270
|
return this.#previewToken(props);
|
|
90428
90271
|
}
|
|
@@ -90666,7 +90509,11 @@ function findRemoteSessionAuthError(error$3) {
|
|
|
90666
90509
|
if (error$3 instanceof Error) return findRemoteSessionAuthError(error$3.cause);
|
|
90667
90510
|
}
|
|
90668
90511
|
async function startRemoteProxySession(bindings, options) {
|
|
90669
|
-
for (const [name, binding] of Object.entries(bindings ?? {})) if (binding.type === "flagship" && binding.app_id === void 0)
|
|
90512
|
+
for (const [name, binding] of Object.entries(bindings ?? {})) if (binding.type === "flagship" && binding.app_id === void 0) {
|
|
90513
|
+
const setting = options.cliDisplayName === "cf" ? "id" : "app_id";
|
|
90514
|
+
const { createFlagshipApp } = CLI_COMMANDS[options.cliDisplayName];
|
|
90515
|
+
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" });
|
|
90516
|
+
}
|
|
90670
90517
|
if (process.versions.bun) throw new UserError("Remote bindings can't work under Bun, because Bun's `fetch()` ignores the undici `dispatcher` that Miniflare routes them through (https://github.com/oven-sh/bun/issues/39247). Run this using Node.js, or turn remote bindings off.", { telemetryMessage: "remote proxy session under bun" });
|
|
90671
90518
|
options.logger.log(source_default.dim("⎔ Establishing remote connection..."));
|
|
90672
90519
|
initLogger(getInternalLogger(options.logger));
|
|
@@ -90679,7 +90526,7 @@ async function startRemoteProxySession(bindings, options) {
|
|
|
90679
90526
|
compatibilityFlags: ["enhanced_error_serialization"],
|
|
90680
90527
|
complianceRegion: options.complianceRegion,
|
|
90681
90528
|
bindings: rawBindings,
|
|
90682
|
-
auth:
|
|
90529
|
+
auth: options.auth,
|
|
90683
90530
|
server: {
|
|
90684
90531
|
port: 0,
|
|
90685
90532
|
secure: false
|
|
@@ -90771,10 +90618,8 @@ function pickRemoteBindings(bindings) {
|
|
|
90771
90618
|
}
|
|
90772
90619
|
/** Potentially starts or updates a remote proxy session. */
|
|
90773
90620
|
async function maybeStartOrUpdateRemoteProxySession(workerConfigObject, preExistingRemoteProxySessionData, auth, context, startSession = startRemoteProxySession) {
|
|
90774
|
-
const { hook, key } =
|
|
90775
|
-
const
|
|
90776
|
-
if (workerConfigObject.target === "cf") warnForDefaultRemoteBindings(bindings, true, (message) => context.logger.warn(message));
|
|
90777
|
-
const remoteBindings = pickRemoteBindings(bindings);
|
|
90621
|
+
const { hook, key } = "hook" in auth ? auth : { hook: auth };
|
|
90622
|
+
const remoteBindings = pickRemoteBindings(workerConfigObject.target === "cf" ? getRemoteBindings({ env: workerConfigObject.env }) : workerConfigObject.bindings);
|
|
90778
90623
|
if (Object.keys(remoteBindings).length === 0 && !preExistingRemoteProxySessionData?.session) return null;
|
|
90779
90624
|
const authSameAsBefore = key !== void 0 || preExistingRemoteProxySessionData?.authKey !== void 0 ? key === preExistingRemoteProxySessionData?.authKey : deepStrictEqual(hook, preExistingRemoteProxySessionData?.auth);
|
|
90780
90625
|
let remoteProxySession = preExistingRemoteProxySessionData?.session;
|
|
@@ -90784,7 +90629,7 @@ async function maybeStartOrUpdateRemoteProxySession(workerConfigObject, preExist
|
|
|
90784
90629
|
workerName: workerConfigObject.name,
|
|
90785
90630
|
complianceRegion: workerConfigObject.complianceRegion,
|
|
90786
90631
|
cliDisplayName: context.cliDisplayName,
|
|
90787
|
-
auth:
|
|
90632
|
+
auth: hook,
|
|
90788
90633
|
logger: context.logger
|
|
90789
90634
|
});
|
|
90790
90635
|
} else if (!deepStrictEqual(remoteBindings, preExistingRemoteProxySessionData?.remoteBindings)) if (!remoteProxySession) {
|
|
@@ -90792,7 +90637,7 @@ async function maybeStartOrUpdateRemoteProxySession(workerConfigObject, preExist
|
|
|
90792
90637
|
workerName: workerConfigObject.name,
|
|
90793
90638
|
complianceRegion: workerConfigObject.complianceRegion,
|
|
90794
90639
|
cliDisplayName: context.cliDisplayName,
|
|
90795
|
-
auth:
|
|
90640
|
+
auth: hook,
|
|
90796
90641
|
logger: context.logger
|
|
90797
90642
|
});
|
|
90798
90643
|
} else await remoteProxySession.updateBindings(remoteBindings);
|
|
@@ -90930,7 +90775,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
|
|
|
90930
90775
|
const inputInspectorPort = await getInputInspectorPort(ctx, viteDevServer);
|
|
90931
90776
|
const { resolvedPluginConfig, resolvedViteConfig, entryWorkerConfig } = ctx;
|
|
90932
90777
|
const assetsConfig = getAssetsConfig(resolvedPluginConfig, entryWorkerConfig, resolvedViteConfig);
|
|
90933
|
-
const resolvedLocalBindingsByWorkerName = resolveLocalBindingsByWorkerName(ctx.allWorkerConfigs, resolvedPluginConfig.localEnv, resolvedPluginConfig.devVars, resolvedPluginConfig.remoteBindings, resolvedViteConfig.mode, viteDevServer.config.logger);
|
|
90778
|
+
const resolvedLocalBindingsByWorkerName = resolveLocalBindingsByWorkerName(ctx.allWorkerConfigs, resolvedPluginConfig.localEnv, resolvedPluginConfig.devVars, resolvedPluginConfig.remoteBindings, resolvedViteConfig.mode, resolvedViteConfig.root, viteDevServer.config.logger);
|
|
90934
90779
|
const [routerWorkerManifest, assetWorkerManifest, viteProxyWorkerManifest] = await Promise.all([
|
|
90935
90780
|
getInternalWorkerManifest(ROUTER_WORKER_PATH),
|
|
90936
90781
|
getInternalWorkerManifest(ASSET_WORKER_PATH),
|
|
@@ -91070,9 +90915,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
|
|
|
91070
90915
|
name: worker.config.name,
|
|
91071
90916
|
target: "cf",
|
|
91072
90917
|
env: worker.config.env,
|
|
91073
|
-
complianceRegion: toApiComplianceRegion(settings.complianceRegion)
|
|
91074
|
-
account_id: settings.accountId,
|
|
91075
|
-
profileDir: resolvedViteConfig.root
|
|
90918
|
+
complianceRegion: toApiComplianceRegion(settings.complianceRegion)
|
|
91076
90919
|
}, preExistingRemoteProxySession ?? null, getRemoteBindingsAuth(resolvedViteConfig.root, settings.accountId, () => ctx.getCloudflareAuth(resolvedViteConfig.root, createLogger(viteDevServer.config.logger))), {
|
|
91077
90920
|
cliDisplayName: CLI_DISPLAY_NAME,
|
|
91078
90921
|
logger: createRemoteBindingsLogger(viteDevServer.config.logger)
|
|
@@ -91222,7 +91065,7 @@ async function getMiniflareManifest(bundle) {
|
|
|
91222
91065
|
async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
|
|
91223
91066
|
const inputInspectorPort = await getInputInspectorPort(ctx, vitePreviewServer);
|
|
91224
91067
|
const { resolvedPluginConfig, resolvedViteConfig } = ctx;
|
|
91225
|
-
const resolvedLocalBindingsByWorkerName = resolveLocalBindingsByWorkerName(ctx.allWorkerConfigs, resolvedPluginConfig.localEnv, resolvedPluginConfig.devVars, resolvedPluginConfig.remoteBindings, resolvedViteConfig.mode, vitePreviewServer.config.logger);
|
|
91068
|
+
const resolvedLocalBindingsByWorkerName = resolveLocalBindingsByWorkerName(ctx.allWorkerConfigs, resolvedPluginConfig.localEnv, resolvedPluginConfig.devVars, resolvedPluginConfig.remoteBindings, resolvedViteConfig.mode, resolvedViteConfig.root, vitePreviewServer.config.logger);
|
|
91226
91069
|
const containerPlansByWorkerName = /* @__PURE__ */ new Map();
|
|
91227
91070
|
const containerOptions = [];
|
|
91228
91071
|
for (const previewWorker of resolvedPluginConfig.workers) {
|
|
@@ -91243,9 +91086,7 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
|
|
|
91243
91086
|
name: workerConfig.name,
|
|
91244
91087
|
target: "cf",
|
|
91245
91088
|
env: workerConfig.env,
|
|
91246
|
-
complianceRegion: toApiComplianceRegion(resolvedPluginConfig.settings.complianceRegion)
|
|
91247
|
-
account_id: resolvedPluginConfig.settings.accountId,
|
|
91248
|
-
profileDir: resolvedViteConfig.root
|
|
91089
|
+
complianceRegion: toApiComplianceRegion(resolvedPluginConfig.settings.complianceRegion)
|
|
91249
91090
|
}, preExistingRemoteProxySessionData ?? null, getRemoteBindingsAuth(resolvedViteConfig.root, resolvedPluginConfig.settings.accountId, () => ctx.getCloudflareAuth(resolvedViteConfig.root, createLogger(vitePreviewServer.config.logger))), {
|
|
91250
91091
|
cliDisplayName: CLI_DISPLAY_NAME,
|
|
91251
91092
|
logger: createRemoteBindingsLogger(vitePreviewServer.config.logger)
|
|
@@ -91304,16 +91145,27 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
|
|
|
91304
91145
|
containerOptions: containerPlansByWorkerName.size === 0 ? void 0 : containerOptions
|
|
91305
91146
|
};
|
|
91306
91147
|
}
|
|
91307
|
-
|
|
91148
|
+
const warnForArtifactsLocalDefault = createArtifactsLocalDefaultWarner("cloudflare-config");
|
|
91149
|
+
function resolveLocalBindingsByWorkerName(workerConfigs, localEnv, devVars, remoteBindings, mode, projectRoot, logger$2) {
|
|
91308
91150
|
const resolvedLocalBindingsByWorkerName = /* @__PURE__ */ new Map();
|
|
91309
|
-
for (const config$3 of workerConfigs)
|
|
91310
|
-
|
|
91311
|
-
|
|
91312
|
-
|
|
91313
|
-
|
|
91314
|
-
|
|
91315
|
-
|
|
91316
|
-
|
|
91151
|
+
for (const config$3 of workerConfigs) {
|
|
91152
|
+
if (remoteBindings) warnForArtifactsLocalDefault({
|
|
91153
|
+
id: projectRoot,
|
|
91154
|
+
bindings: Object.entries(config$3.env ?? {}).flatMap(([name, binding]) => binding.type === "artifacts" ? [{
|
|
91155
|
+
name,
|
|
91156
|
+
remote: binding.dev?.remote,
|
|
91157
|
+
worker: workerConfigs.length > 1 ? config$3.name : void 0
|
|
91158
|
+
}] : [])
|
|
91159
|
+
}, (message) => logger$2.warn(message));
|
|
91160
|
+
resolvedLocalBindingsByWorkerName.set(config$3.name, resolveLocalBindings(config$3.env, {
|
|
91161
|
+
workerName: config$3.name,
|
|
91162
|
+
localEnv: localEnv.values,
|
|
91163
|
+
devVars,
|
|
91164
|
+
mode,
|
|
91165
|
+
remoteBindings,
|
|
91166
|
+
logger: logger$2
|
|
91167
|
+
}));
|
|
91168
|
+
}
|
|
91317
91169
|
return resolvedLocalBindingsByWorkerName;
|
|
91318
91170
|
}
|
|
91319
91171
|
/**
|