@salesforce/b2c-cli 1.12.1 → 1.15.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 (59) hide show
  1. package/dist/commands/ecdn/firewall/create.d.ts +44 -0
  2. package/dist/commands/ecdn/firewall/create.js +111 -0
  3. package/dist/commands/ecdn/firewall/create.js.map +1 -0
  4. package/dist/commands/ecdn/firewall/delete.d.ts +39 -0
  5. package/dist/commands/ecdn/firewall/delete.js +64 -0
  6. package/dist/commands/ecdn/firewall/delete.js.map +1 -0
  7. package/dist/commands/ecdn/firewall/get.d.ts +39 -0
  8. package/dist/commands/ecdn/firewall/get.js +66 -0
  9. package/dist/commands/ecdn/firewall/get.js.map +1 -0
  10. package/dist/commands/ecdn/firewall/list.d.ts +43 -0
  11. package/dist/commands/ecdn/firewall/list.js +103 -0
  12. package/dist/commands/ecdn/firewall/list.js.map +1 -0
  13. package/dist/commands/ecdn/firewall/reorder.d.ts +49 -0
  14. package/dist/commands/ecdn/firewall/reorder.js +135 -0
  15. package/dist/commands/ecdn/firewall/reorder.js.map +1 -0
  16. package/dist/commands/ecdn/firewall/update.d.ts +43 -0
  17. package/dist/commands/ecdn/firewall/update.js +106 -0
  18. package/dist/commands/ecdn/firewall/update.js.map +1 -0
  19. package/dist/commands/ecdn/rate-limit/create.d.ts +49 -0
  20. package/dist/commands/ecdn/rate-limit/create.js +158 -0
  21. package/dist/commands/ecdn/rate-limit/create.js.map +1 -0
  22. package/dist/commands/ecdn/rate-limit/delete.d.ts +39 -0
  23. package/dist/commands/ecdn/rate-limit/delete.js +61 -0
  24. package/dist/commands/ecdn/rate-limit/delete.js.map +1 -0
  25. package/dist/commands/ecdn/rate-limit/get.d.ts +39 -0
  26. package/dist/commands/ecdn/rate-limit/get.js +73 -0
  27. package/dist/commands/ecdn/rate-limit/get.js.map +1 -0
  28. package/dist/commands/ecdn/rate-limit/list.d.ts +41 -0
  29. package/dist/commands/ecdn/rate-limit/list.js +108 -0
  30. package/dist/commands/ecdn/rate-limit/list.js.map +1 -0
  31. package/dist/commands/ecdn/rate-limit/update.d.ts +50 -0
  32. package/dist/commands/ecdn/rate-limit/update.js +186 -0
  33. package/dist/commands/ecdn/rate-limit/update.js.map +1 -0
  34. package/dist/commands/job/import.d.ts +21 -2
  35. package/dist/commands/job/import.js +183 -45
  36. package/dist/commands/job/import.js.map +1 -1
  37. package/dist/commands/mrt/bundle/deploy.d.ts +2 -2
  38. package/dist/commands/mrt/bundle/deploy.js +2 -4
  39. package/dist/commands/mrt/bundle/deploy.js.map +1 -1
  40. package/dist/commands/mrt/bundle/save.d.ts +37 -0
  41. package/dist/commands/mrt/bundle/save.js +116 -0
  42. package/dist/commands/mrt/bundle/save.js.map +1 -0
  43. package/dist/commands/setup/inspect.js +1 -1
  44. package/dist/commands/setup/inspect.js.map +1 -1
  45. package/dist/commands/setup/skills.js +5 -3
  46. package/dist/commands/setup/skills.js.map +1 -1
  47. package/dist/hooks/sfnext-jit-install.d.ts +15 -0
  48. package/dist/hooks/sfnext-jit-install.js +23 -0
  49. package/dist/hooks/sfnext-jit-install.js.map +1 -0
  50. package/dist/hooks/sfnext-local-override.d.ts +3 -0
  51. package/dist/hooks/sfnext-local-override.js +65 -0
  52. package/dist/hooks/sfnext-local-override.js.map +1 -0
  53. package/dist/i18n/locales/en.js +3 -2
  54. package/dist/i18n/locales/en.js.map +1 -1
  55. package/dist/utils/logs/filter.d.ts +1 -40
  56. package/dist/utils/logs/filter.js +1 -106
  57. package/dist/utils/logs/filter.js.map +1 -1
  58. package/oclif.manifest.json +5231 -1602
  59. package/package.json +17 -4
