@cparra/apex-reflection 2.22.0-dev.20251224084554 → 2.22.0-dev.20251224085115
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/dist/index.d.ts +2 -1
- package/dist/index.js +20 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare function reflect(declarationBody: string):
|
|
1
|
+
export declare function reflect(declarationBody: string): ReflectionResult;
|
|
2
|
+
export declare function reflectTrigger(declarationBody: string): TriggerReflectionResult;
|
|
2
3
|
export interface ParamAnnotation {
|
|
3
4
|
bodyLines: string[];
|
|
4
5
|
paramName: string;
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.reflect = void 0;
|
|
6
|
+
exports.reflectTrigger = exports.reflect = void 0;
|
|
7
7
|
const shelljs_1 = __importDefault(require("shelljs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -60,3 +60,22 @@ function reflect(declarationBody) {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
exports.reflect = reflect;
|
|
63
|
+
function reflectTrigger(declarationBody) {
|
|
64
|
+
// NOTE: `declarationBody` is unused for now (prototype phase).
|
|
65
|
+
const binaryPath = resolveNativeBinaryPath();
|
|
66
|
+
const execResult = shelljs_1.default.exec(`"${binaryPath}" --type=reflectTrigger --source "${declarationBody}"`, { silent: true });
|
|
67
|
+
if (execResult.code !== 0) {
|
|
68
|
+
throw new Error(`apex-reflection native binary failed (code=${execResult.code}). stderr:\n${execResult.stderr}`);
|
|
69
|
+
}
|
|
70
|
+
const stdout = (execResult.stdout ?? "").toString().trim();
|
|
71
|
+
if (!stdout) {
|
|
72
|
+
throw new Error("apex-reflection native binary produced no output on stdout.");
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
return JSON.parse(stdout);
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
throw new Error(`apex-reflection native binary output was not valid JSON.\nstdout:\n${stdout}\nerror: ${String(e)}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.reflectTrigger = reflectTrigger;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cparra/apex-reflection",
|
|
3
|
-
"version": "2.22.0-dev.
|
|
3
|
+
"version": "2.22.0-dev.20251224085115",
|
|
4
4
|
"description": "Provides tools for reflecting Apex code, the language used in Salesforce development.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|