@simplysf/simply-apex 1.1.19 → 1.2.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/README.md CHANGED
@@ -31,7 +31,7 @@ Execute anonymous Apex code.
31
31
 
32
32
  ```
33
33
  USAGE
34
- $ sf simply apex execute -f <value> -o <value> [--json] [--flags-dir <value>] [--api-version <value>]
34
+ $ sf simply apex execute -o <value> -f <value> [--json] [--flags-dir <value>] [--api-version <value>]
35
35
 
36
36
  FLAGS
37
37
  -f, --file=<value> (required) Path to Apex file
@@ -58,7 +58,7 @@ FLAG DESCRIPTIONS
58
58
  The path to the local .apex file containing the anonymous Apex code to execute.
59
59
  ```
60
60
 
61
- _See code: [lib/commands/simply/apex/execute.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-apex@1.1.10/packages/simply-apex/lib/commands/simply/apex/execute.js)_
61
+ _See code: [lib/commands/simply/apex/execute.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-apex@1.1.18/packages/simply-apex/lib/commands/simply/apex/execute.js)_
62
62
 
63
63
  ## `sf simply apex logs purge`
64
64
 
@@ -66,13 +66,16 @@ Purge Apex debug logs.
66
66
 
67
67
  ```
68
68
  USAGE
69
- $ sf simply apex logs purge -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-w <value>]
69
+ $ sf simply apex logs purge -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-w <value>] [-b] [--wait
70
+ <value>]
70
71
 
71
72
  FLAGS
73
+ -b, --use-bulk-api Use Bulk API v2 to query and delete the logs.
72
74
  -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
73
75
  configuration variable is already set.
74
76
  -w, --where=<value> SOQL WHERE clause
75
77
  --api-version=<value> Override the api version used for api requests made by this command
78
+ --wait=<value> Number of minutes to wait for the Bulk API jobs to finish.
76
79
 
77
80
  GLOBAL FLAGS
78
81
  --flags-dir=<value> Import flag values from a directory.
@@ -89,13 +92,29 @@ EXAMPLES
89
92
 
90
93
  $ sf simply apex logs purge --target-org myOrg --where "Status = 'Success'"
91
94
 
95
+ $ sf simply apex logs purge --target-org myOrg --use-bulk-api
96
+
97
+ $ sf simply apex logs purge --target-org myOrg --use-bulk-api --wait 60
98
+
92
99
  FLAG DESCRIPTIONS
100
+ -b, --use-bulk-api Use Bulk API v2 to query and delete the logs.
101
+
102
+ Runs the whole purge as two Bulk API v2 jobs instead of a Tooling API query followed by chunked REST deletes. Bulk
103
+ API processes the deletion asynchronously and does not consume the org's REST API request limit, which suits purges
104
+ of tens of thousands of logs. For small purges the default REST path is faster, since it avoids the overhead of
105
+ creating, uploading, and polling a job.
106
+
93
107
  -w, --where=<value> SOQL WHERE clause
94
108
 
95
109
  A WHERE clause used to filter which ApexLog records are purged (e.g. "Status = 'Success'").
110
+
111
+ --wait=<value> Number of minutes to wait for the Bulk API jobs to finish.
112
+
113
+ Only applies with --use-bulk-api. The command polls the query and delete jobs until they complete or this timeout
114
+ elapses, then throws.
96
115
  ```
97
116
 
98
- _See code: [lib/commands/simply/apex/logs/purge.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-apex@1.1.10/packages/simply-apex/lib/commands/simply/apex/logs/purge.js)_
117
+ _See code: [lib/commands/simply/apex/logs/purge.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-apex@1.1.18/packages/simply-apex/lib/commands/simply/apex/logs/purge.js)_
99
118
 
100
119
  ## `sf simply apex trace setup`
101
120
 
@@ -124,7 +143,7 @@ EXAMPLES
124
143
  $ sf simply apex trace setup --target-org myOrg
125
144
  ```
126
145
 
127
- _See code: [lib/commands/simply/apex/trace/setup.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-apex@1.1.10/packages/simply-apex/lib/commands/simply/apex/trace/setup.js)_
146
+ _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)_
128
147
 
129
148
  ## `sf simply apex trace silence`
130
149
 
@@ -168,21 +187,5 @@ FLAG DESCRIPTIONS
168
187
  silence.
169
188
  ```
