@simplysf/simply-aep 0.11.3 → 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 +158 -12
- package/lib/commands/simply/aep/at4dx/platform-event-subscription/list.d.ts +21 -0
- package/lib/commands/simply/aep/at4dx/platform-event-subscription/list.js +120 -0
- package/lib/commands/simply/aep/at4dx/platform-event-subscription/list.js.map +1 -0
- package/lib/commands/simply/aep/at4dx/platform-event-subscription/simulate.d.ts +27 -0
- package/lib/commands/simply/aep/at4dx/platform-event-subscription/simulate.js +148 -0
- package/lib/commands/simply/aep/at4dx/platform-event-subscription/simulate.js.map +1 -0
- package/lib/commands/simply/aep/at4dx/platform-event-subscription/validate.d.ts +26 -0
- package/lib/commands/simply/aep/at4dx/platform-event-subscription/validate.js +132 -0
- package/lib/commands/simply/aep/at4dx/platform-event-subscription/validate.js.map +1 -0
- package/messages/simply.aep.at4dx.platform-event-subscription.list.md +51 -0
- package/messages/simply.aep.at4dx.platform-event-subscription.simulate.md +75 -0
- package/messages/simply.aep.at4dx.platform-event-subscription.validate.md +55 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -34,6 +34,9 @@ This package is part of the [`@simplysf/simply`](https://github.com/SimplySF/sim
|
|
|
34
34
|
- [`sf simply aep at4dx field-set-inclusion list`](#sf-simply-aep-at4dx-field-set-inclusion-list)
|
|
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
|
+
- [`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)
|
|
39
|
+
- [`sf simply aep at4dx platform-event-subscription validate`](#sf-simply-aep-at4dx-platform-event-subscription-validate)
|
|
37
40
|
|
|
38
41
|
## `sf simply aep at4dx binding create`
|
|
39
42
|
|
|
@@ -112,7 +115,7 @@ EXAMPLES
|
|
|
112
115
|
$ sf simply aep at4dx binding create --source-dir sfdx-source/core --type unit-of-work --developer-name Account_UOW --sobject Account --sequence 10
|
|
113
116
|
```
|
|
114
117
|
|
|
115
|
-
_See code: [lib/commands/simply/aep/at4dx/binding/create.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
118
|
+
_See code: [lib/commands/simply/aep/at4dx/binding/create.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.11.3/packages/simply-aep/lib/commands/simply/aep/at4dx/binding/create.js)_
|
|
116
119
|
|
|
117
120
|
## `sf simply aep at4dx binding list`
|
|
118
121
|
|
|
@@ -168,7 +171,7 @@ FLAG DESCRIPTIONS
|
|
|
168
171
|
Comma-separated list of binding types to include. If not specified, all four are included.
|
|
169
172
|
```
|
|
170
173
|
|
|
171
|
-
_See code: [lib/commands/simply/aep/at4dx/binding/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
174
|
+
_See code: [lib/commands/simply/aep/at4dx/binding/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.11.3/packages/simply-aep/lib/commands/simply/aep/at4dx/binding/list.js)_
|
|
172
175
|
|
|
173
176
|
## `sf simply aep at4dx binding update`
|
|
174
177
|
|
|
@@ -241,7 +244,7 @@ EXAMPLES
|
|
|
241
244
|
$ sf simply aep at4dx binding update --target-org myOrg --type unit-of-work --developer-name Account_UOW --sequence 20
|
|
242
245
|
```
|
|
243
246
|
|
|
244
|
-
_See code: [lib/commands/simply/aep/at4dx/binding/update.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
247
|
+
_See code: [lib/commands/simply/aep/at4dx/binding/update.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.11.3/packages/simply-aep/lib/commands/simply/aep/at4dx/binding/update.js)_
|
|
245
248
|
|
|
246
249
|
## `sf simply aep at4dx binding validate`
|
|
247
250
|
|
|
@@ -297,7 +300,7 @@ FLAG DESCRIPTIONS
|
|
|
297
300
|
Comma-separated list of binding types to include. If not specified, all four are included.
|
|
298
301
|
```
|
|
299
302
|
|
|
300
|
-
_See code: [lib/commands/simply/aep/at4dx/binding/validate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
303
|
+
_See code: [lib/commands/simply/aep/at4dx/binding/validate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.11.3/packages/simply-aep/lib/commands/simply/aep/at4dx/binding/validate.js)_
|
|
301
304
|
|
|
302
305
|
## `sf simply aep at4dx domain-process-binding create`
|
|
303
306
|
|
|
@@ -378,7 +381,7 @@ EXAMPLES
|
|
|
378
381
|
$ 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
|
|
379
382
|
```
|
|
380
383
|
|
|
381
|
-
_See code: [lib/commands/simply/aep/at4dx/domain-process-binding/create.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
384
|
+
_See code: [lib/commands/simply/aep/at4dx/domain-process-binding/create.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.11.3/packages/simply-aep/lib/commands/simply/aep/at4dx/domain-process-binding/create.js)_
|
|
382
385
|
|
|
383
386
|
## `sf simply aep at4dx domain-process-binding list`
|
|
384
387
|
|
|
@@ -424,7 +427,7 @@ EXAMPLES
|
|
|
424
427
|
$ sf simply aep at4dx domain-process-binding list --target-org myOrg --active-only --json
|
|
425
428
|
```
|
|
426
429
|
|
|
427
|
-
_See code: [lib/commands/simply/aep/at4dx/domain-process-binding/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
430
|
+
_See code: [lib/commands/simply/aep/at4dx/domain-process-binding/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.11.3/packages/simply-aep/lib/commands/simply/aep/at4dx/domain-process-binding/list.js)_
|
|
428
431
|
|
|
429
432
|
## `sf simply aep at4dx domain-process-binding update`
|
|
430
433
|
|
|
@@ -503,7 +506,7 @@ EXAMPLES
|
|
|
503
506
|
$ sf simply aep at4dx domain-process-binding update --target-org myOrg --developer-name Account_Before_Insert_Assign_Owner --class-to-inject AccountAssignOwnerActionV2
|
|
504
507
|
```
|
|
505
508
|
|
|
506
|
-
_See code: [lib/commands/simply/aep/at4dx/domain-process-binding/update.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
509
|
+
_See code: [lib/commands/simply/aep/at4dx/domain-process-binding/update.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.11.3/packages/simply-aep/lib/commands/simply/aep/at4dx/domain-process-binding/update.js)_
|
|
507
510
|
|
|
508
511
|
## `sf simply aep at4dx domain-process-binding validate`
|
|
509
512
|
|
|
@@ -556,7 +559,7 @@ EXAMPLES
|
|
|
556
559
|
$ sf simply aep at4dx domain-process-binding validate --target-org myOrg --json
|
|
557
560
|
```
|
|
558
561
|
|
|
559
|
-
_See code: [lib/commands/simply/aep/at4dx/domain-process-binding/validate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
562
|
+
_See code: [lib/commands/simply/aep/at4dx/domain-process-binding/validate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.11.3/packages/simply-aep/lib/commands/simply/aep/at4dx/domain-process-binding/validate.js)_
|
|
560
563
|
|
|
561
564
|
## `sf simply aep at4dx field-set-inclusion create`
|
|
562
565
|
|
|
@@ -614,7 +617,7 @@ EXAMPLES
|
|
|
614
617
|
$ sf simply aep at4dx field-set-inclusion create --target-org myOrg --developer-name ServiceResource_Skills --sobject ServiceResource --sobject-alternate --fieldset-name SkillFields
|
|
615
618
|
```
|
|
616
619
|
|
|
617
|
-
_See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/create.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
620
|
+
_See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/create.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.11.3/packages/simply-aep/lib/commands/simply/aep/at4dx/field-set-inclusion/create.js)_
|
|
618
621
|
|
|
619
622
|
## `sf simply aep at4dx field-set-inclusion list`
|
|
620
623
|
|
|
@@ -652,7 +655,7 @@ EXAMPLES
|
|
|
652
655
|
$ sf simply aep at4dx field-set-inclusion list --target-org myOrg --json
|
|
653
656
|
```
|
|
654
657
|
|
|
655
|
-
_See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
658
|
+
_See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.11.3/packages/simply-aep/lib/commands/simply/aep/at4dx/field-set-inclusion/list.js)_
|
|
656
659
|
|
|
657
660
|
## `sf simply aep at4dx field-set-inclusion update`
|
|
658
661
|
|
|
@@ -709,7 +712,7 @@ EXAMPLES
|
|
|
709
712
|
$ sf simply aep at4dx field-set-inclusion update --target-org myOrg --developer-name Account_Contact_Fields --fieldset-name ContactRelatedFieldsV2
|
|
710
713
|
```
|
|
711
714
|
|
|
712
|
-
_See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/update.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
715
|
+
_See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/update.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.11.3/packages/simply-aep/lib/commands/simply/aep/at4dx/field-set-inclusion/update.js)_
|
|
713
716
|
|
|
714
717
|
## `sf simply aep at4dx field-set-inclusion validate`
|
|
715
718
|
|
|
@@ -753,5 +756,148 @@ EXAMPLES
|
|
|
753
756
|
$ sf simply aep at4dx field-set-inclusion validate --target-org myOrg --json
|
|
754
757
|
```
|
|
755
758
|
|
|
756
|
-
_See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/validate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
759
|
+
_See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/validate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.11.3/packages/simply-aep/lib/commands/simply/aep/at4dx/field-set-inclusion/validate.js)_
|
|
760
|
+
|
|
761
|
+
## `sf simply aep at4dx platform-event-subscription list`
|
|
762
|
+
|
|
763
|
+
List the AT4DX Platform Event Distributor subscriptions configured in an org or local source.
|
|
764
|
+
|
|
765
|
+
```
|
|
766
|
+
USAGE
|
|
767
|
+
$ sf simply aep at4dx platform-event-subscription list [--json] [--flags-dir <value>] [-o <value>] [--api-version
|
|
768
|
+
<value>] [-d <value>...]
|
|
769
|
+
|
|
770
|
+
FLAGS
|
|
771
|
+
-d, --source-dir=<value>... One or more paths to directories containing Salesforce DX source. Use this for
|
|
772
|
+
local-source discovery.
|
|
773
|
+
-o, --target-org=<value> Username or alias of the org to read platform event subscriptions from. Use this for
|
|
774
|
+
live-org discovery.
|
|
775
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
776
|
+
|
|
777
|
+
GLOBAL FLAGS
|
|
778
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
779
|
+
--json Format output as json.
|
|
780
|
+
|
|
781
|
+
DESCRIPTION
|
|
782
|
+
List the AT4DX Platform Event Distributor subscriptions configured in an org or local source.
|
|
783
|
+
|
|
784
|
+
Reads `PlatformEvents_Subscription__mdt` — either from a live org or from local Salesforce DX source — and lists every
|
|
785
|
+
record found, grouped by event bus then category. Unlike `simply aep at4dx binding list`, there's no priority/winner
|
|
786
|
+
concept: every `IsActive__c: true` subscription for a matching event is invoked by the distributor, so this is a flat
|
|
787
|
+
table, not a resolved one. Exactly one of `--target-org` or `--source-dir` must be specified.
|
|
788
|
+
|
|
789
|
+
EXAMPLES
|
|
790
|
+
$ sf simply aep at4dx platform-event-subscription list --target-org myOrg
|
|
791
|
+
|
|
792
|
+
$ sf simply aep at4dx platform-event-subscription list --source-dir sfdx-source/core --source-dir sfdx-source/app
|
|
793
|
+
|
|
794
|
+
$ sf simply aep at4dx platform-event-subscription list --target-org myOrg --json
|
|
795
|
+
```
|
|
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)_
|
|
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
|
+
|
|
855
|
+
## `sf simply aep at4dx platform-event-subscription validate`
|
|
856
|
+
|
|
857
|
+
Validate the AT4DX Platform Event Distributor subscriptions configured in an org or local source, failing when a wiring problem is found.
|
|
858
|
+
|
|
859
|
+
```
|
|
860
|
+
USAGE
|
|
861
|
+
$ sf simply aep at4dx platform-event-subscription validate [--json] [--flags-dir <value>] [-o <value>] [--api-version
|
|
862
|
+
<value>] [-d <value>...]
|
|
863
|
+
|
|
864
|
+
FLAGS
|
|
865
|
+
-d, --source-dir=<value>... One or more paths to directories containing Salesforce DX source. Use this for
|
|
866
|
+
local-source discovery.
|
|
867
|
+
-o, --target-org=<value> Username or alias of the org to read platform event subscriptions from. Use this for
|
|
868
|
+
live-org discovery.
|
|
869
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
870
|
+
|
|
871
|
+
GLOBAL FLAGS
|
|
872
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
873
|
+
--json Format output as json.
|
|
874
|
+
|
|
875
|
+
DESCRIPTION
|
|
876
|
+
Validate the AT4DX Platform Event Distributor subscriptions configured in an org or local source, failing when a
|
|
877
|
+
wiring problem is found.
|
|
878
|
+
|
|
879
|
+
Reads `PlatformEvents_Subscription__mdt` — either from a live org or from local Salesforce DX source — and checks them
|
|
880
|
+
for problems `simply aep at4dx platform-event-subscription list` doesn't fail on: a blank or unrecognized
|
|
881
|
+
EventBus__c/Consumer__c/MatcherRule__c, a matcher rule that dereferences a blank match field (a real
|
|
882
|
+
NullPointerException risk at runtime), a MatchEventBus record the distributor's own pre-filter can never admit, an
|
|
883
|
+
event bus missing fields the distributor reads (only checked for a bus this command can see the field list of), two
|
|
884
|
+
records sharing a Consumer__c value (unique org-wide), and the same DeveloperName defined more than once. Exactly one
|
|
885
|
+
of `--target-org` or `--source-dir` must be specified.
|
|
886
|
+
|
|
887
|
+
Several of these problems fail silently at runtime in a real org — PlatformEventDistributor's consumer construction
|
|
888
|
+
only logs to System.debug on failure, and one malformed record can take down every subscription's DI module. Catching
|
|
889
|
+
them here, before deploy, is the whole point of this command.
|
|
890
|
+
|
|
891
|
+
Prints a table of every issue found. Exits non-zero when any issue is an error (a warning alone doesn't fail the
|
|
892
|
+
command) — use this in CI to gate on AT4DX platform event subscription wiring problems before they reach an org.
|
|
893
|
+
|
|
894
|
+
EXAMPLES
|
|
895
|
+
$ sf simply aep at4dx platform-event-subscription validate --target-org myOrg
|
|
896
|
+
|
|
897
|
+
$ sf simply aep at4dx platform-event-subscription validate --source-dir sfdx-source/core --source-dir sfdx-source/app
|
|
898
|
+
|
|
899
|
+
$ sf simply aep at4dx platform-event-subscription validate --target-org myOrg --json
|
|
900
|
+
```
|
|
901
|
+
|
|
902
|
+
_See code: [lib/commands/simply/aep/at4dx/platform-event-subscription/validate.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/validate.js)_
|
|
757
903
|
<!-- commandsstop -->
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { type At4dxPlatformEventSubscriptionListResult } from '@simplysf/simply-aep-core';
|
|
3
|
+
/**
|
|
4
|
+
* Lists the AT4DX Platform Event Distributor subscriptions (`PlatformEvents_Subscription__mdt`)
|
|
5
|
+
* configured in a target org or local DX source, grouped by event bus then category to match how
|
|
6
|
+
* `PlatformEventDistributor` itself scopes a subscription. Unlike `binding list`, there's no
|
|
7
|
+
* priority/winner concept — every active subscription for a matching event is invoked.
|
|
8
|
+
*/
|
|
9
|
+
export default class At4dxPlatformEventSubscriptionList extends SfCommand<At4dxPlatformEventSubscriptionListResult> {
|
|
10
|
+
static readonly summary: string;
|
|
11
|
+
static readonly description: string;
|
|
12
|
+
static readonly examples: string[];
|
|
13
|
+
static readonly flags: {
|
|
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
|
+
'source-dir': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
};
|
|
19
|
+
/** @returns The platform event subscription records found for the requested source, grouped by event bus then category. */
|
|
20
|
+
run(): Promise<At4dxPlatformEventSubscriptionListResult>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
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 { 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.list');
|
|
21
|
+
function toDisplayRow(record) {
|
|
22
|
+
return {
|
|
23
|
+
eventBus: record.eventBus,
|
|
24
|
+
eventCategory: record.eventCategory ?? '(no category)',
|
|
25
|
+
developerName: record.developerName,
|
|
26
|
+
consumer: record.consumer,
|
|
27
|
+
matcherRule: record.matcherRule,
|
|
28
|
+
active: String(record.isActive),
|
|
29
|
+
source: record.source,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Lists the AT4DX Platform Event Distributor subscriptions (`PlatformEvents_Subscription__mdt`)
|
|
34
|
+
* configured in a target org or local DX source, grouped by event bus then category to match how
|
|
35
|
+
* `PlatformEventDistributor` itself scopes a subscription. Unlike `binding list`, there's no
|
|
36
|
+
* priority/winner concept — every active subscription for a matching event is invoked.
|
|
37
|
+
*/
|
|
38
|
+
export default class At4dxPlatformEventSubscriptionList extends SfCommand {
|
|
39
|
+
static summary = messages.getMessage('summary');
|
|
40
|
+
static description = messages.getMessage('description');
|
|
41
|
+
static examples = messages.getMessages('examples');
|
|
42
|
+
static flags = {
|
|
43
|
+
...SfCommand.baseFlags,
|
|
44
|
+
'target-org': Flags.optionalOrg({
|
|
45
|
+
summary: messages.getMessage('flags.target-org.summary'),
|
|
46
|
+
char: 'o',
|
|
47
|
+
}),
|
|
48
|
+
'api-version': Flags.orgApiVersion(),
|
|
49
|
+
'source-dir': Flags.directory({
|
|
50
|
+
summary: messages.getMessage('flags.source-dir.summary'),
|
|
51
|
+
char: 'd',
|
|
52
|
+
exists: true,
|
|
53
|
+
multiple: true,
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
/** @returns The platform event subscription records found for the requested source, grouped by event bus then category. */
|
|
57
|
+
async run() {
|
|
58
|
+
const { flags } = await this.parse(At4dxPlatformEventSubscriptionList);
|
|
59
|
+
const targetOrg = flags['target-org'];
|
|
60
|
+
const sourceDirs = flags['source-dir'] ?? [];
|
|
61
|
+
if ((targetOrg && sourceDirs.length > 0) || (!targetOrg && sourceDirs.length === 0)) {
|
|
62
|
+
throw messages.createError('error.targetOrgOrSourceDirRequired');
|
|
63
|
+
}
|
|
64
|
+
let source;
|
|
65
|
+
let records;
|
|
66
|
+
if (targetOrg) {
|
|
67
|
+
const connection = targetOrg.getConnection(flags['api-version']);
|
|
68
|
+
source = targetOrg.getUsername() ?? 'org';
|
|
69
|
+
this.spinner.start(messages.getMessage('info.queryingOrg', [source]));
|
|
70
|
+
let scanResult;
|
|
71
|
+
try {
|
|
72
|
+
scanResult = await scanOrgPlatformEventSubscriptions(connection);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
this.spinner.stop();
|
|
76
|
+
throw messages.createError('error.orgQueryFailed', [error.message]);
|
|
77
|
+
}
|
|
78
|
+
this.spinner.stop();
|
|
79
|
+
if (scanResult.missing) {
|
|
80
|
+
throw messages.createError('error.at4dxNotDetected');
|
|
81
|
+
}
|
|
82
|
+
records = scanResult.records;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
source = 'local';
|
|
86
|
+
this.spinner.start(messages.getMessage('info.scanningLocalSource'));
|
|
87
|
+
let scanResult;
|
|
88
|
+
try {
|
|
89
|
+
scanResult = scanLocalPlatformEventSubscriptions(sourceDirs);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
this.spinner.stop();
|
|
93
|
+
throw messages.createError('error.localScanFailed', [error.message]);
|
|
94
|
+
}
|
|
95
|
+
this.spinner.stop();
|
|
96
|
+
if (scanResult.records.length === 0 && scanResult.malformed.length === 0) {
|
|
97
|
+
throw messages.createError('error.at4dxNotDetected');
|
|
98
|
+
}
|
|
99
|
+
records = scanResult.records;
|
|
100
|
+
}
|
|
101
|
+
const sorted = [...records].sort((a, b) => a.eventBus.localeCompare(b.eventBus) ||
|
|
102
|
+
(a.eventCategory ?? '').localeCompare(b.eventCategory ?? '') ||
|
|
103
|
+
a.developerName.localeCompare(b.developerName));
|
|
104
|
+
this.table({
|
|
105
|
+
data: sorted.map(toDisplayRow),
|
|
106
|
+
columns: [
|
|
107
|
+
{ key: 'eventBus', name: 'EVENT BUS' },
|
|
108
|
+
{ key: 'eventCategory', name: 'CATEGORY' },
|
|
109
|
+
{ key: 'developerName', name: 'DEVELOPER NAME' },
|
|
110
|
+
{ key: 'consumer', name: 'CONSUMER' },
|
|
111
|
+
{ key: 'matcherRule', name: 'MATCHER RULE' },
|
|
112
|
+
{ key: 'active', name: 'ACTIVE' },
|
|
113
|
+
{ key: 'source', name: 'SOURCE' },
|
|
114
|
+
],
|
|
115
|
+
});
|
|
116
|
+
this.info(messages.getMessage('info.complete', [records.length, source]));
|
|
117
|
+
return { source, records };
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../../../src/commands/simply/aep/at4dx/platform-event-subscription/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,mCAAmC,EACnC,iCAAiC,GAGlC,MAAM,2BAA2B,CAAC;AAEnC,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,sBAAsB,EAAE,mDAAmD,CAAC,CAAC;AAapH,SAAS,YAAY,CAAC,MAA0C;IAC9D,OAAO;QACL,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,eAAe;QACtD,aAAa,EAAE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Aa,EAAE,IAAI,EAAE,cAAc,EAAE;gBAC5C,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACjC,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,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QAE1E,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC7B,CAAC"}
|
|
@@ -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,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,gCAAgC,EAChC,mCAAmC,EACnC,iCAAiC,GAKlC,MAAM,2BAA2B,CAAC;AAEnC,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,sBAAsB,EAAE,uDAAuD,CAAC,CAAC;AASxH,SAAS,iBAAiB,CAAC,KAAqC;IAC9D,OAAO;QACL,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,kBAAkB,EAAE,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC;QACpD,MAAM,EAAE,KAAK,CAAC,MAAM;KACrB,CAAC;AACJ,CAAC;AASD,SAAS,gBAAgB,CAAC,IAAmC;IAC3D,OAAO;QACL,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,MAAM,EAAE,IAAI,CAAC,MAAM;KACpB,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,sCAAuC,SAAQ,SAA0C;IACrG,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAA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AAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;YACxD,IAAI,CAAC,KAAK,CAAC;gBACT,IAAI,EAAE,MAAM,CAAC,MAAM,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,26 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { type At4dxPlatformEventSubscriptionValidateResult } from '@simplysf/simply-aep-core';
|
|
3
|
+
/**
|
|
4
|
+
* Validates the AT4DX Platform Event Distributor subscriptions (`PlatformEvents_Subscription__mdt`)
|
|
5
|
+
* configured in a target org or local DX source — wiring problems that are invisible to
|
|
6
|
+
* `platform-event-subscription list`, several of which fail silently at runtime by design (see
|
|
7
|
+
* docs/design/0025's Problem section) — and fails (non-zero exit) when any of them is a real bug, for
|
|
8
|
+
* use as a CI gate.
|
|
9
|
+
*
|
|
10
|
+
* `non-conforming-event-bus` only fires for an event bus this command can actually see the field list
|
|
11
|
+
* of (a `<Bus>__e` object in the same `--source-dir` scope, for a local run) — a bus it can't see is
|
|
12
|
+
* treated as "not looked at", not "broken".
|
|
13
|
+
*/
|
|
14
|
+
export default class At4dxPlatformEventSubscriptionValidate extends SfCommand<At4dxPlatformEventSubscriptionValidateResult> {
|
|
15
|
+
static readonly summary: string;
|
|
16
|
+
static readonly description: string;
|
|
17
|
+
static readonly examples: string[];
|
|
18
|
+
static readonly flags: {
|
|
19
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
'source-dir': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
};
|
|
24
|
+
/** @returns The validation issues found for the requested source. Sets `process.exitCode = 1` when any issue is severity `error`. */
|
|
25
|
+
run(): Promise<At4dxPlatformEventSubscriptionValidateResult>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
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 { scanLocalPlatformEventSubscriptions, scanOrgPlatformEventSubscriptions, validatePlatformEventSubscriptions, } 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.validate');
|
|
21
|
+
function toDisplayRow(issue) {
|
|
22
|
+
return {
|
|
23
|
+
severity: issue.severity,
|
|
24
|
+
rule: issue.rule,
|
|
25
|
+
eventBus: issue.eventBus ?? '',
|
|
26
|
+
developerName: issue.developerName ?? '',
|
|
27
|
+
source: issue.source,
|
|
28
|
+
message: issue.message,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const ISSUE_TABLE_COLUMNS = [
|
|
32
|
+
{ key: 'severity', name: 'SEVERITY' },
|
|
33
|
+
{ key: 'rule', name: 'RULE' },
|
|
34
|
+
{ key: 'eventBus', name: 'EVENT BUS' },
|
|
35
|
+
{ key: 'developerName', name: 'DEVELOPER NAME' },
|
|
36
|
+
{ key: 'source', name: 'SOURCE' },
|
|
37
|
+
{ key: 'message', name: 'MESSAGE' },
|
|
38
|
+
];
|
|
39
|
+
/**
|
|
40
|
+
* Validates the AT4DX Platform Event Distributor subscriptions (`PlatformEvents_Subscription__mdt`)
|
|
41
|
+
* configured in a target org or local DX source — wiring problems that are invisible to
|
|
42
|
+
* `platform-event-subscription list`, several of which fail silently at runtime by design (see
|
|
43
|
+
* docs/design/0025's Problem section) — and fails (non-zero exit) when any of them is a real bug, for
|
|
44
|
+
* use as a CI gate.
|
|
45
|
+
*
|
|
46
|
+
* `non-conforming-event-bus` only fires for an event bus this command can actually see the field list
|
|
47
|
+
* of (a `<Bus>__e` object in the same `--source-dir` scope, for a local run) — a bus it can't see is
|
|
48
|
+
* treated as "not looked at", not "broken".
|
|
49
|
+
*/
|
|
50
|
+
export default class At4dxPlatformEventSubscriptionValidate extends SfCommand {
|
|
51
|
+
static summary = messages.getMessage('summary');
|
|
52
|
+
static description = messages.getMessage('description');
|
|
53
|
+
static examples = messages.getMessages('examples');
|
|
54
|
+
static flags = {
|
|
55
|
+
...SfCommand.baseFlags,
|
|
56
|
+
'target-org': Flags.optionalOrg({
|
|
57
|
+
summary: messages.getMessage('flags.target-org.summary'),
|
|
58
|
+
char: 'o',
|
|
59
|
+
}),
|
|
60
|
+
'api-version': Flags.orgApiVersion(),
|
|
61
|
+
'source-dir': Flags.directory({
|
|
62
|
+
summary: messages.getMessage('flags.source-dir.summary'),
|
|
63
|
+
char: 'd',
|
|
64
|
+
exists: true,
|
|
65
|
+
multiple: true,
|
|
66
|
+
}),
|
|
67
|
+
};
|
|
68
|
+
/** @returns The validation issues found for the requested source. Sets `process.exitCode = 1` when any issue is severity `error`. */
|
|
69
|
+
async run() {
|
|
70
|
+
const { flags } = await this.parse(At4dxPlatformEventSubscriptionValidate);
|
|
71
|
+
const targetOrg = flags['target-org'];
|
|
72
|
+
const sourceDirs = flags['source-dir'] ?? [];
|
|
73
|
+
if ((targetOrg && sourceDirs.length > 0) || (!targetOrg && sourceDirs.length === 0)) {
|
|
74
|
+
throw messages.createError('error.targetOrgOrSourceDirRequired');
|
|
75
|
+
}
|
|
76
|
+
let source;
|
|
77
|
+
let recordCount;
|
|
78
|
+
let issues;
|
|
79
|
+
if (targetOrg) {
|
|
80
|
+
const connection = targetOrg.getConnection(flags['api-version']);
|
|
81
|
+
source = targetOrg.getUsername() ?? 'org';
|
|
82
|
+
this.spinner.start(messages.getMessage('info.queryingOrg', [source]));
|
|
83
|
+
let scanResult;
|
|
84
|
+
try {
|
|
85
|
+
scanResult = await scanOrgPlatformEventSubscriptions(connection);
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
this.spinner.stop();
|
|
89
|
+
throw messages.createError('error.orgQueryFailed', [error.message]);
|
|
90
|
+
}
|
|
91
|
+
this.spinner.stop();
|
|
92
|
+
if (scanResult.missing) {
|
|
93
|
+
throw messages.createError('error.at4dxNotDetected');
|
|
94
|
+
}
|
|
95
|
+
recordCount = scanResult.records.length;
|
|
96
|
+
// Org-side event-bus-field discovery (describe) isn't wired up in this stage — non-conforming-event-bus
|
|
97
|
+
// is silent for every bus on an org-connected run until that lands. See docs/design/0025.
|
|
98
|
+
issues = validatePlatformEventSubscriptions(scanResult);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
source = 'local';
|
|
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
|
+
recordCount = scanResult.records.length;
|
|
116
|
+
// Local event-bus-field discovery (reading objects/<Bus>__e/fields/) isn't wired up in this
|
|
117
|
+
// stage either — same caveat as the org path above.
|
|
118
|
+
issues = validatePlatformEventSubscriptions(scanResult);
|
|
119
|
+
}
|
|
120
|
+
if (issues.length > 0) {
|
|
121
|
+
this.table({ data: issues.map(toDisplayRow), columns: ISSUE_TABLE_COLUMNS });
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
this.info(messages.getMessage('info.valid', [recordCount, source]));
|
|
125
|
+
}
|
|
126
|
+
if (issues.some((issue) => issue.severity === 'error')) {
|
|
127
|
+
process.exitCode = 1;
|
|
128
|
+
}
|
|
129
|
+
return { source, recordCount, issues };
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../../../src/commands/simply/aep/at4dx/platform-event-subscription/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,S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AAK,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzE,MAAM,QAAQ,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;YACvD,CAAC;YAED,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC;YACxC,4FAA4F;YAC5F,oDAAoD;YACpD,MAAM,GAAG,kCAAkC,CAAC,UAAU,CAAC,CAAC;QAC1D,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC;QAC/E,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QACtE,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,OAAO,CAAC,EAAE,CAAC;YACvD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;IACzC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
List the AT4DX Platform Event Distributor subscriptions configured in an org or local source.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Reads `PlatformEvents_Subscription__mdt` — either from a live org or from local Salesforce DX source — and lists every record found, grouped by event bus then category. Unlike `simply aep at4dx binding list`, there's no priority/winner concept: every `IsActive__c: true` subscription for a matching event is invoked by the distributor, so this is a flat table, not a resolved one. Exactly one of `--target-org` or `--source-dir` must be specified.
|
|
8
|
+
|
|
9
|
+
# flags.target-org.summary
|
|
10
|
+
|
|
11
|
+
Username or alias of the org to read platform event subscriptions from. Use this for live-org discovery.
|
|
12
|
+
|
|
13
|
+
# flags.source-dir.summary
|
|
14
|
+
|
|
15
|
+
One or more paths to directories containing Salesforce DX source. Use this for local-source discovery.
|
|
16
|
+
|
|
17
|
+
# examples
|
|
18
|
+
|
|
19
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg
|
|
20
|
+
|
|
21
|
+
- <%= config.bin %> <%= command.id %> --source-dir sfdx-source/core --source-dir sfdx-source/app
|
|
22
|
+
|
|
23
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg --json
|
|
24
|
+
|
|
25
|
+
# error.targetOrgOrSourceDirRequired
|
|
26
|
+
|
|
27
|
+
You must specify either --target-org or --source-dir, but not both.
|
|
28
|
+
|
|
29
|
+
# error.at4dxNotDetected
|
|
30
|
+
|
|
31
|
+
AT4DX doesn't appear to be present in this source: the PlatformEvents_Subscription__mdt Custom Metadata Type wasn't found.
|
|
32
|
+
|
|
33
|
+
# error.localScanFailed
|
|
34
|
+
|
|
35
|
+
Failed to scan the project directory: %s
|
|
36
|
+
|
|
37
|
+
# error.orgQueryFailed
|
|
38
|
+
|
|
39
|
+
Failed to query platform event subscriptions from the org: %s
|
|
40
|
+
|
|
41
|
+
# info.queryingOrg
|
|
42
|
+
|
|
43
|
+
Querying platform event subscriptions from %s...
|
|
44
|
+
|
|
45
|
+
# info.scanningLocalSource
|
|
46
|
+
|
|
47
|
+
Scanning local source for platform event subscriptions...
|
|
48
|
+
|
|
49
|
+
# info.complete
|
|
50
|
+
|
|
51
|
+
Found %s platform event subscription(s) in %s
|
|
@@ -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
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Validate the AT4DX Platform Event Distributor subscriptions configured in an org or local source, failing when a wiring problem is found.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Reads `PlatformEvents_Subscription__mdt` — either from a live org or from local Salesforce DX source — and checks them for problems `simply aep at4dx platform-event-subscription list` doesn't fail on: a blank or unrecognized EventBus__c/Consumer__c/MatcherRule__c, a matcher rule that dereferences a blank match field (a real NullPointerException risk at runtime), a MatchEventBus record the distributor's own pre-filter can never admit, an event bus missing fields the distributor reads (only checked for a bus this command can see the field list of), two records sharing a Consumer__c value (unique org-wide), and the same DeveloperName defined more than once. Exactly one of `--target-org` or `--source-dir` must be specified.
|
|
8
|
+
|
|
9
|
+
Several of these problems fail silently at runtime in a real org — PlatformEventDistributor's consumer construction only logs to System.debug on failure, and one malformed record can take down every subscription's DI module. Catching them here, before deploy, is the whole point of this command.
|
|
10
|
+
|
|
11
|
+
Prints a table of every issue found. Exits non-zero when any issue is an error (a warning alone doesn't fail the command) — use this in CI to gate on AT4DX platform event subscription wiring problems before they reach an org.
|
|
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
|
+
# examples
|
|
22
|
+
|
|
23
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg
|
|
24
|
+
|
|
25
|
+
- <%= config.bin %> <%= command.id %> --source-dir sfdx-source/core --source-dir sfdx-source/app
|
|
26
|
+
|
|
27
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg --json
|
|
28
|
+
|
|
29
|
+
# error.targetOrgOrSourceDirRequired
|
|
30
|
+
|
|
31
|
+
You must specify either --target-org or --source-dir, but not both.
|
|
32
|
+
|
|
33
|
+
# error.at4dxNotDetected
|
|
34
|
+
|
|
35
|
+
AT4DX doesn't appear to be present in this source: the PlatformEvents_Subscription__mdt Custom Metadata Type wasn't found.
|
|
36
|
+
|
|
37
|
+
# error.localScanFailed
|
|
38
|
+
|
|
39
|
+
Failed to scan the project directory: %s
|
|
40
|
+
|
|
41
|
+
# error.orgQueryFailed
|
|
42
|
+
|
|
43
|
+
Failed to query platform event subscriptions from the org: %s
|
|
44
|
+
|
|
45
|
+
# info.queryingOrg
|
|
46
|
+
|
|
47
|
+
Querying platform event subscriptions from %s...
|
|
48
|
+
|
|
49
|
+
# info.scanningLocalSource
|
|
50
|
+
|
|
51
|
+
Scanning local source for platform event subscriptions...
|
|
52
|
+
|
|
53
|
+
# info.valid
|
|
54
|
+
|
|
55
|
+
No issues found across %s platform event subscription(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.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.
|
|
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": "
|
|
200
|
+
"gitHead": "7f496b64726ad7a7ed93b350bd419dc68cc87898"
|
|
201
201
|
}
|