vercel 51.6.1 → 51.7.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.
Files changed (64) hide show
  1. package/dist/chunks/{add-JALB3DKU.js → add-HLIPDOM3.js} +7 -7
  2. package/dist/chunks/{chunk-MUJZV257.js → chunk-5QNVUXGF.js} +6 -6
  3. package/dist/chunks/{chunk-U73MZTAR.js → chunk-6GTUL6VG.js} +3 -3
  4. package/dist/chunks/{chunk-DAOAZ2VQ.js → chunk-BHDZCUTT.js} +1 -1
  5. package/dist/chunks/{chunk-PVZBM6NU.js → chunk-BJQTGP42.js} +1 -1
  6. package/dist/chunks/{chunk-553A6UFX.js → chunk-BO7LOGQA.js} +6 -6
  7. package/dist/chunks/{chunk-Z66S4G43.js → chunk-BXSWMI6W.js} +1 -1
  8. package/dist/chunks/{chunk-DED5G3HZ.js → chunk-CRZM5WM2.js} +1 -1
  9. package/dist/chunks/{chunk-LUCCJW67.js → chunk-DVQ4SIWF.js} +1 -1
  10. package/dist/chunks/{chunk-DF4AVQY3.js → chunk-G6RXZLQ2.js} +2 -2
  11. package/dist/chunks/{chunk-WCTFUOSJ.js → chunk-GE6G37P4.js} +1 -1
  12. package/dist/chunks/{chunk-FY3TMBQS.js → chunk-HYAMHBSF.js} +1 -1
  13. package/dist/chunks/{chunk-RW7LIX2Y.js → chunk-IDDYXD6T.js} +2 -2
  14. package/dist/chunks/{chunk-3N3AYMMW.js → chunk-IS75MWZN.js} +30 -17
  15. package/dist/chunks/{chunk-QFP6FEBN.js → chunk-L7AFYPER.js} +1 -1
  16. package/dist/chunks/{chunk-C7UTFMYF.js → chunk-LDXYSGPZ.js} +2 -2
  17. package/dist/chunks/{chunk-LUJPLXGG.js → chunk-LGSOFQRC.js} +2 -2
  18. package/dist/chunks/{chunk-34IM6J7A.js → chunk-LKIVGPRE.js} +2 -2
  19. package/dist/chunks/{chunk-UG4457SI.js → chunk-LOUKPRIS.js} +60 -54
  20. package/dist/chunks/{chunk-HUPHOH2F.js → chunk-QLO5NXAS.js} +1 -1
  21. package/dist/chunks/{chunk-WYRFA4PX.js → chunk-QO6J4DC7.js} +2 -2
  22. package/dist/chunks/{chunk-4X7GBE5B.js → chunk-QZ3UQIL3.js} +23 -23
  23. package/dist/chunks/{chunk-VDM5O3P6.js → chunk-RFMC2QXQ.js} +3 -3
  24. package/dist/chunks/{chunk-5KFTN63Q.js → chunk-T74PTRRA.js} +4 -4
  25. package/dist/chunks/{chunk-7L4XVUFK.js → chunk-TAOVG4PS.js} +2 -2
  26. package/dist/chunks/{chunk-XLKXWNRG.js → chunk-UWKTUK3W.js} +1 -1
  27. package/dist/chunks/{chunk-MGJMZIIT.js → chunk-V766LKN6.js} +1 -1
  28. package/dist/chunks/{chunk-MCTAPJSL.js → chunk-VGWGLBUC.js} +1 -1
  29. package/dist/chunks/{chunk-CHUU7VXC.js → chunk-VNDSVCGB.js} +75 -68
  30. package/dist/chunks/{chunk-BBW6EGBQ.js → chunk-WKRF7JKF.js} +1 -1
  31. package/dist/chunks/{chunk-CGTXAXZ4.js → chunk-XKHLPA6V.js} +3 -1
  32. package/dist/chunks/{chunk-QHXUBID6.js → chunk-YDCXNOCS.js} +3 -3
  33. package/dist/chunks/{chunk-FH2OHGXG.js → chunk-YKYISUXV.js} +3 -3
  34. package/dist/chunks/{compile-vercel-config-V2SHBZFW.js → compile-vercel-config-U4OJGTLE.js} +3 -3
  35. package/dist/chunks/{delete-5RI2PRIT.js → delete-H2OF5N72.js} +5 -5
  36. package/dist/chunks/{disable-JPKO7VCV.js → disable-Z4ENND33.js} +5 -5
  37. package/dist/chunks/{discard-KXGXXDNX.js → discard-UQGHXIL4.js} +5 -5
  38. package/dist/chunks/{edit-VFUE5PVU.js → edit-UFYK3Z3T.js} +6 -6
  39. package/dist/chunks/{enable-V2AX2FXX.js → enable-2MEB4O5O.js} +5 -5
  40. package/dist/chunks/{export-BG3TOT6G.js → export-T5VEXLYZ.js} +5 -5
  41. package/dist/chunks/{inspect-3QVCZVKV.js → inspect-7CDEJF2U.js} +7 -7
  42. package/dist/chunks/{list-Y2YMJWEY.js → list-LTDGGY5C.js} +5 -5
  43. package/dist/chunks/{list-CWTYXKB5.js → list-MKMRMDWW.js} +8 -8
  44. package/dist/chunks/{ls-SY2CP56I.js → ls-GRDKWPVP.js} +7 -7
  45. package/dist/chunks/{publish-75IJ4PZS.js → publish-SMAXMKKV.js} +5 -5
  46. package/dist/chunks/{query-MLMGNGL2.js → query-WGX6PLTN.js} +6 -6
  47. package/dist/chunks/{reorder-757V4BF5.js → reorder-SQ52RGDY.js} +5 -5
  48. package/dist/chunks/{restore-KV44XHFS.js → restore-P6RHBBEG.js} +5 -5
  49. package/dist/chunks/{rm-3EGKFLKW.js → rm-EDOGYDVM.js} +7 -7
  50. package/dist/chunks/{rule-inspect-AYUGCLVJ.js → rule-inspect-GW54LGXF.js} +7 -7
  51. package/dist/chunks/{rules-FUFDJOIP.js → rules-MCUCN322.js} +7 -7
  52. package/dist/chunks/{schema-CI2XUYTW.js → schema-CZ7B2GTS.js} +7 -7
  53. package/dist/chunks/{types-M7LVCA3E.js → types-QNN5CDCB.js} +3 -3
  54. package/dist/chunks/{update-6EM4XIDW.js → update-QHI4MJ6N.js} +7 -7
  55. package/dist/commands/build/index.js +24 -15
  56. package/dist/commands/deploy/index.js +21 -21
  57. package/dist/commands/dev/index.js +35 -29
  58. package/dist/commands/env/index.js +17 -17
  59. package/dist/commands/link/index.js +17 -17
  60. package/dist/commands/list/index.js +8 -8
  61. package/dist/commands-bulk.js +215 -115
  62. package/dist/index.js +20 -20
  63. package/dist/version.mjs +1 -1
  64. package/package.json +16 -16
