@simplysf/simply-aep 0.12.0 → 0.14.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
@@ -34,7 +34,10 @@ 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 create`](#sf-simply-aep-at4dx-platform-event-subscription-create)
37
38
  - [`sf simply aep at4dx platform-event-subscription list`](#sf-simply-aep-at4dx-platform-event-subscription-list)
39
+ - [`sf simply aep at4dx platform-event-subscription simulate`](#sf-simply-aep-at4dx-platform-event-subscription-simulate)
40
+ - [`sf simply aep at4dx platform-event-subscription update`](#sf-simply-aep-at4dx-platform-event-subscription-update)
38
41
  - [`sf simply aep at4dx platform-event-subscription validate`](#sf-simply-aep-at4dx-platform-event-subscription-validate)
39
42
 
40
43
  ## `sf simply aep at4dx binding create`
@@ -114,7 +117,7 @@ EXAMPLES
114
117
  $ sf simply aep at4dx binding create --source-dir sfdx-source/core --type unit-of-work --developer-name Account_UOW --sobject Account --sequence 10
115
118
  ```
116
119
 
117
- _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)_
120
+ _See code: [lib/commands/simply/aep/at4dx/binding/create.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.12.0/packages/simply-aep/lib/commands/simply/aep/at4dx/binding/create.js)_
118
121
 
119
122
  ## `sf simply aep at4dx binding list`
120
123
 
@@ -170,7 +173,7 @@ FLAG DESCRIPTIONS
170
173
  Comma-separated list of binding types to include. If not specified, all four are included.
171
174
  ```
172
175
 
173
- _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)_
176
+ _See code: [lib/commands/simply/aep/at4dx/binding/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.12.0/packages/simply-aep/lib/commands/simply/aep/at4dx/binding/list.js)_
174
177
 
175
178
  ## `sf simply aep at4dx binding update`
176
179
 
@@ -243,7 +246,7 @@ EXAMPLES
243
246
  $ sf simply aep at4dx binding update --target-org myOrg --type unit-of-work --developer-name Account_UOW --sequence 20
244
247
  ```
245
248
 
246
- _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)_
249
+ _See code: [lib/commands/simply/aep/at4dx/binding/update.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.12.0/packages/simply-aep/lib/commands/simply/aep/at4dx/binding/update.js)_
247
250
 
248
251
  ## `sf simply aep at4dx binding validate`
249
252
 
@@ -299,7 +302,7 @@ FLAG DESCRIPTIONS
299
302
  Comma-separated list of binding types to include. If not specified, all four are included.
300
303
  ```
301
304
 
302
- _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)_
305
+ _See code: [lib/commands/simply/aep/at4dx/binding/validate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.12.0/packages/simply-aep/lib/commands/simply/aep/at4dx/binding/validate.js)_
303
306
 
304
307
  ## `sf simply aep at4dx domain-process-binding create`
305
308
 
@@ -380,7 +383,7 @@ EXAMPLES
380
383
  $ 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
381
384
  ```
382
385
 
383
- _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)_
386
+ _See code: [lib/commands/simply/aep/at4dx/domain-process-binding/create.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.12.0/packages/simply-aep/lib/commands/simply/aep/at4dx/domain-process-binding/create.js)_
384
387
 
385
388
  ## `sf simply aep at4dx domain-process-binding list`
386
389
 
@@ -426,7 +429,7 @@ EXAMPLES
426
429
  $ sf simply aep at4dx domain-process-binding list --target-org myOrg --active-only --json
427
430
  ```
428
431
 
429
- _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)_
432
+ _See code: [lib/commands/simply/aep/at4dx/domain-process-binding/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.12.0/packages/simply-aep/lib/commands/simply/aep/at4dx/domain-process-binding/list.js)_
430
433
 
431
434
  ## `sf simply aep at4dx domain-process-binding update`
432
435
 
@@ -505,7 +508,7 @@ EXAMPLES
505
508
  $ sf simply aep at4dx domain-process-binding update --target-org myOrg --developer-name Account_Before_Insert_Assign_Owner --class-to-inject AccountAssignOwnerActionV2
506
509
  ```
507
510
 
508
- _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)_
511
+ _See code: [lib/commands/simply/aep/at4dx/domain-process-binding/update.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.12.0/packages/simply-aep/lib/commands/simply/aep/at4dx/domain-process-binding/update.js)_
509
512
 
510
513
  ## `sf simply aep at4dx domain-process-binding validate`
511
514
 
@@ -558,7 +561,7 @@ EXAMPLES
558
561
  $ sf simply aep at4dx domain-process-binding validate --target-org myOrg --json
559
562
  ```
560
563
 
561
- _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)_
564
+ _See code: [lib/commands/simply/aep/at4dx/domain-process-binding/validate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.12.0/packages/simply-aep/lib/commands/simply/aep/at4dx/domain-process-binding/validate.js)_
562
565
 
563
566
  ## `sf simply aep at4dx field-set-inclusion create`
564
567
 
@@ -616,7 +619,7 @@ EXAMPLES
616
619
  $ sf simply aep at4dx field-set-inclusion create --target-org myOrg --developer-name ServiceResource_Skills --sobject ServiceResource --sobject-alternate --fieldset-name SkillFields
617
620
  ```
618
621
 
619
- _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)_
622
+ _See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/create.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.12.0/packages/simply-aep/lib/commands/simply/aep/at4dx/field-set-inclusion/create.js)_
620
623
 
621
624
  ## `sf simply aep at4dx field-set-inclusion list`
622
625
 
@@ -654,7 +657,7 @@ EXAMPLES
654
657
  $ sf simply aep at4dx field-set-inclusion list --target-org myOrg --json
655
658
  ```
656
659
 
657
- _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)_
660
+ _See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.12.0/packages/simply-aep/lib/commands/simply/aep/at4dx/field-set-inclusion/list.js)_
658
661
 
659
662
  ## `sf simply aep at4dx field-set-inclusion update`
660
663
 
@@ -711,7 +714,7 @@ EXAMPLES
711
714
  $ sf simply aep at4dx field-set-inclusion update --target-org myOrg --developer-name Account_Contact_Fields --fieldset-name ContactRelatedFieldsV2
712
715
  ```
713
716
 
714
- _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)_
717
+ _See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/update.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.12.0/packages/simply-aep/lib/commands/simply/aep/at4dx/field-set-inclusion/update.js)_
715
718
 