170
189
 
171
- _See code: [lib/commands/simply/apex/trace/silence.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-apex@1.1.10/packages/simply-apex/lib/commands/simply/apex/trace/silence.js)_
190
+ _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)_
172
191
  <!-- commandsstop -->
173
-
174
- ## Configuration Files
175
-
176
- ### `sf simply apex trace silence --classes-file`
177
-
178
- The `--classes-file` flag on `sf simply apex trace silence` takes the path to a JSON file listing which Apex classes to silence:
179
-
180
- ```json
181
- {
182
- "classes": ["AccountTriggerHandler", "NoisyBatchClass"]
183
- }
184
- ```
185
-
186
- | Field | Type | Required | Description |
187
- | --------- | ---------- | -------- | -------------------------------------------------------------------------- |
188
- | `classes` | `string[]` | Yes | One or more Apex class API names to silence. Must have at least one entry. |
@@ -1,3 +1,4 @@
1
+ import { Duration } from '@salesforce/kit';
1
2
  import { SfCommand } from '@salesforce/sf-plugins-core';
2
3
  /** Outcome of deleting a single `ApexLog` record. */
3
4
  export type ApexLogsPurgeResult = {
@@ -15,6 +16,8 @@ export default class ApexLogsPurge extends SfCommand<ApexLogsPurgeResult[]> {
15
16
  static readonly examples: string[];
16
17
  static readonly flags: {
17
18
  where: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ 'use-bulk-api': import("@oclif/core/interfaces").BooleanFlag<boolean>;
20
+ wait: import("@oclif/core/interfaces").OptionFlag<Duration, import("@oclif/core/interfaces").CustomOptions>;
18
21
  'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined>;
19
22
  'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org>;
20
23
  'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -24,4 +27,12 @@ export default class ApexLogsPurge extends SfCommand<ApexLogsPurgeResult[]> {
24
27
  * filter.
25
28
  */
26
29
  run(): Promise<ApexLogsPurgeResult[]>;
30
+ /**
31
+ * Deletes through the core connection's SObject Collections resource, 200 records per call.
32
+ *
33
+ * Deliberately not `.tooling`: `ApexLog` is exposed on both APIs, but only core REST implements
34
+ * the Collections resource a bulk delete needs. `/tooling/composite/sobjects` does not exist and
35
+ * answers 404 "The requested resource does not exist".
36
+ */
37
+ private deleteViaCollections;
27
38
  }
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Messages } from '@salesforce/core';
17
+ import { Duration } from '@salesforce/kit';
17
18
  import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
18
19
  import { requireConnection, targetOrgFlags } from '@simplysf/simply-plugin-kit';
19
20
  import { chunk } from '@simplysf/simply-core';
@@ -40,6 +41,19 @@ export default class ApexLogsPurge extends SfCommand {
40
41
  description: messages.getMessage('flags.where.description'),
41
42
  char: 'w',
42
43
  }),
44
+ 'use-bulk-api': Flags.boolean({
45
+ summary: messages.getMessage('flags.use-bulk-api.summary'),
46
+ description: messages.getMessage('flags.use-bulk-api.description'),
47
+ char: 'b',
48
+ default: false,
49
+ }),
50
+ wait: Flags.duration({
51
+ unit: 'minutes',
52
+ summary: messages.getMessage('flags.wait.summary'),
53
+ description: messages.getMessage('flags.wait.description'),
54
+ // jsforce defaults bulk polling to 30 seconds, which no real purge finishes within.
55
+ default: Duration.minutes(30),
56
+ }),
43
57
  };
