@simplysf/simply-aep 0.12.0 → 0.13.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
@@ -35,6 +35,7 @@ This package is part of the [`@simplysf/simply`](https://github.com/SimplySF/sim
35
35
  - [`sf simply aep at4dx field-set-inclusion update`](#sf-simply-aep-at4dx-field-set-inclusion-update)
36
36
  - [`sf simply aep at4dx field-set-inclusion validate`](#sf-simply-aep-at4dx-field-set-inclusion-validate)
37
37
  - [`sf simply aep at4dx platform-event-subscription list`](#sf-simply-aep-at4dx-platform-event-subscription-list)
38
+ - [`sf simply aep at4dx platform-event-subscription simulate`](#sf-simply-aep-at4dx-platform-event-subscription-simulate)
38
39
  - [`sf simply aep at4dx platform-event-subscription validate`](#sf-simply-aep-at4dx-platform-event-subscription-validate)
39
40
 
40
41
  ## `sf simply aep at4dx binding create`
@@ -795,6 +796,62 @@ EXAMPLES
795
796
 
796
797
  _See code: [lib/commands/simply/aep/at4dx/platform-event-subscription/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.11.3/packages/simply-aep/lib/commands/simply/aep/at4dx/platform-event-subscription/list.js)_
797
798
 
799
+ ## `sf simply aep at4dx platform-event-subscription simulate`
800
+
801
+ Simulate the AT4DX Platform Event Distributor's consumer resolution for a hypothetical event, and show which subscriptions would receive it and why the rest wouldn't.
802
+
803
+ ```
804
+ USAGE
805
+ $ sf simply aep at4dx platform-event-subscription simulate --event-bus <value> [--json] [--flags-dir <value>] [-o <value>] [--api-version <value>] [-d
806
+ <value>...] [--category <value>] [--event-name <value>]
807
+
808
+ FLAGS
809
+ -d, --source-dir=<value>... One or more paths to directories containing Salesforce DX source. Use this for
810
+ local-source discovery.
811
+ -o, --target-org=<value> Username or alias of the org to read platform event subscriptions from. Use this for
812
+ live-org discovery.
813
+ --api-version=<value> Override the api version used for api requests made by this command
814
+ --category=<value> The hypothetical event's Category__c value. Omit to simulate an event with no category.
815
+ --event-bus=<value> (required) The platform event object API name (EventBus__c) of the hypothetical event to
816
+ simulate, e.g. My_Event__e.
817
+ --event-name=<value> The hypothetical event's EventName__c value. Omit to simulate an event with no event
818
+ name.
819
+
820
+ GLOBAL FLAGS
821
+ --flags-dir=<value> Import flag values from a directory.
822
+ --json Format output as json.
823
+
824
+ DESCRIPTION
825
+ Simulate the AT4DX Platform Event Distributor's consumer resolution for a hypothetical event, and show which
826
+ subscriptions would receive it and why the rest wouldn't.
827
+
828
+ Reads `PlatformEvents_Subscription__mdt` — either from a live org or from local Salesforce DX source — and
829
+ reimplements `PlatformEventDistributor`'s decision sequence against a hypothetical event you describe with
830
+ `--event-bus`, `--category`, and `--event-name`: restrict to subscriptions on that bus, drop inactive records the
831
+ distributor's own query never loads, apply `triggerHandler`'s pre-filter, then each record's `MatcherRule__c` branch.
832
+ Exactly one of `--target-org` or `--source-dir` must be specified.
833
+
834
+ Prints the exact consumer set the distributor would build, in order, tagged synchronous or asynchronous from
835
+ `Execute_Synchronous__c`, plus every subscription on that bus that would *not* receive the event and the structured
836
+ reason why: `inactive`, `prefiltered` (the pre-filter rejected it before any matcher rule ran),
837
+ `matcher-rule-missing-field` (the matcher rule dereferences a blank match field — a real NullPointerException in the
838
+ org), or `no-match` (every field the matcher rule needs is present, but the values don't match this event).
839
+
840
+ This is the same evaluation `simply aep at4dx platform-event-subscription validate` uses to derive
841
+ `matcher-rule-missing-field` and `unreachable-subscription` — running it here against a concrete hypothetical event is
842
+ how you confirm a subscription actually receives what you expect it to, beyond what `validate`'s static checks can
843
+ tell you.
844
+
845
+ EXAMPLES
846
+ $ sf simply aep at4dx platform-event-subscription simulate --target-org myOrg --event-bus Account_Change__e --category Finance --event-name AccountUpdated
847
+
848
+ $ sf simply aep at4dx platform-event-subscription simulate --source-dir sfdx-source/core --event-bus Account_Change__e --event-name AccountUpdated
849
+
850
+ $ sf simply aep at4dx platform-event-subscription simulate --target-org myOrg --event-bus Account_Change__e --json
851
+ ```
852
+
853
+ _See code: [lib/commands/simply/aep/at4dx/platform-event-subscription/simulate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.11.3/packages/simply-aep/lib/commands/simply/aep/at4dx/platform-event-subscription/simulate.js)_
854
+
798
855
  ## `sf simply aep at4dx platform-event-subscription validate`
799
856
 
800
857
  Validate the AT4DX Platform Event Distributor subscriptions configured in an org or local source, failing when a wiring problem is found.
@@ -0,0 +1,27 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { type PlatformEventDistributionResult } from '@simplysf/simply-aep-core';
3
+ /**
4
+ * Simulates `PlatformEventDistributor`'s consumer resolution for a hypothetical event — a bus plus
5
+ * optional category/event-name values — and prints the exact consumer set it would build, in order,
6
+ * plus every subscription on that bus that would *not* receive the event and the structured reason why
7
+ * (`inactive`, `prefiltered`, `matcher-rule-missing-field`, or `no-match`). Reimplements the
8
+ * distributor's own decision sequence rather than asserting it, per docs/design/0025 — the same
9
+ * evaluation code that surfaces `matcher-rule-missing-field`/`unreachable-subscription` from
10
+ * `platform-event-subscription validate`.
11
+ */
12
+ export default class At4dxPlatformEventSubscriptionSimulate extends SfCommand<PlatformEventDistributionResult> {
13
+ static readonly summary: string;
14
+ static readonly description: string;
15
+ static readonly examples: string[];
16
+ static readonly flags: {
17
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
18
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ 'source-dir': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ 'event-bus': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
21
+ category: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
+ 'event-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ 'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
+ };
25
+ /** @returns The simulated event's matched consumer set and non-matches, for the requested source. */
26
+ run(): Promise<PlatformEventDistributionResult>;
27
+ }
@@ -0,0 +1,148 @@
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 { resolvePlatformEventDistribution, scanLocalPlatformEventSubscriptions, scanOrgPlatformEventSubscriptions, } from '@simplysf/simply-aep-core';
19
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
20
+ const messages = Messages.loadMessages('@simplysf/simply-aep', 'simply.aep.at4dx.platform-event-subscription.simulate');
21
+ function toMatchDisplayRow(match) {
22
+ return {
23
+ developerName: match.developerName,
24
+ consumer: match.consumer,
25
+ executeSynchronous: String(match.executeSynchronous),
26
+ source: match.source,
27
+ };
28
+ }
29
+ function toMissDisplayRow(miss) {
30
+ return {
31
+ developerName: miss.developerName,
32
+ consumer: miss.consumer,
33
+ reason: miss.reason,
34
+ source: miss.source,
35
+ };
36
+ }
37
+ /**
38
+ * Simulates `PlatformEventDistributor`'s consumer resolution for a hypothetical event — a bus plus
39
+ * optional category/event-name values — and prints the exact consumer set it would build, in order,
40
+ * plus every subscription on that bus that would *not* receive the event and the structured reason why
41
+ * (`inactive`, `prefiltered`, `matcher-rule-missing-field`, or `no-match`). Reimplements the
42
+ * distributor's own decision sequence rather than asserting it, per docs/design/0025 — the same
43
+ * evaluation code that surfaces `matcher-rule-missing-field`/`unreachable-subscription` from
44
+ * `platform-event-subscription validate`.
45
+ */
46
+ export default class At4dxPlatformEventSubscriptionSimulate extends SfCommand {
47
+ static summary = messages.getMessage('summary');
48
+ static description = messages.getMessage('description');
49
+ static examples = messages.getMessages('examples');
50
+ static flags = {
51
+ ...SfCommand.baseFlags,
52
+ 'target-org': Flags.optionalOrg({
53
+ summary: messages.getMessage('flags.target-org.summary'),
54
+ char: 'o',
55
+ }),
56
+ 'api-version': Flags.orgApiVersion(),
57
+ 'source-dir': Flags.directory({
58
+ summary: messages.getMessage('flags.source-dir.summary'),
59
+ char: 'd',
60
+ exists: true,
61
+ multiple: true,
62
+ }),
63
+ 'event-bus': Flags.string({
64
+ summary: messages.getMessage('flags.event-bus.summary'),
65
+ required: true,
66
+ }),
67
+ category: Flags.string({
68
+ summary: messages.getMessage('flags.category.summary'),
69
+ }),
70
+ 'event-name': Flags.string({
71
+ summary: messages.getMessage('flags.event-name.summary'),
72
+ }),
73
+ };
74
+ /** @returns The simulated event's matched consumer set and non-matches, for the requested source. */
75
+ async run() {
76
+ const { flags } = await this.parse(At4dxPlatformEventSubscriptionSimulate);
77
+ const targetOrg = flags['target-org'];
78
+ const sourceDirs = flags['source-dir'] ?? [];
79
+ if ((targetOrg && sourceDirs.length > 0) || (!targetOrg && sourceDirs.length === 0)) {
80
+ throw messages.createError('error.targetOrgOrSourceDirRequired');
81
+ }
82
+ let records;
83
+ if (targetOrg) {
84
+ const connection = targetOrg.getConnection(flags['api-version']);
85
+ const source = targetOrg.getUsername() ?? 'org';
86
+ this.spinner.start(messages.getMessage('info.queryingOrg', [source]));
87
+ let scanResult;
88
+ try {
89
+ scanResult = await scanOrgPlatformEventSubscriptions(connection);
90
+ }
91
+ catch (error) {
92
+ this.spinner.stop();
93
+ throw messages.createError('error.orgQueryFailed', [error.message]);
94
+ }
95
+ this.spinner.stop();
96
+ if (scanResult.missing) {
97
+ throw messages.createError('error.at4dxNotDetected');
98
+ }
99
+ records = scanResult.records;
100
+ }
101
+ else {
102
+ this.spinner.start(messages.getMessage('info.scanningLocalSource'));
103
+ let scanResult;
104
+ try {
105
+ scanResult = scanLocalPlatformEventSubscriptions(sourceDirs);
106
+ }
107
+ catch (error) {
108
+ this.spinner.stop();
109
+ throw messages.createError('error.localScanFailed', [error.message]);
110
+ }
111
+ this.spinner.stop();
112
+ if (scanResult.records.length === 0 && scanResult.malformed.length === 0) {
113
+ throw messages.createError('error.at4dxNotDetected');
114
+ }
115
+ records = scanResult.records;
116
+ }
117
+ const result = resolvePlatformEventDistribution({ eventBus: flags['event-bus'], category: flags.category, eventName: flags['event-name'] }, records);
118
+ if (result.matches.length > 0) {
119
+ this.styledHeader(messages.getMessage('header.matches'));
120
+ this.table({
121
+ data: result.matches.map(toMatchDisplayRow),
122
+ columns: [
123
+ { key: 'developerName', name: 'DEVELOPER NAME' },
124
+ { key: 'consumer', name: 'CONSUMER' },
125
+ { key: 'executeSynchronous', name: 'SYNCHRONOUS' },
126
+ { key: 'source', name: 'SOURCE' },
127
+ ],
128
+ });
129
+ }
130
+ else {
131
+ this.info(messages.getMessage('info.noMatches'));
132
+ }
133
+ if (result.misses.length > 0) {
134
+ this.styledHeader(messages.getMessage('header.misses'));
135
+ this.table({
136
+ data: result.misses.map(toMissDisplayRow),
137
+ columns: [
138
+ { key: 'developerName', name: 'DEVELOPER NAME' },
139
+ { key: 'consumer', name: 'CONSUMER' },
140
+ { key: 'reason', name: 'REASON' },
141
+ { key: 'source', name: 'SOURCE' },
142
+ ],
143
+ });
144
+ }
145
+ return result;
146
+ }
147
+ }
148
+ //# sourceMappingURL=simulate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulate.js","sourceRoot":"","sources":["../../../../../../src/commands/simply/aep/at4dx/platform-event-subscription/simulate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,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,CAAC,GAAG,CAAC,gBAAgB,CAAC;gBACzC,OAAO,EAAE;oBACP,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,gBAAgB,EAAE;oBAChD,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE;oBACrC,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACjC,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;iBAClC;aACF,CAAC,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
@@ -0,0 +1,75 @@
1
+ # summary
2
+
3
+ Simulate the AT4DX Platform Event Distributor's consumer resolution for a hypothetical event, and show which subscriptions would receive it and why the rest wouldn't.
4
+
5
+ # description
6
+
7
+ Reads `PlatformEvents_Subscription__mdt` — either from a live org or from local Salesforce DX source — and reimplements `PlatformEventDistributor`'s decision sequence against a hypothetical event you describe with `--event-bus`, `--category`, and `--event-name`: restrict to subscriptions on that bus, drop inactive records the distributor's own query never loads, apply `triggerHandler`'s pre-filter, then each record's `MatcherRule__c` branch. Exactly one of `--target-org` or `--source-dir` must be specified.
8
+
9
+ Prints the exact consumer set the distributor would build, in order, tagged synchronous or asynchronous from `Execute_Synchronous__c`, plus every subscription on that bus that would _not_ receive the event and the structured reason why: `inactive`, `prefiltered` (the pre-filter rejected it before any matcher rule ran), `matcher-rule-missing-field` (the matcher rule dereferences a blank match field — a real NullPointerException in the org), or `no-match` (every field the matcher rule needs is present, but the values don't match this event).
10
+
11
+ This is the same evaluation `simply aep at4dx platform-event-subscription validate` uses to derive `matcher-rule-missing-field` and `unreachable-subscription` — running it here against a concrete hypothetical event is how you confirm a subscription actually receives what you expect it to, beyond what `validate`'s static checks can tell you.
12
+
13
+ # flags.target-org.summary
14
+
15
+ Username or alias of the org to read platform event subscriptions from. Use this for live-org discovery.
16
+
17
+ # flags.source-dir.summary
18
+
19
+ One or more paths to directories containing Salesforce DX source. Use this for local-source discovery.
20
+
21
+ # flags.event-bus.summary
22
+
23
+ The platform event object API name (EventBus__c) of the hypothetical event to simulate, e.g. My_Event__e.
24
+
25
+ # flags.category.summary
26
+
27
+ The hypothetical event's Category__c value. Omit to simulate an event with no category.
28
+
29
+ # flags.event-name.summary
30
+
31
+ The hypothetical event's EventName__c value. Omit to simulate an event with no event name.
32
+
33
+ # examples
34
+
35
+ - <%= config.bin %> <%= command.id %> --target-org myOrg --event-bus Account_Change__e --category Finance --event-name AccountUpdated
36
+
37
+ - <%= config.bin %> <%= command.id %> --source-dir sfdx-source/core --event-bus Account_Change__e --event-name AccountUpdated
38
+
39
+ - <%= config.bin %> <%= command.id %> --target-org myOrg --event-bus Account_Change__e --json
40
+
41
+ # error.targetOrgOrSourceDirRequired
42
+
43
+ You must specify either --target-org or --source-dir, but not both.
44
+
45
+ # error.at4dxNotDetected
46
+
47
+ AT4DX doesn't appear to be present in this source: the PlatformEvents_Subscription__mdt Custom Metadata Type wasn't found.
48
+
49
+ # error.localScanFailed
50
+
51
+ Failed to scan the project directory: %s
52
+
53
+ # error.orgQueryFailed
54
+
55
+ Failed to query platform event subscriptions from the org: %s
56
+
57
+ # info.queryingOrg
58
+
59
+ Querying platform event subscriptions from %s...
60
+
61
+ # info.scanningLocalSource
62
+
63
+ Scanning local source for platform event subscriptions...
64
+
65
+ # info.noMatches
66
+
67
+ No subscription would receive this event.
68
+
69
+ # header.matches
70
+
71
+ Matched consumers
72
+
73
+ # header.misses
74
+
75
+ Non-matching subscriptions
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.12.0",
4
+ "version": "0.13.0",
5
5
  "author": "@ClayChipps",
6
6
  "homepage": "https://github.com/SimplySF/simply-node",
7
7
  "bugs": "https://github.com/SimplySF/simply-node/issues",
@@ -60,7 +60,7 @@
60
60
  "@salesforce/core": "^8.30.0",
61
61
  "@salesforce/kit": "^3.2.6",
62
62
  "@salesforce/sf-plugins-core": "^12.2.16",
63
- "@simplysf/simply-aep-core": "^0.11.0",
63
+ "@simplysf/simply-aep-core": "^0.12.0",
64
64
  "@simplysf/simply-core": "^1.5.1"
65
65
  },
66
66
  "devDependencies": {
@@ -197,5 +197,5 @@
197
197
  "output": []
198
198
  }
199
199
  },
200
- "gitHead": "35ce5dcb8e289fe36a5deb87cfd0d4f19d2e3374"
200
+ "gitHead": "7f496b64726ad7a7ed93b350bd419dc68cc87898"
201
201
  }