sf-raven 1.1.0 → 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
@@ -43,6 +43,16 @@ Full details, usage, examples etc are further down, or can be accessed via `--he
43
43
  - [sf raven event subscribe](#sf-raven-event-subscribe)
44
44
  - Subscribe to Platform Events.
45
45
 
46
+ #### sf raven deploy
47
+
48
+ - [sf raven deploy cancel](#sf-raven-deploy-cancel)
49
+ - Cancel a pending or in-progress Salesforce deploy.
50
+
51
+ #### sf raven query
52
+
53
+ - [sf raven query ids](#sf-raven-query-ids)
54
+ - Run a SOQL query against a large list of Salesforce IDs.
55
+
46
56
  #### sf raven pull
47
57
 
48
58
  - [sf raven pull](#sf-raven-pull)
@@ -227,6 +237,61 @@ EXAMPLES
227
237
  $ sf raven pull remote --target-org dev
228
238
  ```
229
239
 
240
+ ## sf raven deploy cancel
241
+
242
+ Cancel a pending or in-progress Salesforce deploy.
243
+
244
+ ```
245
+ USAGE
246
+ $ sf raven deploy cancel [--json] [-o <value>]
247
+
248
+ FLAGS
249
+ -o, --target-org=<value> Login username or alias for the target org. Uses the default org when omitted.
250
+
251
+ GLOBAL FLAGS
252
+ --json Format output as json.
253
+
254
+ DESCRIPTION
255
+ Query the target org for pending or in-progress deploy requests, select one from an interactive list, confirm the cancellation, and submit an asynchronous deploy cancel request.
256
+
257
+ EXAMPLES
258
+ $ sf raven deploy cancel
259
+
260
+ $ sf raven deploy cancel --target-org dev
261
+ ```
262
+
263
+ ## sf raven query ids
264
+
265
+ Run a SOQL query against a large list of Salesforce IDs.
266
+
267
+ ```
268
+ USAGE
269
+ $ sf raven query ids -f <value> -q <value> [--json] [-o <value>] [-b <value>] [-c <value>] [-l <value>]
270
+
271
+ FLAGS
272
+ -b, --batch-size=<value> Number of IDs to include in each query batch. By default, batches are sized to fit Salesforce URI limits.
273
+ -c, --csv=<value> Path to write query results as CSV. When supplied, table output is suppressed.
274
+ -f, --file=<value> (required) Path to a file containing one Salesforce ID per row.
275
+ -l, --limit=<value> Process only the first N unique valid IDs from the file.
276
+ -o, --target-org=<value> Login username or alias for the target org. Uses the default org when omitted.
277
+ -q, --query=<value> (required) SOQL query to run. Must include the {ids} placeholder where the ID list should be inserted.
278
+
279
+ GLOBAL FLAGS
280
+ --json Format output as json.
281
+
282
+ DESCRIPTION
283
+ Read Salesforce IDs from a file, deduplicate and validate them, split them into safe query batches, and run a SOQL query with the IDs inserted at the {ids} placeholder.
284
+
285
+ EXAMPLES
286
+ $ sf raven query ids --file account-ids.txt --query "SELECT Id, Name FROM Account WHERE Id IN {ids}"
287
+
288
+ $ sf raven query ids --file account-ids.txt --query "SELECT Id, Name FROM Opportunity WHERE AccountId IN {ids}"
289
+
290
+ $ sf raven query ids --file account-ids.txt --query "SELECT Id, Name FROM Account WHERE Id IN {ids}" --limit 25
291
+
292
+ $ sf raven query ids --file account-ids.txt --query "SELECT Id, Name FROM Account WHERE Id IN {ids}" --csv results.csv
293
+ ```
294
+
230
295
  ## sf raven audit display
231
296
 
232
297
  Show recent entries in the Setup Audit Trail.
