@salesforce/plugin-omnistudio-migration-tool 1.3.1-dev.0 → 1.5.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.
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CompilationUnitContext } from '@apexdevtools/apex-parser';
|
|
2
|
+
import { Token } from 'antlr4ts';
|
|
3
|
+
export declare class ApexASTParser {
|
|
4
|
+
private apexFileContent;
|
|
5
|
+
private implementsInterface;
|
|
6
|
+
private interfaceName;
|
|
7
|
+
private methodName;
|
|
8
|
+
private astListener;
|
|
9
|
+
get implemementsInterface(): Map<string, Token>;
|
|
10
|
+
constructor(apexFileContent: string, interfaceName: string, methodName: string);
|
|
11
|
+
parse(): CompilationUnitContext;
|
|
12
|
+
private createASTListener;
|
|
13
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApexASTParser = void 0;
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
8
|
+
const apex_parser_1 = require("@apexdevtools/apex-parser");
|
|
9
|
+
const antlr4ts_1 = require("antlr4ts");
|
|
10
|
+
const ParseTreeWalker_1 = require("antlr4ts/tree/ParseTreeWalker");
|
|
11
|
+
class ApexASTParser {
|
|
12
|
+
get implemementsInterface() {
|
|
13
|
+
return this.implementsInterface;
|
|
14
|
+
}
|
|
15
|
+
constructor(apexFileContent, interfaceName, methodName) {
|
|
16
|
+
this.implementsInterface = new Map();
|
|
17
|
+
this.apexFileContent = apexFileContent;
|
|
18
|
+
this.interfaceName = interfaceName;
|
|
19
|
+
this.methodName = methodName;
|
|
20
|
+
this.astListener = this.createASTListener();
|
|
21
|
+
}
|
|
22
|
+
parse() {
|
|
23
|
+
const lexer = new apex_parser_1.ApexLexer(new apex_parser_1.CaseInsensitiveInputStream(antlr4ts_1.CharStreams.fromString(this.apexFileContent)));
|
|
24
|
+
const tokens = new apex_parser_1.CommonTokenStream(lexer);
|
|
25
|
+
const parser = new apex_parser_1.ApexParser(tokens);
|
|
26
|
+
const context = parser.compilationUnit();
|
|
27
|
+
// parser.addParseListener(new interfaceVisitor() as ApexParserListener);
|
|
28
|
+
ParseTreeWalker_1.ParseTreeWalker.DEFAULT.walk(this.astListener, context);
|
|
29
|
+
return context;
|
|
30
|
+
}
|
|
31
|
+
createASTListener() {
|
|
32
|
+
class ApexMigrationListener {
|
|
33
|
+
constructor(parser) {
|
|
34
|
+
this.parser = parser;
|
|
35
|
+
}
|
|
36
|
+
enterClassDeclaration(ctx) {
|
|
37
|
+
const interfaceToBeSearched = this.parser.interfaceName;
|
|
38
|
+
if (!interfaceToBeSearched)
|
|
39
|
+
return;
|
|
40
|
+
if (!ctx.typeList() || !ctx.typeList().typeRef())
|
|
41
|
+
return;
|
|
42
|
+
for (const typeRefContext of ctx.typeList().typeRef())
|
|
43
|
+
for (const typeNameContext of typeRefContext.typeName()) {
|
|
44
|
+
if (!typeNameContext.id() || !typeNameContext.id().Identifier())
|
|
45
|
+
continue;
|
|
46
|
+
if (typeNameContext.id().Identifier().symbol.text === interfaceToBeSearched) {
|
|
47
|
+
this.parser.implementsInterface.set(interfaceToBeSearched, typeNameContext.id().Identifier().symbol);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
enterDotExpression(ctx) {
|
|
52
|
+
// console.log('*********');
|
|
53
|
+
// console.log(ctx.expression().start.text);
|
|
54
|
+
if (ctx.dotMethodCall() && this.parser.methodName) {
|
|
55
|
+
// console.log(ctx.dotMethodCall().anyId().Identifier().symbol.text);
|
|
56
|
+
// ctx.dotMethodCall().expressionList().expression(1).children[0].children[0].children[0];
|
|
57
|
+
// console.log(ctx.dotMethodCall().expressionList().expression(1).children[0]);
|
|
58
|
+
}
|
|
59
|
+
// console.log('*********');
|
|
60
|
+
}
|
|
61
|
+
enterVariableDeclarator(ctx) {
|
|
62
|
+
if (ctx.id().Identifier().symbol.text === 'DRName') {
|
|
63
|
+
// console.log(ctx.expression());
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return new ApexMigrationListener(this);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.ApexASTParser = ApexASTParser;
|
|
71
|
+
// const filePath = '/Users/abhinavkumar2/company/plugin-omnistudio-migration-tool/test/FormulaParserService.cls';
|
|
72
|
+
// new ApexASTParser(filePath, 'callable', '').parse(filePath);
|
|
73
|
+
// console.log(ast);
|
|
74
|
+
//# sourceMappingURL=apexparser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apexparser.js","sourceRoot":"","sources":["../../../../src/utils/apex/parser/apexparser.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,sDAAsD;AACtD,+DAA+D;AAC/D,4DAA4D;AAC5D,2DAUmC;AACnC,uCAA8C;AAC9C,mEAAgE;AAEhE,MAAa,aAAa;IASxB,IAAW,qBAAqB;QAC9B,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IAED,YAAmB,eAAuB,EAAE,aAAqB,EAAE,UAAkB;QAX7E,wBAAmB,GAAuB,IAAI,GAAG,EAAE,CAAC;QAY1D,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC9C,CAAC;IAEM,KAAK;QACV,MAAM,KAAK,GAAG,IAAI,uBAAS,CAAC,IAAI,wCAA0B,CAAC,sBAAW,CAAC,UAAU,CAAC,IAAI,CAA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yB;gBACjD,4BAA4B;gBAC5B,4CAA4C;gBAC5C,IAAI,GAAG,CAAC,aAAa,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;oBACjD,qEAAqE;oBACrE,0FAA0F;oBAC1F,+EAA+E;iBAChF;gBACD,4BAA4B;YAC9B,CAAC;YAEM,uBAAuB,CAAC,GAA8B;gBAC3D,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE;oBAClD,iCAAiC;iBAClC;YACH,CAAC;SACF;QACD,OAAO,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF;AAjED,sCAiEC;AAED,kHAAkH;AAClH,+DAA+D;AAE/D,oBAAoB"}
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.
|
|
1
|
+
{"version":"1.5.0","commands":{"basecommand":{"id":"basecommand","usage":"<%= command.id %> [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/plugin-omnistudio-migration-tool","pluginType":"core","aliases":[],"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)","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"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"}},"args":[]},"omnistudio:migration:info":{"id":"omnistudio:migration:info","description":"print a greeting and your org IDs","usage":"<%= command.id %> [-n <string>] [-a] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/plugin-omnistudio-migration-tool","pluginType":"core","aliases":[],"examples":["sfdx omnistudio:migration:info --targetusername myOrg@example.com --targetdevhubusername devhub@org.com","sfdx omnistudio:migration:info --name myname --targetusername myOrg@example.com"],"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)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetdevhubusername":{"name":"targetdevhubusername","type":"option","char":"v","description":"username or alias for the dev hub org; overrides default dev hub org"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"name":{"name":"name","type":"option","char":"n","description":"name to print"},"allversions":{"name":"allversions","type":"boolean","char":"a","description":"Migrate all versions of a component","required":false,"allowNo":false}},"args":[{"name":"file"}]},"omnistudio:migration:migrate":{"id":"omnistudio:migration:migrate","description":"print a greeting and your org IDs","usage":"<%= command.id %> [-n <string>] [-o <string>] [-a] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/plugin-omnistudio-migration-tool","pluginType":"core","aliases":[],"examples":["omnistudio:migration:migrate -u orguser@domain.com --namespace=YOUR_PACKAGE_NAMESPACE","omnistudio:migration:migrate -u orguser@domain.com --namespace=YOUR_PACKAGE_NAMESPACE --only=dr","omnistudio:migration:migrate -u orguser@domain.com --namespace=YOUR_PACKAGE_NAMESPACE --only=ip","omnistudio:migration:migrate -u orguser@domain.com --namespace=YOUR_PACKAGE_NAMESPACE --only=os","omnistudio:migration:migrate -u orguser@domain.com --namespace=YOUR_PACKAGE_NAMESPACE --only=fc"],"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)","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"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"namespace":{"name":"namespace","type":"option","char":"n","description":"The namespaced of the package"},"only":{"name":"only","type":"option","char":"o","description":"Migrate a single element: osip | fc | dr"},"allversions":{"name":"allversions","type":"boolean","char":"a","description":"Migrate all versions of a component","required":false,"allowNo":false}},"args":[{"name":"file"}]}}}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-omnistudio-migration-tool",
|
|
3
3
|
"description": "This SFDX plugin migrates FlexCard, OmniScript, DataRaptor, and Integration Procedure custom objects to standard objects.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/forcedotcom/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
+
"@apexdevtools/apex-parser": "^4.1.0",
|
|
8
9
|
"@oclif/command": "^1",
|
|
9
10
|
"@oclif/config": "^1",
|
|
10
11
|
"@oclif/errors": "^1",
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
"@types/jsforce": "^1.11.5",
|
|
29
30
|
"@typescript-eslint/eslint-plugin": "^4.2.0",
|
|
30
31
|
"@typescript-eslint/parser": "^4.2.0",
|
|
31
|
-
"chai": "^4.
|
|
32
|
+
"chai": "^4.4.1",
|
|
32
33
|
"eslint": "^7.27.0",
|
|
33
34
|
"eslint-config-oclif": "^3.1",
|
|
34
35
|
"eslint-config-prettier": "^8",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"mocha": "^8.4.0",
|
|
46
47
|
"nyc": "^15.1.0",
|
|
47
48
|
"prettier": "^2.8.8",
|
|
48
|
-
"pretty-quick": "^3.1
|
|
49
|
+
"pretty-quick": "^3.3.1",
|
|
49
50
|
"sinon": "10.0.0",
|
|
50
51
|
"ts-node": "^10.9.2",
|
|
51
52
|
"typescript": "^4.9.5"
|
|
@@ -115,7 +116,7 @@
|
|
|
115
116
|
}
|
|
116
117
|
},
|
|
117
118
|
"sfdx": {
|
|
118
|
-
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-omnistudio-migration-tool/1.
|
|
119
|
-
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-omnistudio-migration-tool/1.
|
|
119
|
+
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-omnistudio-migration-tool/1.5.0.crt",
|
|
120
|
+
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-omnistudio-migration-tool/1.5.0.sig"
|
|
120
121
|
}
|
|
121
122
|
}
|