@terafina/tffa-sfdx-plugin 16.0.0-rc.1 → 16.0.0-rc.2

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
@@ -41,7 +41,7 @@ $ npm install -g @terafina/tffa-sfdx-plugin
41
41
  $ sfdx COMMAND
42
42
  running command...
43
43
  $ sfdx (--version|-v)
44
- @terafina/tffa-sfdx-plugin/16.0.0-rc.1 linux-x64 node-v16.13.1
44
+ @terafina/tffa-sfdx-plugin/16.0.0-rc.2 linux-x64 node-v16.13.1
45
45
  $ sfdx --help [COMMAND]
46
46
  USAGE
47
47
  $ sfdx COMMAND
@@ -54,6 +54,7 @@ USAGE
54
54
  <!-- commands -->
55
55
  * [`sfdx help [COMMAND]`](#sfdx-help-command)
56
56
  * [`sfdx tffa:apexdoc [-s <directory>] [-d <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-tffaapexdoc--s-directory--d-directory---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
57
+ * [`sfdx tffa:data:export -s <array> [-d <string>] [-g <string>] [-o <array>] [-c <array>] [-s] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-tffadataexport--s-array--d-string--g-string--o-array--c-array--s--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
57
58
  * [`sfdx tffa:lint [-s <directory>] [-m <integer>] [-r <filepath>] [-e] [-f] [-j] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-tffalint--s-directory--m-integer--r-filepath--e--f--j---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
58
59
  * [`sfdx tffa:meta [-s <directory>] [-d <directory>] [-c <directory>] [-o json|csv|human] [-f] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-tffameta--s-directory--d-directory--c-directory--o-jsoncsvhuman--f---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
59
60
  * [`sfdx tffa:ping [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-tffaping---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
@@ -104,7 +105,77 @@ EXAMPLES
104
105
  Generate Apex API Documentation : $sfdx tffa:apexdoc
105
106
  ```
106
107
 
107
- _See code: [src/commands/tffa/apexdoc.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v16.0.0-rc.1/src/commands/tffa/apexdoc.ts)_
108
+ _See code: [src/commands/tffa/apexdoc.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v16.0.0-rc.2/src/commands/tffa/apexdoc.ts)_
109
+
110
+ ## `sfdx tffa:data:export -s <array> [-d <string>] [-g <string>] [-o <array>] [-c <array>] [-s] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
111
+
112
+ Exports records of specified sobject types from target org into JSON file(s). Primarily used for exporting business configurations.
113
+
114
+ ```
115
+ USAGE
116
+ $ sfdx tffa:data:export -s <array> [-d <string>] [-g <string>] [-o <array>] [-c <array>] [-s] [-u <string>]
117
+ [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
118
+
119
+ FLAGS
120
+ -c, --children=<value>
121
+ the child relationships to be included in the exported records; this is not required for tffa package objects. e.g.
122
+ tffa__Features__r,tffa__Terms__r child relationships are auto included when running export command for
123
+ tffa__Product__c
124
+
125
+ -d, --outputdir=<value>
126
+ [default: ./data/configuration] output directory where the JSON files of exported records will be placed
127
+
128
+ -g, --groupby=<value>
129
+ the field to be used for grouping the exported records; records belonging to each group are placed in separate JSON
130
+ files (filename suffixed by group name)
131
+
132
+ -o, --orderby=<value>
133
+ the fields to be used for sorting the exported records
134
+
135
+ -s, --skipconfigplan
136
+ skip import of exported record JSON files into configuration plan
137
+
138
+ -s, --sobjecttype=<value>
139
+ (required) sobject types of records to be exported
140
+
141
+ -u, --targetusername=<value>
142
+ username or alias for the target org; overrides default target org
143
+
144
+ --apiversion=<value>
145
+ override the api version used for api requests made by this command
146
+
147
+ --json
148
+ format output as json
149
+
150
+ --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)
151
+ [default: warn] logging level for this command invocation
152
+
153
+ DESCRIPTION
154
+ Exports records of specified sobject types from target org into JSON file(s). Primarily used for exporting business
155
+ configurations.
156
+
157
+ The export command requires a target org for exporting records. Run this command from within a sfdx project containing
158
+ a default username or specify targetusername explicitly.
159
+
160
+ EXAMPLES
161
+ $ sfdx tffa:data:export --sobjecttype tffa__Product__c
162
+ Fetched 101 records of tffa__Product__c
163
+ Writing 24 records to ./data/configuration/Product__c.json
164
+ Writing 30 records to ./data/configuration/Product__c1.json
165
+ Writing 20 records to ./data/configuration/Product__c2.json
166
+ Writing 27 records to ./data/configuration/Product__c3.json
167
+
168
+
169
+ $ sfdx tffa:data:export --sobjecttype tffa__DisclosureTemplate__c,tffa__DisclosureChecklist__c,tffa__DisclosureMatrix__c
170
+ Fetched 81 records of tffa__DisclosureTemplate__c
171
+ Writing 81 records to ./data/configuration/DisclosureTemplate__c.json
172
+ Fetched 57 records of tffa__DisclosureChecklist__c
173
+ Writing 57 records to ./data/configuration/DisclosureChecklist__c.json
174
+ Fetched 144 records of tffa__DisclosureMatrix__c
175
+ Writing 144 records to ./data/configuration/DisclosureMatrix__c.json
176
+ ```
177
+
178
+ _See code: [src/commands/tffa/data/export.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v16.0.0-rc.2/src/commands/tffa/data/export.ts)_
108
179
 
109
180
  ## `sfdx tffa:lint [-s <directory>] [-m <integer>] [-r <filepath>] [-e] [-f] [-j] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
110
181
 
@@ -134,7 +205,7 @@ EXAMPLES
134
205
  $sfdx tffa:lint
135
206
  ```
136
207
 
137
- _See code: [src/commands/tffa/lint.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v16.0.0-rc.1/src/commands/tffa/lint.ts)_
208
+ _See code: [src/commands/tffa/lint.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v16.0.0-rc.2/src/commands/tffa/lint.ts)_
138
209
 
139
210
  ## `sfdx tffa:meta [-s <directory>] [-d <directory>] [-c <directory>] [-o json|csv|human] [-f] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
140
211
 
@@ -163,7 +234,7 @@ EXAMPLES
163
234
  scan a sfdx project for metadata : $sfdx tffa:meta
164
235
  ```
165
236
 
166
- _See code: [src/commands/tffa/meta.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v16.0.0-rc.1/src/commands/tffa/meta.ts)_
237
+ _See code: [src/commands/tffa/meta.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v16.0.0-rc.2/src/commands/tffa/meta.ts)_
167
238
 
168
239
  ## `sfdx tffa:ping [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
169
240
 
@@ -185,7 +256,7 @@ EXAMPLES
185
256
  $ sfdx tffa:ping
186
257
  ```
187
258
 
188
- _See code: [src/commands/tffa/ping.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v16.0.0-rc.1/src/commands/tffa/ping.ts)_
259
+ _See code: [src/commands/tffa/ping.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v16.0.0-rc.2/src/commands/tffa/ping.ts)_
189
260
 
190
261
  ## `sfdx tffa:source:apiset [-h <help>] [-s <directory>] [-a <integer>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
191
262
 
@@ -213,7 +284,7 @@ EXAMPLES
213
284
  $ sfdx tffa:source:apiset
214
285
  ```
215
286
 
216
- _See code: [src/commands/tffa/source/apiset.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v16.0.0-rc.1/src/commands/tffa/source/apiset.ts)_
287
+ _See code: [src/commands/tffa/source/apiset.ts](https://github.com/terafina/tffa-sfdx-plugin/blob/v16.0.0-rc.2/src/commands/tffa/source/apiset.ts)_
217
288
 
218
289
  ## `sfdx version`
219
290
 
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Copyright (c) NCR Terafina
3
+ **/
4
+ import { FlagsConfig, SfdxCommand } from '@salesforce/command';
5
+ export default class DataExport extends SfdxCommand {
6
+ static requiresUsername: boolean;
7
+ static description: string;
8
+ static examples: string[];
9
+ protected static flagsConfig: FlagsConfig;
10
+ /**
11
+ * Custom prefixes
12
+ */
13
+ private sObjectTypePrefixMap;
14
+ run(): Promise<any>;
15
+ private execute;
16
+ /**
17
+ * Gets fields to be included when exporting records.
18
+ */
19
+ private getFields;
20
+ /**
21
+ * Gets the field to be used for ordering when exporting the records.
22
+ */
23
+ private getOrderBy;
24
+ /**
25
+ * Transforms the exported records, making it ready for writing to config files
26
+ * @param records
27
+ */
28
+ private transform;
29
+ /**
30
+ * Gets the external id of the record
31
+ * @param record
32
+ * @returns
33
+ * @throws Error if external id or equivalent is not found
34
+ */
35
+ private getExternalId;
36
+ /**
37
+ * Gets the reference id for the record
38
+ * @param record
39
+ */
40
+ private getReferenceId;
41
+ /**
42
+ * Gets the object prefix to be used when building the reference id
43
+ * @param sObjectType
44
+ * @returns
45
+ */
46
+ private getPrefix;
47
+ /**
48
+ * Writes records to JSON files
49
+ * @param records
50
+ */
51
+ private writeRecords;
52
+ /**
53
+ * Counts the number of SObjects within the record. e.g. a record containing child relationships may contain more than one SObject.
54
+ * @param record
55
+ * @returns
56
+ */
57
+ private getSObjectCount;
58
+ /**
59
+ * Gets the export plan for the specified object type.
60
+ * @param sObjectType
61
+ * @returns
62
+ */
63
+ private getExportPlan;
64
+ private getChildExportPlan;
65
+ /**
66
+ * Returns a map of records where key is record.Id and value is record.
67
+ * @param records
68
+ * @returns
69
+ */
70
+ private toMap;
71
+ }
@@ -0,0 +1,382 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Copyright (c) NCR Terafina
5
+ **/
6
+ const command_1 = require("@salesforce/command");
7
+ const core_1 = require("@salesforce/core");
8
+ const fs_extra_1 = require("fs-extra");
9
+ // Initialize Messages with the current plugin directory
10
+ core_1.Messages.importMessagesDirectory(__dirname);
11
+ // Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
12
+ // or any library that is using the messages framework can also be loaded this way.
13
+ const messages = core_1.Messages.loadMessages('@terafina/tffa-sfdx-plugin', 'dataExport');
14
+ /**
15
+ * Represents a plan to export records of a specific SObject type.
16
+ */
17
+ class ExportPlan {
18
+ constructor(plan) {
19
+ Object.assign(this, plan);
20
+ if (!this.name) {
21
+ this.name = this.sObjectType;
22
+ }
23
+ }
24
+ }
25
+ /**
26
+ * Common regex used
27
+ */
28
+ const NON_ALPHANUM_RE = /[^a-zA-Z0-9]+/g;
29
+ const UPPER_LOWER_RE = /[A-Z][a-z]+/g;
30
+ const REFERENCE_ID_RE = /referenceId/g;
31
+ const MAX_OBJECTS_IN_FILE = 200;
32
+ /**
33
+ * Some internal configurations
34
+ */
35
+ const EXCLUDED_FIELDS = new Set(['OwnerId', 'RecordTypeId', 'tffa__IsDeleted__c']);
36
+ const EXTERNAL_ID_FIELDS = new Set(['ExternalId__c', 'tffa__ExternalId__c']);
37
+ const SORT_ORDER_FIELDS = new Set(['SortOrder__c', 'tffa__SortOrder__c']);
38
+ const CONTENT_URL_FIELDS = new Set(['ImageUrl__c', 'tffa__ImageUrl__c', 'tffa__Url__c']);
39
+ /**
40
+ * Export plans of SObject types that require fetching of child relationships, custom grouping, sorting etc.
41
+ * Export plans of SObject types that are simple and limited to itself need not be included here.
42
+ */
43
+ const EXPORT_PLANS = Object.fromEntries([
44
+ new ExportPlan({
45
+ sObjectType: 'tffa__Product__c',
46
+ children: ['tffa__Features__r', 'tffa__Terms__r'],
47
+ where: "tffa__Type__c='PRODUCT'"
48
+ }),
49
+ new ExportPlan({
50
+ sObjectType: 'tffa__Questionnaire__c',
51
+ groupBy: 'tffa__Type__c',
52
+ children: ['tffa__Outcomes__r', 'tffa__QuestionGroups__r'],
53
+ prefix: 'qn'
54
+ }),
55
+ new ExportPlan({ sObjectType: 'tffa__QuestionGroupTemplate__c', children: ['tffa__Questions__r'] }),
56
+ new ExportPlan({ sObjectType: 'tffa__AddOnService__c', orderBy: ['tffa__Type__c', 'Name'] }),
57
+ new ExportPlan({
58
+ sObjectType: 'tffa__ApplicationDecisionMatrix__c',
59
+ children: ['tffa__CounterOffers__r'],
60
+ orderBy: ['tffa__Type__c', 'tffa__SortOrder__c']
61
+ }),
62
+ new ExportPlan({ sObjectType: 'tffa__Brand__c', children: ['tffa__Locations__r'], prefix: 'brand', orderBy: ['tffa__SortOrder__c'] }),
63
+ new ExportPlan({ sObjectType: 'tffa__DecisionStrategyConfiguration__c', children: ['tffa__Strategies__r'] }),
64
+ new ExportPlan({ sObjectType: 'tffa__Offer__c', children: ['tffa__Terms__r'], orderBy: ['tffa__ProductCategory__c', 'Name'] }),
65
+ new ExportPlan({ sObjectType: 'tffa__Promotion__c', children: ['tffa__Plans__r'], prefix: 'pr' }),
66
+ new ExportPlan({ sObjectType: 'tffa__ListOfValues__c', groupBy: 'tffa__Locale__c' }),
67
+ new ExportPlan({
68
+ name: 'tffa__ProductBundle__c',
69
+ sObjectType: 'tffa__Product__c',
70
+ children: ['tffa__Features__r', 'tffa__Terms__r', 'tffa__ProductXrefs__r'],
71
+ where: "tffa__Type__c='BUNDLE'"
72
+ }),
73
+ new ExportPlan({ name: 'tffa__Address__c', sObjectType: 'tffa__Location__c', map: l => l.tffa__Address__r, prefix: 'addr' }),
74
+ new ExportPlan({ sObjectType: 'tffa__AddOnServiceChecklist__c', children: ['tffa__Items__r'], prefix: 'aoscl' }),
75
+ new ExportPlan({ sObjectType: 'tffa__DisclosureChecklist__c', children: ['tffa__Items__r'], prefix: 'dcl' }),
76
+ new ExportPlan({ sObjectType: 'tffa__StipulationChecklist__c', children: ['tffa__Items__r'], prefix: 'scl' }),
77
+ new ExportPlan({ sObjectType: 'tffa__DepositBoxConfiguration__c', children: ['tffa__Items__r'] }),
78
+ new ExportPlan({ sObjectType: 'tffa__RecommendationConfiguration__c', children: ['tffa__Items__r'] }),
79
+ new ExportPlan({ sObjectType: 'tffa__UXStrategy__c', prefix: 'uxs', orderBy: ['tffa__AppPage__c', 'tffa__SortOrder__c'] }),
80
+ new ExportPlan({ sObjectType: 'tffa__AllowedAddress__c', orderBy: ['tffa__SortOrder__c'] }),
81
+ new ExportPlan({ sObjectType: 'tffa__QuestionnaireMatrix__c', orderBy: ['tffa__Type__c', 'tffa__SortOrder__c'] })
82
+ ].map(p => [p.name, p]));
83
+ class DataExport extends command_1.SfdxCommand {
84
+ constructor() {
85
+ super(...arguments);
86
+ /**
87
+ * Custom prefixes
88
+ */
89
+ this.sObjectTypePrefixMap = new Map();
90
+ }
91
+ async run() {
92
+ for (const sObjectType of this.flags.sobjecttype) {
93
+ const plan = this.getExportPlan(sObjectType);
94
+ this.ux.startSpinner(`Fetching record(s) of ${sObjectType}`);
95
+ const records = await this.execute(plan);
96
+ this.ux.stopSpinner(`completed`);
97
+ this.log(`Fetched ${records.length} records of ${sObjectType}`);
98
+ this.transform(records);
99
+ if (records.length) {
100
+ this.writeRecords(records, plan);
101
+ }
102
+ }
103
+ }
104
+ async execute(plan, parent) {
105
+ let qb = this.org
106
+ .getConnection()
107
+ .sobject(plan.sObjectType)
108
+ .select(await this.getFields(plan, !!parent))
109
+ .orderby((await this.getOrderBy(plan, !parent && !plan.sObjectType.endsWith('Matrix__c'))).map(e => [e, 'asc']))
110
+ .where(plan.where);
111
+ for (const child of plan.children || []) {
112
+ const childPlan = await this.getChildExportPlan(plan.sObjectType, child);
113
+ qb = qb
114
+ .include(child)
115
+ .select(await this.getFields(childPlan, true))
116
+ .orderby((await this.getOrderBy(childPlan)).map(e => [e, 'asc']))
117
+ .end();
118
+ }
119
+ let records = await qb.execute();
120
+ if (plan.map) {
121
+ records = records.map(plan.map);
122
+ }
123
+ for (const child of plan.children || []) {
124
+ const childPlan = await this.getChildExportPlan(plan.sObjectType, child);
125
+ if (childPlan.children?.length) {
126
+ const childRecordMap = this.toMap(await this.execute(childPlan, plan));
127
+ for (const record of records) {
128
+ const relationshipNode = record[child];
129
+ if (relationshipNode) {
130
+ for (const [i, childRecord] of relationshipNode.records.entries()) {
131
+ relationshipNode.records[i] = childRecordMap.get(childRecord.Id) || childRecord;
132
+ }
133
+ }
134
+ }
135
+ }
136
+ }
137
+ return records;
138
+ }
139
+ /**
140
+ * Gets fields to be included when exporting records.
141
+ */
142
+ async getFields(plan, skipMasterDetail = false, skipLookup = false) {
143
+ const sObjectType = plan.sObjectType;
144
+ const fields = ['Id'];
145
+ const conn = this.org.getConnection();
146
+ const describeResult = await conn.describe$(sObjectType);
147
+ for (const f of describeResult.fields) {
148
+ if (EXCLUDED_FIELDS.has(f.name) || !f.createable) {
149
+ continue;
150
+ }
151
+ if (f.referenceTo?.length) {
152
+ if (!skipLookup && (f.relationshipOrder !== 0 || !skipMasterDetail)) {
153
+ fields.push(f.name);
154
+ const refFields = await this.getFields(new ExportPlan({ sObjectType: f.referenceTo[0] }), true, true);
155
+ refFields.forEach(lf => fields.push(`${f.relationshipName}.${lf}`));
156
+ }
157
+ }
158
+ else {
159
+ fields.push(f.name);
160
+ }
161
+ }
162
+ return fields;
163
+ }
164
+ /**
165
+ * Gets the field to be used for ordering when exporting the records.
166
+ */
167
+ async getOrderBy(plan, skipSortOrder = false) {
168
+ const sObjectType = plan.sObjectType;
169
+ if (plan.orderBy) {
170
+ return plan.orderBy;
171
+ }
172
+ let sortOrderField = ['Name'];
173
+ if (!skipSortOrder) {
174
+ const describeResult = await this.org.getConnection().describe$(sObjectType);
175
+ for (const f of describeResult.fields) {
176
+ if (SORT_ORDER_FIELDS.has(f.name)) {
177
+ sortOrderField = [f.name];
178
+ break;
179
+ }
180
+ }
181
+ }
182
+ return sortOrderField;
183
+ }
184
+ /**
185
+ * Transforms the exported records, making it ready for writing to config files
186
+ * @param records
187
+ */
188
+ transform(records) {
189
+ for (const record of records) {
190
+ record.attributes.referenceId = this.getReferenceId(record);
191
+ record.attributes.url = undefined;
192
+ record.Id = undefined;
193
+ for (const [k, v] of Object.entries(record)) {
194
+ if (v === null || v === undefined) {
195
+ record[k] = undefined;
196
+ }
197
+ else if (typeof v === 'object' && k.endsWith('__r')) {
198
+ if (v.records) {
199
+ this.transform(v.records);
200
+ }
201
+ else {
202
+ record[k.replace('__r', '__c')] = `@${this.getReferenceId(v)}`;
203
+ record[k] = undefined;
204
+ }
205
+ }
206
+ else {
207
+ if (CONTENT_URL_FIELDS.has(k) && v.startsWith('/file-asset')) {
208
+ const url = new URL(v, 'http://localhost');
209
+ url.searchParams.delete('oid');
210
+ record[k] = url.pathname + url.search;
211
+ }
212
+ }
213
+ }
214
+ }
215
+ }
216
+ /**
217
+ * Gets the external id of the record
218
+ * @param record
219
+ * @returns
220
+ * @throws Error if external id or equivalent is not found
221
+ */
222
+ getExternalId(record) {
223
+ let externalId;
224
+ for (const externalIdField of EXTERNAL_ID_FIELDS) {
225
+ externalId = record[externalIdField];
226
+ if (externalId) {
227
+ break;
228
+ }
229
+ }
230
+ if (!externalId) {
231
+ throw new Error(`No external id found for sobject ${record.attributes.type} id=${record.Id}`);
232
+ }
233
+ return externalId;
234
+ }
235
+ /**
236
+ * Gets the reference id for the record
237
+ * @param record
238
+ */
239
+ getReferenceId(record) {
240
+ const sObjectType = record.attributes.type;
241
+ return `${this.getPrefix(sObjectType)}_${this.getExternalId(record)}`.replace(NON_ALPHANUM_RE, '_');
242
+ }
243
+ /**
244
+ * Gets the object prefix to be used when building the reference id
245
+ * @param sObjectType
246
+ * @returns
247
+ */
248
+ getPrefix(sObjectType) {
249
+ let prefix = this.sObjectTypePrefixMap.get(sObjectType) || this.getExportPlan(sObjectType).prefix;
250
+ if (!prefix) {
251
+ prefix = sObjectType
252
+ .match(UPPER_LOWER_RE)
253
+ .map(e => e[0])
254
+ .join('')
255
+ .toLowerCase();
256
+ this.sObjectTypePrefixMap.set(sObjectType, prefix);
257
+ }
258
+ return prefix;
259
+ }
260
+ /**
261
+ * Writes records to JSON files
262
+ * @param records
263
+ */
264
+ writeRecords(records, plan) {
265
+ const objectName = plan.name.replace('tffa__', '');
266
+ const outputDir = this.flags.outputdir;
267
+ const groupBy = plan.groupBy || '_';
268
+ (0, fs_extra_1.mkdirpSync)(outputDir);
269
+ const groupMap = new Map();
270
+ if (groupBy === '_') {
271
+ groupMap.set(groupBy, records);
272
+ }
273
+ else {
274
+ for (const record of records) {
275
+ const k = record[groupBy] || '_';
276
+ const group = groupMap.get(k) || groupMap.set(k, []).get(k);
277
+ group.push(record);
278
+ }
279
+ }
280
+ const filenames = [];
281
+ for (const [k, group] of groupMap.entries()) {
282
+ let batch = [];
283
+ let batchObjectCount = 0;
284
+ const batches = [batch];
285
+ for (const record of group) {
286
+ const count = this.getSObjectCount(record);
287
+ if (count + batchObjectCount > MAX_OBJECTS_IN_FILE) {
288
+ batch = [];
289
+ batches.push(batch);
290
+ batchObjectCount = 0;
291
+ }
292
+ batch.push(record);
293
+ batchObjectCount += count;
294
+ }
295
+ for (const [i, batch] of batches.entries()) {
296
+ const filename = `${objectName}${k === '_' ? '' : '-' + k}${i || ''}.json`;
297
+ const filepath = `${outputDir}/${filename}`;
298
+ this.log(`Writing ${batch.length} records to ${filepath}`);
299
+ (0, fs_extra_1.writeFileSync)(filepath, JSON.stringify({ records: batch }, null, 2));
300
+ filenames.push(filename);
301
+ }
302
+ }
303
+ if (!this.flags.skipconfigplan && plan.name === plan.sObjectType) {
304
+ const configPlanFilepath = `${outputDir}/config-data-plan.json`;
305
+ if ((0, fs_extra_1.existsSync)(configPlanFilepath)) {
306
+ const configPlans = JSON.parse((0, fs_extra_1.readFileSync)(configPlanFilepath, 'utf-8'));
307
+ let configPlan = configPlans.find(cp => cp.sobject === plan.sObjectType);
308
+ if (!configPlan) {
309
+ configPlan = { sobject: plan.sObjectType, files: [] };
310
+ configPlans.push(configPlan);
311
+ }
312
+ // update only if something changed
313
+ if (configPlan.files?.toString() !== filenames.toString()) {
314
+ configPlan.files = filenames;
315
+ (0, fs_extra_1.writeFileSync)(configPlanFilepath, JSON.stringify(configPlans, null, 2));
316
+ }
317
+ }
318
+ }
319
+ }
320
+ /**
321
+ * Counts the number of SObjects within the record. e.g. a record containing child relationships may contain more than one SObject.
322
+ * @param record
323
+ * @returns
324
+ */
325
+ getSObjectCount(record) {
326
+ return (JSON.stringify(record).match(REFERENCE_ID_RE) || []).length;
327
+ }
328
+ /**
329
+ * Gets the export plan for the specified object type.
330
+ * @param sObjectType
331
+ * @returns
332
+ */
333
+ getExportPlan(sObjectType) {
334
+ const plan = new ExportPlan({ sObjectType, ...(EXPORT_PLANS[sObjectType] || {}) });
335
+ const { sobjecttype: sobjecttypes, children, groupby, orderby } = this.flags;
336
+ if (sobjecttypes.length === 1 && sobjecttypes[0] === sObjectType) {
337
+ if (children) {
338
+ plan.children = children;
339
+ }
340
+ if (groupby) {
341
+ plan.groupBy = groupby;
342
+ }
343
+ if (orderby) {
344
+ plan.orderBy = orderby;
345
+ }
346
+ }
347
+ return plan;
348
+ }
349
+ async getChildExportPlan(sObjectType, relationshipName) {
350
+ const describeResult = await this.org.getConnection().describe$(sObjectType);
351
+ const relationship = describeResult.childRelationships.find(f => f.relationshipName === relationshipName);
352
+ if (!relationship) {
353
+ throw new Error(`Relationship ${relationshipName} not found on SObjectType ${sObjectType}`);
354
+ }
355
+ return this.getExportPlan(relationship.childSObject);
356
+ }
357
+ /**
358
+ * Returns a map of records where key is record.Id and value is record.
359
+ * @param records
360
+ * @returns
361
+ */
362
+ toMap(records) {
363
+ const recordMap = new Map();
364
+ for (const record of records) {
365
+ recordMap.set(record.Id, record);
366
+ }
367
+ return recordMap;
368
+ }
369
+ }
370
+ exports.default = DataExport;
371
+ DataExport.requiresUsername = true;
372
+ DataExport.description = messages.getMessage('commandDescription');
373
+ DataExport.examples = messages.getMessages('commandExamples');
374
+ DataExport.flagsConfig = {
375
+ sobjecttype: command_1.flags.array({ char: 's', required: true, description: messages.getMessage('sobjecttypeFlagDescription') }),
376
+ outputdir: command_1.flags.string({ char: 'd', description: messages.getMessage('outputdirFlagDescription'), default: './data/configuration' }),
377
+ groupby: command_1.flags.string({ char: 'g', required: false, description: messages.getMessage('groupbyFlagDescription') }),
378
+ orderby: command_1.flags.array({ char: 'o', required: false, description: messages.getMessage('orderbyFlagDescription') }),
379
+ children: command_1.flags.array({ char: 'c', required: false, description: messages.getMessage('childrenFlagDescription') }),
380
+ skipconfigplan: command_1.flags.boolean({ char: 's', required: false, description: messages.getMessage('skipconfigplanFlagDescription') })
381
+ };
382
+ //# sourceMappingURL=export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.js","sourceRoot":"","sources":["../../../../src/commands/tffa/data/export.ts"],"names":[],"mappings":";;AAAA;;IAEI;AACJ,iDAAsE;AACtE,2CAA4C;AAC5C,uCAA+E;AAE/E,wDAAwD;AACxD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAE5C,iGAAiG;AACjG,mFAAmF;AACnF,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,YAAY,CAAC,CAAC;AAEnF;;GAEG;AACH,MAAM,UAAU;IAmCd,YAAY,IAAyB;QACnC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACd,IA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AC,oBAAoB,CAAC,CAAC;AACxD,mBAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;AAChD,sBAAW,GAAgB;IAC1C,WAAW,EAAE,eAAK,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,4BAA4B,CAAC,EAAE,CAAC;IACvH,SAAS,EAAE,eAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,0BAA0B,CAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC;IACrI,OAAO,EAAE,eAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC,EAAE,CAAC;IACjH,OAAO,EAAE,eAAK,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC,EAAE,CAAC;IAChH,QAAQ,EAAE,eAAK,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,yBAAyB,CAAC,EAAE,CAAC;IAClH,cAAc,EAAE,eAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,+BAA+B,CAAC,EAAE,CAAC;CACjI,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright (c) NCR Terafina
3
+ **/
4
+ module.exports = {
5
+ commandDescription: `Exports records of specified sobject types from target org into JSON file(s). Primarily used for exporting business configurations.
6
+ The export command requires a target org for exporting records. Run this command from within a sfdx project containing a default username or specify targetusername explicitly.`,
7
+ sobjecttypeFlagDescription: 'sobject types of records to be exported',
8
+ outputdirFlagDescription: 'output directory where the JSON files of exported records will be placed',
9
+ groupbyFlagDescription:
10
+ 'the field to be used for grouping the exported records; records belonging to each group are placed in separate JSON files (filename suffixed by group name)',
11
+ orderbyFlagDescription: 'the fields to be used for sorting the exported records',
12
+ childrenFlagDescription:
13
+ 'the child relationships to be included in the exported records; this is not required for tffa package objects. e.g. tffa__Features__r,tffa__Terms__r child relationships are auto included when running export command for tffa__Product__c',
14
+ skipconfigplanFlagDescription: 'skip import of exported record JSON files into configuration plan',
15
+ commandExamples: [
16
+ `$ sfdx tffa:data:export --sobjecttype tffa__Product__c
17
+ Fetched 101 records of tffa__Product__c
18
+ Writing 24 records to ./data/configuration/Product__c.json
19
+ Writing 30 records to ./data/configuration/Product__c1.json
20
+ Writing 20 records to ./data/configuration/Product__c2.json
21
+ Writing 27 records to ./data/configuration/Product__c3.json
22
+ `,
23
+ `$ sfdx tffa:data:export --sobjecttype tffa__DisclosureTemplate__c,tffa__DisclosureChecklist__c,tffa__DisclosureMatrix__c
24
+ Fetched 81 records of tffa__DisclosureTemplate__c
25
+ Writing 81 records to ./data/configuration/DisclosureTemplate__c.json
26
+ Fetched 57 records of tffa__DisclosureChecklist__c
27
+ Writing 57 records to ./data/configuration/DisclosureChecklist__c.json
28
+ Fetched 144 records of tffa__DisclosureMatrix__c
29
+ Writing 144 records to ./data/configuration/DisclosureMatrix__c.json
30
+ `
31
+ ]
32
+ };
@@ -1 +1 @@
1
- {"version":"16.0.0-rc.1","commands":{"tffa:apexdoc":{"id":"tffa:apexdoc","description":"Generate Apex API Documentation","strict":true,"usage":"<%= command.id %> [-s <directory>] [-d <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["Generate Apex API Documentation :\t$sfdx tffa:apexdoc "],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"sourcefolder":{"name":"sourcefolder","type":"option","char":"s","description":"directory containing sfdx project","multiple":false,"default":"."},"destfolder":{"name":"destfolder","type":"option","char":"d","description":"directory to generate the api docs","multiple":false}},"args":[],"flagsConfig":{"sourcefolder":{"kind":"directory","char":"s","description":"directory containing sfdx project","default":".","input":[],"multiple":false,"type":"option"},"destfolder":{"kind":"directory","char":"d","description":"directory to generate the api docs","input":[],"multiple":false,"type":"option"}}},"tffa:lint":{"id":"tffa:lint","description":"scan a sfdx project and provide a violations report based on defined standards","strict":true,"usage":"<%= command.id %> [-s <directory>] [-m <integer>] [-r <filepath>] [-e] [-f] [-j] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["$sfdx tffa:lint"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"generate json output","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"sourcefolder":{"name":"sourcefolder","type":"option","char":"s","description":"directory containing sfdx project","multiple":false,"default":"."},"minapi":{"name":"minapi","type":"option","char":"m","description":"minimum api version to use during quality checks","multiple":false,"default":56},"rulesetpath":{"name":"rulesetpath","type":"option","char":"r","description":"path to pmd ruleset","multiple":false},"eject":{"name":"eject","type":"boolean","char":"e","description":"update local pmd ruleset","allowNo":false},"level":{"name":"level","type":"boolean","char":"f","description":"emit fatal violations only","allowNo":false}},"args":[],"flagsConfig":{"sourcefolder":{"kind":"directory","char":"s","description":"directory containing sfdx project","default":".","input":[],"multiple":false,"type":"option"},"minapi":{"kind":"integer","char":"m","description":"minimum api version to use during quality checks","default":56,"input":[],"multiple":false,"type":"option"},"json":{"kind":"boolean","char":"j","description":"generate json output","allowNo":false,"type":"boolean"},"rulesetpath":{"kind":"filepath","char":"r","description":"path to pmd ruleset","input":[],"multiple":false,"type":"option"},"eject":{"kind":"boolean","char":"e","description":"update local pmd ruleset","allowNo":false,"type":"boolean"},"level":{"kind":"boolean","char":"f","description":"emit fatal violations only","allowNo":false,"type":"boolean"}}},"tffa:meta":{"id":"tffa:meta","description":"scan a sfdx project for metadata","strict":true,"usage":"<%= command.id %> [-s <directory>] [-d <directory>] [-c <directory>] [-o json|csv|human] [-f] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["scan a sfdx project for metadata :\t$sfdx tffa:meta"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"sourcefolder":{"name":"sourcefolder","type":"option","char":"s","description":"directory containing sfdx project","multiple":false,"default":"."},"destpath":{"name":"destpath","type":"option","char":"d","description":"full path output file","multiple":false,"default":"."},"clientname":{"name":"clientname","type":"option","char":"c","description":"name of the client","multiple":false,"default":"."},"output":{"name":"output","type":"option","char":"o","description":"output format json csv human","helpValue":"(json|csv|human)","multiple":false,"options":["json","csv","human"]},"fields":{"name":"fields","type":"boolean","char":"f","description":"generate field output","allowNo":false}},"args":[],"flagsConfig":{"sourcefolder":{"kind":"directory","char":"s","description":"directory containing sfdx project","default":".","input":[],"multiple":false,"type":"option"},"destpath":{"kind":"directory","char":"d","description":"full path output file","default":".","input":[],"multiple":false,"type":"option"},"clientname":{"kind":"directory","char":"c","description":"name of the client","default":".","input":[],"multiple":false,"type":"option"},"output":{"kind":"enum","helpValue":"(json|csv|human)","char":"o","options":["json","csv","human"],"description":"output format json csv human","input":[],"multiple":false,"type":"option"},"fields":{"kind":"boolean","char":"f","description":"generate field output","allowNo":false,"type":"boolean"}}},"tffa:ping":{"id":"tffa:ping","description":"ping and test the plugin","strict":true,"usage":"<%= command.id %> [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx tffa:ping "],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"}},"args":[{"name":"file"}],"flagsConfig":{}},"tffa:source:apiset":{"id":"tffa:source:apiset","description":"Upgrades the current project and all metadata to the latest API version","strict":true,"usage":"<%= command.id %> [-h <help>] [-s <directory>] [-a <integer>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx tffa:source:apiset "],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false},"sourcefolder":{"name":"sourcefolder","type":"option","char":"s","description":"directory containing sfdx project","multiple":false,"default":"."},"api":{"name":"api","type":"option","char":"a","description":"specify the API version ","multiple":false,"default":56}},"args":[],"flagsConfig":{"help":{"kind":"help","description":"Show CLI help.","char":"h","allowNo":false,"type":"boolean"},"sourcefolder":{"kind":"directory","char":"s","description":"directory containing sfdx project","default":".","input":[],"multiple":false,"type":"option"},"api":{"kind":"integer","char":"a","description":"specify the API version ","default":56,"input":[],"multiple":false,"type":"option"}}}}}
1
+ {"version":"16.0.0-rc.2","commands":{"tffa:apexdoc":{"id":"tffa:apexdoc","description":"Generate Apex API Documentation","strict":true,"usage":"<%= command.id %> [-s <directory>] [-d <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["Generate Apex API Documentation :\t$sfdx tffa:apexdoc "],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"sourcefolder":{"name":"sourcefolder","type":"option","char":"s","description":"directory containing sfdx project","multiple":false,"default":"."},"destfolder":{"name":"destfolder","type":"option","char":"d","description":"directory to generate the api docs","multiple":false}},"args":[],"flagsConfig":{"sourcefolder":{"kind":"directory","char":"s","description":"directory containing sfdx project","default":".","input":[],"multiple":false,"type":"option"},"destfolder":{"kind":"directory","char":"d","description":"directory to generate the api docs","input":[],"multiple":false,"type":"option"}}},"tffa:lint":{"id":"tffa:lint","description":"scan a sfdx project and provide a violations report based on defined standards","strict":true,"usage":"<%= command.id %> [-s <directory>] [-m <integer>] [-r <filepath>] [-e] [-f] [-j] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["$sfdx tffa:lint"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"generate json output","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"sourcefolder":{"name":"sourcefolder","type":"option","char":"s","description":"directory containing sfdx project","multiple":false,"default":"."},"minapi":{"name":"minapi","type":"option","char":"m","description":"minimum api version to use during quality checks","multiple":false,"default":56},"rulesetpath":{"name":"rulesetpath","type":"option","char":"r","description":"path to pmd ruleset","multiple":false},"eject":{"name":"eject","type":"boolean","char":"e","description":"update local pmd ruleset","allowNo":false},"level":{"name":"level","type":"boolean","char":"f","description":"emit fatal violations only","allowNo":false}},"args":[],"flagsConfig":{"sourcefolder":{"kind":"directory","char":"s","description":"directory containing sfdx project","default":".","input":[],"multiple":false,"type":"option"},"minapi":{"kind":"integer","char":"m","description":"minimum api version to use during quality checks","default":56,"input":[],"multiple":false,"type":"option"},"json":{"kind":"boolean","char":"j","description":"generate json output","allowNo":false,"type":"boolean"},"rulesetpath":{"kind":"filepath","char":"r","description":"path to pmd ruleset","input":[],"multiple":false,"type":"option"},"eject":{"kind":"boolean","char":"e","description":"update local pmd ruleset","allowNo":false,"type":"boolean"},"level":{"kind":"boolean","char":"f","description":"emit fatal violations only","allowNo":false,"type":"boolean"}}},"tffa:meta":{"id":"tffa:meta","description":"scan a sfdx project for metadata","strict":true,"usage":"<%= command.id %> [-s <directory>] [-d <directory>] [-c <directory>] [-o json|csv|human] [-f] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["scan a sfdx project for metadata :\t$sfdx tffa:meta"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"sourcefolder":{"name":"sourcefolder","type":"option","char":"s","description":"directory containing sfdx project","multiple":false,"default":"."},"destpath":{"name":"destpath","type":"option","char":"d","description":"full path output file","multiple":false,"default":"."},"clientname":{"name":"clientname","type":"option","char":"c","description":"name of the client","multiple":false,"default":"."},"output":{"name":"output","type":"option","char":"o","description":"output format json csv human","helpValue":"(json|csv|human)","multiple":false,"options":["json","csv","human"]},"fields":{"name":"fields","type":"boolean","char":"f","description":"generate field output","allowNo":false}},"args":[],"flagsConfig":{"sourcefolder":{"kind":"directory","char":"s","description":"directory containing sfdx project","default":".","input":[],"multiple":false,"type":"option"},"destpath":{"kind":"directory","char":"d","description":"full path output file","default":".","input":[],"multiple":false,"type":"option"},"clientname":{"kind":"directory","char":"c","description":"name of the client","default":".","input":[],"multiple":false,"type":"option"},"output":{"kind":"enum","helpValue":"(json|csv|human)","char":"o","options":["json","csv","human"],"description":"output format json csv human","input":[],"multiple":false,"type":"option"},"fields":{"kind":"boolean","char":"f","description":"generate field output","allowNo":false,"type":"boolean"}}},"tffa:ping":{"id":"tffa:ping","description":"ping and test the plugin","strict":true,"usage":"<%= command.id %> [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx tffa:ping "],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"}},"args":[{"name":"file"}],"flagsConfig":{}},"tffa:data:export":{"id":"tffa:data:export","description":"Exports records of specified sobject types from target org into JSON file(s). Primarily used for exporting business configurations.\nThe export command requires a target org for exporting records. Run this command from within a sfdx project containing a default username or specify targetusername explicitly.","strict":true,"usage":"<%= command.id %> -s <array> [-d <string>] [-g <string>] [-o <array>] [-c <array>] [-s] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx tffa:data:export --sobjecttype tffa__Product__c\n Fetched 101 records of tffa__Product__c\n Writing 24 records to ./data/configuration/Product__c.json\n Writing 30 records to ./data/configuration/Product__c1.json\n Writing 20 records to ./data/configuration/Product__c2.json\n Writing 27 records to ./data/configuration/Product__c3.json\n ","$ sfdx tffa:data:export --sobjecttype tffa__DisclosureTemplate__c,tffa__DisclosureChecklist__c,tffa__DisclosureMatrix__c\n Fetched 81 records of tffa__DisclosureTemplate__c\n Writing 81 records to ./data/configuration/DisclosureTemplate__c.json\n Fetched 57 records of tffa__DisclosureChecklist__c\n Writing 57 records to ./data/configuration/DisclosureChecklist__c.json\n Fetched 144 records of tffa__DisclosureMatrix__c\n Writing 144 records to ./data/configuration/DisclosureMatrix__c.json\n "],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org","multiple":false},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command","multiple":false},"sobjecttype":{"name":"sobjecttype","type":"option","char":"s","description":"sobject types of records to be exported","required":true,"multiple":false},"outputdir":{"name":"outputdir","type":"option","char":"d","description":"output directory where the JSON files of exported records will be placed","multiple":false,"default":"./data/configuration"},"groupby":{"name":"groupby","type":"option","char":"g","description":"the field to be used for grouping the exported records; records belonging to each group are placed in separate JSON files (filename suffixed by group name)","required":false,"multiple":false},"orderby":{"name":"orderby","type":"option","char":"o","description":"the fields to be used for sorting the exported records","required":false,"multiple":false},"children":{"name":"children","type":"option","char":"c","description":"the child relationships to be included in the exported records; this is not required for tffa package objects. e.g. tffa__Features__r,tffa__Terms__r child relationships are auto included when running export command for tffa__Product__c","required":false,"multiple":false},"skipconfigplan":{"name":"skipconfigplan","type":"boolean","char":"s","description":"skip import of exported record JSON files into configuration plan","required":false,"allowNo":false}},"args":[],"requiresUsername":true,"flagsConfig":{"sobjecttype":{"kind":"array","char":"s","required":true,"description":"sobject types of records to be exported","input":[],"multiple":false,"type":"option"},"outputdir":{"kind":"string","char":"d","description":"output directory where the JSON files of exported records will be placed","default":"./data/configuration","input":[],"multiple":false,"type":"option"},"groupby":{"kind":"string","char":"g","required":false,"description":"the field to be used for grouping the exported records; records belonging to each group are placed in separate JSON files (filename suffixed by group name)","input":[],"multiple":false,"type":"option"},"orderby":{"kind":"array","char":"o","required":false,"description":"the fields to be used for sorting the exported records","input":[],"multiple":false,"type":"option"},"children":{"kind":"array","char":"c","required":false,"description":"the child relationships to be included in the exported records; this is not required for tffa package objects. e.g. tffa__Features__r,tffa__Terms__r child relationships are auto included when running export command for tffa__Product__c","input":[],"multiple":false,"type":"option"},"skipconfigplan":{"kind":"boolean","char":"s","required":false,"description":"skip import of exported record JSON files into configuration plan","allowNo":false,"type":"boolean"}}},"tffa:source:apiset":{"id":"tffa:source:apiset","description":"Upgrades the current project and all metadata to the latest API version","strict":true,"usage":"<%= command.id %> [-h <help>] [-s <directory>] [-a <integer>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@terafina/tffa-sfdx-plugin","pluginAlias":"@terafina/tffa-sfdx-plugin","pluginType":"core","aliases":[],"examples":["$ sfdx tffa:source:apiset "],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","multiple":false,"options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false},"sourcefolder":{"name":"sourcefolder","type":"option","char":"s","description":"directory containing sfdx project","multiple":false,"default":"."},"api":{"name":"api","type":"option","char":"a","description":"specify the API version ","multiple":false,"default":56}},"args":[],"flagsConfig":{"help":{"kind":"help","description":"Show CLI help.","char":"h","allowNo":false,"type":"boolean"},"sourcefolder":{"kind":"directory","char":"s","description":"directory containing sfdx project","default":".","input":[],"multiple":false,"type":"option"},"api":{"kind":"integer","char":"a","description":"specify the API version ","default":56,"input":[],"multiple":false,"type":"option"}}}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@terafina/tffa-sfdx-plugin",
3
3
  "description": "sfdx plugin from Terafina containing tools for scanning and extending digital applications for the financial services industry.",
4
- "version": "16.0.0-rc.1",
4
+ "version": "16.0.0-rc.2",
5
5
  "author": "Terafina Inc",
6
6
  "bugs": "https://github.com/terafinainc/tffa-sfdx-plugin/issues",
7
7
  "dependencies": {