@salesforce/b2c-cli 1.12.1 → 1.14.1
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/commands/ecdn/firewall/create.d.ts +44 -0
- package/dist/commands/ecdn/firewall/create.js +111 -0
- package/dist/commands/ecdn/firewall/create.js.map +1 -0
- package/dist/commands/ecdn/firewall/delete.d.ts +39 -0
- package/dist/commands/ecdn/firewall/delete.js +64 -0
- package/dist/commands/ecdn/firewall/delete.js.map +1 -0
- package/dist/commands/ecdn/firewall/get.d.ts +39 -0
- package/dist/commands/ecdn/firewall/get.js +66 -0
- package/dist/commands/ecdn/firewall/get.js.map +1 -0
- package/dist/commands/ecdn/firewall/list.d.ts +43 -0
- package/dist/commands/ecdn/firewall/list.js +103 -0
- package/dist/commands/ecdn/firewall/list.js.map +1 -0
- package/dist/commands/ecdn/firewall/reorder.d.ts +49 -0
- package/dist/commands/ecdn/firewall/reorder.js +135 -0
- package/dist/commands/ecdn/firewall/reorder.js.map +1 -0
- package/dist/commands/ecdn/firewall/update.d.ts +43 -0
- package/dist/commands/ecdn/firewall/update.js +106 -0
- package/dist/commands/ecdn/firewall/update.js.map +1 -0
- package/dist/commands/ecdn/rate-limit/create.d.ts +49 -0
- package/dist/commands/ecdn/rate-limit/create.js +158 -0
- package/dist/commands/ecdn/rate-limit/create.js.map +1 -0
- package/dist/commands/ecdn/rate-limit/delete.d.ts +39 -0
- package/dist/commands/ecdn/rate-limit/delete.js +61 -0
- package/dist/commands/ecdn/rate-limit/delete.js.map +1 -0
- package/dist/commands/ecdn/rate-limit/get.d.ts +39 -0
- package/dist/commands/ecdn/rate-limit/get.js +73 -0
- package/dist/commands/ecdn/rate-limit/get.js.map +1 -0
- package/dist/commands/ecdn/rate-limit/list.d.ts +41 -0
- package/dist/commands/ecdn/rate-limit/list.js +108 -0
- package/dist/commands/ecdn/rate-limit/list.js.map +1 -0
- package/dist/commands/ecdn/rate-limit/update.d.ts +50 -0
- package/dist/commands/ecdn/rate-limit/update.js +186 -0
- package/dist/commands/ecdn/rate-limit/update.js.map +1 -0
- package/dist/commands/job/import.d.ts +21 -2
- package/dist/commands/job/import.js +183 -45
- package/dist/commands/job/import.js.map +1 -1
- package/dist/commands/mrt/bundle/deploy.d.ts +2 -2
- package/dist/commands/mrt/bundle/deploy.js +2 -4
- package/dist/commands/mrt/bundle/deploy.js.map +1 -1
- package/dist/commands/mrt/bundle/save.d.ts +37 -0
- package/dist/commands/mrt/bundle/save.js +116 -0
- package/dist/commands/mrt/bundle/save.js.map +1 -0
- package/dist/hooks/sfnext-jit-install.d.ts +15 -0
- package/dist/hooks/sfnext-jit-install.js +23 -0
- package/dist/hooks/sfnext-jit-install.js.map +1 -0
- package/dist/hooks/sfnext-local-override.d.ts +3 -0
- package/dist/hooks/sfnext-local-override.js +65 -0
- package/dist/hooks/sfnext-local-override.js.map +1 -0
- package/dist/utils/logs/filter.d.ts +1 -40
- package/dist/utils/logs/filter.js +1 -106
- package/dist/utils/logs/filter.js.map +1 -1
- package/oclif.manifest.json +4662 -1036
- package/package.json +17 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/commands/ecdn/rate-limit/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,mBAAoB,SAAQ,eAA2C;IAC1F,MAAM,CAAC,WAAW,GAAG,QAAQ,CAC3B,CAAC,CAAC,6CAA6C,EAAE,wCAAwC,CAAC,EAC1F,2CAA2C,CAC5C,CAAC;IAEF,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAC,QAAQ,GAAG;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AG,MAAM,MAAM,CAAC,MAAM,CAAC,6EAA6E,EAAE;YACjH,MAAM,EAAE;gBACN,IAAI,EAAE,EAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAC;aACvC;SACF,CAAC,CAAC;QAEH,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,KAAK,CACR,CAAC,CAAC,uCAAuC,EAAE,kDAAkD,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,yCAAyC,EAAE,0CAA0C,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 RateLimitingRule = CdnZonesComponents['schemas']['RateLimitingRule'];
|
|
4
|
+
interface GetOutput {
|
|
5
|
+
rule: RateLimitingRule;
|
|
6
|
+
}
|
|
7
|
+
export default class EcdnRateLimitGet extends EcdnZoneCommand<typeof EcdnRateLimitGet> {
|
|
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,73 @@
|
|
|
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 EcdnRateLimitGet extends EcdnZoneCommand {
|
|
11
|
+
static description = withDocs(t('commands.ecdn.rate-limit.get.description', 'Get a rate limiting rule for a zone'), '/cli/ecdn.html#b2c-ecdn-rate-limit-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', 'Rate limiting 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.rate-limit.get.fetching', 'Fetching rate limiting 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}/rate-limiting/rules/{ruleId}', {
|
|
34
|
+
params: {
|
|
35
|
+
path: { organizationId, zoneId, ruleId },
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
if (error) {
|
|
39
|
+
this.error(t('commands.ecdn.rate-limit.get.error', 'Failed to fetch rate limiting rule: {{message}}', {
|
|
40
|
+
message: formatApiError(error),
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
const rule = data?.data;
|
|
44
|
+
if (!rule) {
|
|
45
|
+
this.error(t('commands.ecdn.rate-limit.get.noData', 'No rate limiting 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 = 22;
|
|
53
|
+
ui.div('');
|
|
54
|
+
ui.div({ text: t('commands.ecdn.rate-limit.get.success', 'Rate limiting 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: 'Action:', width: labelWidth }, { text: rule.action });
|
|
60
|
+
ui.div({ text: 'Period (seconds):', width: labelWidth }, { text: String(rule.period) });
|
|
61
|
+
ui.div({ text: 'Requests Per Period:', width: labelWidth }, { text: String(rule.requestsPerPeriod) });
|
|
62
|
+
ui.div({ text: 'Mitigation Timeout:', width: labelWidth }, { text: String(rule.mitigationTimeout) });
|
|
63
|
+
ui.div({ text: 'Enabled:', width: labelWidth }, { text: rule.enabled ? 'yes' : 'no' });
|
|
64
|
+
ui.div({ text: 'Characteristics:', width: labelWidth }, { text: rule.characteristics.join(', ') });
|
|
65
|
+
if (rule.countingExpression) {
|
|
66
|
+
ui.div({ text: 'Counting Expression:', width: labelWidth }, { text: rule.countingExpression });
|
|
67
|
+
}
|
|
68
|
+
ui.div({ text: 'Last Updated:', width: labelWidth }, { text: rule.lastUpdated });
|
|
69
|
+
this.log(ui.toString());
|
|
70
|
+
return output;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/commands/ecdn/rate-limit/get.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,eAAe,EAAE,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAC,CAAC,EAAE,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AAQnD,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,eAAwC;IACpF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAC3B,CAAC,CAAC,0CAA0C,EAAE,qCAAqC,CAAC,EACpF,wCAAwC,CACz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C,QAAQ,EAAE,CAAC,CAAC;QAExB,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { CdnZonesComponents } from '@salesforce/b2c-tooling-sdk/clients';
|
|
2
|
+
import { EcdnZoneCommand } from '../../../utils/ecdn/index.js';
|
|
3
|
+
type RateLimitingRule = CdnZonesComponents['schemas']['RateLimitingRule'];
|
|
4
|
+
interface ListOutput {
|
|
5
|
+
rules: RateLimitingRule[];
|
|
6
|
+
total: number;
|
|
7
|
+
}
|
|
8
|
+
export default class EcdnRateLimitList extends EcdnZoneCommand<typeof EcdnRateLimitList> {
|
|
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
|
+
zone: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
'client-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
'client-secret': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
'auth-scope': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
'short-code': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
'tenant-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
'auth-methods': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
'user-auth': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
23
|
+
'account-manager-host': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
|
+
'jwt-cert': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
'jwt-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
|
+
'jwt-passphrase': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
|
+
'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
28
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
29
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
30
|
+
jsonl: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
31
|
+
lang: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
32
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
33
|
+
instance: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
34
|
+
'project-directory': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
35
|
+
'extra-query': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
36
|
+
'extra-body': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
37
|
+
'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
38
|
+
};
|
|
39
|
+
run(): Promise<ListOutput>;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
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 { TableRenderer, columnFlagsFor, selectColumns } from '@salesforce/b2c-tooling-sdk/cli';
|
|
7
|
+
import { EcdnZoneCommand, formatApiError } from '../../../utils/ecdn/index.js';
|
|
8
|
+
import { t, withDocs } from '../../../i18n/index.js';
|
|
9
|
+
const COLUMNS = {
|
|
10
|
+
ruleId: {
|
|
11
|
+
header: 'Rule ID',
|
|
12
|
+
get: (r) => r.ruleId || '-',
|
|
13
|
+
extended: true,
|
|
14
|
+
},
|
|
15
|
+
description: {
|
|
16
|
+
header: 'Description',
|
|
17
|
+
get: (r) => r.description || '-',
|
|
18
|
+
},
|
|
19
|
+
action: {
|
|
20
|
+
header: 'Action',
|
|
21
|
+
get: (r) => r.action || '-',
|
|
22
|
+
},
|
|
23
|
+
period: {
|
|
24
|
+
header: 'Period',
|
|
25
|
+
get: (r) => String(r.period),
|
|
26
|
+
},
|
|
27
|
+
requestsPerPeriod: {
|
|
28
|
+
header: 'Requests',
|
|
29
|
+
get: (r) => String(r.requestsPerPeriod),
|
|
30
|
+
},
|
|
31
|
+
enabled: {
|
|
32
|
+
header: 'Enabled',
|
|
33
|
+
get: (r) => (r.enabled ? 'yes' : 'no'),
|
|
34
|
+
},
|
|
35
|
+
mitigationTimeout: {
|
|
36
|
+
header: 'Mitigation Timeout',
|
|
37
|
+
get: (r) => String(r.mitigationTimeout),
|
|
38
|
+
extended: true,
|
|
39
|
+
},
|
|
40
|
+
characteristics: {
|
|
41
|
+
header: 'Characteristics',
|
|
42
|
+
get: (r) => r.characteristics?.join(', ') || '-',
|
|
43
|
+
extended: true,
|
|
44
|
+
},
|
|
45
|
+
countingExpression: {
|
|
46
|
+
header: 'Counting Expression',
|
|
47
|
+
get: (r) => r.countingExpression || '-',
|
|
48
|
+
extended: true,
|
|
49
|
+
},
|
|
50
|
+
lastUpdated: {
|
|
51
|
+
header: 'Last Updated',
|
|
52
|
+
get: (r) => r.lastUpdated || '-',
|
|
53
|
+
extended: true,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
const DEFAULT_COLUMNS = ['description', 'action', 'period', 'requestsPerPeriod', 'enabled'];
|
|
57
|
+
const tableRenderer = new TableRenderer(COLUMNS);
|
|
58
|
+
export default class EcdnRateLimitList extends EcdnZoneCommand {
|
|
59
|
+
static description = withDocs(t('commands.ecdn.rate-limit.list.description', 'List rate limiting rules for a zone'), '/cli/ecdn.html#b2c-ecdn-rate-limit-list');
|
|
60
|
+
static enableJsonFlag = true;
|
|
61
|
+
static examples = [
|
|
62
|
+
'<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --zone my-zone',
|
|
63
|
+
'<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --zone my-zone --extended',
|
|
64
|
+
'<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --zone my-zone --json',
|
|
65
|
+
];
|
|
66
|
+
static flags = {
|
|
67
|
+
...EcdnZoneCommand.baseFlags,
|
|
68
|
+
...columnFlagsFor(COLUMNS),
|
|
69
|
+
};
|
|
70
|
+
async run() {
|
|
71
|
+
this.requireOAuthCredentials();
|
|
72
|
+
const zoneId = await this.resolveZoneId();
|
|
73
|
+
if (!this.jsonEnabled()) {
|
|
74
|
+
this.log(t('commands.ecdn.rate-limit.list.fetching', 'Fetching rate limiting rules...'));
|
|
75
|
+
}
|
|
76
|
+
const client = this.getCdnZonesClient();
|
|
77
|
+
const organizationId = this.getOrganizationId();
|
|
78
|
+
const { data, error } = await client.GET('/organizations/{organizationId}/zones/{zoneId}/rate-limiting/rules', {
|
|
79
|
+
params: {
|
|
80
|
+
path: { organizationId, zoneId },
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
if (error) {
|
|
84
|
+
this.error(t('commands.ecdn.rate-limit.list.error', 'Failed to fetch rate limiting rules: {{message}}', {
|
|
85
|
+
message: formatApiError(error),
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
const rules = data?.data ?? [];
|
|
89
|
+
const output = {
|
|
90
|
+
rules,
|
|
91
|
+
total: rules.length,
|
|
92
|
+
};
|
|
93
|
+
if (this.jsonEnabled()) {
|
|
94
|
+
return output;
|
|
95
|
+
}
|
|
96
|
+
if (rules.length === 0) {
|
|
97
|
+
this.log(t('commands.ecdn.rate-limit.list.noRules', 'No rate limiting rules found.'));
|
|
98
|
+
return output;
|
|
99
|
+
}
|
|
100
|
+
this.log(t('commands.ecdn.rate-limit.list.count', 'Found {{count}} rate limiting rule(s):', {
|
|
101
|
+
count: rules.length,
|
|
102
|
+
}));
|
|
103
|
+
this.log('');
|
|
104
|
+
tableRenderer.render(rules, selectColumns(this.flags, tableRenderer, DEFAULT_COLUMNS, this.warn.bind(this)));
|
|
105
|
+
return output;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/ecdn/rate-limit/list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,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,GAAgD;IAC3D,MAAM,EAAE;QACN,MAAM,EAAE,SAAS;QACjB,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,GAAG;QAC3B,QAAQ,EAAE,IAAI;KACf;IACD,WAAW,EAAE;QACX,MAAM,EAAE,aAAa;QACrB,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,C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C,qCAAqC,EAAE,kDAAkD,EAAE;gBAC3F,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC;aAC/B,CAAC,CACH,CAAC;QACJ,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,MAAM,GAAe;YACzB,KAAK;YACL,KAAK,EAAE,KAAK,CAAC,MAAM;SACpB,CAAC;QAEF,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,uCAAuC,EAAE,+BAA+B,CAAC,CAAC,CAAC;YACtF,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IAAI,CAAC,GAAG,CACN,CAAC,CAAC,qCAAqC,EAAE,wCAAwC,EAAE;YACjF,KAAK,EAAE,KAAK,CAAC,MAAM;SACpB,CAAC,CACH,CAAC;QACF,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,50 @@
|
|
|
1
|
+
import type { CdnZonesComponents } from '@salesforce/b2c-tooling-sdk/clients';
|
|
2
|
+
import { EcdnZoneCommand } from '../../../utils/ecdn/index.js';
|
|
3
|
+
type RateLimitingRule = CdnZonesComponents['schemas']['RateLimitingRule'];
|
|
4
|
+
interface UpdateOutput {
|
|
5
|
+
rule: RateLimitingRule;
|
|
6
|
+
}
|
|
7
|
+
export default class EcdnRateLimitUpdate extends EcdnZoneCommand<typeof EcdnRateLimitUpdate> {
|
|
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
|
+
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
expression: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
characteristics: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
action: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
period: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
'requests-per-period': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
'mitigation-timeout': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
'counting-expression': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
enabled: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
22
|
+
'position-before': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
'position-after': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
|
+
zone: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
'client-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
|
+
'client-secret': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
|
+
'auth-scope': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
28
|
+
'short-code': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
29
|
+
'tenant-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
30
|
+
'auth-methods': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
31
|
+
'user-auth': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
32
|
+
'account-manager-host': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
33
|
+
'jwt-cert': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
34
|
+
'jwt-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
35
|
+
'jwt-passphrase': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
36
|
+
'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
37
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
38
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
39
|
+
jsonl: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
40
|
+
lang: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
41
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
42
|
+
instance: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
43
|
+
'project-directory': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
44
|
+
'extra-query': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
45
|
+
'extra-body': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
46
|
+
'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
47
|
+
};
|
|
48
|
+
run(): Promise<UpdateOutput>;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,186 @@
|
|
|
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
|
+
const VALID_PERIODS = [10, 60, 120, 300, 600];
|
|
11
|
+
const VALID_MITIGATION_TIMEOUTS = [0, 60, 120, 300, 600, 3600, 86_400];
|
|
12
|
+
export default class EcdnRateLimitUpdate extends EcdnZoneCommand {
|
|
13
|
+
static description = withDocs(t('commands.ecdn.rate-limit.update.description', 'Update a rate limiting rule for a zone'), '/cli/ecdn.html#b2c-ecdn-rate-limit-update');
|
|
14
|
+
static enableJsonFlag = true;
|
|
15
|
+
static examples = [
|
|
16
|
+
'<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --zone my-zone --rule-id 2c0fc9fa937b11eaa1b71c4d701ab86e --requests-per-period 100 --mitigation-timeout 120',
|
|
17
|
+
'<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --zone my-zone --rule-id 2c0fc9fa937b11eaa1b71c4d701ab86e --action managed_challenge --enabled false',
|
|
18
|
+
];
|
|
19
|
+
static flags = {
|
|
20
|
+
...EcdnZoneCommand.baseFlags,
|
|
21
|
+
'rule-id': Flags.string({
|
|
22
|
+
description: t('flags.ruleId.description', 'Rate limiting rule ID'),
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
description: Flags.string({
|
|
26
|
+
description: t('flags.description.description', 'Rule description'),
|
|
27
|
+
}),
|
|
28
|
+
expression: Flags.string({
|
|
29
|
+
description: t('flags.expression.description', 'Expression for when to evaluate this rule'),
|
|
30
|
+
}),
|
|
31
|
+
characteristics: Flags.string({
|
|
32
|
+
description: t('flags.characteristics.description', 'Comma-separated characteristics used to group requests'),
|
|
33
|
+
}),
|
|
34
|
+
action: Flags.string({
|
|
35
|
+
description: t('flags.action.description', 'Action applied when the rule threshold is exceeded'),
|
|
36
|
+
options: ['block', 'managed_challenge', 'js_challenge', 'legacy_captcha', 'log'],
|
|
37
|
+
}),
|
|
38
|
+
period: Flags.integer({
|
|
39
|
+
description: t('flags.period.description', 'Rate limit evaluation period in seconds'),
|
|
40
|
+
}),
|
|
41
|
+
'requests-per-period': Flags.integer({
|
|
42
|
+
description: t('flags.requestsPerPeriod.description', 'Maximum requests allowed within the period'),
|
|
43
|
+
}),
|
|
44
|
+
'mitigation-timeout': Flags.integer({
|
|
45
|
+
description: t('flags.mitigationTimeout.description', 'Duration in seconds to apply action after threshold is reached'),
|
|
46
|
+
}),
|
|
47
|
+
'counting-expression': Flags.string({
|
|
48
|
+
description: t('flags.countingExpression.description', 'Optional expression for what requests to count'),
|
|
49
|
+
}),
|
|
50
|
+
enabled: Flags.boolean({
|
|
51
|
+
description: t('flags.enabled.description', 'Whether the rule is enabled'),
|
|
52
|
+
allowNo: true,
|
|
53
|
+
}),
|
|
54
|
+
'position-before': Flags.string({
|
|
55
|
+
description: t('flags.positionBefore.description', 'Move this rule before the specified rule ID'),
|
|
56
|
+
exclusive: ['position-after'],
|
|
57
|
+
}),
|
|
58
|
+
'position-after': Flags.string({
|
|
59
|
+
description: t('flags.positionAfter.description', 'Move this rule after the specified rule ID'),
|
|
60
|
+
exclusive: ['position-before'],
|
|
61
|
+
}),
|
|
62
|
+
};
|
|
63
|
+
async run() {
|
|
64
|
+
this.requireOAuthCredentials();
|
|
65
|
+
const zoneId = await this.resolveZoneId();
|
|
66
|
+
const ruleId = this.flags['rule-id'];
|
|
67
|
+
const description = this.flags.description;
|
|
68
|
+
const expression = this.flags.expression;
|
|
69
|
+
const characteristicsRaw = this.flags.characteristics;
|
|
70
|
+
const action = this.flags.action;
|
|
71
|
+
const period = this.flags.period;
|
|
72
|
+
const requestsPerPeriod = this.flags['requests-per-period'];
|
|
73
|
+
const mitigationTimeout = this.flags['mitigation-timeout'];
|
|
74
|
+
const countingExpression = this.flags['counting-expression'];
|
|
75
|
+
const enabled = this.flags.enabled;
|
|
76
|
+
const positionBefore = this.flags['position-before'];
|
|
77
|
+
const positionAfter = this.flags['position-after'];
|
|
78
|
+
const hasUpdates = [
|
|
79
|
+
description,
|
|
80
|
+
expression,
|
|
81
|
+
characteristicsRaw,
|
|
82
|
+
action,
|
|
83
|
+
period,
|
|
84
|
+
requestsPerPeriod,
|
|
85
|
+
mitigationTimeout,
|
|
86
|
+
countingExpression,
|
|
87
|
+
enabled,
|
|
88
|
+
positionBefore,
|
|
89
|
+
positionAfter,
|
|
90
|
+
].some((value) => value !== undefined);
|
|
91
|
+
if (!hasUpdates) {
|
|
92
|
+
this.error(t('commands.ecdn.rate-limit.update.noChanges', 'Provide at least one field to update.'));
|
|
93
|
+
}
|
|
94
|
+
if (!this.jsonEnabled()) {
|
|
95
|
+
this.log(t('commands.ecdn.rate-limit.update.updating', 'Updating rate limiting rule {{id}}...', { id: ruleId }));
|
|
96
|
+
}
|
|
97
|
+
if (period !== undefined && !VALID_PERIODS.includes(period)) {
|
|
98
|
+
this.error(t('commands.ecdn.rate-limit.update.invalidPeriod', 'Invalid period: {{period}}. Valid values: {{valid}}.', {
|
|
99
|
+
period: String(period),
|
|
100
|
+
valid: VALID_PERIODS.join(', '),
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
if (mitigationTimeout !== undefined && !VALID_MITIGATION_TIMEOUTS.includes(mitigationTimeout)) {
|
|
104
|
+
this.error(t('commands.ecdn.rate-limit.update.invalidMitigationTimeout', 'Invalid mitigation timeout: {{timeout}}. Valid values: {{valid}}.', {
|
|
105
|
+
timeout: String(mitigationTimeout),
|
|
106
|
+
valid: VALID_MITIGATION_TIMEOUTS.join(', '),
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
const body = {};
|
|
110
|
+
if (description !== undefined) {
|
|
111
|
+
body.description = description;
|
|
112
|
+
}
|
|
113
|
+
if (expression !== undefined) {
|
|
114
|
+
body.expression = expression;
|
|
115
|
+
}
|
|
116
|
+
if (characteristicsRaw !== undefined) {
|
|
117
|
+
const characteristics = characteristicsRaw
|
|
118
|
+
.split(',')
|
|
119
|
+
.map((value) => value.trim())
|
|
120
|
+
.filter(Boolean);
|
|
121
|
+
if (characteristics.length === 0) {
|
|
122
|
+
this.error(t('commands.ecdn.rate-limit.update.characteristicsRequired', 'At least one characteristic must be provided.'));
|
|
123
|
+
}
|
|
124
|
+
body.characteristics = characteristics;
|
|
125
|
+
}
|
|
126
|
+
if (action !== undefined) {
|
|
127
|
+
body.action = action;
|
|
128
|
+
}
|
|
129
|
+
if (period !== undefined) {
|
|
130
|
+
body.period = period;
|
|
131
|
+
}
|
|
132
|
+
if (requestsPerPeriod !== undefined) {
|
|
133
|
+
body.requestsPerPeriod = requestsPerPeriod;
|
|
134
|
+
}
|
|
135
|
+
if (mitigationTimeout !== undefined) {
|
|
136
|
+
body.mitigationTimeout = mitigationTimeout;
|
|
137
|
+
}
|
|
138
|
+
if (countingExpression !== undefined) {
|
|
139
|
+
body.countingExpression = countingExpression;
|
|
140
|
+
}
|
|
141
|
+
if (enabled !== undefined) {
|
|
142
|
+
body.enabled = enabled;
|
|
143
|
+
}
|
|
144
|
+
if (positionBefore) {
|
|
145
|
+
body.position = { before: positionBefore };
|
|
146
|
+
}
|
|
147
|
+
if (positionAfter) {
|
|
148
|
+
body.position = { after: positionAfter };
|
|
149
|
+
}
|
|
150
|
+
const client = this.getCdnZonesRwClient();
|
|
151
|
+
const organizationId = this.getOrganizationId();
|
|
152
|
+
const { data, error } = await client.PATCH('/organizations/{organizationId}/zones/{zoneId}/rate-limiting/rules/{ruleId}', {
|
|
153
|
+
params: {
|
|
154
|
+
path: { organizationId, zoneId, ruleId },
|
|
155
|
+
},
|
|
156
|
+
body,
|
|
157
|
+
});
|
|
158
|
+
if (error) {
|
|
159
|
+
this.error(t('commands.ecdn.rate-limit.update.error', 'Failed to update rate limiting rule: {{message}}', {
|
|
160
|
+
message: formatApiError(error),
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
const rule = data?.data;
|
|
164
|
+
if (!rule) {
|
|
165
|
+
this.error(t('commands.ecdn.rate-limit.update.noData', 'No rate limiting rule data returned from API'));
|
|
166
|
+
}
|
|
167
|
+
const output = { rule };
|
|
168
|
+
if (this.jsonEnabled()) {
|
|
169
|
+
return output;
|
|
170
|
+
}
|
|
171
|
+
const ui = cliui({ width: process.stdout.columns || 80 });
|
|
172
|
+
const labelWidth = 22;
|
|
173
|
+
ui.div('');
|
|
174
|
+
ui.div({ text: t('commands.ecdn.rate-limit.update.success', 'Rate limiting rule updated successfully!') });
|
|
175
|
+
ui.div('');
|
|
176
|
+
ui.div({ text: 'Rule ID:', width: labelWidth }, { text: rule.ruleId });
|
|
177
|
+
ui.div({ text: 'Description:', width: labelWidth }, { text: rule.description });
|
|
178
|
+
ui.div({ text: 'Action:', width: labelWidth }, { text: rule.action });
|
|
179
|
+
ui.div({ text: 'Period (seconds):', width: labelWidth }, { text: String(rule.period) });
|
|
180
|
+
ui.div({ text: 'Requests Per Period:', width: labelWidth }, { text: String(rule.requestsPerPeriod) });
|
|
181
|
+
ui.div({ text: 'Enabled:', width: labelWidth }, { text: rule.enabled ? 'yes' : 'no' });
|
|
182
|
+
this.log(ui.toString());
|
|
183
|
+
return output;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/commands/ecdn/rate-limit/update.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,eAAe,EAAE,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAC,CAAC,EAAE,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AAKnD,MAAM,aAAa,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAC9C,MAAM,yBAAyB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAMvE,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,eAA2C;IAC1F,MAAM,CAAC,WAAW,GAAG,QAAQ,CAC3B,CAAC,CAAC,6CAA6C,EAAE,wCAAwC,CAAC,EAC1F,2CAA2C,CAC5C,CAAC;IAEF,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAC,QAAQ,GAAG;QAChB,uKAAuK;QACvK,+JAA+J;KAChK,CAAC;IAEF,MAAM,CAAC,KAAK,GAAG;QACb,GAAG,eAAe,CAAC,SAAS;QAC5B,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC;YACtB,WAAW,EAAE,CAAC,CAAC,0BAA0B,EAAE,uBAAuB,CAAC;YACnE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC;YACxB,WAAW,EAAE,CAAC,CAAC,+BAA+B,EAAE,kBAAkB,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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,SAAS,EAAE,KAAK,EAAE,UAAU,EAAC,EAAE,EAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAC,CAAC,CAAC;QAClE,EAAE,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,UAAU,EAAC,EAAE,EAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAC,CAAC,CAAC;QACpF,EAAE,CAAC,GAAG,CAAC,EAAC,IAAI,EAAE,sBAAsB,EAAE,KAAK,EAAE,UAAU,EAAC,EAAE,EAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAC,CAAC,CAAC;QAClG,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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JobCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
2
|
-
import { siteArchiveImport, type SiteArchiveImportResult } from '@salesforce/b2c-tooling-sdk/operations/jobs';
|
|
2
|
+
import { siteArchiveImport, siteArchiveImportSplit, type SiteArchiveImportResult } from '@salesforce/b2c-tooling-sdk/operations/jobs';
|
|
3
3
|
export default class JobImport extends JobCommand<typeof JobImport> {
|
|
4
4
|
static args: {
|
|
5
5
|
target: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
@@ -11,6 +11,8 @@ export default class JobImport extends JobCommand<typeof JobImport> {
|
|
|
11
11
|
wait: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
12
|
'keep-archive': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
13
|
remote: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
split: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
'max-size': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
16
|
timeout: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
17
|
'poll-interval': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
18
|
'show-log': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
@@ -49,6 +51,23 @@ export default class JobImport extends JobCommand<typeof JobImport> {
|
|
|
49
51
|
static strict: boolean;
|
|
50
52
|
protected operations: {
|
|
51
53
|
siteArchiveImport: typeof siteArchiveImport;
|
|
54
|
+
siteArchiveImportSplit: typeof siteArchiveImportSplit;
|
|
52
55
|
};
|
|
53
|
-
run(): Promise<SiteArchiveImportResult>;
|
|
56
|
+
run(): Promise<SiteArchiveImportResult | SiteArchiveImportResult[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Runs a single-archive import, wiring an oversize callback that recommends
|
|
59
|
+
* `--split` when the assembled archive exceeds the size ceiling.
|
|
60
|
+
*/
|
|
61
|
+
private runSingleImport;
|
|
62
|
+
/**
|
|
63
|
+
* Runs a multi-part split import of a directory, logging the plan and each
|
|
64
|
+
* part's progress. A failing part throws JobExecutionError (handled by the
|
|
65
|
+
* caller's catch), so a normal return means all parts imported successfully.
|
|
66
|
+
*/
|
|
67
|
+
private runSplitImport;
|
|
68
|
+
/**
|
|
69
|
+
* Validates the flag combination and resolves the `--max-size` value to
|
|
70
|
+
* bytes. Calls `this.error` (which exits) on any invalid combination.
|
|
71
|
+
*/
|
|
72
|
+
private validateFlags;
|
|
54
73
|
}
|