@@ -28,7 +28,7 @@ import {
28
28
  runInteractiveEditLoop,
29
29
  stripQuotes,
30
30
  validateActionFlags
31
- } from "./chunks/chunk-HUPHOH2F.js";
31
+ } from "./chunks/chunk-QLO5NXAS.js";
32
32
  import {
33
33
  getRouteVersions
34
34
  } from "./chunks/chunk-AHU7WNL2.js";
@@ -45,7 +45,7 @@ import {
45
45
  parsePosition,
46
46
  parseSubcommandArgs,
47
47
  withGlobalFlags
48
- } from "./chunks/chunk-FH2OHGXG.js";
48
+ } from "./chunks/chunk-YKYISUXV.js";
49
49
  import {
50
50
  indent_default
51
51
  } from "./chunks/chunk-A3NYPUKZ.js";
@@ -59,11 +59,11 @@ import {
59
59
  resolveOpenApiTagForProjectsCli,
60
60
  resolveOpenApiTagForTeamsCli,
61
61
  tryOpenApiFallback
62
- } from "./chunks/chunk-CHUU7VXC.js";
62
+ } from "./chunks/chunk-VNDSVCGB.js";
63
63
  import {
64
64
  getUpdateCommand,
65
65
  isGlobal
66
- } from "./chunks/chunk-BBW6EGBQ.js";
66
+ } from "./chunks/chunk-WKRF7JKF.js";
67
67
  import {
68
68
  Now,
69
69
  collectContactInformation,
@@ -85,7 +85,7 @@ import {
85
85
  require_format,
86
86
  require_jsonlines,
87
87
  setupDomain
88
- } from "./chunks/chunk-MUJZV257.js";
88
+ } from "./chunks/chunk-5QNVUXGF.js";
89
89
  import {
90
90
  processRevocationResponse,
91
91
  readLocalConfig,
@@ -94,7 +94,7 @@ import {
94
94
  sleep,
95
95
  writeToAuthConfigFile,
96
96
  writeToConfigFile
97
- } from "./chunks/chunk-5KFTN63Q.js";
97
+ } from "./chunks/chunk-T74PTRRA.js";
98
98
  import "./chunks/chunk-V5P25P7F.js";
99
99
  import {
100
100
  getCustomEnvironments,
@@ -105,7 +105,7 @@ import {
105
105
  } from "./chunks/chunk-C5YP6KFI.js";
106
106
  import {
107
107
  formatTable
108
- } from "./chunks/chunk-DF4AVQY3.js";
108
+ } from "./chunks/chunk-G6RXZLQ2.js";
109
109
  import "./chunks/chunk-LOS7HHU3.js";
110
110
  import {
111
111
  isValidName
@@ -120,11 +120,11 @@ import {
120
120
  } from "./chunks/chunk-N45K6NXC.js";
121
121
  import {
122
122
  getScope
123
- } from "./chunks/chunk-MGJMZIIT.js";
123
+ } from "./chunks/chunk-V766LKN6.js";
124
124
  import {
125
125
  formatEnvironment,
126
126
  validateLsArgs
127
- } from "./chunks/chunk-Z66S4G43.js";
127
+ } from "./chunks/chunk-BXSWMI6W.js";
128
128
  import {
129
129
  validateJsonOutput
130
130
  } from "./chunks/chunk-XPKWKPWA.js";
