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

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.
Files changed (34) hide show
  1. package/README.md +298 -18
  2. package/assets/homepage.html +1 -1
  3. package/bin/pmd/apex_ruleset.xml +25 -0
  4. package/lib/commands/tffa/apexdoc.js +1 -1
  5. package/lib/commands/tffa/apexdoc.js.map +1 -1
  6. package/lib/commands/tffa/data/export.d.ts +71 -0
  7. package/lib/commands/tffa/data/export.js +396 -0
  8. package/lib/commands/tffa/data/export.js.map +1 -0
  9. package/lib/commands/tffa/data/import.d.ts +69 -0
  10. package/lib/commands/tffa/data/import.js +291 -0
  11. package/lib/commands/tffa/data/import.js.map +1 -0
  12. package/lib/commands/tffa/meta.js +2 -2
  13. package/lib/commands/tffa/meta.js.map +1 -1
  14. package/lib/commands/tffa/source/createfield.d.ts +41 -0
  15. package/lib/commands/tffa/source/createfield.js +210 -0
  16. package/lib/commands/tffa/source/createfield.js.map +1 -0
  17. package/lib/services/apexdoc/common/line-reader.js +1 -1
  18. package/lib/services/apexdoc/common/line-reader.js.map +1 -1
  19. package/lib/services/apexdoc/engine/generators/models/source-markup-generator.js +12 -1
  20. package/lib/services/apexdoc/engine/generators/models/source-markup-generator.js.map +1 -1
  21. package/lib/services/lint/rules.js +2 -2
  22. package/lib/services/lint/rules.js.map +1 -1
  23. package/lib/utils/ignored-files.js +2 -0
  24. package/lib/utils/ignored-files.js.map +1 -1
  25. package/messages/apexdoc.json +1 -1
  26. package/messages/createField.js +37 -0
  27. package/messages/dataExport.js +32 -0
  28. package/messages/dataImport.js +50 -0
  29. package/messages/lint.js +31 -0
  30. package/messages/ping.json +1 -1
  31. package/oclif.manifest.json +1 -1
  32. package/package.json +34 -34
  33. package/yarn.lock +789 -736
  34. package/messages/lint.json +0 -5