716
719
  ## `sf simply aep at4dx field-set-inclusion validate`
717
720
 
@@ -755,7 +758,77 @@ EXAMPLES
755
758
  $ sf simply aep at4dx field-set-inclusion validate --target-org myOrg --json
756
759
  ```
757
760
 
758
- _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)_
761
+ _See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/validate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.12.0/packages/simply-aep/lib/commands/simply/aep/at4dx/field-set-inclusion/validate.js)_
762
+
763
+ ## `sf simply aep at4dx platform-event-subscription create`
764
+
765
+ Create a new AT4DX Platform Event Distributor subscription (PlatformEvents_Subscription__mdt) in local source and/or a connected org.
766
+
767
+ ```
768
+ USAGE
769
+ $ sf simply aep at4dx platform-event-subscription create -n <value> --event-bus <value> --consumer <value> --matcher-rule
770
+ MatchEventBus|MatchCategory|MatchEvent|MatchCategoryAndEvent [--json] [--flags-dir <value>] [-d <value>] [-o
771
+ <value>] [--api-version <value>] [--wait <value>] [--label <value>] [--event-category <value>] [--event-name
772
+ <value>] [--active] [--synchronous] [--force]
773
+
774
+ FLAGS
775
+ -d, --source-dir=<value> The package directory to create the platform event subscription's .md-meta.xml under.
776
+ Created if the customMetadata folder doesn't exist yet.
777
+ -n, --developer-name=<value> (required) The record's DeveloperName. Must start with a letter, contain only letters,
778
+ numbers, and single underscores, not end with an underscore, and be 40 characters or
779
+ fewer.
780
+ -o, --target-org=<value> Deploy the generated platform event subscription to this org after writing it.
781
+ --[no-]active IsActive__c. Defaults to true, matching the Custom Metadata Type's own default. Pass
782
+ --no-active to create it inactive.
783
+ --api-version=<value> Override the api version used for api requests made by this command
784
+ --consumer=<value> (required) Consumer__c — the IEventsConsumer-implementing Apex class name. Unique
785
+ org-wide across every subscription.
786
+ --event-bus=<value> (required) EventBus__c — the platform event object API name this subscription registers
787
+ against, e.g. My_Event__e.
788
+ --event-category=<value> EventCategory__c. Required when --matcher-rule is MatchCategory or MatchCategoryAndEvent
789
+ — leaving it blank for those raises matcher-rule-missing-field.
790
+ --event-name=<value> Event__c. Required when --matcher-rule is MatchEvent or MatchCategoryAndEvent — leaving
791
+ it blank for those raises matcher-rule-missing-field.
792
+ --force Write (and deploy) even if validation finds an error-severity issue. Validation still
793
+ runs and its issues are still printed and returned.
794
+ --label=<value> The record's label. Defaults to --developer-name. Must be 40 characters or fewer.
795
+ --matcher-rule=<option> (required) MatcherRule__c — which of --event-category/--event-name the distributor's
796
+ matcher dereferences for this subscription. One of MatchEventBus, MatchCategory,
797
+ MatchEvent, MatchCategoryAndEvent.
798
+ <options: MatchEventBus|MatchCategory|MatchEvent|MatchCategoryAndEvent>
799
+ --[no-]synchronous Execute_Synchronous__c. Defaults to false. Pass --synchronous to have the distributor
800
+ invoke this consumer synchronously.
801
+ --wait=<value> [default: 33] Deploy poll timeout, in minutes. Only meaningful with --target-org.
802
+
803
+ GLOBAL FLAGS
804
+ --flags-dir=<value> Import flag values from a directory.
805
+ --json Format output as json.
806
+
807
+ DESCRIPTION
808
+ Create a new AT4DX Platform Event Distributor subscription (PlatformEvents_Subscription__mdt) in local source and/or a
809
+ connected org.
810
+
811
+ Generates a `PlatformEvents_Subscription.<DeveloperName>.md-meta.xml` file from the given flags and writes it under
812
+ --source-dir, deploys it to --target-org, or both. Validates the resulting record — alongside everything else already
813
+ in scope — with the same rules `simply aep at4dx platform-event-subscription validate` uses, and refuses to write if
814
+ that introduces an error-severity issue unless --force is passed. At least one of --source-dir/--target-org is
815
+ required; both may be given at once (write to source and deploy it live in the same run). Given --target-org alone,
816
+ the file is written to a temporary directory, deployed, and discarded — no working-tree footprint.
817
+
818
+ --matcher-rule controls which of --event-category/--event-name the distributor's matcher dereferences for this
819
+ subscription: MatchEventBus dereferences neither (the whole bus matches, once a category or event name gets it past
820
+ the distributor's pre-filter — see `simply aep at4dx platform-event-subscription validate`'s unreachable-subscription
821
+ rule for why at least one should usually be set anyway), MatchCategory requires --event-category, MatchEvent requires
822
+ --event-name, and MatchCategoryAndEvent requires both. Leaving the field a MatcherRule needs blank is exactly the
823
+ matcher-rule-missing-field hazard validation catches — see that command's description for why it matters at runtime.
824
+
825
+ EXAMPLES
826
+ $ sf simply aep at4dx platform-event-subscription create --source-dir sfdx-source/core --developer-name Account_Change_Subscriber --event-bus Account_Change__e --consumer AccountChangeConsumer --matcher-rule MatchCategory --event-category Finance
827
+
828
+ $ sf simply aep at4dx platform-event-subscription create --target-org myOrg --developer-name Account_Change_Subscriber --event-bus Account_Change__e --consumer AccountChangeConsumer --matcher-rule MatchCategoryAndEvent --event-category Finance --event-name AccountUpdated
829
+ ```
830
+
831
+ _See code: [lib/commands/simply/aep/at4dx/platform-event-subscription/create.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.12.0/packages/simply-aep/lib/commands/simply/aep/at4dx/platform-event-subscription/create.js)_
759
832
 
760
833
  ## `sf simply aep at4dx platform-event-subscription list`
761
834
 
@@ -793,7 +866,131 @@ EXAMPLES
793
866
  $ sf simply aep at4dx platform-event-subscription list --target-org myOrg --json
794
867
  ```
795
868
 
