@simplysf/simply-aep 0.5.1 → 0.6.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.
package/README.md CHANGED
@@ -22,6 +22,326 @@ This package is part of the [`@simplysf/simply`](https://github.com/SimplySF/sim
22
22
 
23
23
  <!-- commands -->
24
24
 
25
+ - [`sf simply aep at4dx binding list`](#sf-simply-aep-at4dx-binding-list)
26
+ - [`sf simply aep at4dx domain-process-binding create`](#sf-simply-aep-at4dx-domain-process-binding-create)
27
+ - [`sf simply aep at4dx domain-process-binding list`](#sf-simply-aep-at4dx-domain-process-binding-list)
28
+ - [`sf simply aep at4dx domain-process-binding set`](#sf-simply-aep-at4dx-domain-process-binding-set)
29
+ - [`sf simply aep at4dx domain-process-binding validate`](#sf-simply-aep-at4dx-domain-process-binding-validate)
30
+
31
+ ## `sf simply aep at4dx binding list`
32
+
33
+ List the AT4DX Application Factory bindings configured in an org or local source, resolved to show which record wins for each binding key.
34
+
35
+ ```
36
+ USAGE
37
+ $ sf simply aep at4dx binding list [--json] [--flags-dir <value>] [-o <value>] [--api-version <value>] [-d <value>...] [-t
38
+ service|selector|domain|unit-of-work...] [--effective-only]
39
+
40
+ FLAGS
41
+ -d, --source-dir=<value>... One or more paths to directories containing Salesforce DX source. Use this for
42
+ local-source discovery.
43
+ -o, --target-org=<value> Username or alias of the org to read bindings from. Use this for live-org discovery.
44
+ -t, --type=<option>... Binding type(s) to include: service, selector, domain, unit-of-work.
45
+ <options: service|selector|domain|unit-of-work>
46
+ --api-version=<value> Override the api version used for api requests made by this command
47
+ --effective-only Only show the bindings that actually win for their key; hide shadowed/non-winning
48
+ records.
49
+
50
+ GLOBAL FLAGS
51
+ --flags-dir=<value> Import flag values from a directory.
52
+ --json Format output as json.
53
+
54
+ DESCRIPTION
55
+ List the AT4DX Application Factory bindings configured in an org or local source, resolved to show which record wins
56
+ for each binding key.
57
+
58
+ Reads the four AT4DX Application Factory Custom Metadata Types — `ApplicationFactory_ServiceBinding__mdt`,
59
+ `ApplicationFactory_SelectorBinding__mdt`, `ApplicationFactory_DomainBinding__mdt`, and
60
+ `ApplicationFactory_UnitOfWorkBinding__mdt` — either from a live org or from local Salesforce DX source, and
61
+ reproduces the resolution rules AT4DX applies at runtime so you can see which record actually wins for a given
62
+ interface or SObject, and which ones are shadowed. Exactly one of `--target-org` or `--source-dir` must be specified.
63
+
64
+ Service and Selector bindings resolve deterministically on `Priority__c` (highest wins). Domain bindings have no
65
+ priority field, so a duplicated key is flagged `ambiguous` rather than reporting a guessed winner. UnitOfWork bindings
66
+ have no winner concept at all — every record contributes to one ordered registration list.
67
+
68
+ EXAMPLES
69
+ $ sf simply aep at4dx binding list --target-org myOrg
70
+
71
+ $ sf simply aep at4dx binding list --source-dir sfdx-source/core --source-dir sfdx-source/app
72
+
73
+ $ sf simply aep at4dx binding list --target-org myOrg --type service,selector
74
+
75
+ $ sf simply aep at4dx binding list --target-org myOrg --effective-only --json
76
+
77
+ FLAG DESCRIPTIONS
78
+ -t, --type=service|selector|domain|unit-of-work...
79
+
80
+ Binding type(s) to include: service, selector, domain, unit-of-work.
81
+
82
+ Comma-separated list of binding types to include. If not specified, all four are included.
83
+ ```
84
+
85
+ _See code: [lib/commands/simply/aep/at4dx/binding/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.5.1/packages/simply-aep/lib/commands/simply/aep/at4dx/binding/list.js)_
86
+
87
+ ## `sf simply aep at4dx domain-process-binding create`
88
+
89
+ Create a new AT4DX Trigger Action Framework binding (DomainProcessBinding__mdt) in local source and/or a connected org.
90
+
91
+ ```
92
+ USAGE
93
+ $ sf simply aep at4dx domain-process-binding create -n <value> -s <value> --process-context TriggerExecution|DomainMethodExecution -t
94
+ Action|Criteria -c <value> --order <value> [--json] [--flags-dir <value>] [-d <value>] [-o <value>] [--api-version
95
+ <value>] [--wait <value>] [--label <value>] [--sobject-alternate] [--trigger-operation
96
+ Before_Insert|After_Insert|Before_Update|After_Update|Before_Delete|After_Delete|After_Undelete]
97
+ [--domain-method-token <value>] [--active] [--execute-asynchronous] [--logical-inverse] [--prevent-recursive]
98
+ [--description <value>] [--force]
99
+
100
+ FLAGS
101
+ -c, --class-to-inject=<value> (required) The Apex class this binding wires in.
102
+ -d, --source-dir=<value> The package directory to create
103
+ customMetadata/DomainProcessBinding.<name>.md-meta.xml under. Created if the
104
+ customMetadata folder doesn't exist yet.
105
+ -n, --developer-name=<value> (required) The binding's DeveloperName. Must start with a letter, contain only
106
+ letters, numbers, and single underscores, not end with an underscore, and be 40
107
+ characters or fewer.
108
+ -o, --target-org=<value> Deploy the generated binding to this org after writing it.
109
+ -s, --sobject=<value> (required) The SObject API name to bind against.
110
+ -t, --type=<option> (required) Whether this binding contributes a Criteria filter or an Action.
111
+ <options: Action|Criteria>
112
+ --[no-]active IsActive__c.
113
+ --api-version=<value> Override the api version used for api requests made by this command
114
+ --description=<value> Description__c.
115
+ --domain-method-token=<value> The domain method's process token this binding matches. Required, and only allowed,
116
+ when --process-context is DomainMethodExecution.
117
+ --execute-asynchronous ExecuteAsynchronous__c.
118
+ --force Write (and deploy) even if validation finds an error-severity issue. Validation
119
+ still runs and its issues are still printed and returned.
120
+ --label=<value> The binding's label. Defaults to --developer-name. Must be 40 characters or fewer.
121
+ --logical-inverse LogicalInverse__c.
122
+ --order=<value> (required) OrderOfExecution__c. Numeric; decimals are allowed.
123
+ --prevent-recursive PreventRecursive__c.
124
+ --process-context=<option> (required) What kind of process invokes this binding: TriggerExecution or
125
+ DomainMethodExecution.
126
+ <options: TriggerExecution|DomainMethodExecution>
127
+ --[no-]sobject-alternate Write --sobject to RelatedDomainBindingSObjectAlternate__c instead of
128
+ RelatedDomainBindingSObject__c. Use this for a SObject that can't be referenced
129
+ through an EntityDefinition field at all (for example ServiceResource and other
130
+ Setup objects).
131
+ --trigger-operation=<option> The trigger event this binding fires on. Required, and only allowed, when
132
+ --process-context is TriggerExecution.
133
+ <options: Before_Insert|After_Insert|Before_Update|After_Update|Before_Delete|After
134
+ _Delete|After_Undelete>
135
+ --wait=<value> [default: 33] Deploy poll timeout, in minutes. Only meaningful with --target-org.
136
+
137
+ GLOBAL FLAGS
138
+ --flags-dir=<value> Import flag values from a directory.
139
+ --json Format output as json.
140
+
141
+ DESCRIPTION
142
+ Create a new AT4DX Trigger Action Framework binding (DomainProcessBinding__mdt) in local source and/or a connected
143
+ org.
144
+
145
+ Generates a `DomainProcessBinding.<DeveloperName>.md-meta.xml` file from the given flags and writes it under
146
+ --source-dir, deploys it to --target-org, or both. Validates the resulting binding — alongside everything else already
147
+ in scope — with the same rules `simply aep at4dx domain-process-binding validate` uses, and refuses to write if that
148
+ introduces an error-severity issue unless --force is passed. At least one of --source-dir/--target-org is required;
149
+ unlike `list`/`validate`, both may be given at once (write to source and deploy it live in the same run). Given
150
+ --target-org alone, the file is written to a temporary directory, deployed, and discarded — no working-tree footprint.
151
+
152
+ Writes RelatedDomainBindingSObject__c by default. Pass --sobject-alternate to write
153
+ RelatedDomainBindingSObjectAlternate__c instead, for a SObject (such as ServiceResource and other Setup objects) that
154
+ can't be referenced through an EntityDefinition field at all.
155
+
156
+ EXAMPLES
157
+ $ sf simply aep at4dx domain-process-binding create --source-dir sfdx-source/core --developer-name Account_Before_Insert_Assign_Owner --sobject Account --process-context TriggerExecution --trigger-operation Before_Insert --type Action --class-to-inject AccountAssignOwnerAction --order 10
158
+
159
+ $ sf simply aep at4dx domain-process-binding create --target-org myOrg --developer-name Account_Before_Insert_Assign_Owner --sobject Account --process-context TriggerExecution --trigger-operation Before_Insert --type Action --class-to-inject AccountAssignOwnerAction --order 10
160
+
161
+ $ sf simply aep at4dx domain-process-binding create --source-dir sfdx-source/core --target-org myOrg --developer-name Account_Before_Insert_Assign_Owner --sobject Account --process-context TriggerExecution --trigger-operation Before_Insert --type Action --class-to-inject AccountAssignOwnerAction --order 10
162
+
163
+ $ sf simply aep at4dx domain-process-binding create --source-dir sfdx-source/core --developer-name ServiceResource_Before_Update_Sync --sobject ServiceResource --sobject-alternate --process-context TriggerExecution --trigger-operation Before_Update --type Action --class-to-inject ServiceResourceSyncAction --order 10
164
+ ```
165
+
166
+ _See code: [lib/commands/simply/aep/at4dx/domain-process-binding/create.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.5.1/packages/simply-aep/lib/commands/simply/aep/at4dx/domain-process-binding/create.js)_
167
+
168
+ ## `sf simply aep at4dx domain-process-binding list`
169
+
170
+ List the AT4DX Trigger Action Framework bindings configured in an org or local source, in execution order.
171
+
172
+ ```
173
+ USAGE
174
+ $ sf simply aep at4dx domain-process-binding list [--json] [--flags-dir <value>] [-o <value>] [--api-version <value>] [-d <value>...] [-s
175
+ <value>...] [--active-only]
176
+
177
+ FLAGS
178
+ -d, --source-dir=<value>... One or more paths to directories containing Salesforce DX source. Use this for
179
+ local-source discovery.
180
+ -o, --target-org=<value> Username or alias of the org to read bindings from. Use this for live-org discovery.
181
+ -s, --sobject=<value>... SObject API name(s) to filter to. If not specified, bindings for every SObject are
182
+ included.
183
+ --active-only Only show active bindings; hide inactive records.
184
+ --api-version=<value> Override the api version used for api requests made by this command
185
+
186
+ GLOBAL FLAGS
187
+ --flags-dir=<value> Import flag values from a directory.
188
+ --json Format output as json.
189
+
190
+ DESCRIPTION
191
+ List the AT4DX Trigger Action Framework bindings configured in an org or local source, in execution order.
192
+
193
+ Reads AT4DX's Trigger Action Framework Custom Metadata Type — `DomainProcessBinding__mdt` — either from a live org or
194
+ from local Salesforce DX source, showing which criteria/action classes are bound to each SObject's trigger events (or
195
+ domain method tokens), and the order they run in. Exactly one of `--target-org` or `--source-dir` must be specified.
196
+
197
+ Unlike `simply aep at4dx binding list`, there's no "winner" here — every active record in a group (same SObject,
198
+ process context, and trigger operation or domain method token) runs, in `OrderOfExecution__c` order. Two active
199
+ records sharing the same order within a group are flagged as a collision, since AT4DX doesn't guarantee which one runs
200
+ first in that case.
201
+
202
+ EXAMPLES
203
+ $ sf simply aep at4dx domain-process-binding list --target-org myOrg
204
+
205
+ $ sf simply aep at4dx domain-process-binding list --source-dir sfdx-source/core --source-dir sfdx-source/app
206
+
207
+ $ sf simply aep at4dx domain-process-binding list --target-org myOrg --sobject Account
208
+
209
+ $ sf simply aep at4dx domain-process-binding list --target-org myOrg --active-only --json
210
+ ```
211
+
212
+ _See code: [lib/commands/simply/aep/at4dx/domain-process-binding/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.5.1/packages/simply-aep/lib/commands/simply/aep/at4dx/domain-process-binding/list.js)_
213
+
214
+ ## `sf simply aep at4dx domain-process-binding set`
215
+
216
+ Update an existing AT4DX Trigger Action Framework binding (DomainProcessBinding__mdt) in local source and/or a connected org.
217
+
218
+ ```
219
+ USAGE
220
+ $ sf simply aep at4dx domain-process-binding set -n <value> [--json] [--flags-dir <value>] [-d <value>...] [-o <value>] [--api-version <value>]
221
+ [--wait <value>] [--label <value>] [-s <value>] [--sobject-alternate] [--process-context
222
+ TriggerExecution|DomainMethodExecution] [--trigger-operation
223
+ Before_Insert|After_Insert|Before_Update|After_Update|Before_Delete|After_Delete|After_Undelete]
224
+ [--domain-method-token <value>] [-t Action|Criteria] [-c <value>] [--order <value>] [--active]
225
+ [--execute-asynchronous] [--logical-inverse] [--prevent-recursive] [--description <value>] [--force]
226
+
227
+ FLAGS
228
+ -c, --class-to-inject=<value> The Apex class this binding wires in. If not given, the existing value is kept.
229
+ -d, --source-dir=<value>... One or more paths to directories containing Salesforce DX source, searched for the
230
+ binding to update.
231
+ -n, --developer-name=<value> (required) The DeveloperName of the binding to update.
232
+ -o, --target-org=<value> Locate (when --source-dir isn't given) and/or deploy the binding to this org.
233
+ -s, --sobject=<value> The SObject API name to bind against. If not given, the existing value is kept.
234
+ -t, --type=<option> Whether this binding contributes a Criteria filter or an Action. If not given, the
235
+ existing value is kept.
236
+ <options: Action|Criteria>
237
+ --[no-]active IsActive__c. If not given, the existing value is kept.
238
+ --api-version=<value> Override the api version used for api requests made by this command
239
+ --description=<value> Description__c. If not given, the existing value is kept.
240
+ --domain-method-token=<value> The domain method's process token this binding matches. If you change
241
+ --process-context to DomainMethodExecution, pass this too.
242
+ --[no-]execute-asynchronous ExecuteAsynchronous__c. If not given, the existing value is kept.
243
+ --force Write (and deploy) even if validation finds an error-severity issue. Validation
244
+ still runs and its issues are still printed and returned.
245
+ --label=<value> The binding's label. If not given, the existing label is kept.
246
+ --[no-]logical-inverse LogicalInverse__c. If not given, the existing value is kept.
247
+ --order=<value> OrderOfExecution__c. Numeric; decimals are allowed. If not given, the existing
248
+ value is kept.
249
+ --[no-]prevent-recursive PreventRecursive__c. If not given, the existing value is kept.
250
+ --process-context=<option> What kind of process invokes this binding: TriggerExecution or
251
+ DomainMethodExecution. If not given, the existing value is kept.
252
+ <options: TriggerExecution|DomainMethodExecution>
253
+ --[no-]sobject-alternate Write --sobject to RelatedDomainBindingSObjectAlternate__c instead of
254
+ RelatedDomainBindingSObject__c, for a SObject that can't be referenced through an
255
+ EntityDefinition field at all (for example ServiceResource and other Setup
256
+ objects). If not given, the binding keeps whichever field it already uses — this
257
+ flag only needs to be passed to change it.
258
+ --trigger-operation=<option> The trigger event this binding fires on. If you change --process-context to
259
+ TriggerExecution, pass this too.
260
+ <options: Before_Insert|After_Insert|Before_Update|After_Update|Before_Delete|After
261
+ _Delete|After_Undelete>
262
+ --wait=<value> [default: 33] Deploy poll timeout, in minutes. Only meaningful with --target-org.
263
+
264
+ GLOBAL FLAGS
265
+ --flags-dir=<value> Import flag values from a directory.
266
+ --json Format output as json.
267
+
268
+ DESCRIPTION
269
+ Update an existing AT4DX Trigger Action Framework binding (DomainProcessBinding__mdt) in local source and/or a
270
+ connected org.
271
+
272
+ Finds the binding named --developer-name in local source and/or a connected org, applies only the fields given as
273
+ flags — everything else, including which SObject reference field the binding uses, is preserved from the found record
274
+ — and rewrites the `DomainProcessBinding.<DeveloperName>.md-meta.xml` file. Validates the resulting binding —
275
+ alongside everything else already in scope — with the same rules `simply aep at4dx domain-process-binding validate`
276
+ uses, and refuses to write if that introduces an error-severity issue unless --force is passed.
277
+
278
+ When --source-dir is given, the binding is located there (searched across every directory given, same as
279
+ `list`/`validate`) and that exact file is rewritten; the found file is also deployed if --target-org is given. When
280
+ only --target-org is given, the binding is located and updated directly in the org via a temporary file, deployed,
281
+ then discarded — no working-tree footprint.
282
+
283
+ --developer-name identifies the binding to update and can't itself be changed by this command.
284
+
285
+ EXAMPLES
286
+ $ sf simply aep at4dx domain-process-binding set --source-dir sfdx-source/core --source-dir sfdx-source/app --developer-name Account_Before_Insert_Assign_Owner --order 20 --no-active
287
+
288
+ $ sf simply aep at4dx domain-process-binding set --target-org myOrg --developer-name Account_Before_Insert_Assign_Owner --class-to-inject AccountAssignOwnerActionV2
289
+ ```
290
+
291
+ _See code: [lib/commands/simply/aep/at4dx/domain-process-binding/set.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.5.1/packages/simply-aep/lib/commands/simply/aep/at4dx/domain-process-binding/set.js)_
292
+
293
+ ## `sf simply aep at4dx domain-process-binding validate`
294
+
295
+ Validate the AT4DX Trigger Action Framework bindings configured in an org or local source, failing when a wiring problem is found.
296
+
297
+ ```
298
+ USAGE
299
+ $ sf simply aep at4dx domain-process-binding validate [--json] [--flags-dir <value>] [-o <value>] [--api-version <value>] [-d <value>...] [-s
300
+ <value>...]
301
+
302
+ FLAGS
303
+ -d, --source-dir=<value>... One or more paths to directories containing Salesforce DX source. Use this for
304
+ local-source discovery.
305
+ -o, --target-org=<value> Username or alias of the org to read bindings from. Use this for live-org discovery.
306
+ -s, --sobject=<value>... SObject API name(s) to filter to. Applies only to issues that name an SObject; issues
307
+ that span the whole scan (a duplicate DeveloperName, or a binding with no resolvable
308
+ SObject) are always reported, since filtering could hide the exact conflict they exist to
309
+ catch. If not specified, every issue is included.
310
+ --api-version=<value> Override the api version used for api requests made by this command
311
+
312
+ GLOBAL FLAGS
313
+ --flags-dir=<value> Import flag values from a directory.
314
+ --json Format output as json.
315
+
316
+ DESCRIPTION
317
+ Validate the AT4DX Trigger Action Framework bindings configured in an org or local source, failing when a wiring
318
+ problem is found.
319
+
320
+ Reads AT4DX's Trigger Action Framework Custom Metadata Type — `DomainProcessBinding__mdt` — either from a live org or
321
+ from local Salesforce DX source, and checks it for problems `simply aep at4dx domain-process-binding list` doesn't
322
+ fail on: two active records silently fighting over the same execution slot, a binding with no resolvable SObject, a
323
+ binding whose declared process context doesn't match the field that's actually populated (so it never runs), the same
324
+ DeveloperName defined more than once, and an ambiguous SObject reference. Exactly one of `--target-org` or
325
+ `--source-dir` must be specified.
326
+
327
+ Prints a table of every issue found. When --sobject is specified, scan-wide issues (a duplicate DeveloperName, or a
328
+ binding with no resolvable SObject) print in their own section below the filtered table, since they can't be
329
+ attributed to one SObject. Exits non-zero when any issue is an error (a warning alone doesn't fail the command) — use
330
+ this in CI to gate on AT4DX wiring problems before they reach an org.
331
+
332
+ EXAMPLES
333
+ $ sf simply aep at4dx domain-process-binding validate --target-org myOrg
334
+
335
+ $ sf simply aep at4dx domain-process-binding validate --source-dir sfdx-source/core --source-dir sfdx-source/app
336
+
337
+ $ sf simply aep at4dx domain-process-binding validate --target-org myOrg --sobject Account
338
+
339
+ $ sf simply aep at4dx domain-process-binding validate --target-org myOrg --json
340
+ ```
341
+
342
+ _See code: [lib/commands/simply/aep/at4dx/domain-process-binding/validate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.5.1/packages/simply-aep/lib/commands/simply/aep/at4dx/domain-process-binding/validate.js)_
343
+ <!-- commandsstop -->
344
+
25
345
  - [`sf simply aep at4dx binding list`](#sf-simply-aep-at4dx-binding-list)
26
346
  - [`sf simply aep at4dx domain-process-binding list`](#sf-simply-aep-at4dx-domain-process-binding-list)
27
347
  - [`sf simply aep at4dx domain-process-binding validate`](#sf-simply-aep-at4dx-domain-process-binding-validate)
@@ -0,0 +1,35 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { type At4dxDomainProcessBindingCreateResult, type DomainProcessType, type ProcessContext, type TriggerOperation } from '@simplysf/simply-aep-core';
3
+ /**
4
+ * Creates a new AT4DX Trigger Action Framework binding (`DomainProcessBinding__mdt`) in local DX
5
+ * source and/or a connected org, validating it against everything already scanned before writing.
6
+ */
7
+ export default class At4dxDomainProcessBindingCreate extends SfCommand<At4dxDomainProcessBindingCreateResult> {
8
+ static readonly summary: string;
9
+ static readonly description: string;
10
+ static readonly examples: string[];
11
+ static readonly flags: {
12
+ 'source-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ wait: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
16
+ 'developer-name': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
17
+ label: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ sobject: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
19
+ 'sobject-alternate': import("@oclif/core/interfaces").BooleanFlag<boolean>;
20
+ 'process-context': import("@oclif/core/interfaces").OptionFlag<ProcessContext, import("@oclif/core/interfaces").CustomOptions>;
21
+ 'trigger-operation': import("@oclif/core/interfaces").OptionFlag<TriggerOperation | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
+ 'domain-method-token': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ type: import("@oclif/core/interfaces").OptionFlag<DomainProcessType, import("@oclif/core/interfaces").CustomOptions>;
24
+ 'class-to-inject': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
25
+ order: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
26
+ active: import("@oclif/core/interfaces").BooleanFlag<boolean>;
27
+ 'execute-asynchronous': import("@oclif/core/interfaces").BooleanFlag<boolean>;
28
+ 'logical-inverse': import("@oclif/core/interfaces").BooleanFlag<boolean>;
29
+ 'prevent-recursive': import("@oclif/core/interfaces").BooleanFlag<boolean>;
30
+ description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
31
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
32
+ 'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
33
+ };
34
+ run(): Promise<At4dxDomainProcessBindingCreateResult>;
35
+ }
@@ -0,0 +1,147 @@
1
+ /*
2
+ * Copyright (c) 2026, Clay Chipps.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Duration } from '@salesforce/kit';
17
+ import { Messages } from '@salesforce/core';
18
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
19
+ import { ALL_TRIGGER_OPERATIONS, createDomainProcessBinding, } from '@simplysf/simply-aep-core';
20
+ import { toDomainProcessBindingCliError } from '../../../../../common/domainProcessBindingWriteError.js';
21
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
22
+ const messages = Messages.loadMessages('@simplysf/simply-aep', 'simply.aep.at4dx.domain-process-binding.create');
23
+ const ISSUE_TABLE_COLUMNS = [
24
+ { key: 'severity', name: 'SEVERITY' },
25
+ { key: 'rule', name: 'RULE' },
26
+ { key: 'message', name: 'MESSAGE' },
27
+ ];
28
+ function toIssueDisplayRow(issue) {
29
+ return { severity: issue.severity, rule: issue.rule, message: issue.message };
30
+ }
31
+ /**
32
+ * Creates a new AT4DX Trigger Action Framework binding (`DomainProcessBinding__mdt`) in local DX
33
+ * source and/or a connected org, validating it against everything already scanned before writing.
34
+ */
35
+ export default class At4dxDomainProcessBindingCreate extends SfCommand {
36
+ static summary = messages.getMessage('summary');
37
+ static description = messages.getMessage('description');
38
+ static examples = messages.getMessages('examples');
39
+ static flags = {
40
+ ...SfCommand.baseFlags,
41
+ 'source-dir': Flags.directory({
42
+ summary: messages.getMessage('flags.source-dir.summary'),
43
+ char: 'd',
44
+ }),
45
+ 'target-org': Flags.optionalOrg({
46
+ summary: messages.getMessage('flags.target-org.summary'),
47
+ char: 'o',
48
+ }),
49
+ 'api-version': Flags.orgApiVersion(),
50
+ wait: Flags.string({ summary: messages.getMessage('flags.wait.summary'), default: '33' }),
51
+ 'developer-name': Flags.string({
52
+ summary: messages.getMessage('flags.developer-name.summary'),
53
+ char: 'n',
54
+ required: true,
55
+ }),
56
+ label: Flags.string({ summary: messages.getMessage('flags.label.summary') }),
57
+ sobject: Flags.string({ summary: messages.getMessage('flags.sobject.summary'), char: 's', required: true }),
58
+ 'sobject-alternate': Flags.boolean({
59
+ summary: messages.getMessage('flags.sobject-alternate.summary'),
60
+ allowNo: true,
61
+ }),
62
+ 'process-context': Flags.custom({ options: ['TriggerExecution', 'DomainMethodExecution'] })({
63
+ summary: messages.getMessage('flags.process-context.summary'),
64
+ required: true,
65
+ }),
66
+ 'trigger-operation': Flags.custom({ options: ALL_TRIGGER_OPERATIONS })({
67
+ summary: messages.getMessage('flags.trigger-operation.summary'),
68
+ }),
69
+ 'domain-method-token': Flags.string({ summary: messages.getMessage('flags.domain-method-token.summary') }),
70
+ type: Flags.custom({ options: ['Action', 'Criteria'] })({
71
+ summary: messages.getMessage('flags.type.summary'),
72
+ char: 't',
73
+ required: true,
74
+ }),
75
+ 'class-to-inject': Flags.string({
76
+ summary: messages.getMessage('flags.class-to-inject.summary'),
77
+ char: 'c',
78
+ required: true,
79
+ }),
80
+ order: Flags.string({ summary: messages.getMessage('flags.order.summary'), required: true }),
81
+ active: Flags.boolean({ summary: messages.getMessage('flags.active.summary'), default: true, allowNo: true }),
82
+ 'execute-asynchronous': Flags.boolean({
83
+ summary: messages.getMessage('flags.execute-asynchronous.summary'),
84
+ default: false,
85
+ }),
86
+ 'logical-inverse': Flags.boolean({ summary: messages.getMessage('flags.logical-inverse.summary'), default: false }),
87
+ 'prevent-recursive': Flags.boolean({
88
+ summary: messages.getMessage('flags.prevent-recursive.summary'),
89
+ default: false,
90
+ }),
91
+ description: Flags.string({ summary: messages.getMessage('flags.description.summary') }),
92
+ force: Flags.boolean({ summary: messages.getMessage('flags.force.summary'), default: false }),
93
+ };
94
+ async run() {
95
+ const { flags } = await this.parse(At4dxDomainProcessBindingCreate);
96
+ const sourceDir = flags['source-dir'];
97
+ const targetOrg = flags['target-org'];
98
+ if (!sourceDir && !targetOrg) {
99
+ throw messages.createError('error.sourceDirOrTargetOrgRequired');
100
+ }
101
+ if (flags['process-context'] === 'TriggerExecution' && !flags['trigger-operation']) {
102
+ throw messages.createError('error.triggerOperationRequired');
103
+ }
104
+ if (flags['process-context'] === 'DomainMethodExecution' && !flags['domain-method-token']) {
105
+ throw messages.createError('error.domainMethodTokenRequired');
106
+ }
107
+ const order = Number(flags.order);
108
+ if (Number.isNaN(order)) {
109
+ throw messages.createError('error.invalidOrder', [flags.order]);
110
+ }
111
+ const connection = targetOrg?.getConnection(flags['api-version']);
112
+ try {
113
+ const result = await createDomainProcessBinding({
114
+ developerName: flags['developer-name'],
115
+ label: flags.label,
116
+ sobject: flags.sobject,
117
+ sobjectAlternate: flags['sobject-alternate'],
118
+ processContext: flags['process-context'],
119
+ triggerOperation: flags['trigger-operation'],
120
+ domainMethodToken: flags['domain-method-token'],
121
+ type: flags.type,
122
+ classToInject: flags['class-to-inject'],
123
+ order,
124
+ isActive: flags.active,
125
+ executeAsynchronous: flags['execute-asynchronous'],
126
+ logicalInverse: flags['logical-inverse'],
127
+ preventRecursive: flags['prevent-recursive'],
128
+ description: flags.description,
129
+ force: flags.force,
130
+ }, { sourceDir, connection, wait: Duration.minutes(Number(flags.wait)) });
131
+ if (result.issues.length > 0) {
132
+ this.table({ data: result.issues.map(toIssueDisplayRow), columns: ISSUE_TABLE_COLUMNS });
133
+ }
134
+ this.info(messages.getMessage(result.filePath ? 'info.created' : 'info.createdInOrg', [result.developerName]));
135
+ if (result.deploy) {
136
+ this.info(messages.getMessage('info.deployed', [result.deploy.id]));
137
+ }
138
+ return result;
139
+ }
140
+ catch (error) {
141
+ throw toDomainProcessBindingCliError(error, messages, (issues) => {
142
+ this.table({ data: issues.map(toIssueDisplayRow), columns: ISSUE_TABLE_COLUMNS });
143
+ });
144
+ }
145
+ }
146
+ }
147
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../../../src/commands/simply/aep/at4dx/domain-process-binding/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAM3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,8BAA8B,EAAE,MAAM,yDAAyD,CAAC;AAEzG,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,sBAAsB,EAAE,gDAAgD,CAAC,CAAC;AAIjH,MAAM,mBAAmB,GAAwD;IAC/E,EAAE,GAAG,EAAE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,EAAE;gBAC/D,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC;YACpF,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { type At4dxDomainProcessBindingSetResult, type DomainProcessType, type ProcessContext, type TriggerOperation } from '@simplysf/simply-aep-core';
3
+ /**
4
+ * Updates an existing AT4DX Trigger Action Framework binding (`DomainProcessBinding__mdt`) in local DX
5
+ * source and/or a connected org — only the fields given change; everything else, including which
6
+ * SObject reference field the binding uses, is preserved from the found record.
7
+ */
8
+ export default class At4dxDomainProcessBindingSet extends SfCommand<At4dxDomainProcessBindingSetResult> {
9
+ static readonly summary: string;
10
+ static readonly description: string;
11
+ static readonly examples: string[];
12
+ static readonly flags: {
13
+ 'source-dir': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
15
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ wait: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
17
+ 'developer-name': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
18
+ label: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ sobject: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ 'sobject-alternate': import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
+ 'process-context': import("@oclif/core/interfaces").OptionFlag<ProcessContext | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
+ 'trigger-operation': import("@oclif/core/interfaces").OptionFlag<TriggerOperation | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ 'domain-method-token': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
+ type: import("@oclif/core/interfaces").OptionFlag<DomainProcessType | undefined, import("@oclif/core/interfaces").CustomOptions>;
25
+ 'class-to-inject': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
26
+ order: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
27
+ active: import("@oclif/core/interfaces").BooleanFlag<boolean>;
28
+ 'execute-asynchronous': import("@oclif/core/interfaces").BooleanFlag<boolean>;
29
+ 'logical-inverse': import("@oclif/core/interfaces").BooleanFlag<boolean>;
30
+ 'prevent-recursive': import("@oclif/core/interfaces").BooleanFlag<boolean>;
31
+ description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
32
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
33
+ 'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
34
+ };
35
+ run(): Promise<At4dxDomainProcessBindingSetResult>;
36
+ }
@@ -0,0 +1,141 @@
1
+ /*
2
+ * Copyright (c) 2026, Clay Chipps.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Duration } from '@salesforce/kit';
17
+ import { Messages } from '@salesforce/core';
18
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
19
+ import { ALL_TRIGGER_OPERATIONS, setDomainProcessBinding, } from '@simplysf/simply-aep-core';
20
+ import { toDomainProcessBindingCliError } from '../../../../../common/domainProcessBindingWriteError.js';
21
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
22
+ const messages = Messages.loadMessages('@simplysf/simply-aep', 'simply.aep.at4dx.domain-process-binding.set');
23
+ const ISSUE_TABLE_COLUMNS = [
24
+ { key: 'severity', name: 'SEVERITY' },
25
+ { key: 'rule', name: 'RULE' },
26
+ { key: 'message', name: 'MESSAGE' },
27
+ ];
28
+ function toIssueDisplayRow(issue) {
29
+ return { severity: issue.severity, rule: issue.rule, message: issue.message };
30
+ }
31
+ /**
32
+ * Updates an existing AT4DX Trigger Action Framework binding (`DomainProcessBinding__mdt`) in local DX
33
+ * source and/or a connected org — only the fields given change; everything else, including which
34
+ * SObject reference field the binding uses, is preserved from the found record.
35
+ */
36
+ export default class At4dxDomainProcessBindingSet extends SfCommand {
37
+ static summary = messages.getMessage('summary');
38
+ static description = messages.getMessage('description');
39
+ static examples = messages.getMessages('examples');
40
+ static flags = {
41
+ ...SfCommand.baseFlags,
42
+ 'source-dir': Flags.directory({
43
+ summary: messages.getMessage('flags.source-dir.summary'),
44
+ char: 'd',
45
+ exists: true,
46
+ multiple: true,
47
+ }),
48
+ 'target-org': Flags.optionalOrg({
49
+ summary: messages.getMessage('flags.target-org.summary'),
50
+ char: 'o',
51
+ }),
52
+ 'api-version': Flags.orgApiVersion(),
53
+ wait: Flags.string({ summary: messages.getMessage('flags.wait.summary'), default: '33' }),
54
+ 'developer-name': Flags.string({
55
+ summary: messages.getMessage('flags.developer-name.summary'),
56
+ char: 'n',
57
+ required: true,
58
+ }),
59
+ label: Flags.string({ summary: messages.getMessage('flags.label.summary') }),
60
+ sobject: Flags.string({ summary: messages.getMessage('flags.sobject.summary'), char: 's' }),
61
+ 'sobject-alternate': Flags.boolean({
62
+ summary: messages.getMessage('flags.sobject-alternate.summary'),
63
+ allowNo: true,
64
+ }),
65
+ 'process-context': Flags.custom({ options: ['TriggerExecution', 'DomainMethodExecution'] })({
66
+ summary: messages.getMessage('flags.process-context.summary'),
67
+ }),
68
+ 'trigger-operation': Flags.custom({ options: ALL_TRIGGER_OPERATIONS })({
69
+ summary: messages.getMessage('flags.trigger-operation.summary'),
70
+ }),
71
+ 'domain-method-token': Flags.string({ summary: messages.getMessage('flags.domain-method-token.summary') }),
72
+ type: Flags.custom({ options: ['Action', 'Criteria'] })({
73
+ summary: messages.getMessage('flags.type.summary'),
74
+ char: 't',
75
+ }),
76
+ 'class-to-inject': Flags.string({ summary: messages.getMessage('flags.class-to-inject.summary'), char: 'c' }),
77
+ order: Flags.string({ summary: messages.getMessage('flags.order.summary') }),
78
+ active: Flags.boolean({ summary: messages.getMessage('flags.active.summary'), allowNo: true }),
79
+ 'execute-asynchronous': Flags.boolean({
80
+ summary: messages.getMessage('flags.execute-asynchronous.summary'),
81
+ allowNo: true,
82
+ }),
83
+ 'logical-inverse': Flags.boolean({ summary: messages.getMessage('flags.logical-inverse.summary'), allowNo: true }),
84
+ 'prevent-recursive': Flags.boolean({
85
+ summary: messages.getMessage('flags.prevent-recursive.summary'),
86
+ allowNo: true,
87
+ }),
88
+ description: Flags.string({ summary: messages.getMessage('flags.description.summary') }),
89
+ force: Flags.boolean({ summary: messages.getMessage('flags.force.summary'), default: false }),
90
+ };
91
+ async run() {
92
+ const { flags } = await this.parse(At4dxDomainProcessBindingSet);
93
+ const sourceDirs = flags['source-dir'] ?? [];
94
+ const targetOrg = flags['target-org'];
95
+ if (sourceDirs.length === 0 && !targetOrg) {
96
+ throw messages.createError('error.sourceDirOrTargetOrgRequired');
97
+ }
98
+ let order;
99
+ if (flags.order !== undefined) {
100
+ order = Number(flags.order);
101
+ if (Number.isNaN(order)) {
102
+ throw messages.createError('error.invalidOrder', [flags.order]);
103
+ }
104
+ }
105
+ const connection = targetOrg?.getConnection(flags['api-version']);
106
+ try {
107
+ const result = await setDomainProcessBinding({
108
+ developerName: flags['developer-name'],
109
+ label: flags.label,
110
+ sobject: flags.sobject,
111
+ sobjectAlternate: flags['sobject-alternate'],
112
+ processContext: flags['process-context'],
113
+ triggerOperation: flags['trigger-operation'],
114
+ domainMethodToken: flags['domain-method-token'],
115
+ type: flags.type,
116
+ classToInject: flags['class-to-inject'],
117
+ order,
118
+ isActive: flags.active,
119
+ executeAsynchronous: flags['execute-asynchronous'],
120
+ logicalInverse: flags['logical-inverse'],
121
+ preventRecursive: flags['prevent-recursive'],
122
+ description: flags.description,
123
+ force: flags.force,
124
+ }, { sourceDirs, connection, wait: Duration.minutes(Number(flags.wait)) });
125
+ if (result.issues.length > 0) {
126
+ this.table({ data: result.issues.map(toIssueDisplayRow), columns: ISSUE_TABLE_COLUMNS });
127
+ }
128
+ this.info(messages.getMessage(result.filePath ? 'info.updated' : 'info.updatedInOrg', [result.developerName]));
129
+ if (result.deploy) {
130
+ this.info(messages.getMessage('info.deployed', [result.deploy.id]));
131
+ }
132
+ return result;
133
+ }
134
+ catch (error) {
135
+ throw toDomainProcessBindingCliError(error, messages, (issues) => {
136
+ this.table({ data: issues.map(toIssueDisplayRow), columns: ISSUE_TABLE_COLUMNS });
137
+ });
138
+ }
139
+ }
140
+ }
141
+ //# sourceMappingURL=set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set.js","sourceRoot":"","sources":["../../../../../../src/commands/simply/aep/at4dx/domain-process-binding/set.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GAMxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,8BAA8B,EAAE,MAAM,yDAAyD,CAAC;AAEz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AAE,mBAAmB,EAAE,CAAC,CAAC;YACpF,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { Messages } from '@salesforce/core';
2
+ import { type DomainProcessBindingIssue } from '@simplysf/simply-aep-core';
3
+ /**
4
+ * Maps a `DomainProcessBindingWriteError` thrown by `createDomainProcessBinding`/`setDomainProcessBinding`
5
+ * onto the calling command's own `error.*` message keys, shared by `create.ts`/`set.ts` since both throw
6
+ * the same error type for the same set of codes. `printIssues` is called before returning the
7
+ * `validation-failed` error, since that's the one code carrying data (`issues`) worth showing the user
8
+ * beyond the error message itself.
9
+ *
10
+ * @param error - Whatever `createDomainProcessBinding`/`setDomainProcessBinding` rejected with.
11
+ * @param messages - The calling command's own loaded message catalog.
12
+ * @param printIssues - Renders a validation issue table (the command's own `this.table`-based printer).
13
+ * @returns An `Error` ready to throw from the command's `run()` — an `SfError` built from a message key when `error` is a recognized `DomainProcessBindingWriteError`, or `error` itself (coerced to `Error`) otherwise.
14
+ */
15
+ export declare function toDomainProcessBindingCliError(error: unknown, messages: Messages<string>, printIssues: (issues: DomainProcessBindingIssue[]) => void): Error;
@@ -0,0 +1,59 @@
1
+ /*
2
+ * Copyright (c) 2026, Clay Chipps.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { DomainProcessBindingWriteError } from '@simplysf/simply-aep-core';
17
+ /**
18
+ * Maps a `DomainProcessBindingWriteError` thrown by `createDomainProcessBinding`/`setDomainProcessBinding`
19
+ * onto the calling command's own `error.*` message keys, shared by `create.ts`/`set.ts` since both throw
20
+ * the same error type for the same set of codes. `printIssues` is called before returning the
21
+ * `validation-failed` error, since that's the one code carrying data (`issues`) worth showing the user
22
+ * beyond the error message itself.
23
+ *
24
+ * @param error - Whatever `createDomainProcessBinding`/`setDomainProcessBinding` rejected with.
25
+ * @param messages - The calling command's own loaded message catalog.
26
+ * @param printIssues - Renders a validation issue table (the command's own `this.table`-based printer).
27
+ * @returns An `Error` ready to throw from the command's `run()` — an `SfError` built from a message key when `error` is a recognized `DomainProcessBindingWriteError`, or `error` itself (coerced to `Error`) otherwise.
28
+ */
29
+ export function toDomainProcessBindingCliError(error, messages, printIssues) {
30
+ if (!(error instanceof DomainProcessBindingWriteError)) {
31
+ return error instanceof Error ? error : new Error(String(error));
32
+ }
33
+ switch (error.code) {
34
+ case 'source-or-target-required':
35
+ return messages.createError('error.sourceDirOrTargetOrgRequired');
36
+ case 'context-field-mismatch':
37
+ return messages.createError('error.contextFieldMismatch', [error.message]);
38
+ case 'invalid-developer-name':
39
+ return messages.createError('error.invalidDeveloperName', [error.message]);
40
+ case 'label-too-long':
41
+ return messages.createError('error.labelTooLong', [error.message]);
42
+ case 'developer-name-already-exists':
43
+ return messages.createError('error.developerNameAlreadyExists', [error.message]);
44
+ case 'developer-name-not-found':
45
+ return messages.createError('error.developerNameNotFound', [error.message]);
46
+ case 'no-fields-to-update':
47
+ return messages.createError('error.noFieldsToUpdate');
48
+ case 'at4dx-not-detected':
49
+ return messages.createError('error.at4dxNotDetected');
50
+ case 'validation-failed':
51
+ printIssues(error.issues ?? []);
52
+ return messages.createError('error.validationFailed');
53
+ case 'deploy-failed':
54
+ return messages.createError('error.deployFailed', [error.message]);
55
+ default:
56
+ return error;
57
+ }
58
+ }
59
+ //# sourceMappingURL=domainProcessBindingWriteError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domainProcessBindingWriteError.js","sourceRoot":"","sources":["../../src/common/domainProcessBindingWriteError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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B;YACtB,WAAW,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;YAChC,OAAO,QAAQ,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;QACxD,KAAK,eAAe;YAClB,OAAO,QAAQ,CAAC,WAAW,CAAC,oBAAoB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACrE;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
@@ -0,0 +1,159 @@
1
+ # summary
2
+
3
+ Create a new AT4DX Trigger Action Framework binding (DomainProcessBinding__mdt) in local source and/or a connected org.
4
+
5
+ # description
6
+
7
+ Generates a `DomainProcessBinding.<DeveloperName>.md-meta.xml` file from the given flags and writes it under --source-dir, deploys it to --target-org, or both. Validates the resulting binding — alongside everything else already in scope — with the same rules `simply aep at4dx domain-process-binding validate` uses, and refuses to write if that introduces an error-severity issue unless --force is passed. At least one of --source-dir/--target-org is required; unlike `list`/`validate`, both may be given at once (write to source and deploy it live in the same run). Given --target-org alone, the file is written to a temporary directory, deployed, and discarded — no working-tree footprint.
8
+
9
+ Writes RelatedDomainBindingSObject__c by default. Pass --sobject-alternate to write RelatedDomainBindingSObjectAlternate__c instead, for a SObject (such as ServiceResource and other Setup objects) that can't be referenced through an EntityDefinition field at all.
10
+
11
+ # flags.source-dir.summary
12
+
13
+ The package directory to create customMetadata/DomainProcessBinding.<name>.md-meta.xml under. Created if the customMetadata folder doesn't exist yet.
14
+
15
+ # flags.target-org.summary
16
+
17
+ Deploy the generated binding to this org after writing it.
18
+
19
+ # flags.wait.summary
20
+
21
+ Deploy poll timeout, in minutes. Only meaningful with --target-org.
22
+
23
+ # flags.developer-name.summary
24
+
25
+ The binding's DeveloperName. Must start with a letter, contain only letters, numbers, and single underscores, not end with an underscore, and be 40 characters or fewer.
26
+
27
+ # flags.label.summary
28
+
29
+ The binding's label. Defaults to --developer-name. Must be 40 characters or fewer.
30
+
31
+ # flags.sobject.summary
32
+
33
+ The SObject API name to bind against.
34
+
35
+ # flags.sobject-alternate.summary
36
+
37
+ Write --sobject to RelatedDomainBindingSObjectAlternate__c instead of RelatedDomainBindingSObject__c. Use this for a SObject that can't be referenced through an EntityDefinition field at all (for example ServiceResource and other Setup objects).
38
+
39
+ # flags.process-context.summary
40
+
41
+ What kind of process invokes this binding: TriggerExecution or DomainMethodExecution.
42
+
43
+ # flags.trigger-operation.summary
44
+
45
+ The trigger event this binding fires on. Required, and only allowed, when --process-context is TriggerExecution.
46
+
47
+ # flags.domain-method-token.summary
48
+
49
+ The domain method's process token this binding matches. Required, and only allowed, when --process-context is DomainMethodExecution.
50
+
51
+ # flags.type.summary
52
+
53
+ Whether this binding contributes a Criteria filter or an Action.
54
+
55
+ # flags.class-to-inject.summary
56
+
57
+ The Apex class this binding wires in.
58
+
59
+ # flags.order.summary
60
+
61
+ OrderOfExecution__c. Numeric; decimals are allowed.
62
+
63
+ # flags.active.summary
64
+
65
+ IsActive__c.
66
+
67
+ # flags.execute-asynchronous.summary
68
+
69
+ ExecuteAsynchronous__c.
70
+
71
+ # flags.logical-inverse.summary
72
+
73
+ LogicalInverse__c.
74
+
75
+ # flags.prevent-recursive.summary
76
+
77
+ PreventRecursive__c.
78
+
79
+ # flags.description.summary
80
+
81
+ Description__c.
82
+
83
+ # flags.force.summary
84
+
85
+ Write (and deploy) even if validation finds an error-severity issue. Validation still runs and its issues are still printed and returned.
86
+
87
+ # examples
88
+
89
+ - <%= config.bin %> <%= command.id %> --source-dir sfdx-source/core --developer-name Account_Before_Insert_Assign_Owner --sobject Account --process-context TriggerExecution --trigger-operation Before_Insert --type Action --class-to-inject AccountAssignOwnerAction --order 10
90
+
91
+ - <%= config.bin %> <%= command.id %> --target-org myOrg --developer-name Account_Before_Insert_Assign_Owner --sobject Account --process-context TriggerExecution --trigger-operation Before_Insert --type Action --class-to-inject AccountAssignOwnerAction --order 10
92
+
93
+ - <%= config.bin %> <%= command.id %> --source-dir sfdx-source/core --target-org myOrg --developer-name Account_Before_Insert_Assign_Owner --sobject Account --process-context TriggerExecution --trigger-operation Before_Insert --type Action --class-to-inject AccountAssignOwnerAction --order 10
94
+
95
+ - <%= config.bin %> <%= command.id %> --source-dir sfdx-source/core --developer-name ServiceResource_Before_Update_Sync --sobject ServiceResource --sobject-alternate --process-context TriggerExecution --trigger-operation Before_Update --type Action --class-to-inject ServiceResourceSyncAction --order 10
96
+
97
+ # error.sourceDirOrTargetOrgRequired
98
+
99
+ You must specify at least one of --source-dir or --target-org.
100
+
101
+ # error.triggerOperationRequired
102
+
103
+ --trigger-operation is required when --process-context is TriggerExecution.
104
+
105
+ # error.domainMethodTokenRequired
106
+
107
+ --domain-method-token is required when --process-context is DomainMethodExecution.
108
+
109
+ # error.invalidOrder
110
+
111
+ "%s" is not a valid --order: it must be a number.
112
+
113
+ # error.contextFieldMismatch
114
+
115
+ %s
116
+
117
+ # error.invalidDeveloperName
118
+
119
+ %s
120
+
121
+ # error.labelTooLong
122
+
123
+ %s
124
+
125
+ # error.developerNameAlreadyExists
126
+
127
+ %s
128
+
129
+ # error.developerNameNotFound
130
+
131
+ %s
132
+
133
+ # error.noFieldsToUpdate
134
+
135
+ At least one field besides --developer-name must be given to update.
136
+
137
+ # error.at4dxNotDetected
138
+
139
+ AT4DX's Trigger Action Framework doesn't appear to be present in this org: the DomainProcessBinding__mdt Custom Metadata Type wasn't found.
140
+
141
+ # error.validationFailed
142
+
143
+ Writing this binding would introduce a wiring problem AT4DX validation already knows how to catch. Pass --force to write anyway.
144
+
145
+ # error.deployFailed
146
+
147
+ %s
148
+
149
+ # info.created
150
+
151
+ Created %s
152
+
153
+ # info.createdInOrg
154
+
155
+ Created %s in the org
156
+
157
+ # info.deployed
158
+
159
+ Deployed (id: %s)
@@ -0,0 +1,149 @@
1
+ # summary
2
+
3
+ Update an existing AT4DX Trigger Action Framework binding (DomainProcessBinding__mdt) in local source and/or a connected org.
4
+
5
+ # description
6
+
7
+ Finds the binding named --developer-name in local source and/or a connected org, applies only the fields given as flags — everything else, including which SObject reference field the binding uses, is preserved from the found record — and rewrites the `DomainProcessBinding.<DeveloperName>.md-meta.xml` file. Validates the resulting binding — alongside everything else already in scope — with the same rules `simply aep at4dx domain-process-binding validate` uses, and refuses to write if that introduces an error-severity issue unless --force is passed.
8
+
9
+ When --source-dir is given, the binding is located there (searched across every directory given, same as `list`/`validate`) and that exact file is rewritten; the found file is also deployed if --target-org is given. When only --target-org is given, the binding is located and updated directly in the org via a temporary file, deployed, then discarded — no working-tree footprint.
10
+
11
+ --developer-name identifies the binding to update and can't itself be changed by this command.
12
+
13
+ # flags.source-dir.summary
14
+
15
+ One or more paths to directories containing Salesforce DX source, searched for the binding to update.
16
+
17
+ # flags.target-org.summary
18
+
19
+ Locate (when --source-dir isn't given) and/or deploy the binding to this org.
20
+
21
+ # flags.wait.summary
22
+
23
+ Deploy poll timeout, in minutes. Only meaningful with --target-org.
24
+
25
+ # flags.developer-name.summary
26
+
27
+ The DeveloperName of the binding to update.
28
+
29
+ # flags.label.summary
30
+
31
+ The binding's label. If not given, the existing label is kept.
32
+
33
+ # flags.sobject.summary
34
+
35
+ The SObject API name to bind against. If not given, the existing value is kept.
36
+
37
+ # flags.sobject-alternate.summary
38
+
39
+ Write --sobject to RelatedDomainBindingSObjectAlternate__c instead of RelatedDomainBindingSObject__c, for a SObject that can't be referenced through an EntityDefinition field at all (for example ServiceResource and other Setup objects). If not given, the binding keeps whichever field it already uses — this flag only needs to be passed to change it.
40
+
41
+ # flags.process-context.summary
42
+
43
+ What kind of process invokes this binding: TriggerExecution or DomainMethodExecution. If not given, the existing value is kept.
44
+
45
+ # flags.trigger-operation.summary
46
+
47
+ The trigger event this binding fires on. If you change --process-context to TriggerExecution, pass this too.
48
+
49
+ # flags.domain-method-token.summary
50
+
51
+ The domain method's process token this binding matches. If you change --process-context to DomainMethodExecution, pass this too.
52
+
53
+ # flags.type.summary
54
+
55
+ Whether this binding contributes a Criteria filter or an Action. If not given, the existing value is kept.
56
+
57
+ # flags.class-to-inject.summary
58
+
59
+ The Apex class this binding wires in. If not given, the existing value is kept.
60
+
61
+ # flags.order.summary
62
+
63
+ OrderOfExecution__c. Numeric; decimals are allowed. If not given, the existing value is kept.
64
+
65
+ # flags.active.summary
66
+
67
+ IsActive__c. If not given, the existing value is kept.
68
+
69
+ # flags.execute-asynchronous.summary
70
+
71
+ ExecuteAsynchronous__c. If not given, the existing value is kept.
72
+
73
+ # flags.logical-inverse.summary
74
+
75
+ LogicalInverse__c. If not given, the existing value is kept.
76
+
77
+ # flags.prevent-recursive.summary
78
+
79
+ PreventRecursive__c. If not given, the existing value is kept.
80
+
81
+ # flags.description.summary
82
+
83
+ Description__c. If not given, the existing value is kept.
84
+
85
+ # flags.force.summary
86
+
87
+ Write (and deploy) even if validation finds an error-severity issue. Validation still runs and its issues are still printed and returned.
88
+
89
+ # examples
90
+
91
+ - <%= config.bin %> <%= command.id %> --source-dir sfdx-source/core --source-dir sfdx-source/app --developer-name Account_Before_Insert_Assign_Owner --order 20 --no-active
92
+
93
+ - <%= config.bin %> <%= command.id %> --target-org myOrg --developer-name Account_Before_Insert_Assign_Owner --class-to-inject AccountAssignOwnerActionV2
94
+
95
+ # error.sourceDirOrTargetOrgRequired
96
+
97
+ You must specify at least one of --source-dir or --target-org.
98
+
99
+ # error.invalidOrder
100
+
101
+ "%s" is not a valid --order: it must be a number.
102
+
103
+ # error.contextFieldMismatch
104
+
105
+ %s
106
+
107
+ # error.invalidDeveloperName
108
+
109
+ %s
110
+
111
+ # error.labelTooLong
112
+
113
+ %s
114
+
115
+ # error.developerNameAlreadyExists
116
+
117
+ %s
118
+
119
+ # error.developerNameNotFound
120
+
121
+ %s
122
+
123
+ # error.noFieldsToUpdate
124
+
125
+ At least one field besides --developer-name must be given to update.
126
+
127
+ # error.at4dxNotDetected
128
+
129
+ AT4DX's Trigger Action Framework doesn't appear to be present in this source or org: the DomainProcessBinding__mdt Custom Metadata Type wasn't found.
130
+
131
+ # error.validationFailed
132
+
133
+ Writing this binding would introduce a wiring problem AT4DX validation already knows how to catch. Pass --force to write anyway.
134
+
135
+ # error.deployFailed
136
+
137
+ %s
138
+
139
+ # info.updated
140
+
141
+ Updated %s
142
+
143
+ # info.updatedInOrg
144
+
145
+ Updated %s in the org
146
+
147
+ # info.deployed
148
+
149
+ Deployed (id: %s)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simplysf/simply-aep",
3
3
  "description": "Commands for Apex Enterprise Patterns tooling (fflib, force-di, AT4DX)",
4
- "version": "0.5.1",
4
+ "version": "0.6.0",
5
5
  "author": "@ClayChipps",
6
6
  "homepage": "https://github.com/SimplySF/simply-node",
7
7
  "bugs": "https://github.com/SimplySF/simply-node/issues",
@@ -58,13 +58,15 @@
58
58
  "dependencies": {
59
59
  "@oclif/core": "^4.11.2",
60
60
  "@salesforce/core": "^8.30.0",
61
+ "@salesforce/kit": "^3.2.6",
61
62
  "@salesforce/sf-plugins-core": "^12.2.16",
62
- "@simplysf/simply-aep-core": "^0.4.0",
63
+ "@simplysf/simply-aep-core": "^0.5.0",
63
64
  "@simplysf/simply-core": "^1.4.0"
64
65
  },
65
66
  "devDependencies": {
66
67
  "@oclif/plugin-command-snapshot": "^5.3.19",
67
68
  "@salesforce/plugin-command-reference": "^3.1.99",
69
+ "@salesforce/source-deploy-retrieve": "^12.37.2",
68
70
  "@vitest/coverage-v8": "^4.1.10",
69
71
  "vitest": "^4.1.10"
70
72
  },
@@ -206,5 +208,5 @@
206
208
  "output": []
207
209
  }
208
210
  },
209
- "gitHead": "d14043949bc320a0740f710c6716407b3e92871e"
211
+ "gitHead": "885986e2736aba9ff318431e08064890b2946b03"
210
212
  }