44
58
  /**
45
59
  * @returns The delete outcome for every `ApexLog` record matched by the (optional) `--where`
@@ -48,39 +62,25 @@ export default class ApexLogsPurge extends SfCommand {
48
62
  async run() {
49
63
  const { flags } = await this.parse(ApexLogsPurge);
50
64
  const targetOrgConnection = requireConnection(flags);
65
+ const useBulkApi = flags['use-bulk-api'];
66
+ const pollTimeout = flags.wait.milliseconds;
51
67
  let query = 'SELECT Id FROM ApexLog';
52
68
  if (flags.where) {
53
69
  query += ` WHERE ${flags.where}`;
54
70
  }
55
71
  this.spinner.start(messages.getMessage('info.queryingLogs'));
56
- const queryResult = await targetOrgConnection.tooling.query(query);
72
+ const logIds = useBulkApi
73
+ ? await queryLogIdsViaBulkApi(targetOrgConnection, query, pollTimeout)
74
+ : await queryLogIdsViaRest(targetOrgConnection, query);
57
75
  this.spinner.stop();
58
- if (queryResult.records.length === 0) {
76
+ if (logIds.length === 0) {
59
77
  this.info(messages.getMessage('info.noLogsToPurge'));
60
78
  return [];
61
79
  }
62
- const logIds = queryResult.records.map((record) => record.Id);
63
- const results = [];
64
80
  this.spinner.start(messages.getMessage('info.purgingLogs', [logIds.length]));
65
- let purged = 0;
66
- for (const idChunk of chunk(logIds, CHUNK_SIZE)) {
67
- purged += idChunk.length;
68
- this.spinner.status = `${purged}/${logIds.length}`;
69
- // Deleted through the core connection, not `.tooling`. ApexLog is exposed on both APIs, but
70
- // only core REST implements the SObject Collections resource that a bulk delete needs;
71
- // `/tooling/composite/sobjects` does not exist and answers 404 "The requested resource does
72
- // not exist". The records were queried via the Tooling API, which returns the same IDs.
73
- // eslint-disable-next-line no-await-in-loop -- batches are sequential so the spinner tracks real progress
74
- const deleteResults = await targetOrgConnection.delete('ApexLog', idChunk);
75
- const deleteResultsArray = Array.isArray(deleteResults) ? deleteResults : [deleteResults];
76
- deleteResultsArray.forEach((deleteResult, index) => {
77
- results.push({
78
- Id: deleteResult.id ?? idChunk[index] ?? 'unknown',
79
- Success: deleteResult.success,
80
- Error: deleteResult.success ? undefined : deleteResult.errors.map((e) => e.message).join(', '),
81
- });
82
- });
83
- }
81
+ const results = useBulkApi
82
+ ? await deleteViaBulkApi(targetOrgConnection, logIds, pollTimeout)
83
+ : await this.deleteViaCollections(targetOrgConnection, logIds);
84
84
  this.spinner.stop();
85
85
  const successCount = results.filter((result) => result.Success).length;
86
86
  const failureCount = results.length - successCount;
@@ -100,5 +100,76 @@ export default class ApexLogsPurge extends SfCommand {
100
100
  });
101
101
  return results;
102
102
  }
103
+ /**
104
+ * Deletes through the core connection's SObject Collections resource, 200 records per call.
105
+ *
106
+ * Deliberately not `.tooling`: `ApexLog` is exposed on both APIs, but only core REST implements
107
+ * the Collections resource a bulk delete needs. `/tooling/composite/sobjects` does not exist and
108
+ * answers 404 "The requested resource does not exist".
109
+ */
110
+ async deleteViaCollections(connection, logIds) {
111
+ const results = [];
112
+ let purged = 0;
113
+ for (const idChunk of chunk(logIds, CHUNK_SIZE)) {
114
+ purged += idChunk.length;
115
+ this.spinner.status = `${purged}/${logIds.length}`;
116
+ // eslint-disable-next-line no-await-in-loop -- batches are sequential so the spinner tracks real progress
117
+ const deleteResults = await connection.delete('ApexLog', idChunk);
118
+ const deleteResultsArray = Array.isArray(deleteResults) ? deleteResults : [deleteResults];
119
+ deleteResultsArray.forEach((deleteResult, index) => {
120
+ results.push({
121
+ Id: deleteResult.id ?? idChunk[index] ?? 'unknown',
122
+ Success: deleteResult.success,
123
+ Error: deleteResult.success ? undefined : deleteResult.errors.map((e) => e.message).join(', '),
124
+ });
125
+ });
126
+ }
127
+ return results;
128
+ }
129
+ }
130
+ /** Collects matching log IDs through the Tooling API, which returns them in a single response. */
131
+ async function queryLogIdsViaRest(connection, query) {
132
+ const queryResult = await connection.tooling.query(query);
133
+ return queryResult.records.map((record) => record.Id);
134
+ }
135
+ /**
136
+ * Collects matching log IDs through a Bulk API v2 query job. The job streams CSV back, so the IDs
137
+ * are gathered from the record stream rather than a single response body.
138
+ */
139
+ async function queryLogIdsViaBulkApi(connection, query, pollTimeout) {
140
+ const recordStream = await connection.bulk2.query(query, { pollTimeout });
141
+ const logIds = [];
142
+ for await (const record of recordStream) {
143
+ const { Id: id } = record;
144
+ if (id) {
145
+ logIds.push(id);
146
+ }
147
+ }
148
+ return logIds;
149
+ }
150
+ /**
151
+ * Deletes through a Bulk API v2 ingest job. The whole set goes up as one job rather than in
152
+ * 200-record chunks, and the org processes it asynchronously without spending REST request limit.
153
+ */
154
+ async function deleteViaBulkApi(connection, logIds, pollTimeout) {
155
+ const { successfulResults, failedResults } = await connection.bulk2.loadAndWaitForResults({
156
+ object: 'ApexLog',
157
+ operation: 'delete',
158
+ input: logIds.map((Id) => ({ Id })),
159
+ pollTimeout,
160
+ });
161
+ return [
162
+ ...successfulResults.map((result) => ({ Id: result.sf__Id, Success: true })),
163
+ ...failedResults.map((result) => {
164
+ // A failed row reports an empty (not absent) `sf__Id`; the submitted `Id` column is echoed
165
+ // back alongside it, so prefer that to keep every failure traceable to a specific log.
166
+ const submittedId = result.Id;
167
+ return {
168
+ Id: result.sf__Id.length > 0 ? result.sf__Id : (submittedId ?? 'unknown'),
169
+ Success: false,
170
+ Error: result.sf__Error,
171
+ };
172
+ }),
173
+ ];
103
174
  }