796
- _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)_
869
+ _See code: [lib/commands/simply/aep/at4dx/platform-event-subscription/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.12.0/packages/simply-aep/lib/commands/simply/aep/at4dx/platform-event-subscription/list.js)_
870
+
871
+ ## `sf simply aep at4dx platform-event-subscription simulate`
872
+
873
+ 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.
874
+
875
+ ```
876
+ USAGE
877
+ $ sf simply aep at4dx platform-event-subscription simulate --event-bus <value> [--json] [--flags-dir <value>] [-o <value>] [--api-version <value>] [-d
878
+ <value>...] [--category <value>] [--event-name <value>]
879
+
880
+ FLAGS
881
+ -d, --source-dir=<value>... One or more paths to directories containing Salesforce DX source. Use this for
882
+ local-source discovery.
883
+ -o, --target-org=<value> Username or alias of the org to read platform event subscriptions from. Use this for
884
+ live-org discovery.
885
+ --api-version=<value> Override the api version used for api requests made by this command
886
+ --category=<value> The hypothetical event's Category__c value. Omit to simulate an event with no category.
887
+ --event-bus=<value> (required) The platform event object API name (EventBus__c) of the hypothetical event to
888
+ simulate, e.g. My_Event__e.
889
+ --event-name=<value> The hypothetical event's EventName__c value. Omit to simulate an event with no event
890
+ name.
891
+
892
+ GLOBAL FLAGS
893
+ --flags-dir=<value> Import flag values from a directory.
894
+ --json Format output as json.
895
+
896
+ DESCRIPTION
897
+ Simulate the AT4DX Platform Event Distributor's consumer resolution for a hypothetical event, and show which
898
+ subscriptions would receive it and why the rest wouldn't.
899
+
900
+ Reads `PlatformEvents_Subscription__mdt` — either from a live org or from local Salesforce DX source — and
901
+ reimplements `PlatformEventDistributor`'s decision sequence against a hypothetical event you describe with
902
+ `--event-bus`, `--category`, and `--event-name`: restrict to subscriptions on that bus, drop inactive records the
903
+ distributor's own query never loads, apply `triggerHandler`'s pre-filter, then each record's `MatcherRule__c` branch.
904
+ Exactly one of `--target-org` or `--source-dir` must be specified.
905
+
906
+ Prints the exact consumer set the distributor would build, in order, tagged synchronous or asynchronous from
907
+ `Execute_Synchronous__c`, plus every subscription on that bus that would _not_ receive the event and the structured
908
+ reason why: `inactive`, `prefiltered` (the pre-filter rejected it before any matcher rule ran),
909
+ `matcher-rule-missing-field` (the matcher rule dereferences a blank match field — a real NullPointerException in the
910
+ org), or `no-match` (every field the matcher rule needs is present, but the values don't match this event).
911
+
912
+ This is the same evaluation `simply aep at4dx platform-event-subscription validate` uses to derive
913
+ `matcher-rule-missing-field` and `unreachable-subscription` — running it here against a concrete hypothetical event is
914
+ how you confirm a subscription actually receives what you expect it to, beyond what `validate`'s static checks can
915
+ tell you.
916
+
917
+ EXAMPLES
918
+ $ sf simply aep at4dx platform-event-subscription simulate --target-org myOrg --event-bus Account_Change__e --category Finance --event-name AccountUpdated
919
+
920
+ $ sf simply aep at4dx platform-event-subscription simulate --source-dir sfdx-source/core --event-bus Account_Change__e --event-name AccountUpdated
921
+
922
+ $ sf simply aep at4dx platform-event-subscription simulate --target-org myOrg --event-bus Account_Change__e --json
923
+ ```
924
+
925
+ _See code: [lib/commands/simply/aep/at4dx/platform-event-subscription/simulate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.12.0/packages/simply-aep/lib/commands/simply/aep/at4dx/platform-event-subscription/simulate.js)_
926
+
927
+ ## `sf simply aep at4dx platform-event-subscription update`
928
+
929
+ Update an existing AT4DX Platform Event Distributor subscription (PlatformEvents_Subscription__mdt) in local source and/or a connected org.
930
+
931
+ ```
932
+ USAGE
933
+ $ sf simply aep at4dx platform-event-subscription update -n <value> [--json] [--flags-dir <value>] [-d <value>...] [-o <value>] [--api-version <value>]
934
+ [--wait <value>] [--label <value>] [--event-bus <value>] [--consumer <value>] [--matcher-rule
935
+ MatchEventBus|MatchCategory|MatchEvent|MatchCategoryAndEvent] [--event-category <value>] [--event-name <value>]
936
+ [--active] [--synchronous] [--force]
937
+
938
+ FLAGS
939
+ -d, --source-dir=<value>... One or more paths to directories containing Salesforce DX source, searched for the
940
+ record to update.
941
+ -n, --developer-name=<value> (required) The DeveloperName of the record to update.
942
+ -o, --target-org=<value> Locate (when --source-dir isn't given) and/or deploy the record to this org.
943
+ --[no-]active IsActive__c. If not given, the existing value is kept. Pass --no-active to deactivate.
944
+ --api-version=<value> Override the api version used for api requests made by this command
945
+ --consumer=<value> Consumer__c. If not given, the existing value is kept. Unique org-wide across every
946
+ subscription.
947
+ --event-bus=<value> EventBus__c. If not given, the existing value is kept.
948
+ --event-category=<value> EventCategory__c. If not given, the existing value is kept. Required when the record's
949
+ MatcherRule__c is MatchCategory or MatchCategoryAndEvent — leaving it blank for those
950
+ raises matcher-rule-missing-field.
951
+ --event-name=<value> Event__c. If not given, the existing value is kept. Required when the record's
952
+ MatcherRule__c is MatchEvent or MatchCategoryAndEvent — leaving it blank for those
953
+ raises matcher-rule-missing-field.
954
+ --force Write (and deploy) even if validation finds an error-severity issue. Validation still
955
+ runs and its issues are still printed and returned.
956
+ --label=<value> The record's label. If not given, the existing label is kept.
957
+ --matcher-rule=<option> MatcherRule__c — which of --event-category/--event-name the distributor's matcher
958
+ dereferences for this subscription. If not given, the existing value is kept.
959
+ <options: MatchEventBus|MatchCategory|MatchEvent|MatchCategoryAndEvent>
960
+ --[no-]synchronous Execute_Synchronous__c. If not given, the existing value is kept. Pass --no-synchronous
961
+ to have the distributor invoke this consumer asynchronously.
962
+ --wait=<value> [default: 33] Deploy poll timeout, in minutes. Only meaningful with --target-org.
963
+
964
+ GLOBAL FLAGS
965
+ --flags-dir=<value> Import flag values from a directory.
966
+ --json Format output as json.
967
+
968
+ DESCRIPTION
969
+ Update an existing AT4DX Platform Event Distributor subscription (PlatformEvents_Subscription__mdt) in local source
970
+ and/or a connected org.
971
+
972
+ Finds the platform event subscription named --developer-name in local source and/or a connected org, applies only the
973
+ fields given as flags — everything else is preserved from the found record — and rewrites its `.md-meta.xml` file.
974
+ Validates the resulting record — alongside everything else already in scope — with the same rules `simply aep at4dx
975
+ platform-event-subscription validate` uses, and refuses to write if that introduces an error-severity issue unless
976
+ --force is passed.
977
+
978
+ When --source-dir is given, the record is located there (searched across every directory given, same as
979
+ `list`/`validate`) and that exact file is rewritten; the found file is also deployed if --target-org is given. When
980
+ only --target-org is given, the record is located and updated directly in the org via a temporary file, deployed, then
981
+ discarded — no working-tree footprint.
982
+
983
+ --developer-name identifies the record to update and can't itself be changed by this command. --consumer, unlike
984
+ --developer-name, is an ordinary field on this record — changing it is a plain value update, not a
985
+ delete-and-recreate, even though it reads as the subscription's identity in most tooling.
986
+
987
+ EXAMPLES
988
+ $ sf simply aep at4dx platform-event-subscription update --source-dir sfdx-source/core --developer-name Account_Change_Subscriber --no-active
989
+
990
+ $ sf simply aep at4dx platform-event-subscription update --target-org myOrg --developer-name Account_Change_Subscriber --consumer AccountChangeConsumerV2
991
+ ```
992
+
993
+ _See code: [lib/commands/simply/aep/at4dx/platform-event-subscription/update.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.12.0/packages/simply-aep/lib/commands/simply/aep/at4dx/platform-event-subscription/update.js)_
797
994
 
