@simplysf/simply-apex 1.2.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +1 -1
- package/README.md +23 -7
- package/lib/commands/simply/apex/execute.js +1 -1
- package/lib/commands/simply/apex/logs/purge.js +1 -1
- package/lib/commands/simply/apex/trace/setup.d.ts +16 -3
- package/lib/commands/simply/apex/trace/setup.js +75 -12
- package/lib/commands/simply/apex/trace/setup.js.map +1 -1
- package/lib/commands/simply/apex/trace/silence.d.ts +7 -5
- package/lib/commands/simply/apex/trace/silence.js +34 -6
- package/lib/commands/simply/apex/trace/silence.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/schemas/silence/classesToSilence.js +1 -1
- package/messages/simply.apex.trace.setup.md +61 -3
- package/messages/simply.apex.trace.silence.md +5 -1
- package/package.json +5 -5
package/LICENSE.txt
CHANGED
package/README.md
CHANGED
|
@@ -118,29 +118,41 @@ _See code: [lib/commands/simply/apex/logs/purge.js](https://github.com/SimplySF/
|
|
|
118
118
|
|
|
119
119
|
## `sf simply apex trace setup`
|
|
120
120
|
|
|
121
|
-
Configure a debug log trace flag for the current user.
|
|
121
|
+
Configure a debug log trace flag for the current user, or another user.
|
|
122
122
|
|
|
123
123
|
```
|
|
124
124
|
USAGE
|
|
125
|
-
$ sf simply apex trace setup -o <value> [--json] [--flags-dir <value>] [--api-version <value>]
|
|
125
|
+
$ sf simply apex trace setup -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [--on-behalf-of
|
|
126
|
+
<value>]
|
|
126
127
|
|
|
127
128
|
FLAGS
|
|
128
|
-
-o, --target-org=<value>
|
|
129
|
-
|
|
130
|
-
--api-version=<value>
|
|
129
|
+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
130
|
+
configuration variable is already set.
|
|
131
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
132
|
+
--on-behalf-of=<value> Configure the trace flag for another user, identified by a "Field:Value" pair.
|
|
131
133
|
|
|
132
134
|
GLOBAL FLAGS
|
|
133
135
|
--flags-dir=<value> Import flag values from a directory.
|
|
134
136
|
--json Format output as json.
|
|
135
137
|
|
|
136
138
|
DESCRIPTION
|
|
137
|
-
Configure a debug log trace flag for the current user.
|
|
139
|
+
Configure a debug log trace flag for the current user, or another user.
|
|
138
140
|
|
|
139
141
|
Creates or updates a 24-hour DEVELOPER_LOG trace flag for the user running the command, using a FINEST/FINER debug
|
|
140
|
-
level suitable for the Apex Replay Debugger.
|
|
142
|
+
level suitable for the Apex Replay Debugger. Use --on-behalf-of to configure the trace flag for a different user
|
|
143
|
+
instead.
|
|
141
144
|
|
|
142
145
|
EXAMPLES
|
|
143
146
|
$ sf simply apex trace setup --target-org myOrg
|
|
147
|
+
|
|
148
|
+
$ sf simply apex trace setup --target-org myOrg --on-behalf-of Username:someuser@example.com
|
|
149
|
+
|
|
150
|
+
$ sf simply apex trace setup --target-org myOrg --on-behalf-of FederationIdentifier:123456
|
|
151
|
+
|
|
152
|
+
FLAG DESCRIPTIONS
|
|
153
|
+
--on-behalf-of=<value> Configure the trace flag for another user, identified by a "Field:Value" pair.
|
|
154
|
+
|
|
155
|
+
Any unique User field can be used, for example "Username:someuser@example.com" or "FederationIdentifier:123456".
|
|
144
156
|
```
|
|
145
157
|
|
|
146
158
|
_See code: [lib/commands/simply/apex/trace/setup.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-apex@1.1.18/packages/simply-apex/lib/commands/simply/apex/trace/setup.js)_
|
|
@@ -189,3 +201,7 @@ FLAG DESCRIPTIONS
|
|
|
189
201
|
|
|
190
202
|
_See code: [lib/commands/simply/apex/trace/silence.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-apex@1.1.18/packages/simply-apex/lib/commands/simply/apex/trace/silence.js)_
|
|
191
203
|
<!-- commandsstop -->
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
Licensed under the [Apache-2.0](https://raw.githubusercontent.com/SimplySF/simply-node/main/LICENSE.txt) license.
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
-
/**
|
|
2
|
+
/** A `Field:Value` pair identifying the user to configure the trace flag for. */
|
|
3
|
+
type OnBehalfOf = {
|
|
4
|
+
field: string;
|
|
5
|
+
value: string;
|
|
6
|
+
};
|
|
7
|
+
/** IDs of the debug level and trace flag configured for the target user, and when it expires. */
|
|
3
8
|
export type ApexTraceSetupResult = {
|
|
4
9
|
userId: string;
|
|
5
10
|
debugLevelId: string;
|
|
@@ -7,14 +12,21 @@ export type ApexTraceSetupResult = {
|
|
|
7
12
|
expirationDate: string;
|
|
8
13
|
};
|
|
9
14
|
/**
|
|
10
|
-
* Creates or updates a
|
|
11
|
-
*
|
|
15
|
+
* Creates or updates a DEVELOPER_LOG trace flag for the target user. The target user is the one
|
|
16
|
+
* running the command by default, or the user identified by `--on-behalf-of` if provided. By
|
|
17
|
+
* default the trace flag uses the FINEST/FINER `ReplayDebuggerLevels` debug level suitable for
|
|
18
|
+
* the Apex Replay Debugger and runs for 24 hours starting now; `--log-level`, `--start-date`, and
|
|
19
|
+
* `--end-date` override those defaults.
|
|
12
20
|
*/
|
|
13
21
|
export default class ApexTraceSetup extends SfCommand<ApexTraceSetupResult> {
|
|
14
22
|
static readonly summary: string;
|
|
15
23
|
static readonly description: string;
|
|
16
24
|
static readonly examples: string[];
|
|
17
25
|
static readonly flags: {
|
|
26
|
+
'on-behalf-of': import("@oclif/core/interfaces").OptionFlag<OnBehalfOf | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
|
+
'log-level': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
28
|
+
'start-date': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
29
|
+
'end-date': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
30
|
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined>;
|
|
19
31
|
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org>;
|
|
20
32
|
'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -25,3 +37,4 @@ export default class ApexTraceSetup extends SfCommand<ApexTraceSetupResult> {
|
|
|
25
37
|
*/
|
|
26
38
|
run(): Promise<ApexTraceSetupResult>;
|
|
27
39
|
}
|
|
40
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) 2026, Clay Chipps
|
|
2
|
+
* Copyright (c) 2026, Clay Chipps.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -14,17 +14,28 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { Messages } from '@salesforce/core';
|
|
17
|
-
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
17
|
+
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
|
|
18
18
|
import { requireConnection, targetOrgFlags } from '@simplysf/simply-plugin-kit';
|
|
19
|
+
import { escapeSoqlLiteral } from '@simplysf/simply-core';
|
|
19
20
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
20
21
|
const messages = Messages.loadMessages('@simplysf/simply-apex', 'simply.apex.trace.setup');
|
|
21
22
|
/** DeveloperName used for the FINEST/FINER debug level created for the Apex Replay Debugger. */
|
|
22
23
|
const DEBUG_LEVEL_NAME = 'ReplayDebuggerLevels';
|
|
23
24
|
/** How long a configured trace flag stays active before expiring, in milliseconds (24 hours). */
|
|
24
25
|
const TRACE_DURATION_MS = 24 * 60 * 60 * 1000;
|
|
26
|
+
/** Matches the ISO 8601 date-time format required by the `--start-date`/`--end-date` flags. */
|
|
27
|
+
const DATE_TIME_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/;
|
|
25
28
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
29
|
+
* Matches `Field:Value` for `--on-behalf-of`. The field name is restricted to safe SOQL
|
|
30
|
+
* identifier characters since, unlike the value, it can't be quoted/escaped in the query.
|
|
31
|
+
*/
|
|
32
|
+
const ON_BEHALF_OF_PATTERN = /^([A-Za-z_][A-Za-z0-9_]*):(.+)$/;
|
|
33
|
+
/**
|
|
34
|
+
* Creates or updates a DEVELOPER_LOG trace flag for the target user. The target user is the one
|
|
35
|
+
* running the command by default, or the user identified by `--on-behalf-of` if provided. By
|
|
36
|
+
* default the trace flag uses the FINEST/FINER `ReplayDebuggerLevels` debug level suitable for
|
|
37
|
+
* the Apex Replay Debugger and runs for 24 hours starting now; `--log-level`, `--start-date`, and
|
|
38
|
+
* `--end-date` override those defaults.
|
|
28
39
|
*/
|
|
29
40
|
export default class ApexTraceSetup extends SfCommand {
|
|
30
41
|
static summary = messages.getMessage('summary');
|
|
@@ -33,6 +44,46 @@ export default class ApexTraceSetup extends SfCommand {
|
|
|
33
44
|
static flags = {
|
|
34
45
|
...SfCommand.baseFlags,
|
|
35
46
|
...targetOrgFlags,
|
|
47
|
+
'on-behalf-of': Flags.custom({
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
49
|
+
parse: async (input) => {
|
|
50
|
+
const match = ON_BEHALF_OF_PATTERN.exec(input);
|
|
51
|
+
if (!match) {
|
|
52
|
+
throw messages.createError('error.invalidOnBehalfOf', [input]);
|
|
53
|
+
}
|
|
54
|
+
const [, field, value] = match;
|
|
55
|
+
return { field, value };
|
|
56
|
+
},
|
|
57
|
+
})({
|
|
58
|
+
summary: messages.getMessage('flags.on-behalf-of.summary'),
|
|
59
|
+
description: messages.getMessage('flags.on-behalf-of.description'),
|
|
60
|
+
}),
|
|
61
|
+
'log-level': Flags.string({
|
|
62
|
+
summary: messages.getMessage('flags.log-level.summary'),
|
|
63
|
+
description: messages.getMessage('flags.log-level.description'),
|
|
64
|
+
}),
|
|
65
|
+
'start-date': Flags.string({
|
|
66
|
+
summary: messages.getMessage('flags.start-date.summary'),
|
|
67
|
+
description: messages.getMessage('flags.start-date.description'),
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
69
|
+
parse: async (input) => {
|
|
70
|
+
if (!DATE_TIME_PATTERN.test(input)) {
|
|
71
|
+
throw messages.createError('error.invalidDateTime', ['start-date', input]);
|
|
72
|
+
}
|
|
73
|
+
return input;
|
|
74
|
+
},
|
|
75
|
+
}),
|
|
76
|
+
'end-date': Flags.string({
|
|
77
|
+
summary: messages.getMessage('flags.end-date.summary'),
|
|
78
|
+
description: messages.getMessage('flags.end-date.description'),
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
80
|
+
parse: async (input) => {
|
|
81
|
+
if (!DATE_TIME_PATTERN.test(input)) {
|
|
82
|
+
throw messages.createError('error.invalidDateTime', ['end-date', input]);
|
|
83
|
+
}
|
|
84
|
+
return input;
|
|
85
|
+
},
|
|
86
|
+
}),
|
|
36
87
|
};
|
|
37
88
|
/**
|
|
38
89
|
* @returns The IDs of the debug level and trace flag that were created or updated, and the
|
|
@@ -41,20 +92,31 @@ export default class ApexTraceSetup extends SfCommand {
|
|
|
41
92
|
async run() {
|
|
42
93
|
const { flags } = await this.parse(ApexTraceSetup);
|
|
43
94
|
const targetOrgConnection = requireConnection(flags);
|
|
95
|
+
const onBehalfOf = flags['on-behalf-of'];
|
|
96
|
+
const userFilterField = onBehalfOf?.field ?? 'Username';
|
|
97
|
+
const userFilterValue = onBehalfOf?.value ?? targetOrgConnection.getUsername() ?? '';
|
|
98
|
+
const userIdentifier = onBehalfOf ? `${onBehalfOf.field}:${onBehalfOf.value}` : userFilterValue;
|
|
44
99
|
this.spinner.start(messages.getMessage('info.findingUser'));
|
|
45
|
-
const
|
|
46
|
-
const userQueryResult = await targetOrgConnection.query(`SELECT Id FROM User WHERE Username = '${username}'`);
|
|
100
|
+
const userQueryResult = await targetOrgConnection.query(`SELECT Id FROM User WHERE ${userFilterField} = '${escapeSoqlLiteral(userFilterValue)}' LIMIT 2`);
|
|
47
101
|
if (userQueryResult.records.length === 0) {
|
|
48
|
-
throw messages.createError('error.userNotFound', [
|
|
102
|
+
throw messages.createError('error.userNotFound', [userIdentifier]);
|
|
103
|
+
}
|
|
104
|
+
if (userQueryResult.records.length > 1) {
|
|
105
|
+
throw messages.createError('error.ambiguousOnBehalfOf', [userIdentifier]);
|
|
49
106
|
}
|
|
50
107
|
const userId = userQueryResult.records[0].Id;
|
|
51
108
|
this.spinner.stop();
|
|
109
|
+
const requestedLogLevel = flags['log-level'];
|
|
110
|
+
const debugLevelName = requestedLogLevel ?? DEBUG_LEVEL_NAME;
|
|
52
111
|
this.spinner.start(messages.getMessage('info.checkingDebugLevel'));
|
|
53
|
-
const debugLevelResult = await targetOrgConnection.tooling.query(`SELECT Id FROM DebugLevel WHERE DeveloperName = '${
|
|
112
|
+
const debugLevelResult = await targetOrgConnection.tooling.query(`SELECT Id FROM DebugLevel WHERE DeveloperName = '${debugLevelName}'`);
|
|
54
113
|
let debugLevelId;
|
|
55
114
|
if (debugLevelResult.records.length > 0) {
|
|
56
115
|
debugLevelId = debugLevelResult.records[0].Id;
|
|
57
116
|
}
|
|
117
|
+
else if (requestedLogLevel) {
|
|
118
|
+
throw messages.createError('error.debugLevelNotFound', [debugLevelName]);
|
|
119
|
+
}
|
|
58
120
|
else {
|
|
59
121
|
const createResult = await targetOrgConnection.tooling.sobject('DebugLevel').create({
|
|
60
122
|
DeveloperName: DEBUG_LEVEL_NAME,
|
|
@@ -72,10 +134,11 @@ export default class ApexTraceSetup extends SfCommand {
|
|
|
72
134
|
this.spinner.stop();
|
|
73
135
|
this.spinner.start(messages.getMessage('info.configuringTraceFlag'));
|
|
74
136
|
const traceFlagResult = await targetOrgConnection.tooling.query(`SELECT Id FROM TraceFlag WHERE LogType = 'DEVELOPER_LOG' AND TracedEntityId = '${userId}'`);
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
137
|
+
const startDate = flags['start-date'] ?? new Date().toISOString();
|
|
138
|
+
const expirationDate = flags['end-date'] ?? new Date(new Date(startDate).getTime() + TRACE_DURATION_MS).toISOString();
|
|
139
|
+
if (new Date(expirationDate).getTime() <= new Date(startDate).getTime()) {
|
|
140
|
+
throw messages.createError('error.invalidDateRange', [expirationDate, startDate]);
|
|
141
|
+
}
|
|
79
142
|
let traceFlagId;
|
|
80
143
|
if (traceFlagResult.records.length > 0) {
|
|
81
144
|
traceFlagId = traceFlagResult.records[0].Id;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../../../src/commands/simply/apex/trace/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../../../src/commands/simply/apex/trace/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,uBAAuB,EAAE,yBAAyB,CAAC,CAAC;AAE3F,gGAA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AC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;iBACrD,CAAC,CAAC;YACL,CAAC;YAED,WAAW,GAAG,YAAY,CAAC,EAAE,CAAC;QAChC,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAEpB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;QAElE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;IAC/D,CAAC"}
|
|
@@ -6,8 +6,10 @@ export type ApexTraceSilenceResult = {
|
|
|
6
6
|
traceFlagId: string;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
* Creates a 24-hour CLASS_TRACING trace flag with a fully suppressed (NONE) debug
|
|
10
|
-
* specified Apex class, preventing those classes from generating debug log
|
|
9
|
+
* Creates or updates a 24-hour CLASS_TRACING trace flag with a fully suppressed (NONE) debug
|
|
10
|
+
* level for each specified Apex class, preventing those classes from generating debug log
|
|
11
|
+
* output. Classes that already have a trace flag have its expiration extended instead of getting
|
|
12
|
+
* a duplicate.
|
|
11
13
|
*/
|
|
12
14
|
export default class ApexTraceSilence extends SfCommand<ApexTraceSilenceResult[]> {
|
|
13
15
|
static readonly summary: string;
|
|
@@ -21,9 +23,9 @@ export default class ApexTraceSilence extends SfCommand<ApexTraceSilenceResult[]
|
|
|
21
23
|
'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
24
|
};
|
|
23
25
|
/**
|
|
24
|
-
* @returns The trace flag created for each Apex class that was found and
|
|
25
|
-
* silenced. Classes that couldn't be found or whose trace flag
|
|
26
|
-
* about and omitted.
|
|
26
|
+
* @returns The trace flag created or updated for each Apex class that was found and
|
|
27
|
+
* successfully silenced. Classes that couldn't be found or whose trace flag couldn't be
|
|
28
|
+
* created/updated are warned about and omitted.
|
|
27
29
|
*/
|
|
28
30
|
run(): Promise<ApexTraceSilenceResult[]>;
|
|
29
31
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) 2026, Clay Chipps
|
|
2
|
+
* Copyright (c) 2026, Clay Chipps.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -51,8 +51,10 @@ function resolveClasses(classesFlag, classesFileFlag) {
|
|
|
51
51
|
return [];
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
|
-
* Creates a 24-hour CLASS_TRACING trace flag with a fully suppressed (NONE) debug
|
|
55
|
-
* specified Apex class, preventing those classes from generating debug log
|
|
54
|
+
* Creates or updates a 24-hour CLASS_TRACING trace flag with a fully suppressed (NONE) debug
|
|
55
|
+
* level for each specified Apex class, preventing those classes from generating debug log
|
|
56
|
+
* output. Classes that already have a trace flag have its expiration extended instead of getting
|
|
57
|
+
* a duplicate.
|
|
56
58
|
*/
|
|
57
59
|
export default class ApexTraceSilence extends SfCommand {
|
|
58
60
|
static summary = messages.getMessage('summary');
|
|
@@ -75,9 +77,9 @@ export default class ApexTraceSilence extends SfCommand {
|
|
|
75
77
|
}),
|
|
76
78
|
};
|
|
77
79
|
/**
|
|
78
|
-
* @returns The trace flag created for each Apex class that was found and
|
|
79
|
-
* silenced. Classes that couldn't be found or whose trace flag
|
|
80
|
-
* about and omitted.
|
|
80
|
+
* @returns The trace flag created or updated for each Apex class that was found and
|
|
81
|
+
* successfully silenced. Classes that couldn't be found or whose trace flag couldn't be
|
|
82
|
+
* created/updated are warned about and omitted.
|
|
81
83
|
*/
|
|
82
84
|
async run() {
|
|
83
85
|
const { flags } = await this.parse(ApexTraceSilence);
|
|
@@ -130,9 +132,35 @@ export default class ApexTraceSilence extends SfCommand {
|
|
|
130
132
|
const expiration = new Date(now.getTime() + TRACE_DURATION_MS);
|
|
131
133
|
const startDate = now.toISOString();
|
|
132
134
|
const expirationDate = expiration.toISOString();
|
|
135
|
+
const classIdsClause = classResult.records.map((record) => `'${record.Id}'`).join(',');
|
|
136
|
+
const existingTraceFlagResult = await targetOrgConnection.tooling.query(`SELECT Id, TracedEntityId FROM TraceFlag WHERE LogType = 'CLASS_TRACING' AND TracedEntityId IN (${classIdsClause})`);
|
|
137
|
+
const existingTraceFlagIdByClassId = new Map(existingTraceFlagResult.records.map((record) => [record.TracedEntityId, record.Id]));
|
|
133
138
|
const results = [];
|
|
134
139
|
this.spinner.start(messages.getMessage('info.creatingTraceFlags'));
|
|
135
140
|
for (const classRecord of classResult.records) {
|
|
141
|
+
const existingTraceFlagId = existingTraceFlagIdByClassId.get(classRecord.Id);
|
|
142
|
+
if (existingTraceFlagId) {
|
|
143
|
+
// eslint-disable-next-line no-await-in-loop
|
|
144
|
+
const updateResult = await targetOrgConnection.tooling.sobject('TraceFlag').update({
|
|
145
|
+
Id: existingTraceFlagId,
|
|
146
|
+
DebugLevelId: debugLevelId,
|
|
147
|
+
StartDate: startDate,
|
|
148
|
+
ExpirationDate: expirationDate,
|
|
149
|
+
});
|
|
150
|
+
if (!updateResult.success) {
|
|
151
|
+
this.warn(messages.getMessage('warning.traceFlagUpdateFailed', [
|
|
152
|
+
classRecord.Name,
|
|
153
|
+
updateResult.errors.map((e) => e.message).join(', '),
|
|
154
|
+
]));
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
results.push({
|
|
158
|
+
class: classRecord.Name,
|
|
159
|
+
classId: classRecord.Id,
|
|
160
|
+
traceFlagId: existingTraceFlagId,
|
|
161
|
+
});
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
136
164
|
// eslint-disable-next-line no-await-in-loop
|
|
137
165
|
const createResult = await targetOrgConnection.tooling.sobject('TraceFlag').create({
|
|
138
166
|
StartDate: startDate,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"silence.js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QAEpB,IAAI,CAAC,KAAK,CAAC;YACT,IAAI,EAAE,OAAO;YACb,OAAO,EAAE;gBACP,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE;gBAC/B,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE;gBACpC,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,eAAe,EAAE;aAC9C;SACF,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;IACjB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,18 +1,76 @@
|
|
|
1
1
|
# summary
|
|
2
2
|
|
|
3
|
-
Configure a debug log trace flag for the current user.
|
|
3
|
+
Configure a debug log trace flag for the current user, or another user.
|
|
4
4
|
|
|
5
5
|
# description
|
|
6
6
|
|
|
7
|
-
Creates or updates a
|
|
7
|
+
Creates or updates a DEVELOPER_LOG trace flag for the target user, using the FINEST/FINER "ReplayDebuggerLevels" debug level suitable for the Apex Replay Debugger and running for 24 hours starting now, by default. Use --on-behalf-of to configure the trace flag for a different user instead; --log-level, --start-date, and --end-date override the other defaults.
|
|
8
|
+
|
|
9
|
+
# flags.on-behalf-of.summary
|
|
10
|
+
|
|
11
|
+
Configure the trace flag for another user, identified by a "Field:Value" pair.
|
|
12
|
+
|
|
13
|
+
# flags.on-behalf-of.description
|
|
14
|
+
|
|
15
|
+
Any unique User field can be used, for example "Username:someuser@example.com" or "FederationIdentifier:123456".
|
|
16
|
+
|
|
17
|
+
# flags.log-level.summary
|
|
18
|
+
|
|
19
|
+
Developer name of an existing debug level to use for the trace flag.
|
|
20
|
+
|
|
21
|
+
# flags.log-level.description
|
|
22
|
+
|
|
23
|
+
Must already exist in the org; it's looked up but never created or modified. Defaults to the "ReplayDebuggerLevels" debug level, which is created automatically if it doesn't exist.
|
|
24
|
+
|
|
25
|
+
# flags.start-date.summary
|
|
26
|
+
|
|
27
|
+
Start date/time of the trace flag, as an ISO 8601 date-time.
|
|
28
|
+
|
|
29
|
+
# flags.start-date.description
|
|
30
|
+
|
|
31
|
+
Defaults to the current date/time.
|
|
32
|
+
|
|
33
|
+
# flags.end-date.summary
|
|
34
|
+
|
|
35
|
+
Expiration date/time of the trace flag, as an ISO 8601 date-time.
|
|
36
|
+
|
|
37
|
+
# flags.end-date.description
|
|
38
|
+
|
|
39
|
+
Defaults to 24 hours after the start date/time.
|
|
8
40
|
|
|
9
41
|
# examples
|
|
10
42
|
|
|
11
43
|
- <%= config.bin %> <%= command.id %> --target-org myOrg
|
|
12
44
|
|
|
45
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg --on-behalf-of Username:someuser@example.com
|
|
46
|
+
|
|
47
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg --on-behalf-of FederationIdentifier:123456
|
|
48
|
+
|
|
49
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg --log-level MyCustomDebugLevel --start-date 2026-08-18T09:00:00Z --end-date 2026-08-19T09:00:00Z
|
|
50
|
+
|
|
51
|
+
# error.invalidOnBehalfOf
|
|
52
|
+
|
|
53
|
+
Invalid --on-behalf-of value: %s. Expected a "Field:Value" pair, for example "Username:someuser@example.com".
|
|
54
|
+
|
|
13
55
|
# error.userNotFound
|
|
14
56
|
|
|
15
|
-
User not found for
|
|
57
|
+
User not found for %s
|
|
58
|
+
|
|
59
|
+
# error.ambiguousOnBehalfOf
|
|
60
|
+
|
|
61
|
+
Multiple users found for %s. Use a field/value pair that uniquely identifies one user.
|
|
62
|
+
|
|
63
|
+
# error.debugLevelNotFound
|
|
64
|
+
|
|
65
|
+
No debug level found with developer name: %s
|
|
66
|
+
|
|
67
|
+
# error.invalidDateTime
|
|
68
|
+
|
|
69
|
+
Invalid value for --%s: "%s". Expected an ISO 8601 date-time (e.g., 2026-08-18T14:30:00Z).
|
|
70
|
+
|
|
71
|
+
# error.invalidDateRange
|
|
72
|
+
|
|
73
|
+
--end-date (%s) must be after --start-date (%s).
|
|
16
74
|
|
|
17
75
|
# error.debugLevelCreateFailed
|
|
18
76
|
|
|
@@ -4,7 +4,7 @@ Silence debug logs for specific Apex classes.
|
|
|
4
4
|
|
|
5
5
|
# description
|
|
6
6
|
|
|
7
|
-
Creates a 24-hour CLASS_TRACING trace flag with a fully suppressed (NONE) debug level for each specified Apex class, preventing those classes from generating debug log output.
|
|
7
|
+
Creates or updates a 24-hour CLASS_TRACING trace flag with a fully suppressed (NONE) debug level for each specified Apex class, preventing those classes from generating debug log output. If a class already has a trace flag, its expiration is extended instead of creating a duplicate.
|
|
8
8
|
|
|
9
9
|
# flags.classes.summary
|
|
10
10
|
|
|
@@ -63,3 +63,7 @@ The following classes were not found and were skipped: %s
|
|
|
63
63
|
# warning.traceFlagCreateFailed
|
|
64
64
|
|
|
65
65
|
Failed to create a trace flag for class %s: %s
|
|
66
|
+
|
|
67
|
+
# warning.traceFlagUpdateFailed
|
|
68
|
+
|
|
69
|
+
Failed to update the existing trace flag for class %s: %s
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysf/simply-apex",
|
|
3
3
|
"description": "Utilities for working with Apex",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"author": "@ClayChipps",
|
|
6
6
|
"homepage": "https://github.com/SimplySF/simply-node",
|
|
7
7
|
"bugs": "https://github.com/SimplySF/simply-node/issues",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"@salesforce/core": "^8.30.0",
|
|
70
70
|
"@salesforce/kit": "^3.2.6",
|
|
71
71
|
"@salesforce/sf-plugins-core": "^12.2.16",
|
|
72
|
-
"@simplysf/simply-core": "^1.1.
|
|
73
|
-
"@simplysf/simply-plugin-kit": "^1.0.
|
|
72
|
+
"@simplysf/simply-core": "^1.1.17",
|
|
73
|
+
"@simplysf/simply-plugin-kit": "^1.0.4",
|
|
74
74
|
"zod": "^4.1.12"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"readme": "oclif readme --no-aliases",
|
|
93
93
|
"test": "wireit",
|
|
94
94
|
"test:coverage": "vitest run --coverage --project simply-apex",
|
|
95
|
-
"test:nuts": "vitest run --config vitest.nuts.config.ts --project simply-apex",
|
|
95
|
+
"test:nuts": "vitest run --config ../../vitest.nuts.config.ts --project simply-apex",
|
|
96
96
|
"test:only": "wireit",
|
|
97
97
|
"test:watch": "vitest watch --project simply-apex"
|
|
98
98
|
},
|
|
@@ -217,5 +217,5 @@
|
|
|
217
217
|
"output": []
|
|
218
218
|
}
|
|
219
219
|
},
|
|
220
|
-
"gitHead": "
|
|
220
|
+
"gitHead": "23a9b5c73b328343000e29a75d3524a979d2fe7c"
|
|
221
221
|
}
|