@@ -364,7 +364,7 @@ import {
364
364
  webAnalyticsSubcommand,
365
365
  webhooksCommand,
366
366
  whoamiCommand
367
- } from "./chunks/chunk-4X7GBE5B.js";
367
+ } from "./chunks/chunk-QZ3UQIL3.js";
368
368
  import {
369
369
  addSubcommand as addSubcommand9,
370
370
  deleteSubcommand,
@@ -380,21 +380,21 @@ import {
380
380
  reorderSubcommand,
381
381
  restoreSubcommand as restoreSubcommand2,
382
382
  routesCommand
383
- } from "./chunks/chunk-DED5G3HZ.js";
383
+ } from "./chunks/chunk-CRZM5WM2.js";
384
384
  import {
385
385
  metricsCommand,
386
386
  schemaSubcommand
387
- } from "./chunks/chunk-DAOAZ2VQ.js";
388
- import "./chunks/chunk-PVZBM6NU.js";
387
+ } from "./chunks/chunk-BHDZCUTT.js";
388
+ import "./chunks/chunk-BJQTGP42.js";
389
389
  import {
390
390
  activityCommand,
391
391
  typesSubcommand
392
- } from "./chunks/chunk-XLKXWNRG.js";
392
+ } from "./chunks/chunk-UWKTUK3W.js";
393
393
  import {
394
394
  alertsCommand,
395
395
  inspectSubcommand,
396
396
  listSubcommand
397
- } from "./chunks/chunk-7L4XVUFK.js";
397
+ } from "./chunks/chunk-TAOVG4PS.js";
398
398
  import {
399
399
  rulesAddSubcommand,
400
400
  rulesAggregateCommand,
@@ -402,26 +402,26 @@ import {
402
402
  rulesLsSubcommand,
403
403
  rulesRmSubcommand,
404
404
  rulesUpdateSubcommand
405
- } from "./chunks/chunk-LUCCJW67.js";
406
- import "./chunks/chunk-MCTAPJSL.js";
405
+ } from "./chunks/chunk-DVQ4SIWF.js";
406
+ import "./chunks/chunk-VGWGLBUC.js";
407
407
  import {
408
408
  main
409
- } from "./chunks/chunk-553A6UFX.js";
410
- import "./chunks/chunk-QFP6FEBN.js";
409
+ } from "./chunks/chunk-BO7LOGQA.js";
410
+ import "./chunks/chunk-L7AFYPER.js";
411
411
  import {
412
412
  ua_default
413
413
  } from "./chunks/chunk-4PQA6H63.js";
414
414
  import {
415
415
  require_execa
416
- } from "./chunks/chunk-FY3TMBQS.js";
416
+ } from "./chunks/chunk-HYAMHBSF.js";
417
417
  import {
418
418
  ensureLink
419
- } from "./chunks/chunk-U73MZTAR.js";
420
- import "./chunks/chunk-3N3AYMMW.js";
421
- import "./chunks/chunk-LUJPLXGG.js";
419
+ } from "./chunks/chunk-6GTUL6VG.js";
420
+ import "./chunks/chunk-IS75MWZN.js";
421
+ import "./chunks/chunk-LGSOFQRC.js";
422
422
  import {
423
423
  autoInstallVercelPlugin
424
- } from "./chunks/chunk-WYRFA4PX.js";
424
+ } from "./chunks/chunk-QO6J4DC7.js";
425
425
  import {
426
426
  AGENT_ACTION,
427
427
  AGENT_REASON,
@@ -429,10 +429,10 @@ import {
429
429
  } from "./chunks/chunk-E3NE4SKN.js";
430
430
  import {
431
431
  help
432
- } from "./chunks/chunk-C7UTFMYF.js";
432
+ } from "./chunks/chunk-LDXYSGPZ.js";
433
433
  import {
434
434
  table
435
- } from "./chunks/chunk-WCTFUOSJ.js";
435
+ } from "./chunks/chunk-GE6G37P4.js";
436
436
  import {
437
437
  STANDARD_ENVIRONMENTS,
438
438
  VERCEL_CONFIG_EXTENSIONS,
@@ -472,7 +472,7 @@ import {
472
472
  resolveProjectCwd,
473
473
  selectAndParseRemoteUrl,
474
474
  selectOrg
475
- } from "./chunks/chunk-UG4457SI.js";
475
+ } from "./chunks/chunk-LOUKPRIS.js";
476
476
  import {
477
477
  TelemetryClient
478
478
  } from "./chunks/chunk-U3WLEFHU.js";
@@ -487,7 +487,7 @@ import {
487
487
  outputActionRequired,
488
488
  outputAgentError,
489
489
  shouldEmitNonInteractiveCommandError
490
- } from "./chunks/chunk-CGTXAXZ4.js";
490
+ } from "./chunks/chunk-XKHLPA6V.js";
491
491
  import {
492
492
  elapsed,
493
493
  require_ms,
@@ -502,7 +502,7 @@ import {
502
502
  globalCliFlagTakesValue,
503
503
  parseArguments,
504
504
  printError
505
- } from "./chunks/chunk-VDM5O3P6.js";
505
+ } from "./chunks/chunk-RFMC2QXQ.js";
506
506
  import {
507
507
  APIError,
508
508
  AliasInUse,
@@ -844,7 +844,7 @@ async function activity(client) {
844
844
  return 0;
845
845
  }
846
846
  telemetry2.trackCliSubcommandTypes(subcommandOriginal);
847
- const typesFn = (await import("./chunks/types-M7LVCA3E.js")).default;
847
+ const typesFn = (await import("./chunks/types-QNN5CDCB.js")).default;
848
848
  return typesFn(client, telemetry2);
849
849
  }
850
850
  default: {
@@ -854,7 +854,7 @@ async function activity(client) {
854
854
  return 0;
855
855
  }
856
856
  telemetry2.trackCliSubcommandLs(subcommandOriginal);
857
- const listFn = (await import("./chunks/list-Y2YMJWEY.js")).default;
857
+ const listFn = (await import("./chunks/list-LTDGGY5C.js")).default;
858
858
  return listFn(client, telemetry2);
859
859
  }
860
860
  }
