sf-plugin-formula 1.0.1

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,85 @@
1
+ {
2
+ "commands": {
3
+ "formula:evaluate": {
4
+ "aliases": [],
5
+ "args": {},
6
+ "description": "Evaluates a Salesforce formula against one or more records and returns the result for each.\n\nThis command uses [Formulon](https://github.com/leifg/formulon) to parse and evaluate Salesforce formulas entirely offline, no org connection required.\n\nKey features:\n\n- **Multi-record evaluation:** Supply multiple records (each as a variable map) to evaluate the same formula against all of them in one shot.\n- **Inline or file input:** Provide the formula and records directly as CLI flags, or point to a JSON file that contains both.\n- **Error transparency:** Formulon errors (wrong argument count, type mismatches, etc.) are surfaced per record rather than aborting the whole run.",
7
+ "examples": [
8
+ "Run a formula without variables:\n<%= config.bin %> <%= command.id %> --formula 'IF(TRUE, \"Yes\", \"No\")'\nRun a formula with variables and multiple records:\n<%= config.bin %> <%= command.id %> --formula 'Amount\\_\\_c \\* 2' --records '[{\"Amount**c\":{\"type\":\"literal\" \"dataType\":\"number\",\"value\":100,\"options\":{\"length\":6,\"scale\":2}}}]\nRun a formula from a JSON file:\n<%= config.bin %> <%= command.id %> --inputfile ./my-formula.json"
9
+ ],
10
+ "flags": {
11
+ "json": {
12
+ "description": "Format output as json.",
13
+ "helpGroup": "GLOBAL",
14
+ "name": "json",
15
+ "allowNo": false,
16
+ "type": "boolean"
17
+ },
18
+ "flags-dir": {
19
+ "helpGroup": "GLOBAL",
20
+ "name": "flags-dir",
21
+ "summary": "Import flag values from a directory.",
22
+ "hasDynamicHelp": false,
23
+ "multiple": false,
24
+ "type": "option"
25
+ },
26
+ "formula": {
27
+ "char": "f",
28
+ "description": "Ignored when --inputfile is provided.",
29
+ "name": "formula",
30
+ "summary": "Salesforce formula to evaluate.",
31
+ "hasDynamicHelp": false,
32
+ "multiple": false,
33
+ "type": "option"
34
+ },
35
+ "records": {
36
+ "char": "r",
37
+ "description": "Each element represents one record. Ignored when --inputfile is provided.",
38
+ "name": "records",
39
+ "summary": "JSON array of record variable maps.",
40
+ "hasDynamicHelp": false,
41
+ "multiple": false,
42
+ "type": "option"
43
+ },
44
+ "inputfile": {
45
+ "char": "x",
46
+ "description": "When supplied, --formula and --records are ignored.",
47
+ "name": "inputfile",
48
+ "summary": "Path to a JSON file containing \"formula\" and \"records\".",
49
+ "hasDynamicHelp": false,
50
+ "multiple": false,
51
+ "type": "option"
52
+ },
53
+ "debug": {
54
+ "char": "d",
55
+ "name": "debug",
56
+ "summary": "Activate debug mode (more logs)",
57
+ "allowNo": false,
58
+ "type": "boolean"
59
+ }
60
+ },
61
+ "hasDynamicHelp": false,
62
+ "hiddenAliases": [],
63
+ "id": "formula:evaluate",
64
+ "pluginAlias": "sf-plugin-formula",
65
+ "pluginName": "sf-plugin-formula",
66
+ "pluginType": "core",
67
+ "strict": true,
68
+ "summary": "Evaluates a Salesforce formula against one or more records and returns the result for each.",
69
+ "enableJsonFlag": true,
70
+ "isESM": true,
71
+ "relativePath": [
72
+ "lib",
73
+ "commands",
74
+ "formula",
75
+ "evaluate.js"
76
+ ],
77
+ "aliasPermutations": [],
78
+ "permutations": [
79
+ "formula:evaluate",
80
+ "evaluate:formula"
81
+ ]
82
+ }
83
+ },
84
+ "version": "1.0.1"
85
+ }
package/package.json ADDED
@@ -0,0 +1,198 @@
1
+ {
2
+ "name": "sf-plugin-formula",
3
+ "description": "Evaluates a Salesforce formula against one or more records and returns the result for each.",
4
+ "version": "1.0.1",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/matheus-delazeri/sf-plugin-formula"
8
+ },
9
+ "dependencies": {
10
+ "@oclif/core": "^4",
11
+ "@salesforce/core": "^8",
12
+ "@salesforce/sf-plugins-core": "^12",
13
+ "@salesforce/ts-types": "^2.0.12",
14
+ "@steedos/formula": "^3.0.12",
15
+ "chalk": "^5.6.2",
16
+ "fs-extra": "^11.3.4",
17
+ "husky": "^9.1.7",
18
+ "sfdx-hardis": "^7.6.3"
19
+ },
20
+ "devDependencies": {
21
+ "@oclif/plugin-command-snapshot": "^5.1.9",
22
+ "@salesforce/cli-plugins-testkit": "^5.3.10",
23
+ "@salesforce/dev-scripts": "^10",
24
+ "@types/fs-extra": "^11.0.4",
25
+ "@types/node": "^25.5.2",
26
+ "eslint-plugin-sf-plugin": "^1.18.6",
27
+ "oclif": "^4.14.0",
28
+ "ts-node": "^10.9.2",
29
+ "typescript": "^5.4.5"
30
+ },
31
+ "engines": {
32
+ "node": ">=18.0.0"
33
+ },
34
+ "files": [
35
+ "/lib",
36
+ "/messages",
37
+ "/oclif.manifest.json",
38
+ "/oclif.lock"
39
+ ],
40
+ "keywords": [
41
+ "force",
42
+ "salesforce",
43
+ "salesforcedx",
44
+ "sf",
45
+ "sf-plugin",
46
+ "sfdx",
47
+ "sfdx-plugin"
48
+ ],
49
+ "license": "BSD-3-Clause",
50
+ "oclif": {
51
+ "commands": "./lib/commands",
52
+ "bin": "sf",
53
+ "topicSeparator": " ",
54
+ "devPlugins": [
55
+ "@oclif/plugin-help"
56
+ ],
57
+ "topics": {
58
+ "formula": {
59
+ "description": "Formula evaluator."
60
+ }
61
+ },
62
+ "flexibleTaxonomy": true
63
+ },
64
+ "scripts": {
65
+ "build": "wireit",
66
+ "clean": "sf-clean",
67
+ "clean-all": "sf-clean all",
68
+ "compile": "wireit",
69
+ "docs": "sf-docs",
70
+ "format": "wireit",
71
+ "link-check": "wireit",
72
+ "lint": "wireit",
73
+ "postinstall": "yarn husky install",
74
+ "postpack": "sf-clean --ignore-signing-artifacts",
75
+ "prepack": "sf-prepack",
76
+ "test": "wireit",
77
+ "test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel",
78
+ "test:only": "wireit",
79
+ "version": "oclif readme"
80
+ },
81
+ "publishConfig": {
82
+ "access": "public"
83
+ },
84
+ "wireit": {
85
+ "build": {
86
+ "dependencies": [
87
+ "compile",
88
+ "lint"
89
+ ]
90
+ },
91
+ "compile": {
92
+ "command": "tsc -p . --pretty --incremental",
93
+ "files": [
94
+ "src/**/*.ts",
95
+ "**/tsconfig.json",
96
+ "messages/**"
97
+ ],
98
+ "output": [
99
+ "lib/**",
100
+ "*.tsbuildinfo"
101
+ ],
102
+ "clean": "if-file-deleted"
103
+ },
104
+ "format": {
105
+ "command": "prettier --write \"+(src|test|schemas)/**/*.+(ts|js|json)|command-snapshot.json\"",
106
+ "files": [
107
+ "src/**/*.ts",
108
+ "test/**/*.ts",
109
+ "schemas/**/*.json",
110
+ "command-snapshot.json",
111
+ ".prettier*"
112
+ ],
113
+ "output": []
114
+ },
115
+ "lint": {
116
+ "command": "eslint src test --color --cache --cache-location .eslintcache",
117
+ "files": [
118
+ "src/**/*.ts",
119
+ "test/**/*.ts",
120
+ "messages/**",
121
+ "**/.eslint*",
122
+ "**/tsconfig.json"
123
+ ],
124
+ "output": []
125
+ },
126
+ "test:compile": {
127
+ "command": "tsc -p \"./test\" --pretty",
128
+ "files": [
129
+ "test/**/*.ts",
130
+ "**/tsconfig.json"
131
+ ],
132
+ "output": []
133
+ },
134
+ "test": {
135
+ "dependencies": [
136
+ "test:compile",
137
+ "test:only",
138
+ "lint"
139
+ ]
140
+ },
141
+ "test:only": {
142
+ "command": "nyc mocha \"test/**/*.test.ts\"",
143
+ "env": {
144
+ "FORCE_COLOR": "2"
145
+ },
146
+ "files": [
147
+ "test/**/*.ts",
148
+ "src/**/*.ts",
149
+ "**/tsconfig.json",
150
+ ".mocha*",
151
+ "!*.nut.ts",
152
+ ".nycrc"
153
+ ],
154
+ "output": []
155
+ },
156
+ "test:command-reference": {
157
+ "command": "node --loader ts-node/esm --no-warnings=ExperimentalWarning \"./bin/dev.js\" commandreference:generate --erroronwarnings",
158
+ "files": [
159
+ "src/**/*.ts",
160
+ "messages/**",
161
+ "package.json"
162
+ ],
163
+ "output": [
164
+ "tmp/root"
165
+ ]
166
+ },
167
+ "test:deprecation-policy": {
168
+ "command": "node --loader ts-node/esm --no-warnings=ExperimentalWarning \"./bin/dev.js\" snapshot:compare",
169
+ "files": [
170
+ "src/**/*.ts"
171
+ ],
172
+ "output": [],
173
+ "dependencies": [
174
+ "compile"
175
+ ]
176
+ },
177
+ "test:json-schema": {
178
+ "command": "node --loader ts-node/esm --no-warnings=ExperimentalWarning \"./bin/dev.js\" schema:compare",
179
+ "files": [
180
+ "src/**/*.ts",
181
+ "schemas"
182
+ ],
183
+ "output": []
184
+ },
185
+ "link-check": {
186
+ "command": "node -e \"process.exit(process.env.CI ? 0 : 1)\" || linkinator \"**/*.md\" --skip \"CHANGELOG.md|node_modules|test/|confluence.internal.salesforce.com|my.salesforce.com|%s\" --markdown --retry --directory-listing --verbosity error",
187
+ "files": [
188
+ "./*.md",
189
+ "./!(CHANGELOG).md",
190
+ "messages/**/*.md"
191
+ ],
192
+ "output": []
193
+ }
194
+ },
195
+ "exports": "./lib/index.js",
196
+ "type": "module",
197
+ "author": "matheus-delazeri"
198
+ }