104
175
  //# sourceMappingURL=purge.js.map
@@ -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,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,uBAAuB,EAAE,wBAAwB,CAAC,CAAC;AAS1F;;;GAGG;AACH,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,SAAgC;IAClE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC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ACJ,CAAC"}
@@ -14,12 +14,32 @@ SOQL WHERE clause
14
14
 
15
15
  A WHERE clause used to filter which ApexLog records are purged (e.g. "Status = 'Success'").
16
16
 
17
+ # flags.use-bulk-api.summary
18
+
19
+ Use Bulk API v2 to query and delete the logs.
20
+
21
+ # flags.use-bulk-api.description
22
+
23
+ Runs the whole purge as two Bulk API v2 jobs instead of a Tooling API query followed by chunked REST deletes. Bulk API processes the deletion asynchronously and does not consume the org's REST API request limit, which suits purges of tens of thousands of logs. For small purges the default REST path is faster, since it avoids the overhead of creating, uploading, and polling a job.
24
+
25
+ # flags.wait.summary
26
+
27
+ Number of minutes to wait for the Bulk API jobs to finish.
28
+
29
+ # flags.wait.description
30
+
31
+ Only applies with --use-bulk-api. The command polls the query and delete jobs until they complete or this timeout elapses, then throws.
32
+
17
33
  # examples
18
34
 
19
35
  - <%= config.bin %> <%= command.id %> --target-org myOrg
20
36
 
21
37
  - <%= config.bin %> <%= command.id %> --target-org myOrg --where "Status = 'Success'"
22
38
 
39
+ - <%= config.bin %> <%= command.id %> --target-org myOrg --use-bulk-api
40
+
41
+ - <%= config.bin %> <%= command.id %> --target-org myOrg --use-bulk-api --wait 60
42
+
23
43
  # info.queryingLogs
24
44
 
25
45
  Querying Apex logs...
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.1.19",
4
+ "version": "1.2.0",
5
5
  "author": "@ClayChipps",
6
6
  "homepage": "https://github.com/SimplySF/simply-node",
7
7
  "bugs": "https://github.com/SimplySF/simply-node/issues",
@@ -217,5 +217,5 @@
217
217
  "output": []
218
218
  }
219
219
  },
220
- "gitHead": "b6604fc398051fa2f92ad8223dd8e214ba9e4988"
220
+ "gitHead": "fb8e9c1bdde7948f51b8d46fd0727a140bcf5470"
221
221
  }