798
995
  ## `sf simply aep at4dx platform-event-subscription validate`
799
996
 
@@ -842,5 +1039,5 @@ EXAMPLES
842
1039
  $ sf simply aep at4dx platform-event-subscription validate --target-org myOrg --json
843
1040
  ```
844
1041
 
845
- _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)_
1042
+ _See code: [lib/commands/simply/aep/at4dx/platform-event-subscription/validate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.12.0/packages/simply-aep/lib/commands/simply/aep/at4dx/platform-event-subscription/validate.js)_
846
1043
  <!-- commandsstop -->
@@ -0,0 +1,30 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { type At4dxPlatformEventSubscriptionCreateResult, type MatcherRule } from '@simplysf/simply-aep-core';
3
+ /**
4
+ * Creates a new AT4DX Platform Event Distributor subscription (`PlatformEvents_Subscription__mdt`) in
5
+ * local DX source and/or a connected org, validating it against everything already scanned before
6
+ * writing.
7
+ */
8
+ export default class At4dxPlatformEventSubscriptionCreate extends SfCommand<At4dxPlatformEventSubscriptionCreateResult> {
9
+ static readonly summary: string;
10
+ static readonly description: string;
11
+ static readonly examples: string[];
12
+ static readonly flags: {
13
+ 'source-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
15
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ wait: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
17
+ 'developer-name': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
18
+ label: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ 'event-bus': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
20
+ consumer: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
21
+ 'matcher-rule': import("@oclif/core/interfaces").OptionFlag<MatcherRule, import("@oclif/core/interfaces").CustomOptions>;
22
+ 'event-category': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ 'event-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
+ active: import("@oclif/core/interfaces").BooleanFlag<boolean>;
25
+ synchronous: import("@oclif/core/interfaces").BooleanFlag<boolean>;
26
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
27
+ 'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
28
+ };
29
+ run(): Promise<At4dxPlatformEventSubscriptionCreateResult>;
30
+ }
@@ -0,0 +1,121 @@
1
+ /*
2
+ * Copyright (c) 2026, Clay Chipps.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Duration } from '@salesforce/kit';
17
+ import { Messages } from '@salesforce/core';
18
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
19
+ import { ALL_MATCHER_RULES, createPlatformEventSubscription, } from '@simplysf/simply-aep-core';
20
+ import { toPlatformEventSubscriptionCliError } from '../../../../../common/platformEventSubscriptionWriteError.js';
21
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
22
+ const messages = Messages.loadMessages('@simplysf/simply-aep', 'simply.aep.at4dx.platform-event-subscription.create');
23
+ const ISSUE_TABLE_COLUMNS = [
24
+ { key: 'severity', name: 'SEVERITY' },
25
+ { key: 'rule', name: 'RULE' },
26
+ { key: 'message', name: 'MESSAGE' },
27
+ ];
28
+ function toIssueDisplayRow(issue) {
29
+ return { severity: issue.severity, rule: issue.rule, message: issue.message };
30
+ }
31
+ /**
32
+ * Creates a new AT4DX Platform Event Distributor subscription (`PlatformEvents_Subscription__mdt`) in
33
+ * local DX source and/or a connected org, validating it against everything already scanned before
34
+ * writing.
35
+ */
36
+ export default class At4dxPlatformEventSubscriptionCreate extends SfCommand {
37
+ static summary = messages.getMessage('summary');
38
+ static description = messages.getMessage('description');
39
+ static examples = messages.getMessages('examples');
40
+ static flags = {
41
+ ...SfCommand.baseFlags,
42
+ 'source-dir': Flags.directory({
43
+ summary: messages.getMessage('flags.source-dir.summary'),
44
+ char: 'd',
45
+ }),
46
+ 'target-org': Flags.optionalOrg({
47
+ summary: messages.getMessage('flags.target-org.summary'),
48
+ char: 'o',
49
+ }),
50
+ 'api-version': Flags.orgApiVersion(),
51
+ wait: Flags.string({ summary: messages.getMessage('flags.wait.summary'), default: '33' }),
52
+ 'developer-name': Flags.string({
53
+ summary: messages.getMessage('flags.developer-name.summary'),
54
+ char: 'n',
55
+ required: true,
56
+ }),
57
+ label: Flags.string({ summary: messages.getMessage('flags.label.summary') }),
58
+ 'event-bus': Flags.string({
59
+ summary: messages.getMessage('flags.event-bus.summary'),
60
+ required: true,
61
+ }),
62
+ consumer: Flags.string({
63
+ summary: messages.getMessage('flags.consumer.summary'),
64
+ required: true,
65
+ }),
66
+ 'matcher-rule': Flags.custom({ options: ALL_MATCHER_RULES })({
67
+ summary: messages.getMessage('flags.matcher-rule.summary'),
68
+ required: true,
69
+ }),
70
+ 'event-category': Flags.string({ summary: messages.getMessage('flags.event-category.summary') }),
71
+ 'event-name': Flags.string({ summary: messages.getMessage('flags.event-name.summary') }),
72
+ active: Flags.boolean({
73
+ summary: messages.getMessage('flags.active.summary'),
74
+ allowNo: true,
75
+ default: true,
76
+ }),
77
+ synchronous: Flags.boolean({
78
+ summary: messages.getMessage('flags.synchronous.summary'),
79
+ allowNo: true,
80
+ default: false,
81
+ }),
82
+ force: Flags.boolean({ summary: messages.getMessage('flags.force.summary'), default: false }),
83
+ };
84
+ async run() {
85
+ const { flags } = await this.parse(At4dxPlatformEventSubscriptionCreate);
86
+ const sourceDir = flags['source-dir'];
87
+ const targetOrg = flags['target-org'];
88
+ if (!sourceDir && !targetOrg) {
89
+ throw messages.createError('error.sourceDirOrTargetOrgRequired');
90
+ }
91
+ const connection = targetOrg?.getConnection(flags['api-version']);
92
+ try {
93
+ const result = await createPlatformEventSubscription({
94
+ developerName: flags['developer-name'],
95
+ label: flags.label,
96
+ eventBus: flags['event-bus'],
97
+ consumer: flags.consumer,
98
+ matcherRule: flags['matcher-rule'],
99
+ eventCategory: flags['event-category'],
100
+ event: flags['event-name'],
101
+ isActive: flags.active,
102
+ executeSynchronous: flags.synchronous,
103
+ force: flags.force,
104
+ }, { sourceDir, connection, wait: Duration.minutes(Number(flags.wait)) });
105
+ if (result.issues.length > 0) {
106
+ this.table({ data: result.issues.map(toIssueDisplayRow), columns: ISSUE_TABLE_COLUMNS });
107
+ }
108
+ this.info(messages.getMessage(result.filePath ? 'info.created' : 'info.createdInOrg', [result.developerName]));
109
+ if (result.deploy) {
110
+ this.info(messages.getMessage('info.deployed', [result.deploy.id]));
111
+ }
112
+ return result;
113
+ }
114
+ catch (error) {
115
+ throw toPlatformEventSubscriptionCliError(error, messages, (issues) => {
116
+ this.table({ data: issues.map(toIssueDisplayRow), columns: ISSUE_TABLE_COLUMNS });
117
+ });
118
+ }
119
+ }
120
+ }
121
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../../../src/commands/simply/aep/at4dx/platform-event-subscription/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,iBAAiB,EACjB,+BAA+B,GAIhC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mCAAmC,EAAE,MAA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,KAAK;aACnB,EACD,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CACtE,CAAC;YAEF,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC7B,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC;YAC3F,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,mBAAmB,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;YAC/G,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBAClB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACtE,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,mCAAmC,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE;gBACpE,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC;YACpF,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC"}
@@ -0,0 +1,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,Q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
+ import { type At4dxPlatformEventSubscriptionUpdateResult, type MatcherRule } from '@simplysf/simply-aep-core';
3
+ /**
4
+ * Updates an existing AT4DX Platform Event Distributor subscription
5
+ * (`PlatformEvents_Subscription__mdt`) in local DX source and/or a connected org — only the fields
6
+ * given change; everything else, including `Consumer__c`, is preserved from the found record unless
7
+ * explicitly overridden (`Consumer__c` is an ordinary value change here, not the record's key —
8
+ * `DeveloperName`, which this command cannot change, is).
9
+ */
10
+ export default class At4dxPlatformEventSubscriptionUpdate extends SfCommand<At4dxPlatformEventSubscriptionUpdateResult> {
11
+ static readonly summary: string;
12
+ static readonly description: string;
13
+ static readonly examples: string[];
14
+ static readonly flags: {
15
+ 'source-dir': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
17
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ wait: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
19
+ 'developer-name': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
20
+ label: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
+ 'event-bus': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
+ consumer: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ 'matcher-rule': import("@oclif/core/interfaces").OptionFlag<MatcherRule | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
+ 'event-category': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
25
+ 'event-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
26
+ active: import("@oclif/core/interfaces").BooleanFlag<boolean>;
27
+ synchronous: import("@oclif/core/interfaces").BooleanFlag<boolean>;
28
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
29
+ 'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
30
+ };
31
+ run(): Promise<At4dxPlatformEventSubscriptionUpdateResult>;
32
+ }
@@ -0,0 +1,116 @@
1
+ /*
2
+ * Copyright (c) 2026, Clay Chipps.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Duration } from '@salesforce/kit';
17
+ import { Messages } from '@salesforce/core';
18
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
19
+ import { ALL_MATCHER_RULES, updatePlatformEventSubscription, } from '@simplysf/simply-aep-core';
20
+ import { toPlatformEventSubscriptionCliError } from '../../../../../common/platformEventSubscriptionWriteError.js';
21
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
22
+ const messages = Messages.loadMessages('@simplysf/simply-aep', 'simply.aep.at4dx.platform-event-subscription.update');
23
+ const ISSUE_TABLE_COLUMNS = [
24
+ { key: 'severity', name: 'SEVERITY' },
25
+ { key: 'rule', name: 'RULE' },
26
+ { key: 'message', name: 'MESSAGE' },
27
+ ];
28
+ function toIssueDisplayRow(issue) {
29
+ return { severity: issue.severity, rule: issue.rule, message: issue.message };
30
+ }
31
+ /**
32
+ * Updates an existing AT4DX Platform Event Distributor subscription
33
+ * (`PlatformEvents_Subscription__mdt`) in local DX source and/or a connected org — only the fields
34
+ * given change; everything else, including `Consumer__c`, is preserved from the found record unless
35
+ * explicitly overridden (`Consumer__c` is an ordinary value change here, not the record's key —
36
+ * `DeveloperName`, which this command cannot change, is).
37
+ */
38
+ export default class At4dxPlatformEventSubscriptionUpdate 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
+ 'source-dir': Flags.directory({
45
+ summary: messages.getMessage('flags.source-dir.summary'),
46
+ char: 'd',
47
+ exists: true,
48
+ multiple: true,
49
+ }),
50
+ 'target-org': Flags.optionalOrg({
51
+ summary: messages.getMessage('flags.target-org.summary'),
52
+ char: 'o',
53
+ }),
54
+ 'api-version': Flags.orgApiVersion(),
55
+ wait: Flags.string({ summary: messages.getMessage('flags.wait.summary'), default: '33' }),
56
+ 'developer-name': Flags.string({
57
+ summary: messages.getMessage('flags.developer-name.summary'),
58
+ char: 'n',
59
+ required: true,
60
+ }),
61
+ label: Flags.string({ summary: messages.getMessage('flags.label.summary') }),
62
+ 'event-bus': Flags.string({ summary: messages.getMessage('flags.event-bus.summary') }),
63
+ consumer: Flags.string({ summary: messages.getMessage('flags.consumer.summary') }),
64
+ 'matcher-rule': Flags.custom({ options: ALL_MATCHER_RULES })({
65
+ summary: messages.getMessage('flags.matcher-rule.summary'),
66
+ }),
67
+ 'event-category': Flags.string({ summary: messages.getMessage('flags.event-category.summary') }),
68
+ 'event-name': Flags.string({ summary: messages.getMessage('flags.event-name.summary') }),
69
+ active: Flags.boolean({
70
+ summary: messages.getMessage('flags.active.summary'),
71
+ allowNo: true,
72
+ }),
73
+ synchronous: Flags.boolean({
74
+ summary: messages.getMessage('flags.synchronous.summary'),
75
+ allowNo: true,
76
+ }),
77
+ force: Flags.boolean({ summary: messages.getMessage('flags.force.summary'), default: false }),
78
+ };
79
+ async run() {
80
+ const { flags } = await this.parse(At4dxPlatformEventSubscriptionUpdate);
81
+ const sourceDirs = flags['source-dir'] ?? [];
82
+ const targetOrg = flags['target-org'];
83
+ if (sourceDirs.length === 0 && !targetOrg) {
84
+ throw messages.createError('error.sourceDirOrTargetOrgRequired');
85
+ }
86
+ const connection = targetOrg?.getConnection(flags['api-version']);
87
+ try {
88
+ const result = await updatePlatformEventSubscription({
89
+ developerName: flags['developer-name'],
90
+ label: flags.label,
91
+ eventBus: flags['event-bus'],
92
+ consumer: flags.consumer,
93
+ matcherRule: flags['matcher-rule'],
94
+ eventCategory: flags['event-category'],
95
+ event: flags['event-name'],
96
+ isActive: flags.active,
97
+ executeSynchronous: flags.synchronous,
98
+ force: flags.force,
99
+ }, { sourceDirs, connection, wait: Duration.minutes(Number(flags.wait)) });
100
+ if (result.issues.length > 0) {
101
+ this.table({ data: result.issues.map(toIssueDisplayRow), columns: ISSUE_TABLE_COLUMNS });
102
+ }
103
+ this.info(messages.getMessage(result.filePath ? 'info.updated' : 'info.updatedInOrg', [result.developerName]));
104
+ if (result.deploy) {
105
+ this.info(messages.getMessage('info.deployed', [result.deploy.id]));
106
+ }
107
+ return result;
108
+ }
109
+ catch (error) {
110
+ throw toPlatformEventSubscriptionCliError(error, messages, (issues) => {
111
+ this.table({ data: issues.map(toIssueDisplayRow), columns: ISSUE_TABLE_COLUMNS });
112
+ });
113
+ }
114
+ }
115
+ }
116
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../../../src/commands/simply/aep/at4dx/platform-event-subscription/update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,iBAAiB,EACjB,+BAA+B,GAIhC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mCAAmC,EA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AU,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CACvE,CAAC;YAEF,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC7B,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC;YAC3F,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,mBAAmB,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;YAC/G,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBAClB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACtE,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,mCAAmC,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE;gBACpE,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC;YACpF,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { Messages } from '@salesforce/core';
2
+ import { type PlatformEventSubscriptionIssue } from '@simplysf/simply-aep-core';
3
+ /**
4
+ * Maps a `PlatformEventSubscriptionWriteError` thrown by
5
+ * `createPlatformEventSubscription`/`updatePlatformEventSubscription` onto the calling command's own
6
+ * `error.*` message keys, shared by `create.ts`/`update.ts` since both throw the same error type for
7
+ * the same set of codes. Mirrors `fieldSetInclusionWriteError.ts`'s `toFieldSetInclusionCliError` — see
8
+ * docs/design/0025-at4dx-platform-event-subscription-support.md.
9
+ *
10
+ * @param error - Whatever `createPlatformEventSubscription`/`updatePlatformEventSubscription` rejected with.
11
+ * @param messages - The calling command's own loaded message catalog.
12
+ * @param printIssues - Renders a validation issue table (the command's own `this.table`-based printer).
13
+ * @returns An `Error` ready to throw from the command's `run()` — an `SfError` built from a message key when `error` is a recognized `PlatformEventSubscriptionWriteError`, or `error` itself (coerced to `Error`) otherwise.
14
+ */
15
+ export declare function toPlatformEventSubscriptionCliError(error: unknown, messages: Messages<string>, printIssues: (issues: PlatformEventSubscriptionIssue[]) => void): Error;
@@ -0,0 +1,57 @@
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 { PlatformEventSubscriptionWriteError } from '@simplysf/simply-aep-core';
17
+ /**
18
+ * Maps a `PlatformEventSubscriptionWriteError` thrown by
19
+ * `createPlatformEventSubscription`/`updatePlatformEventSubscription` onto the calling command's own
20
+ * `error.*` message keys, shared by `create.ts`/`update.ts` since both throw the same error type for
21
+ * the same set of codes. Mirrors `fieldSetInclusionWriteError.ts`'s `toFieldSetInclusionCliError` — see
22
+ * docs/design/0025-at4dx-platform-event-subscription-support.md.
23
+ *
24
+ * @param error - Whatever `createPlatformEventSubscription`/`updatePlatformEventSubscription` rejected with.
25
+ * @param messages - The calling command's own loaded message catalog.
26
+ * @param printIssues - Renders a validation issue table (the command's own `this.table`-based printer).
27
+ * @returns An `Error` ready to throw from the command's `run()` — an `SfError` built from a message key when `error` is a recognized `PlatformEventSubscriptionWriteError`, or `error` itself (coerced to `Error`) otherwise.
28
+ */
29
+ export function toPlatformEventSubscriptionCliError(error, messages, printIssues) {
30
+ if (!(error instanceof PlatformEventSubscriptionWriteError)) {
31
+ return error instanceof Error ? error : new Error(String(error));
32
+ }
33
+ switch (error.code) {
34
+ case 'source-or-target-required':
35
+ return messages.createError('error.sourceDirOrTargetOrgRequired');
36
+ case 'invalid-developer-name':
37
+ return messages.createError('error.invalidDeveloperName', [error.message]);
38
+ case 'label-too-long':
39
+ return messages.createError('error.labelTooLong', [error.message]);
40
+ case 'developer-name-already-exists':
41
+ return messages.createError('error.developerNameAlreadyExists', [error.message]);
42
+ case 'developer-name-not-found':
43
+ return messages.createError('error.developerNameNotFound', [error.message]);
44
+ case 'no-fields-to-update':
45
+ return messages.createError('error.noFieldsToUpdate');
46
+ case 'at4dx-not-detected':
47
+ return messages.createError('error.at4dxNotDetected', [error.message]);
48
+ case 'validation-failed':
49
+ printIssues(error.issues ?? []);
50
+ return messages.createError('error.validationFailed');
51
+ case 'deploy-failed':
52
+ return messages.createError('error.deployFailed', [error.message]);
53
+ default:
54
+ return error;
55
+ }
56
+ }
57
+ //# sourceMappingURL=platformEventSubscriptionWriteError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platformEventSubscriptionWriteError.js","sourceRoot":"","sources":["../../src/common/platformEventSubscriptionWriteError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,mCAAmC,EAAuC,MAAM,2BAA2B,CAAC;AAErH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mCAAmC,CACjD,KAAc,EACd,QAA0B,EAC1B,WAA+D;IAE/D,IAAI,CAAC,CAAC,KAAK,YAAY,mCAAmC,CAAC,EAAE,CAAC;QAC5D,OAAO,KAAK,YA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3
+ Create a new AT4DX Platform Event Distributor subscription (PlatformEvents_Subscription__mdt) in local source and/or a connected org.
4
+
5
+ # description
6
+
7
+ Generates a `PlatformEvents_Subscription.<DeveloperName>.md-meta.xml` file from the given flags and writes it under --source-dir, deploys it to --target-org, or both. Validates the resulting record — alongside everything else already in scope — with the same rules `simply aep at4dx platform-event-subscription validate` uses, and refuses to write if that introduces an error-severity issue unless --force is passed. At least one of --source-dir/--target-org is required; both may be given at once (write to source and deploy it live in the same run). Given --target-org alone, the file is written to a temporary directory, deployed, and discarded — no working-tree footprint.
8
+
9
+ --matcher-rule controls which of --event-category/--event-name the distributor's matcher dereferences for this subscription: MatchEventBus dereferences neither (the whole bus matches, once a category or event name gets it past the distributor's pre-filter — see `simply aep at4dx platform-event-subscription validate`'s unreachable-subscription rule for why at least one should usually be set anyway), MatchCategory requires --event-category, MatchEvent requires --event-name, and MatchCategoryAndEvent requires both. Leaving the field a MatcherRule needs blank is exactly the matcher-rule-missing-field hazard validation catches — see that command's description for why it matters at runtime.
10
+
11
+ # flags.source-dir.summary
12
+
13
+ The package directory to create the platform event subscription's .md-meta.xml under. Created if the customMetadata folder doesn't exist yet.
14
+
15
+ # flags.target-org.summary
16
+
17
+ Deploy the generated platform event subscription to this org after writing it.
18
+
19
+ # flags.wait.summary
20
+
21
+ Deploy poll timeout, in minutes. Only meaningful with --target-org.
22
+
23
+ # flags.developer-name.summary
24
+
25
+ The record's DeveloperName. Must start with a letter, contain only letters, numbers, and single underscores, not end with an underscore, and be 40 characters or fewer.
26
+
27
+ # flags.label.summary
28
+
29
+ The record's label. Defaults to --developer-name. Must be 40 characters or fewer.
30
+
31
+ # flags.event-bus.summary
32
+
33
+ EventBus__c — the platform event object API name this subscription registers against, e.g. My_Event__e.
34
+
35
+ # flags.consumer.summary
36
+
37
+ Consumer__c — the IEventsConsumer-implementing Apex class name. Unique org-wide across every subscription.
38
+
39
+ # flags.matcher-rule.summary
40
+
41
+ MatcherRule__c — which of --event-category/--event-name the distributor's matcher dereferences for this subscription. One of MatchEventBus, MatchCategory, MatchEvent, MatchCategoryAndEvent.
42
+
43
+ # flags.event-category.summary
44
+
45
+ EventCategory__c. Required when --matcher-rule is MatchCategory or MatchCategoryAndEvent — leaving it blank for those raises matcher-rule-missing-field.
46
+
47
+ # flags.event-name.summary
48
+
49
+ Event__c. Required when --matcher-rule is MatchEvent or MatchCategoryAndEvent — leaving it blank for those raises matcher-rule-missing-field.
50
+
51
+ # flags.active.summary
52
+
53
+ IsActive__c. Defaults to true, matching the Custom Metadata Type's own default. Pass --no-active to create it inactive.
54
+
55
+ # flags.synchronous.summary
56
+
57
+ Execute_Synchronous__c. Defaults to false. Pass --synchronous to have the distributor invoke this consumer synchronously.
58
+
59
+ # flags.force.summary
60
+
61
+ Write (and deploy) even if validation finds an error-severity issue. Validation still runs and its issues are still printed and returned.
62
+
63
+ # examples
64
+
65
+ - <%= config.bin %> <%= command.id %> --source-dir sfdx-source/core --developer-name Account_Change_Subscriber --event-bus Account_Change__e --consumer AccountChangeConsumer --matcher-rule MatchCategory --event-category Finance
66
+
67
+ - <%= config.bin %> <%= command.id %> --target-org myOrg --developer-name Account_Change_Subscriber --event-bus Account_Change__e --consumer AccountChangeConsumer --matcher-rule MatchCategoryAndEvent --event-category Finance --event-name AccountUpdated
68
+
69
+ # error.sourceDirOrTargetOrgRequired
70
+
71
+ You must specify at least one of --source-dir or --target-org.
72
+
73
+ # error.invalidDeveloperName
74
+
75
+ %s
76
+
77
+ # error.labelTooLong
78
+
79
+ %s
80
+
81
+ # error.developerNameAlreadyExists
82
+
83
+ %s
84
+
85
+ # error.developerNameNotFound
86
+
87
+ %s
88
+
89
+ # error.noFieldsToUpdate
90
+
91
+ At least one field besides --developer-name must be given to update.
92
+
93
+ # error.at4dxNotDetected
94
+
95
+ %s
96
+
97
+ # error.validationFailed
98
+
99
+ Writing this record would introduce a wiring problem AT4DX validation already knows how to catch. Pass --force to write anyway.
100
+
101
+ # error.deployFailed
102
+
103
+ %s
104
+
105
+ # info.created
106
+
107
+ Created %s
108
+
109
+ # info.createdInOrg
110
+
111
+ Created %s in the org
112
+
113
+ # info.deployed
114
+
115
+ Deployed (id: %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,117 @@
1
+ # summary
2
+
3
+ Update an existing AT4DX Platform Event Distributor subscription (PlatformEvents_Subscription__mdt) in local source and/or a connected org.
4
+
5
+ # description
6
+
7
+ Finds the platform event subscription named --developer-name in local source and/or a connected org, applies only the fields given as flags — everything else is preserved from the found record — and rewrites its `.md-meta.xml` file. Validates the resulting record — alongside everything else already in scope — with the same rules `simply aep at4dx platform-event-subscription validate` uses, and refuses to write if that introduces an error-severity issue unless --force is passed.
8
+
9
+ When --source-dir is given, the record is located there (searched across every directory given, same as `list`/`validate`) and that exact file is rewritten; the found file is also deployed if --target-org is given. When only --target-org is given, the record is located and updated directly in the org via a temporary file, deployed, then discarded — no working-tree footprint.
10
+
11
+ --developer-name identifies the record to update and can't itself be changed by this command. --consumer, unlike --developer-name, is an ordinary field on this record — changing it is a plain value update, not a delete-and-recreate, even though it reads as the subscription's identity in most tooling.
12
+
13
+ # flags.source-dir.summary
14
+
15
+ One or more paths to directories containing Salesforce DX source, searched for the record to update.
16
+
17
+ # flags.target-org.summary
18
+
19
+ Locate (when --source-dir isn't given) and/or deploy the record to this org.
20
+
21
+ # flags.wait.summary
22
+
23
+ Deploy poll timeout, in minutes. Only meaningful with --target-org.
24
+
25
+ # flags.developer-name.summary
26
+
27
+ The DeveloperName of the record to update.
28
+
29
+ # flags.label.summary
30
+
31
+ The record's label. If not given, the existing label is kept.
32
+
33
+ # flags.event-bus.summary
34
+
35
+ EventBus__c. If not given, the existing value is kept.
36
+
37
+ # flags.consumer.summary
38
+
39
+ Consumer__c. If not given, the existing value is kept. Unique org-wide across every subscription.
40
+
41
+ # flags.matcher-rule.summary
42
+
43
+ MatcherRule__c — which of --event-category/--event-name the distributor's matcher dereferences for this subscription. If not given, the existing value is kept.
44
+
45
+ # flags.event-category.summary
46
+
47
+ EventCategory__c. If not given, the existing value is kept. Required when the record's MatcherRule__c is MatchCategory or MatchCategoryAndEvent — leaving it blank for those raises matcher-rule-missing-field.
48
+
49
+ # flags.event-name.summary
50
+
51
+ Event__c. If not given, the existing value is kept. Required when the record's MatcherRule__c is MatchEvent or MatchCategoryAndEvent — leaving it blank for those raises matcher-rule-missing-field.
52
+
53
+ # flags.active.summary
54
+
55
+ IsActive__c. If not given, the existing value is kept. Pass --no-active to deactivate.
56
+
57
+ # flags.synchronous.summary
58
+
59
+ Execute_Synchronous__c. If not given, the existing value is kept. Pass --no-synchronous to have the distributor invoke this consumer asynchronously.
60
+
61
+ # flags.force.summary
62
+
63
+ Write (and deploy) even if validation finds an error-severity issue. Validation still runs and its issues are still printed and returned.
64
+
65
+ # examples
66
+
67
+ - <%= config.bin %> <%= command.id %> --source-dir sfdx-source/core --developer-name Account_Change_Subscriber --no-active
68
+
69
+ - <%= config.bin %> <%= command.id %> --target-org myOrg --developer-name Account_Change_Subscriber --consumer AccountChangeConsumerV2
70
+
71
+ # error.sourceDirOrTargetOrgRequired
72
+
73
+ You must specify at least one of --source-dir or --target-org.
74
+
75
+ # error.invalidDeveloperName
76
+
77
+ %s
78
+
79
+ # error.labelTooLong
80
+
81
+ %s
82
+
83
+ # error.developerNameAlreadyExists
84
+
85
+ %s
86
+
87
+ # error.developerNameNotFound
88
+
89
+ %s
90
+
91
+ # error.noFieldsToUpdate
92
+
93
+ At least one field besides --developer-name must be given to update.
94
+
95
+ # error.at4dxNotDetected
96
+
97
+ %s
98
+
99
+ # error.validationFailed
100
+
101
+ Writing this record would introduce a wiring problem AT4DX validation already knows how to catch. Pass --force to write anyway.
102
+
103
+ # error.deployFailed
104
+
105
+ %s
106
+
107
+ # info.updated
108
+
109
+ Updated %s
110
+
111
+ # info.updatedInOrg
112
+
113
+ Updated %s in the org
114
+
115
+ # info.deployed
116
+
117
+ Deployed (id: %s)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simplysf/simply-aep",
3
3
  "description": "Commands for Apex Enterprise Patterns tooling (fflib, force-di, AT4DX)",
4
- "version": "0.12.0",
4
+ "version": "0.14.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.13.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": "3f3f4ccb39cef4e5ca2748d823305dd099de8a4d"
201
201
  }