@simplysf/simply-aep 0.2.0 → 0.3.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.
- package/README.md +48 -1
- package/lib/commands/simply/aep/at4dx/domain-process-binding/list.d.ts +22 -0
- package/lib/commands/simply/aep/at4dx/domain-process-binding/list.js +131 -0
- package/lib/commands/simply/aep/at4dx/domain-process-binding/list.js.map +1 -0
- package/lib/common/at4dxDomainProcessBindingTypes.d.ts +55 -0
- package/lib/common/at4dxDomainProcessBindingTypes.js +29 -0
- package/lib/common/at4dxDomainProcessBindingTypes.js.map +1 -0
- package/lib/common/at4dxDomainProcessLocalScan.d.ts +15 -0
- package/lib/common/at4dxDomainProcessLocalScan.js +95 -0
- package/lib/common/at4dxDomainProcessLocalScan.js.map +1 -0
- package/lib/common/at4dxDomainProcessOrgScan.d.ts +16 -0
- package/lib/common/at4dxDomainProcessOrgScan.js +78 -0
- package/lib/common/at4dxDomainProcessOrgScan.js.map +1 -0
- package/lib/common/at4dxDomainProcessResolve.d.ts +17 -0
- package/lib/common/at4dxDomainProcessResolve.js +70 -0
- package/lib/common/at4dxDomainProcessResolve.js.map +1 -0
- package/lib/common/at4dxLocalScan.js +2 -18
- package/lib/common/at4dxLocalScan.js.map +1 -1
- package/lib/common/customMetadataXml.d.ts +21 -0
- package/lib/common/customMetadataXml.js +41 -0
- package/lib/common/customMetadataXml.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/messages/simply.aep.at4dx.domain-process-binding.list.md +63 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@ This package is part of the [`@simplysf/simply`](https://github.com/SimplySF/sim
|
|
|
23
23
|
<!-- commands -->
|
|
24
24
|
|
|
25
25
|
- [`sf simply aep at4dx binding list`](#sf-simply-aep-at4dx-binding-list)
|
|
26
|
+
- [`sf simply aep at4dx domain-process-binding list`](#sf-simply-aep-at4dx-domain-process-binding-list)
|
|
26
27
|
|
|
27
28
|
## `sf simply aep at4dx binding list`
|
|
28
29
|
|
|
@@ -78,5 +79,51 @@ FLAG DESCRIPTIONS
|
|
|
78
79
|
Comma-separated list of binding types to include. If not specified, all four are included.
|
|
79
80
|
```
|
|
80
81
|
|
|
81
|
-
_See code: [lib/commands/simply/aep/at4dx/binding/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
82
|
+
_See code: [lib/commands/simply/aep/at4dx/binding/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.3.0/packages/simply-aep/lib/commands/simply/aep/at4dx/binding/list.js)_
|
|
83
|
+
|
|
84
|
+
## `sf simply aep at4dx domain-process-binding list`
|
|
85
|
+
|
|
86
|
+
List the AT4DX Trigger Action Framework bindings configured in an org or local source, in execution order.
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
USAGE
|
|
90
|
+
$ sf simply aep at4dx domain-process-binding list [--json] [--flags-dir <value>] [-o <value>] [--api-version <value>] [-d <value>...] [-s
|
|
91
|
+
<value>...] [--active-only]
|
|
92
|
+
|
|
93
|
+
FLAGS
|
|
94
|
+
-d, --source-dir=<value>... One or more paths to directories containing Salesforce DX source. Use this for
|
|
95
|
+
local-source discovery.
|
|
96
|
+
-o, --target-org=<value> Username or alias of the org to read bindings from. Use this for live-org discovery.
|
|
97
|
+
-s, --sobject=<value>... SObject API name(s) to filter to. If not specified, bindings for every SObject are
|
|
98
|
+
included.
|
|
99
|
+
--active-only Only show active bindings; hide inactive records.
|
|
100
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
101
|
+
|
|
102
|
+
GLOBAL FLAGS
|
|
103
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
104
|
+
--json Format output as json.
|
|
105
|
+
|
|
106
|
+
DESCRIPTION
|
|
107
|
+
List the AT4DX Trigger Action Framework bindings configured in an org or local source, in execution order.
|
|
108
|
+
|
|
109
|
+
Reads AT4DX's Trigger Action Framework Custom Metadata Type — `DomainProcessBinding__mdt` — either from a live org or
|
|
110
|
+
from local Salesforce DX source, showing which criteria/action classes are bound to each SObject's trigger events (or
|
|
111
|
+
domain method tokens), and the order they run in. Exactly one of `--target-org` or `--source-dir` must be specified.
|
|
112
|
+
|
|
113
|
+
Unlike `simply aep at4dx binding list`, there's no "winner" here — every active record in a group (same SObject,
|
|
114
|
+
process context, and trigger operation or domain method token) runs, in `OrderOfExecution__c` order. Two active
|
|
115
|
+
records sharing the same order within a group are flagged as a collision, since AT4DX doesn't guarantee which one runs
|
|
116
|
+
first in that case.
|
|
117
|
+
|
|
118
|
+
EXAMPLES
|
|
119
|
+
$ sf simply aep at4dx domain-process-binding list --target-org myOrg
|
|
120
|
+
|
|
121
|
+
$ sf simply aep at4dx domain-process-binding list --source-dir sfdx-source/core --source-dir sfdx-source/app
|
|
122
|
+
|
|
123
|
+
$ sf simply aep at4dx domain-process-binding list --target-org myOrg --sobject Account
|
|
124
|
+
|
|
125
|
+
$ sf simply aep at4dx domain-process-binding list --target-org myOrg --active-only --json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
_See code: [lib/commands/simply/aep/at4dx/domain-process-binding/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.3.0/packages/simply-aep/lib/commands/simply/aep/at4dx/domain-process-binding/list.js)_
|
|
82
129
|
<!-- commandsstop -->
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { type At4dxDomainProcessBindingListResult } from '../../../../../common/at4dxDomainProcessBindingTypes.js';
|
|
3
|
+
/**
|
|
4
|
+
* Lists the AT4DX Trigger Action Framework bindings (`DomainProcessBinding__mdt`) configured in a
|
|
5
|
+
* target org or local DX source — the criteria/action classes bound to each SObject's trigger events
|
|
6
|
+
* (or domain method tokens), in execution order.
|
|
7
|
+
*/
|
|
8
|
+
export default class At4dxDomainProcessBindingList extends SfCommand<At4dxDomainProcessBindingListResult> {
|
|
9
|
+
static readonly summary: string;
|
|
10
|
+
static readonly description: string;
|
|
11
|
+
static readonly examples: string[];
|
|
12
|
+
static readonly flags: {
|
|
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
|
+
'source-dir': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
sobject: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
'active-only': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
};
|
|
20
|
+
/** @returns The resolved Trigger Action Framework bindings for the requested source, optionally filtered to specific SObjects. */
|
|
21
|
+
run(): Promise<At4dxDomainProcessBindingListResult>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
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 { Messages } from '@salesforce/core';
|
|
17
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { scanLocalDomainProcessBindings } from '../../../../../common/at4dxDomainProcessLocalScan.js';
|
|
19
|
+
import { scanOrgDomainProcessBindings } from '../../../../../common/at4dxDomainProcessOrgScan.js';
|
|
20
|
+
import { resolveDomainProcessBindings } from '../../../../../common/at4dxDomainProcessResolve.js';
|
|
21
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
22
|
+
const messages = Messages.loadMessages('@simplysf/simply-aep', 'simply.aep.at4dx.domain-process-binding.list');
|
|
23
|
+
function toDisplayRow(row) {
|
|
24
|
+
return {
|
|
25
|
+
sobject: row.sobject,
|
|
26
|
+
context: row.triggerOperation?.replace(/_/g, ' ') ?? row.domainMethodToken ?? '',
|
|
27
|
+
type: row.type,
|
|
28
|
+
order: row.orderCollision ? `${row.order} (collision)` : String(row.order),
|
|
29
|
+
class: row.classToInject,
|
|
30
|
+
active: String(row.isActive),
|
|
31
|
+
async: String(row.executeAsynchronous),
|
|
32
|
+
source: row.source,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Lists the AT4DX Trigger Action Framework bindings (`DomainProcessBinding__mdt`) configured in a
|
|
37
|
+
* target org or local DX source — the criteria/action classes bound to each SObject's trigger events
|
|
38
|
+
* (or domain method tokens), in execution order.
|
|
39
|
+
*/
|
|
40
|
+
export default class At4dxDomainProcessBindingList extends SfCommand {
|
|
41
|
+
static summary = messages.getMessage('summary');
|
|
42
|
+
static description = messages.getMessage('description');
|
|
43
|
+
static examples = messages.getMessages('examples');
|
|
44
|
+
static flags = {
|
|
45
|
+
...SfCommand.baseFlags,
|
|
46
|
+
'target-org': Flags.optionalOrg({
|
|
47
|
+
summary: messages.getMessage('flags.target-org.summary'),
|
|
48
|
+
char: 'o',
|
|
49
|
+
}),
|
|
50
|
+
'api-version': Flags.orgApiVersion(),
|
|
51
|
+
'source-dir': Flags.directory({
|
|
52
|
+
summary: messages.getMessage('flags.source-dir.summary'),
|
|
53
|
+
char: 'd',
|
|
54
|
+
exists: true,
|
|
55
|
+
multiple: true,
|
|
56
|
+
}),
|
|
57
|
+
sobject: Flags.string({
|
|
58
|
+
summary: messages.getMessage('flags.sobject.summary'),
|
|
59
|
+
char: 's',
|
|
60
|
+
multiple: true,
|
|
61
|
+
}),
|
|
62
|
+
'active-only': Flags.boolean({
|
|
63
|
+
summary: messages.getMessage('flags.active-only.summary'),
|
|
64
|
+
default: false,
|
|
65
|
+
}),
|
|
66
|
+
};
|
|
67
|
+
/** @returns The resolved Trigger Action Framework bindings for the requested source, optionally filtered to specific SObjects. */
|
|
68
|
+
async run() {
|
|
69
|
+
const { flags } = await this.parse(At4dxDomainProcessBindingList);
|
|
70
|
+
const targetOrg = flags['target-org'];
|
|
71
|
+
const sourceDirs = flags['source-dir'] ?? [];
|
|
72
|
+
if ((targetOrg && sourceDirs.length > 0) || (!targetOrg && sourceDirs.length === 0)) {
|
|
73
|
+
throw messages.createError('error.targetOrgOrSourceDirRequired');
|
|
74
|
+
}
|
|
75
|
+
const sobjectFilter = flags.sobject?.length ? new Set(flags.sobject) : undefined;
|
|
76
|
+
let source;
|
|
77
|
+
let records;
|
|
78
|
+
if (targetOrg) {
|
|
79
|
+
const connection = targetOrg.getConnection(flags['api-version']);
|
|
80
|
+
source = targetOrg.getUsername() ?? 'org';
|
|
81
|
+
this.spinner.start(messages.getMessage('info.queryingOrg', [source]));
|
|
82
|
+
let scanResult;
|
|
83
|
+
try {
|
|
84
|
+
scanResult = await scanOrgDomainProcessBindings(connection);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
this.spinner.stop();
|
|
88
|
+
throw messages.createError('error.orgQueryFailed', [error.message]);
|
|
89
|
+
}
|
|
90
|
+
this.spinner.stop();
|
|
91
|
+
if (scanResult.missing) {
|
|
92
|
+
throw messages.createError('error.at4dxNotDetected');
|
|
93
|
+
}
|
|
94
|
+
records = scanResult.records;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
source = 'local';
|
|
98
|
+
this.spinner.start(messages.getMessage('info.scanningLocalSource'));
|
|
99
|
+
try {
|
|
100
|
+
records = scanLocalDomainProcessBindings(sourceDirs);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
this.spinner.stop();
|
|
104
|
+
throw messages.createError('error.localScanFailed', [error.message]);
|
|
105
|
+
}
|
|
106
|
+
this.spinner.stop();
|
|
107
|
+
if (records.length === 0) {
|
|
108
|
+
throw messages.createError('error.at4dxNotDetected');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const filteredRecords = sobjectFilter ? records.filter((record) => sobjectFilter.has(record.sobject)) : records;
|
|
112
|
+
const resolvedRows = resolveDomainProcessBindings(filteredRecords);
|
|
113
|
+
const bindings = flags['active-only'] ? resolvedRows.filter((row) => row.isActive) : resolvedRows;
|
|
114
|
+
this.table({
|
|
115
|
+
data: bindings.map(toDisplayRow),
|
|
116
|
+
columns: [
|
|
117
|
+
{ key: 'sobject', name: 'SOBJECT' },
|
|
118
|
+
{ key: 'context', name: 'CONTEXT' },
|
|
119
|
+
{ key: 'type', name: 'TYPE' },
|
|
120
|
+
{ key: 'order', name: 'ORDER' },
|
|
121
|
+
{ key: 'class', name: 'CLASS' },
|
|
122
|
+
{ key: 'active', name: 'ACTIVE' },
|
|
123
|
+
{ key: 'async', name: 'ASYNC' },
|
|
124
|
+
{ key: 'source', name: 'SOURCE' },
|
|
125
|
+
],
|
|
126
|
+
});
|
|
127
|
+
this.info(messages.getMessage('info.complete', [bindings.length, source]));
|
|
128
|
+
return { source, bindings };
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../../../src/commands/simply/aep/at4dx/domain-process-binding/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EA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,EAAE,QAAQ,EAAE;gBACjC,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE;gBAC/B,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;aAClC;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QAE3E,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAC9B,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** Whether a `DomainProcessBinding__mdt` record contributes a criteria filter or an action. */
|
|
2
|
+
export type DomainProcessType = 'Action' | 'Criteria';
|
|
3
|
+
/** What kind of process invokes this binding: a trigger event, or a domain method's explicit process token. */
|
|
4
|
+
export type ProcessContext = 'TriggerExecution' | 'DomainMethodExecution';
|
|
5
|
+
/** `TriggerOperation__c`'s picklist values, meaningful only when `processContext` is `TriggerExecution`. */
|
|
6
|
+
export type TriggerOperation = 'Before_Insert' | 'After_Insert' | 'Before_Update' | 'After_Update' | 'Before_Delete' | 'After_Delete' | 'After_Undelete';
|
|
7
|
+
export declare const ALL_TRIGGER_OPERATIONS: TriggerOperation[];
|
|
8
|
+
/** The Custom Metadata Type API name AT4DX's Trigger Action Framework stores its bindings in. */
|
|
9
|
+
export declare const DOMAIN_PROCESS_BINDING_OBJECT = "DomainProcessBinding__mdt";
|
|
10
|
+
/** The local-source component object name for `DomainProcessBinding__mdt` records — the CMDT API name without its `__mdt` suffix. */
|
|
11
|
+
export declare const DOMAIN_PROCESS_BINDING_LOCAL_OBJECT_NAME = "DomainProcessBinding";
|
|
12
|
+
/**
|
|
13
|
+
* One `DomainProcessBinding__mdt` record, normalized from either an org query or local source.
|
|
14
|
+
*
|
|
15
|
+
* Unlike `RawBindingRecord` (Application Factory bindings), there's no interface/SObject "key" a
|
|
16
|
+
* record resolves for and no priority-based winner — every active record actually runs, ordered by
|
|
17
|
+
* `order`. `sobject` is `undefined` only for a malformed record with neither
|
|
18
|
+
* `RelatedDomainBindingSObject__c` nor `RelatedDomainBindingSObjectAlternate__c` set; such records
|
|
19
|
+
* are dropped by the scanners rather than surfaced with a missing SObject.
|
|
20
|
+
*/
|
|
21
|
+
export type RawDomainProcessBindingRecord = {
|
|
22
|
+
developerName: string;
|
|
23
|
+
sobject: string;
|
|
24
|
+
processContext: ProcessContext;
|
|
25
|
+
/** `TriggerOperation__c`. Present when `processContext` is `TriggerExecution`. */
|
|
26
|
+
triggerOperation?: TriggerOperation;
|
|
27
|
+
/** `DomainMethodToken__c`. Present when `processContext` is `DomainMethodExecution`. */
|
|
28
|
+
domainMethodToken?: string;
|
|
29
|
+
type: DomainProcessType;
|
|
30
|
+
classToInject: string;
|
|
31
|
+
/** `OrderOfExecution__c`. */
|
|
32
|
+
order: number;
|
|
33
|
+
isActive: boolean;
|
|
34
|
+
executeAsynchronous: boolean;
|
|
35
|
+
logicalInverse: boolean;
|
|
36
|
+
preventRecursive: boolean;
|
|
37
|
+
description?: string;
|
|
38
|
+
/** Local package directory name, or the org username when read from `--target-org`. */
|
|
39
|
+
source: string;
|
|
40
|
+
};
|
|
41
|
+
/** A `RawDomainProcessBindingRecord` annotated with the resolution outcome `resolveDomainProcessBindings` computed for it. */
|
|
42
|
+
export type DomainProcessBindingRow = RawDomainProcessBindingRecord & {
|
|
43
|
+
/**
|
|
44
|
+
* `true` when more than one *active* record in the same group (same `sobject`, `processContext`,
|
|
45
|
+
* and `triggerOperation`/`domainMethodToken`) shares this record's `order` — AT4DX's Custom
|
|
46
|
+
* Metadata query has no `ORDER BY` tiebreak for equal `OrderOfExecution__c` values, so which one
|
|
47
|
+
* actually runs first isn't something this command can determine, the same "flag it, don't guess"
|
|
48
|
+
* precedent `at4dxResolve.ts` applies to ambiguous Domain bindings.
|
|
49
|
+
*/
|
|
50
|
+
orderCollision?: boolean;
|
|
51
|
+
};
|
|
52
|
+
export type At4dxDomainProcessBindingListResult = {
|
|
53
|
+
source: string;
|
|
54
|
+
bindings: DomainProcessBindingRow[];
|
|
55
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
export const ALL_TRIGGER_OPERATIONS = [
|
|
17
|
+
'Before_Insert',
|
|
18
|
+
'After_Insert',
|
|
19
|
+
'Before_Update',
|
|
20
|
+
'After_Update',
|
|
21
|
+
'Before_Delete',
|
|
22
|
+
'After_Delete',
|
|
23
|
+
'After_Undelete',
|
|
24
|
+
];
|
|
25
|
+
/** The Custom Metadata Type API name AT4DX's Trigger Action Framework stores its bindings in. */
|
|
26
|
+
export const DOMAIN_PROCESS_BINDING_OBJECT = 'DomainProcessBinding__mdt';
|
|
27
|
+
/** The local-source component object name for `DomainProcessBinding__mdt` records — the CMDT API name without its `__mdt` suffix. */
|
|
28
|
+
export const DOMAIN_PROCESS_BINDING_LOCAL_OBJECT_NAME = 'DomainProcessBinding';
|
|
29
|
+
//# sourceMappingURL=at4dxDomainProcessBindingTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"at4dxDomainProcessBindingTypes.js","sourceRoot":"","sources":["../../src/common/at4dxDomainProcessBindingTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAkBH,MAAM,CAAC,MAAM,sBAAsB,GAAuB;IACxD,eAAe;IACf,cAAc;IACd,eAAe;IACf,cAAc;IACd,eAAe;IACf,cAAc;IACd,gBAAgB;CACjB,CAAC;AAEF,iGAAiG;AACjG,MAAM,CAAC,MAAM,6BAA6B,GAAG,2BAA2B,CAAC;AAEzE,qIAAqI;AACrI,MAAM,CAAC,MAAM,wCAAwC,GAAG,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type RawDomainProcessBindingRecord } from './at4dxDomainProcessBindingTypes.js';
|
|
2
|
+
/**
|
|
3
|
+
* Scan local Salesforce DX source directories for AT4DX `DomainProcessBinding__mdt` records, parsing
|
|
4
|
+
* each `CustomMetadata` component's `<values>` pairs directly — the same approach `at4dxLocalScan.ts`
|
|
5
|
+
* uses for Application Factory bindings.
|
|
6
|
+
*
|
|
7
|
+
* Unlike an org (see `at4dxDomainProcessOrgScan.ts`), local source gives no signal for "this Custom
|
|
8
|
+
* Metadata Type doesn't exist" independent of "zero records exist for it" — a missing
|
|
9
|
+
* `customMetadata` folder and an empty one look identical to `ComponentSet.fromSource`. Callers treat
|
|
10
|
+
* an empty result as "AT4DX's Trigger Action Framework isn't configured here."
|
|
11
|
+
*
|
|
12
|
+
* @param sourceDirs - The source directories to scan.
|
|
13
|
+
* @returns The discovered bindings.
|
|
14
|
+
*/
|
|
15
|
+
export declare function scanLocalDomainProcessBindings(sourceDirs: string[]): RawDomainProcessBindingRecord[];
|
|
@@ -0,0 +1,95 @@
|
|
|
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 path from 'node:path';
|
|
17
|
+
import { ComponentSet } from '@salesforce/source-deploy-retrieve';
|
|
18
|
+
import { DOMAIN_PROCESS_BINDING_LOCAL_OBJECT_NAME, } from './at4dxDomainProcessBindingTypes.js';
|
|
19
|
+
import { extractValues, fieldValue, toBoolean, toNumber } from './customMetadataXml.js';
|
|
20
|
+
/** @returns The source-format package/project directory name a metadata file belongs to (the directory containing `customMetadata`), same convention `at4dxLocalScan.ts` uses. */
|
|
21
|
+
function deriveProjectName(filePath) {
|
|
22
|
+
if (!filePath) {
|
|
23
|
+
return 'local';
|
|
24
|
+
}
|
|
25
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
26
|
+
const index = normalized.indexOf('/customMetadata/');
|
|
27
|
+
if (index === -1) {
|
|
28
|
+
return 'local';
|
|
29
|
+
}
|
|
30
|
+
return path.basename(normalized.slice(0, index));
|
|
31
|
+
}
|
|
32
|
+
/** @returns The normalized binding record for one `DomainProcessBinding.*` `CustomMetadata` component, or `undefined` if it has no resolvable SObject. */
|
|
33
|
+
function toRawRecord(component, developerName) {
|
|
34
|
+
const xml = component.parseXmlSync();
|
|
35
|
+
const values = extractValues(xml);
|
|
36
|
+
const sobject = fieldValue(values, 'RelatedDomainBindingSObject__c') ??
|
|
37
|
+
fieldValue(values, 'RelatedDomainBindingSObjectAlternate__c');
|
|
38
|
+
if (!sobject) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
developerName,
|
|
43
|
+
sobject,
|
|
44
|
+
processContext: fieldValue(values, 'ProcessContext__c'),
|
|
45
|
+
triggerOperation: fieldValue(values, 'TriggerOperation__c'),
|
|
46
|
+
domainMethodToken: fieldValue(values, 'DomainMethodToken__c'),
|
|
47
|
+
type: fieldValue(values, 'Type__c'),
|
|
48
|
+
classToInject: fieldValue(values, 'ClassToInject__c') ?? '',
|
|
49
|
+
order: toNumber(fieldValue(values, 'OrderOfExecution__c')) ?? 0,
|
|
50
|
+
isActive: toBoolean(fieldValue(values, 'IsActive__c'), true),
|
|
51
|
+
executeAsynchronous: toBoolean(fieldValue(values, 'ExecuteAsynchronous__c'), false),
|
|
52
|
+
logicalInverse: toBoolean(fieldValue(values, 'LogicalInverse__c'), false),
|
|
53
|
+
preventRecursive: toBoolean(fieldValue(values, 'PreventRecursive__c'), false),
|
|
54
|
+
description: fieldValue(values, 'Description__c'),
|
|
55
|
+
source: deriveProjectName(component.xml),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Scan local Salesforce DX source directories for AT4DX `DomainProcessBinding__mdt` records, parsing
|
|
60
|
+
* each `CustomMetadata` component's `<values>` pairs directly — the same approach `at4dxLocalScan.ts`
|
|
61
|
+
* uses for Application Factory bindings.
|
|
62
|
+
*
|
|
63
|
+
* Unlike an org (see `at4dxDomainProcessOrgScan.ts`), local source gives no signal for "this Custom
|
|
64
|
+
* Metadata Type doesn't exist" independent of "zero records exist for it" — a missing
|
|
65
|
+
* `customMetadata` folder and an empty one look identical to `ComponentSet.fromSource`. Callers treat
|
|
66
|
+
* an empty result as "AT4DX's Trigger Action Framework isn't configured here."
|
|
67
|
+
*
|
|
68
|
+
* @param sourceDirs - The source directories to scan.
|
|
69
|
+
* @returns The discovered bindings.
|
|
70
|
+
*/
|
|
71
|
+
export function scanLocalDomainProcessBindings(sourceDirs) {
|
|
72
|
+
const records = [];
|
|
73
|
+
const components = ComponentSet.fromSource(sourceDirs);
|
|
74
|
+
for (const rawComponent of components) {
|
|
75
|
+
const component = rawComponent;
|
|
76
|
+
if (component.type.id !== 'custommetadata') {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const separatorIndex = component.name.indexOf('.');
|
|
80
|
+
if (separatorIndex === -1) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const localObjectName = component.name.slice(0, separatorIndex);
|
|
84
|
+
if (localObjectName !== DOMAIN_PROCESS_BINDING_LOCAL_OBJECT_NAME) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
const developerName = component.name.slice(separatorIndex + 1);
|
|
88
|
+
const record = toRawRecord(component, developerName);
|
|
89
|
+
if (record) {
|
|
90
|
+
records.push(record);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return records;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=at4dxDomainProcessLocalScan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"at4dxDomainProcessLocalScan.js","sourceRoot":"","sources":["../../src/common/at4dxDomainProcessLocalScan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAwB,MAAM,oCAAoC,CAAC;AACxF,OAAO,EACL,wCAAwC,GAKzC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAA0B,MAAM,wBAAwB,CAAC;AAEhH,kLAAkL;AAClL,SAAS,iBAAiB,CAAC,QAA4B;IACrD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAChD,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACrD,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACjB,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC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MAAM,EAAE,gBAAgB,CAAC;QACjD,MAAM,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,CAAC;KACzC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,8BAA8B,CAAC,UAAoB;IACjE,MAAM,OAAO,GAAoC,EAAE,CAAC;IAEpD,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAEvD,KAAK,MAAM,YAAY,IAAI,UAAU,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,YAA+B,CAAC;QAClD,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,KAAK,gBAAgB,EAAE,CAAC;YAC3C,SAAS;QACX,CAAC;QAED,MAAM,cAAc,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACnD,IAAI,cAAc,KAAK,CAAC,CAAC,EAAE,CAAC;YAC1B,SAAS;QACX,CAAC;QACD,MAAM,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;QAChE,IAAI,eAAe,KAAK,wCAAwC,EAAE,CAAC;YACjE,SAAS;QACX,CAAC;QACD,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;QAE/D,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QACrD,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Connection } from '@salesforce/core';
|
|
2
|
+
import { type RawDomainProcessBindingRecord } from './at4dxDomainProcessBindingTypes.js';
|
|
3
|
+
export type DomainProcessOrgScanResult = {
|
|
4
|
+
records: RawDomainProcessBindingRecord[];
|
|
5
|
+
/** `true` when the `DomainProcessBinding__mdt` Custom Metadata Type doesn't exist in this org. */
|
|
6
|
+
missing: boolean;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Query the target org for AT4DX `DomainProcessBinding__mdt` records — an ordinary queryable Custom
|
|
10
|
+
* Metadata Type, plain REST (`connection.autoFetchQuery`), no Tooling API, no chunking (row counts
|
|
11
|
+
* are inherently small).
|
|
12
|
+
*
|
|
13
|
+
* @param connection - The org connection to query against.
|
|
14
|
+
* @returns The discovered bindings, and whether the Custom Metadata Type exists in this org at all.
|
|
15
|
+
*/
|
|
16
|
+
export declare function scanOrgDomainProcessBindings(connection: Connection): Promise<DomainProcessOrgScanResult>;
|
|
@@ -0,0 +1,78 @@
|
|
|
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 { DOMAIN_PROCESS_BINDING_OBJECT, } from './at4dxDomainProcessBindingTypes.js';
|
|
17
|
+
/**
|
|
18
|
+
* SOQL for `DomainProcessBinding__mdt`, including the `RelatedDomainBindingSObject__r.QualifiedApiName`
|
|
19
|
+
* relationship traversal — like `ApplicationFactory_*Binding__mdt`'s `BindingSObject__c`, this field
|
|
20
|
+
* holds an EntityDefinition reference, not a usable API name, when read from an org (local source XML
|
|
21
|
+
* stores the API name directly; see `at4dxDomainProcessLocalScan.ts`).
|
|
22
|
+
*/
|
|
23
|
+
const SOQL = `SELECT DeveloperName, RelatedDomainBindingSObject__c, RelatedDomainBindingSObject__r.QualifiedApiName, RelatedDomainBindingSObjectAlternate__c, ProcessContext__c, TriggerOperation__c, DomainMethodToken__c, Type__c, ClassToInject__c, OrderOfExecution__c, IsActive__c, ExecuteAsynchronous__c, LogicalInverse__c, PreventRecursive__c, Description__c FROM ${DOMAIN_PROCESS_BINDING_OBJECT}`;
|
|
24
|
+
/** @returns The SObject API name, preferring `RelatedDomainBindingSObject__c`'s resolved API name and falling back to `RelatedDomainBindingSObjectAlternate__c`, matching the same fallback order `at4dxOrgScan.ts` uses for `BindingSObject__c`. */
|
|
25
|
+
function resolveSObject(record) {
|
|
26
|
+
if (record.RelatedDomainBindingSObject__c) {
|
|
27
|
+
return record.RelatedDomainBindingSObject__r?.QualifiedApiName ?? undefined;
|
|
28
|
+
}
|
|
29
|
+
return record.RelatedDomainBindingSObjectAlternate__c ?? undefined;
|
|
30
|
+
}
|
|
31
|
+
/** @returns The normalized binding record, or `undefined` if the record has no resolvable SObject. */
|
|
32
|
+
function toRawRecord(record, source) {
|
|
33
|
+
const sobject = resolveSObject(record);
|
|
34
|
+
if (!sobject) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
developerName: record.DeveloperName,
|
|
39
|
+
sobject,
|
|
40
|
+
processContext: record.ProcessContext__c,
|
|
41
|
+
triggerOperation: record.TriggerOperation__c ?? undefined,
|
|
42
|
+
domainMethodToken: record.DomainMethodToken__c ?? undefined,
|
|
43
|
+
type: record.Type__c,
|
|
44
|
+
classToInject: record.ClassToInject__c,
|
|
45
|
+
order: record.OrderOfExecution__c,
|
|
46
|
+
isActive: record.IsActive__c,
|
|
47
|
+
executeAsynchronous: record.ExecuteAsynchronous__c,
|
|
48
|
+
logicalInverse: record.LogicalInverse__c,
|
|
49
|
+
preventRecursive: record.PreventRecursive__c,
|
|
50
|
+
description: record.Description__c ?? undefined,
|
|
51
|
+
source,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Query the target org for AT4DX `DomainProcessBinding__mdt` records — an ordinary queryable Custom
|
|
56
|
+
* Metadata Type, plain REST (`connection.autoFetchQuery`), no Tooling API, no chunking (row counts
|
|
57
|
+
* are inherently small).
|
|
58
|
+
*
|
|
59
|
+
* @param connection - The org connection to query against.
|
|
60
|
+
* @returns The discovered bindings, and whether the Custom Metadata Type exists in this org at all.
|
|
61
|
+
*/
|
|
62
|
+
export async function scanOrgDomainProcessBindings(connection) {
|
|
63
|
+
const source = connection.getUsername() ?? 'org';
|
|
64
|
+
try {
|
|
65
|
+
const result = await connection.autoFetchQuery(SOQL);
|
|
66
|
+
const records = result.records
|
|
67
|
+
.map((record) => toRawRecord(record, source))
|
|
68
|
+
.filter((record) => record !== undefined);
|
|
69
|
+
return { records, missing: false };
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (error.name === 'INVALID_TYPE') {
|
|
73
|
+
return { records: [], missing: true };
|
|
74
|
+
}
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=at4dxDomainProcessOrgScan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"at4dxDomainProcessOrgScan.js","sourceRoot":"","sources":["../../src/common/at4dxDomainProcessOrgScan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,6BAA6B,GAK9B,MAAM,qCAAqC,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,IAAI,GAAG,kWAAkW,6BAA6B,EAAE,CAAC;AAoB/Y,qPAAqP;AACrP,SAAS,cAAc,CAAC,MAAqC;IAC3D,IAAI,MAAM,CAAC,8BAA8B,EAAE,CAAC;QAC1C,OAAO,MAAM,CAAC,8BAA8B,EAAE,gBAAgB,IAAI,SAAS,CAAC;I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M,KAAK,SAAS,CAAC,CAAC;QACrF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IACrC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAAe,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAC7C,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACxC,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DomainProcessBindingRow, RawDomainProcessBindingRecord } from './at4dxDomainProcessBindingTypes.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve raw `DomainProcessBinding__mdt` records into rows sorted by execution order within each
|
|
4
|
+
* (SObject, process context, trigger operation/domain method token, type) group, flagging
|
|
5
|
+
* `orderCollision` where AT4DX itself doesn't guarantee a deterministic tiebreak.
|
|
6
|
+
*
|
|
7
|
+
* Unlike Application Factory bindings, there's no "winner" here — every active record in a group
|
|
8
|
+
* runs, in `OrderOfExecution__c` order. Two *active* records sharing the same order within a group is
|
|
9
|
+
* the one thing worth flagging: AT4DX's Custom Metadata query has no `ORDER BY` tiebreak for equal
|
|
10
|
+
* order values, so which one actually runs first isn't something this command can determine (the same
|
|
11
|
+
* "flag it, don't guess" precedent `at4dxResolve.ts` applies to ambiguous Domain bindings). Inactive
|
|
12
|
+
* records never contribute to a collision, since AT4DX skips them entirely.
|
|
13
|
+
*
|
|
14
|
+
* @param records - The raw binding records to resolve, as returned by `scanOrgDomainProcessBindings`/`scanLocalDomainProcessBindings`.
|
|
15
|
+
* @returns The resolved rows, grouped in first-seen order, sorted by `order` ascending within each group.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveDomainProcessBindings(records: RawDomainProcessBindingRecord[]): DomainProcessBindingRow[];
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Groups records by the same (SObject, process context, trigger operation/domain method token, type)
|
|
18
|
+
* scope AT4DX's `DomainProcessCoordinator` map contends over. `type` matters: AT4DX's runtime map keys
|
|
19
|
+
* `Criteria` and `Action` records separately, so a Criteria and an Action sharing the same
|
|
20
|
+
* `OrderOfExecution__c` — a normal, common configuration — never contend for the same slot and must
|
|
21
|
+
* not be flagged as a collision.
|
|
22
|
+
*/
|
|
23
|
+
function groupKey(record) {
|
|
24
|
+
return [
|
|
25
|
+
record.sobject,
|
|
26
|
+
record.processContext,
|
|
27
|
+
record.triggerOperation ?? record.domainMethodToken ?? '',
|
|
28
|
+
record.type,
|
|
29
|
+
].join(' ');
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Resolve raw `DomainProcessBinding__mdt` records into rows sorted by execution order within each
|
|
33
|
+
* (SObject, process context, trigger operation/domain method token, type) group, flagging
|
|
34
|
+
* `orderCollision` where AT4DX itself doesn't guarantee a deterministic tiebreak.
|
|
35
|
+
*
|
|
36
|
+
* Unlike Application Factory bindings, there's no "winner" here — every active record in a group
|
|
37
|
+
* runs, in `OrderOfExecution__c` order. Two *active* records sharing the same order within a group is
|
|
38
|
+
* the one thing worth flagging: AT4DX's Custom Metadata query has no `ORDER BY` tiebreak for equal
|
|
39
|
+
* order values, so which one actually runs first isn't something this command can determine (the same
|
|
40
|
+
* "flag it, don't guess" precedent `at4dxResolve.ts` applies to ambiguous Domain bindings). Inactive
|
|
41
|
+
* records never contribute to a collision, since AT4DX skips them entirely.
|
|
42
|
+
*
|
|
43
|
+
* @param records - The raw binding records to resolve, as returned by `scanOrgDomainProcessBindings`/`scanLocalDomainProcessBindings`.
|
|
44
|
+
* @returns The resolved rows, grouped in first-seen order, sorted by `order` ascending within each group.
|
|
45
|
+
*/
|
|
46
|
+
export function resolveDomainProcessBindings(records) {
|
|
47
|
+
const byGroup = new Map();
|
|
48
|
+
for (const record of records) {
|
|
49
|
+
const key = groupKey(record);
|
|
50
|
+
const group = byGroup.get(key) ?? [];
|
|
51
|
+
group.push(record);
|
|
52
|
+
byGroup.set(key, group);
|
|
53
|
+
}
|
|
54
|
+
const rows = [];
|
|
55
|
+
for (const group of byGroup.values()) {
|
|
56
|
+
const activeOrderCounts = new Map();
|
|
57
|
+
for (const record of group) {
|
|
58
|
+
if (record.isActive) {
|
|
59
|
+
activeOrderCounts.set(record.order, (activeOrderCounts.get(record.order) ?? 0) + 1);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const sorted = [...group].sort((a, b) => a.order - b.order);
|
|
63
|
+
for (const record of sorted) {
|
|
64
|
+
const orderCollision = record.isActive && (activeOrderCounts.get(record.order) ?? 0) > 1;
|
|
65
|
+
rows.push({ ...record, ...(orderCollision ? { orderCollision: true } : {}) });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return rows;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=at4dxDomainProcessResolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"at4dxDomainProcessResolve.js","sourceRoot":"","sources":["../../src/common/at4dxDomainProcessResolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;;;;;GAMG;AACH,SAAS,QAAQ,CAAC,MAAqC;IACrD,OAAO;QACL,MAAM,C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;YAC5B,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YACzF,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -16,22 +16,7 @@
|
|
|
16
16
|
import path from 'node:path';
|
|
17
17
|
import { ComponentSet } from '@salesforce/source-deploy-retrieve';
|
|
18
18
|
import { bindingTypeForLocalObjectName } from './at4dxBindingTypes.js';
|
|
19
|
-
|
|
20
|
-
function fieldValue(values, field) {
|
|
21
|
-
const entry = values.find((value) => value.field === field);
|
|
22
|
-
if (!entry?.value || entry.value['@_xsi:nil'] === 'true') {
|
|
23
|
-
return undefined;
|
|
24
|
-
}
|
|
25
|
-
return entry.value['#text'];
|
|
26
|
-
}
|
|
27
|
-
/** @returns `value` parsed as a number, or `undefined` if `value` is absent or not numeric. */
|
|
28
|
-
function toNumber(value) {
|
|
29
|
-
if (value === undefined) {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
const parsed = Number(value);
|
|
33
|
-
return Number.isNaN(parsed) ? undefined : parsed;
|
|
34
|
-
}
|
|
19
|
+
import { extractValues, fieldValue, toNumber } from './customMetadataXml.js';
|
|
35
20
|
/**
|
|
36
21
|
* @returns The source-format package/project directory name a metadata file belongs to (the
|
|
37
22
|
* directory containing `customMetadata`) — the same convention `simply schema visualize` uses for
|
|
@@ -51,8 +36,7 @@ function deriveProjectName(filePath) {
|
|
|
51
36
|
/** @returns The normalized binding record for one `CustomMetadata` component, or `undefined` if it has no resolvable key. */
|
|
52
37
|
function toRawRecord(bindingType, component, developerName) {
|
|
53
38
|
const xml = component.parseXmlSync();
|
|
54
|
-
const
|
|
55
|
-
const values = rawValues === undefined ? [] : Array.isArray(rawValues) ? rawValues : [rawValues];
|
|
39
|
+
const values = extractValues(xml);
|
|
56
40
|
const bindingSObject = fieldValue(values, 'BindingSObject__c');
|
|
57
41
|
const bindingSObjectAlternate = fieldValue(values, 'BindingSObjectAlternate__c');
|
|
58
42
|
const key = bindingType === 'Service' ? fieldValue(values, 'BindingInterface__c') : (bindingSObject ?? bindingSObjectAlternate);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"at4dxLocalScan.js","sourceRoot":"","sources":["../../src/common/at4dxLocalScan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAwB,MAAM,oCAAoC,CAAC;AACxF,OAAO,EAAE,6BAA6B,EAA2C,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"at4dxLocalScan.js","sourceRoot":"","sources":["../../src/common/at4dxLocalScan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAwB,MAAM,oCAAoC,CAAC;AACxF,OAAO,EAAE,6BAA6B,EAA2C,MAAM,wBAAwB,CAAC;AAChH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAA0B,MAAM,wBAAwB,CAAC;AAErG;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,QAA4B;IACrD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAChD,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACrD,IAAI,KAA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C;IAEvC,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAEvD,KAAK,MAAM,YAAY,IAAI,UAAU,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,YAA+B,CAAC;QAClD,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,KAAK,gBAAgB,EAAE,CAAC;YAC3C,SAAS;QACX,CAAC;QAED,MAAM,cAAc,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACnD,IAAI,cAAc,KAAK,CAAC,CAAC,EAAE,CAAC;YAC1B,SAAS;QACX,CAAC;QACD,MAAM,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;QAChE,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;QAE/D,MAAM,WAAW,GAAG,6BAA6B,CAAC,eAAe,CAAC,CAAC;QACnE,IAAI,CAAC,WAAW,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;YACrD,SAAS;QACX,CAAC;QAED,MAAM,MAAM,GAAG,WAAW,CAAC,WAAW,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;QAClE,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** One `<values><field>.../field><value>.../value></values>` entry from a `CustomMetadata` record's parsed XML. */
|
|
2
|
+
export type RawMetadataValue = {
|
|
3
|
+
field: string;
|
|
4
|
+
value?: {
|
|
5
|
+
'#text'?: string;
|
|
6
|
+
'@_xsi:nil'?: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export type CustomMetadataXml = {
|
|
10
|
+
CustomMetadata?: {
|
|
11
|
+
values?: RawMetadataValue | RawMetadataValue[];
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/** @returns The plain-text value for `field` in `values`, or `undefined` if the field is absent or explicitly nil. */
|
|
15
|
+
export declare function fieldValue(values: RawMetadataValue[], field: string): string | undefined;
|
|
16
|
+
/** @returns `value` parsed as a number, or `undefined` if `value` is absent or not numeric. */
|
|
17
|
+
export declare function toNumber(value: string | undefined): number | undefined;
|
|
18
|
+
/** @returns `value` parsed as a boolean (`"true"`/`"false"` as Salesforce serializes Checkbox fields), or `defaultValue` if `value` is absent. */
|
|
19
|
+
export declare function toBoolean(value: string | undefined, defaultValue: boolean): boolean;
|
|
20
|
+
/** @returns The `values` array from a parsed `CustomMetadata` component's XML, normalizing the single-vs-array shape `fast-xml-parser` produces. */
|
|
21
|
+
export declare function extractValues(xml: CustomMetadataXml): RawMetadataValue[];
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
/** @returns The plain-text value for `field` in `values`, or `undefined` if the field is absent or explicitly nil. */
|
|
17
|
+
export function fieldValue(values, field) {
|
|
18
|
+
const entry = values.find((value) => value.field === field);
|
|
19
|
+
if (!entry?.value || entry.value['@_xsi:nil'] === 'true') {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
return entry.value['#text'];
|
|
23
|
+
}
|
|
24
|
+
/** @returns `value` parsed as a number, or `undefined` if `value` is absent or not numeric. */
|
|
25
|
+
export function toNumber(value) {
|
|
26
|
+
if (value === undefined) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
const parsed = Number(value);
|
|
30
|
+
return Number.isNaN(parsed) ? undefined : parsed;
|
|
31
|
+
}
|
|
32
|
+
/** @returns `value` parsed as a boolean (`"true"`/`"false"` as Salesforce serializes Checkbox fields), or `defaultValue` if `value` is absent. */
|
|
33
|
+
export function toBoolean(value, defaultValue) {
|
|
34
|
+
return value === undefined ? defaultValue : value === 'true';
|
|
35
|
+
}
|
|
36
|
+
/** @returns The `values` array from a parsed `CustomMetadata` component's XML, normalizing the single-vs-array shape `fast-xml-parser` produces. */
|
|
37
|
+
export function extractValues(xml) {
|
|
38
|
+
const rawValues = xml.CustomMetadata?.values;
|
|
39
|
+
return rawValues === undefined ? [] : Array.isArray(rawValues) ? rawValues : [rawValues];
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=customMetadataXml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customMetadataXml.js","sourceRoot":"","sources":["../../src/common/customMetadataXml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAkBH,sHAAsH;AACtH,MAAM,UAAU,UAAU,CAAC,MAA0B,EAAE,KAAa;IAClE,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;IAC5D,IAAI,CAAC,KAAK,EAAE,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,MAAM,EAAE,CAAC;QACzD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,QAAQ,CAAC,KAAyB;IAChD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AACnD,CAAC;AAED,kJAAkJ;AAClJ,MAAM,UAAU,SAAS,CAAC,KAAyB,EAAE,YAAqB;IACxE,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC;AAC/D,CAAC;AAED,oJAAoJ;AACpJ,MAAM,UAAU,aAAa,CAAC,GAAsB;IAClD,MAAM,SAAS,GAAG,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC;IAC7C,OAAO,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AAC3F,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -2,3 +2,7 @@ export { ALL_BINDING_TYPES, AT4DX_BINDING_OBJECTS, AT4DX_BINDING_LOCAL_OBJECT_NA
|
|
|
2
2
|
export { scanLocalBindings } from './common/at4dxLocalScan.js';
|
|
3
3
|
export { scanOrgBindings, type OrgScanResult } from './common/at4dxOrgScan.js';
|
|
4
4
|
export { resolveBindings } from './common/at4dxResolve.js';
|
|
5
|
+
export { ALL_TRIGGER_OPERATIONS, DOMAIN_PROCESS_BINDING_OBJECT, DOMAIN_PROCESS_BINDING_LOCAL_OBJECT_NAME, type At4dxDomainProcessBindingListResult, type DomainProcessBindingRow, type DomainProcessType, type ProcessContext, type RawDomainProcessBindingRecord, type TriggerOperation, } from './common/at4dxDomainProcessBindingTypes.js';
|
|
6
|
+
export { scanLocalDomainProcessBindings } from './common/at4dxDomainProcessLocalScan.js';
|
|
7
|
+
export { scanOrgDomainProcessBindings, type DomainProcessOrgScanResult } from './common/at4dxDomainProcessOrgScan.js';
|
|
8
|
+
export { resolveDomainProcessBindings } from './common/at4dxDomainProcessResolve.js';
|
package/lib/index.js
CHANGED
|
@@ -21,4 +21,8 @@ export { ALL_BINDING_TYPES, AT4DX_BINDING_OBJECTS, AT4DX_BINDING_LOCAL_OBJECT_NA
|
|
|
21
21
|
export { scanLocalBindings } from './common/at4dxLocalScan.js';
|
|
22
22
|
export { scanOrgBindings } from './common/at4dxOrgScan.js';
|
|
23
23
|
export { resolveBindings } from './common/at4dxResolve.js';
|
|
24
|
+
export { ALL_TRIGGER_OPERATIONS, DOMAIN_PROCESS_BINDING_OBJECT, DOMAIN_PROCESS_BINDING_LOCAL_OBJECT_NAME, } from './common/at4dxDomainProcessBindingTypes.js';
|
|
25
|
+
export { scanLocalDomainProcessBindings } from './common/at4dxDomainProcessLocalScan.js';
|
|
26
|
+
export { scanOrgDomainProcessBindings } from './common/at4dxDomainProcessOrgScan.js';
|
|
27
|
+
export { resolveDomainProcessBindings } from './common/at4dxDomainProcessResolve.js';
|
|
24
28
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,+FAA+F;AAC/F,iGAAiG;AACjG,8FAA8F;AAC9F,mBAAmB;AAEnB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,gCAAgC,EAChC,oBAAoB,EACpB,6BAA6B,GAM9B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAsB,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,+FAA+F;AAC/F,iGAAiG;AACjG,8FAA8F;AAC9F,mBAAmB;AAEnB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,gCAAgC,EAChC,oBAAoB,EACpB,6BAA6B,GAM9B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAsB,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,wCAAwC,GAOzC,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AACzF,OAAO,EAAE,4BAA4B,EAAmC,MAAM,uCAAuC,CAAC;AACtH,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
List the AT4DX Trigger Action Framework bindings configured in an org or local source, in execution order.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Reads AT4DX's Trigger Action Framework Custom Metadata Type — `DomainProcessBinding__mdt` — either from a live org or from local Salesforce DX source, showing which criteria/action classes are bound to each SObject's trigger events (or domain method tokens), and the order they run in. Exactly one of `--target-org` or `--source-dir` must be specified.
|
|
8
|
+
|
|
9
|
+
Unlike `simply aep at4dx binding list`, there's no "winner" here — every active record in a group (same SObject, process context, and trigger operation or domain method token) runs, in `OrderOfExecution__c` order. Two active records sharing the same order within a group are flagged as a collision, since AT4DX doesn't guarantee which one runs first in that case.
|
|
10
|
+
|
|
11
|
+
# flags.target-org.summary
|
|
12
|
+
|
|
13
|
+
Username or alias of the org to read bindings from. Use this for live-org discovery.
|
|
14
|
+
|
|
15
|
+
# flags.source-dir.summary
|
|
16
|
+
|
|
17
|
+
One or more paths to directories containing Salesforce DX source. Use this for local-source discovery.
|
|
18
|
+
|
|
19
|
+
# flags.sobject.summary
|
|
20
|
+
|
|
21
|
+
SObject API name(s) to filter to. If not specified, bindings for every SObject are included.
|
|
22
|
+
|
|
23
|
+
# flags.active-only.summary
|
|
24
|
+
|
|
25
|
+
Only show active bindings; hide inactive records.
|
|
26
|
+
|
|
27
|
+
# examples
|
|
28
|
+
|
|
29
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg
|
|
30
|
+
|
|
31
|
+
- <%= config.bin %> <%= command.id %> --source-dir sfdx-source/core --source-dir sfdx-source/app
|
|
32
|
+
|
|
33
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg --sobject Account
|
|
34
|
+
|
|
35
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg --active-only --json
|
|
36
|
+
|
|
37
|
+
# error.targetOrgOrSourceDirRequired
|
|
38
|
+
|
|
39
|
+
You must specify either --target-org or --source-dir, but not both.
|
|
40
|
+
|
|
41
|
+
# error.at4dxNotDetected
|
|
42
|
+
|
|
43
|
+
AT4DX's Trigger Action Framework doesn't appear to be present in this source: the DomainProcessBinding__mdt Custom Metadata Type wasn't found.
|
|
44
|
+
|
|
45
|
+
# error.localScanFailed
|
|
46
|
+
|
|
47
|
+
Failed to scan the project directory: %s
|
|
48
|
+
|
|
49
|
+
# error.orgQueryFailed
|
|
50
|
+
|
|
51
|
+
Failed to query bindings from the org: %s
|
|
52
|
+
|
|
53
|
+
# info.queryingOrg
|
|
54
|
+
|
|
55
|
+
Querying bindings from %s...
|
|
56
|
+
|
|
57
|
+
# info.scanningLocalSource
|
|
58
|
+
|
|
59
|
+
Scanning local source for bindings...
|
|
60
|
+
|
|
61
|
+
# info.complete
|
|
62
|
+
|
|
63
|
+
Found %s binding(s) in %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.
|
|
4
|
+
"version": "0.3.1",
|
|
5
5
|
"author": "@ClayChipps",
|
|
6
6
|
"homepage": "https://github.com/SimplySF/simply-node",
|
|
7
7
|
"bugs": "https://github.com/SimplySF/simply-node/issues",
|
|
@@ -206,5 +206,5 @@
|
|
|
206
206
|
"output": []
|
|
207
207
|
}
|
|
208
208
|
},
|
|
209
|
-
"gitHead": "
|
|
209
|
+
"gitHead": "4fca2ac0e338eb2221758a5eca8cca3497fb24af"
|
|
210
210
|
}
|