@simplysf/simply-apex 1.6.10 → 1.8.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/README.md +53 -4
- package/lib/commands/simply/apex/execute.d.ts +2 -2
- package/lib/commands/simply/apex/execute.js +1 -1
- package/lib/commands/simply/apex/execute.js.map +1 -1
- package/lib/commands/simply/apex/logs/purge.d.ts +2 -2
- package/lib/commands/simply/apex/logs/purge.js +1 -1
- package/lib/commands/simply/apex/logs/purge.js.map +1 -1
- package/lib/commands/simply/apex/test-suite/generate.d.ts +20 -0
- package/lib/commands/simply/apex/test-suite/generate.js +81 -0
- package/lib/commands/simply/apex/test-suite/generate.js.map +1 -0
- package/lib/commands/simply/apex/trace/setup.d.ts +2 -2
- package/lib/commands/simply/apex/trace/setup.js +1 -1
- package/lib/commands/simply/apex/trace/setup.js.map +1 -1
- package/lib/commands/simply/apex/trace/silence.d.ts +2 -2
- package/lib/commands/simply/apex/trace/silence.js +1 -1
- package/lib/commands/simply/apex/trace/silence.js.map +1 -1
- package/messages/simply.apex.test-suite.generate.md +53 -0
- package/package.json +8 -5
- package/lib/common/apexExecute.d.ts +0 -31
- package/lib/common/apexExecute.js +0 -60
- package/lib/common/apexExecute.js.map +0 -1
- package/lib/common/apexLogsPurge.d.ts +0 -34
- package/lib/common/apexLogsPurge.js +0 -100
- package/lib/common/apexLogsPurge.js.map +0 -1
- package/lib/common/apexTraceSetup.d.ts +0 -57
- package/lib/common/apexTraceSetup.js +0 -142
- package/lib/common/apexTraceSetup.js.map +0 -1
- package/lib/common/apexTraceSilence.d.ts +0 -65
- package/lib/common/apexTraceSilence.js +0 -171
- package/lib/common/apexTraceSilence.js.map +0 -1
- package/lib/common/schemas/classesToSilence.d.ts +0 -7
- package/lib/common/schemas/classesToSilence.js +0 -21
- package/lib/common/schemas/classesToSilence.js.map +0 -1
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@ This package is part of the [`@simplysf/simply`](https://github.com/SimplySF/sim
|
|
|
22
22
|
|
|
23
23
|
- [`sf simply apex execute`](#sf-simply-apex-execute)
|
|
24
24
|
- [`sf simply apex logs purge`](#sf-simply-apex-logs-purge)
|
|
25
|
+
- [`sf simply apex test-suite generate`](#sf-simply-apex-test-suite-generate)
|
|
25
26
|
- [`sf simply apex trace setup`](#sf-simply-apex-trace-setup)
|
|
26
27
|
- [`sf simply apex trace silence`](#sf-simply-apex-trace-silence)
|
|
27
28
|
|
|
@@ -58,7 +59,7 @@ FLAG DESCRIPTIONS
|
|
|
58
59
|
The path to the local .apex file containing the anonymous Apex code to execute.
|
|
59
60
|
```
|
|
60
61
|
|
|
61
|
-
_See code: [lib/commands/simply/apex/execute.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-apex@1.
|
|
62
|
+
_See code: [lib/commands/simply/apex/execute.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-apex@1.6.10/packages/simply-apex/lib/commands/simply/apex/execute.js)_
|
|
62
63
|
|
|
63
64
|
## `sf simply apex logs purge`
|
|
64
65
|
|
|
@@ -114,7 +115,55 @@ FLAG DESCRIPTIONS
|
|
|
114
115
|
elapses, then throws.
|
|
115
116
|
```
|
|
116
117
|
|
|
117
|
-
_See code: [lib/commands/simply/apex/logs/purge.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-apex@1.
|
|
118
|
+
_See code: [lib/commands/simply/apex/logs/purge.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-apex@1.6.10/packages/simply-apex/lib/commands/simply/apex/logs/purge.js)_
|
|
119
|
+
|
|
120
|
+
## `sf simply apex test-suite generate`
|
|
121
|
+
|
|
122
|
+
Generate an Apex test suite from source.
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
USAGE
|
|
126
|
+
$ sf simply apex test-suite generate -d <value>... -n <value> --output-dir <value> [--json] [--flags-dir <value>]
|
|
127
|
+
|
|
128
|
+
FLAGS
|
|
129
|
+
-d, --source-dir=<value>... (required) Directories to scan for Apex classes
|
|
130
|
+
-n, --name=<value> (required) API name for the test suite
|
|
131
|
+
--output-dir=<value> (required) Output directory
|
|
132
|
+
|
|
133
|
+
GLOBAL FLAGS
|
|
134
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
135
|
+
--json Format output as json.
|
|
136
|
+
|
|
137
|
+
DESCRIPTION
|
|
138
|
+
Generate an Apex test suite from source.
|
|
139
|
+
|
|
140
|
+
Scans one or more source directories for Apex classes, keeps only the ones whose first meaningful line (skipping
|
|
141
|
+
leading blank lines and comments) is an @IsTest annotation, and writes an ApexTestSuite metadata file listing them.
|
|
142
|
+
Every run regenerates the file from scratch based on the current state of --source-dir; an existing file with the same
|
|
143
|
+
name is always overwritten.
|
|
144
|
+
|
|
145
|
+
EXAMPLES
|
|
146
|
+
$ sf simply apex test-suite generate --source-dir force-app/main/default/classes --name My_Suite --output-dir force-app/main/default/testSuites
|
|
147
|
+
|
|
148
|
+
$ sf simply apex test-suite generate --source-dir force-app/main/default/classes --source-dir force-app/extra/classes --name All_Tests --output-dir force-app/main/default/testSuites
|
|
149
|
+
|
|
150
|
+
FLAG DESCRIPTIONS
|
|
151
|
+
-d, --source-dir=<value>... Directories to scan for Apex classes
|
|
152
|
+
|
|
153
|
+
One or more directories to scan, recursively, for Apex classes. Only classes whose first meaningful line is an
|
|
154
|
+
@IsTest annotation are included in the generated suite.
|
|
155
|
+
|
|
156
|
+
-n, --name=<value> API name for the test suite
|
|
157
|
+
|
|
158
|
+
The API name for the generated test suite; also used to derive the output filename, <name>.testSuite-meta.xml.
|
|
159
|
+
|
|
160
|
+
--output-dir=<value> Output directory
|
|
161
|
+
|
|
162
|
+
The directory to write the generated ApexTestSuite metadata file to. Not automatically suffixed with testSuites/ —
|
|
163
|
+
pass that directory explicitly, e.g. force-app/main/default/testSuites.
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
_See code: [lib/commands/simply/apex/test-suite/generate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-apex@1.6.10/packages/simply-apex/lib/commands/simply/apex/test-suite/generate.js)_
|
|
118
167
|
|
|
119
168
|
## `sf simply apex trace setup`
|
|
120
169
|
|
|
@@ -174,7 +223,7 @@ FLAG DESCRIPTIONS
|
|
|
174
223
|
Defaults to the current date/time.
|
|
175
224
|
```
|
|
176
225
|
|
|
177
|
-
_See code: [lib/commands/simply/apex/trace/setup.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-apex@1.
|
|
226
|
+
_See code: [lib/commands/simply/apex/trace/setup.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-apex@1.6.10/packages/simply-apex/lib/commands/simply/apex/trace/setup.js)_
|
|
178
227
|
|
|
179
228
|
## `sf simply apex trace silence`
|
|
180
229
|
|
|
@@ -238,7 +287,7 @@ FLAG DESCRIPTIONS
|
|
|
238
287
|
Adds di_Binding, di_Module, di_PlatformCache, and di_Injector to the classes to silence.
|
|
239
288
|
```
|
|
240
289
|
|
|
241
|
-
_See code: [lib/commands/simply/apex/trace/silence.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-apex@1.
|
|
290
|
+
_See code: [lib/commands/simply/apex/trace/silence.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-apex@1.6.10/packages/simply-apex/lib/commands/simply/apex/trace/silence.js)_
|
|
242
291
|
<!-- commandsstop -->
|
|
243
292
|
|
|
244
293
|
## License
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
-
import { type ApexExecuteResult } from '
|
|
3
|
-
export type { ApexExecuteResult } from '
|
|
2
|
+
import { type ApexExecuteResult } from '@simplysf/simply-apex-core';
|
|
3
|
+
export type { ApexExecuteResult } from '@simplysf/simply-apex-core';
|
|
4
4
|
/**
|
|
5
5
|
* Executes an anonymous block of Apex code from a local .apex file against a target org and
|
|
6
6
|
* reports the compile and execution results, including any debug logs produced.
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
import path from 'node:path';
|
|
17
17
|
import { Messages } from '@salesforce/core';
|
|
18
18
|
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
19
|
+
import { ApexExecuteError, executeApex } from '@simplysf/simply-apex-core';
|
|
19
20
|
import { requireConnection, targetOrgFlags } from '@simplysf/simply-plugin-kit';
|
|
20
|
-
import { ApexExecuteError, executeApex } from '../../../common/apexExecute.js';
|
|
21
21
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
22
22
|
const messages = Messages.loadMessages('@simplysf/simply-apex', 'simply.apex.execute');
|
|
23
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../src/commands/simply/apex/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../src/commands/simply/apex/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAA0B,MAAM,4BAA4B,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEhF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;AAIvF;;;GAGG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K,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;oBACpC,MAAM,QAAQ,CAAC,WAAW,CAAC,qBAAqB,EAAE;wBAChD,KAAK,CAAC,MAAM,CAAC,IAAI;wBACjB,KAAK,CAAC,MAAM,CAAC,MAAM;wBACnB,KAAK,CAAC,MAAM,CAAC,cAAc;qBAC5B,CAAC,CAAC;gBACL,CAAC;gBACD,MAAM,QAAQ,CAAC,WAAW,CAAC,qBAAqB,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC;YACrF,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAEpB,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAChB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Duration } from '@salesforce/kit';
|
|
2
2
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
-
import { type ApexLogsPurgeResult } from '
|
|
4
|
-
export type { ApexLogsPurgeResult } from '
|
|
3
|
+
import { type ApexLogsPurgeResult } from '@simplysf/simply-apex-core';
|
|
4
|
+
export type { ApexLogsPurgeResult } from '@simplysf/simply-apex-core';
|
|
5
5
|
/**
|
|
6
6
|
* Deletes `ApexLog` records from the target org. By default all logs are purged; use `--where`
|
|
7
7
|
* to scope the deletion to a subset of logs.
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
import { Messages } from '@salesforce/core';
|
|
17
17
|
import { Duration } from '@salesforce/kit';
|
|
18
18
|
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
19
|
+
import { deleteApexLogsViaBulkApi, deleteApexLogsViaCollections, queryApexLogIdsViaBulkApi, queryApexLogIdsViaRest, } from '@simplysf/simply-apex-core';
|
|
19
20
|
import { requireConnection, targetOrgFlags } from '@simplysf/simply-plugin-kit';
|
|
20
|
-
import { deleteApexLogsViaBulkApi, deleteApexLogsViaCollections, queryApexLogIdsViaBulkApi, queryApexLogIdsViaRest, } from '../../../../common/apexLogsPurge.js';
|
|
21
21
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
22
22
|
const messages = Messages.loadMessages('@simplysf/simply-apex', 'simply.apex.logs.purge');
|
|
23
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"purge.js","sourceRoot":"","sources":["../../../../../src/commands/simply/apex/logs/purge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"purge.js","sourceRoot":"","sources":["../../../../../src/commands/simply/apex/logs/purge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,yBAAyB,EACzB,sBAAsB,GAEvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEhF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,uBAAuB,EAAE,wBAAwB,CAAC,CAAC;AAI1F;;;GAGG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AC;QAEpB,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;QACvE,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,YAAY,CAAC;QAEnD,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;QACrF,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACnE,CAAC;QAED,IAAI,CAAC,KAAK,CAAC;YACT,IAAI,EAAE,OAAO;YACb,OAAO,EAAE;gBACP,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;gBACzB,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;gBACnC,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE;aAChC;SACF,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;IACjB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { type ApexTestSuiteGenerateResult } from '@simplysf/simply-apex-core';
|
|
3
|
+
export type { ApexTestSuiteGenerateResult } from '@simplysf/simply-apex-core';
|
|
4
|
+
/**
|
|
5
|
+
* Scans one or more source directories for Apex classes whose first meaningful line is an
|
|
6
|
+
* `@IsTest` annotation, then generates an `ApexTestSuite` metadata file listing them.
|
|
7
|
+
*/
|
|
8
|
+
export default class ApexTestSuiteGenerate extends SfCommand<ApexTestSuiteGenerateResult> {
|
|
9
|
+
static readonly summary: string;
|
|
10
|
+
static readonly description: string;
|
|
11
|
+
static readonly examples: string[];
|
|
12
|
+
static readonly flags: {
|
|
13
|
+
'source-dir': import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
'output-dir': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
};
|
|
18
|
+
/** @returns The generated file's path and the test class names it lists. */
|
|
19
|
+
run(): Promise<ApexTestSuiteGenerateResult>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, Clay Chipps.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Messages } from '@salesforce/core';
|
|
17
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { ApexTestSuiteError, generateApexTestSuite, } from '@simplysf/simply-apex-core';
|
|
19
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
20
|
+
const messages = Messages.loadMessages('@simplysf/simply-apex', 'simply.apex.test-suite.generate');
|
|
21
|
+
/** Maps `ApexTestSuiteError`'s structural codes to this command's own `Messages` catalog. */
|
|
22
|
+
function toCliError(error) {
|
|
23
|
+
switch (error.code) {
|
|
24
|
+
case 'no-test-classes-found':
|
|
25
|
+
return messages.createError('error.noTestClassesFound');
|
|
26
|
+
case 'scan-failed':
|
|
27
|
+
return messages.createError('error.scanFailed', [error.message]);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Scans one or more source directories for Apex classes whose first meaningful line is an
|
|
32
|
+
* `@IsTest` annotation, then generates an `ApexTestSuite` metadata file listing them.
|
|
33
|
+
*/
|
|
34
|
+
export default class ApexTestSuiteGenerate extends SfCommand {
|
|
35
|
+
static summary = messages.getMessage('summary');
|
|
36
|
+
static description = messages.getMessage('description');
|
|
37
|
+
static examples = messages.getMessages('examples');
|
|
38
|
+
static flags = {
|
|
39
|
+
...SfCommand.baseFlags,
|
|
40
|
+
'source-dir': Flags.directory({
|
|
41
|
+
summary: messages.getMessage('flags.source-dir.summary'),
|
|
42
|
+
description: messages.getMessage('flags.source-dir.description'),
|
|
43
|
+
char: 'd',
|
|
44
|
+
exists: true,
|
|
45
|
+
multiple: true,
|
|
46
|
+
required: true,
|
|
47
|
+
}),
|
|
48
|
+
name: Flags.string({
|
|
49
|
+
summary: messages.getMessage('flags.name.summary'),
|
|
50
|
+
description: messages.getMessage('flags.name.description'),
|
|
51
|
+
char: 'n',
|
|
52
|
+
required: true,
|
|
53
|
+
}),
|
|
54
|
+
'output-dir': Flags.directory({
|
|
55
|
+
summary: messages.getMessage('flags.output-dir.summary'),
|
|
56
|
+
description: messages.getMessage('flags.output-dir.description'),
|
|
57
|
+
required: true,
|
|
58
|
+
}),
|
|
59
|
+
};
|
|
60
|
+
/** @returns The generated file's path and the test class names it lists. */
|
|
61
|
+
async run() {
|
|
62
|
+
const { flags } = await this.parse(ApexTestSuiteGenerate);
|
|
63
|
+
this.spinner.start(messages.getMessage('info.scanning'));
|
|
64
|
+
let result;
|
|
65
|
+
try {
|
|
66
|
+
result = await generateApexTestSuite(flags['source-dir'], flags['output-dir'], flags.name);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
this.spinner.stop();
|
|
70
|
+
throw error instanceof ApexTestSuiteError ? toCliError(error) : error;
|
|
71
|
+
}
|
|
72
|
+
this.spinner.stop();
|
|
73
|
+
this.info(messages.getMessage('info.fileGenerated', [result.filePath]));
|
|
74
|
+
this.table({
|
|
75
|
+
data: result.testClassNames.map((className) => ({ class: className })),
|
|
76
|
+
columns: [{ key: 'class', name: 'CLASS' }],
|
|
77
|
+
});
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../../../src/commands/simply/apex/test-suite/generate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GAEtB,MAAM,4BAA4B,CAAC;AAEpC,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,uBAAuB,EAAE,iCAAiC,CAAC,CAAC;AAInG,6FAA6F;AAC7F,SAAS,UAAU,CAAC,KAAyB;IAC3C,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,uBAAuB;YAC1B,OAAO,QAAQ,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC;QAC1D,KAAK,aAAa;YAChB,OAAO,QAAQ,CAAC,WAAW,CAAC,kBAAkB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACrE,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM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EzD,IAAI,MAAmC,CAAC;QACxC,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,qBAAqB,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7F,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACpB,MAAM,KAAK,YAAY,kBAAkB,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACxE,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAEpB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAExE,IAAI,CAAC,KAAK,CAAC;YACT,IAAI,EAAE,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;YACtE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;SAC3C,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
-
import { type ApexTraceSetupResult, type OnBehalfOf } from '
|
|
3
|
-
export type { ApexTraceSetupResult } from '
|
|
2
|
+
import { type ApexTraceSetupResult, type OnBehalfOf } from '@simplysf/simply-apex-core';
|
|
3
|
+
export type { ApexTraceSetupResult } from '@simplysf/simply-apex-core';
|
|
4
4
|
/**
|
|
5
5
|
* Creates or updates a DEVELOPER_LOG trace flag for the target user. The target user is the one
|
|
6
6
|
* running the command by default, or the user identified by `--on-behalf-of` if provided. By
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Messages } from '@salesforce/core';
|
|
17
17
|
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { ApexTraceSetupError, DATE_TIME_PATTERN, parseOnBehalfOf, setupApexTrace, } from '@simplysf/simply-apex-core';
|
|
18
19
|
import { requireConnection, targetOrgFlags } from '@simplysf/simply-plugin-kit';
|
|
19
|
-
import { ApexTraceSetupError, DATE_TIME_PATTERN, parseOnBehalfOf, setupApexTrace, } from '../../../../common/apexTraceSetup.js';
|
|
20
20
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
21
21
|
const messages = Messages.loadMessages('@simplysf/simply-apex', 'simply.apex.trace.setup');
|
|
22
22
|
/** Maps `ApexTraceSetupError`'s structural codes to this command's own `Messages` catalog. */
|
|
@@ -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,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,
|
|
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,EACL,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,cAAc,GAGf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEhF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAA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AK,CAAC,QAAQ,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC,CAAC;wBACrE,MAAM;gBACV,CAAC;YACH,CAAC,CACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACpB,MAAM,KAAK,YAAY,mBAAmB,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACzE,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAEpB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;QAEzE,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
-
import { type ApexTraceSilenceResult } from '
|
|
3
|
-
export type { ApexTraceSilenceResult } from '
|
|
2
|
+
import { type ApexTraceSilenceResult } from '@simplysf/simply-apex-core';
|
|
3
|
+
export type { ApexTraceSilenceResult } from '@simplysf/simply-apex-core';
|
|
4
4
|
/**
|
|
5
5
|
* Creates or updates a 24-hour CLASS_TRACING trace flag with a fully suppressed (NONE) debug
|
|
6
6
|
* level for each specified Apex class, preventing those classes from generating debug log
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Messages } from '@salesforce/core';
|
|
17
17
|
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { ApexTraceSilenceError, resolveClasses, silenceApexClasses, } from '@simplysf/simply-apex-core';
|
|
18
19
|
import { requireConnection, targetOrgFlags } from '@simplysf/simply-plugin-kit';
|
|
19
|
-
import { ApexTraceSilenceError, resolveClasses, silenceApexClasses, } from '../../../../common/apexTraceSilence.js';
|
|
20
20
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
21
21
|
const messages = Messages.loadMessages('@simplysf/simply-apex', 'simply.apex.trace.silence');
|
|
22
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"silence.js","sourceRoot":"","sources":["../../../../../src/commands/simply/apex/trace/silence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"silence.js","sourceRoot":"","sources":["../../../../../src/commands/simply/apex/trace/silence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,kBAAkB,GAGnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEhF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,uBAAuB,EAAE,2BAA2B,CAAC,CAAC;AAI7F;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,SAAmC;IACxE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC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K,MAAM,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACvC,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,+BAA+B,CAAC;YAC5G,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACtE,CAAC;QAED,IAAI,CAAC,KAAK,CAAC;YACT,IAAI,EAAE,OAAO,CAAC,OAAO;YACrB,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,OAAO,CAAC;IACzB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Generate an Apex test suite from source.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Scans one or more source directories for Apex classes, keeps only the ones whose first meaningful line (skipping leading blank lines and comments) is an @IsTest annotation, and writes an ApexTestSuite metadata file listing them. Every run regenerates the file from scratch based on the current state of --source-dir; an existing file with the same name is always overwritten.
|
|
8
|
+
|
|
9
|
+
# flags.source-dir.summary
|
|
10
|
+
|
|
11
|
+
Directories to scan for Apex classes
|
|
12
|
+
|
|
13
|
+
# flags.source-dir.description
|
|
14
|
+
|
|
15
|
+
One or more directories to scan, recursively, for Apex classes. Only classes whose first meaningful line is an @IsTest annotation are included in the generated suite.
|
|
16
|
+
|
|
17
|
+
# flags.name.summary
|
|
18
|
+
|
|
19
|
+
API name for the test suite
|
|
20
|
+
|
|
21
|
+
# flags.name.description
|
|
22
|
+
|
|
23
|
+
The API name for the generated test suite; also used to derive the output filename, <name>.testSuite-meta.xml.
|
|
24
|
+
|
|
25
|
+
# flags.output-dir.summary
|
|
26
|
+
|
|
27
|
+
Output directory
|
|
28
|
+
|
|
29
|
+
# flags.output-dir.description
|
|
30
|
+
|
|
31
|
+
The directory to write the generated ApexTestSuite metadata file to. Not automatically suffixed with testSuites/ — pass that directory explicitly, e.g. force-app/main/default/testSuites.
|
|
32
|
+
|
|
33
|
+
# examples
|
|
34
|
+
|
|
35
|
+
- <%= config.bin %> <%= command.id %> --source-dir force-app/main/default/classes --name My_Suite --output-dir force-app/main/default/testSuites
|
|
36
|
+
|
|
37
|
+
- <%= config.bin %> <%= command.id %> --source-dir force-app/main/default/classes --source-dir force-app/extra/classes --name All_Tests --output-dir force-app/main/default/testSuites
|
|
38
|
+
|
|
39
|
+
# error.noTestClassesFound
|
|
40
|
+
|
|
41
|
+
No @IsTest-annotated classes were found in the given source director(y/ies).
|
|
42
|
+
|
|
43
|
+
# error.scanFailed
|
|
44
|
+
|
|
45
|
+
Failed to scan the given source director(y/ies): %s
|
|
46
|
+
|
|
47
|
+
# info.scanning
|
|
48
|
+
|
|
49
|
+
Scanning for @IsTest-annotated classes...
|
|
50
|
+
|
|
51
|
+
# info.fileGenerated
|
|
52
|
+
|
|
53
|
+
Test suite successfully generated at %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.8.1",
|
|
5
5
|
"author": "@ClayChipps",
|
|
6
6
|
"homepage": "https://github.com/SimplySF/simply-node",
|
|
7
7
|
"bugs": "https://github.com/SimplySF/simply-node/issues",
|
|
@@ -55,6 +55,9 @@
|
|
|
55
55
|
},
|
|
56
56
|
"trace": {
|
|
57
57
|
"description": "Commands for working with Apex trace flags"
|
|
58
|
+
},
|
|
59
|
+
"test-suite": {
|
|
60
|
+
"description": "Commands for working with Apex test suites"
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
}
|
|
@@ -65,16 +68,16 @@
|
|
|
65
68
|
},
|
|
66
69
|
"dependencies": {
|
|
67
70
|
"@oclif/core": "^4.11.2",
|
|
68
|
-
"@salesforce/apex-node": "^8.4.39",
|
|
69
71
|
"@salesforce/core": "^8.30.0",
|
|
70
72
|
"@salesforce/kit": "^3.2.6",
|
|
71
73
|
"@salesforce/sf-plugins-core": "^12.2.16",
|
|
74
|
+
"@simplysf/simply-apex-core": "^0.3.1",
|
|
72
75
|
"@simplysf/simply-core": "^1.5.1",
|
|
73
|
-
"@simplysf/simply-plugin-kit": "^1.0.4"
|
|
74
|
-
"zod": "^4.1.12"
|
|
76
|
+
"@simplysf/simply-plugin-kit": "^1.0.4"
|
|
75
77
|
},
|
|
76
78
|
"devDependencies": {
|
|
77
79
|
"@oclif/plugin-command-snapshot": "^5.4.0",
|
|
80
|
+
"@salesforce/apex-node": "^8.4.39",
|
|
78
81
|
"@salesforce/plugin-command-reference": "^3.1.99",
|
|
79
82
|
"@vitest/coverage-v8": "^4.1.10",
|
|
80
83
|
"vitest": "^4.1.10"
|
|
@@ -206,5 +209,5 @@
|
|
|
206
209
|
"output": []
|
|
207
210
|
}
|
|
208
211
|
},
|
|
209
|
-
"gitHead": "
|
|
212
|
+
"gitHead": "10d6af113422236dd24541f302db0288428e45c1"
|
|
210
213
|
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { Connection } from '@salesforce/core';
|
|
2
|
-
/** Compile/execution outcome for an anonymous Apex execution, including any debug logs produced. */
|
|
3
|
-
export type ApexExecuteResult = {
|
|
4
|
-
success: boolean;
|
|
5
|
-
compiled: boolean;
|
|
6
|
-
compileProblem: string;
|
|
7
|
-
exceptionMessage: string;
|
|
8
|
-
exceptionStackTrace: string;
|
|
9
|
-
line: number;
|
|
10
|
-
column: number;
|
|
11
|
-
logs?: string;
|
|
12
|
-
};
|
|
13
|
-
/** The error conditions `executeApex` signals structurally (via `code`) rather than by message text, so a `Messages`-based caller (the CLI) can map each one to its own error key without string-matching. */
|
|
14
|
-
export type ApexExecuteErrorCode = 'compile-failed' | 'execute-failed';
|
|
15
|
-
export declare class ApexExecuteError extends Error {
|
|
16
|
-
readonly code: ApexExecuteErrorCode;
|
|
17
|
-
readonly result: ApexExecuteResult;
|
|
18
|
-
constructor(code: ApexExecuteErrorCode, message: string, result: ApexExecuteResult);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Executes an anonymous block of Apex code from a local file against `connection` and returns the
|
|
22
|
-
* compile/execution result, including any debug logs produced.
|
|
23
|
-
*
|
|
24
|
-
* @param connection - The org connection to execute against.
|
|
25
|
-
* @param apexFilePath - Path to the local `.apex` file to execute.
|
|
26
|
-
* @returns The compile/execution result.
|
|
27
|
-
* @throws {ApexExecuteError} `compile-failed` if the Apex didn't compile, `execute-failed` if it
|
|
28
|
-
* compiled but threw during execution. Either way, `error.result` carries the full result so a
|
|
29
|
-
* caller can still inspect line/column/logs.
|
|
30
|
-
*/
|
|
31
|
-
export declare function executeApex(connection: Connection, apexFilePath: string): Promise<ApexExecuteResult>;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2026, Clay Chipps.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { ExecuteService } from '@salesforce/apex-node';
|
|
17
|
-
export class ApexExecuteError extends Error {
|
|
18
|
-
code;
|
|
19
|
-
result;
|
|
20
|
-
constructor(code, message, result) {
|
|
21
|
-
super(message);
|
|
22
|
-
this.name = 'ApexExecuteError';
|
|
23
|
-
this.code = code;
|
|
24
|
-
this.result = result;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Executes an anonymous block of Apex code from a local file against `connection` and returns the
|
|
29
|
-
* compile/execution result, including any debug logs produced.
|
|
30
|
-
*
|
|
31
|
-
* @param connection - The org connection to execute against.
|
|
32
|
-
* @param apexFilePath - Path to the local `.apex` file to execute.
|
|
33
|
-
* @returns The compile/execution result.
|
|
34
|
-
* @throws {ApexExecuteError} `compile-failed` if the Apex didn't compile, `execute-failed` if it
|
|
35
|
-
* compiled but threw during execution. Either way, `error.result` carries the full result so a
|
|
36
|
-
* caller can still inspect line/column/logs.
|
|
37
|
-
*/
|
|
38
|
-
export async function executeApex(connection, apexFilePath) {
|
|
39
|
-
const executeService = new ExecuteService(connection);
|
|
40
|
-
const response = await executeService.executeAnonymous({ apexFilePath });
|
|
41
|
-
const diagnostic = response.diagnostic?.[0];
|
|
42
|
-
const result = {
|
|
43
|
-
success: response.success,
|
|
44
|
-
compiled: response.compiled,
|
|
45
|
-
compileProblem: diagnostic?.compileProblem ?? '',
|
|
46
|
-
exceptionMessage: diagnostic?.exceptionMessage ?? '',
|
|
47
|
-
exceptionStackTrace: diagnostic?.exceptionStackTrace ?? '',
|
|
48
|
-
line: diagnostic?.lineNumber ?? -1,
|
|
49
|
-
column: diagnostic?.columnNumber ?? -1,
|
|
50
|
-
logs: response.logs,
|
|
51
|
-
};
|
|
52
|
-
if (!response.compiled) {
|
|
53
|
-
throw new ApexExecuteError('compile-failed', `Compile failed at line ${result.line}, column ${result.column}: ${result.compileProblem}`, result);
|
|
54
|
-
}
|
|
55
|
-
if (!response.success) {
|
|
56
|
-
throw new ApexExecuteError('execute-failed', `Execution failed: ${result.exceptionMessage}`, result);
|
|
57
|
-
}
|
|
58
|
-
return result;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=apexExecute.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apexExecute.js","sourceRoot":"","sources":["../../src/common/apexExecute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAiBvD,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzB,IAAI,CAAuB;IAC3B,MAAM,CAAoB;IAE1C,YAAmB,IAA0B,EAAE,OAAe,EAAE,MAAyB;QACvF,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,UAAsB,EAAE,YAAoB;IAC5E,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,UAAU,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,gBAAgB,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;IAEzE,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAsB;QAChC,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,cAAc,EAAE,UAAU,EAAE,cAAc,IAAI,EAAE;QAChD,gBAAgB,EAAE,UAAU,EAAE,gBAAgB,IAAI,EAAE;QACpD,mBAAmB,EAAE,UAAU,EAAE,mBAAmB,IAAI,EAAE;QAC1D,IAAI,EAAE,UAAU,EAAE,UAAU,IAAI,CAAC,CAAC;QAClC,MAAM,EAAE,UAAU,EAAE,YAAY,IAAI,CAAC,CAAC;QACtC,IAAI,EAAE,QAAQ,CAAC,IAAI;KACpB,CAAC;IAEF,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACvB,MAAM,IAAI,gBAAgB,CACxB,gBAAgB,EAChB,0BAA0B,MAAM,CAAC,IAAI,YAAY,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,cAAc,EAAE,EAC1F,MAAM,CACP,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACtB,MAAM,IAAI,gBAAgB,CAAC,gBAAgB,EAAE,qBAAqB,MAAM,CAAC,gBAAgB,EAAE,EAAE,MAAM,CAAC,CAAC;IACvG,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { Connection } from '@salesforce/core';
|
|
2
|
-
/** Outcome of deleting a single `ApexLog` record. */
|
|
3
|
-
export type ApexLogsPurgeResult = {
|
|
4
|
-
Id: string;
|
|
5
|
-
Success: boolean;
|
|
6
|
-
Error?: string;
|
|
7
|
-
};
|
|
8
|
-
/** @returns Every `ApexLog` Id matched by `query` (a full SOQL statement), via the Tooling API, which returns them in a single response. */
|
|
9
|
-
export declare function queryApexLogIdsViaRest(connection: Connection, query: string): Promise<string[]>;
|
|
10
|
-
/**
|
|
11
|
-
* @returns Every `ApexLog` Id matched by `query` (a full SOQL statement), via a Bulk API v2 query
|
|
12
|
-
* job. The job streams CSV back, so the IDs are gathered from the record stream rather than a
|
|
13
|
-
* single response body.
|
|
14
|
-
*/
|
|
15
|
-
export declare function queryApexLogIdsViaBulkApi(connection: Connection, query: string, pollTimeout: number): Promise<string[]>;
|
|
16
|
-
/**
|
|
17
|
-
* Deletes `ApexLog` records through the core connection's SObject Collections resource, 200
|
|
18
|
-
* records per call.
|
|
19
|
-
*
|
|
20
|
-
* Deliberately not `.tooling`: `ApexLog` is exposed on both APIs, but only core REST implements
|
|
21
|
-
* the Collections resource a bulk delete needs. `/tooling/composite/sobjects` does not exist and
|
|
22
|
-
* answers 404 "The requested resource does not exist".
|
|
23
|
-
*
|
|
24
|
-
* @param onChunkComplete - Called after each 200-record chunk is deleted, with the running total —
|
|
25
|
-
* a caller (the CLI) can use this to update a progress indicator. Optional; has no effect on the
|
|
26
|
-
* delete itself.
|
|
27
|
-
*/
|
|
28
|
-
export declare function deleteApexLogsViaCollections(connection: Connection, logIds: string[], onChunkComplete?: (purged: number, total: number) => void): Promise<ApexLogsPurgeResult[]>;
|
|
29
|
-
/**
|
|
30
|
-
* Deletes `ApexLog` records through a Bulk API v2 ingest job. The whole set goes up as one job
|
|
31
|
-
* rather than in 200-record chunks, and the org processes it asynchronously without spending REST
|
|
32
|
-
* request limit.
|
|
33
|
-
*/
|
|
34
|
-
export declare function deleteApexLogsViaBulkApi(connection: Connection, logIds: string[], pollTimeout: number): Promise<ApexLogsPurgeResult[]>;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2026, Clay Chipps.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { chunk } from '@simplysf/simply-core';
|
|
17
|
-
/**
|
|
18
|
-
* Maximum number of `ApexLog` records to delete per SObject Collections call, which is the API's
|
|
19
|
-
* own ceiling and matches jsforce's `MAX_DML_COUNT`.
|
|
20
|
-
*/
|
|
21
|
-
const CHUNK_SIZE = 200;
|
|
22
|
-
/** @returns Every `ApexLog` Id matched by `query` (a full SOQL statement), via the Tooling API, which returns them in a single response. */
|
|
23
|
-
export async function queryApexLogIdsViaRest(connection, query) {
|
|
24
|
-
const queryResult = await connection.tooling.query(query);
|
|
25
|
-
return queryResult.records.map((record) => record.Id);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* @returns Every `ApexLog` Id matched by `query` (a full SOQL statement), via a Bulk API v2 query
|
|
29
|
-
* job. The job streams CSV back, so the IDs are gathered from the record stream rather than a
|
|
30
|
-
* single response body.
|
|
31
|
-
*/
|
|
32
|
-
export async function queryApexLogIdsViaBulkApi(connection, query, pollTimeout) {
|
|
33
|
-
const recordStream = await connection.bulk2.query(query, { pollTimeout });
|
|
34
|
-
const logIds = [];
|
|
35
|
-
for await (const record of recordStream) {
|
|
36
|
-
const { Id: id } = record;
|
|
37
|
-
if (id) {
|
|
38
|
-
logIds.push(id);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return logIds;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Deletes `ApexLog` records through the core connection's SObject Collections resource, 200
|
|
45
|
-
* records per call.
|
|
46
|
-
*
|
|
47
|
-
* Deliberately not `.tooling`: `ApexLog` is exposed on both APIs, but only core REST implements
|
|
48
|
-
* the Collections resource a bulk delete needs. `/tooling/composite/sobjects` does not exist and
|
|
49
|
-
* answers 404 "The requested resource does not exist".
|
|
50
|
-
*
|
|
51
|
-
* @param onChunkComplete - Called after each 200-record chunk is deleted, with the running total —
|
|
52
|
-
* a caller (the CLI) can use this to update a progress indicator. Optional; has no effect on the
|
|
53
|
-
* delete itself.
|
|
54
|
-
*/
|
|
55
|
-
export async function deleteApexLogsViaCollections(connection, logIds, onChunkComplete) {
|
|
56
|
-
const results = [];
|
|
57
|
-
let purged = 0;
|
|
58
|
-
for (const idChunk of chunk(logIds, CHUNK_SIZE)) {
|
|
59
|
-
// eslint-disable-next-line no-await-in-loop -- batches are sequential so progress reporting tracks real progress
|
|
60
|
-
const deleteResults = await connection.delete('ApexLog', idChunk);
|
|
61
|
-
const deleteResultsArray = Array.isArray(deleteResults) ? deleteResults : [deleteResults];
|
|
62
|
-
deleteResultsArray.forEach((deleteResult, index) => {
|
|
63
|
-
results.push({
|
|
64
|
-
Id: deleteResult.id ?? idChunk[index] ?? 'unknown',
|
|
65
|
-
Success: deleteResult.success,
|
|
66
|
-
Error: deleteResult.success ? undefined : deleteResult.errors.map((e) => e.message).join(', '),
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
purged += idChunk.length;
|
|
70
|
-
onChunkComplete?.(purged, logIds.length);
|
|
71
|
-
}
|
|
72
|
-
return results;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Deletes `ApexLog` records through a Bulk API v2 ingest job. The whole set goes up as one job
|
|
76
|
-
* rather than in 200-record chunks, and the org processes it asynchronously without spending REST
|
|
77
|
-
* request limit.
|
|
78
|
-
*/
|
|
79
|
-
export async function deleteApexLogsViaBulkApi(connection, logIds, pollTimeout) {
|
|
80
|
-
const { successfulResults, failedResults } = await connection.bulk2.loadAndWaitForResults({
|
|
81
|
-
object: 'ApexLog',
|
|
82
|
-
operation: 'delete',
|
|
83
|
-
input: logIds.map((Id) => ({ Id })),
|
|
84
|
-
pollTimeout,
|
|
85
|
-
});
|
|
86
|
-
return [
|
|
87
|
-
...successfulResults.map((result) => ({ Id: result.sf__Id, Success: true })),
|
|
88
|
-
...failedResults.map((result) => {
|
|
89
|
-
// A failed row reports an empty (not absent) `sf__Id`; the submitted `Id` column is echoed
|
|
90
|
-
// back alongside it, so prefer that to keep every failure traceable to a specific log.
|
|
91
|
-
const submittedId = result.Id;
|
|
92
|
-
return {
|
|
93
|
-
Id: result.sf__Id.length > 0 ? result.sf__Id : (submittedId ?? 'unknown'),
|
|
94
|
-
Success: false,
|
|
95
|
-
Error: result.sf__Error,
|
|
96
|
-
};
|
|
97
|
-
}),
|
|
98
|
-
];
|
|
99
|
-
}
|
|
100
|
-
//# sourceMappingURL=apexLogsPurge.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apexLogsPurge.js","sourceRoot":"","sources":["../../src/common/apexLogsPurge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAS9C;;;GAGG;AACH,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB,4IAA4I;AAC5I,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,UAAsB,EAAE,KAAa;IAChF,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,KAAK,CAAiB,KAAK,CAAC,CAAC;IAC1E,OAAO,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,UAAsB,EACtB,KAAa,EACb,WAAmB;IAEnB,MAAM,YAAY,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;IAC1E,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI,YAAY,EAAE,CAAC;QACxC,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,MAAyB,CAAC;QAC7C,IAAI,EAAE,EAAE,CAAC;YACP,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,UAAsB,EACtB,MA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,SAAS,EAAE,QAAQ;QACnB,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACnC,WAAW;KACZ,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5E,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YAC9B,2FAA2F;YAC3F,uFAAuF;YACvF,MAAM,WAAW,GAAI,MAA0B,CAAC,EAAE,CAAC;YACnD,OAAO;gBACL,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,SAAS,CAAC;gBACzE,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,MAAM,CAAC,SAAS;aACxB,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { Connection } from '@salesforce/core';
|
|
2
|
-
/** Matches the ISO 8601 date-time format `--start-date`/`--end-date` require. */
|
|
3
|
-
export declare const DATE_TIME_PATTERN: RegExp;
|
|
4
|
-
/**
|
|
5
|
-
* Matches `Field:Value` for `--on-behalf-of`. The field name is restricted to safe SOQL identifier
|
|
6
|
-
* characters since, unlike the value, it can't be quoted/escaped in the query.
|
|
7
|
-
*/
|
|
8
|
-
export declare const ON_BEHALF_OF_PATTERN: RegExp;
|
|
9
|
-
/** A `Field:Value` pair identifying the user to configure the trace flag for. */
|
|
10
|
-
export type OnBehalfOf = {
|
|
11
|
-
field: string;
|
|
12
|
-
value: string;
|
|
13
|
-
};
|
|
14
|
-
/** @returns `input` parsed as a `Field:Value` pair, or `undefined` if it doesn't match `ON_BEHALF_OF_PATTERN`. */
|
|
15
|
-
export declare function parseOnBehalfOf(input: string): OnBehalfOf | undefined;
|
|
16
|
-
export type ApexTraceSetupOptions = {
|
|
17
|
-
/** Field:Value pair identifying the target user. Defaults to the connection's own username. */
|
|
18
|
-
onBehalfOf?: OnBehalfOf;
|
|
19
|
-
/** DebugLevel DeveloperName to use. Defaults to (and, if absent, creates) `ReplayDebuggerLevels`. */
|
|
20
|
-
logLevel?: string;
|
|
21
|
-
/** ISO 8601 date-time. Defaults to now. */
|
|
22
|
-
startDate?: string;
|
|
23
|
-
/** ISO 8601 date-time. Defaults to 24 hours after `startDate`. */
|
|
24
|
-
endDate?: string;
|
|
25
|
-
};
|
|
26
|
-
/** IDs of the debug level and trace flag configured for the target user, and when it expires. */
|
|
27
|
-
export type ApexTraceSetupResult = {
|
|
28
|
-
userId: string;
|
|
29
|
-
debugLevelId: string;
|
|
30
|
-
traceFlagId: string;
|
|
31
|
-
expirationDate: string;
|
|
32
|
-
};
|
|
33
|
-
/** The error conditions `setupApexTrace` signals structurally (via `code`) rather than by message text, so a `Messages`-based caller (the CLI) can map each one to its own error key without string-matching. */
|
|
34
|
-
export type ApexTraceSetupErrorCode = 'user-not-found' | 'ambiguous-on-behalf-of' | 'debug-level-not-found' | 'debug-level-create-failed' | 'trace-flag-create-failed' | 'invalid-date-range';
|
|
35
|
-
export declare class ApexTraceSetupError extends Error {
|
|
36
|
-
readonly code: ApexTraceSetupErrorCode;
|
|
37
|
-
/** The raw values a `Messages`-based caller needs to reproduce its own error text (e.g. `[userIdentifier]`, `[expirationDate, startDate]`) — not necessarily the same as `message`, which is this error's own human-readable text. */
|
|
38
|
-
readonly args: string[];
|
|
39
|
-
constructor(code: ApexTraceSetupErrorCode, message: string, args?: string[]);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Creates or updates a DEVELOPER_LOG trace flag for a target user. The target user is the one
|
|
43
|
-
* `connection` authenticates as by default, or the user identified by `options.onBehalfOf` if
|
|
44
|
-
* given. By default the trace flag uses the FINEST/FINER `ReplayDebuggerLevels` debug level
|
|
45
|
-
* suitable for the Apex Replay Debugger and runs for 24 hours starting now;
|
|
46
|
-
* `options.logLevel`/`startDate`/`endDate` override those defaults.
|
|
47
|
-
*
|
|
48
|
-
* @param connection - The org connection to configure the trace flag in.
|
|
49
|
-
* @param options - See `ApexTraceSetupOptions`.
|
|
50
|
-
* @param onPhase - Called as each of the three phases (finding the user, checking the debug
|
|
51
|
-
* level, configuring the trace flag) starts — a caller (the CLI) can use this to update a
|
|
52
|
-
* spinner. Optional; has no effect on the operation itself.
|
|
53
|
-
* @returns The IDs of the debug level and trace flag that were created or updated, and the trace
|
|
54
|
-
* flag's new expiration date.
|
|
55
|
-
* @throws {ApexTraceSetupError} See `ApexTraceSetupErrorCode`.
|
|
56
|
-
*/
|
|
57
|
-
export declare function setupApexTrace(connection: Connection, options?: ApexTraceSetupOptions, onPhase?: (phase: 'finding-user' | 'checking-debug-level' | 'configuring-trace-flag') => void): Promise<ApexTraceSetupResult>;
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2026, Clay Chipps.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { escapeSoqlLiteral } from '@simplysf/simply-core';
|
|
17
|
-
/** DeveloperName used for the FINEST/FINER debug level created for the Apex Replay Debugger. */
|
|
18
|
-
const DEBUG_LEVEL_NAME = 'ReplayDebuggerLevels';
|
|
19
|
-
/** How long a configured trace flag stays active before expiring, in milliseconds (24 hours). */
|
|
20
|
-
const TRACE_DURATION_MS = 24 * 60 * 60 * 1000;
|
|
21
|
-
/** Matches the ISO 8601 date-time format `--start-date`/`--end-date` require. */
|
|
22
|
-
export const DATE_TIME_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/;
|
|
23
|
-
/**
|
|
24
|
-
* Matches `Field:Value` for `--on-behalf-of`. The field name is restricted to safe SOQL identifier
|
|
25
|
-
* characters since, unlike the value, it can't be quoted/escaped in the query.
|
|
26
|
-
*/
|
|
27
|
-
export const ON_BEHALF_OF_PATTERN = /^([A-Za-z_][A-Za-z0-9_]*):(.+)$/;
|
|
28
|
-
/** @returns `input` parsed as a `Field:Value` pair, or `undefined` if it doesn't match `ON_BEHALF_OF_PATTERN`. */
|
|
29
|
-
export function parseOnBehalfOf(input) {
|
|
30
|
-
const match = ON_BEHALF_OF_PATTERN.exec(input);
|
|
31
|
-
if (!match) {
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
const [, field, value] = match;
|
|
35
|
-
return { field, value };
|
|
36
|
-
}
|
|
37
|
-
export class ApexTraceSetupError extends Error {
|
|
38
|
-
code;
|
|
39
|
-
/** The raw values a `Messages`-based caller needs to reproduce its own error text (e.g. `[userIdentifier]`, `[expirationDate, startDate]`) — not necessarily the same as `message`, which is this error's own human-readable text. */
|
|
40
|
-
args;
|
|
41
|
-
constructor(code, message, args = [message]) {
|
|
42
|
-
super(message);
|
|
43
|
-
this.name = 'ApexTraceSetupError';
|
|
44
|
-
this.code = code;
|
|
45
|
-
this.args = args;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/** @returns The Id of the single user matching `onBehalfOf` (or `connection`'s own username if `onBehalfOf` is absent). @throws {ApexTraceSetupError} `user-not-found`/`ambiguous-on-behalf-of`. */
|
|
49
|
-
async function findTraceTargetUserId(connection, onBehalfOf) {
|
|
50
|
-
const userFilterField = onBehalfOf?.field ?? 'Username';
|
|
51
|
-
const userFilterValue = onBehalfOf?.value ?? connection.getUsername() ?? '';
|
|
52
|
-
const userIdentifier = onBehalfOf ? `${onBehalfOf.field}:${onBehalfOf.value}` : userFilterValue;
|
|
53
|
-
const userQueryResult = await connection.query(`SELECT Id FROM User WHERE ${userFilterField} = '${escapeSoqlLiteral(userFilterValue)}' LIMIT 2`);
|
|
54
|
-
if (userQueryResult.records.length === 0) {
|
|
55
|
-
throw new ApexTraceSetupError('user-not-found', `No user found matching "${userIdentifier}".`, [userIdentifier]);
|
|
56
|
-
}
|
|
57
|
-
if (userQueryResult.records.length > 1) {
|
|
58
|
-
throw new ApexTraceSetupError('ambiguous-on-behalf-of', `More than one user matches "${userIdentifier}".`, [
|
|
59
|
-
userIdentifier,
|
|
60
|
-
]);
|
|
61
|
-
}
|
|
62
|
-
return userQueryResult.records[0].Id;
|
|
63
|
-
}
|
|
64
|
-
/** @returns The Id of `requestedLogLevel` if given (must already exist), or the shared `ReplayDebuggerLevels` debug level's Id (created if absent). @throws {ApexTraceSetupError} `debug-level-not-found`/`debug-level-create-failed`. */
|
|
65
|
-
async function findOrCreateDebugLevel(connection, requestedLogLevel) {
|
|
66
|
-
const debugLevelName = requestedLogLevel ?? DEBUG_LEVEL_NAME;
|
|
67
|
-
const debugLevelResult = await connection.tooling.query(`SELECT Id FROM DebugLevel WHERE DeveloperName = '${debugLevelName}'`);
|
|
68
|
-
if (debugLevelResult.records.length > 0) {
|
|
69
|
-
return debugLevelResult.records[0].Id;
|
|
70
|
-
}
|
|
71
|
-
if (requestedLogLevel) {
|
|
72
|
-
throw new ApexTraceSetupError('debug-level-not-found', `No DebugLevel named "${debugLevelName}" was found.`, [
|
|
73
|
-
debugLevelName,
|
|
74
|
-
]);
|
|
75
|
-
}
|
|
76
|
-
const createResult = await connection.tooling.sobject('DebugLevel').create({
|
|
77
|
-
DeveloperName: DEBUG_LEVEL_NAME,
|
|
78
|
-
MasterLabel: DEBUG_LEVEL_NAME,
|
|
79
|
-
ApexCode: 'FINEST',
|
|
80
|
-
Visualforce: 'FINER',
|
|
81
|
-
});
|
|
82
|
-
if (!createResult.success) {
|
|
83
|
-
throw new ApexTraceSetupError('debug-level-create-failed', createResult.errors.map((e) => e.message).join(', '));
|
|
84
|
-
}
|
|
85
|
-
return createResult.id;
|
|
86
|
-
}
|
|
87
|
-
/** @returns The Id and expiration date of the DEVELOPER_LOG trace flag created/updated for `userId`. @throws {ApexTraceSetupError} `invalid-date-range`/`trace-flag-create-failed`. */
|
|
88
|
-
async function findOrUpdateTraceFlag(connection, userId, debugLevelId, options) {
|
|
89
|
-
const traceFlagResult = await connection.tooling.query(`SELECT Id FROM TraceFlag WHERE LogType = 'DEVELOPER_LOG' AND TracedEntityId = '${userId}'`);
|
|
90
|
-
const startDate = options.startDate ?? new Date().toISOString();
|
|
91
|
-
const expirationDate = options.endDate ?? new Date(new Date(startDate).getTime() + TRACE_DURATION_MS).toISOString();
|
|
92
|
-
if (new Date(expirationDate).getTime() <= new Date(startDate).getTime()) {
|
|
93
|
-
throw new ApexTraceSetupError('invalid-date-range', `The end date (${expirationDate}) must be after the start date (${startDate}).`, [expirationDate, startDate]);
|
|
94
|
-
}
|
|
95
|
-
if (traceFlagResult.records.length > 0) {
|
|
96
|
-
const traceFlagId = traceFlagResult.records[0].Id;
|
|
97
|
-
await connection.tooling.sobject('TraceFlag').update({
|
|
98
|
-
Id: traceFlagId,
|
|
99
|
-
DebugLevelId: debugLevelId,
|
|
100
|
-
StartDate: startDate,
|
|
101
|
-
ExpirationDate: expirationDate,
|
|
102
|
-
});
|
|
103
|
-
return { traceFlagId, expirationDate };
|
|
104
|
-
}
|
|
105
|
-
const createResult = await connection.tooling.sobject('TraceFlag').create({
|
|
106
|
-
TracedEntityId: userId,
|
|
107
|
-
LogType: 'DEVELOPER_LOG',
|
|
108
|
-
DebugLevelId: debugLevelId,
|
|
109
|
-
StartDate: startDate,
|
|
110
|
-
ExpirationDate: expirationDate,
|
|
111
|
-
});
|
|
112
|
-
if (!createResult.success) {
|
|
113
|
-
throw new ApexTraceSetupError('trace-flag-create-failed', createResult.errors.map((e) => e.message).join(', '));
|
|
114
|
-
}
|
|
115
|
-
return { traceFlagId: createResult.id, expirationDate };
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Creates or updates a DEVELOPER_LOG trace flag for a target user. The target user is the one
|
|
119
|
-
* `connection` authenticates as by default, or the user identified by `options.onBehalfOf` if
|
|
120
|
-
* given. By default the trace flag uses the FINEST/FINER `ReplayDebuggerLevels` debug level
|
|
121
|
-
* suitable for the Apex Replay Debugger and runs for 24 hours starting now;
|
|
122
|
-
* `options.logLevel`/`startDate`/`endDate` override those defaults.
|
|
123
|
-
*
|
|
124
|
-
* @param connection - The org connection to configure the trace flag in.
|
|
125
|
-
* @param options - See `ApexTraceSetupOptions`.
|
|
126
|
-
* @param onPhase - Called as each of the three phases (finding the user, checking the debug
|
|
127
|
-
* level, configuring the trace flag) starts — a caller (the CLI) can use this to update a
|
|
128
|
-
* spinner. Optional; has no effect on the operation itself.
|
|
129
|
-
* @returns The IDs of the debug level and trace flag that were created or updated, and the trace
|
|
130
|
-
* flag's new expiration date.
|
|
131
|
-
* @throws {ApexTraceSetupError} See `ApexTraceSetupErrorCode`.
|
|
132
|
-
*/
|
|
133
|
-
export async function setupApexTrace(connection, options = {}, onPhase) {
|
|
134
|
-
onPhase?.('finding-user');
|
|
135
|
-
const userId = await findTraceTargetUserId(connection, options.onBehalfOf);
|
|
136
|
-
onPhase?.('checking-debug-level');
|
|
137
|
-
const debugLevelId = await findOrCreateDebugLevel(connection, options.logLevel);
|
|
138
|
-
onPhase?.('configuring-trace-flag');
|
|
139
|
-
const { traceFlagId, expirationDate } = await findOrUpdateTraceFlag(connection, userId, debugLevelId, options);
|
|
140
|
-
return { userId, debugLevelId, traceFlagId, expirationDate };
|
|
141
|
-
}
|
|
142
|
-
//# sourceMappingURL=apexTraceSetup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apexTraceSetup.js","sourceRoot":"","sources":["../../src/common/apexTraceSetup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,gGAAgG;AAChG,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAChD,iGAAiG;AACjG,MAAM,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC9C,iFAAiF;AACjF,MAAM,CAAC,MAAM,iBAAiB,GAAG,gDAAgD,CAAC;AAClF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,iCAAiC,CAAC;AAKtE,kHAAkH;AAClH,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC;IAC/B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC1B,CAAC;AA8BD,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5B,IAAI,CAA0B;IAC9C,sOAAsO;IACtN,IAAI,CAAW;IAE/B,YAAmB,IAA6B,EAAE,OAAe,EAAE,OAAiB,CAAC,OAAO,CAAC;QAC3F,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,oMAAoM;AACpM,KAAK,UAA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,EAAE,CAAC,cAAc,CAAC,CAAC;IAC1B,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE3E,OAAO,EAAE,CAAC,sBAAsB,CAAC,CAAC;IAClC,MAAM,YAAY,GAAG,MAAM,sBAAsB,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEhF,OAAO,EAAE,CAAC,wBAAwB,CAAC,CAAC;IACpC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,MAAM,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IAE/G,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;AAC/D,CAAC"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { Connection } from '@salesforce/core';
|
|
2
|
-
/** Classes silenced by the `fflib` preset. */
|
|
3
|
-
export declare const FFLIB_CLASSES: string[];
|
|
4
|
-
/** Classes silenced by the `at4dx` preset. */
|
|
5
|
-
export declare const AT4DX_CLASSES: string[];
|
|
6
|
-
/** Classes silenced by the `forceDi` preset. */
|
|
7
|
-
export declare const FORCE_DI_CLASSES: string[];
|
|
8
|
-
/** The trace flag created to silence debug logs for a single Apex class. */
|
|
9
|
-
export type ApexTraceSilenceResult = {
|
|
10
|
-
class: string;
|
|
11
|
-
classId: string;
|
|
12
|
-
traceFlagId: string;
|
|
13
|
-
};
|
|
14
|
-
/** Everything `silenceApexClasses` found out along the way, beyond the classes it actually silenced — for a CLI (or other) caller to report however it likes. */
|
|
15
|
-
export type ApexTraceSilenceOutcome = {
|
|
16
|
-
results: ApexTraceSilenceResult[];
|
|
17
|
-
/** Requested class names that don't exist as an `ApexClass` in the org. */
|
|
18
|
-
missingClassNames: string[];
|
|
19
|
-
/** A class that was found but whose trace flag couldn't be created/updated, with the API's error text and which of the two operations was attempted. */
|
|
20
|
-
failures: Array<{
|
|
21
|
-
class: string;
|
|
22
|
-
action: 'create' | 'update';
|
|
23
|
-
error: string;
|
|
24
|
-
}>;
|
|
25
|
-
};
|
|
26
|
-
/** The error conditions `resolveClasses`/`silenceApexClasses` signal structurally (via `code`) rather than by message text, so a `Messages`-based caller (the CLI) can map each one to its own error key without string-matching. */
|
|
27
|
-
export type ApexTraceSilenceErrorCode = 'invalid-classes-file' | 'no-classes-specified' | 'debug-level-create-failed';
|
|
28
|
-
export declare class ApexTraceSilenceError extends Error {
|
|
29
|
-
readonly code: ApexTraceSilenceErrorCode;
|
|
30
|
-
constructor(code: ApexTraceSilenceErrorCode, message: string);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Resolve the list of Apex class names to silence from an explicit list, a classes-file path (a
|
|
34
|
-
* JSON config matching {@link ClassesToSilenceSchema}), and the `fflib`/`at4dx`/`forceDi` built-in
|
|
35
|
-
* presets. All sources are combined and deduplicated.
|
|
36
|
-
*
|
|
37
|
-
* @param classNames - Explicit class names (e.g. from a `--classes` flag already split on commas).
|
|
38
|
-
* @param classesFilePath - Path to a JSON config file, if one was given.
|
|
39
|
-
* @param presets - Which of the built-in class presets were requested.
|
|
40
|
-
* @returns The resolved, trimmed, deduplicated list of Apex class names.
|
|
41
|
-
* @throws {ApexTraceSilenceError} `invalid-classes-file` if `classesFilePath` was given but fails
|
|
42
|
-
* schema validation.
|
|
43
|
-
*/
|
|
44
|
-
export declare function resolveClasses(classNames: string[], classesFilePath: string | undefined, presets: {
|
|
45
|
-
fflib: boolean;
|
|
46
|
-
at4dx: boolean;
|
|
47
|
-
forceDi: boolean;
|
|
48
|
-
}): string[];
|
|
49
|
-
/**
|
|
50
|
-
* Creates or updates a 24-hour CLASS_TRACING trace flag with a fully suppressed (NONE) debug level
|
|
51
|
-
* for each of `classNames`, preventing those classes from generating debug log output. A class
|
|
52
|
-
* that already has a trace flag has its expiration extended instead of getting a duplicate.
|
|
53
|
-
*
|
|
54
|
-
* @param connection - The org connection to silence classes in.
|
|
55
|
-
* @param classNames - The Apex class names to silence — see `resolveClasses`.
|
|
56
|
-
* @param onPhase - Called as each of the three phases (checking the debug level, finding the
|
|
57
|
-
* classes, writing trace flags) starts — a caller (the CLI) can use this to update a spinner.
|
|
58
|
-
* Optional; has no effect on the operation itself.
|
|
59
|
-
* @returns The trace flag created/updated per successfully-silenced class, plus any class names
|
|
60
|
-
* that don't exist in the org and any per-class create/update failures.
|
|
61
|
-
* @throws {ApexTraceSilenceError} `no-classes-specified` if `classNames` is empty,
|
|
62
|
-
* `debug-level-create-failed` if the shared `Silence` debug level doesn't exist yet and couldn't be
|
|
63
|
-
* created.
|
|
64
|
-
*/
|
|
65
|
-
export declare function silenceApexClasses(connection: Connection, classNames: string[], onPhase?: (phase: 'checking-debug-level' | 'finding-classes' | 'creating-trace-flags') => void): Promise<ApexTraceSilenceOutcome>;
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2026, Clay Chipps.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { loadJsonConfigSync } from '@simplysf/simply-core';
|
|
17
|
-
import { ClassesToSilenceSchema } from './schemas/classesToSilence.js';
|
|
18
|
-
/** DeveloperName used for the fully-suppressed (NONE) debug level created for class silencing. */
|
|
19
|
-
const DEBUG_LEVEL_NAME = 'Silence';
|
|
20
|
-
/** How long a configured trace flag stays active before expiring, in milliseconds (24 hours). */
|
|
21
|
-
const TRACE_DURATION_MS = 24 * 60 * 60 * 1000;
|
|
22
|
-
/** Classes silenced by the `fflib` preset. */
|
|
23
|
-
export const FFLIB_CLASSES = ['fflib_SObjectDescribe', 'fflib_SObjectDomain'];
|
|
24
|
-
/** Classes silenced by the `at4dx` preset. */
|
|
25
|
-
export const AT4DX_CLASSES = ['ApplicationSObjectDomain'];
|
|
26
|
-
/** Classes silenced by the `forceDi` preset. */
|
|
27
|
-
export const FORCE_DI_CLASSES = ['di_Binding', 'di_Module', 'di_PlatformCache', 'di_Injector'];
|
|
28
|
-
export class ApexTraceSilenceError extends Error {
|
|
29
|
-
code;
|
|
30
|
-
constructor(code, message) {
|
|
31
|
-
super(message);
|
|
32
|
-
this.name = 'ApexTraceSilenceError';
|
|
33
|
-
this.code = code;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Resolve the list of Apex class names to silence from an explicit list, a classes-file path (a
|
|
38
|
-
* JSON config matching {@link ClassesToSilenceSchema}), and the `fflib`/`at4dx`/`forceDi` built-in
|
|
39
|
-
* presets. All sources are combined and deduplicated.
|
|
40
|
-
*
|
|
41
|
-
* @param classNames - Explicit class names (e.g. from a `--classes` flag already split on commas).
|
|
42
|
-
* @param classesFilePath - Path to a JSON config file, if one was given.
|
|
43
|
-
* @param presets - Which of the built-in class presets were requested.
|
|
44
|
-
* @returns The resolved, trimmed, deduplicated list of Apex class names.
|
|
45
|
-
* @throws {ApexTraceSilenceError} `invalid-classes-file` if `classesFilePath` was given but fails
|
|
46
|
-
* schema validation.
|
|
47
|
-
*/
|
|
48
|
-
export function resolveClasses(classNames, classesFilePath, presets) {
|
|
49
|
-
const classes = [...classNames];
|
|
50
|
-
if (classesFilePath) {
|
|
51
|
-
const parsed = loadJsonConfigSync(classesFilePath, ClassesToSilenceSchema);
|
|
52
|
-
if (!parsed.success) {
|
|
53
|
-
throw new ApexTraceSilenceError('invalid-classes-file', parsed.message);
|
|
54
|
-
}
|
|
55
|
-
classes.push(...parsed.data.classes);
|
|
56
|
-
}
|
|
57
|
-
if (presets.fflib) {
|
|
58
|
-
classes.push(...FFLIB_CLASSES);
|
|
59
|
-
}
|
|
60
|
-
if (presets.at4dx) {
|
|
61
|
-
classes.push(...AT4DX_CLASSES);
|
|
62
|
-
}
|
|
63
|
-
if (presets.forceDi) {
|
|
64
|
-
classes.push(...FORCE_DI_CLASSES);
|
|
65
|
-
}
|
|
66
|
-
return [...new Set(classes)];
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Creates or updates a 24-hour CLASS_TRACING trace flag with a fully suppressed (NONE) debug level
|
|
70
|
-
* for each of `classNames`, preventing those classes from generating debug log output. A class
|
|
71
|
-
* that already has a trace flag has its expiration extended instead of getting a duplicate.
|
|
72
|
-
*
|
|
73
|
-
* @param connection - The org connection to silence classes in.
|
|
74
|
-
* @param classNames - The Apex class names to silence — see `resolveClasses`.
|
|
75
|
-
* @param onPhase - Called as each of the three phases (checking the debug level, finding the
|
|
76
|
-
* classes, writing trace flags) starts — a caller (the CLI) can use this to update a spinner.
|
|
77
|
-
* Optional; has no effect on the operation itself.
|
|
78
|
-
* @returns The trace flag created/updated per successfully-silenced class, plus any class names
|
|
79
|
-
* that don't exist in the org and any per-class create/update failures.
|
|
80
|
-
* @throws {ApexTraceSilenceError} `no-classes-specified` if `classNames` is empty,
|
|
81
|
-
* `debug-level-create-failed` if the shared `Silence` debug level doesn't exist yet and couldn't be
|
|
82
|
-
* created.
|
|
83
|
-
*/
|
|
84
|
-
export async function silenceApexClasses(connection, classNames, onPhase) {
|
|
85
|
-
if (classNames.length === 0) {
|
|
86
|
-
throw new ApexTraceSilenceError('no-classes-specified', 'No Apex classes were specified to silence.');
|
|
87
|
-
}
|
|
88
|
-
onPhase?.('checking-debug-level');
|
|
89
|
-
const debugLevelResult = await connection.tooling.query(`SELECT Id FROM DebugLevel WHERE DeveloperName = '${DEBUG_LEVEL_NAME}'`);
|
|
90
|
-
let debugLevelId;
|
|
91
|
-
if (debugLevelResult.records.length > 0) {
|
|
92
|
-
debugLevelId = debugLevelResult.records[0].Id;
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
const createResult = await connection.tooling.sobject('DebugLevel').create({
|
|
96
|
-
DeveloperName: DEBUG_LEVEL_NAME,
|
|
97
|
-
MasterLabel: DEBUG_LEVEL_NAME,
|
|
98
|
-
ApexCode: 'NONE',
|
|
99
|
-
ApexProfiling: 'NONE',
|
|
100
|
-
Callout: 'NONE',
|
|
101
|
-
Database: 'NONE',
|
|
102
|
-
System: 'NONE',
|
|
103
|
-
Validation: 'NONE',
|
|
104
|
-
Visualforce: 'NONE',
|
|
105
|
-
Workflow: 'NONE',
|
|
106
|
-
});
|
|
107
|
-
if (!createResult.success) {
|
|
108
|
-
throw new ApexTraceSilenceError('debug-level-create-failed', createResult.errors.map((e) => e.message).join(', '));
|
|
109
|
-
}
|
|
110
|
-
debugLevelId = createResult.id;
|
|
111
|
-
}
|
|
112
|
-
onPhase?.('finding-classes');
|
|
113
|
-
const classesClause = classNames.map((className) => `'${className}'`).join(',');
|
|
114
|
-
const classResult = await connection.tooling.query(`SELECT Id, Name FROM ApexClass WHERE Name IN (${classesClause})`);
|
|
115
|
-
if (classResult.records.length === 0) {
|
|
116
|
-
return { results: [], missingClassNames: classNames, failures: [] };
|
|
117
|
-
}
|
|
118
|
-
const foundNames = new Set(classResult.records.map((record) => record.Name));
|
|
119
|
-
const missingClassNames = classNames.filter((className) => !foundNames.has(className));
|
|
120
|
-
const now = new Date();
|
|
121
|
-
const expiration = new Date(now.getTime() + TRACE_DURATION_MS);
|
|
122
|
-
const startDate = now.toISOString();
|
|
123
|
-
const expirationDate = expiration.toISOString();
|
|
124
|
-
const classIdsClause = classResult.records.map((record) => `'${record.Id}'`).join(',');
|
|
125
|
-
const existingTraceFlagResult = await connection.tooling.query(`SELECT Id, TracedEntityId FROM TraceFlag WHERE LogType = 'CLASS_TRACING' AND TracedEntityId IN (${classIdsClause})`);
|
|
126
|
-
const existingTraceFlagIdByClassId = new Map(existingTraceFlagResult.records.map((record) => [record.TracedEntityId, record.Id]));
|
|
127
|
-
const results = [];
|
|
128
|
-
const failures = [];
|
|
129
|
-
onPhase?.('creating-trace-flags');
|
|
130
|
-
for (const classRecord of classResult.records) {
|
|
131
|
-
const existingTraceFlagId = existingTraceFlagIdByClassId.get(classRecord.Id);
|
|
132
|
-
if (existingTraceFlagId) {
|
|
133
|
-
// eslint-disable-next-line no-await-in-loop -- trace flags are written sequentially, matching the CLI's per-class progress reporting
|
|
134
|
-
const updateResult = await connection.tooling.sobject('TraceFlag').update({
|
|
135
|
-
Id: existingTraceFlagId,
|
|
136
|
-
DebugLevelId: debugLevelId,
|
|
137
|
-
StartDate: startDate,
|
|
138
|
-
ExpirationDate: expirationDate,
|
|
139
|
-
});
|
|
140
|
-
if (!updateResult.success) {
|
|
141
|
-
failures.push({
|
|
142
|
-
class: classRecord.Name,
|
|
143
|
-
action: 'update',
|
|
144
|
-
error: updateResult.errors.map((e) => e.message).join(', '),
|
|
145
|
-
});
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
results.push({ class: classRecord.Name, classId: classRecord.Id, traceFlagId: existingTraceFlagId });
|
|
149
|
-
continue;
|
|
150
|
-
}
|
|
151
|
-
// eslint-disable-next-line no-await-in-loop -- trace flags are written sequentially, matching the CLI's per-class progress reporting
|
|
152
|
-
const createResult = await connection.tooling.sobject('TraceFlag').create({
|
|
153
|
-
StartDate: startDate,
|
|
154
|
-
ExpirationDate: expirationDate,
|
|
155
|
-
DebugLevelId: debugLevelId,
|
|
156
|
-
TracedEntityId: classRecord.Id,
|
|
157
|
-
LogType: 'CLASS_TRACING',
|
|
158
|
-
});
|
|
159
|
-
if (!createResult.success) {
|
|
160
|
-
failures.push({
|
|
161
|
-
class: classRecord.Name,
|
|
162
|
-
action: 'create',
|
|
163
|
-
error: createResult.errors.map((e) => e.message).join(', '),
|
|
164
|
-
});
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
results.push({ class: classRecord.Name, classId: classRecord.Id, traceFlagId: createResult.id });
|
|
168
|
-
}
|
|
169
|
-
return { results, missingClassNames, failures };
|
|
170
|
-
}
|
|
171
|
-
//# sourceMappingURL=apexTraceSilence.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apexTraceSilence.js","sourceRoot":"","sources":["../../src/common/apexTraceSilence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,kGAAkG;AAClG,MAAM,gBAAgB,GAAG,SAAS,CAAC;AACnC,iGAAiG;AACjG,MAAM,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE9C,8CAA8C;AAC9C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;AAC9E,8CAA8C;AAC9C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,0BAA0B,CAAC,CAAC;AAC1D,gDAAgD;AAChD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,aAAa,CAAC,CAAC;AAqB/F,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9B,IAAI,CAA4B;IAEhD,YAAmB,IAA+B,EAAE,OAAe;QACjE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAC5B,UAAoB,EACpB,eAAmC,EACnC,OAA6D;IAE7D,MAAM,OAAO,G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AC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;aAC5D,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC;IACnG,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC;AAClD,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/** Schema for the JSON config file that lists which Apex classes to silence debug logs for. */
|
|
3
|
-
export declare const ClassesToSilenceSchema: z.ZodObject<{
|
|
4
|
-
classes: z.ZodArray<z.ZodString>;
|
|
5
|
-
}, z.core.$strip>;
|
|
6
|
-
/** A parsed classes-to-silence config file: a non-empty list of Apex class names. */
|
|
7
|
-
export type ClassesToSilence = z.infer<typeof ClassesToSilenceSchema>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2026, Clay Chipps.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { z } from 'zod';
|
|
17
|
-
/** Schema for the JSON config file that lists which Apex classes to silence debug logs for. */
|
|
18
|
-
export const ClassesToSilenceSchema = z.object({
|
|
19
|
-
classes: z.array(z.string()).min(1),
|
|
20
|
-
});
|
|
21
|
-
//# sourceMappingURL=classesToSilence.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classesToSilence.js","sourceRoot":"","sources":["../../../src/common/schemas/classesToSilence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+FAA+F;AAC/F,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CACpC,CAAC,CAAC"}
|