@simplysf/simply-aep 0.13.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 +156 -16
- package/lib/commands/simply/aep/at4dx/platform-event-subscription/create.d.ts +30 -0
- package/lib/commands/simply/aep/at4dx/platform-event-subscription/create.js +121 -0
- package/lib/commands/simply/aep/at4dx/platform-event-subscription/create.js.map +1 -0
- package/lib/commands/simply/aep/at4dx/platform-event-subscription/update.d.ts +32 -0
- package/lib/commands/simply/aep/at4dx/platform-event-subscription/update.js +116 -0
- package/lib/commands/simply/aep/at4dx/platform-event-subscription/update.js.map +1 -0
- package/lib/common/platformEventSubscriptionWriteError.d.ts +15 -0
- package/lib/common/platformEventSubscriptionWriteError.js +57 -0
- package/lib/common/platformEventSubscriptionWriteError.js.map +1 -0
- package/messages/simply.aep.at4dx.platform-event-subscription.create.md +115 -0
- package/messages/simply.aep.at4dx.platform-event-subscription.update.md +117 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -34,8 +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)
|
|
38
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)
|
|
39
41
|
- [`sf simply aep at4dx platform-event-subscription validate`](#sf-simply-aep-at4dx-platform-event-subscription-validate)
|
|
40
42
|
|
|
41
43
|
## `sf simply aep at4dx binding create`
|
|
@@ -115,7 +117,7 @@ EXAMPLES
|
|
|
115
117
|
$ sf simply aep at4dx binding create --source-dir sfdx-source/core --type unit-of-work --developer-name Account_UOW --sobject Account --sequence 10
|
|
116
118
|
```
|
|
117
119
|
|
|
118
|
-
_See code: [lib/commands/simply/aep/at4dx/binding/create.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
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)_
|
|
119
121
|
|
|
120
122
|
## `sf simply aep at4dx binding list`
|
|
121
123
|
|
|
@@ -171,7 +173,7 @@ FLAG DESCRIPTIONS
|
|
|
171
173
|
Comma-separated list of binding types to include. If not specified, all four are included.
|
|
172
174
|
```
|
|
173
175
|
|
|
174
|
-
_See code: [lib/commands/simply/aep/at4dx/binding/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
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)_
|
|
175
177
|
|
|
176
178
|
## `sf simply aep at4dx binding update`
|
|
177
179
|
|
|
@@ -244,7 +246,7 @@ EXAMPLES
|
|
|
244
246
|
$ sf simply aep at4dx binding update --target-org myOrg --type unit-of-work --developer-name Account_UOW --sequence 20
|
|
245
247
|
```
|
|
246
248
|
|
|
247
|
-
_See code: [lib/commands/simply/aep/at4dx/binding/update.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
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)_
|
|
248
250
|
|
|
249
251
|
## `sf simply aep at4dx binding validate`
|
|
250
252
|
|
|
@@ -300,7 +302,7 @@ FLAG DESCRIPTIONS
|
|
|
300
302
|
Comma-separated list of binding types to include. If not specified, all four are included.
|
|
301
303
|
```
|
|
302
304
|
|
|
303
|
-
_See code: [lib/commands/simply/aep/at4dx/binding/validate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
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)_
|
|
304
306
|
|
|
305
307
|
## `sf simply aep at4dx domain-process-binding create`
|
|
306
308
|
|
|
@@ -381,7 +383,7 @@ EXAMPLES
|
|
|
381
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
|
|
382
384
|
```
|
|
383
385
|
|
|
384
|
-
_See code: [lib/commands/simply/aep/at4dx/domain-process-binding/create.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
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)_
|
|
385
387
|
|
|
386
388
|
## `sf simply aep at4dx domain-process-binding list`
|
|
387
389
|
|
|
@@ -427,7 +429,7 @@ EXAMPLES
|
|
|
427
429
|
$ sf simply aep at4dx domain-process-binding list --target-org myOrg --active-only --json
|
|
428
430
|
```
|
|
429
431
|
|
|
430
|
-
_See code: [lib/commands/simply/aep/at4dx/domain-process-binding/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
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)_
|
|
431
433
|
|
|
432
434
|
## `sf simply aep at4dx domain-process-binding update`
|
|
433
435
|
|
|
@@ -506,7 +508,7 @@ EXAMPLES
|
|
|
506
508
|
$ sf simply aep at4dx domain-process-binding update --target-org myOrg --developer-name Account_Before_Insert_Assign_Owner --class-to-inject AccountAssignOwnerActionV2
|
|
507
509
|
```
|
|
508
510
|
|
|
509
|
-
_See code: [lib/commands/simply/aep/at4dx/domain-process-binding/update.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
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)_
|
|
510
512
|
|
|
511
513
|
## `sf simply aep at4dx domain-process-binding validate`
|
|
512
514
|
|
|
@@ -559,7 +561,7 @@ EXAMPLES
|
|
|
559
561
|
$ sf simply aep at4dx domain-process-binding validate --target-org myOrg --json
|
|
560
562
|
```
|
|
561
563
|
|
|
562
|
-
_See code: [lib/commands/simply/aep/at4dx/domain-process-binding/validate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
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)_
|
|
563
565
|
|
|
564
566
|
## `sf simply aep at4dx field-set-inclusion create`
|
|
565
567
|
|
|
@@ -617,7 +619,7 @@ EXAMPLES
|
|
|
617
619
|
$ sf simply aep at4dx field-set-inclusion create --target-org myOrg --developer-name ServiceResource_Skills --sobject ServiceResource --sobject-alternate --fieldset-name SkillFields
|
|
618
620
|
```
|
|
619
621
|
|
|
620
|
-
_See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/create.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
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)_
|
|
621
623
|
|
|
622
624
|
## `sf simply aep at4dx field-set-inclusion list`
|
|
623
625
|
|
|
@@ -655,7 +657,7 @@ EXAMPLES
|
|
|
655
657
|
$ sf simply aep at4dx field-set-inclusion list --target-org myOrg --json
|
|
656
658
|
```
|
|
657
659
|
|
|
658
|
-
_See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
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)_
|
|
659
661
|
|
|
660
662
|
## `sf simply aep at4dx field-set-inclusion update`
|
|
661
663
|
|
|
@@ -712,7 +714,7 @@ EXAMPLES
|
|
|
712
714
|
$ sf simply aep at4dx field-set-inclusion update --target-org myOrg --developer-name Account_Contact_Fields --fieldset-name ContactRelatedFieldsV2
|
|
713
715
|
```
|
|
714
716
|
|
|
715
|
-
_See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/update.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
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)_
|
|
716
718
|
|
|
717
719
|
## `sf simply aep at4dx field-set-inclusion validate`
|
|
718
720
|
|
|
@@ -756,7 +758,77 @@ EXAMPLES
|
|
|
756
758
|
$ sf simply aep at4dx field-set-inclusion validate --target-org myOrg --json
|
|
757
759
|
```
|
|
758
760
|
|
|
759
|
-
_See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/validate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
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)_
|
|
760
832
|
|
|
761
833
|
## `sf simply aep at4dx platform-event-subscription list`
|
|
762
834
|
|
|
@@ -794,7 +866,7 @@ EXAMPLES
|
|
|
794
866
|
$ sf simply aep at4dx platform-event-subscription list --target-org myOrg --json
|
|
795
867
|
```
|
|
796
868
|
|
|
797
|
-
_See code: [lib/commands/simply/aep/at4dx/platform-event-subscription/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
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)_
|
|
798
870
|
|
|
799
871
|
## `sf simply aep at4dx platform-event-subscription simulate`
|
|
800
872
|
|
|
@@ -832,7 +904,7 @@ DESCRIPTION
|
|
|
832
904
|
Exactly one of `--target-org` or `--source-dir` must be specified.
|
|
833
905
|
|
|
834
906
|
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
|
|
907
|
+
`Execute_Synchronous__c`, plus every subscription on that bus that would _not_ receive the event and the structured
|
|
836
908
|
reason why: `inactive`, `prefiltered` (the pre-filter rejected it before any matcher rule ran),
|
|
837
909
|
`matcher-rule-missing-field` (the matcher rule dereferences a blank match field — a real NullPointerException in the
|
|
838
910
|
org), or `no-match` (every field the matcher rule needs is present, but the values don't match this event).
|
|
@@ -850,7 +922,75 @@ EXAMPLES
|
|
|
850
922
|
$ sf simply aep at4dx platform-event-subscription simulate --target-org myOrg --event-bus Account_Change__e --json
|
|
851
923
|
```
|
|
852
924
|
|
|
853
|
-
_See code: [lib/commands/simply/aep/at4dx/platform-event-subscription/simulate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
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)_
|
|
854
994
|
|
|
855
995
|
## `sf simply aep at4dx platform-event-subscription validate`
|
|
856
996
|
|
|
@@ -899,5 +1039,5 @@ EXAMPLES
|
|
|
899
1039
|
$ sf simply aep at4dx platform-event-subscription validate --target-org myOrg --json
|
|
900
1040
|
```
|
|
901
1041
|
|
|
902
|
-
_See code: [lib/commands/simply/aep/at4dx/platform-event-subscription/validate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.
|
|
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)_
|
|
903
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,MAAM,8DAA8D,CAAC;AAEnH,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,sBAAsB,EAAE,qDAAqD,CAAC,CAAC;AAItH,MAAM,mBAAmB,GAAwD;IAC/E,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE;IACrC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;IAC7B,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;CACpC,CAAC;AAEF,SAAS,iBAAiB,CAAC,KAAqC;IAC9D,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;AAChF,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,oCAAqC,SAAQ,SAAqD;IAC9G,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,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AAC;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,32 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
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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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,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACnE,CAAC;IAED,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,2BAA2B;YAC9B,OAAO,QAAQ,CAAC,WAAW,CAAC,oCAAoC,CAAC,CAAC;QACpE,KAAK,wBAAwB;YAC3B,OAAO,QAAQ,CAAC,WAAW,CAAC,4BAA4B,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAC7E,KAAK,gBAAgB;YACnB,OAAO,QAAQ,CAAC,WAAW,CAAC,oBAAoB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACrE,KAAK,+BAA+B;YAClC,OAAO,QAAQ,CAAC,WAAW,CAAC,kCAAkC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACnF,KAAK,0BAA0B;YAC7B,OAAO,QAAQ,CAAC,WAAW,CAAC,6BAA6B,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAC9E,KAAK,qBAAqB;YACxB,OAAO,QAAQ,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;QACxD,KAAK,oBAAoB;YACvB,OAAO,QAAQ,CAAC,WAAW,CAAC,wBAAwB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACzE,KAAK,mBAAmB;YACtB,WAAW,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;YAChC,OAAO,QAAQ,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;QACxD,KAAK,eAAe;YAClB,OAAO,QAAQ,CAAC,WAAW,CAAC,oBAAoB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACrE;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
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,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.
|
|
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.
|
|
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": "
|
|
200
|
+
"gitHead": "3f3f4ccb39cef4e5ca2748d823305dd099de8a4d"
|
|
201
201
|
}
|