@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,65 @@
|
|
|
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 { Plugin } from '@oclif/core';
|
|
7
|
+
import { existsSync } from 'node:fs';
|
|
8
|
+
import { dirname, join, parse } from 'node:path';
|
|
9
|
+
const SFNEXT_PLUGIN_NAME = '@salesforce/storefront-next-dev';
|
|
10
|
+
/**
|
|
11
|
+
* Walks up from `start` looking for `node_modules/<pkg>/package.json` and returns
|
|
12
|
+
* the absolute path to the package root if found, otherwise undefined.
|
|
13
|
+
*/
|
|
14
|
+
function findProjectLocalPackageRoot(start, pkg) {
|
|
15
|
+
const root = parse(start).root;
|
|
16
|
+
let dir = start;
|
|
17
|
+
while (true) {
|
|
18
|
+
const candidate = join(dir, 'node_modules', pkg);
|
|
19
|
+
if (existsSync(join(candidate, 'package.json'))) {
|
|
20
|
+
return candidate;
|
|
21
|
+
}
|
|
22
|
+
if (dir === root)
|
|
23
|
+
return undefined;
|
|
24
|
+
const parent = dirname(dir);
|
|
25
|
+
if (parent === dir)
|
|
26
|
+
return undefined;
|
|
27
|
+
dir = parent;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const hook = async function ({ config, id }) {
|
|
31
|
+
// Cheap guard: only do work for sfnext-namespaced commands. Topic separator is a
|
|
32
|
+
// space at runtime, but oclif normalises ids to colon-separated form.
|
|
33
|
+
if (!id || (id !== 'sfnext' && !id.startsWith('sfnext:')))
|
|
34
|
+
return;
|
|
35
|
+
try {
|
|
36
|
+
const localRoot = findProjectLocalPackageRoot(process.cwd(), SFNEXT_PLUGIN_NAME);
|
|
37
|
+
if (!localRoot)
|
|
38
|
+
return;
|
|
39
|
+
const existing = config.plugins.get(SFNEXT_PLUGIN_NAME);
|
|
40
|
+
if (existing && existing.root === localRoot)
|
|
41
|
+
return;
|
|
42
|
+
const plugin = new Plugin({
|
|
43
|
+
name: SFNEXT_PLUGIN_NAME,
|
|
44
|
+
root: localRoot,
|
|
45
|
+
type: 'link',
|
|
46
|
+
});
|
|
47
|
+
await plugin.load();
|
|
48
|
+
config.plugins.set(plugin.name, plugin);
|
|
49
|
+
// The Config interface in @oclif/core does not expose loadPluginsAndCommands,
|
|
50
|
+
// but the underlying class implementation does. We need to call it so the
|
|
51
|
+
// newly-registered plugin's commands and topics become discoverable on this
|
|
52
|
+
// already-initialized Config (init hooks fire after the initial command/topic
|
|
53
|
+
// discovery pass).
|
|
54
|
+
const reloadable = config;
|
|
55
|
+
if (typeof reloadable.loadPluginsAndCommands === 'function') {
|
|
56
|
+
await reloadable.loadPluginsAndCommands({ force: true });
|
|
57
|
+
}
|
|
58
|
+
this.debug(`loaded project-local ${SFNEXT_PLUGIN_NAME} from ${localRoot} (overriding any JIT copy)`);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
this.warn(`Failed to load project-local ${SFNEXT_PLUGIN_NAME}: ${error.message}`);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
export default hook;
|
|
65
|
+
//# sourceMappingURL=sfnext-local-override.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sfnext-local-override.js","sourceRoot":"","sources":["../../src/hooks/sfnext-local-override.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AACnC,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,WAAW,CAAC;AAE/C,MAAM,kBAAkB,GAAG,iCAAiC,CAAC;AAE7D;;;GAGG;AACH,SAAS,2BAA2B,CAAC,KAAa,EAAE,GAAW;IAC7D,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;IAC/B,IAAI,GAAG,GAAG,KAAK,CAAC;IAChB,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,GAAG,CAAC,CAAC;QACjD,IAAI,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;YAChD,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,SAAS,CAAC;QACnC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,GAAG;YAAE,OAAO,SAAS,CAAC;QACrC,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,IAAI,GAAiB,KAAK,WAAW,EAAC,MAAM,EAAE,EAAE,EAA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AC"}
|
|
@@ -1,40 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Parses a relative time string (e.g., "5m", "1h", "2d") into milliseconds.
|
|
4
|
-
* Returns null if the string is not a valid relative time format.
|
|
5
|
-
*/
|
|
6
|
-
export declare function parseRelativeTime(timeStr: string): null | number;
|
|
7
|
-
/**
|
|
8
|
-
* Parses a --since value into a Date object.
|
|
9
|
-
* Supports:
|
|
10
|
-
* - Relative times: "5m", "1h", "2d"
|
|
11
|
-
* - ISO 8601: "2026-01-25T10:00:00"
|
|
12
|
-
*/
|
|
13
|
-
export declare function parseSinceTime(sinceStr: string): Date;
|
|
14
|
-
/**
|
|
15
|
-
* Parses a B2C log timestamp into a Date object.
|
|
16
|
-
* Expected format: "2025-01-25 10:30:45.123 GMT"
|
|
17
|
-
*/
|
|
18
|
-
export declare function parseLogTimestamp(timestamp: string): Date | null;
|
|
19
|
-
/**
|
|
20
|
-
* Filters entries by timestamp.
|
|
21
|
-
*/
|
|
22
|
-
export declare function filterBySince(entries: LogEntry[], since: Date): LogEntry[];
|
|
23
|
-
/**
|
|
24
|
-
* Filters entries by log level.
|
|
25
|
-
*/
|
|
26
|
-
export declare function filterByLevel(entries: LogEntry[], levels: string[]): LogEntry[];
|
|
27
|
-
/**
|
|
28
|
-
* Filters entries by text search (case-insensitive substring match).
|
|
29
|
-
*/
|
|
30
|
-
export declare function filterBySearch(entries: LogEntry[], search: string): LogEntry[];
|
|
31
|
-
/**
|
|
32
|
-
* Checks if a single entry matches the specified log levels.
|
|
33
|
-
* Used for streaming/tail scenarios where we filter one entry at a time.
|
|
34
|
-
*/
|
|
35
|
-
export declare function matchesLevel(entry: LogEntry, levels: string[]): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Checks if a single entry matches the search text (case-insensitive).
|
|
38
|
-
* Used for streaming/tail scenarios where we filter one entry at a time.
|
|
39
|
-
*/
|
|
40
|
-
export declare function matchesSearch(entry: LogEntry, search: string): boolean;
|
|
1
|
+
export { filterByLevel, filterBySearch, filterBySince, matchesLevel, matchesSearch, parseLogTimestamp, parseRelativeTime, parseSinceTime, } from '@salesforce/b2c-tooling-sdk/operations/logs';
|
|
@@ -3,110 +3,5 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2
|
|
4
4
|
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
* Parses a relative time string (e.g., "5m", "1h", "2d") into milliseconds.
|
|
8
|
-
* Returns null if the string is not a valid relative time format.
|
|
9
|
-
*/
|
|
10
|
-
export function parseRelativeTime(timeStr) {
|
|
11
|
-
const match = timeStr.match(/^(\d+)([mhd])$/i);
|
|
12
|
-
if (!match) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
const value = Number.parseInt(match[1], 10);
|
|
16
|
-
const unit = match[2].toLowerCase();
|
|
17
|
-
switch (unit) {
|
|
18
|
-
case 'd': {
|
|
19
|
-
return value * 24 * 60 * 60 * 1000;
|
|
20
|
-
}
|
|
21
|
-
case 'h': {
|
|
22
|
-
return value * 60 * 60 * 1000;
|
|
23
|
-
}
|
|
24
|
-
case 'm': {
|
|
25
|
-
return value * 60 * 1000;
|
|
26
|
-
}
|
|
27
|
-
default: {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Parses a --since value into a Date object.
|
|
34
|
-
* Supports:
|
|
35
|
-
* - Relative times: "5m", "1h", "2d"
|
|
36
|
-
* - ISO 8601: "2026-01-25T10:00:00"
|
|
37
|
-
*/
|
|
38
|
-
export function parseSinceTime(sinceStr) {
|
|
39
|
-
// Try relative time first
|
|
40
|
-
const relativeMs = parseRelativeTime(sinceStr);
|
|
41
|
-
if (relativeMs !== null) {
|
|
42
|
-
return new Date(Date.now() - relativeMs);
|
|
43
|
-
}
|
|
44
|
-
// Try ISO 8601
|
|
45
|
-
const date = new Date(sinceStr);
|
|
46
|
-
if (Number.isNaN(date.getTime())) {
|
|
47
|
-
throw new TypeError(`Invalid --since value: "${sinceStr}". Use relative time (e.g., "5m", "1h", "2d") or ISO 8601 (e.g., "2026-01-25T10:00:00")`);
|
|
48
|
-
}
|
|
49
|
-
return date;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Parses a B2C log timestamp into a Date object.
|
|
53
|
-
* Expected format: "2025-01-25 10:30:45.123 GMT"
|
|
54
|
-
*/
|
|
55
|
-
export function parseLogTimestamp(timestamp) {
|
|
56
|
-
// B2C format: "2025-01-25 10:30:45.123 GMT"
|
|
57
|
-
// Convert to ISO format for parsing
|
|
58
|
-
const isoFormat = timestamp.replace(' GMT', 'Z').replace(' ', 'T');
|
|
59
|
-
const date = new Date(isoFormat);
|
|
60
|
-
return Number.isNaN(date.getTime()) ? null : date;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Filters entries by timestamp.
|
|
64
|
-
*/
|
|
65
|
-
export function filterBySince(entries, since) {
|
|
66
|
-
return entries.filter((entry) => {
|
|
67
|
-
if (!entry.timestamp)
|
|
68
|
-
return true; // Include entries without timestamps
|
|
69
|
-
const entryDate = parseLogTimestamp(entry.timestamp);
|
|
70
|
-
return entryDate === null || entryDate >= since;
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Filters entries by log level.
|
|
75
|
-
*/
|
|
76
|
-
export function filterByLevel(entries, levels) {
|
|
77
|
-
const upperLevels = new Set(levels.map((l) => l.toUpperCase()));
|
|
78
|
-
return entries.filter((entry) => {
|
|
79
|
-
// Include entries without level if no specific level filter
|
|
80
|
-
if (!entry.level)
|
|
81
|
-
return false;
|
|
82
|
-
return upperLevels.has(entry.level.toUpperCase());
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Filters entries by text search (case-insensitive substring match).
|
|
87
|
-
*/
|
|
88
|
-
export function filterBySearch(entries, search) {
|
|
89
|
-
const lowerSearch = search.toLowerCase();
|
|
90
|
-
return entries.filter((entry) => {
|
|
91
|
-
return entry.message.toLowerCase().includes(lowerSearch) || entry.raw.toLowerCase().includes(lowerSearch);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Checks if a single entry matches the specified log levels.
|
|
96
|
-
* Used for streaming/tail scenarios where we filter one entry at a time.
|
|
97
|
-
*/
|
|
98
|
-
export function matchesLevel(entry, levels) {
|
|
99
|
-
if (!entry.level)
|
|
100
|
-
return false;
|
|
101
|
-
const upperLevels = new Set(levels.map((l) => l.toUpperCase()));
|
|
102
|
-
return upperLevels.has(entry.level.toUpperCase());
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Checks if a single entry matches the search text (case-insensitive).
|
|
106
|
-
* Used for streaming/tail scenarios where we filter one entry at a time.
|
|
107
|
-
*/
|
|
108
|
-
export function matchesSearch(entry, search) {
|
|
109
|
-
const lowerSearch = search.toLowerCase();
|
|
110
|
-
return entry.message.toLowerCase().includes(lowerSearch) || entry.raw.toLowerCase().includes(lowerSearch);
|
|
111
|
-
}
|
|
6
|
+
export { filterByLevel, filterBySearch, filterBySince, matchesLevel, matchesSearch, parseLogTimestamp, parseRelativeTime, parseSinceTime, } from '@salesforce/b2c-tooling-sdk/operations/logs';
|
|
112
7
|
//# sourceMappingURL=filter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/utils/logs/filter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/utils/logs/filter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,aAAa,EACb,cAAc,EACd,aAAa,EACb,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,GACf,MAAM,6CAA6C,CAAC"}
|