@@ -0,0 +1,396 @@
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([
36
+ 'OwnerId',
37
+ 'RecordTypeId',
38
+ 'IsDeleted__c',
39
+ 'CreatedDate',
40
+ 'CreatedById',
41
+ 'LastModifiedDate',
42
+ 'LastModifiedById',
43
+ 'tffa__IsDeleted__c'
44
+ ]);
45
+ const EXTERNAL_ID_FIELDS = new Set(['ExternalId__c', 'tffa__ExternalId__c']);
46
+ const SORT_ORDER_FIELDS = new Set(['SortOrder__c', 'tffa__SortOrder__c']);
47
+ const CONTENT_URL_FIELDS = new Set(['ImageUrl__c', 'tffa__ImageUrl__c', 'tffa__Url__c']);
48
+ /**
49
+ * Export plans of SObject types that require fetching of child relationships, custom grouping, sorting etc.
50
+ * Export plans of SObject types that are simple and limited to itself need not be included here.
51
+ */
52
+ const EXPORT_PLANS = Object.fromEntries([
53
+ new ExportPlan({
54
+ sObjectType: 'tffa__Product__c',
55
+ children: ['tffa__Features__r', 'tffa__Terms__r'],
56
+ where: "tffa__Type__c='PRODUCT'"
57
+ }),
58
+ new ExportPlan({
59
+ sObjectType: 'tffa__Questionnaire__c',
60
+ groupBy: 'tffa__Type__c',
61
+ children: ['tffa__Outcomes__r', 'tffa__QuestionGroups__r'],
62
+ prefix: 'qn'
63
+ }),
64
+ new ExportPlan({ sObjectType: 'tffa__QuestionGroupTemplate__c', children: ['tffa__Questions__r'] }),
65
+ new ExportPlan({ sObjectType: 'tffa__AddOnService__c', orderBy: ['tffa__Type__c', 'Name'] }),
66
+ new ExportPlan({
67
+ sObjectType: 'tffa__ApplicationDecisionMatrix__c',
68
+ children: ['tffa__CounterOffers__r'],
69
+ orderBy: ['tffa__Type__c', 'tffa__SortOrder__c']
70
+ }),
71
+ new ExportPlan({ sObjectType: 'tffa__Brand__c', children: ['tffa__Locations__r'], prefix: 'brand', orderBy: ['tffa__SortOrder__c'] }),
72
+ new ExportPlan({ sObjectType: 'tffa__DecisionStrategyConfiguration__c', children: ['tffa__Strategies__r'] }),
73
+ new ExportPlan({ sObjectType: 'tffa__Offer__c', children: ['tffa__Terms__r'], orderBy: ['tffa__ProductCategory__c', 'Name'] }),
74
+ new ExportPlan({ sObjectType: 'tffa__Promotion__c', children: ['tffa__Plans__r'], prefix: 'pr' }),
75
+ new ExportPlan({ sObjectType: 'tffa__ListOfValues__c', groupBy: 'tffa__Locale__c' }),
76
+ new ExportPlan({
77
+ name: 'tffa__ProductBundle__c',
78
+ sObjectType: 'tffa__Product__c',
79
+ children: ['tffa__Features__r', 'tffa__Terms__r', 'tffa__ProductXrefs__r'],
80
+ where: "tffa__Type__c='BUNDLE'"
81
+ }),
82
+ new ExportPlan({ sObjectType: 'tffa__Address__c', prefix: 'addr', where: 'tffa__IsBusinessConfiguration__c=true' }),
83
+ new ExportPlan({ sObjectType: 'tffa__AddOnServiceChecklist__c', children: ['tffa__Items__r'], prefix: 'aoscl' }),
84
+ new ExportPlan({ sObjectType: 'tffa__DisclosureChecklist__c', children: ['tffa__Items__r'], prefix: 'dcl' }),
85
+ new ExportPlan({ sObjectType: 'tffa__StipulationChecklist__c', children: ['tffa__Items__r'], prefix: 'scl' }),
86
+ new ExportPlan({ sObjectType: 'tffa__DepositBoxConfiguration__c', children: ['tffa__Items__r'] }),
87
+ new ExportPlan({ sObjectType: 'tffa__RecommendationConfiguration__c', children: ['tffa__Items__r'] }),
88
+ new ExportPlan({ sObjectType: 'tffa__UXStrategy__c', prefix: 'uxs', orderBy: ['tffa__AppPage__c', 'tffa__SortOrder__c'] }),
89
+ new ExportPlan({ sObjectType: 'tffa__AllowedAddress__c', orderBy: ['tffa__SortOrder__c'] }),
90
+ new ExportPlan({ sObjectType: 'tffa__QuestionnaireMatrix__c', orderBy: ['tffa__Type__c', 'tffa__SortOrder__c'] })
91
+ ].map(p => [p.name, p]));
92
+ class DataExport extends command_1.SfdxCommand {
93
+ constructor() {
94
+ super(...arguments);
95
+ /**
96
+ * Custom prefixes
97
+ */
98
+ this.sObjectTypePrefixMap = new Map();
99
+ }
100
+ async run() {
101
+ for (const sObjectType of this.flags.sobjecttypes) {
102
+ const plan = this.getExportPlan(sObjectType);
103
+ this.ux.startSpinner(`Fetching record(s) of ${sObjectType}`);
104
+ const records = await this.execute(plan);
105
+ this.ux.stopSpinner(`completed`);
106
+ this.log(`Fetched ${records.length} records of ${sObjectType}`);
107
+ this.transform(records);
108
+ if (records.length) {
109
+ this.writeRecords(records, plan);
110
+ }
111
+ }
112
+ }
113
+ async execute(plan, parent) {
114
+ let qb = this.org
115
+ .getConnection()
116
+ .sobject(plan.sObjectType)
117
+ .select(await this.getFields(plan, !!parent))
118
+ .orderby((await this.getOrderBy(plan, !parent && !plan.sObjectType.endsWith('Matrix__c'))).map(e => [e, 'asc']))
119
+ .where(plan.where);
120
+ for (const child of plan.children || []) {
121
+ const childPlan = await this.getChildExportPlan(plan.sObjectType, child);
122
+ qb = qb
123
+ .include(child)
124
+ .select(await this.getFields(childPlan, true))
125
+ .orderby((await this.getOrderBy(childPlan)).map(e => [e, 'asc']))
126
+ .end();
127
+ }
128
+ let records = await qb.execute();
129
+ if (plan.map) {
130
+ records = records.map(plan.map);
131
+ }
132
+ for (const child of plan.children || []) {
133
+ const childPlan = await this.getChildExportPlan(plan.sObjectType, child);
134
+ if (childPlan.children?.length) {
135
+ const childRecordMap = this.toMap(await this.execute(childPlan, plan));
136
+ for (const record of records) {
137
+ const relationshipNode = record[child];
138
+ if (relationshipNode) {
139
+ for (const [i, childRecord] of relationshipNode.records.entries()) {
140
+ relationshipNode.records[i] = childRecordMap.get(childRecord.Id) || childRecord;
141
+ }
142
+ }
143
+ }
144
+ }
145
+ }
146
+ return records;
147
+ }
148
+ /**
149
+ * Gets fields to be included when exporting records.
150
+ */
151
+ async getFields(plan, skipMasterDetail = false, skipLookup = false) {
152
+ const sObjectType = plan.sObjectType;
153
+ const fields = ['Id'];
154
+ const conn = this.org.getConnection();
155
+ const describeResult = await conn.describe$(sObjectType);
156
+ for (const f of describeResult.fields) {
157
+ if (EXCLUDED_FIELDS.has(f.name) || !f.createable) {
158
+ continue;
159
+ }
160
+ if (f.referenceTo?.length) {
161
+ if (!skipLookup && (f.relationshipOrder !== 0 || !skipMasterDetail)) {
162
+ fields.push(f.name);
163
+ fields.push(`${f.relationshipName}.Id`);
164
+ const refFields = await this.getFields(new ExportPlan({ sObjectType: f.referenceTo[0] }), true, true);
165
+ for (const lf of refFields) {
166
+ if (EXTERNAL_ID_FIELDS.has(lf)) {
167
+ fields.push(`${f.relationshipName}.${lf}`);
168
+ }
169
+ }
170
+ }
171
+ }
172
+ else {
173
+ fields.push(f.name);
174
+ }
175
+ }
176
+ return fields;
177
+ }
178
+ /**
179
+ * Gets the field to be used for ordering when exporting the records.
180
+ */
181
+ async getOrderBy(plan, skipSortOrder = false) {
182
+ const sObjectType = plan.sObjectType;
183
+ if (plan.orderBy) {
184
+ return plan.orderBy;
185
+ }
186
+ let sortOrderField = ['Name'];
187
+ if (!skipSortOrder) {
188
+ const describeResult = await this.org.getConnection().describe$(sObjectType);
189
+ for (const f of describeResult.fields) {
190
+ if (SORT_ORDER_FIELDS.has(f.name)) {
191
+ sortOrderField = [f.name];
192
+ break;
193
+ }
194
+ }
195
+ }
196
+ return sortOrderField;
197
+ }
198
+ /**
199
+ * Transforms the exported records, making it ready for writing to config files
200
+ * @param records
201
+ */
202
+ transform(records) {
203
+ for (const record of records) {
204
+ record.attributes.referenceId = this.getReferenceId(record);
205
+ record.attributes.url = undefined;
206
+ record.Id = undefined;
207
+ for (const [k, v] of Object.entries(record)) {
208
+ if (v === null || v === undefined) {
209
+ record[k] = undefined;
210
+ }
211
+ else if (typeof v === 'object' && k.endsWith('__r')) {
212
+ if (v.records) {
213
+ this.transform(v.records);
214
+ }
215
+ else {
216
+ record[k.replace('__r', '__c')] = `@${this.getReferenceId(v)}`;
217
+ record[k] = undefined;
218
+ }
219
+ }
220
+ else {
221
+ if (CONTENT_URL_FIELDS.has(k) && v.startsWith('/file-asset')) {
222
+ const url = new URL(v, 'http://localhost');
223
+ url.searchParams.delete('oid');
224
+ record[k] = url.pathname + url.search;
225
+ }
226
+ }
227
+ }
228
+ }
229
+ }
230
+ /**
231
+ * Gets the external id of the record
232
+ * @param record
233
+ * @returns
234
+ * @throws Error if external id or equivalent is not found
235
+ */
236
+ getExternalId(record) {
237
+ let externalId;
238
+ for (const externalIdField of EXTERNAL_ID_FIELDS) {
239
+ externalId = record[externalIdField];
240
+ if (externalId) {
241
+ break;
242
+ }
243
+ }
244
+ if (!externalId) {
245
+ throw new Error(`No external id found for sobject ${record.attributes.type} id=${record.Id}`);
246
+ }
247
+ return externalId;
248
+ }
249
+ /**
250
+ * Gets the reference id for the record
251
+ * @param record
252
+ */
253
+ getReferenceId(record) {
254
+ const sObjectType = record.attributes.type;
255
+ return `${this.getPrefix(sObjectType)}_${this.getExternalId(record)}`.replace(NON_ALPHANUM_RE, '_');
256
+ }
257
+ /**
258
+ * Gets the object prefix to be used when building the reference id
259
+ * @param sObjectType
260
+ * @returns
261
+ */
262
+ getPrefix(sObjectType) {
263
+ let prefix = this.sObjectTypePrefixMap.get(sObjectType) || this.getExportPlan(sObjectType).prefix;
264
+ if (!prefix) {
265
+ prefix = sObjectType
266
+ .match(UPPER_LOWER_RE)
267
+ .map(e => e[0])
268
+ .join('')
269
+ .toLowerCase();
270
+ this.sObjectTypePrefixMap.set(sObjectType, prefix);
271
+ }
272
+ return prefix;
273
+ }
274
+ /**
275
+ * Writes records to JSON files
276
+ * @param records
277
+ */
278
+ writeRecords(records, plan) {
279
+ const objectName = plan.name.replace('tffa__', '');
280
+ const outputDir = this.flags.outputdir;
281
+ const groupBy = plan.groupBy || '_';
282
+ (0, fs_extra_1.mkdirpSync)(outputDir);
283
+ const groupMap = new Map();
284
+ if (groupBy === '_') {
285
+ groupMap.set(groupBy, records);
286
+ }
287
+ else {
288
+ for (const record of records) {
289
+ const k = record[groupBy] || '_';
290
+ const group = groupMap.get(k) || groupMap.set(k, []).get(k);
291
+ group.push(record);
292
+ }
293
+ }
294
+ const filenames = [];
295
+ for (const [k, group] of groupMap.entries()) {
296
+ let batch = [];
297
+ let batchObjectCount = 0;
298
+ const batches = [batch];
299
+ for (const record of group) {
300
+ const count = this.getSObjectCount(record);
301
+ if (count + batchObjectCount > MAX_OBJECTS_IN_FILE) {
302
+ batch = [];
303
+ batches.push(batch);
304
+ batchObjectCount = 0;
305
+ }
306
+ batch.push(record);
307
+ batchObjectCount += count;
308
+ }
309
+ for (const [i, batch] of batches.entries()) {
310
+ const filename = `${objectName}${k === '_' ? '' : '-' + k}${i || ''}.json`;
311
+ const filepath = `${outputDir}/${filename}`;
312
+ this.log(`Writing ${batch.length} records to ${filepath}`);
313
+ (0, fs_extra_1.writeFileSync)(filepath, JSON.stringify({ records: batch }, null, 2));
314
+ filenames.push(filename);
315
+ }
316
+ }
317
+ if (!this.flags.skipconfigplan && plan.name === plan.sObjectType) {
318
+ const configPlanFilepath = `${outputDir}/config-data-plan.json`;
319
+ if ((0, fs_extra_1.existsSync)(configPlanFilepath)) {
320
+ const configPlans = JSON.parse((0, fs_extra_1.readFileSync)(configPlanFilepath, 'utf-8'));
321
+ let configPlan = configPlans.find(cp => cp.sobject === plan.sObjectType);
322
+ if (!configPlan) {
323
+ configPlan = { sobject: plan.sObjectType, files: [] };
324
+ configPlans.push(configPlan);
325
+ }
326
+ // update only if something changed
327
+ if (configPlan.files?.toString() !== filenames.toString()) {
328
+ configPlan.files = filenames;
329
+ (0, fs_extra_1.writeFileSync)(configPlanFilepath, JSON.stringify(configPlans, null, 2));
330
+ }
331
+ }
332
+ }
333
+ }
334
+ /**
335
+ * Counts the number of SObjects within the record. e.g. a record containing child relationships may contain more than one SObject.
336
+ * @param record
337
+ * @returns
338
+ */
339
+ getSObjectCount(record) {
340
+ return (JSON.stringify(record).match(REFERENCE_ID_RE) || []).length;
341
+ }
342
+ /**
343
+ * Gets the export plan for the specified object type.
344
+ * @param sObjectType
345
+ * @returns
346
+ */
347
+ getExportPlan(sObjectType) {
348
+ const plan = new ExportPlan({ sObjectType, ...(EXPORT_PLANS[sObjectType] || {}) });
349
+ const { sobjecttypes, children, groupby, orderby } = this.flags;
350
+ if (sobjecttypes.length === 1 && sobjecttypes[0] === sObjectType) {
351
+ if (children) {
352
+ plan.children = children;
353
+ }
354
+ if (groupby) {
355
+ plan.groupBy = groupby;
356
+ }
357
+ if (orderby) {
358
+ plan.orderBy = orderby;
359
+ }
360
+ }
361
+ return plan;
362
+ }
363
+ async getChildExportPlan(sObjectType, relationshipName) {
364
+ const describeResult = await this.org.getConnection().describe$(sObjectType);
365
+ const relationship = describeResult.childRelationships.find(f => f.relationshipName === relationshipName);
366
+ if (!relationship) {
367
+ throw new Error(`Relationship ${relationshipName} not found on SObjectType ${sObjectType}`);
368
+ }
369
+ return this.getExportPlan(relationship.childSObject);
370
+ }
371
+ /**
372
+ * Returns a map of records where key is record.Id and value is record.
373
+ * @param records
374
+ * @returns
375
+ */
376
+ toMap(records) {
377
+ const recordMap = new Map();
378
+ for (const record of records) {
379
+ recordMap.set(record.Id, record);
380
+ }
381
+ return recordMap;
382
+ }
383
+ }
384
+ exports.default = DataExport;
385
+ DataExport.requiresUsername = true;
386
+ DataExport.description = messages.getMessage('commandDescription');
387
+ DataExport.examples = messages.getMessages('commandExamples');
388
+ DataExport.flagsConfig = {
389
+ sobjecttypes: command_1.flags.array({ char: 's', required: true, description: messages.getMessage('sobjecttypesFlagDescription') }),
390
+ outputdir: command_1.flags.string({ char: 'd', description: messages.getMessage('outputdirFlagDescription'), default: './data/configuration' }),
391
+ groupby: command_1.flags.string({ char: 'g', required: false, description: messages.getMessage('groupbyFlagDescription') }),
392
+ orderby: command_1.flags.array({ char: 'o', required: false, description: messages.getMessage('orderbyFlagDescription') }),
393
+ children: command_1.flags.array({ char: 'c', required: false, description: messages.getMessage('childrenFlagDescription') }),
394
+ skipconfigplan: command_1.flags.boolean({ char: 's', required: false, description: messages.getMessage('skipconfigplanFlagDescription') })
395
+ };
396
+ //# 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,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC;SAC9B;IACH,CAAC;CACF;AAgBD;;GAEG;AACH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 /**
6
+ * Stores external id information of a record.
7
+ * Stores both the external id field name and value.
8
+ */
9
+ declare type ExternalId = {
10
+ fieldName: string;
11
+ value: string;
12
+ };
13
+ export default class DataImport extends SfdxCommand {
14
+ static requiresUsername: boolean;
15
+ static requiresProject: boolean;
16
+ static description: string;
17
+ static examples: string[];
18
+ protected static flagsConfig: FlagsConfig;
19
+ protected referenceIdExternalIdMap: Map<string, ExternalId>;
20
+ private isScratch;
21
+ private namespacePrefix;
22
+ run(): Promise<any>;
23
+ /**
24
+ * Gathers external ids from the specified records. The external id of each record along with the external id field name
25
+ * is stored as a lookup reference mapped to the reference id of the record.
26
+ * @see referenceIdExternalIdMap
27
+ * @param records
28
+ */
29
+ private collectExternalIds;
30
+ /**
31
+ * Upserts the records using sfdx bulk2 API.
32
+ * @param records SObject records
33
+ */
34
+ private upsert;
35
+ /**
36
+ * Creates an upsert request for the records
37
+ * @param records
38
+ */
39
+ private createUpsertRequest;
40
+ /**
41
+ * Executes the upsert request. May include execution of child upsert requests if the records have child relationships.
42
+ * @param request
43
+ */
44
+ private execute;
45
+ /**
46
+ * Logs the success/error metrics
47
+ * @param result
48
+ * @param request
49
+ */
50
+ private logResult;
51
+ /**
52
+ * Checks if file has changed since the last time it was seen by comparing it's last modified date to last known one.
53
+ * @param sobjectfile
54
+ * @returns
55
+ */
56
+ private determineIfFileChanged;
57
+ /**
58
+ * Tracks the files for any changes in future. Uses last modified date to track changes.
59
+ * @param sobjectfiles
60
+ */
61
+ private trackFileChange;
62
+ /**
63
+ * Returns the external id field names to be used for:
64
+ * 1. resolving external ids of lookup references on records
65
+ * 2. resolving the external id of records for upsert
66
+ */
67
+ private getExternalIdFieldNames;
68
+ }
69
+ export {};