vercel 51.0.0 → 51.1.0
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/chunks/{chunk-UV6I5R3Q.js → chunk-E6ZEBMUP.js} +1 -1
- package/dist/chunks/{chunk-3ZDQHZB3.js → chunk-Q4UET42E.js} +1 -1
- package/dist/chunks/{chunk-CCEUMQG3.js → chunk-VOT6BE6P.js} +29 -9
- package/dist/commands/deploy/index.js +2 -2
- package/dist/commands/env/index.js +1 -1
- package/dist/commands/link/index.js +1 -1
- package/dist/commands-bulk.js +733 -663
- package/dist/index.js +2 -2
- package/dist/version.mjs +1 -1
- package/package.json +13 -13
package/dist/commands-bulk.js
CHANGED
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
did_you_mean_default,
|
|
55
55
|
executeUpgrade,
|
|
56
56
|
login
|
|
57
|
-
} from "./chunks/chunk-
|
|
57
|
+
} from "./chunks/chunk-Q4UET42E.js";
|
|
58
58
|
import {
|
|
59
59
|
getUpdateCommand,
|
|
60
60
|
isGlobal
|
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
require_format,
|
|
81
81
|
require_jsonlines,
|
|
82
82
|
setupDomain
|
|
83
|
-
} from "./chunks/chunk-
|
|
83
|
+
} from "./chunks/chunk-E6ZEBMUP.js";
|
|
84
84
|
import {
|
|
85
85
|
processRevocationResponse,
|
|
86
86
|
readLocalConfig,
|
|
@@ -343,7 +343,7 @@ import {
|
|
|
343
343
|
webAnalyticsSubcommand,
|
|
344
344
|
webhooksCommand,
|
|
345
345
|
whoamiCommand
|
|
346
|
-
} from "./chunks/chunk-
|
|
346
|
+
} from "./chunks/chunk-VOT6BE6P.js";
|
|
347
347
|
import {
|
|
348
348
|
addSubcommand as addSubcommand9,
|
|
349
349
|
deleteSubcommand,
|
|
@@ -4007,7 +4007,7 @@ async function connectResourceToProject(client, projectId, storeId, environments
|
|
|
4007
4007
|
}
|
|
4008
4008
|
|
|
4009
4009
|
// src/commands/blob/store-add.ts
|
|
4010
|
-
var
|
|
4010
|
+
var import_chalk15 = __toESM(require_source(), 1);
|
|
4011
4011
|
|
|
4012
4012
|
// src/util/telemetry/commands/blob/store-add.ts
|
|
4013
4013
|
var BlobAddStoreTelemetryClient = class extends TelemetryClient {
|
|
@@ -4035,8 +4035,134 @@ var BlobAddStoreTelemetryClient = class extends TelemetryClient {
|
|
|
4035
4035
|
});
|
|
4036
4036
|
}
|
|
4037
4037
|
}
|
|
4038
|
+
trackCliFlagYes(v) {
|
|
4039
|
+
if (v) {
|
|
4040
|
+
this.trackCliFlag("yes");
|
|
4041
|
+
}
|
|
4042
|
+
}
|
|
4043
|
+
trackCliOptionEnvironment(value) {
|
|
4044
|
+
if (value) {
|
|
4045
|
+
this.trackCliOption({
|
|
4046
|
+
option: "environment",
|
|
4047
|
+
value: value.join(",")
|
|
4048
|
+
});
|
|
4049
|
+
}
|
|
4050
|
+
}
|
|
4038
4051
|
};
|
|
4039
4052
|
|
|
4053
|
+
// src/util/integration/post-provision-setup.ts
|
|
4054
|
+
var import_chalk14 = __toESM(require_source(), 1);
|
|
4055
|
+
var VALID_ENVIRONMENTS = [
|
|
4056
|
+
"production",
|
|
4057
|
+
"preview",
|
|
4058
|
+
"development"
|
|
4059
|
+
];
|
|
4060
|
+
var ENV_PULL_FAILED_MESSAGE = "Failed to pull environment variables. You can run `vercel env pull` manually.";
|
|
4061
|
+
function validateEnvironments(environments) {
|
|
4062
|
+
const invalid = environments.filter(
|
|
4063
|
+
(env) => !VALID_ENVIRONMENTS.includes(env)
|
|
4064
|
+
);
|
|
4065
|
+
if (invalid.length > 0) {
|
|
4066
|
+
return { valid: false, invalid };
|
|
4067
|
+
}
|
|
4068
|
+
return { valid: true };
|
|
4069
|
+
}
|
|
4070
|
+
async function postProvisionSetup(client, resourceName, resourceId, contextName, options = {}) {
|
|
4071
|
+
const dashboardUrl = options.integrationSlug && options.installationId ? `https://vercel.com/d/dashboard/integrations/${options.integrationSlug}/${options.installationId}/resources/${resourceId}` : `https://vercel.com/${contextName}/~/stores/integration/${resourceId}`;
|
|
4072
|
+
output_manager_default.log(
|
|
4073
|
+
indent_default(
|
|
4074
|
+
`Dashboard: ${output_manager_default.link(dashboardUrl, dashboardUrl, { fallback: false })}`,
|
|
4075
|
+
4
|
|
4076
|
+
)
|
|
4077
|
+
);
|
|
4078
|
+
const baseResult = {
|
|
4079
|
+
exitCode: 0,
|
|
4080
|
+
dashboardUrl,
|
|
4081
|
+
connected: false,
|
|
4082
|
+
environments: [],
|
|
4083
|
+
envPulled: false
|
|
4084
|
+
};
|
|
4085
|
+
if (options.noConnect) {
|
|
4086
|
+
return baseResult;
|
|
4087
|
+
}
|
|
4088
|
+
const linkedProject = await getLinkedProject(client);
|
|
4089
|
+
if (linkedProject.status === "error") {
|
|
4090
|
+
return { ...baseResult, exitCode: linkedProject.exitCode };
|
|
4091
|
+
}
|
|
4092
|
+
if (linkedProject.status === "not_linked") {
|
|
4093
|
+
return baseResult;
|
|
4094
|
+
}
|
|
4095
|
+
const { project } = linkedProject;
|
|
4096
|
+
const environments = [
|
|
4097
|
+
...new Set(
|
|
4098
|
+
options.environments && options.environments.length > 0 ? options.environments : [...VALID_ENVIRONMENTS]
|
|
4099
|
+
)
|
|
4100
|
+
];
|
|
4101
|
+
output_manager_default.debug(`Selected environments: ${JSON.stringify(environments)}`);
|
|
4102
|
+
output_manager_default.spinner(
|
|
4103
|
+
`Connecting ${import_chalk14.default.bold(resourceName)} to ${import_chalk14.default.bold(project.name)}...`
|
|
4104
|
+
);
|
|
4105
|
+
output_manager_default.debug(`Connecting resource ${resourceId} to project ${project.id}`);
|
|
4106
|
+
try {
|
|
4107
|
+
await connectResourceToProject(
|
|
4108
|
+
client,
|
|
4109
|
+
project.id,
|
|
4110
|
+
resourceId,
|
|
4111
|
+
environments,
|
|
4112
|
+
options.prefix ? { envVarPrefix: options.prefix } : void 0
|
|
4113
|
+
);
|
|
4114
|
+
} catch (error) {
|
|
4115
|
+
output_manager_default.stopSpinner();
|
|
4116
|
+
options.onProjectConnectFailed?.(project.id, error);
|
|
4117
|
+
output_manager_default.error(`Failed to connect: ${error.message}`);
|
|
4118
|
+
return {
|
|
4119
|
+
...baseResult,
|
|
4120
|
+
exitCode: 1,
|
|
4121
|
+
project: { id: project.id, name: project.name },
|
|
4122
|
+
environments,
|
|
4123
|
+
connectError: error.message
|
|
4124
|
+
};
|
|
4125
|
+
}
|
|
4126
|
+
output_manager_default.stopSpinner();
|
|
4127
|
+
output_manager_default.log(
|
|
4128
|
+
`${import_chalk14.default.bold(resourceName)} successfully connected to ${import_chalk14.default.bold(project.name)}`
|
|
4129
|
+
);
|
|
4130
|
+
options.onProjectConnected?.(project.id);
|
|
4131
|
+
let envPulled = false;
|
|
4132
|
+
if (!options.noEnvPull) {
|
|
4133
|
+
const pullExitCode = await pull(
|
|
4134
|
+
client,
|
|
4135
|
+
["--yes"],
|
|
4136
|
+
"vercel-cli:integration:add"
|
|
4137
|
+
);
|
|
4138
|
+
if (pullExitCode !== 0) {
|
|
4139
|
+
output_manager_default.warn(ENV_PULL_FAILED_MESSAGE);
|
|
4140
|
+
} else {
|
|
4141
|
+
envPulled = true;
|
|
4142
|
+
}
|
|
4143
|
+
}
|
|
4144
|
+
return {
|
|
4145
|
+
...baseResult,
|
|
4146
|
+
project: { id: project.id, name: project.name },
|
|
4147
|
+
connected: true,
|
|
4148
|
+
environments,
|
|
4149
|
+
envPulled
|
|
4150
|
+
};
|
|
4151
|
+
}
|
|
4152
|
+
async function getLinkedProjectField(client, noConnect, field = "name") {
|
|
4153
|
+
if (noConnect) {
|
|
4154
|
+
return { value: void 0 };
|
|
4155
|
+
}
|
|
4156
|
+
const linkedProject = await getLinkedProject(client);
|
|
4157
|
+
if (linkedProject.status === "error") {
|
|
4158
|
+
return { value: void 0, exitCode: linkedProject.exitCode };
|
|
4159
|
+
}
|
|
4160
|
+
if (linkedProject.status === "linked") {
|
|
4161
|
+
return { value: linkedProject.project[field] };
|
|
4162
|
+
}
|
|
4163
|
+
return { value: void 0 };
|
|
4164
|
+
}
|
|
4165
|
+
|
|
4040
4166
|
// src/commands/blob/store-add.ts
|
|
4041
4167
|
async function addStore(client, argv) {
|
|
4042
4168
|
const telemetryClient = new BlobAddStoreTelemetryClient({
|
|
@@ -4056,6 +4182,17 @@ async function addStore(client, argv) {
|
|
|
4056
4182
|
args: [nameArg],
|
|
4057
4183
|
flags
|
|
4058
4184
|
} = parsedArgs;
|
|
4185
|
+
const yes = flags["--yes"] ?? false;
|
|
4186
|
+
const environmentFlags = flags["--environment"];
|
|
4187
|
+
if (environmentFlags?.length) {
|
|
4188
|
+
const envValidation = validateEnvironments(environmentFlags);
|
|
4189
|
+
if (!envValidation.valid) {
|
|
4190
|
+
output_manager_default.error(
|
|
4191
|
+
`Invalid environment value: ${envValidation.invalid.map((e2) => `"${e2}"`).join(", ")}. Must be one of: ${VALID_ENVIRONMENTS.join(", ")}`
|
|
4192
|
+
);
|
|
4193
|
+
return 1;
|
|
4194
|
+
}
|
|
4195
|
+
}
|
|
4059
4196
|
let accessFlag = flags["--access"];
|
|
4060
4197
|
if (!accessFlag && client.stdin.isTTY) {
|
|
4061
4198
|
accessFlag = await client.input.select({
|
|
@@ -4080,6 +4217,10 @@ async function addStore(client, argv) {
|
|
|
4080
4217
|
const region = flags["--region"] || "iad1";
|
|
4081
4218
|
let name = nameArg;
|
|
4082
4219
|
if (!name) {
|
|
4220
|
+
if (!client.stdin.isTTY) {
|
|
4221
|
+
output_manager_default.error("Missing required argument: name");
|
|
4222
|
+
return 1;
|
|
4223
|
+
}
|
|
4083
4224
|
name = await client.input.text({
|
|
4084
4225
|
message: "Enter a name for your blob store",
|
|
4085
4226
|
validate: (value) => {
|
|
@@ -4120,21 +4261,31 @@ async function addStore(client, argv) {
|
|
|
4120
4261
|
const docsUrl = access3 === "public" ? "https://vercel.com/docs/vercel-blob/public-storage" : "https://vercel.com/docs/vercel-blob/private-storage";
|
|
4121
4262
|
output_manager_default.log(`Access: ${access3}. Learn more: ${output_manager_default.link(docsUrl, docsUrl)}`);
|
|
4122
4263
|
if (link.status === "linked") {
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4264
|
+
let shouldLink = yes;
|
|
4265
|
+
if (!shouldLink) {
|
|
4266
|
+
shouldLink = await client.input.confirm(
|
|
4267
|
+
`Would you like to link this blob store to ${link.project.name}?`,
|
|
4268
|
+
true
|
|
4269
|
+
);
|
|
4270
|
+
}
|
|
4271
|
+
if (shouldLink) {
|
|
4272
|
+
let environments;
|
|
4273
|
+
if (environmentFlags?.length) {
|
|
4274
|
+
environments = environmentFlags;
|
|
4275
|
+
} else if (yes) {
|
|
4276
|
+
environments = [...VALID_ENVIRONMENTS];
|
|
4277
|
+
} else {
|
|
4278
|
+
environments = await client.input.checkbox({
|
|
4279
|
+
message: "Select environments",
|
|
4280
|
+
choices: [
|
|
4281
|
+
{ name: "Production", value: "production", checked: true },
|
|
4282
|
+
{ name: "Preview", value: "preview", checked: true },
|
|
4283
|
+
{ name: "Development", value: "development", checked: true }
|
|
4284
|
+
]
|
|
4285
|
+
});
|
|
4286
|
+
}
|
|
4136
4287
|
output_manager_default.spinner(
|
|
4137
|
-
`Connecting ${
|
|
4288
|
+
`Connecting ${import_chalk15.default.bold(name)} to ${import_chalk15.default.bold(link.project.name)}...`
|
|
4138
4289
|
);
|
|
4139
4290
|
await connectResourceToProject(
|
|
4140
4291
|
client,
|
|
@@ -4144,7 +4295,7 @@ async function addStore(client, argv) {
|
|
|
4144
4295
|
{ accountId: link.org.id }
|
|
4145
4296
|
);
|
|
4146
4297
|
output_manager_default.success(
|
|
4147
|
-
`Blob store ${
|
|
4298
|
+
`Blob store ${import_chalk15.default.bold(name)} linked to ${import_chalk15.default.bold(
|
|
4148
4299
|
link.project.name
|
|
4149
4300
|
)}`
|
|
4150
4301
|
);
|
|
@@ -4193,14 +4344,20 @@ async function removeStore(client, argv, rwToken) {
|
|
|
4193
4344
|
printError(err);
|
|
4194
4345
|
return 1;
|
|
4195
4346
|
}
|
|
4196
|
-
|
|
4197
|
-
args: [
|
|
4347
|
+
const {
|
|
4348
|
+
args: [storeIdArg],
|
|
4349
|
+
flags: { "--yes": yes }
|
|
4198
4350
|
} = parsedArgs;
|
|
4351
|
+
let storeId = storeIdArg;
|
|
4199
4352
|
if (!storeId && rwToken.success) {
|
|
4200
4353
|
const [, , , id] = rwToken.token.split("_");
|
|
4201
4354
|
storeId = `store_${id}`;
|
|
4202
4355
|
}
|
|
4203
4356
|
if (!storeId) {
|
|
4357
|
+
if (!client.stdin.isTTY) {
|
|
4358
|
+
output_manager_default.error("Missing required argument: storeId");
|
|
4359
|
+
return 1;
|
|
4360
|
+
}
|
|
4204
4361
|
storeId = await client.input.text({
|
|
4205
4362
|
message: "Enter the ID of the blob store you want to remove",
|
|
4206
4363
|
validate: (value) => {
|
|
@@ -4231,13 +4388,21 @@ async function removeStore(client, argv, rwToken) {
|
|
|
4231
4388
|
const projectsInfo = formatConnectedProjects(
|
|
4232
4389
|
connectionsResponse.connections
|
|
4233
4390
|
);
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4391
|
+
if (!yes) {
|
|
4392
|
+
if (!client.stdin.isTTY) {
|
|
4393
|
+
output_manager_default.error(
|
|
4394
|
+
"Confirmation required. Use --yes to skip confirmation in non-interactive environments."
|
|
4395
|
+
);
|
|
4396
|
+
return 1;
|
|
4397
|
+
}
|
|
4398
|
+
const res = await client.input.confirm(
|
|
4399
|
+
`Are you sure you want to remove ${label}?${projectsInfo} This action cannot be undone.`,
|
|
4400
|
+
false
|
|
4401
|
+
);
|
|
4402
|
+
if (!res) {
|
|
4403
|
+
output_manager_default.success("Blob store not removed");
|
|
4404
|
+
return 0;
|
|
4405
|
+
}
|
|
4241
4406
|
}
|
|
4242
4407
|
output_manager_default.debug("Deleting blob store");
|
|
4243
4408
|
output_manager_default.spinner("Deleting blob store");
|
|
@@ -4288,16 +4453,16 @@ var BlobGetStoreTelemetryClient = class extends TelemetryClient {
|
|
|
4288
4453
|
|
|
4289
4454
|
// src/util/blob/format-store.ts
|
|
4290
4455
|
var import_bytes2 = __toESM(require_bytes(), 1);
|
|
4291
|
-
var
|
|
4456
|
+
var import_chalk16 = __toESM(require_source(), 1);
|
|
4292
4457
|
var import_date_fns = __toESM(require_date_fns(), 1);
|
|
4293
4458
|
function formatStoreDetails(store, teamSlug) {
|
|
4294
4459
|
const dateTimeFormat = "MM/DD/YYYY HH:mm:ss.SS";
|
|
4295
4460
|
const isPublic = store.access !== "private";
|
|
4296
4461
|
const storeIdSuffix = store.id.replace("store_", "").toLowerCase();
|
|
4297
4462
|
const accessDomain = isPublic ? "public" : "private";
|
|
4298
|
-
const billingState = store.billingState === "active" ?
|
|
4463
|
+
const billingState = store.billingState === "active" ? import_chalk16.default.green("Active") : import_chalk16.default.red("Inactive");
|
|
4299
4464
|
const lines = [
|
|
4300
|
-
`Blob Store: ${
|
|
4465
|
+
`Blob Store: ${import_chalk16.default.bold(store.name)} (${import_chalk16.default.dim(store.id)})`,
|
|
4301
4466
|
`Billing State: ${billingState}`
|
|
4302
4467
|
];
|
|
4303
4468
|
if (store.count !== void 0) {
|
|
@@ -4349,6 +4514,10 @@ async function getStore(client, argv, rwToken) {
|
|
|
4349
4514
|
storeId = `store_${id}`;
|
|
4350
4515
|
}
|
|
4351
4516
|
if (!storeId) {
|
|
4517
|
+
if (!client.stdin.isTTY) {
|
|
4518
|
+
output_manager_default.error("Missing required argument: storeId");
|
|
4519
|
+
return 1;
|
|
4520
|
+
}
|
|
4352
4521
|
storeId = await client.input.text({
|
|
4353
4522
|
message: "Enter the ID of the blob store you want to get info about",
|
|
4354
4523
|
validate: (value) => {
|
|
@@ -4387,28 +4556,36 @@ async function getStore(client, argv, rwToken) {
|
|
|
4387
4556
|
}
|
|
4388
4557
|
|
|
4389
4558
|
// src/commands/blob/store-list.ts
|
|
4390
|
-
var
|
|
4559
|
+
var import_chalk17 = __toESM(require_source(), 1);
|
|
4391
4560
|
|
|
4392
4561
|
// src/util/telemetry/commands/blob/store-list.ts
|
|
4393
4562
|
var BlobListStoresTelemetryClient = class extends TelemetryClient {
|
|
4563
|
+
trackCliFlagAll(v) {
|
|
4564
|
+
if (v) {
|
|
4565
|
+
this.trackCliFlag("all");
|
|
4566
|
+
}
|
|
4567
|
+
}
|
|
4394
4568
|
};
|
|
4395
4569
|
|
|
4396
4570
|
// src/commands/blob/store-list.ts
|
|
4397
4571
|
async function listStores(client, argv) {
|
|
4398
|
-
new BlobListStoresTelemetryClient({
|
|
4399
|
-
opts: {
|
|
4400
|
-
store: client.telemetryEventStore
|
|
4401
|
-
}
|
|
4402
|
-
});
|
|
4403
4572
|
const flagsSpecification = getFlagsSpecification(
|
|
4404
4573
|
listStoresSubcommand.options
|
|
4405
4574
|
);
|
|
4575
|
+
let parsedArgs;
|
|
4406
4576
|
try {
|
|
4407
|
-
parseArguments(argv, flagsSpecification);
|
|
4577
|
+
parsedArgs = parseArguments(argv, flagsSpecification);
|
|
4408
4578
|
} catch (err) {
|
|
4409
4579
|
printError(err);
|
|
4410
4580
|
return 1;
|
|
4411
4581
|
}
|
|
4582
|
+
const showAll = parsedArgs.flags["--all"] ?? false;
|
|
4583
|
+
const telemetryClient = new BlobListStoresTelemetryClient({
|
|
4584
|
+
opts: {
|
|
4585
|
+
store: client.telemetryEventStore
|
|
4586
|
+
}
|
|
4587
|
+
});
|
|
4588
|
+
telemetryClient.trackCliFlagAll(showAll || void 0);
|
|
4412
4589
|
try {
|
|
4413
4590
|
let accountId;
|
|
4414
4591
|
let teamSlug;
|
|
@@ -4421,7 +4598,7 @@ async function listStores(client, argv) {
|
|
|
4421
4598
|
dirLink.projectId,
|
|
4422
4599
|
dirLink.orgId
|
|
4423
4600
|
);
|
|
4424
|
-
if (project && !(project instanceof ProjectNotFound)) {
|
|
4601
|
+
if (project && !(project instanceof ProjectNotFound) && !showAll) {
|
|
4425
4602
|
linkedProject = { id: project.id, name: project.name };
|
|
4426
4603
|
}
|
|
4427
4604
|
} else {
|
|
@@ -4452,16 +4629,22 @@ async function listStores(client, argv) {
|
|
|
4452
4629
|
);
|
|
4453
4630
|
}
|
|
4454
4631
|
if (stores.length === 0) {
|
|
4455
|
-
|
|
4632
|
+
if (linkedProject) {
|
|
4633
|
+
output_manager_default.log(
|
|
4634
|
+
`No blob stores connected to ${import_chalk17.default.bold(linkedProject.name)}. Use ${import_chalk17.default.cyan("--all")} to list all team stores.`
|
|
4635
|
+
);
|
|
4636
|
+
} else {
|
|
4637
|
+
output_manager_default.log("No blob stores found");
|
|
4638
|
+
}
|
|
4456
4639
|
return 0;
|
|
4457
4640
|
}
|
|
4458
|
-
const header = linkedProject ? `Blob stores for project ${
|
|
4641
|
+
const header = linkedProject ? `Blob stores for project ${import_chalk17.default.bold(linkedProject.name)}:` : `Blob stores:`;
|
|
4459
4642
|
output_manager_default.log(header);
|
|
4460
4643
|
if (!client.stdin.isTTY || !client.stdout.isTTY) {
|
|
4461
4644
|
output_manager_default.print(
|
|
4462
4645
|
table(
|
|
4463
4646
|
[
|
|
4464
|
-
["Name", "Store ID"].map((h) =>
|
|
4647
|
+
["Name", "Store ID"].map((h) => import_chalk17.default.dim(h)),
|
|
4465
4648
|
...stores.map((store) => [store.name, store.id])
|
|
4466
4649
|
],
|
|
4467
4650
|
{ hsep: 4 }
|
|
@@ -4471,7 +4654,7 @@ async function listStores(client, argv) {
|
|
|
4471
4654
|
}
|
|
4472
4655
|
const choices = [
|
|
4473
4656
|
...stores.map((store) => ({
|
|
4474
|
-
name: `${store.name} (${
|
|
4657
|
+
name: `${store.name} (${import_chalk17.default.dim(store.id)})`,
|
|
4475
4658
|
value: store.id
|
|
4476
4659
|
})),
|
|
4477
4660
|
{ name: "Cancel", value: "" }
|
|
@@ -4607,7 +4790,7 @@ async function emptyStore(client, argv, rwToken, fullToken) {
|
|
|
4607
4790
|
import { resolve as resolve3 } from "path";
|
|
4608
4791
|
|
|
4609
4792
|
// src/util/output/list-item.ts
|
|
4610
|
-
var
|
|
4793
|
+
var import_chalk18 = __toESM(require_source(), 1);
|
|
4611
4794
|
var listItem = (msg, n) => {
|
|
4612
4795
|
if (!n) {
|
|
4613
4796
|
n = "-";
|
|
@@ -4615,7 +4798,7 @@ var listItem = (msg, n) => {
|
|
|
4615
4798
|
if (Number(n)) {
|
|
4616
4799
|
n += ".";
|
|
4617
4800
|
}
|
|
4618
|
-
return `${(0,
|
|
4801
|
+
return `${(0, import_chalk18.default)(n.toString())} ${msg}`;
|
|
4619
4802
|
};
|
|
4620
4803
|
var list_item_default = listItem;
|
|
4621
4804
|
|
|
@@ -4814,7 +4997,7 @@ async function main2(client) {
|
|
|
4814
4997
|
}
|
|
4815
4998
|
|
|
4816
4999
|
// src/commands/buy/credits.ts
|
|
4817
|
-
var
|
|
5000
|
+
var import_chalk19 = __toESM(require_source(), 1);
|
|
4818
5001
|
|
|
4819
5002
|
// src/util/buy/create-purchase.ts
|
|
4820
5003
|
async function createPurchase(client, item) {
|
|
@@ -4983,7 +5166,7 @@ async function credits(client, argv) {
|
|
|
4983
5166
|
return 1;
|
|
4984
5167
|
}
|
|
4985
5168
|
if (!await client.input.confirm(
|
|
4986
|
-
`Purchase ${
|
|
5169
|
+
`Purchase ${import_chalk19.default.bold(`$${amount}`)} of ${label} credits for team ${import_chalk19.default.bold(contextName)}?`,
|
|
4987
5170
|
false
|
|
4988
5171
|
)) {
|
|
4989
5172
|
return 0;
|
|
@@ -5014,7 +5197,7 @@ async function credits(client, argv) {
|
|
|
5014
5197
|
);
|
|
5015
5198
|
} else {
|
|
5016
5199
|
output_manager_default.success(
|
|
5017
|
-
`Purchased ${
|
|
5200
|
+
`Purchased ${import_chalk19.default.bold(`$${amount}`)} of ${label} credits for ${import_chalk19.default.bold(contextName)} ${purchaseStamp()}`
|
|
5018
5201
|
);
|
|
5019
5202
|
if (result.purchaseIntent) {
|
|
5020
5203
|
output_manager_default.debug(`Purchase intent: ${result.purchaseIntent.id}`);
|
|
@@ -5030,7 +5213,7 @@ async function credits(client, argv) {
|
|
|
5030
5213
|
}
|
|
5031
5214
|
|
|
5032
5215
|
// src/commands/buy/addon.ts
|
|
5033
|
-
var
|
|
5216
|
+
var import_chalk20 = __toESM(require_source(), 1);
|
|
5034
5217
|
async function addon(client, argv) {
|
|
5035
5218
|
const flagsSpecification = getFlagsSpecification(addonSubcommand.options);
|
|
5036
5219
|
let parsedArgs;
|
|
@@ -5097,7 +5280,7 @@ async function addon(client, argv) {
|
|
|
5097
5280
|
return 1;
|
|
5098
5281
|
}
|
|
5099
5282
|
if (!await client.input.confirm(
|
|
5100
|
-
`Purchase ${
|
|
5283
|
+
`Purchase ${import_chalk20.default.bold(quantity)} unit${quantity === 1 ? "" : "s"} of ${label} for team ${import_chalk20.default.bold(contextName)}?`,
|
|
5101
5284
|
false
|
|
5102
5285
|
)) {
|
|
5103
5286
|
return 0;
|
|
@@ -5128,7 +5311,7 @@ async function addon(client, argv) {
|
|
|
5128
5311
|
);
|
|
5129
5312
|
} else {
|
|
5130
5313
|
output_manager_default.success(
|
|
5131
|
-
`Purchased ${
|
|
5314
|
+
`Purchased ${import_chalk20.default.bold(quantity)} unit${quantity === 1 ? "" : "s"} of ${label} for ${import_chalk20.default.bold(contextName)} ${purchaseStamp()}`
|
|
5132
5315
|
);
|
|
5133
5316
|
if (result.subscriptionIntent) {
|
|
5134
5317
|
output_manager_default.debug(`Subscription intent: ${result.subscriptionIntent.id}`);
|
|
@@ -5144,7 +5327,7 @@ async function addon(client, argv) {
|
|
|
5144
5327
|
}
|
|
5145
5328
|
|
|
5146
5329
|
// src/commands/buy/pro.ts
|
|
5147
|
-
var
|
|
5330
|
+
var import_chalk21 = __toESM(require_source(), 1);
|
|
5148
5331
|
async function pro(client, argv) {
|
|
5149
5332
|
const flagsSpecification = getFlagsSpecification(proSubcommand.options);
|
|
5150
5333
|
let parsedArgs;
|
|
@@ -5176,7 +5359,7 @@ async function pro(client, argv) {
|
|
|
5176
5359
|
return 1;
|
|
5177
5360
|
}
|
|
5178
5361
|
if (!await client.input.confirm(
|
|
5179
|
-
`Upgrade team ${
|
|
5362
|
+
`Upgrade team ${import_chalk21.default.bold(contextName)} to Vercel Pro?`,
|
|
5180
5363
|
false
|
|
5181
5364
|
)) {
|
|
5182
5365
|
return 0;
|
|
@@ -5204,7 +5387,7 @@ async function pro(client, argv) {
|
|
|
5204
5387
|
);
|
|
5205
5388
|
} else {
|
|
5206
5389
|
output_manager_default.success(
|
|
5207
|
-
`Upgraded ${
|
|
5390
|
+
`Upgraded ${import_chalk21.default.bold(contextName)} to Vercel Pro ${purchaseStamp()}`
|
|
5208
5391
|
);
|
|
5209
5392
|
if (result.subscriptionIntent) {
|
|
5210
5393
|
output_manager_default.debug(`Subscription intent: ${result.subscriptionIntent.id}`);
|
|
@@ -5241,7 +5424,7 @@ async function v0(client, argv) {
|
|
|
5241
5424
|
}
|
|
5242
5425
|
|
|
5243
5426
|
// src/commands/domains/buy.ts
|
|
5244
|
-
var
|
|
5427
|
+
var import_chalk22 = __toESM(require_source(), 1);
|
|
5245
5428
|
var import_tldts3 = __toESM(require_cjs(), 1);
|
|
5246
5429
|
var import_error_utils3 = __toESM(require_dist(), 1);
|
|
5247
5430
|
|
|
@@ -5374,7 +5557,7 @@ async function buy(client, argv) {
|
|
|
5374
5557
|
}
|
|
5375
5558
|
if (!domainStatus.available) {
|
|
5376
5559
|
output_manager_default.error(
|
|
5377
|
-
`The domain ${param(domainName)} is ${
|
|
5560
|
+
`The domain ${param(domainName)} is ${import_chalk22.default.underline(
|
|
5378
5561
|
"unavailable"
|
|
5379
5562
|
)}! ${availableStamp()}`
|
|
5380
5563
|
);
|
|
@@ -5386,9 +5569,9 @@ async function buy(client, argv) {
|
|
|
5386
5569
|
return 1;
|
|
5387
5570
|
}
|
|
5388
5571
|
output_manager_default.log(
|
|
5389
|
-
`The domain ${param(domainName)} is ${
|
|
5572
|
+
`The domain ${param(domainName)} is ${import_chalk22.default.underline(
|
|
5390
5573
|
"available"
|
|
5391
|
-
)} to buy under ${
|
|
5574
|
+
)} to buy under ${import_chalk22.default.bold(contextName)}! ${availableStamp()}`
|
|
5392
5575
|
);
|
|
5393
5576
|
if (skipConfirmation) {
|
|
5394
5577
|
output_manager_default.error(
|
|
@@ -5397,13 +5580,13 @@ async function buy(client, argv) {
|
|
|
5397
5580
|
return 1;
|
|
5398
5581
|
}
|
|
5399
5582
|
if (!await client.input.confirm(
|
|
5400
|
-
`Buy now for ${
|
|
5583
|
+
`Buy now for ${import_chalk22.default.bold(`$${purchasePrice}`)} (${`${years}yr${years > 1 ? "s" : ""}`})?`,
|
|
5401
5584
|
false
|
|
5402
5585
|
)) {
|
|
5403
5586
|
return 0;
|
|
5404
5587
|
}
|
|
5405
5588
|
const autoRenew = await client.input.confirm(
|
|
5406
|
-
years === 1 ? `Auto renew yearly for ${
|
|
5589
|
+
years === 1 ? `Auto renew yearly for ${import_chalk22.default.bold(`$${renewalPrice}`)}?` : `Auto renew every ${years} years for ${import_chalk22.default.bold(
|
|
5407
5590
|
`$${renewalPrice}`
|
|
5408
5591
|
)}?`,
|
|
5409
5592
|
true
|
|
@@ -6032,7 +6215,7 @@ async function main4(client) {
|
|
|
6032
6215
|
}
|
|
6033
6216
|
|
|
6034
6217
|
// src/commands/contract/index.ts
|
|
6035
|
-
var
|
|
6218
|
+
var import_chalk23 = __toESM(require_source(), 1);
|
|
6036
6219
|
|
|
6037
6220
|
// src/util/telemetry/commands/contract/index.ts
|
|
6038
6221
|
var ContractTelemetryClient = class extends TelemetryClient {
|
|
@@ -6103,7 +6286,7 @@ async function contract(client) {
|
|
|
6103
6286
|
}
|
|
6104
6287
|
const start = Date.now();
|
|
6105
6288
|
if (!asJson) {
|
|
6106
|
-
spinner(`Fetching contract commitments for ${
|
|
6289
|
+
spinner(`Fetching contract commitments for ${import_chalk23.default.bold(contextName)}`);
|
|
6107
6290
|
}
|
|
6108
6291
|
const query = new URLSearchParams();
|
|
6109
6292
|
if (teamId) {
|
|
@@ -6152,7 +6335,7 @@ async function contract(client) {
|
|
|
6152
6335
|
return 0;
|
|
6153
6336
|
}
|
|
6154
6337
|
log(
|
|
6155
|
-
`Contract commitments for ${
|
|
6338
|
+
`Contract commitments for ${import_chalk23.default.bold(contextName)} ${elapsed(Date.now() - start)}`
|
|
6156
6339
|
);
|
|
6157
6340
|
log("");
|
|
6158
6341
|
if (commitments.length === 0) {
|
|
@@ -6167,9 +6350,9 @@ async function contract(client) {
|
|
|
6167
6350
|
}
|
|
6168
6351
|
for (const [contractId, contractCommitments] of contractGroups) {
|
|
6169
6352
|
const firstCommitment = contractCommitments[0];
|
|
6170
|
-
log(
|
|
6353
|
+
log(import_chalk23.default.bold(`Contract: ${contractId}`));
|
|
6171
6354
|
log(
|
|
6172
|
-
`${
|
|
6355
|
+
`${import_chalk23.default.gray("Period:")} ${extractDatePortion(firstCommitment.ContractPeriodStart)} to ${extractDatePortion(firstCommitment.ContractPeriodEnd)}`
|
|
6173
6356
|
);
|
|
6174
6357
|
log("");
|
|
6175
6358
|
const headers = [
|
|
@@ -6201,14 +6384,14 @@ async function contract(client) {
|
|
|
6201
6384
|
];
|
|
6202
6385
|
});
|
|
6203
6386
|
const tablePrint = table(
|
|
6204
|
-
[headers.map((h) =>
|
|
6387
|
+
[headers.map((h) => import_chalk23.default.bold(import_chalk23.default.cyan(h))), ...rows],
|
|
6205
6388
|
{ hsep: 3, align: ["l", "l", "l", "r", "l"] }
|
|
6206
6389
|
).replace(/^/gm, " ");
|
|
6207
6390
|
print(`${tablePrint}
|
|
6208
6391
|
|
|
6209
6392
|
`);
|
|
6210
6393
|
}
|
|
6211
|
-
log(`${
|
|
6394
|
+
log(`${import_chalk23.default.gray("Total commitments:")} ${commitments.length}`);
|
|
6212
6395
|
return 0;
|
|
6213
6396
|
} catch (err) {
|
|
6214
6397
|
output_manager_default.prettyError(err);
|
|
@@ -6217,7 +6400,7 @@ async function contract(client) {
|
|
|
6217
6400
|
}
|
|
6218
6401
|
|
|
6219
6402
|
// src/commands/certs/add.ts
|
|
6220
|
-
var
|
|
6403
|
+
var import_chalk24 = __toESM(require_source(), 1);
|
|
6221
6404
|
|
|
6222
6405
|
// src/util/certs/create-cert-from-file.ts
|
|
6223
6406
|
var import_error_utils5 = __toESM(require_dist(), 1);
|
|
@@ -6321,7 +6504,7 @@ async function add(client, argv) {
|
|
|
6321
6504
|
`Invalid number of arguments to create a custom certificate entry. Usage:`
|
|
6322
6505
|
);
|
|
6323
6506
|
output_manager_default.print(
|
|
6324
|
-
` ${
|
|
6507
|
+
` ${import_chalk24.default.cyan(
|
|
6325
6508
|
`${getCommandName(
|
|
6326
6509
|
"certs add --crt <domain.crt> --key <domain.key> --ca <ca.crt>"
|
|
6327
6510
|
)}`
|
|
@@ -6333,9 +6516,9 @@ async function add(client, argv) {
|
|
|
6333
6516
|
cert = await createCertFromFile(client, keyPath, crtPath, caPath);
|
|
6334
6517
|
} else {
|
|
6335
6518
|
output_manager_default.warn(
|
|
6336
|
-
`${
|
|
6519
|
+
`${import_chalk24.default.cyan(
|
|
6337
6520
|
getCommandName("certs add")
|
|
6338
|
-
)} will be soon deprecated. Please use ${
|
|
6521
|
+
)} will be soon deprecated. Please use ${import_chalk24.default.cyan(
|
|
6339
6522
|
getCommandName("certs issue <cn> <cns>")
|
|
6340
6523
|
)} instead`
|
|
6341
6524
|
);
|
|
@@ -6344,7 +6527,7 @@ async function add(client, argv) {
|
|
|
6344
6527
|
`Invalid number of arguments to create a custom certificate entry. Usage:`
|
|
6345
6528
|
);
|
|
6346
6529
|
output_manager_default.print(
|
|
6347
|
-
` ${
|
|
6530
|
+
` ${import_chalk24.default.cyan(getCommandName("certs add <cn>[, <cn>]"))}
|
|
6348
6531
|
`
|
|
6349
6532
|
);
|
|
6350
6533
|
return 1;
|
|
@@ -6354,7 +6537,7 @@ async function add(client, argv) {
|
|
|
6354
6537
|
[]
|
|
6355
6538
|
);
|
|
6356
6539
|
output_manager_default.spinner(
|
|
6357
|
-
`Generating a certificate for ${
|
|
6540
|
+
`Generating a certificate for ${import_chalk24.default.bold(cns.join(", "))}`
|
|
6358
6541
|
);
|
|
6359
6542
|
const { contextName } = await getScope(client);
|
|
6360
6543
|
cert = await createCertForCns(client, cns, contextName);
|
|
@@ -6365,7 +6548,7 @@ async function add(client, argv) {
|
|
|
6365
6548
|
return 1;
|
|
6366
6549
|
} else {
|
|
6367
6550
|
output_manager_default.success(
|
|
6368
|
-
`Certificate entry for ${
|
|
6551
|
+
`Certificate entry for ${import_chalk24.default.bold(
|
|
6369
6552
|
cert.cns.join(", ")
|
|
6370
6553
|
)} created ${addStamp()}`
|
|
6371
6554
|
);
|
|
@@ -6375,13 +6558,13 @@ async function add(client, argv) {
|
|
|
6375
6558
|
var add_default = add;
|
|
6376
6559
|
|
|
6377
6560
|
// src/commands/certs/issue.ts
|
|
6378
|
-
var
|
|
6561
|
+
var import_chalk27 = __toESM(require_source(), 1);
|
|
6379
6562
|
var import_tldts4 = __toESM(require_cjs(), 1);
|
|
6380
6563
|
|
|
6381
6564
|
// src/util/certs/finish-cert-order.ts
|
|
6382
|
-
var
|
|
6565
|
+
var import_chalk25 = __toESM(require_source(), 1);
|
|
6383
6566
|
async function startCertOrder(client, cns, context) {
|
|
6384
|
-
output_manager_default.spinner(`Issuing a certificate for ${
|
|
6567
|
+
output_manager_default.spinner(`Issuing a certificate for ${import_chalk25.default.bold(cns.join(", "))}`);
|
|
6385
6568
|
try {
|
|
6386
6569
|
const cert = await client.fetch("/v3/certs", {
|
|
6387
6570
|
method: "PATCH",
|
|
@@ -6411,12 +6594,12 @@ function getCnsFromArgs(args) {
|
|
|
6411
6594
|
}
|
|
6412
6595
|
|
|
6413
6596
|
// src/util/certs/start-cert-order.ts
|
|
6414
|
-
var
|
|
6597
|
+
var import_chalk26 = __toESM(require_source(), 1);
|
|
6415
6598
|
async function startCertOrder2(client, cns, contextName) {
|
|
6416
6599
|
output_manager_default.spinner(
|
|
6417
|
-
`Starting certificate issuance for ${
|
|
6600
|
+
`Starting certificate issuance for ${import_chalk26.default.bold(
|
|
6418
6601
|
cns.join(", ")
|
|
6419
|
-
)} under ${
|
|
6602
|
+
)} under ${import_chalk26.default.bold(contextName)}`
|
|
6420
6603
|
);
|
|
6421
6604
|
const order = await client.fetch("/v3/certs", {
|
|
6422
6605
|
method: "PATCH",
|
|
@@ -6486,7 +6669,7 @@ async function issue(client, argv) {
|
|
|
6486
6669
|
`Invalid number of arguments to create a custom certificate entry. Usage:`
|
|
6487
6670
|
);
|
|
6488
6671
|
output_manager_default.print(
|
|
6489
|
-
` ${
|
|
6672
|
+
` ${import_chalk27.default.cyan(
|
|
6490
6673
|
getCommandName(
|
|
6491
6674
|
"certs issue --crt <domain.crt> --key <domain.key> --ca <ca.crt>"
|
|
6492
6675
|
)
|
|
@@ -6501,7 +6684,7 @@ async function issue(client, argv) {
|
|
|
6501
6684
|
return 1;
|
|
6502
6685
|
}
|
|
6503
6686
|
output_manager_default.success(
|
|
6504
|
-
`Certificate entry for ${
|
|
6687
|
+
`Certificate entry for ${import_chalk27.default.bold(
|
|
6505
6688
|
cert.cns.join(", ")
|
|
6506
6689
|
)} created ${addStamp()}`
|
|
6507
6690
|
);
|
|
@@ -6512,7 +6695,7 @@ async function issue(client, argv) {
|
|
|
6512
6695
|
`Invalid number of arguments to create a custom certificate entry. Usage:`
|
|
6513
6696
|
);
|
|
6514
6697
|
output_manager_default.print(
|
|
6515
|
-
` ${
|
|
6698
|
+
` ${import_chalk27.default.cyan(getCommandName("certs issue <cn>[, <cn>]"))}
|
|
6516
6699
|
`
|
|
6517
6700
|
);
|
|
6518
6701
|
return 1;
|
|
@@ -6540,14 +6723,14 @@ async function issue(client, argv) {
|
|
|
6540
6723
|
}
|
|
6541
6724
|
if (handledResult instanceof DomainPermissionDenied) {
|
|
6542
6725
|
output_manager_default.error(
|
|
6543
|
-
`You do not have permissions over domain ${
|
|
6726
|
+
`You do not have permissions over domain ${import_chalk27.default.underline(
|
|
6544
6727
|
handledResult.meta.domain
|
|
6545
|
-
)} under ${
|
|
6728
|
+
)} under ${import_chalk27.default.bold(handledResult.meta.context)}.`
|
|
6546
6729
|
);
|
|
6547
6730
|
return 1;
|
|
6548
6731
|
}
|
|
6549
6732
|
output_manager_default.success(
|
|
6550
|
-
`Certificate entry for ${
|
|
6733
|
+
`Certificate entry for ${import_chalk27.default.bold(
|
|
6551
6734
|
handledResult.cns.join(", ")
|
|
6552
6735
|
)} created ${addStamp()}`
|
|
6553
6736
|
);
|
|
@@ -6569,7 +6752,7 @@ async function runStartOrder(client, cns, contextName, stamp, { fallingBack = fa
|
|
|
6569
6752
|
}
|
|
6570
6753
|
if (pendingChallenges.length === 0) {
|
|
6571
6754
|
output_manager_default.log(
|
|
6572
|
-
`A certificate issuance for ${
|
|
6755
|
+
`A certificate issuance for ${import_chalk27.default.bold(
|
|
6573
6756
|
cns.join(", ")
|
|
6574
6757
|
)} has been started ${stamp()}`
|
|
6575
6758
|
);
|
|
@@ -6578,13 +6761,13 @@ async function runStartOrder(client, cns, contextName, stamp, { fallingBack = fa
|
|
|
6578
6761
|
`
|
|
6579
6762
|
);
|
|
6580
6763
|
output_manager_default.print(
|
|
6581
|
-
` ${
|
|
6764
|
+
` ${import_chalk27.default.cyan(getCommandName(`certs issue ${cns.join(" ")}`))}
|
|
6582
6765
|
`
|
|
6583
6766
|
);
|
|
6584
6767
|
return 0;
|
|
6585
6768
|
}
|
|
6586
6769
|
output_manager_default.log(
|
|
6587
|
-
`A certificate issuance for ${
|
|
6770
|
+
`A certificate issuance for ${import_chalk27.default.bold(
|
|
6588
6771
|
cns.join(", ")
|
|
6589
6772
|
)} has been started ${stamp()}`
|
|
6590
6773
|
);
|
|
@@ -6613,7 +6796,7 @@ async function runStartOrder(client, cns, contextName, stamp, { fallingBack = fa
|
|
|
6613
6796
|
`);
|
|
6614
6797
|
output_manager_default.log(`To issue the certificate once the records are added, run:`);
|
|
6615
6798
|
output_manager_default.print(
|
|
6616
|
-
` ${
|
|
6799
|
+
` ${import_chalk27.default.cyan(getCommandName(`certs issue ${cns.join(" ")}`))}
|
|
6617
6800
|
`
|
|
6618
6801
|
);
|
|
6619
6802
|
output_manager_default.print(
|
|
@@ -6623,7 +6806,7 @@ async function runStartOrder(client, cns, contextName, stamp, { fallingBack = fa
|
|
|
6623
6806
|
}
|
|
6624
6807
|
|
|
6625
6808
|
// src/commands/certs/ls.ts
|
|
6626
|
-
var
|
|
6809
|
+
var import_chalk28 = __toESM(require_source(), 1);
|
|
6627
6810
|
var import_ms6 = __toESM(require_ms(), 1);
|
|
6628
6811
|
|
|
6629
6812
|
// src/util/certs/get-certs.ts
|
|
@@ -6692,7 +6875,7 @@ async function ls2(client, argv) {
|
|
|
6692
6875
|
const { certs, pagination } = await getCerts(client, ...paginationOptions);
|
|
6693
6876
|
const { contextName } = await getScope(client);
|
|
6694
6877
|
output_manager_default.log(
|
|
6695
|
-
`${certs.length > 0 ? "Certificates" : "No certificates"} found under ${
|
|
6878
|
+
`${certs.length > 0 ? "Certificates" : "No certificates"} found under ${import_chalk28.default.bold(contextName)} ${lsStamp()}`
|
|
6696
6879
|
);
|
|
6697
6880
|
if (certs.length > 0) {
|
|
6698
6881
|
client.stdout.write(formatCertsTable(certs));
|
|
@@ -6716,11 +6899,11 @@ function formatCertsTable(certsList) {
|
|
|
6716
6899
|
}
|
|
6717
6900
|
function formatCertsTableHead() {
|
|
6718
6901
|
return [
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6902
|
+
import_chalk28.default.dim("id"),
|
|
6903
|
+
import_chalk28.default.dim("cns"),
|
|
6904
|
+
import_chalk28.default.dim("expiration"),
|
|
6905
|
+
import_chalk28.default.dim("renew"),
|
|
6906
|
+
import_chalk28.default.dim("age")
|
|
6724
6907
|
];
|
|
6725
6908
|
}
|
|
6726
6909
|
function formatCertsTableBody(certsList) {
|
|
@@ -6739,7 +6922,7 @@ function formatCertNonFirstCn(cn, multiple) {
|
|
|
6739
6922
|
return ["", formatCertCn(cn, multiple), "", "", ""];
|
|
6740
6923
|
}
|
|
6741
6924
|
function formatCertCn(cn, multiple) {
|
|
6742
|
-
return multiple ? `${
|
|
6925
|
+
return multiple ? `${import_chalk28.default.gray("-")} ${import_chalk28.default.bold(cn)}` : import_chalk28.default.bold(cn);
|
|
6743
6926
|
}
|
|
6744
6927
|
function formatCertFirstCn(time, cert, cn, multiple) {
|
|
6745
6928
|
return [
|
|
@@ -6747,17 +6930,17 @@ function formatCertFirstCn(time, cert, cn, multiple) {
|
|
|
6747
6930
|
formatCertCn(cn, multiple),
|
|
6748
6931
|
formatExpirationDate(new Date(cert.expiration)),
|
|
6749
6932
|
cert.autoRenew ? "yes" : "no",
|
|
6750
|
-
|
|
6933
|
+
import_chalk28.default.gray((0, import_ms6.default)(time.getTime() - new Date(cert.created).getTime()))
|
|
6751
6934
|
];
|
|
6752
6935
|
}
|
|
6753
6936
|
function formatExpirationDate(date) {
|
|
6754
6937
|
const diff2 = date.getTime() - Date.now();
|
|
6755
|
-
return diff2 < 0 ?
|
|
6938
|
+
return diff2 < 0 ? import_chalk28.default.gray(`${(0, import_ms6.default)(-diff2)} ago`) : import_chalk28.default.gray(`in ${(0, import_ms6.default)(diff2)}`);
|
|
6756
6939
|
}
|
|
6757
6940
|
var ls_default = ls2;
|
|
6758
6941
|
|
|
6759
6942
|
// src/commands/certs/rm.ts
|
|
6760
|
-
var
|
|
6943
|
+
var import_chalk29 = __toESM(require_source(), 1);
|
|
6761
6944
|
var import_ms7 = __toESM(require_ms(), 1);
|
|
6762
6945
|
var import_pluralize4 = __toESM(require_pluralize(), 1);
|
|
6763
6946
|
|
|
@@ -6830,7 +7013,7 @@ async function rm2(client, argv) {
|
|
|
6830
7013
|
telemetry2.trackCliArgumentId(id);
|
|
6831
7014
|
if (args.length !== 1) {
|
|
6832
7015
|
output_manager_default.error(
|
|
6833
|
-
`Invalid number of arguments. Usage: ${
|
|
7016
|
+
`Invalid number of arguments. Usage: ${import_chalk29.default.cyan(
|
|
6834
7017
|
`${getCommandName("certs rm <id or cn>")}`
|
|
6835
7018
|
)}`
|
|
6836
7019
|
);
|
|
@@ -6847,13 +7030,13 @@ async function rm2(client, argv) {
|
|
|
6847
7030
|
if (certs.length === 0) {
|
|
6848
7031
|
if (id.includes(".")) {
|
|
6849
7032
|
output_manager_default.error(
|
|
6850
|
-
`No custom certificates found for "${id}" under ${
|
|
7033
|
+
`No custom certificates found for "${id}" under ${import_chalk29.default.bold(
|
|
6851
7034
|
contextName
|
|
6852
7035
|
)}`
|
|
6853
7036
|
);
|
|
6854
7037
|
} else {
|
|
6855
7038
|
output_manager_default.error(
|
|
6856
|
-
`No certificates found by id "${id}" under ${
|
|
7039
|
+
`No certificates found by id "${id}" under ${import_chalk29.default.bold(contextName)}`
|
|
6857
7040
|
);
|
|
6858
7041
|
}
|
|
6859
7042
|
return 1;
|
|
@@ -6868,7 +7051,7 @@ async function rm2(client, argv) {
|
|
|
6868
7051
|
}
|
|
6869
7052
|
await Promise.all(certs.map((cert) => deleteCertById(client, cert.uid)));
|
|
6870
7053
|
output_manager_default.success(
|
|
6871
|
-
`${
|
|
7054
|
+
`${import_chalk29.default.bold(
|
|
6872
7055
|
(0, import_pluralize4.default)("Certificate", certs.length, true)
|
|
6873
7056
|
)} removed ${rmStamp()}`
|
|
6874
7057
|
);
|
|
@@ -6896,7 +7079,7 @@ function readConfirmation(client, msg, certs) {
|
|
|
6896
7079
|
`
|
|
6897
7080
|
);
|
|
6898
7081
|
output_manager_default.print(
|
|
6899
|
-
`${
|
|
7082
|
+
`${import_chalk29.default.bold.red("> Are you sure?")} ${import_chalk29.default.gray("(y/N) ")}`
|
|
6900
7083
|
);
|
|
6901
7084
|
client.stdin.on("data", (d) => {
|
|
6902
7085
|
process.stdin.pause();
|
|
@@ -6907,8 +7090,8 @@ function readConfirmation(client, msg, certs) {
|
|
|
6907
7090
|
function formatCertRow(cert) {
|
|
6908
7091
|
return [
|
|
6909
7092
|
cert.uid,
|
|
6910
|
-
|
|
6911
|
-
...cert.created ? [
|
|
7093
|
+
import_chalk29.default.bold(cert.cns ? cert.cns.join(", ") : "\u2013"),
|
|
7094
|
+
...cert.created ? [import_chalk29.default.gray(`${(0, import_ms7.default)(Date.now() - new Date(cert.created).getTime())} ago`)] : []
|
|
6912
7095
|
];
|
|
6913
7096
|
}
|
|
6914
7097
|
var rm_default = rm2;
|
|
@@ -7021,7 +7204,7 @@ async function main5(client) {
|
|
|
7021
7204
|
}
|
|
7022
7205
|
|
|
7023
7206
|
// src/commands/crons/add.ts
|
|
7024
|
-
var
|
|
7207
|
+
var import_chalk30 = __toESM(require_source(), 1);
|
|
7025
7208
|
import { resolve as resolve5 } from "path";
|
|
7026
7209
|
import { access, readFile as readFile4, writeFile as writeFile3 } from "fs/promises";
|
|
7027
7210
|
|
|
@@ -7181,7 +7364,7 @@ async function add2(client, argv) {
|
|
|
7181
7364
|
try {
|
|
7182
7365
|
await access(altPath);
|
|
7183
7366
|
output_manager_default.error(
|
|
7184
|
-
`Found ${
|
|
7367
|
+
`Found ${import_chalk30.default.cyan(configName)} \u2014 ${getCommandName("crons add")} only supports ${import_chalk30.default.cyan("vercel.json")}. Add cron jobs directly to your ${import_chalk30.default.cyan(configName)} file instead.`
|
|
7185
7368
|
);
|
|
7186
7369
|
return 1;
|
|
7187
7370
|
} catch {
|
|
@@ -7195,7 +7378,7 @@ async function add2(client, argv) {
|
|
|
7195
7378
|
} catch (err) {
|
|
7196
7379
|
if (err instanceof SyntaxError) {
|
|
7197
7380
|
output_manager_default.error(
|
|
7198
|
-
`Failed to parse ${
|
|
7381
|
+
`Failed to parse ${import_chalk30.default.cyan("vercel.json")}: ${err.message}`
|
|
7199
7382
|
);
|
|
7200
7383
|
return 1;
|
|
7201
7384
|
}
|
|
@@ -7203,7 +7386,7 @@ async function add2(client, argv) {
|
|
|
7203
7386
|
config = {};
|
|
7204
7387
|
} else {
|
|
7205
7388
|
output_manager_default.error(
|
|
7206
|
-
`Failed to read ${
|
|
7389
|
+
`Failed to read ${import_chalk30.default.cyan("vercel.json")}: ${err instanceof Error ? err.message : String(err)}`
|
|
7207
7390
|
);
|
|
7208
7391
|
return 1;
|
|
7209
7392
|
}
|
|
@@ -7211,7 +7394,7 @@ async function add2(client, argv) {
|
|
|
7211
7394
|
const existingCrons = Array.isArray(config.crons) ? config.crons : [];
|
|
7212
7395
|
if (existingCrons.some((c) => c.path === cronPath)) {
|
|
7213
7396
|
output_manager_default.error(
|
|
7214
|
-
`A cron job with path ${
|
|
7397
|
+
`A cron job with path ${import_chalk30.default.bold(cronPath)} already exists in vercel.json`
|
|
7215
7398
|
);
|
|
7216
7399
|
return 1;
|
|
7217
7400
|
}
|
|
@@ -7225,12 +7408,12 @@ async function add2(client, argv) {
|
|
|
7225
7408
|
);
|
|
7226
7409
|
} catch (err) {
|
|
7227
7410
|
output_manager_default.error(
|
|
7228
|
-
`Failed to write ${
|
|
7411
|
+
`Failed to write ${import_chalk30.default.cyan("vercel.json")}: ${err instanceof Error ? err.message : String(err)}`
|
|
7229
7412
|
);
|
|
7230
7413
|
return 1;
|
|
7231
7414
|
}
|
|
7232
7415
|
output_manager_default.log(
|
|
7233
|
-
`Added cron job ${
|
|
7416
|
+
`Added cron job ${import_chalk30.default.bold(cronPath)} with schedule ${import_chalk30.default.bold(schedule)} to ${import_chalk30.default.cyan("vercel.json")}`
|
|
7234
7417
|
);
|
|
7235
7418
|
output_manager_default.warn(
|
|
7236
7419
|
`This cron job won't be active until the project is deployed to production. Run ${getCommandName("deploy --prod")} to deploy.`
|
|
@@ -7239,7 +7422,7 @@ async function add2(client, argv) {
|
|
|
7239
7422
|
}
|
|
7240
7423
|
|
|
7241
7424
|
// src/commands/crons/ls.ts
|
|
7242
|
-
var
|
|
7425
|
+
var import_chalk31 = __toESM(require_source(), 1);
|
|
7243
7426
|
|
|
7244
7427
|
// src/util/telemetry/commands/crons/ls.ts
|
|
7245
7428
|
var CronsLsTelemetryClient = class extends TelemetryClient {
|
|
@@ -7298,7 +7481,7 @@ async function ls3(client, argv) {
|
|
|
7298
7481
|
const { project, org } = link;
|
|
7299
7482
|
const lsStamp = stamp_default();
|
|
7300
7483
|
output_manager_default.spinner(
|
|
7301
|
-
`Fetching cron jobs for ${
|
|
7484
|
+
`Fetching cron jobs for ${import_chalk31.default.bold(`${org.slug}/${project.name}`)}`
|
|
7302
7485
|
);
|
|
7303
7486
|
const projectData = await client.fetch(`/v9/projects/${encodeURIComponent(project.id)}`);
|
|
7304
7487
|
const definitions = projectData.crons?.definitions ?? [];
|
|
@@ -7339,13 +7522,13 @@ async function ls3(client, argv) {
|
|
|
7339
7522
|
`);
|
|
7340
7523
|
} else if (definitions.length === 0 && undeployedCrons.length === 0 && modifiedCrons.length === 0) {
|
|
7341
7524
|
output_manager_default.log(
|
|
7342
|
-
`No cron jobs found for ${
|
|
7525
|
+
`No cron jobs found for ${import_chalk31.default.bold(`${org.slug}/${project.name}`)} ${import_chalk31.default.gray(lsStamp())}`
|
|
7343
7526
|
);
|
|
7344
7527
|
} else {
|
|
7345
7528
|
const totalDeployed = definitions.length;
|
|
7346
7529
|
if (totalDeployed > 0) {
|
|
7347
7530
|
output_manager_default.log(
|
|
7348
|
-
`${totalDeployed} cron ${totalDeployed === 1 ? "job" : "jobs"} found for ${
|
|
7531
|
+
`${totalDeployed} cron ${totalDeployed === 1 ? "job" : "jobs"} found for ${import_chalk31.default.bold(`${org.slug}/${project.name}`)}${isDisabled ? import_chalk31.default.yellow(" (disabled)") : ""} ${import_chalk31.default.gray(lsStamp())}`
|
|
7349
7532
|
);
|
|
7350
7533
|
output_manager_default.print(
|
|
7351
7534
|
formatCronsTable(definitions).replace(/^(.*)/gm, `${" ".repeat(1)}$1`)
|
|
@@ -7373,7 +7556,7 @@ async function ls3(client, argv) {
|
|
|
7373
7556
|
}
|
|
7374
7557
|
function formatCronsTable(definitions) {
|
|
7375
7558
|
const rows = definitions.map((cron) => [
|
|
7376
|
-
|
|
7559
|
+
import_chalk31.default.bold(cron.path),
|
|
7377
7560
|
cron.schedule
|
|
7378
7561
|
]);
|
|
7379
7562
|
return formatTable(["Path", "Schedule"], ["l", "l"], [{ rows }]);
|
|
@@ -7381,14 +7564,14 @@ function formatCronsTable(definitions) {
|
|
|
7381
7564
|
function formatPendingCronsTable(undeployed, modified) {
|
|
7382
7565
|
const rows = [
|
|
7383
7566
|
...modified.map(({ local, deployed }) => [
|
|
7384
|
-
|
|
7385
|
-
`${
|
|
7386
|
-
|
|
7567
|
+
import_chalk31.default.bold(local.path),
|
|
7568
|
+
`${import_chalk31.default.dim(deployed.schedule)} \u2192 ${local.schedule}`,
|
|
7569
|
+
import_chalk31.default.yellow("modified")
|
|
7387
7570
|
]),
|
|
7388
7571
|
...undeployed.map((cron) => [
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7572
|
+
import_chalk31.default.dim(cron.path),
|
|
7573
|
+
import_chalk31.default.dim(cron.schedule),
|
|
7574
|
+
import_chalk31.default.yellow("not deployed")
|
|
7392
7575
|
])
|
|
7393
7576
|
];
|
|
7394
7577
|
return formatTable(
|
|
@@ -7399,7 +7582,7 @@ function formatPendingCronsTable(undeployed, modified) {
|
|
|
7399
7582
|
}
|
|
7400
7583
|
|
|
7401
7584
|
// src/commands/crons/run.ts
|
|
7402
|
-
var
|
|
7585
|
+
var import_chalk32 = __toESM(require_source(), 1);
|
|
7403
7586
|
|
|
7404
7587
|
// src/util/telemetry/commands/crons/run.ts
|
|
7405
7588
|
var CronsRunTelemetryClient = class extends TelemetryClient {
|
|
@@ -7444,19 +7627,19 @@ async function run(client, argv) {
|
|
|
7444
7627
|
const { project, org } = link;
|
|
7445
7628
|
const runStamp = stamp_default();
|
|
7446
7629
|
output_manager_default.spinner(
|
|
7447
|
-
`Fetching cron jobs for ${
|
|
7630
|
+
`Fetching cron jobs for ${import_chalk32.default.bold(`${org.slug}/${project.name}`)}`
|
|
7448
7631
|
);
|
|
7449
7632
|
const projectData = await client.fetch(`/v9/projects/${encodeURIComponent(project.id)}`);
|
|
7450
7633
|
const definitions = projectData.crons?.definitions ?? [];
|
|
7451
7634
|
if (definitions.length === 0) {
|
|
7452
7635
|
output_manager_default.error(
|
|
7453
|
-
`No cron jobs found for ${
|
|
7636
|
+
`No cron jobs found for ${import_chalk32.default.bold(`${org.slug}/${project.name}`)}. Define cron jobs in your vercel.json file.`
|
|
7454
7637
|
);
|
|
7455
7638
|
return 1;
|
|
7456
7639
|
}
|
|
7457
7640
|
if (projectData.crons?.disabledAt != null) {
|
|
7458
7641
|
output_manager_default.error(
|
|
7459
|
-
`Cron jobs are disabled for ${
|
|
7642
|
+
`Cron jobs are disabled for ${import_chalk32.default.bold(`${org.slug}/${project.name}`)}. Enable them in the project settings.`
|
|
7460
7643
|
);
|
|
7461
7644
|
return 1;
|
|
7462
7645
|
}
|
|
@@ -7470,7 +7653,7 @@ async function run(client, argv) {
|
|
|
7470
7653
|
output_manager_default.stopSpinner();
|
|
7471
7654
|
if (definitions.length === 1) {
|
|
7472
7655
|
cronPath = definitions[0].path;
|
|
7473
|
-
output_manager_default.log(`Auto-selected ${
|
|
7656
|
+
output_manager_default.log(`Auto-selected ${import_chalk32.default.bold(cronPath)} (only cron job)`);
|
|
7474
7657
|
} else {
|
|
7475
7658
|
cronPath = await client.input.select({
|
|
7476
7659
|
message: "Which cron job would you like to run?",
|
|
@@ -7484,11 +7667,11 @@ async function run(client, argv) {
|
|
|
7484
7667
|
const cronDef = definitions.find((d) => d.path === cronPath);
|
|
7485
7668
|
if (!cronDef) {
|
|
7486
7669
|
output_manager_default.error(
|
|
7487
|
-
`Cron job with path ${
|
|
7670
|
+
`Cron job with path ${import_chalk32.default.bold(cronPath)} not found. Run ${getCommandName("crons ls")} to see available cron jobs.`
|
|
7488
7671
|
);
|
|
7489
7672
|
return 1;
|
|
7490
7673
|
}
|
|
7491
|
-
output_manager_default.spinner(`Triggering cron job ${
|
|
7674
|
+
output_manager_default.spinner(`Triggering cron job ${import_chalk32.default.bold(cronPath)}`);
|
|
7492
7675
|
const teamId = link.org.type === "team" ? link.org.id : void 0;
|
|
7493
7676
|
const qs = teamId ? `?teamId=${encodeURIComponent(teamId)}` : "";
|
|
7494
7677
|
let result;
|
|
@@ -7507,17 +7690,17 @@ async function run(client, argv) {
|
|
|
7507
7690
|
} catch (err) {
|
|
7508
7691
|
if (isAPIError(err)) {
|
|
7509
7692
|
output_manager_default.error(
|
|
7510
|
-
`Failed to trigger cron job ${
|
|
7693
|
+
`Failed to trigger cron job ${import_chalk32.default.bold(cronPath)}: ${err.message}`
|
|
7511
7694
|
);
|
|
7512
7695
|
return 1;
|
|
7513
7696
|
}
|
|
7514
7697
|
throw err;
|
|
7515
7698
|
}
|
|
7516
7699
|
output_manager_default.log(
|
|
7517
|
-
`Cron job ${
|
|
7700
|
+
`Cron job ${import_chalk32.default.bold(cronPath)} triggered ${import_chalk32.default.gray(runStamp())}`
|
|
7518
7701
|
);
|
|
7519
7702
|
output_manager_default.log(
|
|
7520
|
-
` Invocation time: ${
|
|
7703
|
+
` Invocation time: ${import_chalk32.default.cyan(new Date(result.invocationAt).toISOString())}`
|
|
7521
7704
|
);
|
|
7522
7705
|
return 0;
|
|
7523
7706
|
}
|
|
@@ -7658,11 +7841,11 @@ var CurlTelemetryClient = class extends TelemetryClient {
|
|
|
7658
7841
|
};
|
|
7659
7842
|
|
|
7660
7843
|
// src/commands/curl/shared.ts
|
|
7661
|
-
var
|
|
7844
|
+
var import_chalk34 = __toESM(require_source(), 1);
|
|
7662
7845
|
var import_error_utils6 = __toESM(require_dist(), 1);
|
|
7663
7846
|
|
|
7664
7847
|
// src/commands/curl/bypass-token.ts
|
|
7665
|
-
var
|
|
7848
|
+
var import_chalk33 = __toESM(require_source(), 1);
|
|
7666
7849
|
async function createDeploymentProtectionToken(client, projectId, orgId) {
|
|
7667
7850
|
if (!client.authConfig.token) {
|
|
7668
7851
|
output_manager_default.debug(
|
|
@@ -7686,7 +7869,7 @@ async function createDeploymentProtectionToken(client, projectId, orgId) {
|
|
|
7686
7869
|
`You require a deployment protection bypass token to access this deployment... Generating one now...`
|
|
7687
7870
|
);
|
|
7688
7871
|
output_manager_default.log(
|
|
7689
|
-
`Successfully generated deployment protection bypass token for project ${
|
|
7872
|
+
`Successfully generated deployment protection bypass token for project ${import_chalk33.default.bold(projectId)}
|
|
7690
7873
|
`
|
|
7691
7874
|
);
|
|
7692
7875
|
output_manager_default.debug(`Protection Bypass Response: ${protectionBypass}`);
|
|
@@ -7699,13 +7882,13 @@ async function createDeploymentProtectionToken(client, projectId, orgId) {
|
|
|
7699
7882
|
output_manager_default.note(
|
|
7700
7883
|
'To bypass deployment protection, create a "Protection Bypass for Automation" secret in your project settings:'
|
|
7701
7884
|
);
|
|
7702
|
-
output_manager_default.log(` 1. Visit ${
|
|
7885
|
+
output_manager_default.log(` 1. Visit ${import_chalk33.default.cyan("https://vercel.com/dashboard")}`);
|
|
7703
7886
|
output_manager_default.log(` 2. Go to your project settings \u2192 Deployment Protection`);
|
|
7704
7887
|
output_manager_default.log(` 3. Generate a "Protection Bypass for Automation" secret`);
|
|
7705
7888
|
output_manager_default.log(
|
|
7706
|
-
` 4. Use it with ${
|
|
7889
|
+
` 4. Use it with ${import_chalk33.default.cyan(
|
|
7707
7890
|
"--protection-bypass"
|
|
7708
|
-
)} flag or set ${
|
|
7891
|
+
)} flag or set ${import_chalk33.default.cyan("VERCEL_AUTOMATION_BYPASS_SECRET")} env var`
|
|
7709
7892
|
);
|
|
7710
7893
|
output_manager_default.log("");
|
|
7711
7894
|
throw new Error("Failed to create deployment protection bypass token");
|
|
@@ -7899,7 +8082,7 @@ async function getDeploymentUrlAndToken(client, commandName, path3, options) {
|
|
|
7899
8082
|
throw new Error("No deployment URL found for the project");
|
|
7900
8083
|
}
|
|
7901
8084
|
const fullUrl = `${baseUrl}${path3.startsWith("/") ? path3 : `/${path3}`}`;
|
|
7902
|
-
output_manager_default.debug(`${
|
|
8085
|
+
output_manager_default.debug(`${import_chalk34.default.cyan("Target URL:")} ${import_chalk34.default.bold(fullUrl)}`);
|
|
7903
8086
|
let deploymentProtectionToken = null;
|
|
7904
8087
|
if (project.id) {
|
|
7905
8088
|
try {
|
|
@@ -7969,7 +8152,7 @@ async function curl(client) {
|
|
|
7969
8152
|
}
|
|
7970
8153
|
|
|
7971
8154
|
// src/commands/dns/add.ts
|
|
7972
|
-
var
|
|
8155
|
+
var import_chalk36 = __toESM(require_source(), 1);
|
|
7973
8156
|
|
|
7974
8157
|
// src/util/dns/add-dns-record.ts
|
|
7975
8158
|
async function addDNSRecord(client, domain2, recordData) {
|
|
@@ -8061,7 +8244,7 @@ function parseAddArgs(args) {
|
|
|
8061
8244
|
}
|
|
8062
8245
|
|
|
8063
8246
|
// src/util/dns/get-dns-data.ts
|
|
8064
|
-
var
|
|
8247
|
+
var import_chalk35 = __toESM(require_source(), 1);
|
|
8065
8248
|
var RECORD_TYPES = ["A", "AAAA", "ALIAS", "CAA", "CNAME", "MX", "SRV", "TXT"];
|
|
8066
8249
|
async function getDNSData(client, data) {
|
|
8067
8250
|
if (data) {
|
|
@@ -8080,9 +8263,9 @@ async function getDNSData(client, data) {
|
|
|
8080
8263
|
const port = await getNumber(client, `- ${type} port: `);
|
|
8081
8264
|
const target = await getTrimmedString(client, `- ${type} target: `);
|
|
8082
8265
|
output_manager_default.log(
|
|
8083
|
-
`${
|
|
8266
|
+
`${import_chalk35.default.cyan(name)} ${import_chalk35.default.bold(type)} ${import_chalk35.default.cyan(
|
|
8084
8267
|
`${priority}`
|
|
8085
|
-
)} ${
|
|
8268
|
+
)} ${import_chalk35.default.cyan(`${weight}`)} ${import_chalk35.default.cyan(`${port}`)} ${import_chalk35.default.cyan(
|
|
8086
8269
|
target
|
|
8087
8270
|
)}.`
|
|
8088
8271
|
);
|
|
@@ -8101,9 +8284,9 @@ async function getDNSData(client, data) {
|
|
|
8101
8284
|
const mxPriority = await getNumber(client, `- ${type} priority: `);
|
|
8102
8285
|
const value2 = await getTrimmedString(client, `- ${type} host: `);
|
|
8103
8286
|
output_manager_default.log(
|
|
8104
|
-
`${
|
|
8287
|
+
`${import_chalk35.default.cyan(name)} ${import_chalk35.default.bold(type)} ${import_chalk35.default.cyan(
|
|
8105
8288
|
`${mxPriority}`
|
|
8106
|
-
)} ${
|
|
8289
|
+
)} ${import_chalk35.default.cyan(value2)}`
|
|
8107
8290
|
);
|
|
8108
8291
|
return await verifyData(client) ? {
|
|
8109
8292
|
name,
|
|
@@ -8113,7 +8296,7 @@ async function getDNSData(client, data) {
|
|
|
8113
8296
|
} : null;
|
|
8114
8297
|
}
|
|
8115
8298
|
const value = await getTrimmedString(client, `- ${type} value: `);
|
|
8116
|
-
output_manager_default.log(`${
|
|
8299
|
+
output_manager_default.log(`${import_chalk35.default.cyan(name)} ${import_chalk35.default.bold(type)} ${import_chalk35.default.cyan(value)}`);
|
|
8117
8300
|
return await verifyData(client) ? {
|
|
8118
8301
|
name,
|
|
8119
8302
|
type,
|
|
@@ -8245,7 +8428,7 @@ async function add3(client, argv) {
|
|
|
8245
8428
|
);
|
|
8246
8429
|
}
|
|
8247
8430
|
output_manager_default.error(
|
|
8248
|
-
`Invalid number of arguments. See: ${
|
|
8431
|
+
`Invalid number of arguments. See: ${import_chalk36.default.cyan(
|
|
8249
8432
|
`${getCommandName("dns --help")}`
|
|
8250
8433
|
)} for usage.`
|
|
8251
8434
|
);
|
|
@@ -8332,9 +8515,9 @@ async function add3(client, argv) {
|
|
|
8332
8515
|
);
|
|
8333
8516
|
}
|
|
8334
8517
|
output_manager_default.error(
|
|
8335
|
-
`The domain ${domain2} can't be found under ${
|
|
8518
|
+
`The domain ${domain2} can't be found under ${import_chalk36.default.bold(
|
|
8336
8519
|
contextName
|
|
8337
|
-
)} ${
|
|
8520
|
+
)} ${import_chalk36.default.gray(addStamp())}`
|
|
8338
8521
|
);
|
|
8339
8522
|
return 1;
|
|
8340
8523
|
}
|
|
@@ -8351,9 +8534,9 @@ async function add3(client, argv) {
|
|
|
8351
8534
|
);
|
|
8352
8535
|
}
|
|
8353
8536
|
output_manager_default.error(
|
|
8354
|
-
`You don't have permissions to add records to domain ${domain2} under ${
|
|
8537
|
+
`You don't have permissions to add records to domain ${domain2} under ${import_chalk36.default.bold(
|
|
8355
8538
|
contextName
|
|
8356
|
-
)} ${
|
|
8539
|
+
)} ${import_chalk36.default.gray(addStamp())}`
|
|
8357
8540
|
);
|
|
8358
8541
|
return 1;
|
|
8359
8542
|
}
|
|
@@ -8370,7 +8553,7 @@ async function add3(client, argv) {
|
|
|
8370
8553
|
);
|
|
8371
8554
|
}
|
|
8372
8555
|
output_manager_default.error(
|
|
8373
|
-
`Invalid <port> parameter. A number was expected ${
|
|
8556
|
+
`Invalid <port> parameter. A number was expected ${import_chalk36.default.gray(
|
|
8374
8557
|
addStamp()
|
|
8375
8558
|
)}`
|
|
8376
8559
|
);
|
|
@@ -8389,7 +8572,7 @@ async function add3(client, argv) {
|
|
|
8389
8572
|
);
|
|
8390
8573
|
}
|
|
8391
8574
|
output_manager_default.error(
|
|
8392
|
-
`Invalid <type> parameter "${record.meta.type}". Expected one of A, AAAA, ALIAS, CAA, CNAME, MX, SRV, TXT ${
|
|
8575
|
+
`Invalid <type> parameter "${record.meta.type}". Expected one of A, AAAA, ALIAS, CAA, CNAME, MX, SRV, TXT ${import_chalk36.default.gray(
|
|
8393
8576
|
addStamp()
|
|
8394
8577
|
)}`
|
|
8395
8578
|
);
|
|
@@ -8411,23 +8594,23 @@ async function add3(client, argv) {
|
|
|
8411
8594
|
return 1;
|
|
8412
8595
|
}
|
|
8413
8596
|
output_manager_default.success(
|
|
8414
|
-
`DNS record for domain ${
|
|
8597
|
+
`DNS record for domain ${import_chalk36.default.bold(domain2)} ${import_chalk36.default.gray(
|
|
8415
8598
|
`(${record.uid})`
|
|
8416
|
-
)} created under ${
|
|
8599
|
+
)} created under ${import_chalk36.default.bold(contextName)} ${import_chalk36.default.gray(addStamp())}`
|
|
8417
8600
|
);
|
|
8418
8601
|
return 0;
|
|
8419
8602
|
}
|
|
8420
8603
|
|
|
8421
8604
|
// src/commands/dns/import.ts
|
|
8422
|
-
var
|
|
8605
|
+
var import_chalk38 = __toESM(require_source(), 1);
|
|
8423
8606
|
|
|
8424
8607
|
// src/util/dns/import-zonefile.ts
|
|
8425
|
-
var
|
|
8608
|
+
var import_chalk37 = __toESM(require_source(), 1);
|
|
8426
8609
|
import { readFileSync as readFileSync2 } from "fs";
|
|
8427
8610
|
import { resolve as resolve6 } from "path";
|
|
8428
8611
|
async function importZonefile(client, contextName, domain2, zonefilePath) {
|
|
8429
8612
|
output_manager_default.spinner(
|
|
8430
|
-
`Importing Zone file for domain ${domain2} under ${
|
|
8613
|
+
`Importing Zone file for domain ${domain2} under ${import_chalk37.default.bold(contextName)}`
|
|
8431
8614
|
);
|
|
8432
8615
|
const zonefile = readFileSync2(resolve6(zonefilePath), "utf8");
|
|
8433
8616
|
try {
|
|
@@ -8529,7 +8712,7 @@ async function importZone(client, argv) {
|
|
|
8529
8712
|
);
|
|
8530
8713
|
}
|
|
8531
8714
|
output_manager_default.error(
|
|
8532
|
-
`Invalid number of arguments. Usage: ${
|
|
8715
|
+
`Invalid number of arguments. Usage: ${import_chalk38.default.cyan(
|
|
8533
8716
|
`${getCommandName("dns import <domain> <zonefile>")}`
|
|
8534
8717
|
)}`
|
|
8535
8718
|
);
|
|
@@ -8564,9 +8747,9 @@ async function importZone(client, argv) {
|
|
|
8564
8747
|
);
|
|
8565
8748
|
}
|
|
8566
8749
|
output_manager_default.error(
|
|
8567
|
-
`The domain ${domain2} can't be found under ${
|
|
8750
|
+
`The domain ${domain2} can't be found under ${import_chalk38.default.bold(
|
|
8568
8751
|
contextName
|
|
8569
|
-
)} ${
|
|
8752
|
+
)} ${import_chalk38.default.gray(addStamp())}`
|
|
8570
8753
|
);
|
|
8571
8754
|
return 1;
|
|
8572
8755
|
}
|
|
@@ -8583,22 +8766,22 @@ async function importZone(client, argv) {
|
|
|
8583
8766
|
);
|
|
8584
8767
|
}
|
|
8585
8768
|
output_manager_default.error(
|
|
8586
|
-
`The domain ${domain2} doesn't match with the one found in the Zone file ${
|
|
8769
|
+
`The domain ${domain2} doesn't match with the one found in the Zone file ${import_chalk38.default.gray(
|
|
8587
8770
|
addStamp()
|
|
8588
8771
|
)}`
|
|
8589
8772
|
);
|
|
8590
8773
|
return 1;
|
|
8591
8774
|
}
|
|
8592
8775
|
output_manager_default.success(
|
|
8593
|
-
`${recordIds.length} DNS records for domain ${
|
|
8776
|
+
`${recordIds.length} DNS records for domain ${import_chalk38.default.bold(
|
|
8594
8777
|
domain2
|
|
8595
|
-
)} created under ${
|
|
8778
|
+
)} created under ${import_chalk38.default.bold(contextName)} ${import_chalk38.default.gray(addStamp())}`
|
|
8596
8779
|
);
|
|
8597
8780
|
return 0;
|
|
8598
8781
|
}
|
|
8599
8782
|
|
|
8600
8783
|
// src/commands/dns/ls.ts
|
|
8601
|
-
var
|
|
8784
|
+
var import_chalk40 = __toESM(require_source(), 1);
|
|
8602
8785
|
var import_ms8 = __toESM(require_ms(), 1);
|
|
8603
8786
|
|
|
8604
8787
|
// src/util/dns/get-domain-dns-records.ts
|
|
@@ -8631,7 +8814,7 @@ async function getDomains(client, next, limit = 20) {
|
|
|
8631
8814
|
}
|
|
8632
8815
|
|
|
8633
8816
|
// src/util/dns/get-dns-records.ts
|
|
8634
|
-
var
|
|
8817
|
+
var import_chalk39 = __toESM(require_source(), 1);
|
|
8635
8818
|
async function getDNSRecords(client, contextName, next) {
|
|
8636
8819
|
const { domainNames, pagination } = await getDomainNames(
|
|
8637
8820
|
client,
|
|
@@ -8668,7 +8851,7 @@ function getAddDomainName(domainNames) {
|
|
|
8668
8851
|
];
|
|
8669
8852
|
}
|
|
8670
8853
|
async function getDomainNames(client, contextName, next) {
|
|
8671
|
-
output_manager_default.spinner(`Fetching domains under ${
|
|
8854
|
+
output_manager_default.spinner(`Fetching domains under ${import_chalk39.default.bold(contextName)}`);
|
|
8672
8855
|
const { domains: domains2, pagination } = await getDomains(client, next);
|
|
8673
8856
|
return { domainNames: domains2.map((domain2) => domain2.name), pagination };
|
|
8674
8857
|
}
|
|
@@ -8797,15 +8980,15 @@ async function ls4(client, argv) {
|
|
|
8797
8980
|
);
|
|
8798
8981
|
}
|
|
8799
8982
|
output_manager_default.error(
|
|
8800
|
-
`The domain ${domainName} can't be found under ${
|
|
8983
|
+
`The domain ${domainName} can't be found under ${import_chalk40.default.bold(
|
|
8801
8984
|
contextName
|
|
8802
|
-
)} ${
|
|
8985
|
+
)} ${import_chalk40.default.gray(lsStamp())}`
|
|
8803
8986
|
);
|
|
8804
8987
|
return 1;
|
|
8805
8988
|
}
|
|
8806
8989
|
const { records, pagination: pagination2 } = data;
|
|
8807
8990
|
output_manager_default.log(
|
|
8808
|
-
`${records.length > 0 ? "Records" : "No records"} found under ${
|
|
8991
|
+
`${records.length > 0 ? "Records" : "No records"} found under ${import_chalk40.default.bold(contextName)} ${import_chalk40.default.gray(lsStamp())}`
|
|
8809
8992
|
);
|
|
8810
8993
|
client.stdout.write(getDNSRecordsTable([{ domainName, records }]));
|
|
8811
8994
|
if (pagination2 && pagination2.count === 20) {
|
|
@@ -8825,9 +9008,9 @@ async function ls4(client, argv) {
|
|
|
8825
9008
|
);
|
|
8826
9009
|
const nRecords = dnsRecords.reduce((p, r) => r.records.length + p, 0);
|
|
8827
9010
|
output_manager_default.log(
|
|
8828
|
-
`${nRecords > 0 ? "Records" : "No records"} found under ${
|
|
9011
|
+
`${nRecords > 0 ? "Records" : "No records"} found under ${import_chalk40.default.bold(
|
|
8829
9012
|
contextName
|
|
8830
|
-
)} ${
|
|
9013
|
+
)} ${import_chalk40.default.gray(lsStamp())}`
|
|
8831
9014
|
);
|
|
8832
9015
|
output_manager_default.log(getDNSRecordsTable(dnsRecords));
|
|
8833
9016
|
if (pagination && pagination.count === 20) {
|
|
@@ -8845,7 +9028,7 @@ function getDNSRecordsTable(dnsRecords) {
|
|
|
8845
9028
|
["", "id", "name", "type", "value", "created"],
|
|
8846
9029
|
["l", "r", "l", "l", "l", "l"],
|
|
8847
9030
|
dnsRecords.map(({ domainName, records }) => ({
|
|
8848
|
-
name:
|
|
9031
|
+
name: import_chalk40.default.bold(domainName),
|
|
8849
9032
|
rows: records.map(getDNSRecordRow)
|
|
8850
9033
|
}))
|
|
8851
9034
|
);
|
|
@@ -8862,12 +9045,12 @@ function getDNSRecordRow(record) {
|
|
|
8862
9045
|
record.name,
|
|
8863
9046
|
record.type,
|
|
8864
9047
|
priority ? `${priority} ${record.value}` : record.value,
|
|
8865
|
-
|
|
9048
|
+
import_chalk40.default.gray(isSystemRecord ? "default" : createdAt)
|
|
8866
9049
|
];
|
|
8867
9050
|
}
|
|
8868
9051
|
|
|
8869
9052
|
// src/commands/dns/rm.ts
|
|
8870
|
-
var
|
|
9053
|
+
var import_chalk41 = __toESM(require_source(), 1);
|
|
8871
9054
|
var import_ms9 = __toESM(require_ms(), 1);
|
|
8872
9055
|
|
|
8873
9056
|
// src/util/dns/delete-dns-record-by-id.ts
|
|
@@ -8957,7 +9140,7 @@ async function rm3(client, argv) {
|
|
|
8957
9140
|
);
|
|
8958
9141
|
}
|
|
8959
9142
|
output_manager_default.error(
|
|
8960
|
-
`Invalid number of arguments. Usage: ${
|
|
9143
|
+
`Invalid number of arguments. Usage: ${import_chalk41.default.cyan(
|
|
8961
9144
|
`${getCommandName("dns rm <id>")}`
|
|
8962
9145
|
)}`
|
|
8963
9146
|
);
|
|
@@ -9021,7 +9204,7 @@ async function rm3(client, argv) {
|
|
|
9021
9204
|
const rmStamp = stamp_default();
|
|
9022
9205
|
await deleteDNSRecordById(client, domainName, record.id);
|
|
9023
9206
|
output_manager_default.success(
|
|
9024
|
-
`Record ${
|
|
9207
|
+
`Record ${import_chalk41.default.gray(`${record.id}`)} removed ${import_chalk41.default.gray(rmStamp())}`
|
|
9025
9208
|
);
|
|
9026
9209
|
return 0;
|
|
9027
9210
|
}
|
|
@@ -9036,7 +9219,7 @@ function readConfirmation2(client, msg, domainName, record) {
|
|
|
9036
9219
|
`
|
|
9037
9220
|
);
|
|
9038
9221
|
output_manager_default.print(
|
|
9039
|
-
`${
|
|
9222
|
+
`${import_chalk41.default.bold.red("> Are you sure?")} ${import_chalk41.default.gray("(y/N) ")}`
|
|
9040
9223
|
);
|
|
9041
9224
|
client.stdin.on("data", (d) => {
|
|
9042
9225
|
process.stdin.pause();
|
|
@@ -9048,10 +9231,10 @@ function getDeleteTableRow(domainName, record) {
|
|
|
9048
9231
|
const recordName = `${record.name.length > 0 ? `${record.name}.` : ""}${domainName}`;
|
|
9049
9232
|
return [
|
|
9050
9233
|
record.id,
|
|
9051
|
-
|
|
9234
|
+
import_chalk41.default.bold(
|
|
9052
9235
|
`${recordName} ${record.type} ${record.value} ${record.mxPriority || ""}`
|
|
9053
9236
|
),
|
|
9054
|
-
|
|
9237
|
+
import_chalk41.default.gray(
|
|
9055
9238
|
`${(0, import_ms9.default)(Date.now() - new Date(Number(record.createdAt)).getTime())} ago`
|
|
9056
9239
|
)
|
|
9057
9240
|
];
|
|
@@ -9161,10 +9344,10 @@ async function dns(client) {
|
|
|
9161
9344
|
}
|
|
9162
9345
|
|
|
9163
9346
|
// src/commands/domains/add.ts
|
|
9164
|
-
var
|
|
9347
|
+
var import_chalk45 = __toESM(require_source(), 1);
|
|
9165
9348
|
|
|
9166
9349
|
// src/util/format-ns-table.ts
|
|
9167
|
-
var
|
|
9350
|
+
var import_chalk42 = __toESM(require_source(), 1);
|
|
9168
9351
|
|
|
9169
9352
|
// src/util/output/chars.ts
|
|
9170
9353
|
var chars = {
|
|
@@ -9184,16 +9367,16 @@ function formatNSTable(intendedNameservers, currentNameservers, { extraSpace = "
|
|
|
9184
9367
|
const rows = [];
|
|
9185
9368
|
for (let i = 0; i < maxLength; i++) {
|
|
9186
9369
|
rows.push([
|
|
9187
|
-
sortedIntended[i] ||
|
|
9188
|
-
sortedCurrent[i] ||
|
|
9189
|
-
sortedIntended[i] === sortedCurrent[i] ?
|
|
9370
|
+
sortedIntended[i] || import_chalk42.default.gray("-"),
|
|
9371
|
+
sortedCurrent[i] || import_chalk42.default.gray("-"),
|
|
9372
|
+
sortedIntended[i] === sortedCurrent[i] ? import_chalk42.default.green(chars_default.tick) : import_chalk42.default.red(chars_default.cross)
|
|
9190
9373
|
]);
|
|
9191
9374
|
}
|
|
9192
9375
|
return table(
|
|
9193
9376
|
[
|
|
9194
9377
|
[
|
|
9195
|
-
|
|
9196
|
-
|
|
9378
|
+
import_chalk42.default.gray("Intended Nameservers"),
|
|
9379
|
+
import_chalk42.default.gray("Current Nameservers"),
|
|
9197
9380
|
""
|
|
9198
9381
|
],
|
|
9199
9382
|
...rows
|
|
@@ -9223,10 +9406,10 @@ async function getDomainConfig(client, domainName) {
|
|
|
9223
9406
|
}
|
|
9224
9407
|
|
|
9225
9408
|
// src/util/projects/add-domain-to-project.ts
|
|
9226
|
-
var
|
|
9409
|
+
var import_chalk43 = __toESM(require_source(), 1);
|
|
9227
9410
|
async function addDomainToProject(client, projectNameOrId, domain2) {
|
|
9228
9411
|
output_manager_default.spinner(
|
|
9229
|
-
`Adding domain ${domain2} to project ${
|
|
9412
|
+
`Adding domain ${domain2} to project ${import_chalk43.default.bold(projectNameOrId)}`
|
|
9230
9413
|
);
|
|
9231
9414
|
try {
|
|
9232
9415
|
const response = await client.fetch(
|
|
@@ -9257,10 +9440,10 @@ async function addDomainToProject(client, projectNameOrId, domain2) {
|
|
|
9257
9440
|
}
|
|
9258
9441
|
|
|
9259
9442
|
// src/util/projects/remove-domain-from-project.ts
|
|
9260
|
-
var
|
|
9443
|
+
var import_chalk44 = __toESM(require_source(), 1);
|
|
9261
9444
|
async function removeDomainFromProject(client, projectNameOrId, domain2) {
|
|
9262
9445
|
output_manager_default.spinner(
|
|
9263
|
-
`Removing domain ${domain2} from project ${
|
|
9446
|
+
`Removing domain ${domain2} from project ${import_chalk44.default.bold(projectNameOrId)}`
|
|
9264
9447
|
);
|
|
9265
9448
|
try {
|
|
9266
9449
|
const response = await client.fetch(
|
|
@@ -9502,7 +9685,7 @@ async function add4(client, argv) {
|
|
|
9502
9685
|
}
|
|
9503
9686
|
}
|
|
9504
9687
|
output_manager_default.success(
|
|
9505
|
-
`Domain ${
|
|
9688
|
+
`Domain ${import_chalk45.default.bold(domainName)} added to project ${import_chalk45.default.bold(
|
|
9506
9689
|
projectName
|
|
9507
9690
|
)}. ${addStamp()}`
|
|
9508
9691
|
);
|
|
@@ -9534,11 +9717,11 @@ async function add4(client, argv) {
|
|
|
9534
9717
|
"This domain is not configured properly. To configure it you should either:"
|
|
9535
9718
|
);
|
|
9536
9719
|
output_manager_default.print(
|
|
9537
|
-
` ${
|
|
9720
|
+
` ${import_chalk45.default.grey("a)")} Set the following record on your DNS provider to continue: ${code(`A ${domainName} 76.76.21.21`)} ${import_chalk45.default.grey("[recommended]")}
|
|
9538
9721
|
`
|
|
9539
9722
|
);
|
|
9540
9723
|
output_manager_default.print(
|
|
9541
|
-
` ${
|
|
9724
|
+
` ${import_chalk45.default.grey("b)")} Change your Domains's nameservers to the intended set`
|
|
9542
9725
|
);
|
|
9543
9726
|
output_manager_default.print(
|
|
9544
9727
|
`
|
|
@@ -9563,7 +9746,7 @@ ${formatNSTable(
|
|
|
9563
9746
|
}
|
|
9564
9747
|
|
|
9565
9748
|
// src/commands/domains/transfer-in.ts
|
|
9566
|
-
var
|
|
9749
|
+
var import_chalk46 = __toESM(require_source(), 1);
|
|
9567
9750
|
|
|
9568
9751
|
// src/util/domains/transfer-in-domain.ts
|
|
9569
9752
|
async function transferInDomain(client, name, authCode, expectedPrice, years) {
|
|
@@ -9714,13 +9897,13 @@ async function transferIn(client, argv) {
|
|
|
9714
9897
|
}
|
|
9715
9898
|
const { contextName } = await getScope(client);
|
|
9716
9899
|
output_manager_default.log(
|
|
9717
|
-
`The domain ${param(domainName)} is ${
|
|
9900
|
+
`The domain ${param(domainName)} is ${import_chalk46.default.underline(
|
|
9718
9901
|
"available"
|
|
9719
|
-
)} to transfer under ${
|
|
9902
|
+
)} to transfer under ${import_chalk46.default.bold(contextName)}! ${availableStamp()}`
|
|
9720
9903
|
);
|
|
9721
9904
|
const authCode = await getAuthCode(client, opts["--code"]);
|
|
9722
9905
|
const shouldTransfer = await client.input.confirm(
|
|
9723
|
-
`Transfer now with 1yr renewal for ${
|
|
9906
|
+
`Transfer now with 1yr renewal for ${import_chalk46.default.bold(`$${transferPrice}`)}?`,
|
|
9724
9907
|
false
|
|
9725
9908
|
);
|
|
9726
9909
|
if (!shouldTransfer) {
|
|
@@ -9789,7 +9972,7 @@ async function transferIn(client, argv) {
|
|
|
9789
9972
|
}
|
|
9790
9973
|
|
|
9791
9974
|
// src/commands/domains/inspect.ts
|
|
9792
|
-
var
|
|
9975
|
+
var import_chalk47 = __toESM(require_source(), 1);
|
|
9793
9976
|
|
|
9794
9977
|
// src/util/projects/find-projects-for-domain.ts
|
|
9795
9978
|
async function findProjectsForDomain(client, domainName) {
|
|
@@ -9865,7 +10048,7 @@ async function inspect(client, argv) {
|
|
|
9865
10048
|
telemetry2.trackCliArgumentDomain(domainName);
|
|
9866
10049
|
if (args.length !== 1) {
|
|
9867
10050
|
output_manager_default.error(
|
|
9868
|
-
`Invalid number of arguments. Usage: ${
|
|
10051
|
+
`Invalid number of arguments. Usage: ${import_chalk47.default.cyan(
|
|
9869
10052
|
`${getCommandName("domains inspect <domain>")}`
|
|
9870
10053
|
)}`
|
|
9871
10054
|
);
|
|
@@ -9874,7 +10057,7 @@ async function inspect(client, argv) {
|
|
|
9874
10057
|
output_manager_default.debug(`Fetching domain info`);
|
|
9875
10058
|
const { contextName } = await getScope(client);
|
|
9876
10059
|
output_manager_default.spinner(
|
|
9877
|
-
`Fetching Domain ${domainName} under ${
|
|
10060
|
+
`Fetching Domain ${domainName} under ${import_chalk47.default.bold(contextName)}`
|
|
9878
10061
|
);
|
|
9879
10062
|
const information = await fetchInformation({
|
|
9880
10063
|
client,
|
|
@@ -9886,38 +10069,38 @@ async function inspect(client, argv) {
|
|
|
9886
10069
|
}
|
|
9887
10070
|
const { domain: domain2, projects, renewalPrice, domainConfig } = information;
|
|
9888
10071
|
output_manager_default.log(
|
|
9889
|
-
`Domain ${domainName} found under ${
|
|
10072
|
+
`Domain ${domainName} found under ${import_chalk47.default.bold(contextName)} ${import_chalk47.default.gray(
|
|
9890
10073
|
inspectStamp()
|
|
9891
10074
|
)}`
|
|
9892
10075
|
);
|
|
9893
10076
|
output_manager_default.print("\n");
|
|
9894
|
-
output_manager_default.print(
|
|
9895
|
-
output_manager_default.print(` ${
|
|
10077
|
+
output_manager_default.print(import_chalk47.default.bold(" General\n\n"));
|
|
10078
|
+
output_manager_default.print(` ${import_chalk47.default.cyan("Name")} ${domain2.name}
|
|
9896
10079
|
`);
|
|
9897
10080
|
output_manager_default.print(
|
|
9898
|
-
` ${
|
|
10081
|
+
` ${import_chalk47.default.cyan("Registrar")} ${getDomainRegistrar(domain2)}
|
|
9899
10082
|
`
|
|
9900
10083
|
);
|
|
9901
10084
|
output_manager_default.print(
|
|
9902
|
-
` ${
|
|
10085
|
+
` ${import_chalk47.default.cyan("Expiration Date")} ${formatDate(domain2.expiresAt)}
|
|
9903
10086
|
`
|
|
9904
10087
|
);
|
|
9905
10088
|
output_manager_default.print(
|
|
9906
|
-
` ${
|
|
10089
|
+
` ${import_chalk47.default.cyan("Creator")} ${domain2.creator.username}
|
|
9907
10090
|
`
|
|
9908
10091
|
);
|
|
9909
10092
|
output_manager_default.print(
|
|
9910
|
-
` ${
|
|
10093
|
+
` ${import_chalk47.default.cyan("Created At")} ${formatDate(domain2.createdAt)}
|
|
9911
10094
|
`
|
|
9912
10095
|
);
|
|
9913
|
-
output_manager_default.print(` ${
|
|
10096
|
+
output_manager_default.print(` ${import_chalk47.default.cyan("Edge Network")} yes
|
|
9914
10097
|
`);
|
|
9915
10098
|
output_manager_default.print(
|
|
9916
|
-
` ${
|
|
10099
|
+
` ${import_chalk47.default.cyan("Renewal Price")} ${domain2.boughtAt && renewalPrice ? `$${renewalPrice} USD` : import_chalk47.default.gray("-")}
|
|
9917
10100
|
`
|
|
9918
10101
|
);
|
|
9919
10102
|
output_manager_default.print("\n");
|
|
9920
|
-
output_manager_default.print(
|
|
10103
|
+
output_manager_default.print(import_chalk47.default.bold(" Nameservers\n\n"));
|
|
9921
10104
|
output_manager_default.print(
|
|
9922
10105
|
`${formatNSTable(domain2.intendedNameservers, domain2.nameservers, {
|
|
9923
10106
|
extraSpace: " "
|
|
@@ -9926,7 +10109,7 @@ async function inspect(client, argv) {
|
|
|
9926
10109
|
);
|
|
9927
10110
|
output_manager_default.print("\n");
|
|
9928
10111
|
if (Array.isArray(projects) && projects.length > 0) {
|
|
9929
|
-
output_manager_default.print(
|
|
10112
|
+
output_manager_default.print(import_chalk47.default.bold(" Projects\n"));
|
|
9930
10113
|
const table3 = formatTable(
|
|
9931
10114
|
["Project", "Domains"],
|
|
9932
10115
|
["l", "l"],
|
|
@@ -9956,11 +10139,11 @@ async function inspect(client, argv) {
|
|
|
9956
10139
|
null
|
|
9957
10140
|
);
|
|
9958
10141
|
output_manager_default.print(
|
|
9959
|
-
` ${
|
|
10142
|
+
` ${import_chalk47.default.grey("a)")} Set the following record on your DNS provider to continue: ${code(`A ${domainName} 76.76.21.21`)} ${import_chalk47.default.grey("[recommended]")}
|
|
9960
10143
|
`
|
|
9961
10144
|
);
|
|
9962
10145
|
output_manager_default.print(
|
|
9963
|
-
` ${
|
|
10146
|
+
` ${import_chalk47.default.grey("b)")} Change your Domains's nameservers to the intended set detailed above.
|
|
9964
10147
|
|
|
9965
10148
|
`
|
|
9966
10149
|
);
|
|
@@ -10022,7 +10205,7 @@ async function fetchInformation({
|
|
|
10022
10205
|
|
|
10023
10206
|
// src/commands/domains/ls.ts
|
|
10024
10207
|
var import_ms10 = __toESM(require_ms(), 1);
|
|
10025
|
-
var
|
|
10208
|
+
var import_chalk48 = __toESM(require_source(), 1);
|
|
10026
10209
|
var import_pluralize5 = __toESM(require_pluralize(), 1);
|
|
10027
10210
|
|
|
10028
10211
|
// src/util/telemetry/commands/domains/ls.ts
|
|
@@ -10090,7 +10273,7 @@ async function ls5(client, argv) {
|
|
|
10090
10273
|
resolveLocalScope: true
|
|
10091
10274
|
});
|
|
10092
10275
|
const lsStamp = stamp_default();
|
|
10093
|
-
output_manager_default.spinner(`Fetching Domains under ${
|
|
10276
|
+
output_manager_default.spinner(`Fetching Domains under ${import_chalk48.default.bold(contextName)}`);
|
|
10094
10277
|
const { domains: domains2, pagination } = await getDomains(
|
|
10095
10278
|
client,
|
|
10096
10279
|
...paginationOptions
|
|
@@ -10112,9 +10295,9 @@ async function ls5(client, argv) {
|
|
|
10112
10295
|
`);
|
|
10113
10296
|
} else {
|
|
10114
10297
|
output_manager_default.log(
|
|
10115
|
-
`${(0, import_pluralize5.default)("Domain", domains2.length, true)} found under ${
|
|
10298
|
+
`${(0, import_pluralize5.default)("Domain", domains2.length, true)} found under ${import_chalk48.default.bold(
|
|
10116
10299
|
contextName
|
|
10117
|
-
)} ${
|
|
10300
|
+
)} ${import_chalk48.default.gray(lsStamp())}`
|
|
10118
10301
|
);
|
|
10119
10302
|
if (domains2.length > 0) {
|
|
10120
10303
|
output_manager_default.print(
|
|
@@ -10144,7 +10327,7 @@ function formatDomainsTable(domains2) {
|
|
|
10144
10327
|
isDomainExternal(domain2) ? "Third Party" : "Vercel",
|
|
10145
10328
|
expiration,
|
|
10146
10329
|
domain2.creator.username,
|
|
10147
|
-
|
|
10330
|
+
import_chalk48.default.gray(age)
|
|
10148
10331
|
];
|
|
10149
10332
|
});
|
|
10150
10333
|
return formatTable(
|
|
@@ -10155,7 +10338,7 @@ function formatDomainsTable(domains2) {
|
|
|
10155
10338
|
}
|
|
10156
10339
|
|
|
10157
10340
|
// src/commands/domains/rm.ts
|
|
10158
|
-
var
|
|
10341
|
+
var import_chalk49 = __toESM(require_source(), 1);
|
|
10159
10342
|
var import_pluralize6 = __toESM(require_pluralize(), 1);
|
|
10160
10343
|
|
|
10161
10344
|
// src/util/domains/remove-domain-by-name.ts
|
|
@@ -10267,7 +10450,7 @@ async function rm4(client, argv) {
|
|
|
10267
10450
|
const { contextName } = await getScope(client);
|
|
10268
10451
|
if (args.length !== 1) {
|
|
10269
10452
|
output_manager_default.error(
|
|
10270
|
-
`Invalid number of arguments. Usage: ${
|
|
10453
|
+
`Invalid number of arguments. Usage: ${import_chalk49.default.cyan(
|
|
10271
10454
|
`${getCommandName("domains rm <domain>")}`
|
|
10272
10455
|
)}`
|
|
10273
10456
|
);
|
|
@@ -10276,14 +10459,14 @@ async function rm4(client, argv) {
|
|
|
10276
10459
|
const domain2 = await getDomainByName(client, contextName, domainName);
|
|
10277
10460
|
if (domain2 instanceof DomainNotFound || domain2.name !== domainName) {
|
|
10278
10461
|
output_manager_default.error(
|
|
10279
|
-
`Domain not found by "${domainName}" under ${
|
|
10462
|
+
`Domain not found by "${domainName}" under ${import_chalk49.default.bold(contextName)}`
|
|
10280
10463
|
);
|
|
10281
10464
|
output_manager_default.log(`Run ${getCommandName(`domains ls`)} to see your domains.`);
|
|
10282
10465
|
return 1;
|
|
10283
10466
|
}
|
|
10284
10467
|
if (domain2 instanceof DomainPermissionDenied) {
|
|
10285
10468
|
output_manager_default.error(
|
|
10286
|
-
`You don't have access to the domain ${domainName} under ${
|
|
10469
|
+
`You don't have access to the domain ${domainName} under ${import_chalk49.default.bold(
|
|
10287
10470
|
contextName
|
|
10288
10471
|
)}`
|
|
10289
10472
|
);
|
|
@@ -10343,15 +10526,15 @@ async function removeDomain(client, contextName, skipConfirmation, domain2, alia
|
|
|
10343
10526
|
domain2.name
|
|
10344
10527
|
);
|
|
10345
10528
|
if (removeResult instanceof DomainNotFound) {
|
|
10346
|
-
output_manager_default.error(`Domain not found under ${
|
|
10529
|
+
output_manager_default.error(`Domain not found under ${import_chalk49.default.bold(contextName)}`);
|
|
10347
10530
|
output_manager_default.log(`Run ${getCommandName(`domains ls`)} to see your domains.`);
|
|
10348
10531
|
return 1;
|
|
10349
10532
|
}
|
|
10350
10533
|
if (removeResult instanceof DomainPermissionDenied) {
|
|
10351
10534
|
output_manager_default.error(
|
|
10352
|
-
`You don't have permissions over domain ${
|
|
10535
|
+
`You don't have permissions over domain ${import_chalk49.default.underline(
|
|
10353
10536
|
removeResult.meta.domain
|
|
10354
|
-
)} under ${
|
|
10537
|
+
)} under ${import_chalk49.default.bold(removeResult.meta.context)}.`
|
|
10355
10538
|
);
|
|
10356
10539
|
return 1;
|
|
10357
10540
|
}
|
|
@@ -10393,21 +10576,21 @@ async function removeDomain(client, contextName, skipConfirmation, domain2, alia
|
|
|
10393
10576
|
);
|
|
10394
10577
|
if (aliases.length > 0) {
|
|
10395
10578
|
output_manager_default.warn(
|
|
10396
|
-
`This domain's ${
|
|
10579
|
+
`This domain's ${import_chalk49.default.bold(
|
|
10397
10580
|
(0, import_pluralize6.default)("alias", aliases.length, true)
|
|
10398
10581
|
)} will be removed. Run ${getCommandName(`alias ls`)} to list them.`
|
|
10399
10582
|
);
|
|
10400
10583
|
}
|
|
10401
10584
|
if (certs.length > 0) {
|
|
10402
10585
|
output_manager_default.warn(
|
|
10403
|
-
`This domain's ${
|
|
10586
|
+
`This domain's ${import_chalk49.default.bold(
|
|
10404
10587
|
(0, import_pluralize6.default)("certificate", certs.length, true)
|
|
10405
10588
|
)} will be removed. Run ${getCommandName(`cert ls`)} to list them.`
|
|
10406
10589
|
);
|
|
10407
10590
|
}
|
|
10408
10591
|
if (suffix2) {
|
|
10409
10592
|
output_manager_default.warn(
|
|
10410
|
-
`The ${
|
|
10593
|
+
`The ${import_chalk49.default.bold(`custom suffix`)} associated with this domain.`
|
|
10411
10594
|
);
|
|
10412
10595
|
}
|
|
10413
10596
|
if (!skipConfirmation && !await client.input.confirm(
|
|
@@ -10428,12 +10611,12 @@ async function removeDomain(client, contextName, skipConfirmation, domain2, alia
|
|
|
10428
10611
|
attempt + 1
|
|
10429
10612
|
);
|
|
10430
10613
|
}
|
|
10431
|
-
output_manager_default.success(`Domain ${
|
|
10614
|
+
output_manager_default.success(`Domain ${import_chalk49.default.bold(domain2.name)} removed ${removeStamp()}`);
|
|
10432
10615
|
return 0;
|
|
10433
10616
|
}
|
|
10434
10617
|
|
|
10435
10618
|
// src/commands/domains/move.ts
|
|
10436
|
-
var
|
|
10619
|
+
var import_chalk50 = __toESM(require_source(), 1);
|
|
10437
10620
|
var import_pluralize7 = __toESM(require_pluralize(), 1);
|
|
10438
10621
|
|
|
10439
10622
|
// src/util/domains/move-out-domain.ts
|
|
@@ -10533,15 +10716,15 @@ async function move(client, argv) {
|
|
|
10533
10716
|
}
|
|
10534
10717
|
const domain2 = await getDomainByName(client, contextName, domainName);
|
|
10535
10718
|
if (domain2 instanceof DomainNotFound) {
|
|
10536
|
-
output_manager_default.error(`Domain not found under ${
|
|
10719
|
+
output_manager_default.error(`Domain not found under ${import_chalk50.default.bold(contextName)}`);
|
|
10537
10720
|
output_manager_default.log(`Run ${getCommandName(`domains ls`)} to see your domains.`);
|
|
10538
10721
|
return 1;
|
|
10539
10722
|
}
|
|
10540
10723
|
if (domain2 instanceof DomainPermissionDenied) {
|
|
10541
10724
|
output_manager_default.error(
|
|
10542
|
-
`You don't have permissions over domain ${
|
|
10725
|
+
`You don't have permissions over domain ${import_chalk50.default.underline(
|
|
10543
10726
|
domain2.meta.domain
|
|
10544
|
-
)} under ${
|
|
10727
|
+
)} under ${import_chalk50.default.bold(domain2.meta.context)}.`
|
|
10545
10728
|
);
|
|
10546
10729
|
return 1;
|
|
10547
10730
|
}
|
|
@@ -10571,7 +10754,7 @@ async function move(client, argv) {
|
|
|
10571
10754
|
const aliases = await getDomainAliases(client, domainName);
|
|
10572
10755
|
if (aliases.length > 0) {
|
|
10573
10756
|
output_manager_default.warn(
|
|
10574
|
-
`This domain's ${
|
|
10757
|
+
`This domain's ${import_chalk50.default.bold(
|
|
10575
10758
|
(0, import_pluralize7.default)("alias", aliases.length, true)
|
|
10576
10759
|
)} will be removed. Run ${getCommandName(`alias ls`)} to list them.`
|
|
10577
10760
|
);
|
|
@@ -10612,21 +10795,21 @@ async function move(client, argv) {
|
|
|
10612
10795
|
return 1;
|
|
10613
10796
|
}
|
|
10614
10797
|
if (moveTokenResult instanceof DomainNotFound) {
|
|
10615
|
-
output_manager_default.error(`Domain not found under ${
|
|
10798
|
+
output_manager_default.error(`Domain not found under ${import_chalk50.default.bold(contextName)}`);
|
|
10616
10799
|
output_manager_default.log(`Run ${getCommandName(`domains ls`)} to see your domains.`);
|
|
10617
10800
|
return 1;
|
|
10618
10801
|
}
|
|
10619
10802
|
if (moveTokenResult instanceof DomainPermissionDenied) {
|
|
10620
10803
|
output_manager_default.error(
|
|
10621
|
-
`You don't have permissions over domain ${
|
|
10804
|
+
`You don't have permissions over domain ${import_chalk50.default.underline(
|
|
10622
10805
|
moveTokenResult.meta.domain
|
|
10623
|
-
)} under ${
|
|
10806
|
+
)} under ${import_chalk50.default.bold(moveTokenResult.meta.context)}.`
|
|
10624
10807
|
);
|
|
10625
10808
|
return 1;
|
|
10626
10809
|
}
|
|
10627
10810
|
if (moveTokenResult instanceof InvalidMoveDestination) {
|
|
10628
10811
|
output_manager_default.error(
|
|
10629
|
-
`Destination ${
|
|
10812
|
+
`Destination ${import_chalk50.default.bold(
|
|
10630
10813
|
destination
|
|
10631
10814
|
)} is invalid. Please supply a valid username, email, team slug, user id, or team id.`
|
|
10632
10815
|
);
|
|
@@ -10814,10 +10997,10 @@ async function main7(client) {
|
|
|
10814
10997
|
}
|
|
10815
10998
|
|
|
10816
10999
|
// src/commands/firewall/overview.ts
|
|
10817
|
-
var
|
|
11000
|
+
var import_chalk53 = __toESM(require_source(), 1);
|
|
10818
11001
|
|
|
10819
11002
|
// src/commands/firewall/shared.ts
|
|
10820
|
-
var
|
|
11003
|
+
var import_chalk51 = __toESM(require_source(), 1);
|
|
10821
11004
|
|
|
10822
11005
|
// src/util/firewall/list-firewall-configs.ts
|
|
10823
11006
|
async function listFirewallConfigs(client, projectId, options = {}) {
|
|
@@ -10953,7 +11136,7 @@ async function detectExistingDraft(client, projectId, teamId) {
|
|
|
10953
11136
|
async function offerAutoPublish(client, projectId, hadExistingDraft, opts) {
|
|
10954
11137
|
output_manager_default.print(
|
|
10955
11138
|
`
|
|
10956
|
-
${
|
|
11139
|
+
${import_chalk51.default.gray(`This change is staged. Run ${import_chalk51.default.cyan(getCommandName("firewall publish"))} to make it live, or ${import_chalk51.default.cyan(getCommandName("firewall discard"))} to undo.`)}
|
|
10957
11140
|
`
|
|
10958
11141
|
);
|
|
10959
11142
|
if (!hadExistingDraft && !opts.skipPrompts && client.stdin.isTTY && !client.nonInteractive) {
|
|
@@ -10971,7 +11154,7 @@ async function offerAutoPublish(client, projectId, hadExistingDraft, opts) {
|
|
|
10971
11154
|
teamId: opts.teamId
|
|
10972
11155
|
});
|
|
10973
11156
|
output_manager_default.log(
|
|
10974
|
-
`${
|
|
11157
|
+
`${import_chalk51.default.cyan("Published")} to production ${import_chalk51.default.gray(publishStamp())}`
|
|
10975
11158
|
);
|
|
10976
11159
|
} catch (e2) {
|
|
10977
11160
|
const err = e2;
|
|
@@ -10982,7 +11165,7 @@ async function offerAutoPublish(client, projectId, hadExistingDraft, opts) {
|
|
|
10982
11165
|
}
|
|
10983
11166
|
} else if (hadExistingDraft) {
|
|
10984
11167
|
output_manager_default.warn(
|
|
10985
|
-
`There are other draft changes. Review with ${
|
|
11168
|
+
`There are other draft changes. Review with ${import_chalk51.default.cyan(getCommandName("firewall diff"))} before publishing.`
|
|
10986
11169
|
);
|
|
10987
11170
|
}
|
|
10988
11171
|
}
|
|
@@ -11028,7 +11211,7 @@ async function getBypass(client, projectId, options = {}) {
|
|
|
11028
11211
|
}
|
|
11029
11212
|
|
|
11030
11213
|
// src/util/firewall/format.ts
|
|
11031
|
-
var
|
|
11214
|
+
var import_chalk52 = __toESM(require_source(), 1);
|
|
11032
11215
|
function isAllSourcesBypass(ip) {
|
|
11033
11216
|
return ip === "0.0.0.0/0" || ip === "::/0";
|
|
11034
11217
|
}
|
|
@@ -11040,18 +11223,18 @@ function isMitigationsPaused(bypass) {
|
|
|
11040
11223
|
}
|
|
11041
11224
|
function formatAttackModeStatus(status3) {
|
|
11042
11225
|
if (!status3.enabled) {
|
|
11043
|
-
return
|
|
11226
|
+
return import_chalk52.default.dim("Off");
|
|
11044
11227
|
}
|
|
11045
11228
|
if (status3.activeUntil) {
|
|
11046
11229
|
const remainingMs = status3.activeUntil - Date.now();
|
|
11047
11230
|
if (remainingMs <= 0) {
|
|
11048
|
-
return
|
|
11231
|
+
return import_chalk52.default.dim("Off (expired)");
|
|
11049
11232
|
}
|
|
11050
11233
|
const hours = Math.floor(remainingMs / (60 * 60 * 1e3));
|
|
11051
11234
|
const minutes = Math.floor(remainingMs % (60 * 60 * 1e3) / (60 * 1e3));
|
|
11052
|
-
return
|
|
11235
|
+
return import_chalk52.default.red(`On (expires in ${hours}h ${minutes}m)`);
|
|
11053
11236
|
}
|
|
11054
|
-
return
|
|
11237
|
+
return import_chalk52.default.red("On");
|
|
11055
11238
|
}
|
|
11056
11239
|
function formatMitigationsStatus(bypass) {
|
|
11057
11240
|
if (isMitigationsPaused(bypass)) {
|
|
@@ -11065,49 +11248,49 @@ function formatMitigationsStatus(bypass) {
|
|
|
11065
11248
|
const minutes = Math.floor(
|
|
11066
11249
|
remainingMs % (60 * 60 * 1e3) / (60 * 1e3)
|
|
11067
11250
|
);
|
|
11068
|
-
return
|
|
11251
|
+
return import_chalk52.default.yellow(`Paused (auto-resumes in ${hours}h ${minutes}m)`);
|
|
11069
11252
|
}
|
|
11070
11253
|
}
|
|
11071
|
-
return
|
|
11254
|
+
return import_chalk52.default.yellow("Paused");
|
|
11072
11255
|
}
|
|
11073
|
-
return
|
|
11256
|
+
return import_chalk52.default.green("Active");
|
|
11074
11257
|
}
|
|
11075
11258
|
function formatStatusOutput(active, draft, bypass, attackMode) {
|
|
11076
11259
|
const lines = [];
|
|
11077
11260
|
if (active) {
|
|
11078
11261
|
const enabled = active.firewallEnabled;
|
|
11079
11262
|
lines.push(
|
|
11080
|
-
` ${
|
|
11263
|
+
` ${import_chalk52.default.bold("Firewall:")} ${enabled ? import_chalk52.default.green("Enabled") : import_chalk52.default.red("Disabled")}`
|
|
11081
11264
|
);
|
|
11082
11265
|
const activeRules = active.rules.filter((r) => r.active).length;
|
|
11083
11266
|
const inactiveRules = active.rules.filter((r) => !r.active).length;
|
|
11084
11267
|
const totalRules = active.rules.length;
|
|
11085
11268
|
lines.push(
|
|
11086
|
-
` ${
|
|
11269
|
+
` ${import_chalk52.default.bold("Custom Rules:")} ${activeRules} active, ${inactiveRules} inactive (${totalRules} total)`
|
|
11087
11270
|
);
|
|
11088
|
-
lines.push(` ${
|
|
11271
|
+
lines.push(` ${import_chalk52.default.bold("IP Blocks:")} ${active.ips.length}`);
|
|
11089
11272
|
} else {
|
|
11090
11273
|
lines.push(
|
|
11091
|
-
` ${
|
|
11274
|
+
` ${import_chalk52.default.bold("Firewall:")} ${import_chalk52.default.dim("Not configured")}`
|
|
11092
11275
|
);
|
|
11093
11276
|
}
|
|
11094
11277
|
const regularBypasses = bypass.filter((b) => !isAllSourcesBypass(b.Ip));
|
|
11095
11278
|
lines.push(
|
|
11096
|
-
` ${
|
|
11279
|
+
` ${import_chalk52.default.bold("System Bypass:")} ${regularBypasses.length} IP${regularBypasses.length !== 1 ? "s" : ""}`
|
|
11097
11280
|
);
|
|
11098
11281
|
lines.push("");
|
|
11099
11282
|
if (attackMode) {
|
|
11100
11283
|
lines.push(
|
|
11101
|
-
` ${
|
|
11284
|
+
` ${import_chalk52.default.bold("Attack Mode:")} ${formatAttackModeStatus(attackMode)}`
|
|
11102
11285
|
);
|
|
11103
11286
|
}
|
|
11104
11287
|
lines.push(
|
|
11105
|
-
` ${
|
|
11288
|
+
` ${import_chalk52.default.bold("System Mitigations:")} ${formatMitigationsStatus(bypass)}`
|
|
11106
11289
|
);
|
|
11107
11290
|
if (draft && draft.changes.length > 0) {
|
|
11108
11291
|
lines.push("");
|
|
11109
11292
|
lines.push(
|
|
11110
|
-
` ${
|
|
11293
|
+
` ${import_chalk52.default.bold("Pending Draft:")} ${import_chalk52.default.yellow(`${draft.changes.length} unpublished change${draft.changes.length !== 1 ? "s" : ""}`)}`
|
|
11111
11294
|
);
|
|
11112
11295
|
lines.push(formatDiffOutput(draft.changes));
|
|
11113
11296
|
}
|
|
@@ -11122,7 +11305,7 @@ function formatBypassTable(bypasses) {
|
|
|
11122
11305
|
const domainWidth = Math.max("Domain".length, ...domains2.map((d) => d.length));
|
|
11123
11306
|
const gap = 3;
|
|
11124
11307
|
lines.push(
|
|
11125
|
-
` ${
|
|
11308
|
+
` ${import_chalk52.default.dim("IP/CIDR".padEnd(ipWidth + gap))}${import_chalk52.default.dim("Domain".padEnd(domainWidth + gap))}${import_chalk52.default.dim("Note")}`
|
|
11126
11309
|
);
|
|
11127
11310
|
for (let i = 0; i < bypasses.length; i++) {
|
|
11128
11311
|
const bypass = bypasses[i];
|
|
@@ -11179,7 +11362,7 @@ function formatIpBlocksTable(annotated) {
|
|
|
11179
11362
|
...hostnames.map((h) => h.length)
|
|
11180
11363
|
);
|
|
11181
11364
|
lines.push(
|
|
11182
|
-
` ${" ".repeat(prefixWidth)}${
|
|
11365
|
+
` ${" ".repeat(prefixWidth)}${import_chalk52.default.dim("IP/CIDR".padEnd(ipWidth + gap))}${import_chalk52.default.dim("Hostname".padEnd(hostnameWidth + gap))}${import_chalk52.default.dim("Notes")}`
|
|
11183
11366
|
);
|
|
11184
11367
|
for (let i = 0; i < annotated.length; i++) {
|
|
11185
11368
|
const { rule, status: status3 } = annotated[i];
|
|
@@ -11190,13 +11373,13 @@ function formatIpBlocksTable(annotated) {
|
|
|
11190
11373
|
let colorFn = (s) => s;
|
|
11191
11374
|
if (status3 === "added") {
|
|
11192
11375
|
prefix = "+ ";
|
|
11193
|
-
colorFn =
|
|
11376
|
+
colorFn = import_chalk52.default.green;
|
|
11194
11377
|
} else if (status3 === "removed") {
|
|
11195
11378
|
prefix = "- ";
|
|
11196
|
-
colorFn =
|
|
11379
|
+
colorFn = import_chalk52.default.red;
|
|
11197
11380
|
} else if (status3 === "modified") {
|
|
11198
11381
|
prefix = "~ ";
|
|
11199
|
-
colorFn =
|
|
11382
|
+
colorFn = import_chalk52.default.yellow;
|
|
11200
11383
|
}
|
|
11201
11384
|
lines.push(colorFn(` ${prefix}${ip}${hostname}${notes}`));
|
|
11202
11385
|
}
|
|
@@ -11204,12 +11387,12 @@ function formatIpBlocksTable(annotated) {
|
|
|
11204
11387
|
}
|
|
11205
11388
|
function getDiffSymbol(action) {
|
|
11206
11389
|
if (action.endsWith(".insert")) {
|
|
11207
|
-
return { symbol: "+", color:
|
|
11390
|
+
return { symbol: "+", color: import_chalk52.default.green };
|
|
11208
11391
|
}
|
|
11209
11392
|
if (action.endsWith(".remove")) {
|
|
11210
|
-
return { symbol: "-", color:
|
|
11393
|
+
return { symbol: "-", color: import_chalk52.default.red };
|
|
11211
11394
|
}
|
|
11212
|
-
return { symbol: "~", color:
|
|
11395
|
+
return { symbol: "~", color: import_chalk52.default.yellow };
|
|
11213
11396
|
}
|
|
11214
11397
|
function formatChangeDescription(change2) {
|
|
11215
11398
|
const { action, id, value } = change2;
|
|
@@ -11357,7 +11540,7 @@ function formatConditionCompact(condition) {
|
|
|
11357
11540
|
function formatActionDisplay(action) {
|
|
11358
11541
|
const mitigate = action.mitigate;
|
|
11359
11542
|
if (!mitigate)
|
|
11360
|
-
return
|
|
11543
|
+
return import_chalk52.default.dim("None");
|
|
11361
11544
|
const actionType = mitigate.action;
|
|
11362
11545
|
const duration = mitigate.actionDuration;
|
|
11363
11546
|
switch (actionType) {
|
|
@@ -11437,7 +11620,7 @@ function formatRulesTable(annotated) {
|
|
|
11437
11620
|
...actionTexts.map((t) => t.length)
|
|
11438
11621
|
);
|
|
11439
11622
|
lines.push(
|
|
11440
|
-
` ${" ".repeat(prefixWidth)}${
|
|
11623
|
+
` ${" ".repeat(prefixWidth)}${import_chalk52.default.dim("#".padEnd(numWidth + gap))}${import_chalk52.default.dim("Name".padEnd(nameWidth + gap))}${import_chalk52.default.dim("Status".padEnd(statusWidth + gap))}${import_chalk52.default.dim("Action".padEnd(actionWidth + gap))}${import_chalk52.default.dim("Description")}`
|
|
11441
11624
|
);
|
|
11442
11625
|
for (let i = 0; i < annotated.length; i++) {
|
|
11443
11626
|
const { rule, status: status3 } = annotated[i];
|
|
@@ -11452,13 +11635,13 @@ function formatRulesTable(annotated) {
|
|
|
11452
11635
|
let colorFn = (s) => s;
|
|
11453
11636
|
if (status3 === "added") {
|
|
11454
11637
|
prefix = "+ ";
|
|
11455
|
-
colorFn =
|
|
11638
|
+
colorFn = import_chalk52.default.green;
|
|
11456
11639
|
} else if (status3 === "removed") {
|
|
11457
11640
|
prefix = "- ";
|
|
11458
|
-
colorFn =
|
|
11641
|
+
colorFn = import_chalk52.default.red;
|
|
11459
11642
|
} else if (status3 === "modified") {
|
|
11460
11643
|
prefix = "~ ";
|
|
11461
|
-
colorFn =
|
|
11644
|
+
colorFn = import_chalk52.default.yellow;
|
|
11462
11645
|
}
|
|
11463
11646
|
lines.push(
|
|
11464
11647
|
colorFn(
|
|
@@ -11471,7 +11654,7 @@ function formatRulesTable(annotated) {
|
|
|
11471
11654
|
function formatConditionGroup(group, groupIndex, totalGroups) {
|
|
11472
11655
|
const lines = [];
|
|
11473
11656
|
const label = totalGroups > 1 ? `Group ${groupIndex + 1} (AND):` : "Conditions:";
|
|
11474
|
-
lines.push(` ${
|
|
11657
|
+
lines.push(` ${import_chalk52.default.dim(label)}`);
|
|
11475
11658
|
for (const condition of group.conditions) {
|
|
11476
11659
|
lines.push(` ${formatConditionCompact(condition)}`);
|
|
11477
11660
|
}
|
|
@@ -11480,15 +11663,15 @@ function formatConditionGroup(group, groupIndex, totalGroups) {
|
|
|
11480
11663
|
function formatRuleExpanded(rule, index) {
|
|
11481
11664
|
const lines = [];
|
|
11482
11665
|
const prefix = index !== void 0 ? `${index + 1}. ` : "";
|
|
11483
|
-
const status3 = rule.active ? "Active" :
|
|
11666
|
+
const status3 = rule.active ? "Active" : import_chalk52.default.dim("Inactive");
|
|
11484
11667
|
const action = formatActionDisplay(rule.action);
|
|
11485
|
-
lines.push(` ${prefix}${
|
|
11668
|
+
lines.push(` ${prefix}${import_chalk52.default.bold(rule.name)} [${status3}]`);
|
|
11486
11669
|
if (rule.description) {
|
|
11487
|
-
lines.push(` ${
|
|
11670
|
+
lines.push(` ${import_chalk52.default.dim(rule.description)}`);
|
|
11488
11671
|
}
|
|
11489
11672
|
lines.push("");
|
|
11490
11673
|
if (rule.conditionGroup.length === 0) {
|
|
11491
|
-
lines.push(` ${
|
|
11674
|
+
lines.push(` ${import_chalk52.default.dim("No conditions")}`);
|
|
11492
11675
|
} else {
|
|
11493
11676
|
for (let i = 0; i < rule.conditionGroup.length; i++) {
|
|
11494
11677
|
lines.push(
|
|
@@ -11499,72 +11682,72 @@ function formatRuleExpanded(rule, index) {
|
|
|
11499
11682
|
)
|
|
11500
11683
|
);
|
|
11501
11684
|
if (i < rule.conditionGroup.length - 1) {
|
|
11502
|
-
lines.push(` ${
|
|
11685
|
+
lines.push(` ${import_chalk52.default.dim("OR")}`);
|
|
11503
11686
|
}
|
|
11504
11687
|
}
|
|
11505
11688
|
}
|
|
11506
11689
|
lines.push("");
|
|
11507
|
-
lines.push(` ${
|
|
11690
|
+
lines.push(` ${import_chalk52.default.dim("Action:")} ${action}`);
|
|
11508
11691
|
const duration = rule.action.mitigate?.actionDuration;
|
|
11509
11692
|
if (duration) {
|
|
11510
|
-
lines.push(` ${
|
|
11693
|
+
lines.push(` ${import_chalk52.default.dim("Duration:")} ${duration}`);
|
|
11511
11694
|
}
|
|
11512
11695
|
const rl = rule.action.mitigate?.rateLimit;
|
|
11513
11696
|
if (rl) {
|
|
11514
11697
|
lines.push(
|
|
11515
|
-
` ${
|
|
11698
|
+
` ${import_chalk52.default.dim("Rate Limit:")} ${rl.limit} req / ${rl.window}s (${rl.algo})`
|
|
11516
11699
|
);
|
|
11517
|
-
lines.push(` ${
|
|
11700
|
+
lines.push(` ${import_chalk52.default.dim("Keys:")} ${rl.keys.join(", ")}`);
|
|
11518
11701
|
if (rl.action) {
|
|
11519
|
-
lines.push(` ${
|
|
11702
|
+
lines.push(` ${import_chalk52.default.dim("Sub-action:")} ${rl.action}`);
|
|
11520
11703
|
}
|
|
11521
11704
|
}
|
|
11522
11705
|
const rd = rule.action.mitigate?.redirect;
|
|
11523
11706
|
if (rd) {
|
|
11524
11707
|
lines.push(
|
|
11525
|
-
` ${
|
|
11708
|
+
` ${import_chalk52.default.dim("Redirect:")} ${rd.location} (${rd.permanent ? "301 permanent" : "307 temporary"})`
|
|
11526
11709
|
);
|
|
11527
11710
|
}
|
|
11528
11711
|
return lines.join("\n");
|
|
11529
11712
|
}
|
|
11530
11713
|
function formatRuleDetail(rule) {
|
|
11531
11714
|
const lines = [];
|
|
11532
|
-
lines.push(` ${
|
|
11533
|
-
lines.push(` ${
|
|
11715
|
+
lines.push(` ${import_chalk52.default.bold("Rule:")} ${rule.name}`);
|
|
11716
|
+
lines.push(` ${import_chalk52.default.bold("ID:")} ${import_chalk52.default.dim(rule.id)}`);
|
|
11534
11717
|
lines.push(
|
|
11535
|
-
` ${
|
|
11718
|
+
` ${import_chalk52.default.bold("Status:")} ${rule.active ? import_chalk52.default.green("Active") : import_chalk52.default.dim("Inactive")}`
|
|
11536
11719
|
);
|
|
11537
11720
|
if (rule.description) {
|
|
11538
|
-
lines.push(` ${
|
|
11721
|
+
lines.push(` ${import_chalk52.default.bold("Description:")} ${rule.description}`);
|
|
11539
11722
|
}
|
|
11540
11723
|
lines.push("");
|
|
11541
11724
|
if (rule.conditionGroup.length === 0) {
|
|
11542
|
-
lines.push(` ${
|
|
11725
|
+
lines.push(` ${import_chalk52.default.bold("Conditions:")} ${import_chalk52.default.dim("No conditions")}`);
|
|
11543
11726
|
} else {
|
|
11544
|
-
lines.push(` ${
|
|
11727
|
+
lines.push(` ${import_chalk52.default.bold("Conditions:")}`);
|
|
11545
11728
|
for (let i = 0; i < rule.conditionGroup.length; i++) {
|
|
11546
11729
|
if (rule.conditionGroup.length > 1) {
|
|
11547
|
-
lines.push(` ${
|
|
11730
|
+
lines.push(` ${import_chalk52.default.dim(`Group ${i + 1} (AND):`)}`);
|
|
11548
11731
|
}
|
|
11549
11732
|
for (const condition of rule.conditionGroup[i].conditions) {
|
|
11550
11733
|
lines.push(` ${formatConditionCompact(condition)}`);
|
|
11551
11734
|
}
|
|
11552
11735
|
if (i < rule.conditionGroup.length - 1) {
|
|
11553
|
-
lines.push(` ${
|
|
11736
|
+
lines.push(` ${import_chalk52.default.dim("OR")}`);
|
|
11554
11737
|
}
|
|
11555
11738
|
}
|
|
11556
11739
|
}
|
|
11557
11740
|
lines.push("");
|
|
11558
11741
|
lines.push(
|
|
11559
|
-
` ${
|
|
11742
|
+
` ${import_chalk52.default.bold("Action:")} ${formatActionDisplay(rule.action)}`
|
|
11560
11743
|
);
|
|
11561
11744
|
const duration = rule.action.mitigate?.actionDuration;
|
|
11562
11745
|
if (duration) {
|
|
11563
|
-
lines.push(` ${
|
|
11746
|
+
lines.push(` ${import_chalk52.default.bold("Duration:")} ${duration}`);
|
|
11564
11747
|
}
|
|
11565
11748
|
const rl = rule.action.mitigate?.rateLimit;
|
|
11566
11749
|
if (rl) {
|
|
11567
|
-
lines.push(` ${
|
|
11750
|
+
lines.push(` ${import_chalk52.default.bold("Rate Limit:")}`);
|
|
11568
11751
|
lines.push(` Algorithm: ${rl.algo}`);
|
|
11569
11752
|
lines.push(` Window: ${rl.window}s`);
|
|
11570
11753
|
lines.push(` Limit: ${rl.limit} requests`);
|
|
@@ -11575,7 +11758,7 @@ function formatRuleDetail(rule) {
|
|
|
11575
11758
|
}
|
|
11576
11759
|
const rd = rule.action.mitigate?.redirect;
|
|
11577
11760
|
if (rd) {
|
|
11578
|
-
lines.push(` ${
|
|
11761
|
+
lines.push(` ${import_chalk52.default.bold("Redirect:")}`);
|
|
11579
11762
|
lines.push(` Location: ${rd.location}`);
|
|
11580
11763
|
lines.push(
|
|
11581
11764
|
` Type: ${rd.permanent ? "301 (permanent)" : "307 (temporary)"}`
|
|
@@ -11594,7 +11777,7 @@ async function overview(client, argv) {
|
|
|
11594
11777
|
return link;
|
|
11595
11778
|
const { project, org } = link;
|
|
11596
11779
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
11597
|
-
output_manager_default.spinner(`Fetching firewall overview for ${
|
|
11780
|
+
output_manager_default.spinner(`Fetching firewall overview for ${import_chalk53.default.bold(project.name)}`);
|
|
11598
11781
|
try {
|
|
11599
11782
|
const [configList, bypassList, freshProject] = await Promise.all([
|
|
11600
11783
|
listFirewallConfigs(client, project.id, { teamId }),
|
|
@@ -11643,7 +11826,7 @@ async function overview(client, argv) {
|
|
|
11643
11826
|
}
|
|
11644
11827
|
|
|
11645
11828
|
// src/commands/firewall/diff.ts
|
|
11646
|
-
var
|
|
11829
|
+
var import_chalk54 = __toESM(require_source(), 1);
|
|
11647
11830
|
async function diff(client, argv) {
|
|
11648
11831
|
const parsed = await parseSubcommandArgs2(argv, diffSubcommand, client);
|
|
11649
11832
|
if (typeof parsed === "number")
|
|
@@ -11653,7 +11836,7 @@ async function diff(client, argv) {
|
|
|
11653
11836
|
return link;
|
|
11654
11837
|
const { project, org } = link;
|
|
11655
11838
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
11656
|
-
output_manager_default.spinner(`Fetching draft changes for ${
|
|
11839
|
+
output_manager_default.spinner(`Fetching draft changes for ${import_chalk54.default.bold(project.name)}`);
|
|
11657
11840
|
try {
|
|
11658
11841
|
const { draft } = await listFirewallConfigs(client, project.id, {
|
|
11659
11842
|
teamId
|
|
@@ -11672,14 +11855,14 @@ async function diff(client, argv) {
|
|
|
11672
11855
|
}
|
|
11673
11856
|
output_manager_default.print(
|
|
11674
11857
|
`
|
|
11675
|
-
${
|
|
11858
|
+
${import_chalk54.default.bold(`Pending changes (${draft.changes.length}):`)}
|
|
11676
11859
|
|
|
11677
11860
|
`
|
|
11678
11861
|
);
|
|
11679
11862
|
output_manager_default.print(formatDiffOutput(draft.changes));
|
|
11680
11863
|
output_manager_default.print("\n\n");
|
|
11681
11864
|
output_manager_default.print(
|
|
11682
|
-
` Run ${
|
|
11865
|
+
` Run ${import_chalk54.default.cyan(getCommandName("firewall publish"))} to publish, or ${import_chalk54.default.cyan(getCommandName("firewall discard"))} to discard.
|
|
11683
11866
|
|
|
11684
11867
|
`
|
|
11685
11868
|
);
|
|
@@ -11703,7 +11886,7 @@ ${import_chalk53.default.bold(`Pending changes (${draft.changes.length}):`)}
|
|
|
11703
11886
|
}
|
|
11704
11887
|
|
|
11705
11888
|
// src/commands/firewall/publish.ts
|
|
11706
|
-
var
|
|
11889
|
+
var import_chalk55 = __toESM(require_source(), 1);
|
|
11707
11890
|
async function publish(client, argv) {
|
|
11708
11891
|
const parsed = await parseSubcommandArgs2(argv, publishSubcommand, client);
|
|
11709
11892
|
if (typeof parsed === "number")
|
|
@@ -11713,7 +11896,7 @@ async function publish(client, argv) {
|
|
|
11713
11896
|
return link;
|
|
11714
11897
|
const { project, org } = link;
|
|
11715
11898
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
11716
|
-
output_manager_default.spinner(`Fetching draft changes for ${
|
|
11899
|
+
output_manager_default.spinner(`Fetching draft changes for ${import_chalk55.default.bold(project.name)}`);
|
|
11717
11900
|
try {
|
|
11718
11901
|
const { draft } = await listFirewallConfigs(client, project.id, {
|
|
11719
11902
|
teamId
|
|
@@ -11724,7 +11907,7 @@ async function publish(client, argv) {
|
|
|
11724
11907
|
}
|
|
11725
11908
|
output_manager_default.print(
|
|
11726
11909
|
`
|
|
11727
|
-
${
|
|
11910
|
+
${import_chalk55.default.bold(`Changes to be published (${draft.changes.length}):`)}
|
|
11728
11911
|
|
|
11729
11912
|
`
|
|
11730
11913
|
);
|
|
@@ -11734,7 +11917,7 @@ ${import_chalk54.default.bold(`Changes to be published (${draft.changes.length})
|
|
|
11734
11917
|
client,
|
|
11735
11918
|
parsed.flags["--yes"],
|
|
11736
11919
|
"Publish these changes to production?",
|
|
11737
|
-
`This will make them live for ${
|
|
11920
|
+
`This will make them live for ${import_chalk55.default.bold(project.name)}.`
|
|
11738
11921
|
);
|
|
11739
11922
|
if (!confirmed) {
|
|
11740
11923
|
output_manager_default.log("Canceled");
|
|
@@ -11744,7 +11927,7 @@ ${import_chalk54.default.bold(`Changes to be published (${draft.changes.length})
|
|
|
11744
11927
|
output_manager_default.spinner("Publishing to production");
|
|
11745
11928
|
await activateFirewallConfig(client, project.id, "draft", { teamId });
|
|
11746
11929
|
output_manager_default.log(
|
|
11747
|
-
`${
|
|
11930
|
+
`${import_chalk55.default.cyan("Success!")} Firewall config published to production ${import_chalk55.default.gray(updateStamp())}`
|
|
11748
11931
|
);
|
|
11749
11932
|
return 0;
|
|
11750
11933
|
} catch (e2) {
|
|
@@ -11766,7 +11949,7 @@ ${import_chalk54.default.bold(`Changes to be published (${draft.changes.length})
|
|
|
11766
11949
|
}
|
|
11767
11950
|
|
|
11768
11951
|
// src/commands/firewall/discard.ts
|
|
11769
|
-
var
|
|
11952
|
+
var import_chalk56 = __toESM(require_source(), 1);
|
|
11770
11953
|
|
|
11771
11954
|
// src/util/firewall/delete-firewall-draft.ts
|
|
11772
11955
|
async function deleteFirewallDraft(client, projectId, options = {}) {
|
|
@@ -11791,7 +11974,7 @@ async function discard(client, argv) {
|
|
|
11791
11974
|
return link;
|
|
11792
11975
|
const { project, org } = link;
|
|
11793
11976
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
11794
|
-
output_manager_default.spinner(`Fetching draft changes for ${
|
|
11977
|
+
output_manager_default.spinner(`Fetching draft changes for ${import_chalk56.default.bold(project.name)}`);
|
|
11795
11978
|
try {
|
|
11796
11979
|
const { draft } = await listFirewallConfigs(client, project.id, {
|
|
11797
11980
|
teamId
|
|
@@ -11802,7 +11985,7 @@ async function discard(client, argv) {
|
|
|
11802
11985
|
}
|
|
11803
11986
|
output_manager_default.print(
|
|
11804
11987
|
`
|
|
11805
|
-
${
|
|
11988
|
+
${import_chalk56.default.bold(`Changes to be discarded (${draft.changes.length}):`)}
|
|
11806
11989
|
|
|
11807
11990
|
`
|
|
11808
11991
|
);
|
|
@@ -11822,7 +12005,7 @@ ${import_chalk55.default.bold(`Changes to be discarded (${draft.changes.length})
|
|
|
11822
12005
|
output_manager_default.spinner("Discarding draft changes");
|
|
11823
12006
|
await deleteFirewallDraft(client, project.id, { teamId });
|
|
11824
12007
|
output_manager_default.log(
|
|
11825
|
-
`${
|
|
12008
|
+
`${import_chalk56.default.cyan("Success!")} Draft changes discarded ${import_chalk56.default.gray(updateStamp())}`
|
|
11826
12009
|
);
|
|
11827
12010
|
return 0;
|
|
11828
12011
|
} catch (e2) {
|
|
@@ -11844,7 +12027,7 @@ ${import_chalk55.default.bold(`Changes to be discarded (${draft.changes.length})
|
|
|
11844
12027
|
}
|
|
11845
12028
|
|
|
11846
12029
|
// src/commands/firewall/system-bypass/list.ts
|
|
11847
|
-
var
|
|
12030
|
+
var import_chalk57 = __toESM(require_source(), 1);
|
|
11848
12031
|
async function list5(client, argv) {
|
|
11849
12032
|
const parsed = await parseSubcommandArgs2(
|
|
11850
12033
|
argv,
|
|
@@ -11860,7 +12043,7 @@ async function list5(client, argv) {
|
|
|
11860
12043
|
const { project, org } = link;
|
|
11861
12044
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
11862
12045
|
output_manager_default.spinner(
|
|
11863
|
-
`Fetching system bypass rules for ${
|
|
12046
|
+
`Fetching system bypass rules for ${import_chalk57.default.bold(project.name)}`
|
|
11864
12047
|
);
|
|
11865
12048
|
try {
|
|
11866
12049
|
const { result: allBypasses } = await getBypass(client, project.id, {
|
|
@@ -11903,7 +12086,7 @@ ${formatBypassTable(bypasses)}
|
|
|
11903
12086
|
}
|
|
11904
12087
|
|
|
11905
12088
|
// src/commands/firewall/system-bypass/add.ts
|
|
11906
|
-
var
|
|
12089
|
+
var import_chalk58 = __toESM(require_source(), 1);
|
|
11907
12090
|
|
|
11908
12091
|
// src/util/firewall/add-bypass.ts
|
|
11909
12092
|
async function addBypass(client, projectId, body, options = {}) {
|
|
@@ -12063,7 +12246,7 @@ async function add5(client, argv) {
|
|
|
12063
12246
|
const confirmed = await confirmAction(
|
|
12064
12247
|
client,
|
|
12065
12248
|
parsed.flags["--yes"],
|
|
12066
|
-
`Add system bypass for ${
|
|
12249
|
+
`Add system bypass for ${import_chalk58.default.bold(ip)} on ${import_chalk58.default.bold(scopeLabel)}?`
|
|
12067
12250
|
);
|
|
12068
12251
|
if (!confirmed) {
|
|
12069
12252
|
output_manager_default.log("Canceled");
|
|
@@ -12083,7 +12266,7 @@ async function add5(client, argv) {
|
|
|
12083
12266
|
{ teamId }
|
|
12084
12267
|
);
|
|
12085
12268
|
output_manager_default.log(
|
|
12086
|
-
`${
|
|
12269
|
+
`${import_chalk58.default.cyan("Success!")} Added system bypass for ${import_chalk58.default.bold(ip)} on ${import_chalk58.default.bold(scopeLabel)} ${import_chalk58.default.gray(addStamp())}`
|
|
12087
12270
|
);
|
|
12088
12271
|
return 0;
|
|
12089
12272
|
} catch (e2) {
|
|
@@ -12112,7 +12295,7 @@ async function add5(client, argv) {
|
|
|
12112
12295
|
}
|
|
12113
12296
|
|
|
12114
12297
|
// src/commands/firewall/system-bypass/remove.ts
|
|
12115
|
-
var
|
|
12298
|
+
var import_chalk59 = __toESM(require_source(), 1);
|
|
12116
12299
|
|
|
12117
12300
|
// src/util/firewall/remove-bypass.ts
|
|
12118
12301
|
async function removeBypass(client, projectId, body, options = {}) {
|
|
@@ -12166,7 +12349,7 @@ async function remove(client, argv) {
|
|
|
12166
12349
|
const confirmed = await confirmAction(
|
|
12167
12350
|
client,
|
|
12168
12351
|
parsed.flags["--yes"],
|
|
12169
|
-
`Remove system bypass for ${
|
|
12352
|
+
`Remove system bypass for ${import_chalk59.default.bold(ip)} on ${import_chalk59.default.bold(scopeLabel)}?`
|
|
12170
12353
|
);
|
|
12171
12354
|
if (!confirmed) {
|
|
12172
12355
|
output_manager_default.log("Canceled");
|
|
@@ -12185,14 +12368,14 @@ async function remove(client, argv) {
|
|
|
12185
12368
|
{ teamId }
|
|
12186
12369
|
);
|
|
12187
12370
|
output_manager_default.log(
|
|
12188
|
-
`${
|
|
12371
|
+
`${import_chalk59.default.cyan("Success!")} Removed system bypass for ${import_chalk59.default.bold(ip)} ${import_chalk59.default.gray(removeStamp())}`
|
|
12189
12372
|
);
|
|
12190
12373
|
return 0;
|
|
12191
12374
|
} catch (e2) {
|
|
12192
12375
|
const error = e2;
|
|
12193
12376
|
if (error.status === 404) {
|
|
12194
12377
|
output_manager_default.error(
|
|
12195
|
-
`No bypass rule found for ${
|
|
12378
|
+
`No bypass rule found for ${import_chalk59.default.bold(ip)}. Run ${import_chalk59.default.cyan(getCommandName("firewall system-bypass list"))} to view all rules.`
|
|
12196
12379
|
);
|
|
12197
12380
|
return 1;
|
|
12198
12381
|
}
|
|
@@ -12444,7 +12627,7 @@ async function main8(client, args) {
|
|
|
12444
12627
|
}
|
|
12445
12628
|
|
|
12446
12629
|
// src/commands/firewall/attack-mode/enable.ts
|
|
12447
|
-
var
|
|
12630
|
+
var import_chalk60 = __toESM(require_source(), 1);
|
|
12448
12631
|
|
|
12449
12632
|
// src/util/firewall/update-attack-mode.ts
|
|
12450
12633
|
async function updateAttackMode(client, body) {
|
|
@@ -12509,8 +12692,8 @@ async function enable(client, argv) {
|
|
|
12509
12692
|
const confirmed = await confirmAction(
|
|
12510
12693
|
client,
|
|
12511
12694
|
parsed.flags["--yes"],
|
|
12512
|
-
`Enable attack mode for ${
|
|
12513
|
-
`${
|
|
12695
|
+
`Enable attack mode for ${import_chalk60.default.bold(project.name)} (${import_chalk60.default.bold(duration)})?`,
|
|
12696
|
+
`${import_chalk60.default.yellow("Warning:")} Every visitor will be shown a verification challenge before accessing your site. This may impact legitimate traffic and SEO. Attack mode automatically expires after ${duration}.`
|
|
12514
12697
|
);
|
|
12515
12698
|
if (!confirmed) {
|
|
12516
12699
|
output_manager_default.log("Canceled");
|
|
@@ -12525,7 +12708,7 @@ async function enable(client, argv) {
|
|
|
12525
12708
|
attackModeActiveUntil: Date.now() + DURATION_MAP[duration]
|
|
12526
12709
|
});
|
|
12527
12710
|
output_manager_default.log(
|
|
12528
|
-
`${
|
|
12711
|
+
`${import_chalk60.default.cyan("Success!")} Attack mode enabled for ${import_chalk60.default.bold(duration)} ${import_chalk60.default.gray(updateStamp())}`
|
|
12529
12712
|
);
|
|
12530
12713
|
return 0;
|
|
12531
12714
|
} catch (e2) {
|
|
@@ -12537,7 +12720,7 @@ async function enable(client, argv) {
|
|
|
12537
12720
|
}
|
|
12538
12721
|
|
|
12539
12722
|
// src/commands/firewall/attack-mode/disable.ts
|
|
12540
|
-
var
|
|
12723
|
+
var import_chalk61 = __toESM(require_source(), 1);
|
|
12541
12724
|
async function disable(client, argv) {
|
|
12542
12725
|
const parsed = await parseSubcommandArgs2(
|
|
12543
12726
|
argv,
|
|
@@ -12578,7 +12761,7 @@ async function disable(client, argv) {
|
|
|
12578
12761
|
const confirmed = await confirmAction(
|
|
12579
12762
|
client,
|
|
12580
12763
|
parsed.flags["--yes"],
|
|
12581
|
-
`Disable attack mode for ${
|
|
12764
|
+
`Disable attack mode for ${import_chalk61.default.bold(project.name)}?`,
|
|
12582
12765
|
"Visitors will no longer be shown a verification challenge."
|
|
12583
12766
|
);
|
|
12584
12767
|
if (!confirmed) {
|
|
@@ -12593,7 +12776,7 @@ async function disable(client, argv) {
|
|
|
12593
12776
|
attackModeEnabled: false
|
|
12594
12777
|
});
|
|
12595
12778
|
output_manager_default.log(
|
|
12596
|
-
`${
|
|
12779
|
+
`${import_chalk61.default.cyan("Success!")} Attack mode disabled ${import_chalk61.default.gray(updateStamp())}`
|
|
12597
12780
|
);
|
|
12598
12781
|
return 0;
|
|
12599
12782
|
} catch (e2) {
|
|
@@ -12687,7 +12870,7 @@ async function main9(client, args) {
|
|
|
12687
12870
|
}
|
|
12688
12871
|
|
|
12689
12872
|
// src/commands/firewall/system-mitigations/pause.ts
|
|
12690
|
-
var
|
|
12873
|
+
var import_chalk62 = __toESM(require_source(), 1);
|
|
12691
12874
|
async function pause(client, argv) {
|
|
12692
12875
|
const parsed = await parseSubcommandArgs2(
|
|
12693
12876
|
argv,
|
|
@@ -12732,8 +12915,8 @@ async function pause(client, argv) {
|
|
|
12732
12915
|
const confirmed = await confirmAction(
|
|
12733
12916
|
client,
|
|
12734
12917
|
parsed.flags["--yes"],
|
|
12735
|
-
`Pause system mitigations for ${
|
|
12736
|
-
`${
|
|
12918
|
+
`Pause system mitigations for ${import_chalk62.default.bold(project.name)}?`,
|
|
12919
|
+
`${import_chalk62.default.yellow("Warning:")} This disables automatic DDoS protection, bot mitigation, and system-level traffic filtering for 24 hours. Your project will be unprotected from automated attacks during this period. Auto-resumes after 24 hours.`
|
|
12737
12920
|
);
|
|
12738
12921
|
if (!confirmed) {
|
|
12739
12922
|
output_manager_default.log("Canceled");
|
|
@@ -12752,7 +12935,7 @@ async function pause(client, argv) {
|
|
|
12752
12935
|
{ teamId }
|
|
12753
12936
|
);
|
|
12754
12937
|
output_manager_default.log(
|
|
12755
|
-
`${
|
|
12938
|
+
`${import_chalk62.default.cyan("Success!")} System mitigations paused for ${import_chalk62.default.bold(project.name)}. Auto-resumes in 24 hours. ${import_chalk62.default.gray(pauseStamp())}`
|
|
12756
12939
|
);
|
|
12757
12940
|
return 0;
|
|
12758
12941
|
} catch (e2) {
|
|
@@ -12764,7 +12947,7 @@ async function pause(client, argv) {
|
|
|
12764
12947
|
}
|
|
12765
12948
|
|
|
12766
12949
|
// src/commands/firewall/system-mitigations/resume.ts
|
|
12767
|
-
var
|
|
12950
|
+
var import_chalk63 = __toESM(require_source(), 1);
|
|
12768
12951
|
async function resume(client, argv) {
|
|
12769
12952
|
const parsed = await parseSubcommandArgs2(
|
|
12770
12953
|
argv,
|
|
@@ -12809,7 +12992,7 @@ async function resume(client, argv) {
|
|
|
12809
12992
|
const confirmed = await confirmAction(
|
|
12810
12993
|
client,
|
|
12811
12994
|
parsed.flags["--yes"],
|
|
12812
|
-
`Resume system mitigations for ${
|
|
12995
|
+
`Resume system mitigations for ${import_chalk63.default.bold(project.name)}?`,
|
|
12813
12996
|
"Automatic DDoS protection and system-level traffic filtering will be re-enabled immediately."
|
|
12814
12997
|
);
|
|
12815
12998
|
if (!confirmed) {
|
|
@@ -12829,7 +13012,7 @@ async function resume(client, argv) {
|
|
|
12829
13012
|
{ teamId }
|
|
12830
13013
|
);
|
|
12831
13014
|
output_manager_default.log(
|
|
12832
|
-
`${
|
|
13015
|
+
`${import_chalk63.default.cyan("Success!")} System mitigations resumed for ${import_chalk63.default.bold(project.name)} ${import_chalk63.default.gray(resumeStamp())}`
|
|
12833
13016
|
);
|
|
12834
13017
|
return 0;
|
|
12835
13018
|
} catch (e2) {
|
|
@@ -12923,7 +13106,7 @@ async function main10(client, args) {
|
|
|
12923
13106
|
}
|
|
12924
13107
|
|
|
12925
13108
|
// src/commands/firewall/ip-blocks/list.ts
|
|
12926
|
-
var
|
|
13109
|
+
var import_chalk64 = __toESM(require_source(), 1);
|
|
12927
13110
|
async function list6(client, argv) {
|
|
12928
13111
|
const parsed = await parseSubcommandArgs2(
|
|
12929
13112
|
argv,
|
|
@@ -12938,7 +13121,7 @@ async function list6(client, argv) {
|
|
|
12938
13121
|
return link;
|
|
12939
13122
|
const { project, org } = link;
|
|
12940
13123
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
12941
|
-
output_manager_default.spinner(`Fetching IP blocking rules for ${
|
|
13124
|
+
output_manager_default.spinner(`Fetching IP blocking rules for ${import_chalk64.default.bold(project.name)}`);
|
|
12942
13125
|
try {
|
|
12943
13126
|
const { active, draft } = await listFirewallConfigs(client, project.id, {
|
|
12944
13127
|
teamId
|
|
@@ -12970,12 +13153,12 @@ ${formatIpBlocksTable(annotated)}
|
|
|
12970
13153
|
if (ipChanges > 0) {
|
|
12971
13154
|
output_manager_default.print(
|
|
12972
13155
|
`
|
|
12973
|
-
${
|
|
13156
|
+
${import_chalk64.default.yellow(`${ipChanges} unpublished IP block change${ipChanges !== 1 ? "s" : ""}.`)} Run ${import_chalk64.default.cyan(getCommandName("firewall publish"))} to publish.
|
|
12974
13157
|
`
|
|
12975
13158
|
);
|
|
12976
13159
|
} else {
|
|
12977
13160
|
output_manager_default.print(`
|
|
12978
|
-
${
|
|
13161
|
+
${import_chalk64.default.dim("Showing live configuration.")}
|
|
12979
13162
|
`);
|
|
12980
13163
|
}
|
|
12981
13164
|
output_manager_default.print("\n");
|
|
@@ -13003,7 +13186,7 @@ ${formatIpBlocksTable(annotated)}
|
|
|
13003
13186
|
}
|
|
13004
13187
|
|
|
13005
13188
|
// src/commands/firewall/ip-blocks/block.ts
|
|
13006
|
-
var
|
|
13189
|
+
var import_chalk65 = __toESM(require_source(), 1);
|
|
13007
13190
|
|
|
13008
13191
|
// src/util/firewall/patch-firewall-draft.ts
|
|
13009
13192
|
async function patchFirewallDraft(client, projectId, patch, options = {}) {
|
|
@@ -13066,7 +13249,7 @@ async function block(client, argv) {
|
|
|
13066
13249
|
const confirmed = await confirmAction(
|
|
13067
13250
|
client,
|
|
13068
13251
|
parsed.flags["--yes"],
|
|
13069
|
-
`Block ${
|
|
13252
|
+
`Block ${import_chalk65.default.bold(ip)} on ${import_chalk65.default.bold(hostnameLabel)}?`
|
|
13070
13253
|
);
|
|
13071
13254
|
if (!confirmed) {
|
|
13072
13255
|
output_manager_default.log("Canceled");
|
|
@@ -13096,7 +13279,7 @@ async function block(client, argv) {
|
|
|
13096
13279
|
{ teamId }
|
|
13097
13280
|
);
|
|
13098
13281
|
output_manager_default.log(
|
|
13099
|
-
`${
|
|
13282
|
+
`${import_chalk65.default.cyan("Success!")} IP block for ${import_chalk65.default.bold(ip)} on ${import_chalk65.default.bold(hostnameLabel)} staged ${import_chalk65.default.gray(blockStamp())}`
|
|
13100
13283
|
);
|
|
13101
13284
|
await offerAutoPublish(client, project.id, hadExistingDraft, {
|
|
13102
13285
|
teamId,
|
|
@@ -13129,7 +13312,7 @@ async function block(client, argv) {
|
|
|
13129
13312
|
}
|
|
13130
13313
|
|
|
13131
13314
|
// src/commands/firewall/ip-blocks/unblock.ts
|
|
13132
|
-
var
|
|
13315
|
+
var import_chalk66 = __toESM(require_source(), 1);
|
|
13133
13316
|
async function unblock(client, argv) {
|
|
13134
13317
|
const parsed = await parseSubcommandArgs2(
|
|
13135
13318
|
argv,
|
|
@@ -13149,7 +13332,7 @@ async function unblock(client, argv) {
|
|
|
13149
13332
|
return link;
|
|
13150
13333
|
const { project, org } = link;
|
|
13151
13334
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
13152
|
-
output_manager_default.spinner(`Fetching IP blocking rules for ${
|
|
13335
|
+
output_manager_default.spinner(`Fetching IP blocking rules for ${import_chalk66.default.bold(project.name)}`);
|
|
13153
13336
|
try {
|
|
13154
13337
|
const { active, draft } = await listFirewallConfigs(client, project.id, {
|
|
13155
13338
|
teamId
|
|
@@ -13167,7 +13350,7 @@ async function unblock(client, argv) {
|
|
|
13167
13350
|
}
|
|
13168
13351
|
if (matches.length === 0) {
|
|
13169
13352
|
output_manager_default.error(
|
|
13170
|
-
`No IP block found for "${identifier}". Run ${
|
|
13353
|
+
`No IP block found for "${identifier}". Run ${import_chalk66.default.cyan(getCommandName("firewall ip-blocks list"))} to view all rules.`
|
|
13171
13354
|
);
|
|
13172
13355
|
return 1;
|
|
13173
13356
|
}
|
|
@@ -13216,7 +13399,7 @@ async function unblock(client, argv) {
|
|
|
13216
13399
|
const confirmed = await confirmAction(
|
|
13217
13400
|
client,
|
|
13218
13401
|
parsed.flags["--yes"],
|
|
13219
|
-
`Remove IP block for ${
|
|
13402
|
+
`Remove IP block for ${import_chalk66.default.bold(rule.ip)} on ${import_chalk66.default.bold(hostnameLabel)}?`
|
|
13220
13403
|
);
|
|
13221
13404
|
if (!confirmed) {
|
|
13222
13405
|
output_manager_default.log("Canceled");
|
|
@@ -13235,7 +13418,7 @@ async function unblock(client, argv) {
|
|
|
13235
13418
|
{ teamId }
|
|
13236
13419
|
);
|
|
13237
13420
|
output_manager_default.log(
|
|
13238
|
-
`${
|
|
13421
|
+
`${import_chalk66.default.cyan("Success!")} IP block removal for ${import_chalk66.default.bold(rule.ip)} staged ${import_chalk66.default.gray(unblockStamp())}`
|
|
13239
13422
|
);
|
|
13240
13423
|
await offerAutoPublish(client, project.id, hadExistingDraft, {
|
|
13241
13424
|
teamId,
|
|
@@ -13360,7 +13543,7 @@ async function main11(client, args) {
|
|
|
13360
13543
|
}
|
|
13361
13544
|
|
|
13362
13545
|
// src/commands/firewall/rules/list.ts
|
|
13363
|
-
var
|
|
13546
|
+
var import_chalk67 = __toESM(require_source(), 1);
|
|
13364
13547
|
async function list7(client, argv) {
|
|
13365
13548
|
const parsed = await parseSubcommandArgs2(
|
|
13366
13549
|
argv,
|
|
@@ -13375,7 +13558,7 @@ async function list7(client, argv) {
|
|
|
13375
13558
|
return link;
|
|
13376
13559
|
const { project, org } = link;
|
|
13377
13560
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
13378
|
-
output_manager_default.spinner(`Fetching custom rules for ${
|
|
13561
|
+
output_manager_default.spinner(`Fetching custom rules for ${import_chalk67.default.bold(project.name)}`);
|
|
13379
13562
|
try {
|
|
13380
13563
|
const { active, draft } = await listFirewallConfigs(client, project.id, {
|
|
13381
13564
|
teamId
|
|
@@ -13406,13 +13589,13 @@ async function list7(client, argv) {
|
|
|
13406
13589
|
let colorFn = (s) => s;
|
|
13407
13590
|
let prefix = "";
|
|
13408
13591
|
if (status3 === "added") {
|
|
13409
|
-
colorFn =
|
|
13592
|
+
colorFn = import_chalk67.default.green;
|
|
13410
13593
|
prefix = "+ ";
|
|
13411
13594
|
} else if (status3 === "removed") {
|
|
13412
|
-
colorFn =
|
|
13595
|
+
colorFn = import_chalk67.default.red;
|
|
13413
13596
|
prefix = "- ";
|
|
13414
13597
|
} else if (status3 === "modified") {
|
|
13415
|
-
colorFn =
|
|
13598
|
+
colorFn = import_chalk67.default.yellow;
|
|
13416
13599
|
prefix = "~ ";
|
|
13417
13600
|
}
|
|
13418
13601
|
const expanded = formatRuleExpanded(rule, i);
|
|
@@ -13441,12 +13624,12 @@ ${formatRulesTable(annotated)}
|
|
|
13441
13624
|
if (ruleChanges > 0) {
|
|
13442
13625
|
output_manager_default.print(
|
|
13443
13626
|
`
|
|
13444
|
-
${
|
|
13627
|
+
${import_chalk67.default.yellow(`${ruleChanges} unpublished rule change${ruleChanges !== 1 ? "s" : ""}.`)} Run ${import_chalk67.default.cyan(getCommandName("firewall publish"))} to publish.
|
|
13445
13628
|
`
|
|
13446
13629
|
);
|
|
13447
13630
|
} else {
|
|
13448
13631
|
output_manager_default.print(`
|
|
13449
|
-
${
|
|
13632
|
+
${import_chalk67.default.dim("Showing live configuration.")}
|
|
13450
13633
|
`);
|
|
13451
13634
|
}
|
|
13452
13635
|
output_manager_default.print("\n");
|
|
@@ -13470,7 +13653,7 @@ ${formatRulesTable(annotated)}
|
|
|
13470
13653
|
}
|
|
13471
13654
|
|
|
13472
13655
|
// src/commands/firewall/rules/inspect.ts
|
|
13473
|
-
var
|
|
13656
|
+
var import_chalk68 = __toESM(require_source(), 1);
|
|
13474
13657
|
async function inspect2(client, argv) {
|
|
13475
13658
|
const parsed = await parseSubcommandArgs2(
|
|
13476
13659
|
argv,
|
|
@@ -13516,7 +13699,7 @@ async function inspect2(client, argv) {
|
|
|
13516
13699
|
return link;
|
|
13517
13700
|
const { project, org } = link;
|
|
13518
13701
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
13519
|
-
output_manager_default.spinner(`Fetching rules for ${
|
|
13702
|
+
output_manager_default.spinner(`Fetching rules for ${import_chalk68.default.bold(project.name)}`);
|
|
13520
13703
|
try {
|
|
13521
13704
|
const { active, draft } = await listFirewallConfigs(client, project.id, {
|
|
13522
13705
|
teamId
|
|
@@ -13543,7 +13726,7 @@ async function inspect2(client, argv) {
|
|
|
13543
13726
|
);
|
|
13544
13727
|
}
|
|
13545
13728
|
output_manager_default.error(
|
|
13546
|
-
`No rule found for "${identifier}". Run ${
|
|
13729
|
+
`No rule found for "${identifier}". Run ${import_chalk68.default.cyan(getCommandName("firewall rules list"))} to view all rules.`
|
|
13547
13730
|
);
|
|
13548
13731
|
return 1;
|
|
13549
13732
|
}
|
|
@@ -13809,7 +13992,7 @@ async function main13(client) {
|
|
|
13809
13992
|
}
|
|
13810
13993
|
|
|
13811
13994
|
// src/commands/edge-config/list.ts
|
|
13812
|
-
var
|
|
13995
|
+
var import_chalk69 = __toESM(require_source(), 1);
|
|
13813
13996
|
|
|
13814
13997
|
// src/util/telemetry/commands/edge-config/ls.ts
|
|
13815
13998
|
var EdgeConfigLsTelemetryClient = class extends TelemetryClient {
|
|
@@ -13873,14 +14056,14 @@ async function listCmd(client, argv) {
|
|
|
13873
14056
|
}
|
|
13874
14057
|
const { contextName } = await getScope(client);
|
|
13875
14058
|
output_manager_default.print(
|
|
13876
|
-
`${(0,
|
|
14059
|
+
`${(0, import_chalk69.gray)(`${rows.length} Edge Config${rows.length === 1 ? "" : "s"} found under ${contextName} ${stamp_default()}`)}
|
|
13877
14060
|
`
|
|
13878
14061
|
);
|
|
13879
14062
|
if (rows.length === 0) {
|
|
13880
14063
|
return 0;
|
|
13881
14064
|
}
|
|
13882
14065
|
const tableRows = [
|
|
13883
|
-
["id", "slug", "items", "size", "updated"].map((h) => (0,
|
|
14066
|
+
["id", "slug", "items", "size", "updated"].map((h) => (0, import_chalk69.gray)(h)),
|
|
13884
14067
|
...rows.map((r) => [
|
|
13885
14068
|
r.id,
|
|
13886
14069
|
r.slug,
|
|
@@ -13895,7 +14078,7 @@ async function listCmd(client, argv) {
|
|
|
13895
14078
|
}
|
|
13896
14079
|
|
|
13897
14080
|
// src/commands/edge-config/add.ts
|
|
13898
|
-
var
|
|
14081
|
+
var import_chalk70 = __toESM(require_source(), 1);
|
|
13899
14082
|
|
|
13900
14083
|
// src/util/telemetry/commands/edge-config/add.ts
|
|
13901
14084
|
var EdgeConfigAddTelemetryClient = class extends TelemetryClient {
|
|
@@ -13961,7 +14144,7 @@ async function addCmd(client, argv) {
|
|
|
13961
14144
|
);
|
|
13962
14145
|
}
|
|
13963
14146
|
output_manager_default.error(
|
|
13964
|
-
`Missing slug. Usage: ${
|
|
14147
|
+
`Missing slug. Usage: ${import_chalk70.default.cyan(getCommandName("edge-config add <slug>"))}`
|
|
13965
14148
|
);
|
|
13966
14149
|
return 1;
|
|
13967
14150
|
}
|
|
@@ -14001,12 +14184,12 @@ async function addCmd(client, argv) {
|
|
|
14001
14184
|
`);
|
|
14002
14185
|
return 0;
|
|
14003
14186
|
}
|
|
14004
|
-
output_manager_default.success(`Edge Config ${
|
|
14187
|
+
output_manager_default.success(`Edge Config ${import_chalk70.default.bold(slug)} created.`);
|
|
14005
14188
|
return 0;
|
|
14006
14189
|
}
|
|
14007
14190
|
|
|
14008
14191
|
// src/commands/edge-config/get.ts
|
|
14009
|
-
var
|
|
14192
|
+
var import_chalk71 = __toESM(require_source(), 1);
|
|
14010
14193
|
|
|
14011
14194
|
// src/util/telemetry/commands/edge-config/get.ts
|
|
14012
14195
|
var EdgeConfigGetTelemetryClient = class extends TelemetryClient {
|
|
@@ -14079,7 +14262,7 @@ async function getCmd(client, argv) {
|
|
|
14079
14262
|
);
|
|
14080
14263
|
}
|
|
14081
14264
|
output_manager_default.error(
|
|
14082
|
-
`Missing id or slug. Usage: ${
|
|
14265
|
+
`Missing id or slug. Usage: ${import_chalk71.default.cyan(getCommandName("edge-config get <id-or-slug>"))}`
|
|
14083
14266
|
);
|
|
14084
14267
|
return 1;
|
|
14085
14268
|
}
|
|
@@ -14138,7 +14321,7 @@ async function getCmd(client, argv) {
|
|
|
14138
14321
|
}
|
|
14139
14322
|
|
|
14140
14323
|
// src/commands/edge-config/update.ts
|
|
14141
|
-
var
|
|
14324
|
+
var import_chalk72 = __toESM(require_source(), 1);
|
|
14142
14325
|
|
|
14143
14326
|
// src/util/telemetry/commands/edge-config/update.ts
|
|
14144
14327
|
var EdgeConfigUpdateTelemetryClient = class extends TelemetryClient {
|
|
@@ -14240,7 +14423,7 @@ async function updateCmd(client, argv) {
|
|
|
14240
14423
|
);
|
|
14241
14424
|
}
|
|
14242
14425
|
output_manager_default.error(
|
|
14243
|
-
`Missing id or slug. Usage: ${
|
|
14426
|
+
`Missing id or slug. Usage: ${import_chalk72.default.cyan(getCommandName("edge-config update <id-or-slug>"))}`
|
|
14244
14427
|
);
|
|
14245
14428
|
return 1;
|
|
14246
14429
|
}
|
|
@@ -14333,7 +14516,7 @@ async function updateCmd(client, argv) {
|
|
|
14333
14516
|
}
|
|
14334
14517
|
|
|
14335
14518
|
// src/commands/edge-config/remove.ts
|
|
14336
|
-
var
|
|
14519
|
+
var import_chalk73 = __toESM(require_source(), 1);
|
|
14337
14520
|
|
|
14338
14521
|
// src/util/telemetry/commands/edge-config/remove.ts
|
|
14339
14522
|
var EdgeConfigRemoveTelemetryClient = class extends TelemetryClient {
|
|
@@ -14400,7 +14583,7 @@ async function removeCmd(client, argv) {
|
|
|
14400
14583
|
);
|
|
14401
14584
|
}
|
|
14402
14585
|
output_manager_default.error(
|
|
14403
|
-
`Missing id or slug. Usage: ${
|
|
14586
|
+
`Missing id or slug. Usage: ${import_chalk73.default.cyan(getCommandName("edge-config remove <id-or-slug>"))}`
|
|
14404
14587
|
);
|
|
14405
14588
|
return 1;
|
|
14406
14589
|
}
|
|
@@ -14454,7 +14637,7 @@ async function removeCmd(client, argv) {
|
|
|
14454
14637
|
return 1;
|
|
14455
14638
|
}
|
|
14456
14639
|
if (!skipConfirmation && !await client.input.confirm(
|
|
14457
|
-
`Delete Edge Config ${
|
|
14640
|
+
`Delete Edge Config ${import_chalk73.default.bold(id)} (${import_chalk73.default.bold(idOrSlug)})?`,
|
|
14458
14641
|
false
|
|
14459
14642
|
)) {
|
|
14460
14643
|
output_manager_default.log("Canceled");
|
|
@@ -14484,12 +14667,12 @@ async function removeCmd(client, argv) {
|
|
|
14484
14667
|
);
|
|
14485
14668
|
return 0;
|
|
14486
14669
|
}
|
|
14487
|
-
output_manager_default.success(`Edge Config ${
|
|
14670
|
+
output_manager_default.success(`Edge Config ${import_chalk73.default.bold(id)} removed.`);
|
|
14488
14671
|
return 0;
|
|
14489
14672
|
}
|
|
14490
14673
|
|
|
14491
14674
|
// src/commands/edge-config/items.ts
|
|
14492
|
-
var
|
|
14675
|
+
var import_chalk74 = __toESM(require_source(), 1);
|
|
14493
14676
|
|
|
14494
14677
|
// src/util/telemetry/commands/edge-config/items.ts
|
|
14495
14678
|
var EdgeConfigItemsTelemetryClient = class extends TelemetryClient {
|
|
@@ -14556,7 +14739,7 @@ async function itemsCmd(client, argv) {
|
|
|
14556
14739
|
);
|
|
14557
14740
|
}
|
|
14558
14741
|
output_manager_default.error(
|
|
14559
|
-
`Missing id or slug. Usage: ${
|
|
14742
|
+
`Missing id or slug. Usage: ${import_chalk74.default.cyan(getCommandName("edge-config items <id-or-slug>"))}`
|
|
14560
14743
|
);
|
|
14561
14744
|
return 1;
|
|
14562
14745
|
}
|
|
@@ -14645,7 +14828,7 @@ async function itemsCmd(client, argv) {
|
|
|
14645
14828
|
}
|
|
14646
14829
|
|
|
14647
14830
|
// src/commands/edge-config/tokens.ts
|
|
14648
|
-
var
|
|
14831
|
+
var import_chalk75 = __toESM(require_source(), 1);
|
|
14649
14832
|
|
|
14650
14833
|
// src/util/telemetry/commands/edge-config/tokens.ts
|
|
14651
14834
|
var EdgeConfigTokensTelemetryClient = class extends TelemetryClient {
|
|
@@ -14729,7 +14912,7 @@ async function tokensCmd(client, argv) {
|
|
|
14729
14912
|
);
|
|
14730
14913
|
}
|
|
14731
14914
|
output_manager_default.error(
|
|
14732
|
-
`Missing id or slug. Usage: ${
|
|
14915
|
+
`Missing id or slug. Usage: ${import_chalk75.default.cyan(getCommandName("edge-config tokens <id-or-slug>"))}`
|
|
14733
14916
|
);
|
|
14734
14917
|
return 1;
|
|
14735
14918
|
}
|
|
@@ -14803,17 +14986,17 @@ async function tokensCmd(client, argv) {
|
|
|
14803
14986
|
}
|
|
14804
14987
|
output_manager_default.success("Token created.");
|
|
14805
14988
|
output_manager_default.print(
|
|
14806
|
-
`${
|
|
14989
|
+
`${import_chalk75.default.bold("Token")} (copy now; it will not be shown again):
|
|
14807
14990
|
${created.token}
|
|
14808
14991
|
`
|
|
14809
14992
|
);
|
|
14810
|
-
output_manager_default.print(`${(0,
|
|
14993
|
+
output_manager_default.print(`${(0, import_chalk75.gray)(`id: ${created.id}`)}
|
|
14811
14994
|
`);
|
|
14812
14995
|
return 0;
|
|
14813
14996
|
}
|
|
14814
14997
|
if (removeTokens?.length) {
|
|
14815
14998
|
if (!skipConfirmation && !await client.input.confirm(
|
|
14816
|
-
`Revoke ${removeTokens.length} token(s) on ${
|
|
14999
|
+
`Revoke ${removeTokens.length} token(s) on ${import_chalk75.default.bold(id)}?`,
|
|
14817
15000
|
false
|
|
14818
15001
|
)) {
|
|
14819
15002
|
output_manager_default.log("Canceled");
|
|
@@ -14844,7 +15027,7 @@ ${created.token}
|
|
|
14844
15027
|
return 0;
|
|
14845
15028
|
}
|
|
14846
15029
|
const tableRows = [
|
|
14847
|
-
["id", "label", "created"].map((h) => (0,
|
|
15030
|
+
["id", "label", "created"].map((h) => (0, import_chalk75.gray)(h)),
|
|
14848
15031
|
...rows.map((t) => [
|
|
14849
15032
|
t.id ?? "",
|
|
14850
15033
|
t.label ?? "",
|
|
@@ -15067,7 +15250,7 @@ var FlagsTelemetryClient = class extends TelemetryClient {
|
|
|
15067
15250
|
};
|
|
15068
15251
|
|
|
15069
15252
|
// src/commands/flags/ls.ts
|
|
15070
|
-
var
|
|
15253
|
+
var import_chalk76 = __toESM(require_source(), 1);
|
|
15071
15254
|
var import_ms11 = __toESM(require_ms(), 1);
|
|
15072
15255
|
var import_pluralize8 = __toESM(require_pluralize(), 1);
|
|
15073
15256
|
|
|
@@ -15152,11 +15335,11 @@ async function ls6(client, argv) {
|
|
|
15152
15335
|
outputJson2(client, sortedFlags);
|
|
15153
15336
|
} else if (flagsList.length === 0) {
|
|
15154
15337
|
output_manager_default.log(
|
|
15155
|
-
`No ${state} feature flags found for ${projectSlugLink} ${
|
|
15338
|
+
`No ${state} feature flags found for ${projectSlugLink} ${import_chalk76.default.gray(lsStamp())}`
|
|
15156
15339
|
);
|
|
15157
15340
|
} else {
|
|
15158
15341
|
output_manager_default.log(
|
|
15159
|
-
`${(0, import_pluralize8.default)("feature flag", flagsList.length, true)} found for ${projectSlugLink} ${
|
|
15342
|
+
`${(0, import_pluralize8.default)("feature flag", flagsList.length, true)} found for ${projectSlugLink} ${import_chalk76.default.gray(lsStamp())}`
|
|
15160
15343
|
);
|
|
15161
15344
|
printFlagsTable(sortedFlags);
|
|
15162
15345
|
}
|
|
@@ -15187,9 +15370,9 @@ function printFlagsTable(flags) {
|
|
|
15187
15370
|
const headers = ["Name", "Kind", "State", "Variants", "Updated"];
|
|
15188
15371
|
const now = Date.now();
|
|
15189
15372
|
const rows = flags.map((flag) => [
|
|
15190
|
-
|
|
15373
|
+
import_chalk76.default.bold(flag.slug),
|
|
15191
15374
|
flag.kind,
|
|
15192
|
-
flag.state === "active" ?
|
|
15375
|
+
flag.state === "active" ? import_chalk76.default.green(flag.state) : import_chalk76.default.gray(flag.state),
|
|
15193
15376
|
String(flag.variants.length),
|
|
15194
15377
|
(0, import_ms11.default)(now - flag.updatedAt) + " ago"
|
|
15195
15378
|
]);
|
|
@@ -15216,7 +15399,7 @@ var FlagsInspectTelemetryClient = class extends TelemetryClient {
|
|
|
15216
15399
|
};
|
|
15217
15400
|
|
|
15218
15401
|
// src/util/flags/print-flag-details.ts
|
|
15219
|
-
var
|
|
15402
|
+
var import_chalk78 = __toESM(require_source(), 1);
|
|
15220
15403
|
|
|
15221
15404
|
// src/util/flags/dashboard-url.ts
|
|
15222
15405
|
function getFlagDashboardUrl(orgSlug, projectName, flagSlug) {
|
|
@@ -15227,14 +15410,14 @@ function getFlagsDashboardUrl(orgSlug, projectName) {
|
|
|
15227
15410
|
}
|
|
15228
15411
|
|
|
15229
15412
|
// src/util/flags/resolve-variant.ts
|
|
15230
|
-
var
|
|
15413
|
+
var import_chalk77 = __toESM(require_source(), 1);
|
|
15231
15414
|
function formatVariantValue(value) {
|
|
15232
15415
|
return JSON.stringify(value);
|
|
15233
15416
|
}
|
|
15234
15417
|
function formatVariantForDisplay(variant) {
|
|
15235
15418
|
const parts = [formatVariantValue(variant.value)];
|
|
15236
15419
|
if (variant.label) {
|
|
15237
|
-
parts.push(
|
|
15420
|
+
parts.push(import_chalk77.default.dim(variant.label));
|
|
15238
15421
|
}
|
|
15239
15422
|
return parts.join(" ");
|
|
15240
15423
|
}
|
|
@@ -15292,14 +15475,14 @@ function formatAvailableVariant(variant) {
|
|
|
15292
15475
|
if (!variant.label) {
|
|
15293
15476
|
return value;
|
|
15294
15477
|
}
|
|
15295
|
-
return `${value} ${
|
|
15478
|
+
return `${value} ${import_chalk77.default.dim(variant.label)}`;
|
|
15296
15479
|
}
|
|
15297
15480
|
function formatStyledVariantValue(value) {
|
|
15298
15481
|
const formattedValue = formatVariantValue(value);
|
|
15299
15482
|
if (typeof value !== "string") {
|
|
15300
|
-
return
|
|
15483
|
+
return import_chalk77.default.bold(formattedValue);
|
|
15301
15484
|
}
|
|
15302
|
-
return `"${
|
|
15485
|
+
return `"${import_chalk77.default.bold(formattedValue.slice(1, -1))}"`;
|
|
15303
15486
|
}
|
|
15304
15487
|
|
|
15305
15488
|
// src/util/flags/print-flag-details.ts
|
|
@@ -15314,41 +15497,41 @@ function printFlagDetails({
|
|
|
15314
15497
|
const dashboardUrl = getFlagDashboardUrl(orgSlug, projectName, flag.slug);
|
|
15315
15498
|
output_manager_default.log(
|
|
15316
15499
|
`
|
|
15317
|
-
Feature flag ${
|
|
15500
|
+
Feature flag ${import_chalk78.default.bold(flag.slug)} for ${projectSlugLink}
|
|
15318
15501
|
`
|
|
15319
15502
|
);
|
|
15320
|
-
output_manager_default.print(` ${
|
|
15503
|
+
output_manager_default.print(` ${import_chalk78.default.cyan(dashboardUrl)}
|
|
15321
15504
|
|
|
15322
15505
|
`);
|
|
15323
|
-
output_manager_default.print(` ${
|
|
15506
|
+
output_manager_default.print(` ${import_chalk78.default.dim("ID:")} ${flag.id}
|
|
15324
15507
|
`);
|
|
15325
|
-
output_manager_default.print(` ${
|
|
15508
|
+
output_manager_default.print(` ${import_chalk78.default.dim("Kind:")} ${flag.kind}
|
|
15326
15509
|
`);
|
|
15327
15510
|
output_manager_default.print(
|
|
15328
|
-
` ${
|
|
15511
|
+
` ${import_chalk78.default.dim("State:")} ${flag.state === "active" ? import_chalk78.default.green(flag.state) : import_chalk78.default.gray(flag.state)}
|
|
15329
15512
|
`
|
|
15330
15513
|
);
|
|
15331
15514
|
if (flag.description) {
|
|
15332
|
-
output_manager_default.print(` ${
|
|
15515
|
+
output_manager_default.print(` ${import_chalk78.default.dim("Description:")} ${flag.description}
|
|
15333
15516
|
`);
|
|
15334
15517
|
}
|
|
15335
15518
|
if (showTimestamps) {
|
|
15336
15519
|
output_manager_default.print(
|
|
15337
|
-
` ${
|
|
15520
|
+
` ${import_chalk78.default.dim("Created:")} ${formatDate(flag.createdAt)}
|
|
15338
15521
|
`
|
|
15339
15522
|
);
|
|
15340
15523
|
output_manager_default.print(
|
|
15341
|
-
` ${
|
|
15524
|
+
` ${import_chalk78.default.dim("Updated:")} ${formatDate(flag.updatedAt)}
|
|
15342
15525
|
`
|
|
15343
15526
|
);
|
|
15344
15527
|
}
|
|
15345
15528
|
output_manager_default.print(`
|
|
15346
|
-
${
|
|
15529
|
+
${import_chalk78.default.dim("Variants:")}
|
|
15347
15530
|
`);
|
|
15348
15531
|
for (const [index, variant] of flag.variants.entries()) {
|
|
15349
15532
|
output_manager_default.print(` ${formatVariantListSummary(variant)}
|
|
15350
15533
|
`);
|
|
15351
|
-
output_manager_default.print(` ${
|
|
15534
|
+
output_manager_default.print(` ${import_chalk78.default.dim(`id: ${variant.id}`)}
|
|
15352
15535
|
`);
|
|
15353
15536
|
if (index < flag.variants.length - 1) {
|
|
15354
15537
|
output_manager_default.print("\n");
|
|
@@ -15359,12 +15542,12 @@ Feature flag ${import_chalk77.default.bold(flag.slug)} for ${projectSlugLink}
|
|
|
15359
15542
|
function printFlagEnvironmentDetails(flag, settings, environments) {
|
|
15360
15543
|
const sortedEnvs = getSortedEnvironmentEntries(flag, environments);
|
|
15361
15544
|
output_manager_default.print(`
|
|
15362
|
-
${
|
|
15545
|
+
${import_chalk78.default.dim("Environments:")}
|
|
15363
15546
|
`);
|
|
15364
15547
|
for (const [envName, envConfig] of sortedEnvs) {
|
|
15365
15548
|
if (envConfig.reuse?.active) {
|
|
15366
15549
|
output_manager_default.print(
|
|
15367
|
-
` ${
|
|
15550
|
+
` ${import_chalk78.default.bold(envName)}: reuses ${import_chalk78.default.cyan(envConfig.reuse.environment)} environment
|
|
15368
15551
|
`
|
|
15369
15552
|
);
|
|
15370
15553
|
continue;
|
|
@@ -15372,10 +15555,10 @@ function printFlagEnvironmentDetails(flag, settings, environments) {
|
|
|
15372
15555
|
if (envConfig.active) {
|
|
15373
15556
|
const hasCustomConfiguration = hasCustomConfigurationEnabled(envConfig);
|
|
15374
15557
|
const envSummary = hasCustomConfiguration ? "custom" : formatEnvironmentOutcome(envConfig.fallthrough, flag.variants);
|
|
15375
|
-
output_manager_default.print(` ${
|
|
15558
|
+
output_manager_default.print(` ${import_chalk78.default.bold(envName)}: ${envSummary}
|
|
15376
15559
|
`);
|
|
15377
15560
|
if (envConfig.targets && Object.keys(envConfig.targets).length > 0) {
|
|
15378
|
-
output_manager_default.print(` ${
|
|
15561
|
+
output_manager_default.print(` ${import_chalk78.default.dim("Targeting:")}
|
|
15379
15562
|
`);
|
|
15380
15563
|
for (const [variantId2, entityKinds] of Object.entries(
|
|
15381
15564
|
envConfig.targets
|
|
@@ -15394,10 +15577,10 @@ function printFlagEnvironmentDetails(flag, settings, environments) {
|
|
|
15394
15577
|
attribute,
|
|
15395
15578
|
v.value
|
|
15396
15579
|
);
|
|
15397
|
-
return label ? `${v.value} ${
|
|
15580
|
+
return label ? `${v.value} ${import_chalk78.default.gray(label)}` : v.value;
|
|
15398
15581
|
}).join(", ");
|
|
15399
15582
|
output_manager_default.print(
|
|
15400
|
-
` ${
|
|
15583
|
+
` ${import_chalk78.default.dim(`${entityKind}.${attribute}:`)} ${valueList} ${import_chalk78.default.dim("\u2192")} ${variantSummary}
|
|
15401
15584
|
`
|
|
15402
15585
|
);
|
|
15403
15586
|
}
|
|
@@ -15405,19 +15588,19 @@ function printFlagEnvironmentDetails(flag, settings, environments) {
|
|
|
15405
15588
|
}
|
|
15406
15589
|
}
|
|
15407
15590
|
if (envConfig.rules && envConfig.rules.length > 0) {
|
|
15408
|
-
output_manager_default.print(` ${
|
|
15591
|
+
output_manager_default.print(` ${import_chalk78.default.dim("Rules:")}
|
|
15409
15592
|
`);
|
|
15410
15593
|
for (const rule of envConfig.rules) {
|
|
15411
15594
|
const outcome = formatEnvironmentOutcome(rule.outcome, flag.variants);
|
|
15412
|
-
output_manager_default.print(` ${
|
|
15595
|
+
output_manager_default.print(` ${import_chalk78.default.dim("\u2192")} ${outcome}
|
|
15413
15596
|
`);
|
|
15414
15597
|
for (const condition of rule.conditions) {
|
|
15415
15598
|
const { text, listItems } = formatCondition2(condition, settings);
|
|
15416
|
-
output_manager_default.print(` ${
|
|
15599
|
+
output_manager_default.print(` ${import_chalk78.default.dim("if")} ${text}
|
|
15417
15600
|
`);
|
|
15418
15601
|
if (listItems && listItems.length > 0) {
|
|
15419
15602
|
for (const item of listItems) {
|
|
15420
|
-
output_manager_default.print(` ${
|
|
15603
|
+
output_manager_default.print(` ${import_chalk78.default.dim("-")} ${item}
|
|
15421
15604
|
`);
|
|
15422
15605
|
}
|
|
15423
15606
|
}
|
|
@@ -15434,14 +15617,14 @@ function printFlagEnvironmentDetails(flag, settings, environments) {
|
|
|
15434
15617
|
defaultVariant,
|
|
15435
15618
|
fallthrough.variantId
|
|
15436
15619
|
);
|
|
15437
|
-
output_manager_default.print(` ${
|
|
15620
|
+
output_manager_default.print(` ${import_chalk78.default.dim("Default:")} ${defaultSummary}
|
|
15438
15621
|
`);
|
|
15439
15622
|
} else if (fallthrough.type === "split") {
|
|
15440
15623
|
const weights = formatSplitWeights(
|
|
15441
15624
|
fallthrough.weights,
|
|
15442
15625
|
flag.variants
|
|
15443
15626
|
);
|
|
15444
|
-
output_manager_default.print(` ${
|
|
15627
|
+
output_manager_default.print(` ${import_chalk78.default.dim("Default split:")} ${weights}
|
|
15445
15628
|
`);
|
|
15446
15629
|
}
|
|
15447
15630
|
}
|
|
@@ -15453,7 +15636,7 @@ function printFlagEnvironmentDetails(flag, settings, environments) {
|
|
|
15453
15636
|
pausedVariant,
|
|
15454
15637
|
envConfig.pausedOutcome?.variantId || "paused"
|
|
15455
15638
|
);
|
|
15456
|
-
output_manager_default.print(` ${
|
|
15639
|
+
output_manager_default.print(` ${import_chalk78.default.bold(envName)}: ${pausedSummary}
|
|
15457
15640
|
`);
|
|
15458
15641
|
}
|
|
15459
15642
|
}
|
|
@@ -15520,19 +15703,19 @@ function formatSplitWeights(weights, variants) {
|
|
|
15520
15703
|
}
|
|
15521
15704
|
function formatEnvironmentVariantSummary(variant, fallback) {
|
|
15522
15705
|
if (!variant) {
|
|
15523
|
-
return
|
|
15706
|
+
return import_chalk78.default.bold(fallback);
|
|
15524
15707
|
}
|
|
15525
15708
|
if (variant.label) {
|
|
15526
|
-
return
|
|
15709
|
+
return import_chalk78.default.bold(variant.label);
|
|
15527
15710
|
}
|
|
15528
|
-
return
|
|
15711
|
+
return import_chalk78.default.bold(formatVariantValue(variant.value));
|
|
15529
15712
|
}
|
|
15530
15713
|
function formatVariantListSummary(variant) {
|
|
15531
15714
|
const value = formatVariantValue(variant.value);
|
|
15532
15715
|
if (!variant.label) {
|
|
15533
15716
|
return value;
|
|
15534
15717
|
}
|
|
15535
|
-
return `${value}: ${
|
|
15718
|
+
return `${value}: ${import_chalk78.default.gray(variant.label)}`;
|
|
15536
15719
|
}
|
|
15537
15720
|
function formatCondition2(condition, settings) {
|
|
15538
15721
|
let lhs;
|
|
@@ -15541,7 +15724,7 @@ function formatCondition2(condition, settings) {
|
|
|
15541
15724
|
} else {
|
|
15542
15725
|
lhs = `${condition.lhs.kind}.${condition.lhs.attribute}`;
|
|
15543
15726
|
}
|
|
15544
|
-
const cmp =
|
|
15727
|
+
const cmp = import_chalk78.default.dim(formatComparison(condition.cmp));
|
|
15545
15728
|
if (condition.rhs === void 0 || condition.rhs === null) {
|
|
15546
15729
|
return { text: `${lhs} ${cmp}` };
|
|
15547
15730
|
}
|
|
@@ -15556,7 +15739,7 @@ function formatCondition2(condition, settings) {
|
|
|
15556
15739
|
condition.lhs.attribute,
|
|
15557
15740
|
itemValue
|
|
15558
15741
|
);
|
|
15559
|
-
return label ? `${itemValue} ${
|
|
15742
|
+
return label ? `${itemValue} ${import_chalk78.default.gray(label)}` : itemValue;
|
|
15560
15743
|
}
|
|
15561
15744
|
return itemValue;
|
|
15562
15745
|
});
|
|
@@ -15572,7 +15755,7 @@ function formatCondition2(condition, settings) {
|
|
|
15572
15755
|
condition.lhs.attribute,
|
|
15573
15756
|
String(condition.rhs)
|
|
15574
15757
|
);
|
|
15575
|
-
rhs = label ? `${condition.rhs} ${
|
|
15758
|
+
rhs = label ? `${condition.rhs} ${import_chalk78.default.gray(label)}` : String(condition.rhs);
|
|
15576
15759
|
} else {
|
|
15577
15760
|
rhs = String(condition.rhs);
|
|
15578
15761
|
}
|
|
@@ -15653,7 +15836,7 @@ async function inspect3(client, argv) {
|
|
|
15653
15836
|
}
|
|
15654
15837
|
|
|
15655
15838
|
// src/commands/flags/add.ts
|
|
15656
|
-
var
|
|
15839
|
+
var import_chalk79 = __toESM(require_source(), 1);
|
|
15657
15840
|
import { randomBytes } from "crypto";
|
|
15658
15841
|
|
|
15659
15842
|
// src/util/flags/create-flag.ts
|
|
@@ -15805,7 +15988,7 @@ async function create(client, argv) {
|
|
|
15805
15988
|
const flag = await createFlag(client, project.id, request2);
|
|
15806
15989
|
output_manager_default.stopSpinner();
|
|
15807
15990
|
output_manager_default.success(
|
|
15808
|
-
`Feature flag ${
|
|
15991
|
+
`Feature flag ${import_chalk79.default.bold(flag.slug)} created successfully`
|
|
15809
15992
|
);
|
|
15810
15993
|
printFlagDetails({
|
|
15811
15994
|
flag,
|
|
@@ -16018,7 +16201,7 @@ async function openFlag(client, argv) {
|
|
|
16018
16201
|
}
|
|
16019
16202
|
|
|
16020
16203
|
// src/commands/flags/update.ts
|
|
16021
|
-
var
|
|
16204
|
+
var import_chalk80 = __toESM(require_source(), 1);
|
|
16022
16205
|
|
|
16023
16206
|
// src/util/flags/update-flag.ts
|
|
16024
16207
|
async function updateFlag(client, projectId, flagIdOrSlug, request2) {
|
|
@@ -16154,7 +16337,7 @@ async function update(client, argv) {
|
|
|
16154
16337
|
output_manager_default.stopSpinner();
|
|
16155
16338
|
if (flag.state === "archived") {
|
|
16156
16339
|
output_manager_default.error(
|
|
16157
|
-
`Flag ${
|
|
16340
|
+
`Flag ${import_chalk80.default.bold(flag.slug)} is archived and cannot be updated`
|
|
16158
16341
|
);
|
|
16159
16342
|
return 1;
|
|
16160
16343
|
}
|
|
@@ -16167,7 +16350,7 @@ async function update(client, argv) {
|
|
|
16167
16350
|
variantUpdate
|
|
16168
16351
|
]);
|
|
16169
16352
|
if (changedVariants.length === 0) {
|
|
16170
|
-
output_manager_default.warn(`Flag ${
|
|
16353
|
+
output_manager_default.warn(`Flag ${import_chalk80.default.bold(flag.slug)} is already up to date`);
|
|
16171
16354
|
return 0;
|
|
16172
16355
|
}
|
|
16173
16356
|
const updateMessage = await resolveOptionalInput(
|
|
@@ -16189,10 +16372,10 @@ async function update(client, argv) {
|
|
|
16189
16372
|
}
|
|
16190
16373
|
);
|
|
16191
16374
|
output_manager_default.stopSpinner();
|
|
16192
|
-
output_manager_default.success(`Feature flag ${
|
|
16375
|
+
output_manager_default.success(`Feature flag ${import_chalk80.default.bold(flag.slug)} has been updated`);
|
|
16193
16376
|
for (const variant of changedVariants) {
|
|
16194
16377
|
output_manager_default.log(
|
|
16195
|
-
` ${
|
|
16378
|
+
` ${import_chalk80.default.dim("Variant:")} ${formatVariantForDisplay(variant)}`
|
|
16196
16379
|
);
|
|
16197
16380
|
}
|
|
16198
16381
|
} catch (err) {
|
|
@@ -16252,7 +16435,7 @@ async function resolveSelectedVariant(client, flag, selector) {
|
|
|
16252
16435
|
const selectedVariantId = await client.input.select({
|
|
16253
16436
|
message: "Select a variant to update:",
|
|
16254
16437
|
choices: flag.variants.map((variant) => ({
|
|
16255
|
-
name: `${formatVariantForDisplay(variant)} ${
|
|
16438
|
+
name: `${formatVariantForDisplay(variant)} ${import_chalk80.default.dim(`[id: ${variant.id}]`)}`,
|
|
16256
16439
|
value: variant.id
|
|
16257
16440
|
}))
|
|
16258
16441
|
});
|
|
@@ -16350,10 +16533,10 @@ function validateVariantValue2(value, kind) {
|
|
|
16350
16533
|
}
|
|
16351
16534
|
|
|
16352
16535
|
// src/commands/flags/set.ts
|
|
16353
|
-
var
|
|
16536
|
+
var import_chalk82 = __toESM(require_source(), 1);
|
|
16354
16537
|
|
|
16355
16538
|
// src/util/flags/environment-variant.ts
|
|
16356
|
-
var
|
|
16539
|
+
var import_chalk81 = __toESM(require_source(), 1);
|
|
16357
16540
|
async function resolveFlagEnvironment(client, flag, environment, promptMessage, options = {}) {
|
|
16358
16541
|
let nextEnvironment = environment;
|
|
16359
16542
|
if (!nextEnvironment) {
|
|
@@ -16392,7 +16575,7 @@ async function resolveFlagEnvironment(client, flag, environment, promptMessage,
|
|
|
16392
16575
|
return nextEnvironment;
|
|
16393
16576
|
}
|
|
16394
16577
|
function formatEnvironmentChoiceLabel(envName, envConfig) {
|
|
16395
|
-
const status3 = envConfig?.active ?
|
|
16578
|
+
const status3 = envConfig?.active ? import_chalk81.default.green("active") : import_chalk81.default.yellow("paused");
|
|
16396
16579
|
return `${envName} (${status3})`;
|
|
16397
16580
|
}
|
|
16398
16581
|
function isOverridingEnvironmentToVariant(envConfig, variantId2) {
|
|
@@ -16429,7 +16612,7 @@ function getBooleanVariant(flag, value) {
|
|
|
16429
16612
|
const variant = flag.variants.find((candidate) => candidate.value === value);
|
|
16430
16613
|
if (!variant) {
|
|
16431
16614
|
throw new Error(
|
|
16432
|
-
`Flag ${
|
|
16615
|
+
`Flag ${import_chalk81.default.bold(flag.slug)} is missing the standard boolean variants`
|
|
16433
16616
|
);
|
|
16434
16617
|
}
|
|
16435
16618
|
return variant;
|
|
@@ -16538,7 +16721,7 @@ async function set2(client, argv) {
|
|
|
16538
16721
|
output_manager_default.stopSpinner();
|
|
16539
16722
|
if (flag.state === "archived") {
|
|
16540
16723
|
output_manager_default.error(
|
|
16541
|
-
`Flag ${
|
|
16724
|
+
`Flag ${import_chalk82.default.bold(flag.slug)} is archived and cannot be set`
|
|
16542
16725
|
);
|
|
16543
16726
|
return 1;
|
|
16544
16727
|
}
|
|
@@ -16560,7 +16743,7 @@ async function set2(client, argv) {
|
|
|
16560
16743
|
const envConfig = flag.environments[selectedEnvironment];
|
|
16561
16744
|
if (isOverridingEnvironmentToVariant(envConfig, selectedVariant.id)) {
|
|
16562
16745
|
output_manager_default.warn(
|
|
16563
|
-
`Flag ${
|
|
16746
|
+
`Flag ${import_chalk82.default.bold(flag.slug)} is already serving ${formatVariantForDisplay(selectedVariant)} in ${selectedEnvironment}`
|
|
16564
16747
|
);
|
|
16565
16748
|
return 0;
|
|
16566
16749
|
}
|
|
@@ -16583,7 +16766,7 @@ async function set2(client, argv) {
|
|
|
16583
16766
|
output_manager_default.stopSpinner();
|
|
16584
16767
|
output_manager_default.success(presentation.success(flag.slug, selectedEnvironment));
|
|
16585
16768
|
output_manager_default.log(
|
|
16586
|
-
` ${
|
|
16769
|
+
` ${import_chalk82.default.dim("Serving variant:")} ${formatVariantForDisplay(selectedVariant)}`
|
|
16587
16770
|
);
|
|
16588
16771
|
} catch (err) {
|
|
16589
16772
|
output_manager_default.stopSpinner();
|
|
@@ -16624,26 +16807,26 @@ function getSetPresentation(flag, variant) {
|
|
|
16624
16807
|
if (flag.kind === "boolean" && variant.value === true) {
|
|
16625
16808
|
return {
|
|
16626
16809
|
spinner: (environment) => `Enabling flag in ${environment}...`,
|
|
16627
|
-
success: (slug, environment) => `Feature flag ${
|
|
16810
|
+
success: (slug, environment) => `Feature flag ${import_chalk82.default.bold(slug)} has been enabled in ${import_chalk82.default.bold(environment)}`,
|
|
16628
16811
|
defaultMessage: (environment) => `Enabled for ${environment} via CLI`
|
|
16629
16812
|
};
|
|
16630
16813
|
}
|
|
16631
16814
|
if (flag.kind === "boolean" && variant.value === false) {
|
|
16632
16815
|
return {
|
|
16633
16816
|
spinner: (environment) => `Disabling flag in ${environment}...`,
|
|
16634
|
-
success: (slug, environment) => `Feature flag ${
|
|
16817
|
+
success: (slug, environment) => `Feature flag ${import_chalk82.default.bold(slug)} has been disabled in ${import_chalk82.default.bold(environment)}`,
|
|
16635
16818
|
defaultMessage: (environment) => `Disabled for ${environment} via CLI`
|
|
16636
16819
|
};
|
|
16637
16820
|
}
|
|
16638
16821
|
return {
|
|
16639
16822
|
spinner: (environment) => `Setting variant in ${environment}...`,
|
|
16640
|
-
success: (slug, environment) => `Feature flag ${
|
|
16823
|
+
success: (slug, environment) => `Feature flag ${import_chalk82.default.bold(slug)} has been set in ${import_chalk82.default.bold(environment)}`,
|
|
16641
16824
|
defaultMessage: (environment) => `Set variant for ${environment} via CLI`
|
|
16642
16825
|
};
|
|
16643
16826
|
}
|
|
16644
16827
|
|
|
16645
16828
|
// src/commands/flags/rm.ts
|
|
16646
|
-
var
|
|
16829
|
+
var import_chalk83 = __toESM(require_source(), 1);
|
|
16647
16830
|
|
|
16648
16831
|
// src/util/flags/delete-flag.ts
|
|
16649
16832
|
async function deleteFlag(client, projectId, flagIdOrSlug) {
|
|
@@ -16715,7 +16898,7 @@ async function rm5(client, argv) {
|
|
|
16715
16898
|
output_manager_default.stopSpinner();
|
|
16716
16899
|
if (flag.state !== "archived") {
|
|
16717
16900
|
output_manager_default.error(
|
|
16718
|
-
`Flag ${
|
|
16901
|
+
`Flag ${import_chalk83.default.bold(flag.slug)} must be archived before it can be deleted. Run ${getCommandName(`flags archive ${flag.slug}`)} first.`
|
|
16719
16902
|
);
|
|
16720
16903
|
return 1;
|
|
16721
16904
|
}
|
|
@@ -16727,7 +16910,7 @@ async function rm5(client, argv) {
|
|
|
16727
16910
|
return 1;
|
|
16728
16911
|
}
|
|
16729
16912
|
const confirmed = await client.input.confirm(
|
|
16730
|
-
`Are you sure you want to delete ${
|
|
16913
|
+
`Are you sure you want to delete ${import_chalk83.default.bold(flag.slug)}? This action cannot be undone.`,
|
|
16731
16914
|
false
|
|
16732
16915
|
);
|
|
16733
16916
|
if (!confirmed) {
|
|
@@ -16738,7 +16921,7 @@ async function rm5(client, argv) {
|
|
|
16738
16921
|
output_manager_default.spinner("Deleting flag...");
|
|
16739
16922
|
await deleteFlag(client, project.id, flagArg);
|
|
16740
16923
|
output_manager_default.stopSpinner();
|
|
16741
|
-
output_manager_default.success(`Feature flag ${
|
|
16924
|
+
output_manager_default.success(`Feature flag ${import_chalk83.default.bold(flag.slug)} has been deleted`);
|
|
16742
16925
|
} catch (err) {
|
|
16743
16926
|
output_manager_default.stopSpinner();
|
|
16744
16927
|
printError(err);
|
|
@@ -16748,7 +16931,7 @@ async function rm5(client, argv) {
|
|
|
16748
16931
|
}
|
|
16749
16932
|
|
|
16750
16933
|
// src/commands/flags/archive.ts
|
|
16751
|
-
var
|
|
16934
|
+
var import_chalk84 = __toESM(require_source(), 1);
|
|
16752
16935
|
|
|
16753
16936
|
// src/util/telemetry/commands/flags/archive.ts
|
|
16754
16937
|
var FlagsArchiveTelemetryClient = class extends TelemetryClient {
|
|
@@ -16808,7 +16991,7 @@ async function archive(client, argv) {
|
|
|
16808
16991
|
const flag = await getFlag(client, project.id, flagArg);
|
|
16809
16992
|
output_manager_default.stopSpinner();
|
|
16810
16993
|
if (flag.state === "archived") {
|
|
16811
|
-
output_manager_default.warn(`Flag ${
|
|
16994
|
+
output_manager_default.warn(`Flag ${import_chalk84.default.bold(flag.slug)} is already archived`);
|
|
16812
16995
|
return 0;
|
|
16813
16996
|
}
|
|
16814
16997
|
if (!skipConfirmation) {
|
|
@@ -16819,7 +17002,7 @@ async function archive(client, argv) {
|
|
|
16819
17002
|
return 1;
|
|
16820
17003
|
}
|
|
16821
17004
|
const confirmed = await client.input.confirm(
|
|
16822
|
-
`Are you sure you want to archive ${
|
|
17005
|
+
`Are you sure you want to archive ${import_chalk84.default.bold(flag.slug)}?`,
|
|
16823
17006
|
false
|
|
16824
17007
|
);
|
|
16825
17008
|
if (!confirmed) {
|
|
@@ -16833,10 +17016,10 @@ async function archive(client, argv) {
|
|
|
16833
17016
|
message: "Archived via CLI"
|
|
16834
17017
|
});
|
|
16835
17018
|
output_manager_default.stopSpinner();
|
|
16836
|
-
output_manager_default.success(`Feature flag ${
|
|
17019
|
+
output_manager_default.success(`Feature flag ${import_chalk84.default.bold(flag.slug)} has been archived`);
|
|
16837
17020
|
output_manager_default.log(
|
|
16838
17021
|
`
|
|
16839
|
-
To restore this flag, visit the dashboard: ${
|
|
17022
|
+
To restore this flag, visit the dashboard: ${import_chalk84.default.cyan(getFlagsDashboardUrl(link.org.slug, project.name) + "/archive")}`
|
|
16840
17023
|
);
|
|
16841
17024
|
} catch (err) {
|
|
16842
17025
|
output_manager_default.stopSpinner();
|
|
@@ -16847,10 +17030,10 @@ To restore this flag, visit the dashboard: ${import_chalk83.default.cyan(getFlag
|
|
|
16847
17030
|
}
|
|
16848
17031
|
|
|
16849
17032
|
// src/commands/flags/disable.ts
|
|
16850
|
-
var
|
|
17033
|
+
var import_chalk86 = __toESM(require_source(), 1);
|
|
16851
17034
|
|
|
16852
17035
|
// src/util/flags/log-non-boolean-guidance.ts
|
|
16853
|
-
var
|
|
17036
|
+
var import_chalk85 = __toESM(require_source(), 1);
|
|
16854
17037
|
function logNonBooleanFlagGuidance(flag, {
|
|
16855
17038
|
attemptedSubcommand,
|
|
16856
17039
|
environment,
|
|
@@ -16864,7 +17047,7 @@ function logNonBooleanFlagGuidance(flag, {
|
|
|
16864
17047
|
`The ${getCommandName(`flags ${attemptedSubcommand}`)} command only works with boolean flags.`
|
|
16865
17048
|
);
|
|
16866
17049
|
output_manager_default.log(
|
|
16867
|
-
`Flag ${
|
|
17050
|
+
`Flag ${import_chalk85.default.bold(flag.slug)} is a ${import_chalk85.default.cyan(flag.kind)} flag. Set a specific variant instead:`
|
|
16868
17051
|
);
|
|
16869
17052
|
output_manager_default.log(
|
|
16870
17053
|
` ${getCommandName(
|
|
@@ -16880,7 +17063,7 @@ function logNonBooleanFlagGuidance(flag, {
|
|
|
16880
17063
|
output_manager_default.log(
|
|
16881
17064
|
`See full flag details with ${getCommandName(`flags inspect ${flag.slug}`)}`
|
|
16882
17065
|
);
|
|
16883
|
-
output_manager_default.log(`Open in the dashboard: ${
|
|
17066
|
+
output_manager_default.log(`Open in the dashboard: ${import_chalk85.default.cyan(dashboardUrl)}`);
|
|
16884
17067
|
}
|
|
16885
17068
|
function getSuggestedSetCommand(slug, environment, isInteractive) {
|
|
16886
17069
|
const parts = [`flags set ${slug}`];
|
|
@@ -17023,7 +17206,7 @@ async function disable2(client, argv) {
|
|
|
17023
17206
|
output_manager_default.stopSpinner();
|
|
17024
17207
|
if (flag.state === "archived") {
|
|
17025
17208
|
output_manager_default.error(
|
|
17026
|
-
`Flag ${
|
|
17209
|
+
`Flag ${import_chalk86.default.bold(flag.slug)} is archived and cannot be disabled`
|
|
17027
17210
|
);
|
|
17028
17211
|
return 1;
|
|
17029
17212
|
}
|
|
@@ -17076,7 +17259,7 @@ async function disable2(client, argv) {
|
|
|
17076
17259
|
}
|
|
17077
17260
|
if (isPausingEnvironmentToVariant(envConfig, selectedVariant.id)) {
|
|
17078
17261
|
output_manager_default.warn(
|
|
17079
|
-
`Flag ${
|
|
17262
|
+
`Flag ${import_chalk86.default.bold(flag.slug)} is already disabled in ${environment}`
|
|
17080
17263
|
);
|
|
17081
17264
|
return 0;
|
|
17082
17265
|
}
|
|
@@ -17097,10 +17280,10 @@ async function disable2(client, argv) {
|
|
|
17097
17280
|
});
|
|
17098
17281
|
output_manager_default.stopSpinner();
|
|
17099
17282
|
output_manager_default.success(
|
|
17100
|
-
`Feature flag ${
|
|
17283
|
+
`Feature flag ${import_chalk86.default.bold(flag.slug)} has been disabled in ${import_chalk86.default.bold(environment)}`
|
|
17101
17284
|
);
|
|
17102
17285
|
output_manager_default.log(
|
|
17103
|
-
` ${
|
|
17286
|
+
` ${import_chalk86.default.dim("Serving variant:")} ${formatVariantForDisplay(selectedVariant)}`
|
|
17104
17287
|
);
|
|
17105
17288
|
} catch (err) {
|
|
17106
17289
|
output_manager_default.stopSpinner();
|
|
@@ -17136,7 +17319,7 @@ function getDefaultDisableMessage(environment) {
|
|
|
17136
17319
|
}
|
|
17137
17320
|
|
|
17138
17321
|
// src/commands/flags/enable.ts
|
|
17139
|
-
var
|
|
17322
|
+
var import_chalk87 = __toESM(require_source(), 1);
|
|
17140
17323
|
|
|
17141
17324
|
// src/util/telemetry/commands/flags/enable.ts
|
|
17142
17325
|
var FlagsEnableTelemetryClient = class extends TelemetryClient {
|
|
@@ -17216,7 +17399,7 @@ async function enable2(client, argv) {
|
|
|
17216
17399
|
output_manager_default.stopSpinner();
|
|
17217
17400
|
if (flag.state === "archived") {
|
|
17218
17401
|
output_manager_default.error(
|
|
17219
|
-
`Flag ${
|
|
17402
|
+
`Flag ${import_chalk87.default.bold(flag.slug)} is archived and cannot be enabled`
|
|
17220
17403
|
);
|
|
17221
17404
|
return 1;
|
|
17222
17405
|
}
|
|
@@ -17261,7 +17444,7 @@ async function enable2(client, argv) {
|
|
|
17261
17444
|
const onVariant = getBooleanVariant(flag, true);
|
|
17262
17445
|
if (isPausingEnvironmentToVariant(envConfig, onVariant.id)) {
|
|
17263
17446
|
output_manager_default.warn(
|
|
17264
|
-
`Flag ${
|
|
17447
|
+
`Flag ${import_chalk87.default.bold(flag.slug)} is already enabled in ${environment}`
|
|
17265
17448
|
);
|
|
17266
17449
|
return 0;
|
|
17267
17450
|
}
|
|
@@ -17279,10 +17462,10 @@ async function enable2(client, argv) {
|
|
|
17279
17462
|
});
|
|
17280
17463
|
output_manager_default.stopSpinner();
|
|
17281
17464
|
output_manager_default.success(
|
|
17282
|
-
`Feature flag ${
|
|
17465
|
+
`Feature flag ${import_chalk87.default.bold(flag.slug)} has been enabled in ${import_chalk87.default.bold(environment)}`
|
|
17283
17466
|
);
|
|
17284
17467
|
output_manager_default.log(
|
|
17285
|
-
` ${
|
|
17468
|
+
` ${import_chalk87.default.dim("Serving variant:")} ${formatVariantForDisplay(onVariant)}`
|
|
17286
17469
|
);
|
|
17287
17470
|
} catch (err) {
|
|
17288
17471
|
output_manager_default.stopSpinner();
|
|
@@ -17388,7 +17571,7 @@ var FlagsSdkKeysRmTelemetryClient = class extends TelemetryClient {
|
|
|
17388
17571
|
};
|
|
17389
17572
|
|
|
17390
17573
|
// src/commands/flags/sdk-keys-ls.ts
|
|
17391
|
-
var
|
|
17574
|
+
var import_chalk88 = __toESM(require_source(), 1);
|
|
17392
17575
|
var import_ms12 = __toESM(require_ms(), 1);
|
|
17393
17576
|
|
|
17394
17577
|
// src/util/flags/sdk-keys.ts
|
|
@@ -17463,7 +17646,7 @@ Create one with: ${getCommandName("flags sdk-keys add --type server --environmen
|
|
|
17463
17646
|
);
|
|
17464
17647
|
} else {
|
|
17465
17648
|
output_manager_default.log(
|
|
17466
|
-
`${
|
|
17649
|
+
`${import_chalk88.default.bold(keys.length)} SDK key${keys.length === 1 ? "" : "s"} found for ${projectSlugLink}`
|
|
17467
17650
|
);
|
|
17468
17651
|
printSdkKeysTable(sortedKeys);
|
|
17469
17652
|
}
|
|
@@ -17492,10 +17675,10 @@ function printSdkKeysTable(keys) {
|
|
|
17492
17675
|
const headers = ["Hash Key", "Type", "Environment", "Label", "Created"];
|
|
17493
17676
|
const now = Date.now();
|
|
17494
17677
|
const rows = keys.map((key) => [
|
|
17495
|
-
|
|
17678
|
+
import_chalk88.default.dim(key.hashKey.slice(0, 12) + "..."),
|
|
17496
17679
|
getTypeLabel(key.type),
|
|
17497
17680
|
key.environment,
|
|
17498
|
-
key.label ||
|
|
17681
|
+
key.label || import_chalk88.default.dim("-"),
|
|
17499
17682
|
(0, import_ms12.default)(now - key.createdAt) + " ago"
|
|
17500
17683
|
]);
|
|
17501
17684
|
const table3 = formatTable(
|
|
@@ -17510,20 +17693,20 @@ ${table3}
|
|
|
17510
17693
|
function getTypeLabel(type) {
|
|
17511
17694
|
switch (type) {
|
|
17512
17695
|
case "server":
|
|
17513
|
-
return
|
|
17696
|
+
return import_chalk88.default.blue("server");
|
|
17514
17697
|
case "client":
|
|
17515
|
-
return
|
|
17698
|
+
return import_chalk88.default.green("client");
|
|
17516
17699
|
case "mobile":
|
|
17517
|
-
return
|
|
17700
|
+
return import_chalk88.default.yellow("mobile");
|
|
17518
17701
|
default:
|
|
17519
17702
|
return type;
|
|
17520
17703
|
}
|
|
17521
17704
|
}
|
|
17522
17705
|
|
|
17523
17706
|
// src/commands/flags/sdk-keys-add.ts
|
|
17524
|
-
var
|
|
17707
|
+
var import_chalk89 = __toESM(require_source(), 1);
|
|
17525
17708
|
var VALID_TYPES = ["server", "client", "mobile"];
|
|
17526
|
-
var
|
|
17709
|
+
var VALID_ENVIRONMENTS2 = ["production", "preview", "development"];
|
|
17527
17710
|
async function sdkKeysAdd(client, argv) {
|
|
17528
17711
|
const telemetryClient = new FlagsSdkKeysAddTelemetryClient({
|
|
17529
17712
|
opts: {
|
|
@@ -17666,20 +17849,20 @@ async function sdkKeysAdd(client, argv) {
|
|
|
17666
17849
|
}
|
|
17667
17850
|
environment = await client.input.select({
|
|
17668
17851
|
message: "Select the environment:",
|
|
17669
|
-
choices:
|
|
17852
|
+
choices: VALID_ENVIRONMENTS2.map((env) => ({
|
|
17670
17853
|
name: env,
|
|
17671
17854
|
value: env
|
|
17672
17855
|
}))
|
|
17673
17856
|
});
|
|
17674
17857
|
}
|
|
17675
|
-
if (!
|
|
17858
|
+
if (!VALID_ENVIRONMENTS2.includes(environment)) {
|
|
17676
17859
|
if (client.nonInteractive) {
|
|
17677
17860
|
outputAgentError(
|
|
17678
17861
|
client,
|
|
17679
17862
|
{
|
|
17680
17863
|
status: AGENT_STATUS.ERROR,
|
|
17681
17864
|
reason: AGENT_REASON.INVALID_ARGUMENTS,
|
|
17682
|
-
message: `Invalid environment: ${environment}. Must be one of: ${
|
|
17865
|
+
message: `Invalid environment: ${environment}. Must be one of: ${VALID_ENVIRONMENTS2.join(", ")}`,
|
|
17683
17866
|
next: [
|
|
17684
17867
|
{
|
|
17685
17868
|
command: buildCommandWithGlobalFlags(
|
|
@@ -17695,7 +17878,7 @@ async function sdkKeysAdd(client, argv) {
|
|
|
17695
17878
|
return 1;
|
|
17696
17879
|
}
|
|
17697
17880
|
output_manager_default.error(
|
|
17698
|
-
`Invalid environment: ${environment}. Must be one of: ${
|
|
17881
|
+
`Invalid environment: ${environment}. Must be one of: ${VALID_ENVIRONMENTS2.join(", ")}`
|
|
17699
17882
|
);
|
|
17700
17883
|
return 1;
|
|
17701
17884
|
}
|
|
@@ -17719,27 +17902,27 @@ async function sdkKeysAdd(client, argv) {
|
|
|
17719
17902
|
output_manager_default.stopSpinner();
|
|
17720
17903
|
output_manager_default.success("SDK key created successfully");
|
|
17721
17904
|
output_manager_default.print("\n");
|
|
17722
|
-
output_manager_default.print(` ${
|
|
17905
|
+
output_manager_default.print(` ${import_chalk89.default.dim("Hash Key:")} ${key.hashKey}
|
|
17723
17906
|
`);
|
|
17724
|
-
output_manager_default.print(` ${
|
|
17907
|
+
output_manager_default.print(` ${import_chalk89.default.dim("Type:")} ${key.type}
|
|
17725
17908
|
`);
|
|
17726
|
-
output_manager_default.print(` ${
|
|
17909
|
+
output_manager_default.print(` ${import_chalk89.default.dim("Environment:")} ${key.environment}
|
|
17727
17910
|
`);
|
|
17728
17911
|
if (key.label) {
|
|
17729
|
-
output_manager_default.print(` ${
|
|
17912
|
+
output_manager_default.print(` ${import_chalk89.default.dim("Label:")} ${key.label}
|
|
17730
17913
|
`);
|
|
17731
17914
|
}
|
|
17732
17915
|
if (key.keyValue) {
|
|
17733
17916
|
output_manager_default.print("\n");
|
|
17734
17917
|
output_manager_default.warn("Save this key - it will not be shown again:");
|
|
17735
17918
|
output_manager_default.print(`
|
|
17736
|
-
${
|
|
17919
|
+
${import_chalk89.default.cyan(key.keyValue)}
|
|
17737
17920
|
`);
|
|
17738
17921
|
}
|
|
17739
17922
|
if (key.connectionString) {
|
|
17740
17923
|
output_manager_default.print("\n");
|
|
17741
|
-
output_manager_default.log(`${
|
|
17742
|
-
output_manager_default.print(` ${
|
|
17924
|
+
output_manager_default.log(`${import_chalk89.default.dim("Connection string:")}`);
|
|
17925
|
+
output_manager_default.print(` ${import_chalk89.default.cyan(key.connectionString)}
|
|
17743
17926
|
`);
|
|
17744
17927
|
}
|
|
17745
17928
|
} catch (err) {
|
|
@@ -17751,7 +17934,7 @@ async function sdkKeysAdd(client, argv) {
|
|
|
17751
17934
|
}
|
|
17752
17935
|
|
|
17753
17936
|
// src/commands/flags/sdk-keys-rm.ts
|
|
17754
|
-
var
|
|
17937
|
+
var import_chalk90 = __toESM(require_source(), 1);
|
|
17755
17938
|
async function sdkKeysRm(client, argv) {
|
|
17756
17939
|
const telemetryClient = new FlagsSdkKeysRmTelemetryClient({
|
|
17757
17940
|
opts: {
|
|
@@ -17870,7 +18053,7 @@ async function sdkKeysRm(client, argv) {
|
|
|
17870
18053
|
return 1;
|
|
17871
18054
|
}
|
|
17872
18055
|
const confirmed = await client.input.confirm(
|
|
17873
|
-
`Are you sure you want to delete SDK key ${
|
|
18056
|
+
`Are you sure you want to delete SDK key ${import_chalk90.default.bold(hashKey.slice(0, 12) + "...")}?`,
|
|
17874
18057
|
false
|
|
17875
18058
|
);
|
|
17876
18059
|
if (!confirmed) {
|
|
@@ -17882,7 +18065,7 @@ async function sdkKeysRm(client, argv) {
|
|
|
17882
18065
|
await deleteSdkKey(client, project.id, hashKey);
|
|
17883
18066
|
output_manager_default.stopSpinner();
|
|
17884
18067
|
output_manager_default.success(
|
|
17885
|
-
`SDK key ${
|
|
18068
|
+
`SDK key ${import_chalk90.default.bold(hashKey.slice(0, 12) + "...")} has been deleted`
|
|
17886
18069
|
);
|
|
17887
18070
|
} catch (err) {
|
|
17888
18071
|
output_manager_default.stopSpinner();
|
|
@@ -18271,7 +18454,7 @@ async function main15(client) {
|
|
|
18271
18454
|
}
|
|
18272
18455
|
|
|
18273
18456
|
// src/commands/git/connect.ts
|
|
18274
|
-
var
|
|
18457
|
+
var import_chalk91 = __toESM(require_source(), 1);
|
|
18275
18458
|
import { join as join3 } from "path";
|
|
18276
18459
|
|
|
18277
18460
|
// src/util/telemetry/commands/git/connect.ts
|
|
@@ -18322,7 +18505,7 @@ async function connect(client, argv) {
|
|
|
18322
18505
|
const confirm = Boolean(opts["--yes"]);
|
|
18323
18506
|
if (args.length > 1) {
|
|
18324
18507
|
output_manager_default.error(
|
|
18325
|
-
`Invalid number of arguments. Usage: ${
|
|
18508
|
+
`Invalid number of arguments. Usage: ${import_chalk91.default.cyan(
|
|
18326
18509
|
`${getCommandName("project connect")}`
|
|
18327
18510
|
)}`
|
|
18328
18511
|
);
|
|
@@ -18369,7 +18552,7 @@ async function connect(client, argv) {
|
|
|
18369
18552
|
}
|
|
18370
18553
|
if (!gitConfig) {
|
|
18371
18554
|
output_manager_default.error(
|
|
18372
|
-
`No local Git repository found. Run ${
|
|
18555
|
+
`No local Git repository found. Run ${import_chalk91.default.cyan(
|
|
18373
18556
|
"`git clone <url>`"
|
|
18374
18557
|
)} to clone a remote Git repository first.`
|
|
18375
18558
|
);
|
|
@@ -18378,7 +18561,7 @@ async function connect(client, argv) {
|
|
|
18378
18561
|
const remoteUrls = pluckRemoteUrls(gitConfig);
|
|
18379
18562
|
if (!remoteUrls) {
|
|
18380
18563
|
output_manager_default.error(
|
|
18381
|
-
`No remote URLs found in your Git config. Make sure you've configured a remote repo in your local Git config. Run ${
|
|
18564
|
+
`No remote URLs found in your Git config. Make sure you've configured a remote repo in your local Git config. Run ${import_chalk91.default.cyan(
|
|
18382
18565
|
"`git remote --help`"
|
|
18383
18566
|
)} for more details.`
|
|
18384
18567
|
);
|
|
@@ -18496,7 +18679,7 @@ async function promptConnectArg({
|
|
|
18496
18679
|
return true;
|
|
18497
18680
|
}
|
|
18498
18681
|
output_manager_default.log(
|
|
18499
|
-
`Found a repository in your local Git Config: ${
|
|
18682
|
+
`Found a repository in your local Git Config: ${import_chalk91.default.cyan(
|
|
18500
18683
|
Object.values(remoteUrls)[0]
|
|
18501
18684
|
)}`
|
|
18502
18685
|
);
|
|
@@ -18516,7 +18699,7 @@ async function promptConnectArg({
|
|
|
18516
18699
|
}
|
|
18517
18700
|
|
|
18518
18701
|
// src/commands/git/disconnect.ts
|
|
18519
|
-
var
|
|
18702
|
+
var import_chalk92 = __toESM(require_source(), 1);
|
|
18520
18703
|
|
|
18521
18704
|
// src/util/telemetry/commands/git/disconnect.ts
|
|
18522
18705
|
var GitDisconnectTelemetryClient = class extends TelemetryClient {
|
|
@@ -18558,7 +18741,7 @@ async function disconnect(client, argv) {
|
|
|
18558
18741
|
}
|
|
18559
18742
|
if (args.length !== 0) {
|
|
18560
18743
|
output_manager_default.error(
|
|
18561
|
-
`Invalid number of arguments. Usage: ${
|
|
18744
|
+
`Invalid number of arguments. Usage: ${import_chalk92.default.cyan(
|
|
18562
18745
|
`${getCommandName("project disconnect")}`
|
|
18563
18746
|
)}`
|
|
18564
18747
|
);
|
|
@@ -18580,14 +18763,14 @@ async function disconnect(client, argv) {
|
|
|
18580
18763
|
`
|
|
18581
18764
|
);
|
|
18582
18765
|
const confirmDisconnect = autoConfirm || await client.input.confirm(
|
|
18583
|
-
`Are you sure you want to disconnect ${
|
|
18766
|
+
`Are you sure you want to disconnect ${import_chalk92.default.cyan(
|
|
18584
18767
|
`${linkOrg}/${repo}`
|
|
18585
18768
|
)} from your project?`,
|
|
18586
18769
|
false
|
|
18587
18770
|
);
|
|
18588
18771
|
if (confirmDisconnect) {
|
|
18589
18772
|
await disconnectGitProvider(client, org, project.id);
|
|
18590
|
-
output_manager_default.log(`Disconnected ${
|
|
18773
|
+
output_manager_default.log(`Disconnected ${import_chalk92.default.cyan(`${linkOrg}/${repo}`)}.`);
|
|
18591
18774
|
} else {
|
|
18592
18775
|
output_manager_default.log("Canceled");
|
|
18593
18776
|
}
|
|
@@ -18663,12 +18846,12 @@ async function main16(client) {
|
|
|
18663
18846
|
}
|
|
18664
18847
|
|
|
18665
18848
|
// src/commands/guidance/status.ts
|
|
18666
|
-
var
|
|
18849
|
+
var import_chalk93 = __toESM(require_source(), 1);
|
|
18667
18850
|
async function status(client) {
|
|
18668
18851
|
const enabled = client.config.guidance?.enabled !== false;
|
|
18669
|
-
const status3 = enabled ?
|
|
18852
|
+
const status3 = enabled ? import_chalk93.default.green("Enabled") : import_chalk93.default.red("Disabled");
|
|
18670
18853
|
output_manager_default.print("\n");
|
|
18671
|
-
output_manager_default.log(`${
|
|
18854
|
+
output_manager_default.log(`${import_chalk93.default.bold("Guidance status")}: ${status3}`);
|
|
18672
18855
|
output_manager_default.print("\n");
|
|
18673
18856
|
return 0;
|
|
18674
18857
|
}
|
|
@@ -18897,7 +19080,7 @@ async function httpstat(client) {
|
|
|
18897
19080
|
|
|
18898
19081
|
// src/commands/init/init.ts
|
|
18899
19082
|
var import_tar_fs = __toESM(require_tar_fs(), 1);
|
|
18900
|
-
var
|
|
19083
|
+
var import_chalk94 = __toESM(require_source(), 1);
|
|
18901
19084
|
import fs from "fs";
|
|
18902
19085
|
import path2 from "path";
|
|
18903
19086
|
var EXAMPLE_API = "https://examples.vercel.sh";
|
|
@@ -18976,9 +19159,9 @@ async function extractExample(client, name, dir, force, ver = "v2") {
|
|
|
18976
19159
|
extractor.on("finish", resolve8);
|
|
18977
19160
|
res.body.pipe(extractor);
|
|
18978
19161
|
});
|
|
18979
|
-
const successLog = `Initialized "${
|
|
19162
|
+
const successLog = `Initialized "${import_chalk94.default.bold(
|
|
18980
19163
|
name
|
|
18981
|
-
)}" example in ${
|
|
19164
|
+
)}" example in ${import_chalk94.default.bold(humanizePath(folder))}.`;
|
|
18982
19165
|
const folderRel = path2.relative(client.cwd, folder);
|
|
18983
19166
|
const deployHint = folderRel === "" ? list_item_default(`To deploy, run ${getCommandName()}.`) : list_item_default(
|
|
18984
19167
|
`To deploy, ${cmd(
|
|
@@ -18998,14 +19181,14 @@ function prepareFolder(cwd, folder, force) {
|
|
|
18998
19181
|
if (fs.existsSync(dest)) {
|
|
18999
19182
|
if (!fs.lstatSync(dest).isDirectory()) {
|
|
19000
19183
|
throw new Error(
|
|
19001
|
-
`Destination path "${
|
|
19184
|
+
`Destination path "${import_chalk94.default.bold(
|
|
19002
19185
|
folder
|
|
19003
19186
|
)}" already exists and is not a directory.`
|
|
19004
19187
|
);
|
|
19005
19188
|
}
|
|
19006
19189
|
if (!force && fs.readdirSync(dest).length !== 0) {
|
|
19007
19190
|
throw new Error(
|
|
19008
|
-
`Destination path "${
|
|
19191
|
+
`Destination path "${import_chalk94.default.bold(
|
|
19009
19192
|
folder
|
|
19010
19193
|
)}" already exists and is not an empty directory. You may use ${cmd(
|
|
19011
19194
|
"--force"
|
|
@@ -19016,14 +19199,14 @@ function prepareFolder(cwd, folder, force) {
|
|
|
19016
19199
|
try {
|
|
19017
19200
|
fs.mkdirSync(dest);
|
|
19018
19201
|
} catch (_e) {
|
|
19019
|
-
throw new Error(`Could not create directory "${
|
|
19202
|
+
throw new Error(`Could not create directory "${import_chalk94.default.bold(folder)}".`);
|
|
19020
19203
|
}
|
|
19021
19204
|
}
|
|
19022
19205
|
return dest;
|
|
19023
19206
|
}
|
|
19024
19207
|
async function guess(client, exampleList, name) {
|
|
19025
19208
|
const GuessError = new Error(
|
|
19026
|
-
`No example found for ${
|
|
19209
|
+
`No example found for ${import_chalk94.default.bold(name)}, run ${getCommandName(
|
|
19027
19210
|
"init"
|
|
19028
19211
|
)} to see the list of available examples.`
|
|
19029
19212
|
);
|
|
@@ -19032,7 +19215,7 @@ async function guess(client, exampleList, name) {
|
|
|
19032
19215
|
}
|
|
19033
19216
|
const found = did_you_mean_default(name, exampleList, 0.7);
|
|
19034
19217
|
if (typeof found === "string") {
|
|
19035
|
-
if (await client.input.confirm(`Did you mean ${
|
|
19218
|
+
if (await client.input.confirm(`Did you mean ${import_chalk94.default.bold(found)}?`, false)) {
|
|
19036
19219
|
return found;
|
|
19037
19220
|
}
|
|
19038
19221
|
} else {
|
|
@@ -19111,13 +19294,13 @@ async function main17(client) {
|
|
|
19111
19294
|
|
|
19112
19295
|
// src/commands/inspect/index.ts
|
|
19113
19296
|
var import_error_utils9 = __toESM(require_dist(), 1);
|
|
19114
|
-
var
|
|
19297
|
+
var import_chalk97 = __toESM(require_source(), 1);
|
|
19115
19298
|
var import_ms13 = __toESM(require_ms(), 1);
|
|
19116
19299
|
var import_title = __toESM(require_lib2(), 1);
|
|
19117
19300
|
import { URL as URL2 } from "url";
|
|
19118
19301
|
|
|
19119
19302
|
// src/util/output/builds.ts
|
|
19120
|
-
var
|
|
19303
|
+
var import_chalk95 = __toESM(require_source(), 1);
|
|
19121
19304
|
var import_bytes3 = __toESM(require_bytes(), 1);
|
|
19122
19305
|
|
|
19123
19306
|
// src/util/build-state.ts
|
|
@@ -19151,48 +19334,48 @@ var getCommonPath = (buildGroup) => {
|
|
|
19151
19334
|
var styleBuild = (build, times, longestSource) => {
|
|
19152
19335
|
const { entrypoint, id } = build;
|
|
19153
19336
|
const time = typeof times[id] === "string" ? times[id] : "";
|
|
19154
|
-
let pathColor =
|
|
19337
|
+
let pathColor = import_chalk95.default.cyan;
|
|
19155
19338
|
if (isFailed(build)) {
|
|
19156
|
-
pathColor =
|
|
19339
|
+
pathColor = import_chalk95.default.red;
|
|
19157
19340
|
}
|
|
19158
19341
|
const entry = entrypoint.padEnd(longestSource + padding);
|
|
19159
19342
|
const prefix = hasOutput(build) ? "\u250C" : "\u2576";
|
|
19160
|
-
return `${
|
|
19343
|
+
return `${import_chalk95.default.grey(prefix)} ${pathColor(entry)}${time}`;
|
|
19161
19344
|
};
|
|
19162
19345
|
var styleHiddenBuilds = (commonPath, buildGroup, times, longestSource, isHidden = false) => {
|
|
19163
19346
|
const { id } = buildGroup[0];
|
|
19164
19347
|
const entry = commonPath.padEnd(longestSource + padding);
|
|
19165
19348
|
const time = typeof times[id] === "string" ? times[id] : "";
|
|
19166
19349
|
const prefix = isHidden === false && buildGroup.some(hasOutput) ? "\u250C" : "\u2576";
|
|
19167
|
-
let pathColor =
|
|
19350
|
+
let pathColor = import_chalk95.default.cyan;
|
|
19168
19351
|
if (buildGroup.every(isFailed)) {
|
|
19169
|
-
pathColor =
|
|
19352
|
+
pathColor = import_chalk95.default.red;
|
|
19170
19353
|
}
|
|
19171
19354
|
if (isHidden) {
|
|
19172
|
-
pathColor =
|
|
19355
|
+
pathColor = import_chalk95.default.grey;
|
|
19173
19356
|
}
|
|
19174
|
-
return `${
|
|
19357
|
+
return `${import_chalk95.default.grey(prefix)} ${pathColor(entry)}${time}`;
|
|
19175
19358
|
};
|
|
19176
19359
|
var styleOutput = (output, readyState, isLast) => {
|
|
19177
19360
|
const { type, path: path3, size, lambda } = output;
|
|
19178
19361
|
const prefix = type === "lambda" ? "\u03BB " : "";
|
|
19179
|
-
const finalSize = size ? ` ${
|
|
19180
|
-
let color =
|
|
19362
|
+
const finalSize = size ? ` ${import_chalk95.default.grey(`(${(0, import_bytes3.default)(size)})`)}` : "";
|
|
19363
|
+
let color = import_chalk95.default.grey;
|
|
19181
19364
|
let finalRegion = "";
|
|
19182
19365
|
if (isReady({ readyState })) {
|
|
19183
|
-
color =
|
|
19366
|
+
color = import_chalk95.default;
|
|
19184
19367
|
} else if (isFailed({ readyState })) {
|
|
19185
|
-
color =
|
|
19368
|
+
color = import_chalk95.default.red;
|
|
19186
19369
|
}
|
|
19187
19370
|
if (lambda) {
|
|
19188
19371
|
const { deployedTo } = lambda;
|
|
19189
19372
|
if (deployedTo && deployedTo.length > 0) {
|
|
19190
|
-
finalRegion = ` ${
|
|
19373
|
+
finalRegion = ` ${import_chalk95.default.grey(`[${deployedTo.join(", ")}]`)}`;
|
|
19191
19374
|
}
|
|
19192
19375
|
}
|
|
19193
19376
|
const corner = isLast ? "\u2514\u2500\u2500" : "\u251C\u2500\u2500";
|
|
19194
19377
|
const main29 = prefix + path3 + finalSize + finalRegion;
|
|
19195
|
-
return `${
|
|
19378
|
+
return `${import_chalk95.default.grey(corner)} ${color(main29)}`;
|
|
19196
19379
|
};
|
|
19197
19380
|
var getDirPath = (path3, level = 0, highestLevel = null) => {
|
|
19198
19381
|
const parts = path3.split("/").slice(0, -1);
|
|
@@ -19324,7 +19507,7 @@ var builds_default = (builds, times) => {
|
|
|
19324
19507
|
);
|
|
19325
19508
|
if (outputs.length > MAX_OUTPUTS_PER_GROUP) {
|
|
19326
19509
|
final.push(
|
|
19327
|
-
|
|
19510
|
+
import_chalk95.default.grey(
|
|
19328
19511
|
`\u2514\u2500\u2500 ${outputs.length - MAX_OUTPUTS_PER_GROUP} output items hidden
|
|
19329
19512
|
`
|
|
19330
19513
|
)
|
|
@@ -19350,7 +19533,7 @@ var builds_default = (builds, times) => {
|
|
|
19350
19533
|
};
|
|
19351
19534
|
|
|
19352
19535
|
// src/util/output/routes.ts
|
|
19353
|
-
var
|
|
19536
|
+
var import_chalk96 = __toESM(require_source(), 1);
|
|
19354
19537
|
var longestProperty = (routes2, name) => {
|
|
19355
19538
|
const longestItem = routes2.sort((a, b) => {
|
|
19356
19539
|
const aName = a[name];
|
|
@@ -19369,19 +19552,19 @@ function routes(routes2) {
|
|
|
19369
19552
|
const padding2 = 6;
|
|
19370
19553
|
const space = " ".repeat(padding2);
|
|
19371
19554
|
const destSpace = " ".repeat(longestDest || 10);
|
|
19372
|
-
const arrow =
|
|
19555
|
+
const arrow = import_chalk96.default.grey("->");
|
|
19373
19556
|
for (const item of routes2) {
|
|
19374
19557
|
if ("handle" in item) {
|
|
19375
|
-
toPrint += `${
|
|
19558
|
+
toPrint += `${import_chalk96.default.grey("\u2576")} ${import_chalk96.default.cyan(item.handle)}`;
|
|
19376
19559
|
continue;
|
|
19377
19560
|
}
|
|
19378
19561
|
const { src, dest, status: status3, headers } = item;
|
|
19379
19562
|
const last = routes2.indexOf(item) === routes2.length - 1;
|
|
19380
19563
|
const suffix = last ? "" : `
|
|
19381
19564
|
`;
|
|
19382
|
-
const finalSrc =
|
|
19565
|
+
const finalSrc = import_chalk96.default.cyan(src.padEnd(longestSrc + padding2));
|
|
19383
19566
|
const finalDest = dest ? `${arrow}${space}${dest}` : ` ${space}${destSpace}`;
|
|
19384
|
-
const finalStatus = status3 ?
|
|
19567
|
+
const finalStatus = status3 ? import_chalk96.default.grey(`[${status3}]`) : "";
|
|
19385
19568
|
let finalHeaders = null;
|
|
19386
19569
|
if (headers) {
|
|
19387
19570
|
finalHeaders = `
|
|
@@ -19392,11 +19575,11 @@ function routes(routes2) {
|
|
|
19392
19575
|
const last2 = headerKeys.indexOf(header) === headerKeys.length - 1;
|
|
19393
19576
|
const suffix2 = last2 ? "" : `
|
|
19394
19577
|
`;
|
|
19395
|
-
const prefix2 =
|
|
19578
|
+
const prefix2 = import_chalk96.default.grey(last2 ? "\u2514\u2500\u2500" : "\u251C\u2500\u2500");
|
|
19396
19579
|
finalHeaders += `${prefix2} ${header}: ${value}${suffix2}`;
|
|
19397
19580
|
}
|
|
19398
19581
|
}
|
|
19399
|
-
const prefix =
|
|
19582
|
+
const prefix = import_chalk96.default.grey(finalHeaders ? "\u250C" : "\u2576");
|
|
19400
19583
|
const fill = `${finalSrc}${finalDest}${space}${finalStatus}`;
|
|
19401
19584
|
toPrint += `${prefix} ${fill}${finalHeaders || ""}${suffix}`;
|
|
19402
19585
|
}
|
|
@@ -19510,7 +19693,7 @@ async function inspect4(client) {
|
|
|
19510
19693
|
} catch {
|
|
19511
19694
|
}
|
|
19512
19695
|
output_manager_default.spinner(
|
|
19513
|
-
`Fetching deployment "${deploymentIdOrHost}" in ${
|
|
19696
|
+
`Fetching deployment "${deploymentIdOrHost}" in ${import_chalk97.default.bold(contextName)}`
|
|
19514
19697
|
);
|
|
19515
19698
|
let deployment = await getDeployment(client, contextName, deploymentIdOrHost);
|
|
19516
19699
|
let abortController;
|
|
@@ -19540,7 +19723,7 @@ async function inspect4(client) {
|
|
|
19540
19723
|
output_manager_default.stopSpinner();
|
|
19541
19724
|
await printJson({ deployment, contextName, client });
|
|
19542
19725
|
} else if (withLogs) {
|
|
19543
|
-
print(`${
|
|
19726
|
+
print(`${import_chalk97.default.cyan("status")} ${stateString(deployment.readyState)}
|
|
19544
19727
|
`);
|
|
19545
19728
|
} else {
|
|
19546
19729
|
await printDetails({ deployment, contextName, client, startTimestamp });
|
|
@@ -19553,17 +19736,17 @@ function stateString(s) {
|
|
|
19553
19736
|
switch (s) {
|
|
19554
19737
|
case "INITIALIZING":
|
|
19555
19738
|
case "BUILDING":
|
|
19556
|
-
return
|
|
19739
|
+
return import_chalk97.default.yellow(CIRCLE) + sTitle;
|
|
19557
19740
|
case "ERROR":
|
|
19558
|
-
return
|
|
19741
|
+
return import_chalk97.default.red(CIRCLE) + sTitle;
|
|
19559
19742
|
case "READY":
|
|
19560
|
-
return
|
|
19743
|
+
return import_chalk97.default.green(CIRCLE) + sTitle;
|
|
19561
19744
|
case "QUEUED":
|
|
19562
|
-
return
|
|
19745
|
+
return import_chalk97.default.gray(CIRCLE) + sTitle;
|
|
19563
19746
|
case "CANCELED":
|
|
19564
|
-
return
|
|
19747
|
+
return import_chalk97.default.gray(CIRCLE) + sTitle;
|
|
19565
19748
|
default:
|
|
19566
|
-
return
|
|
19749
|
+
return import_chalk97.default.gray("UNKNOWN");
|
|
19567
19750
|
}
|
|
19568
19751
|
}
|
|
19569
19752
|
async function printDetails({
|
|
@@ -19573,7 +19756,7 @@ async function printDetails({
|
|
|
19573
19756
|
startTimestamp
|
|
19574
19757
|
}) {
|
|
19575
19758
|
output_manager_default.log(
|
|
19576
|
-
`Fetched deployment "${
|
|
19759
|
+
`Fetched deployment "${import_chalk97.default.bold(deployment.url)}" in ${import_chalk97.default.bold(
|
|
19577
19760
|
contextName
|
|
19578
19761
|
)} ${elapsed(Date.now() - startTimestamp)}`
|
|
19579
19762
|
);
|
|
@@ -19589,14 +19772,14 @@ async function printDetails({
|
|
|
19589
19772
|
const { print, link } = output_manager_default;
|
|
19590
19773
|
const { builds } = deployment.version === 2 ? await client.fetch(`/v11/deployments/${id}/builds`) : { builds: [] };
|
|
19591
19774
|
print("\n");
|
|
19592
|
-
print(
|
|
19593
|
-
print(` ${
|
|
19775
|
+
print(import_chalk97.default.bold(" General\n\n"));
|
|
19776
|
+
print(` ${import_chalk97.default.cyan("id")} ${id}
|
|
19594
19777
|
`);
|
|
19595
|
-
print(` ${
|
|
19778
|
+
print(` ${import_chalk97.default.cyan("name")} ${name}
|
|
19596
19779
|
`);
|
|
19597
19780
|
const customEnvironmentSlug = deployment.customEnvironment?.slug;
|
|
19598
19781
|
const target = customEnvironmentSlug ?? deployment.target ?? "preview";
|
|
19599
|
-
print(` ${
|
|
19782
|
+
print(` ${import_chalk97.default.cyan("target")} `);
|
|
19600
19783
|
print(
|
|
19601
19784
|
deployment.customEnvironment && deployment.team?.slug ? `${link(
|
|
19602
19785
|
`${target}`,
|
|
@@ -19606,13 +19789,13 @@ async function printDetails({
|
|
|
19606
19789
|
` : `${target}
|
|
19607
19790
|
`
|
|
19608
19791
|
);
|
|
19609
|
-
print(` ${
|
|
19792
|
+
print(` ${import_chalk97.default.cyan("status")} ${stateString(readyState)}
|
|
19610
19793
|
`);
|
|
19611
|
-
print(` ${
|
|
19794
|
+
print(` ${import_chalk97.default.cyan("url")} https://${url}
|
|
19612
19795
|
`);
|
|
19613
19796
|
if (createdAt) {
|
|
19614
19797
|
print(
|
|
19615
|
-
` ${
|
|
19798
|
+
` ${import_chalk97.default.cyan("created")} ${new Date(createdAt)} ${elapsed(
|
|
19616
19799
|
Date.now() - createdAt,
|
|
19617
19800
|
true
|
|
19618
19801
|
)}
|
|
@@ -19621,10 +19804,10 @@ async function printDetails({
|
|
|
19621
19804
|
}
|
|
19622
19805
|
print("\n\n");
|
|
19623
19806
|
if (aliases !== void 0 && aliases.length > 0) {
|
|
19624
|
-
print(
|
|
19807
|
+
print(import_chalk97.default.bold(" Aliases\n\n"));
|
|
19625
19808
|
let aliasList = "";
|
|
19626
19809
|
for (const alias2 of aliases) {
|
|
19627
|
-
aliasList += `${
|
|
19810
|
+
aliasList += `${import_chalk97.default.gray("\u2576")} https://${alias2}
|
|
19628
19811
|
`;
|
|
19629
19812
|
}
|
|
19630
19813
|
print(indent_default(aliasList, 4));
|
|
@@ -19636,12 +19819,12 @@ async function printDetails({
|
|
|
19636
19819
|
const { id: id2, createdAt: createdAt2, readyStateAt } = build;
|
|
19637
19820
|
times[id2] = createdAt2 && readyStateAt ? elapsed(readyStateAt - createdAt2) : null;
|
|
19638
19821
|
}
|
|
19639
|
-
print(
|
|
19822
|
+
print(import_chalk97.default.bold(" Builds\n\n"));
|
|
19640
19823
|
print(indent_default(builds_default(builds, times).toPrint, 4));
|
|
19641
19824
|
print("\n\n");
|
|
19642
19825
|
}
|
|
19643
19826
|
if (Array.isArray(routes2) && routes2.length > 0) {
|
|
19644
|
-
print(
|
|
19827
|
+
print(import_chalk97.default.bold(" Routes\n\n"));
|
|
19645
19828
|
print(indent_default(routes(routes2), 4));
|
|
19646
19829
|
print(`
|
|
19647
19830
|
|
|
@@ -19687,119 +19870,6 @@ function exitCode(state) {
|
|
|
19687
19870
|
return 0;
|
|
19688
19871
|
}
|
|
19689
19872
|
|
|
19690
|
-
// src/util/integration/post-provision-setup.ts
|
|
19691
|
-
var import_chalk97 = __toESM(require_source(), 1);
|
|
19692
|
-
var VALID_ENVIRONMENTS2 = [
|
|
19693
|
-
"production",
|
|
19694
|
-
"preview",
|
|
19695
|
-
"development"
|
|
19696
|
-
];
|
|
19697
|
-
var ENV_PULL_FAILED_MESSAGE = "Failed to pull environment variables. You can run `vercel env pull` manually.";
|
|
19698
|
-
function validateEnvironments(environments) {
|
|
19699
|
-
const invalid = environments.filter(
|
|
19700
|
-
(env) => !VALID_ENVIRONMENTS2.includes(env)
|
|
19701
|
-
);
|
|
19702
|
-
if (invalid.length > 0) {
|
|
19703
|
-
return { valid: false, invalid };
|
|
19704
|
-
}
|
|
19705
|
-
return { valid: true };
|
|
19706
|
-
}
|
|
19707
|
-
async function postProvisionSetup(client, resourceName, resourceId, contextName, options = {}) {
|
|
19708
|
-
const dashboardUrl = options.integrationSlug && options.installationId ? `https://vercel.com/d/dashboard/integrations/${options.integrationSlug}/${options.installationId}/resources/${resourceId}` : `https://vercel.com/${contextName}/~/stores/integration/${resourceId}`;
|
|
19709
|
-
output_manager_default.log(
|
|
19710
|
-
indent_default(
|
|
19711
|
-
`Dashboard: ${output_manager_default.link(dashboardUrl, dashboardUrl, { fallback: false })}`,
|
|
19712
|
-
4
|
|
19713
|
-
)
|
|
19714
|
-
);
|
|
19715
|
-
const baseResult = {
|
|
19716
|
-
exitCode: 0,
|
|
19717
|
-
dashboardUrl,
|
|
19718
|
-
connected: false,
|
|
19719
|
-
environments: [],
|
|
19720
|
-
envPulled: false
|
|
19721
|
-
};
|
|
19722
|
-
if (options.noConnect) {
|
|
19723
|
-
return baseResult;
|
|
19724
|
-
}
|
|
19725
|
-
const linkedProject = await getLinkedProject(client);
|
|
19726
|
-
if (linkedProject.status === "error") {
|
|
19727
|
-
return { ...baseResult, exitCode: linkedProject.exitCode };
|
|
19728
|
-
}
|
|
19729
|
-
if (linkedProject.status === "not_linked") {
|
|
19730
|
-
return baseResult;
|
|
19731
|
-
}
|
|
19732
|
-
const { project } = linkedProject;
|
|
19733
|
-
const environments = [
|
|
19734
|
-
...new Set(
|
|
19735
|
-
options.environments && options.environments.length > 0 ? options.environments : [...VALID_ENVIRONMENTS2]
|
|
19736
|
-
)
|
|
19737
|
-
];
|
|
19738
|
-
output_manager_default.debug(`Selected environments: ${JSON.stringify(environments)}`);
|
|
19739
|
-
output_manager_default.spinner(
|
|
19740
|
-
`Connecting ${import_chalk97.default.bold(resourceName)} to ${import_chalk97.default.bold(project.name)}...`
|
|
19741
|
-
);
|
|
19742
|
-
output_manager_default.debug(`Connecting resource ${resourceId} to project ${project.id}`);
|
|
19743
|
-
try {
|
|
19744
|
-
await connectResourceToProject(
|
|
19745
|
-
client,
|
|
19746
|
-
project.id,
|
|
19747
|
-
resourceId,
|
|
19748
|
-
environments,
|
|
19749
|
-
options.prefix ? { envVarPrefix: options.prefix } : void 0
|
|
19750
|
-
);
|
|
19751
|
-
} catch (error) {
|
|
19752
|
-
output_manager_default.stopSpinner();
|
|
19753
|
-
options.onProjectConnectFailed?.(project.id, error);
|
|
19754
|
-
output_manager_default.error(`Failed to connect: ${error.message}`);
|
|
19755
|
-
return {
|
|
19756
|
-
...baseResult,
|
|
19757
|
-
exitCode: 1,
|
|
19758
|
-
project: { id: project.id, name: project.name },
|
|
19759
|
-
environments,
|
|
19760
|
-
connectError: error.message
|
|
19761
|
-
};
|
|
19762
|
-
}
|
|
19763
|
-
output_manager_default.stopSpinner();
|
|
19764
|
-
output_manager_default.log(
|
|
19765
|
-
`${import_chalk97.default.bold(resourceName)} successfully connected to ${import_chalk97.default.bold(project.name)}`
|
|
19766
|
-
);
|
|
19767
|
-
options.onProjectConnected?.(project.id);
|
|
19768
|
-
let envPulled = false;
|
|
19769
|
-
if (!options.noEnvPull) {
|
|
19770
|
-
const pullExitCode = await pull(
|
|
19771
|
-
client,
|
|
19772
|
-
["--yes"],
|
|
19773
|
-
"vercel-cli:integration:add"
|
|
19774
|
-
);
|
|
19775
|
-
if (pullExitCode !== 0) {
|
|
19776
|
-
output_manager_default.warn(ENV_PULL_FAILED_MESSAGE);
|
|
19777
|
-
} else {
|
|
19778
|
-
envPulled = true;
|
|
19779
|
-
}
|
|
19780
|
-
}
|
|
19781
|
-
return {
|
|
19782
|
-
...baseResult,
|
|
19783
|
-
project: { id: project.id, name: project.name },
|
|
19784
|
-
connected: true,
|
|
19785
|
-
environments,
|
|
19786
|
-
envPulled
|
|
19787
|
-
};
|
|
19788
|
-
}
|
|
19789
|
-
async function getLinkedProjectField(client, noConnect, field = "name") {
|
|
19790
|
-
if (noConnect) {
|
|
19791
|
-
return { value: void 0 };
|
|
19792
|
-
}
|
|
19793
|
-
const linkedProject = await getLinkedProject(client);
|
|
19794
|
-
if (linkedProject.status === "error") {
|
|
19795
|
-
return { value: void 0, exitCode: linkedProject.exitCode };
|
|
19796
|
-
}
|
|
19797
|
-
if (linkedProject.status === "linked") {
|
|
19798
|
-
return { value: linkedProject.project[field] };
|
|
19799
|
-
}
|
|
19800
|
-
return { value: void 0 };
|
|
19801
|
-
}
|
|
19802
|
-
|
|
19803
19873
|
// src/commands/integration/add-auto-provision.ts
|
|
19804
19874
|
var import_chalk100 = __toESM(require_source(), 1);
|
|
19805
19875
|
var import_error_utils10 = __toESM(require_dist(), 1);
|
|
@@ -21304,7 +21374,7 @@ async function add6(client, args, flags, commandName) {
|
|
|
21304
21374
|
const envValidation = validateEnvironments(environments);
|
|
21305
21375
|
if (!envValidation.valid) {
|
|
21306
21376
|
output_manager_default.error(
|
|
21307
|
-
`Invalid environment value: ${envValidation.invalid.map((e2) => `"${e2}"`).join(", ")}. Must be one of: ${
|
|
21377
|
+
`Invalid environment value: ${envValidation.invalid.map((e2) => `"${e2}"`).join(", ")}. Must be one of: ${VALID_ENVIRONMENTS.join(", ")}`
|
|
21308
21378
|
);
|
|
21309
21379
|
return 1;
|
|
21310
21380
|
}
|