@@ -0,0 +1,44 @@
1
+ import type { CdnZonesComponents } from '@salesforce/b2c-tooling-sdk/clients';
2
+ import { EcdnZoneCommand } from '../../../utils/ecdn/index.js';
3
+ type CustomRule = CdnZonesComponents['schemas']['CustomRule'];
4
+ interface CreateOutput {
5
+ rule: CustomRule;
6
+ }
7
+ export default class EcdnFirewallCreate extends EcdnZoneCommand<typeof EcdnFirewallCreate> {
8
+ static description: string;
9
+ static enableJsonFlag: boolean;
10
+ static examples: string[];
11
+ static flags: {
12
+ description: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ expression: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ actions: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
+ enabled: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ before: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ after: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ zone: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
19
+ 'client-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
20
+ 'client-secret': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
21
+ 'auth-scope': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
+ 'short-code': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ 'tenant-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
+ 'auth-methods': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
25
+ 'user-auth': import("@oclif/core/interfaces").BooleanFlag<boolean>;
26
+ 'account-manager-host': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
27
+ 'jwt-cert': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
28
+ 'jwt-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
29
+ 'jwt-passphrase': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
30
+ 'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
31
+ debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
32
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
33
+ jsonl: import("@oclif/core/interfaces").BooleanFlag<boolean>;
34
+ lang: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
35
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
36
+ instance: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
37
+ 'project-directory': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
38
+ 'extra-query': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
39
+ 'extra-body': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
40
+ 'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
41
+ };
42
+ run(): Promise<CreateOutput>;
43
+ }
44
+ export {};
@@ -0,0 +1,111 @@
1
+ /*
2
+ * Copyright (c) 2025, Salesforce, Inc.
3
+ * SPDX-License-Identifier: Apache-2
4
+ * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ import { Flags } from '@oclif/core';
7
+ import cliui from 'cliui';
8
+ import { EcdnZoneCommand, formatApiError } from '../../../utils/ecdn/index.js';
9
+ import { t, withDocs } from '../../../i18n/index.js';
10
+ export default class EcdnFirewallCreate extends EcdnZoneCommand {
11
+ static description = withDocs(t('commands.ecdn.firewall.create.description', 'Create a custom firewall rule for a zone'), '/cli/ecdn.html#b2c-ecdn-firewall-create');
12
+ static enableJsonFlag = true;
13
+ static examples = [
14
+ `<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --zone my-zone --description "Block /admin" --expression '(http.request.uri.path matches "^/admin")' --actions block`,
15
+ `<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --zone my-zone --description "Challenge bot traffic" --expression 'cf.threat_score gt 30' --actions managed_challenge --enabled false`,
16
+ `<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --zone my-zone --description "Insert before existing" --expression '(http.host eq "old.example.com")' --actions block --before 2c0fc9fa937b11eaa1b71c4d701ab86e`,
17
+ ];
18
+ static flags = {
19
+ ...EcdnZoneCommand.baseFlags,
20
+ description: Flags.string({
21
+ description: t('flags.description.description', 'Rule description'),
22
+ required: true,
23
+ }),
24
+ expression: Flags.string({
25
+ description: t('flags.expression.description', 'Expression that determines when this rule applies'),
26
+ required: true,
27
+ }),
28
+ actions: Flags.string({
29
+ description: t('flags.actions.description', 'Comma-separated list of actions applied by the rule'),
30
+ required: true,
31
+ }),
32
+ enabled: Flags.boolean({
33
+ description: t('flags.enabled.description', 'Whether the rule is enabled'),
34
+ allowNo: true,
35
+ default: true,
36
+ }),
37
+ before: Flags.string({
38
+ description: t('flags.before.description', 'Insert this rule before the specified rule ID'),
39
+ exclusive: ['after'],
40
+ }),
41
+ after: Flags.string({
42
+ description: t('flags.after.description', 'Insert this rule after the specified rule ID'),
43
+ exclusive: ['before'],
44
+ }),
45
+ };
46
+ async run() {
47
+ this.requireOAuthCredentials();
48
+ const zoneId = await this.resolveZoneId();
49
+ const description = this.flags.description;
50
+ const expression = this.flags.expression;
51
+ const actionsRaw = this.flags.actions;
52
+ const enabled = this.flags.enabled;
53
+ const before = this.flags.before;
54
+ const after = this.flags.after;
55
+ if (!this.jsonEnabled()) {
56
+ this.log(t('commands.ecdn.firewall.create.creating', 'Creating custom firewall rule...'));
57
+ }
58
+ const actions = actionsRaw
59
+ .split(',')
60
+ .map((value) => value.trim())
61
+ .filter(Boolean);
62
+ if (actions.length === 0) {
63
+ this.error(t('commands.ecdn.firewall.create.actionsRequired', 'At least one action must be provided.'));
64
+ }
65
+ const body = {
66
+ description,
67
+ expression,
68
+ actions,
69
+ enabled,
70
+ };
71
+ if (before) {
72
+ body.position = { before };
73
+ }
74
+ else if (after) {
75
+ body.position = { after };
76
+ }
77
+ const client = this.getCdnZonesRwClient();
78
+ const organizationId = this.getOrganizationId();
79
+ const { data, error } = await client.POST('/organizations/{organizationId}/zones/{zoneId}/firewall-custom/rules', {
80
+ params: {
81
+ path: { organizationId, zoneId },
82
+ },
83
+ body,
84
+ });
85
+ if (error) {
86
+ this.error(t('commands.ecdn.firewall.create.error', 'Failed to create custom firewall rule: {{message}}', {
87
+ message: formatApiError(error),
88
+ }));
89
+ }
90
+ const rule = data?.data;
91
+ if (!rule) {
92
+ this.error(t('commands.ecdn.firewall.create.noData', 'No custom firewall rule data returned from API'));
93
+ }
94
+ const output = { rule };
95
+ if (this.jsonEnabled()) {
96
+ return output;
97
+ }
98
+ const ui = cliui({ width: process.stdout.columns || 80 });
99
+ const labelWidth = 18;
100
+ ui.div('');
101
+ ui.div({ text: t('commands.ecdn.firewall.create.success', 'Custom firewall rule created successfully!') });
102
+ ui.div('');
103
+ ui.div({ text: 'Rule ID:', width: labelWidth }, { text: rule.ruleId });
104
+ ui.div({ text: 'Description:', width: labelWidth }, { text: rule.description });
105
+ ui.div({ text: 'Actions:', width: labelWidth }, { text: rule.actions?.join(', ') ?? '-' });
106
+ ui.div({ text: 'Enabled:', width: labelWidth }, { text: rule.enabled ? 'yes' : 'no' });
107
+ this.log(ui.toString());
108
+ return output;
109
+ }
110
+ }
111
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/ecdn/firewall/create.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAClC,OAAO,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uC,EAAE,4CAA4C,CAAC,EAAC,CAAC,CAAC;QACzG,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACX,EAAE,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAC,EAAE,EAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAC,CAAC,CAAC;QACnE,EAAE,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,UAAU,EAAC,EAAE,EAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAC,CAAC,CAAC;QAC5E,EAAE,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAC,EAAE,EAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,EAAC,CAAC,CAAC;QACvF,EAAE,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAC,EAAE,EAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAC,CAAC,CAAC;QAEnF,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAExB,OAAO,MAAM,CAAC;IAChB,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { EcdnZoneCommand } from '../../../utils/ecdn/index.js';
2
+ interface DeleteOutput {
3
+ deleted: boolean;
4
+ ruleId: string;
5
+ }
6
+ export default class EcdnFirewallDelete extends EcdnZoneCommand<typeof EcdnFirewallDelete> {
7
+ static description: string;
8
+ static enableJsonFlag: boolean;
9
+ static examples: string[];
10
+ static flags: {
11
+ 'rule-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
+ zone: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'client-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
+ 'client-secret': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
16
+ 'auth-scope': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ 'short-code': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ 'tenant-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ 'auth-methods': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ 'user-auth': import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
+ 'account-manager-host': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
22
+ 'jwt-cert': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ 'jwt-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
+ 'jwt-passphrase': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
25
+ 'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
26
+ debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
27
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
28
+ jsonl: import("@oclif/core/interfaces").BooleanFlag<boolean>;
29
+ lang: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
30
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
31
+ instance: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
32
+ 'project-directory': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
33
+ 'extra-query': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
34
+ 'extra-body': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
35
+ 'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
36
+ };
37
+ run(): Promise<DeleteOutput>;
38
+ }
39
+ export {};
@@ -0,0 +1,64 @@
1
+ /*
2
+ * Copyright (c) 2025, Salesforce, Inc.
3
+ * SPDX-License-Identifier: Apache-2
4
+ * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ import { Flags } from '@oclif/core';
7
+ import { EcdnZoneCommand, formatApiError } from '../../../utils/ecdn/index.js';
8
+ import { t, withDocs } from '../../../i18n/index.js';
9
+ export default class EcdnFirewallDelete extends EcdnZoneCommand {
10
+ static description = withDocs(t('commands.ecdn.firewall.delete.description', 'Delete a custom firewall rule for a zone'), '/cli/ecdn.html#b2c-ecdn-firewall-delete');
11
+ static enableJsonFlag = true;
12
+ static examples = [
13
+ '<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --zone my-zone --rule-id 2c0fc9fa937b11eaa1b71c4d701ab86e',
14
+ '<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --zone my-zone --rule-id 2c0fc9fa937b11eaa1b71c4d701ab86e --force',
15
+ ];
16
+ static flags = {
17
+ ...EcdnZoneCommand.baseFlags,
18
+ 'rule-id': Flags.string({
19
+ description: t('flags.ruleId.description', 'Custom firewall rule ID to delete'),
20
+ required: true,
21
+ }),
22
+ force: Flags.boolean({
23
+ char: 'f',
24
+ description: t('flags.force.description', 'Skip confirmation prompt'),
25
+ default: false,
26
+ }),
27
+ };
28
+ async run() {
29
+ // Routes through the same destructive-action guard the rest of the CLI
30
+ // uses (sandbox reset, code delete, etc.). Surfaces a confirm prompt or
31
+ // honors the safety policy before any HTTP call.
32
+ this.assertDestructiveOperationAllowed('delete custom firewall rule');
33
+ this.requireOAuthCredentials();
34
+ const zoneId = await this.resolveZoneId();
35
+ const ruleId = this.flags['rule-id'];
36
+ if (!this.flags.force && !this.jsonEnabled()) {
37
+ this.warn(t('commands.ecdn.firewall.delete.warning', 'Deleting a custom firewall rule may impact traffic behavior. Use --force to confirm.'));
38
+ return { deleted: false, ruleId };
39
+ }
40
+ if (!this.jsonEnabled()) {
41
+ this.log(t('commands.ecdn.firewall.delete.deleting', 'Deleting custom firewall rule {{id}}...', { id: ruleId }));
42
+ }
43
+ const client = this.getCdnZonesRwClient();
44
+ const organizationId = this.getOrganizationId();
45
+ const { error } = await client.DELETE('/organizations/{organizationId}/zones/{zoneId}/firewall-custom/rules/{ruleId}', {
46
+ params: {
47
+ path: { organizationId, zoneId, ruleId },
48
+ },
49
+ });
50
+ if (error) {
51
+ this.error(t('commands.ecdn.firewall.delete.error', 'Failed to delete custom firewall rule: {{message}}', {
52
+ message: formatApiError(error),
53
+ }));
54
+ }
55
+ const output = { deleted: true, ruleId };
56
+ if (this.jsonEnabled()) {
57
+ return output;
58
+ }
59
+ this.log('');
60
+ this.log(t('commands.ecdn.firewall.delete.success', 'Custom firewall rule deleted successfully.'));
61
+ return output;
62
+ }
63
+ }
64
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/commands/ecdn/firewall/delete.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAClC,OAAO,EAAC,eAAe,EAAE,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAC,CAAC,EAAE,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AAOnD,MAAM,CAAC,OAAO,OAAO,kBAAmB,SA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C,CAAC,wCAAwC,EAAE,yCAAyC,EAAE,EAAC,EAAE,EAAE,MAAM,EAAC,CAAC,CAAC,CAAC;QACjH,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC1C,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAEhD,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,MAAM,CAAC,MAAM,CACjC,+EAA+E,EAC/E;YACE,MAAM,EAAE;gBACN,IAAI,EAAE,EAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAC;aACvC;SACF,CACF,CAAC;QAEF,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,KAAK,CACR,CAAC,CAAC,qCAAqC,EAAE,oDAAoD,EAAE;gBAC7F,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC;aAC/B,CAAC,CACH,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAiB,EAAC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC;QAErD,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACvB,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACb,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,uCAAuC,EAAE,4CAA4C,CAAC,CAAC,CAAC;QAEnG,OAAO,MAAM,CAAC;IAChB,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { CdnZonesComponents } from '@salesforce/b2c-tooling-sdk/clients';
2
+ import { EcdnZoneCommand } from '../../../utils/ecdn/index.js';
3
+ type CustomRule = CdnZonesComponents['schemas']['CustomRule'];
4
+ interface GetOutput {
5
+ rule: CustomRule;
6
+ }
7
+ export default class EcdnFirewallGet extends EcdnZoneCommand<typeof EcdnFirewallGet> {
8
+ static description: string;
9
+ static enableJsonFlag: boolean;
10
+ static examples: string[];
11
+ static flags: {
12
+ 'rule-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ zone: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'client-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
+ 'client-secret': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
16
+ 'auth-scope': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ 'short-code': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ 'tenant-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ 'auth-methods': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ 'user-auth': import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
+ 'account-manager-host': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
22
+ 'jwt-cert': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ 'jwt-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
+ 'jwt-passphrase': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
25
+ 'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
26
+ debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
27
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
28
+ jsonl: import("@oclif/core/interfaces").BooleanFlag<boolean>;
29
+ lang: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
30
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
31
+ instance: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
32
+ 'project-directory': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
33
+ 'extra-query': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
34
+ 'extra-body': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
35
+ 'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
36
+ };
37
+ run(): Promise<GetOutput>;
38
+ }
39
+ export {};
@@ -0,0 +1,66 @@
1
+ /*
2
+ * Copyright (c) 2025, Salesforce, Inc.
3
+ * SPDX-License-Identifier: Apache-2
4
+ * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ import { Flags } from '@oclif/core';
7
+ import cliui from 'cliui';
8
+ import { EcdnZoneCommand, formatApiError } from '../../../utils/ecdn/index.js';
9
+ import { t, withDocs } from '../../../i18n/index.js';
10
+ export default class EcdnFirewallGet extends EcdnZoneCommand {
11
+ static description = withDocs(t('commands.ecdn.firewall.get.description', 'Get a custom firewall rule for a zone'), '/cli/ecdn.html#b2c-ecdn-firewall-get');
12
+ static enableJsonFlag = true;
13
+ static examples = [
14
+ '<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --zone my-zone --rule-id 2c0fc9fa937b11eaa1b71c4d701ab86e',
15
+ '<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --zone my-zone --rule-id 2c0fc9fa937b11eaa1b71c4d701ab86e --json',
16
+ ];
17
+ static flags = {
18
+ ...EcdnZoneCommand.baseFlags,
19
+ 'rule-id': Flags.string({
20
+ description: t('flags.ruleId.description', 'Custom firewall rule ID'),
21
+ required: true,
22
+ }),
23
+ };
24
+ async run() {
25
+ this.requireOAuthCredentials();
26
+ const zoneId = await this.resolveZoneId();
27
+ const ruleId = this.flags['rule-id'];
28
+ if (!this.jsonEnabled()) {
29
+ this.log(t('commands.ecdn.firewall.get.fetching', 'Fetching custom firewall rule {{id}}...', { id: ruleId }));
30
+ }
31
+ const client = this.getCdnZonesClient();
32
+ const organizationId = this.getOrganizationId();
33
+ const { data, error } = await client.GET('/organizations/{organizationId}/zones/{zoneId}/firewall-custom/rules/{ruleId}', {
34
+ params: {
35
+ path: { organizationId, zoneId, ruleId },
36
+ },
37
+ });
38
+ if (error) {
39
+ this.error(t('commands.ecdn.firewall.get.error', 'Failed to fetch custom firewall rule: {{message}}', {
40
+ message: formatApiError(error),
41
+ }));
42
+ }
43
+ const rule = data?.data;
44
+ if (!rule) {
45
+ this.error(t('commands.ecdn.firewall.get.noData', 'No custom firewall rule data returned from API'));
46
+ }
47
+ const output = { rule };
48
+ if (this.jsonEnabled()) {
49
+ return output;
50
+ }
51
+ const ui = cliui({ width: process.stdout.columns || 80 });
52
+ const labelWidth = 18;
53
+ ui.div('');
54
+ ui.div({ text: t('commands.ecdn.firewall.get.success', 'Custom firewall rule details:') });
55
+ ui.div('');
56
+ ui.div({ text: 'Rule ID:', width: labelWidth }, { text: rule.ruleId });
57
+ ui.div({ text: 'Description:', width: labelWidth }, { text: rule.description });
58
+ ui.div({ text: 'Expression:', width: labelWidth }, { text: rule.expression });
59
+ ui.div({ text: 'Actions:', width: labelWidth }, { text: rule.actions?.join(', ') ?? '-' });
60
+ ui.div({ text: 'Enabled:', width: labelWidth }, { text: rule.enabled ? 'yes' : 'no' });
61
+ ui.div({ text: 'Last Updated:', width: labelWidth }, { text: rule.lastUpdated });
62
+ this.log(ui.toString());
63
+ return output;
64
+ }
65
+ }
66
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/commands/ecdn/firewall/get.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,KAAK,EAAC,MAAM,aAA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C,CAAC;QAC5E,EAAE,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAC,EAAE,EAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAC,CAAC,CAAC;QAC1E,EAAE,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAC,EAAE,EAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,EAAC,CAAC,CAAC;QACvF,EAAE,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAC,EAAE,EAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAC,CAAC,CAAC;QACnF,EAAE,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,UAAU,EAAC,EAAE,EAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAC,CAAC,CAAC;QAE7E,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAExB,OAAO,MAAM,CAAC;IAChB,CAAC"}
@@ -0,0 +1,43 @@
1
+ import type { CdnZonesComponents } from '@salesforce/b2c-tooling-sdk/clients';
2
+ import { EcdnZoneCommand } from '../../../utils/ecdn/index.js';
3
+ type CustomRule = CdnZonesComponents['schemas']['CustomRule'];
4
+ interface ListOutput {
5
+ rules: CustomRule[];
6
+ total: number;
7
+ }
8
+ export default class EcdnFirewallList extends EcdnZoneCommand<typeof EcdnFirewallList> {
9
+ static description: string;
10
+ static enableJsonFlag: boolean;
11
+ static examples: string[];
12
+ static flags: {
13
+ columns: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ extended: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
+ limit: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ offset: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ zone: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
18
+ 'client-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
19
+ 'client-secret': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
20
+ 'auth-scope': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
+ 'short-code': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
+ 'tenant-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ 'auth-methods': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
+ 'user-auth': import("@oclif/core/interfaces").BooleanFlag<boolean>;
25
+ 'account-manager-host': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
26
+ 'jwt-cert': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
27
+ 'jwt-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
28
+ 'jwt-passphrase': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
29
+ 'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
30
+ debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
31
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
32
+ jsonl: import("@oclif/core/interfaces").BooleanFlag<boolean>;
33
+ lang: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
34
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
35
+ instance: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
36
+ 'project-directory': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
37
+ 'extra-query': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
38
+ 'extra-body': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
39
+ 'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
40
+ };
41
+ run(): Promise<ListOutput>;
42
+ }
43
+ export {};
@@ -0,0 +1,103 @@
1
+ /*
2
+ * Copyright (c) 2025, Salesforce, Inc.
3
+ * SPDX-License-Identifier: Apache-2
4
+ * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ import { Flags } from '@oclif/core';
7
+ import { TableRenderer, columnFlagsFor, selectColumns } from '@salesforce/b2c-tooling-sdk/cli';
8
+ import { EcdnZoneCommand, formatApiError } from '../../../utils/ecdn/index.js';
9
+ import { t, withDocs } from '../../../i18n/index.js';
10
+ const COLUMNS = {
11
+ ruleId: {
12
+ header: 'Rule ID',
13
+ get: (r) => r.ruleId || '-',
14
+ },
15
+ description: {
16
+ header: 'Description',
17
+ get: (r) => r.description || '-',
18
+ },
19
+ actions: {
20
+ header: 'Actions',
21
+ get: (r) => r.actions?.join(', ') || '-',
22
+ },
23
+ enabled: {
24
+ header: 'Enabled',
25
+ get: (r) => (r.enabled ? 'yes' : 'no'),
26
+ },
27
+ expression: {
28
+ header: 'Expression',
29
+ get: (r) => r.expression || '-',
30
+ extended: true,
31
+ },
32
+ lastUpdated: {
33
+ header: 'Last Updated',
34
+ get: (r) => r.lastUpdated || '-',
35
+ extended: true,
36
+ },
37
+ };
38
+ const DEFAULT_COLUMNS = ['ruleId', 'description', 'actions', 'enabled'];
39
+ const tableRenderer = new TableRenderer(COLUMNS);
40
+ export default class EcdnFirewallList extends EcdnZoneCommand {
41
+ static description = withDocs(t('commands.ecdn.firewall.list.description', 'List custom firewall rules for a zone'), '/cli/ecdn.html#b2c-ecdn-firewall-list');
42
+ static enableJsonFlag = true;
43
+ static examples = [
44
+ '<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --zone my-zone',
45
+ '<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --zone my-zone --extended',
46
+ '<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --zone my-zone --limit 50',
47
+ '<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --zone my-zone --json',
48
+ ];
49
+ static flags = {
50
+ ...EcdnZoneCommand.baseFlags,
51
+ limit: Flags.integer({
52
+ description: t('flags.limit.description', 'Maximum records to retrieve per request, not to exceed 50'),
53
+ min: 1,
54
+ max: 50,
55
+ }),
56
+ offset: Flags.integer({
57
+ description: t('flags.offset.description', 'Result offset for pagination'),
58
+ min: 0,
59
+ }),
60
+ ...columnFlagsFor(COLUMNS),
61
+ };
62
+ async run() {
63
+ this.requireOAuthCredentials();
64
+ const zoneId = await this.resolveZoneId();
65
+ const limit = this.flags.limit;
66
+ const offset = this.flags.offset;
67
+ if (!this.jsonEnabled()) {
68
+ this.log(t('commands.ecdn.firewall.list.fetching', 'Fetching custom firewall rules...'));
69
+ }
70
+ const client = this.getCdnZonesClient();
71
+ const organizationId = this.getOrganizationId();
72
+ const query = {};
73
+ if (limit !== undefined)
74
+ query.limit = limit;
75
+ if (offset !== undefined)
76
+ query.offset = offset;
77
+ const { data, error } = await client.GET('/organizations/{organizationId}/zones/{zoneId}/firewall-custom/rules', {
78
+ params: {
79
+ path: { organizationId, zoneId },
80
+ query,
81
+ },
82
+ });
83
+ if (error) {
84
+ this.error(t('commands.ecdn.firewall.list.error', 'Failed to fetch custom firewall rules: {{message}}', {
85
+ message: formatApiError(error),
86
+ }));
87
+ }
88
+ const rules = data?.data ?? [];
89
+ const output = { rules, total: rules.length };
90
+ if (this.jsonEnabled()) {
91
+ return output;
92
+ }
93
+ if (rules.length === 0) {
94
+ this.log(t('commands.ecdn.firewall.list.noRules', 'No custom firewall rules found.'));
95
+ return output;
96
+ }
97
+ this.log(t('commands.ecdn.firewall.list.count', 'Found {{count}} custom firewall rule(s):', { count: rules.length }));
98
+ this.log('');
99
+ tableRenderer.render(rules, selectColumns(this.flags, tableRenderer, DEFAULT_COLUMNS, this.warn.bind(this)));
100
+ return output;
101
+ }
102
+ }
103
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/ecdn/firewall/list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAClC,OAAO,EAAC,aAAa,EAAE,cAAc,EAAE,aAAa,EAAiB,MAAM,iCAAiC,CAAC;AAE7G,OAAO,EAAC,eAAe,EAAE,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAC,CAAC,EAAE,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AASnD,MAAM,OAAO,GAA0C;IACrD,MAAM,EAAE;QACN,MAAM,EAAE,SAAS;QACjB,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,GAAG;KAC5B;IACD,WAAW,EAAE;QACX,MAAM,EAAE,aAAa;QACrB,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,IAAI,GAAG;KACjC;IACD,OAAO,EAAE;QACP,MAAM,EAAE,SAAS;QACjB,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG;KACzC;IACD,OAAO,EAAE;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,MAAM,GAAe,EAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAC,CAAC;QAExD,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACvB,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,qCAAqC,EAAE,iCAAiC,CAAC,CAAC,CAAC;YACtF,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,mCAAmC,EAAE,0CAA0C,EAAE,EAAC,KAAK,EAAE,KAAK,CAAC,MAAM,EAAC,CAAC,CAAC,CAAC;QACpH,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAEb,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAE7G,OAAO,MAAM,CAAC;IAChB,CAAC"}
@@ -0,0 +1,49 @@
1
+ import type { CdnZonesComponents } from '@salesforce/b2c-tooling-sdk/clients';
2
+ import { EcdnZoneCommand } from '../../../utils/ecdn/index.js';
3
+ type CustomRule = CdnZonesComponents['schemas']['CustomRule'];
4
+ interface ReorderOutput {
5
+ rules: CustomRule[];
6
+ total: number;
7
+ }
8
+ export default class EcdnFirewallReorder extends EcdnZoneCommand<typeof EcdnFirewallReorder> {
9
+ static description: string;
10
+ static enableJsonFlag: boolean;
11
+ static examples: string[];
12
+ static flags: {
13
+ 'rule-ids': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'rule-ids-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ zone: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
17
+ 'client-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
18
+ 'client-secret': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
19
+ 'auth-scope': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ 'short-code': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
+ 'tenant-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
+ 'auth-methods': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ 'user-auth': import("@oclif/core/interfaces").BooleanFlag<boolean>;
24
+ 'account-manager-host': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
25
+ 'jwt-cert': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
26
+ 'jwt-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
27
+ 'jwt-passphrase': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
28
+ 'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
29
+ debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
30
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
31
+ jsonl: import("@oclif/core/interfaces").BooleanFlag<boolean>;
32
+ lang: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
33
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
34
+ instance: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
35
+ 'project-directory': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
36
+ 'extra-query': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
37
+ 'extra-body': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
38
+ 'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
39
+ };
40
+ run(): Promise<ReorderOutput>;
41
+ /**
42
+ * Resolve the desired ordering from either --rule-ids (csv) or
43
+ * --rule-ids-file (path to a JSON array). Centralizing this here keeps run()
44
+ * focused on the API call and makes the inputs easy to validate uniformly.
45
+ */
46
+ private parseRuleIds;
47
+ private readRuleIdsFile;
48
+ }
49
+ export {};