@@ -0,0 +1,15 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export type DeployCancelResult = {
3
+ cancelled: boolean;
4
+ jobId?: string;
5
+ targetOrg?: string;
6
+ };
7
+ export default class DeployCancel extends SfCommand<DeployCancelResult> {
8
+ static readonly summary: string;
9
+ static readonly description: string;
10
+ static readonly examples: string[];
11
+ static readonly flags: {
12
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
13
+ };
14
+ run(): Promise<DeployCancelResult>;
15
+ }
@@ -0,0 +1,185 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { spawn } from 'node:child_process';
11
+ import select, { Separator } from '@inquirer/select';
12
+ import { Messages } from '@salesforce/core';
13
+ import { Flags, SfCommand, Ux } from '@salesforce/sf-plugins-core';
14
+ import dayjs from 'dayjs';
15
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
16
+ const messages = Messages.loadMessages('sf-raven', 'raven.deploy.cancel');
17
+ const cancelSelection = 'cancel';
18
+ class DeployCancel extends SfCommand {
19
+ run() {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ const { flags } = yield this.parse(DeployCancel);
22
+ const ux = new Ux({ jsonEnabled: this.jsonEnabled() });
23
+ const org = flags['target-org'];
24
+ if (org == null) {
25
+ throw messages.createError('error.noTargetOrg');
26
+ }
27
+ const targetOrg = org.getUsername();
28
+ if (targetOrg == null) {
29
+ throw messages.createError('error.noTargetOrg');
30
+ }
31
+ ux.spinner.start(messages.getMessage('info.loadingDeploys'));
32
+ let deployRequests;
33
+ try {
34
+ deployRequests = yield getActiveDeployRequests(org.getConnection());
35
+ }
36
+ finally {
37
+ ux.spinner.stop();
38
+ }
39
+ if (deployRequests.length === 0) {
40
+ ux.log(messages.getMessage('info.noDeploys'));
41
+ return {
42
+ cancelled: false,
43
+ targetOrg,
44
+ };
45
+ }
46
+ const selectedDeployRequest = yield selectDeployRequest(deployRequests);
47
+ if (selectedDeployRequest === cancelSelection || selectedDeployRequest == null) {
48
+ ux.log(messages.getMessage('info.noSelection'));
49
+ return {
50
+ cancelled: false,
51
+ targetOrg,
52
+ };
53
+ }
54
+ const confirmed = yield this.confirm({
55
+ message: messages.getMessage('prompt.confirmCancel', [selectedDeployRequest.Id]),
56
+ defaultAnswer: false,
57
+ });
58
+ if (!confirmed) {
59
+ ux.log(messages.getMessage('info.cancelAborted'));
60
+ return {
61
+ cancelled: false,
62
+ jobId: selectedDeployRequest.Id,
63
+ targetOrg,
64
+ };
65
+ }
66
+ const exitCode = yield cancelDeploy(selectedDeployRequest.Id, targetOrg);
67
+ if (exitCode !== 0) {
68
+ throw messages.createError('error.cancelFailed', [exitCode.toString()]);
69
+ }
70
+ ux.log(messages.getMessage('info.cancelSubmitted', [selectedDeployRequest.Id]));
71
+ return {
72
+ cancelled: true,
73
+ jobId: selectedDeployRequest.Id,
74
+ targetOrg,
75
+ };
76
+ });
77
+ }
78
+ }
79
+ DeployCancel.summary = messages.getMessage('summary');
80
+ DeployCancel.description = messages.getMessage('description');
81
+ DeployCancel.examples = messages.getMessages('examples');
82
+ DeployCancel.flags = {
83
+ 'target-org': Flags.optionalOrg({
84
+ summary: messages.getMessage('flags.target-org.summary'),
85
+ char: 'o',
86
+ }),
87
+ };
88
+ export default DeployCancel;
89
+ const getActiveDeployRequests = (connection) => __awaiter(void 0, void 0, void 0, function* () {
90
+ const result = yield connection.tooling.query(`
91
+ SELECT Id, Status, StartDate,
92
+ NumberComponentsDeployed, NumberComponentsTotal, NumberComponentErrors,
93
+ NumberTestsCompleted, NumberTestsTotal, NumberTestErrors
94
+ FROM DeployRequest
95
+ WHERE Status IN ('InProgress', 'Pending')
96
+ ORDER BY StartDate DESC
97
+ `);
98
+ return result.records;
99
+ });
100
+ const formatDeployRequest = (deployRequest) => {
101
+ if (deployRequest.Status === 'Pending') {
102
+ return [deployRequest.Status, deployRequest.Id].join(' | ');
103
+ }
104
+ const startDate = deployRequest.StartDate == null ? messages.getMessage('label.unknownStartDate') : dayjs(deployRequest.StartDate).format('DD/MM/YYYY HH:mm');
105
+ return [
106
+ startDate,
107
+ deployRequest.Status,
108
+ deployRequest.Id,
109
+ `Metadata: ${formatProgress(deployRequest.NumberComponentsDeployed, deployRequest.NumberComponentsTotal, deployRequest.NumberComponentErrors)}`,
110
+ `Apex Tests: ${formatProgress(deployRequest.NumberTestsCompleted, deployRequest.NumberTestsTotal, deployRequest.NumberTestErrors)}`,
111
+ ].join(' | ');
112
+ };
113
+ const selectDeployRequest = (deployRequests) => __awaiter(void 0, void 0, void 0, function* () {
114
+ try {
115
+ return yield select({
116
+ message: messages.getMessage('prompt.selectDeploy'),
117
+ choices: getDeployChoices(deployRequests),
118
+ pageSize: 10,
119
+ });
120
+ }
121
+ catch (error) {
122
+ if (isPromptForceCloseError(error)) {
123
+ return undefined;
124
+ }
125
+ throw error;
126
+ }
127
+ });
128
+ const getDeployChoices = (deployRequests) => {
129
+ const inProgressDeployRequests = deployRequests.filter((deployRequest) => deployRequest.Status === 'InProgress');
130
+ const pendingDeployRequests = deployRequests.filter((deployRequest) => deployRequest.Status === 'Pending');
131
+ return [
132
+ { name: messages.getMessage('label.cancel'), value: cancelSelection },
133
+ new Separator(),
134
+ ...getGroupedDeployChoices(messages.getMessage('label.inProgress'), inProgressDeployRequests),
135
+ ...getGroupedDeployChoices(messages.getMessage('label.pending'), pendingDeployRequests),
136
+ ];
137
+ };
138
+ const getGroupedDeployChoices = (label, deployRequests) => deployRequests.length === 0
139
+ ? []
140
+ : [
141
+ new Separator(label),
142
+ ...deployRequests.map((deployRequest) => ({
143
+ name: formatDeployRequest(deployRequest),
144
+ value: deployRequest,
145
+ })),
146
+ ];
147
+ const isPromptForceCloseError = (error) => error instanceof Error && error.message.includes('User force closed the prompt');
148
+ const formatProgress = (completed, total, errors) => {
149
+ const completedValue = completed !== null && completed !== void 0 ? completed : 0;
150
+ const totalValue = total !== null && total !== void 0 ? total : 0;
151
+ const errorValue = errors !== null && errors !== void 0 ? errors : 0;
152
+ const percentage = totalValue > 0 ? Math.floor((completedValue / totalValue) * 100) : 0;
153
+ return `${completedValue}/${totalValue} (${percentage}% - ${errorValue} errors)`;
154
+ };
155
+ const cancelDeploy = (jobId, targetOrg) => __awaiter(void 0, void 0, void 0, function* () {
156
+ var _a;
157
+ const result = yield runChildProcess((_a = process.env.SF_BINPATH) !== null && _a !== void 0 ? _a : 'sf', [
158
+ 'project',
159
+ 'deploy',
160
+ 'cancel',
161
+ '--job-id',
162
+ jobId,
163
+ '--target-org',
164
+ targetOrg,
165
+ '--async',
166
+ ]);
167
+ return result.exitCode;
168
+ });
169
+ const runChildProcess = (command, args) => __awaiter(void 0, void 0, void 0, function* () {
170
+ return new Promise((resolve, reject) => {
171
+ const childProcess = spawn(command, args, {
172
+ stdio: 'inherit',
173
+ env: process.env,
174
+ });
175
+ childProcess.on('error', (error) => {
176
+ reject(error);
177
+ });
178
+ childProcess.on('close', (code) => {
179
+ resolve({
180
+ exitCode: code !== null && code !== void 0 ? code : 0,
181
+ });
182
+ });
183
+ });
184
+ });
185
+ //# sourceMappingURL=cancel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../../../src/commands/raven/deploy/cancel.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,qBAAqB,CAAC,CAAC;AAkC1E,MAAM,eAAe,GAAG,QAAiB,CAAC;AAK1C,MAAqB,YAAa,SAAQ,SAA6B;IAYxD,GAAG;;YACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YACjD,MAAM,EAAE,GAAG,IAAI,EAAE,CAA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QAEH,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACjC,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;QAEH,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YAChC,OAAO,CAAC;gBACN,QAAQ,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,CAAC;aACpB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAA;EAAA,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export type QueryIdsResult = {
3
+ totalRows: number;
4
+ validIds: number;
5
+ uniqueIds: number;
6
+ duplicateIds: number;
7
+ limit?: number;
8
+ processedIds: number;
9
+ batches: number;
10
+ recordsReturned: number;
11
+ records: QueryRecord[];
12
+ };
13
+ type QueryRecord = Record<string, unknown>;
14
+ export default class QueryIds extends SfCommand<QueryIdsResult> {
15
+ static readonly summary: string;
16
+ static readonly description: string;
17
+ static readonly examples: string[];
18
+ static readonly flags: {
19
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
20
+ file: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
21
+ query: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
22
+ 'batch-size': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ csv: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
+ limit: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
25
+ };
26
+ run(): Promise<QueryIdsResult>;
27
+ }
28
+ export {};
@@ -0,0 +1,246 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { readFileSync, writeFileSync } from 'node:fs';
11
+ import { Messages } from '@salesforce/core';
12
+ import { Flags, SfCommand, Ux } from '@salesforce/sf-plugins-core';
13
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
14
+ const messages = Messages.loadMessages('sf-raven', 'raven.query.ids');
15
+ const idPattern = /^[a-zA-Z0-9]{15}([a-zA-Z0-9]{3})?$/;
16
+ const idsPlaceholder = '{ids}';
17
+ const maxEncodedQueryLength = 14000;
18
+ class QueryIds extends SfCommand {
19
+ run() {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ const { flags } = yield this.parse(QueryIds);
22
+ const ux = new Ux({ jsonEnabled: this.jsonEnabled() });
23
+ const org = flags['target-org'];
24
+ if (org == null) {
25
+ throw messages.createError('error.noTargetOrg');
26
+ }
27
+ validateQuery(flags.query);
28
+ const parsedIds = parseIdsFromFile(flags.file);
29
+ const processedIds = flags.limit == null ? parsedIds.uniqueIds : parsedIds.uniqueIds.slice(0, flags.limit);
30
+ if (processedIds.length === 0) {
31
+ throw messages.createError('error.noIds');
32
+ }
33
+ const batches = flags['batch-size'] == null ? buildAutomaticBatches(processedIds, flags.query) : buildFixedBatches(processedIds, flags['batch-size']);
34
+ const connection = org.getConnection();
35
+ const records = [];
36
+ yield batches.reduce((previousBatch, batch, index) => __awaiter(this, void 0, void 0, function* () {
37
+ yield previousBatch;
38
+ ux.spinner.start(messages.getMessage('info.queryingBatch', [(index + 1).toString(), batches.length.toString()]));
39
+ try {
40
+ const batchRecords = yield runQuery(connection, buildQuery(flags.query, batch));
41
+ records.push(...batchRecords);
42
+ }
43
+ finally {
44
+ ux.spinner.stop();
45
+ }
46
+ }), Promise.resolve());
47
+ const flattenedRecords = records.map((record) => flattenRecord(record));
48
+ if (flags.csv != null) {
49
+ writeCsv(flags.csv, flattenedRecords);
50
+ ux.log(messages.getMessage('info.csvWritten', [records.length.toString(), flags.csv]));
51
+ }
52
+ else {
53
+ renderTable(ux, flattenedRecords);
54
+ }
55
+ ux.log(messages.getMessage('info.summary', [
56
+ processedIds.length.toString(),
57
+ batches.length.toString(),
58
+ records.length.toString(),
59
+ parsedIds.duplicateIds.toString(),
60
+ ]));
61
+ return {
62
+ totalRows: parsedIds.totalRows,
63
+ validIds: parsedIds.uniqueIds.length,
64
+ uniqueIds: parsedIds.uniqueIds.length,
65
+ duplicateIds: parsedIds.duplicateIds,
66
+ limit: flags.limit,
67
+ processedIds: processedIds.length,
68
+ batches: batches.length,
69
+ recordsReturned: records.length,
70
+ records,
71
+ };
72
+ });
73
+ }
74
+ }
75
+ QueryIds.summary = messages.getMessage('summary');
76
+ QueryIds.description = messages.getMessage('description');
77
+ QueryIds.examples = messages.getMessages('examples');
78
+ QueryIds.flags = {
79
+ 'target-org': Flags.optionalOrg({
80
+ summary: messages.getMessage('flags.target-org.summary'),
81
+ char: 'o',
82
+ }),
83
+ file: Flags.file({
84
+ summary: messages.getMessage('flags.file.summary'),
85
+ char: 'f',
86
+ required: true,
87
+ exists: true,
88
+ }),
89
+ query: Flags.string({
90
+ summary: messages.getMessage('flags.query.summary'),
91
+ char: 'q',
92
+ required: true,
93
+ }),
94
+ 'batch-size': Flags.integer({
95
+ summary: messages.getMessage('flags.batch-size.summary'),
96
+ char: 'b',
97
+ min: 1,
98
+ }),
99
+ csv: Flags.file({
100
+ summary: messages.getMessage('flags.csv.summary'),
101
+ char: 'c',
102
+ required: false,
103
+ }),
104
+ limit: Flags.integer({
105
+ summary: messages.getMessage('flags.limit.summary'),
106
+ char: 'l',
107
+ min: 1,
108
+ }),
109
+ };
110
+ export default QueryIds;
111
+ const parseIdsFromFile = (filePath) => {
112
+ const rows = readFileSync(filePath, 'utf8')
113
+ .split(/\r?\n/)
114
+ .map((row) => row.trim())
115
+ .filter((row) => row.length > 0);
116
+ const uniqueIds = [];
117
+ const seenIds = new Set();
118
+ let duplicateIds = 0;
119
+ for (const row of rows) {
120
+ if (!idPattern.test(row)) {
121
+ throw messages.createError('error.invalidId', [row]);
122
+ }
123
+ if (seenIds.has(row)) {
124
+ duplicateIds += 1;
125
+ }
126
+ else {
127
+ uniqueIds.push(row);
128
+ seenIds.add(row);
129
+ }
130
+ }
131
+ return {
132
+ totalRows: rows.length,
133
+ uniqueIds,
134
+ duplicateIds,
135
+ };
136
+ };
137
+ const validateQuery = (query) => {
138
+ const placeholderCount = query.split(idsPlaceholder).length - 1;
139
+ if (placeholderCount !== 1) {
140
+ throw messages.createError('error.invalidPlaceholder', [idsPlaceholder]);
141
+ }
142
+ };
143
+ const buildFixedBatches = (ids, batchSize) => {
144
+ const batches = [];
145
+ for (let index = 0; index < ids.length; index += batchSize) {
146
+ batches.push(ids.slice(index, index + batchSize));
147
+ }
148
+ return batches;
149
+ };
150
+ const buildAutomaticBatches = (ids, query) => {
151
+ const batches = [];
152
+ let currentBatch = [];
153
+ for (const id of ids) {
154
+ const candidateBatch = [...currentBatch, id];
155
+ if (getEncodedQueryLength(buildQuery(query, candidateBatch)) > maxEncodedQueryLength) {
156
+ if (currentBatch.length === 0) {
157
+ throw messages.createError('error.queryTooLongForSingleId', [id]);
158
+ }
159
+ batches.push(currentBatch);
160
+ currentBatch = [id];
161
+ }
162
+ else {
163
+ currentBatch = candidateBatch;
164
+ }
165
+ }
166
+ if (currentBatch.length > 0) {
167
+ batches.push(currentBatch);
168
+ }
169
+ return batches;
170
+ };
171
+ const buildQuery = (query, ids) => query.replace(idsPlaceholder, `(${ids.map((id) => `'${id}'`).join(', ')})`);
172
+ const getEncodedQueryLength = (query) => Buffer.byteLength(encodeURIComponent(query), 'utf8');
173
+ const runQuery = (connection, query) => __awaiter(void 0, void 0, void 0, function* () {
174
+ const records = [];
175
+ const result = yield connection.query(query);
176
+ records.push(...result.records);
177
+ yield queryMoreRecords(connection, result, records);
178
+ return records;
179
+ });
180
+ const queryMoreRecords = (connection, result, records) => __awaiter(void 0, void 0, void 0, function* () {
181
+ if (result.done || result.nextRecordsUrl == null) {
182
+ return;
183
+ }
184
+ const nextResult = yield connection.queryMore(result.nextRecordsUrl);
185
+ records.push(...nextResult.records);
186
+ yield queryMoreRecords(connection, nextResult, records);
187
+ });
188
+ const flattenRecord = (record) => {
189
+ const flattenedRecord = flattenValue(record, '');
190
+ delete flattenedRecord.attributes;
191
+ return flattenedRecord;
192
+ };
193
+ const flattenValue = (value, prefix) => {
194
+ if (isPlainObject(value)) {
195
+ const flattenedRecord = {};
196
+ for (const [key, childValue] of Object.entries(value)) {
197
+ if (key === 'attributes') {
198
+ continue;
199
+ }
200
+ Object.assign(flattenedRecord, flattenValue(childValue, prefix.length === 0 ? key : `${prefix}.${key}`));
201
+ }
202
+ return flattenedRecord;
203
+ }
204
+ else {
205
+ return {
206
+ [prefix]: value,
207
+ };
208
+ }
209
+ };
210
+ const isPlainObject = (value) => value != null && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Date);
211
+ const renderTable = (ux, records) => {
212
+ if (records.length === 0) {
213
+ ux.log(messages.getMessage('info.noRecords'));
214
+ return;
215
+ }
216
+ const columns = getColumns(records);
217
+ ux.table(records, Object.fromEntries(columns.map((column) => [column, { header: column, get: (row) => row[column] }])));
218
+ };
219
+ const getColumns = (records) => {
220
+ const columns = new Set();
221
+ for (const record of records) {
222
+ for (const key of Object.keys(record)) {
223
+ columns.add(key);
224
+ }
225
+ }
226
+ return Array.from(columns);
227
+ };
228
+ const writeCsv = (filePath, records) => {
229
+ const columns = getColumns(records);
230
+ const rows = [columns.map(escapeCsvValue).join(',')];
231
+ for (const record of records) {
232
+ rows.push(columns.map((column) => escapeCsvValue(record[column])).join(','));
233
+ }
234
+ writeFileSync(filePath, `${rows.join('\n')}\n`, 'utf8');
235
+ };
236
+ const escapeCsvValue = (value) => {
237
+ if (value == null) {
238
+ return '';
239
+ }
240
+ const stringValue = typeof value === 'string' ? value : JSON.stringify(value);
241
+ if (/[",\n\r]/.test(stringValue)) {
242
+ return `"${stringValue.replace(/"/g, '""')}"`;
243
+ }
244
+ return stringValue;
245
+ };
246
+ //# sourceMappingURL=ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.js","sourceRoot":"","sources":["../../../../src/commands/raven/query/ids.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AAEnE,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;AAEtE,MAAM,SAAS,GAAG,oCAAoC,CAAC;AACvD,MAAM,cAAc,GAAG,OAAO,CAAC;AAC/B,MAAM,qBAAqB,GAAG,KAAM,CAAC;AA4BrC,MAAqB,QAAS,SAAQ,SAAyB;IAsChD,GAAG;;YACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAC7C,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YACvD,MAAM,GAAG,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;YAEhC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;gBAChB,MAAM,QAAQ,CAAC,W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,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,KAAc,EAAU,EAAE;IAChD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,WAAW,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAE9E,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;IAChD,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC"}
@@ -0,0 +1,73 @@
1
+ # summary
2
+
3
+ Cancel a pending or in-progress Salesforce deploy.
4
+
5
+ # description
6
+
7
+ Query the target org for pending or in-progress deploy requests, select one from an interactive list, confirm the cancellation, and submit an asynchronous deploy cancel request.
8
+
9
+ # examples
10
+
11
+ Cancel a deploy in the default org:
12
+
13
+ <%= config.bin %> <%= command.id %>
14
+
15
+ Cancel a deploy in a specific org:
16
+
17
+ <%= config.bin %> <%= command.id %> --target-org dev
18
+
19
+ # flags.target-org.summary
20
+
21
+ Login username or alias for the target org. Uses the default org when omitted.
22
+
23
+ # info.loadingDeploys
24
+
25
+ 🔎 Loading pending and in-progress deploys...
26
+
27
+ # info.noDeploys
28
+
29
+ ✅ No pending or in-progress deploys found.
30
+
31
+ # info.noSelection
32
+
33
+ â†Šī¸ No deploy was selected.
34
+
35
+ # info.cancelAborted
36
+
37
+ â†Šī¸ Deploy cancel aborted.
38
+
39
+ # info.cancelSubmitted
40
+
41
+ 🛑 Deploy cancel submitted for job %s.
42
+
43
+ # prompt.selectDeploy
44
+
45
+ Select a deploy to cancel
46
+
47
+ # prompt.confirmCancel
48
+
49
+ Are you sure you want to cancel job %s
50
+
51
+ # label.unknownStartDate
52
+
53
+ Unknown start time
54
+
55
+ # label.inProgress
56
+
57
+ đŸŸĸ In Progress
58
+
59
+ # label.pending
60
+
61
+ 🟡 Pending
62
+
63
+ # label.cancel
64
+
65
+ Cancel
66
+
67
+ # error.cancelFailed
68
+
69
+ sf project deploy cancel failed with exit code %s.
70
+
71
+ # error.noTargetOrg
72
+
73
+ No target org was supplied and no default target org was resolved.