@@ -1331,17 +1331,17 @@ async function alerts(client) {
1331
1331
  switch (subcommand) {
1332
1332
  case "inspect": {
1333
1333
  telemetry2.trackCliSubcommandInspect(subcommandOriginal);
1334
- const inspectFn = (await import("./chunks/inspect-3QVCZVKV.js")).default;
1334
+ const inspectFn = (await import("./chunks/inspect-7CDEJF2U.js")).default;
1335
1335
  return inspectFn(client, args);
1336
1336
  }
1337
1337
  case "rules": {
1338
1338
  telemetry2.trackCliSubcommandRules(args[0] ?? "ls");
1339
- const rulesFn = (await import("./chunks/rules-FUFDJOIP.js")).default;
1339
+ const rulesFn = (await import("./chunks/rules-MCUCN322.js")).default;
1340
1340
  return rulesFn(client, args);
1341
1341
  }
1342
1342
  default: {
1343
1343
  telemetry2.trackCliSubcommandLs(subcommandOriginal);
1344
- const listFn = (await import("./chunks/list-CWTYXKB5.js")).default;
1344
+ const listFn = (await import("./chunks/list-MKMRMDWW.js")).default;
1345
1345
  return listFn(client, telemetry2);
1346
1346
  }
1347
1347
  }
@@ -5845,54 +5845,86 @@ async function create2(client, args, flags) {
5845
5845
  }
5846
5846
  const { original, hash } = generateRequestCode();
5847
5847
  const link = await getProjectLink(client, client.cwd);
5848
+ const body = {
5849
+ service: serviceType,
5850
+ name,
5851
+ request_code: hash
5852
+ };
5853
+ if (link?.projectId) {
5854
+ body.projectId = link.projectId;
5855
+ }
5848
5856
  output_manager_default.spinner("Setting up...");
5857
+ let createdClient = null;
5849
5858
  let browserUrl;
5850
5859
  try {
5851
- let url = `/v1/connex/clients/managed?service=${encodeURIComponent(serviceType)}&name=${encodeURIComponent(name)}&request_code=${encodeURIComponent(hash)}&autoinstall=true`;
5852
- if (link?.projectId) {
5853
- url += `&projectId=${encodeURIComponent(link.projectId)}`;
5854
- }
5855
- const res = await client.fetch(url, { json: false, redirect: "manual" });
5856
- const location = res.headers.get("location");
5857
- if (!location) {
5858
- output_manager_default.stopSpinner();
5859
- output_manager_default.error("Unexpected response from API: no redirect URL");
5860
- return 1;
5861
- }
5862
- browserUrl = location;
5860
+ createdClient = await client.fetch(
5861
+ "/v1/connex/clients/managed?autoinstall=true",
5862
+ { method: "POST", body }
5863
+ );
5863
5864
  } catch (err) {
5864
- output_manager_default.stopSpinner();
5865
- const status3 = err.status;
5866
- if (status3 === 404) {
5865
+ const apiErr = err;
5866
+ if (apiErr.status === 422 && apiErr.registerUrl) {
5867
+ browserUrl = apiErr.registerUrl;
5868
+ } else if (apiErr.status === 404) {
5869
+ output_manager_default.stopSpinner();
5867
5870
  output_manager_default.error(
5868
5871
  "Connex is not enabled for this team. Contact support to enable it."
5869
5872
  );
5870
5873
  return 1;
5874
+ } else {
5875
+ output_manager_default.stopSpinner();
5876
+ printError(err);
5877
+ return 1;
5871
5878
  }
5872
- printError(err);
5873
- return 1;
5874
5879
  }
5875
5880
  output_manager_default.stopSpinner();
5876
- output_manager_default.log(`Opening browser for ${serviceType} app setup...`);
5877
- output_manager_default.log(`If the browser doesn't open, visit:
5881
+ let hasBeenInstalled = false;
5882
+ if (browserUrl) {
5883
+ output_manager_default.log(`Opening browser for ${serviceType} app setup...`);
5884
+ output_manager_default.log(`If the browser doesn't open, visit:
5878
5885
  ${browserUrl}`);
5879
- (0, import_open3.default)(browserUrl).catch(
5880
- (err) => output_manager_default.debug(`Failed to open browser: ${err}`)
5881
- );
5882
- output_manager_default.spinner("Waiting for you to complete setup in the browser...");
5883
- const data = await awaitConnexResult(client, original);
5884
- output_manager_default.stopSpinner();
5885
- if (!data) {
5886
+ (0, import_open3.default)(browserUrl).catch(
5887
+ (err) => output_manager_default.debug(`Failed to open browser: ${err}`)
5888
+ );
5889
+ output_manager_default.spinner("Waiting for you to complete setup in the browser...");
5890
+ const resultFromBrowser = await awaitConnexResult(client, original);
5891
+ output_manager_default.stopSpinner();
5892
+ if (resultFromBrowser && "clientId" in resultFromBrowser && typeof resultFromBrowser.clientId === "string") {
5893
+ const clientId = resultFromBrowser.clientId;
5894
+ createdClient = await client.fetch(
5895
+ `/v1/connex/clients/${clientId}`
5896
+ );
5897
+ }
5898
+ if (resultFromBrowser && "installationId" in resultFromBrowser && resultFromBrowser.installationId) {
5899
+ hasBeenInstalled = true;
5900
+ }
5901
+ }
5902
+ if (!createdClient) {
5886
5903
  return 1;
5887
5904
  }
5888
- const clientId = data.clientId;
5889
5905
  if (asJson) {
5890
- client.stdout.write(`${JSON.stringify(data, null, 2)}
5891
- `);
5892
- } else if (data.installationId) {
5893
- output_manager_default.success(`${serviceType} client created and installed: ${clientId}`);
5906
+ client.stdout.write(
5907
+ `${JSON.stringify(
5908
+ {
5909
+ id: createdClient.id,
5910
+ uid: createdClient.uid,
5911
+ type: createdClient.type,
5912
+ name: createdClient.name,
5913
+ supportedSubjectTypes: createdClient.supportedSubjectTypes
5914
+ },
5915
+ null,
5916
+ 2
5917
+ )}
5918
+ `
5919
+ );
5920
+ } else if (hasBeenInstalled) {
5921
+ output_manager_default.success(
5922
+ `${serviceType} client created and installed: ${createdClient.id} (UID ${createdClient.uid})`
5923
+ );
5894
5924
  } else {
5895
- output_manager_default.success(`${serviceType} client created: ${clientId}`);
5925
+ output_manager_default.success(
5926
+ `${serviceType} client created: ${createdClient.id} (UID ${createdClient.uid})`
5927
+ );
5896
5928
  }
5897
5929
  return 0;
5898
5930
  }
@@ -11987,14 +12019,15 @@ function formatStatusOutput(active, draft, bypass, attackMode) {
11987
12019
  );
11988
12020
  }
11989
12021
  lines.push(
11990
- ` ${import_chalk56.default.bold("System Mitigations:")} ${formatMitigationsStatus(bypass)}`
12022
+ ` ${import_chalk56.default.bold("System Mitigations:")} ${formatMitigationsStatus(bypass)}`
11991
12023
  );
11992
12024
  if (draft && draft.changes.length > 0) {
11993
12025
  lines.push("");
11994
12026
  lines.push(
11995
12027
  ` ${import_chalk56.default.bold("Pending Draft:")} ${import_chalk56.default.yellow(`${draft.changes.length} unpublished change${draft.changes.length !== 1 ? "s" : ""}`)}`
11996
12028
  );
11997
- lines.push(formatDiffOutput(draft.changes));
12029
+ const activeRulesMap = new Map((active?.rules || []).map((r) => [r.id, r]));
12030
+ lines.push(formatDiffOutput(draft.changes, activeRulesMap));
11998
12031
  }
11999
12032
  return lines.join("\n");
12000
12033
  }
@@ -12096,7 +12129,7 @@ function getDiffSymbol(action) {
12096
12129
  }
12097
12130
  return { symbol: "~", color: import_chalk56.default.yellow };
12098
12131
  }
12099
- function formatChangeDescription(change2) {
12132
+ function formatChangeDescription(change2, activeRules) {
12100
12133
  const { action, id, value } = change2;
12101
12134
  switch (action) {
12102
12135
  case "rules.insert": {
@@ -12104,8 +12137,21 @@ function formatChangeDescription(change2) {
12104
12137
  return `Added rule "${rule?.name || id || "unknown"}"`;
12105
12138
  }
12106
12139
  case "rules.update": {
12107
- const rule = value;
12108
- return `Modified rule "${rule?.name || id || "unknown"}"`;
12140
+ const draft = value;
12141
+ const ruleName = draft?.name || id || "unknown";
12142
+ if (activeRules && id && draft && typeof draft.active === "boolean") {
12143
+ const activeRule = activeRules.get(id);
12144
+ if (activeRule && activeRule.active !== draft.active) {
12145
+ const nameUnchanged = activeRule.name === draft.name;
12146
+ const conditionsUnchanged = JSON.stringify(activeRule.conditionGroup) === JSON.stringify(draft.conditionGroup);
12147
+ const actionUnchanged = JSON.stringify(activeRule.action) === JSON.stringify(draft.action);
12148
+ const descriptionUnchanged = (activeRule.description || "") === (draft.description || "");
12149
+ if (nameUnchanged && conditionsUnchanged && actionUnchanged && descriptionUnchanged) {
12150
+ return draft.active ? `Enabled rule "${ruleName}"` : `Disabled rule "${ruleName}"`;
12151
+ }
12152
+ }
12153
+ }
12154
+ return `Modified rule "${ruleName}"`;
12109
12155
  }
12110
12156
  case "rules.remove":
12111
12157
  return `Removed rule "${id || "unknown"}"`;
@@ -12145,12 +12191,80 @@ function formatChangeDescription(change2) {
12145
12191
  return `${action}${id ? ` (${id})` : ""}`;
12146
12192
  }
12147
12193
  }
12148
- function formatDiffOutput(changes) {
12194
+ function formatRuleFieldDiff(activeRule, draftValue) {
12149
12195
  const lines = [];
12150
- for (const change2 of changes) {
12196
+ if (draftValue.name && activeRule.name !== draftValue.name) {
12197
+ lines.push(
12198
+ import_chalk56.default.yellow(` ~ Name: "${activeRule.name}" \u2192 "${draftValue.name}"`)
12199
+ );
12200
+ }
12201
+ if (draftValue.action && JSON.stringify(activeRule.action) !== JSON.stringify(draftValue.action)) {
12202
+ const oldAction = formatActionDisplay(activeRule.action);
12203
+ const newAction = formatActionDisplay(draftValue.action);
12204
+ lines.push(import_chalk56.default.yellow(` ~ Action: ${oldAction} \u2192 ${newAction}`));
12205
+ }
12206
+ if (draftValue.conditionGroup && JSON.stringify(activeRule.conditionGroup) !== JSON.stringify(draftValue.conditionGroup)) {
12207
+ const oldConditions = new Set(
12208
+ activeRule.conditionGroup.flatMap(
12209
+ (g) => g.conditions.map((c) => formatConditionCompact(c))
12210
+ )
12211
+ );
12212
+ const newConditions = new Set(
12213
+ draftValue.conditionGroup.flatMap(
12214
+ (g) => g.conditions.map((c) => formatConditionCompact(c))
12215
+ )
12216
+ );
12217
+ const added = [...newConditions].filter((c) => !oldConditions.has(c));
12218
+ const removed = [...oldConditions].filter((c) => !newConditions.has(c));
12219
+ for (const c of added) {
12220
+ lines.push(import_chalk56.default.green(` + Condition: ${c}`));
12221
+ }
12222
+ for (const c of removed) {
12223
+ lines.push(import_chalk56.default.red(` - Condition: ${c}`));
12224
+ }
12225
+ if (added.length === 0 && removed.length === 0) {
12226
+ lines.push(import_chalk56.default.yellow(" ~ Condition groups restructured"));
12227
+ }
12228
+ }
12229
+ return lines;
12230
+ }
12231
+ var CHANGE_ACTION_ORDER = {
12232
+ firewallEnabled: 0,
12233
+ "rules.insert": 1,
12234
+ "rules.update": 2,
12235
+ "rules.remove": 3,
12236
+ "rules.priority": 4,
12237
+ "ip.insert": 5,
12238
+ "ip.update": 6,
12239
+ "ip.remove": 7,
12240
+ "crs.update": 8,
12241
+ "crs.disable": 9,
12242
+ "managedRules.update": 10,
12243
+ "managedRuleGroup.update": 11,
12244
+ "botId.toggle": 12,
12245
+ ja3Enabled: 13,
12246
+ ja4Enabled: 14,
12247
+ "logHeaders.update": 15
12248
+ };
12249
+ function formatDiffOutput(changes, activeRules) {
12250
+ const lines = [];
12251
+ const sorted = [...changes].sort(
12252
+ (a, b) => (CHANGE_ACTION_ORDER[a.action] ?? 99) - (CHANGE_ACTION_ORDER[b.action] ?? 99)
12253
+ );
12254
+ for (const change2 of sorted) {
12151
12255
  const { symbol, color } = getDiffSymbol(change2.action);
12152
- const description = formatChangeDescription(change2);
12256
+ const description = formatChangeDescription(change2, activeRules);
12153
12257
  lines.push(color(` ${symbol} ${description}`));
12258
+ if (change2.action === "rules.update" && activeRules && change2.id) {
12259
+ const activeRule = activeRules.get(change2.id);
12260
+ if (activeRule && change2.value) {
12261
+ const subLines = formatRuleFieldDiff(
12262
+ activeRule,
12263
+ change2.value
12264
+ );
12265
+ lines.push(...subLines);
12266
+ }
12267
+ }
12154
12268
  }
12155
12269
  return lines.join("\n");
12156
12270
  }
@@ -12198,7 +12312,6 @@ var CONDITION_TYPE_LABELS = {
12198
12312
  scheme: "scheme",
12199
12313
  environment: "environment",
12200
12314
  region: "region",
12201
- ssl: "SSL",
12202
12315
  ip_address: "IP address",
12203
12316
  user_agent: "user agent",
12204
12317
  geo_country: "geo country",
@@ -12318,28 +12431,19 @@ function formatRulesTable(annotated) {
12318
12431
  "Name".length,
12319
12432
  ...annotated.map((a) => a.rule.name.length)
12320
12433
  );
12321
- const statusWidth = Math.max(
12322
- "Status".length,
12323
- ...annotated.map((a) => (a.rule.active ? "Enabled" : "Disabled").length)
12324
- );
12325
12434
  const actionTexts = annotated.map((a) => formatActionDisplay(a.rule.action));
12326
12435
  const actionWidth = Math.max(
12327
12436
  "Action".length,
12328
12437
  ...actionTexts.map((t) => t.length)
12329
12438
  );
12330
12439
  lines.push(
12331
- ` ${" ".repeat(prefixWidth)}${import_chalk56.default.dim("#".padEnd(numWidth + gap))}${import_chalk56.default.dim("Name".padEnd(nameWidth + gap))}${import_chalk56.default.dim("Status".padEnd(statusWidth + gap))}${import_chalk56.default.dim("Action".padEnd(actionWidth + gap))}${import_chalk56.default.dim("Description")}`
12440
+ ` ${" ".repeat(prefixWidth)}${import_chalk56.default.dim("#".padEnd(numWidth + gap))}${import_chalk56.default.dim("Name".padEnd(nameWidth + gap))}${import_chalk56.default.dim("Action".padEnd(actionWidth + gap))}${import_chalk56.default.dim("Status")}`
12332
12441
  );
12333
12442
  for (let i = 0; i < annotated.length; i++) {
12334
12443
  const { rule, status: status3 } = annotated[i];
12335
12444
  const num = String(i + 1).padEnd(numWidth + gap);
12336
12445
  const name = rule.name.padEnd(nameWidth + gap);
12337
- const activeStatusText = (rule.active ? "Enabled" : "Disabled").padEnd(
12338
- statusWidth + gap
12339
- );
12340
- const activeStatus = rule.active ? import_chalk56.default.green(activeStatusText) : import_chalk56.default.red(activeStatusText);
12341
12446
  const actionText = actionTexts[i].padEnd(actionWidth + gap);
12342
- const description = rule.description || "";
12343
12447
  let prefix = " ";
12344
12448
  let colorFn = (s) => s;
12345
12449
  if (status3 === "added") {
@@ -12352,11 +12456,11 @@ function formatRulesTable(annotated) {
12352
12456
  prefix = "~ ";
12353
12457
  colorFn = import_chalk56.default.yellow;
12354
12458
  }
12355
- lines.push(
12356
- colorFn(
12357
- ` ${prefix}${num}${name}${activeStatus}${actionText}${description}`
12358
- )
12359
- );
12459
+ const activeStatusText = rule.active ? "Enabled" : "Disabled";
12460
+ const activeStatus = status3 === "removed" ? import_chalk56.default.dim(activeStatusText) : rule.active ? import_chalk56.default.green(activeStatusText) : import_chalk56.default.red(activeStatusText);
12461
+ lines.push(colorFn(` ${prefix}${num}${name}${actionText}${activeStatus}`));
12462
+ const idIndent = " ".repeat(prefixWidth + numWidth + gap);
12463
+ lines.push(colorFn(` ${idIndent}${import_chalk56.default.dim(rule.id)}`));
12360
12464
  }
12361
12465
  return lines.join("\n");
12362
12466
  }
@@ -12549,7 +12653,7 @@ async function diff(client, argv) {
12549
12653
  const teamId = org.type === "team" ? org.id : void 0;
12550
12654
  output_manager_default.spinner(`Fetching draft changes for ${import_chalk58.default.bold(project.name)}`);
12551
12655
  try {
12552
- const { draft } = await listFirewallConfigs(client, project.id, {
12656
+ const { active, draft } = await listFirewallConfigs(client, project.id, {
12553
12657
  teamId
12554
12658
  });
12555
12659
  if (!draft || draft.changes.length === 0) {
@@ -12564,13 +12668,14 @@ async function diff(client, argv) {
12564
12668
  outputJson2(client, { changes: draft.changes });
12565
12669
  return 0;
12566
12670
  }
12671
+ const activeRulesMap = new Map((active?.rules || []).map((r) => [r.id, r]));
12567
12672
  output_manager_default.print(
12568
12673
  `
12569
12674
  ${import_chalk58.default.bold(`Pending changes (${draft.changes.length}):`)}
12570
12675
 
12571
12676
  `
12572
12677
  );
12573
- output_manager_default.print(formatDiffOutput(draft.changes));
12678
+ output_manager_default.print(formatDiffOutput(draft.changes, activeRulesMap));
12574
12679
  output_manager_default.print("\n\n");
12575
12680
  output_manager_default.print(
12576
12681
  ` Run ${import_chalk58.default.cyan(getCommandName("firewall publish"))} to publish, or ${import_chalk58.default.cyan(getCommandName("firewall discard"))} to discard.
@@ -12609,20 +12714,21 @@ async function publish(client, argv) {
12609
12714
  const teamId = org.type === "team" ? org.id : void 0;
12610
12715
  output_manager_default.spinner(`Fetching draft changes for ${import_chalk59.default.bold(project.name)}`);
12611
12716
  try {
12612
- const { draft } = await listFirewallConfigs(client, project.id, {
12717
+ const { active, draft } = await listFirewallConfigs(client, project.id, {
12613
12718
  teamId
12614
12719
  });
12615
12720
  if (!draft || draft.changes.length === 0) {
12616
12721
  output_manager_default.warn("No draft changes to publish.");
12617
12722
  return 0;
12618
12723
  }
12724
+ const activeRulesMap = new Map((active?.rules || []).map((r) => [r.id, r]));
12619
12725
  output_manager_default.print(
12620
12726
  `
12621
12727
  ${import_chalk59.default.bold(`Changes to be published (${draft.changes.length}):`)}
12622
12728
 
12623
12729
  `
12624
12730
  );
12625
- output_manager_default.print(formatDiffOutput(draft.changes));
12731
+ output_manager_default.print(formatDiffOutput(draft.changes, activeRulesMap));
12626
12732
  output_manager_default.print("\n\n");
12627
12733
  const confirmed = await confirmAction(
12628
12734
  client,
@@ -12687,20 +12793,21 @@ async function discard(client, argv) {
12687
12793
  const teamId = org.type === "team" ? org.id : void 0;
12688
12794
  output_manager_default.spinner(`Fetching draft changes for ${import_chalk60.default.bold(project.name)}`);
12689
12795
  try {
12690
- const { draft } = await listFirewallConfigs(client, project.id, {
12796
+ const { active, draft } = await listFirewallConfigs(client, project.id, {
12691
12797
  teamId
12692
12798
  });
12693
12799
  if (!draft || draft.changes.length === 0) {
12694
12800
  output_manager_default.warn("No draft changes to discard.");
12695
12801
  return 0;
12696
12802
  }
12803
+ const activeRulesMap = new Map((active?.rules || []).map((r) => [r.id, r]));
12697
12804
  output_manager_default.print(
12698
12805
  `
12699
12806
  ${import_chalk60.default.bold(`Changes to be discarded (${draft.changes.length}):`)}
12700
12807
 
12701
12808
  `
12702
12809
  );
12703
- output_manager_default.print(formatDiffOutput(draft.changes));
12810
+ output_manager_default.print(formatDiffOutput(draft.changes, activeRulesMap));
12704
12811
  output_manager_default.print("\n\n");
12705
12812
  const confirmed = await confirmAction(
12706
12813
  client,
@@ -14143,6 +14250,7 @@ async function unblock(client, argv) {
14143
14250
  rule = selected;
14144
14251
  }
14145
14252
  const hostnameLabel = rule.hostname === "*" || rule.hostname === "" ? "all hosts" : rule.hostname;
14253
+ output_manager_default.stopSpinner();
14146
14254
  const confirmed = await confirmAction(
14147
14255
  client,
14148
14256
  parsed.flags["--yes"],
@@ -14683,14 +14791,6 @@ var CONDITION_TYPES = [
14683
14791
  { label: "https", value: "https" }
14684
14792
  ]
14685
14793
  },
14686
- {
14687
- type: "ssl",
14688
- displayName: "SSL",
14689
- description: "Whether the connection uses SSL/TLS",
14690
- category: "request",
14691
- requiresKey: false,
14692
- operators: ["ex"]
14693
- },
14694
14794
  {
14695
14795
  type: "rate_limit_api_id",
14696
14796
  displayName: "Rate Limit API ID",
@@ -31432,7 +31532,7 @@ async function metrics(client) {
31432
31532
  return 0;
31433
31533
  }
31434
31534
  telemetry2.trackCliSubcommandSchema(subcommandOriginal);
31435
- const schemaFn = (await import("./chunks/schema-CI2XUYTW.js")).default;
31535
+ const schemaFn = (await import("./chunks/schema-CZ7B2GTS.js")).default;
31436
31536
  return schemaFn(client, telemetry2);
31437
31537
  }
31438
31538
  default: {
@@ -31445,7 +31545,7 @@ async function metrics(client) {
31445
31545
  output_manager_default.print(help(metricsCommand, { columns: client.stderr.columns }));
31446
31546
  return 2;
31447
31547
  }
31448
- const queryFn = (await import("./chunks/query-MLMGNGL2.js")).default;
31548
+ const queryFn = (await import("./chunks/query-WGX6PLTN.js")).default;
31449
31549
  return queryFn(client, telemetry2);
31450
31550
  }
31451
31551
  }
@@ -42322,7 +42422,7 @@ async function main27(client) {
42322
42422
  return 2;
42323
42423
  }
42324
42424
  telemetry2.trackCliSubcommandEdit(subcommandOriginal);
42325
- return (await import("./chunks/edit-VFUE5PVU.js")).default(client, args);
42425
+ return (await import("./chunks/edit-UFYK3Z3T.js")).default(client, args);
42326
42426
  case "delete":
42327
42427
  if (needHelp) {
42328
42428
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -42330,7 +42430,7 @@ async function main27(client) {
42330
42430
  return 2;
42331
42431
  }
42332
42432
  telemetry2.trackCliSubcommandDelete(subcommandOriginal);
42333
- return (await import("./chunks/delete-5RI2PRIT.js")).default(client, args);
42433
+ return (await import("./chunks/delete-H2OF5N72.js")).default(client, args);
42334
42434
  case "enable":
42335
42435
  if (needHelp) {
42336
42436
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -42338,7 +42438,7 @@ async function main27(client) {
42338
42438
  return 2;
42339
42439
  }
42340
42440
  telemetry2.trackCliSubcommandEnable(subcommandOriginal);
42341
- return (await import("./chunks/enable-V2AX2FXX.js")).default(client, args);
42441
+ return (await import("./chunks/enable-2MEB4O5O.js")).default(client, args);
42342
42442
  case "disable":
42343
42443
  if (needHelp) {
42344
42444
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -42346,7 +42446,7 @@ async function main27(client) {
42346
42446
  return 2;
42347
42447
  }
42348
42448
  telemetry2.trackCliSubcommandDisable(subcommandOriginal);
42349
- return (await import("./chunks/disable-JPKO7VCV.js")).default(client, args);
42449
+ return (await import("./chunks/disable-Z4ENND33.js")).default(client, args);
42350
42450
  case "reorder":
42351
42451
  if (needHelp) {
42352
42452
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -42354,7 +42454,7 @@ async function main27(client) {
42354
42454
  return 2;
42355
42455
  }
42356
42456
  telemetry2.trackCliSubcommandReorder(subcommandOriginal);
42357
- return (await import("./chunks/reorder-757V4BF5.js")).default(client, args);
42457
+ return (await import("./chunks/reorder-SQ52RGDY.js")).default(client, args);
42358
42458
  case "export":
42359
42459
  if (needHelp) {
42360
42460
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -42362,7 +42462,7 @@ async function main27(client) {
42362
42462
  return 2;
42363
42463
  }
42364
42464
  telemetry2.trackCliSubcommandExport(subcommandOriginal);
42365
- return (await import("./chunks/export-BG3TOT6G.js")).default(client, args);
42465
+ return (await import("./chunks/export-T5VEXLYZ.js")).default(client, args);
42366
42466
  case "publish":
42367
42467
  if (needHelp) {
42368
42468
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -42370,7 +42470,7 @@ async function main27(client) {
42370
42470
  return 2;
42371
42471
  }
42372
42472
  telemetry2.trackCliSubcommandPublish(subcommandOriginal);
42373
- return (await import("./chunks/publish-75IJ4PZS.js")).default(client, args);
42473
+ return (await import("./chunks/publish-SMAXMKKV.js")).default(client, args);
42374
42474
  case "restore":
42375
42475
  if (needHelp) {
42376
42476
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -42378,7 +42478,7 @@ async function main27(client) {
42378
42478
  return 2;
42379
42479
  }
42380
42480
  telemetry2.trackCliSubcommandRestore(subcommandOriginal);
42381
- return (await import("./chunks/restore-KV44XHFS.js")).default(client, args);
42481
+ return (await import("./chunks/restore-P6RHBBEG.js")).default(client, args);
42382
42482
  case "discard-staging":
42383
42483
  if (needHelp) {
42384
42484
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -42386,7 +42486,7 @@ async function main27(client) {
42386
42486
  return 2;
42387
42487
  }
42388
42488
  telemetry2.trackCliSubcommandDiscardStaging(subcommandOriginal);
42389
- return (await import("./chunks/discard-KXGXXDNX.js")).default(client, args);
42489
+ return (await import("./chunks/discard-UQGHXIL4.js")).default(client, args);
42390
42490
  default:
42391
42491
  output_manager_default.error(getInvalidSubcommand(COMMAND_CONFIG35));
42392
42492
  output_manager_default.print(help(routesCommand, { columns: client.stderr.columns }));