@simplysf/simply-aep 0.8.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +201 -0
- package/lib/commands/simply/aep/at4dx/field-set-inclusion/create.d.ts +26 -0
- package/lib/commands/simply/aep/at4dx/field-set-inclusion/create.js +112 -0
- package/lib/commands/simply/aep/at4dx/field-set-inclusion/create.js.map +1 -0
- package/lib/commands/simply/aep/at4dx/field-set-inclusion/list.d.ts +20 -0
- package/lib/commands/simply/aep/at4dx/field-set-inclusion/list.js +110 -0
- package/lib/commands/simply/aep/at4dx/field-set-inclusion/list.js.map +1 -0
- package/lib/commands/simply/aep/at4dx/field-set-inclusion/update.d.ts +27 -0
- package/lib/commands/simply/aep/at4dx/field-set-inclusion/update.js +109 -0
- package/lib/commands/simply/aep/at4dx/field-set-inclusion/update.js.map +1 -0
- package/lib/commands/simply/aep/at4dx/field-set-inclusion/validate.d.ts +21 -0
- package/lib/commands/simply/aep/at4dx/field-set-inclusion/validate.js +129 -0
- package/lib/commands/simply/aep/at4dx/field-set-inclusion/validate.js.map +1 -0
- package/lib/common/fieldSetInclusionWriteError.d.ts +14 -0
- package/lib/common/fieldSetInclusionWriteError.js +56 -0
- package/lib/common/fieldSetInclusionWriteError.js.map +1 -0
- package/messages/simply.aep.at4dx.field-set-inclusion.create.md +103 -0
- package/messages/simply.aep.at4dx.field-set-inclusion.list.md +51 -0
- package/messages/simply.aep.at4dx.field-set-inclusion.update.md +105 -0
- package/messages/simply.aep.at4dx.field-set-inclusion.validate.md +53 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -30,6 +30,10 @@ This package is part of the [`@simplysf/simply`](https://github.com/SimplySF/sim
|
|
|
30
30
|
- [`sf simply aep at4dx domain-process-binding list`](#sf-simply-aep-at4dx-domain-process-binding-list)
|
|
31
31
|
- [`sf simply aep at4dx domain-process-binding set`](#sf-simply-aep-at4dx-domain-process-binding-set)
|
|
32
32
|
- [`sf simply aep at4dx domain-process-binding validate`](#sf-simply-aep-at4dx-domain-process-binding-validate)
|
|
33
|
+
- [`sf simply aep at4dx field-set-inclusion create`](#sf-simply-aep-at4dx-field-set-inclusion-create)
|
|
34
|
+
- [`sf simply aep at4dx field-set-inclusion list`](#sf-simply-aep-at4dx-field-set-inclusion-list)
|
|
35
|
+
- [`sf simply aep at4dx field-set-inclusion update`](#sf-simply-aep-at4dx-field-set-inclusion-update)
|
|
36
|
+
- [`sf simply aep at4dx field-set-inclusion validate`](#sf-simply-aep-at4dx-field-set-inclusion-validate)
|
|
33
37
|
|
|
34
38
|
## `sf simply aep at4dx binding create`
|
|
35
39
|
|
|
@@ -541,4 +545,201 @@ EXAMPLES
|
|
|
541
545
|
```
|
|
542
546
|
|
|
543
547
|
_See code: [lib/commands/simply/aep/at4dx/domain-process-binding/validate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.7.0/packages/simply-aep/lib/commands/simply/aep/at4dx/domain-process-binding/validate.js)_
|
|
548
|
+
|
|
549
|
+
## `sf simply aep at4dx field-set-inclusion create`
|
|
550
|
+
|
|
551
|
+
Create a new AT4DX Selector field set inclusion (SelectorConfig_FieldSetInclusion__mdt) in local source and/or a connected org.
|
|
552
|
+
|
|
553
|
+
```
|
|
554
|
+
USAGE
|
|
555
|
+
$ sf simply aep at4dx field-set-inclusion create -n <value> -s <value> -f <value> [--json] [--flags-dir <value>] [-d <value>] [-o <value>]
|
|
556
|
+
[--api-version <value>] [--wait <value>] [--label <value>] [--sobject-alternate] [--active] [--force]
|
|
557
|
+
|
|
558
|
+
FLAGS
|
|
559
|
+
-d, --source-dir=<value> The package directory to create the field set inclusion's .md-meta.xml under. Created if
|
|
560
|
+
the customMetadata folder doesn't exist yet.
|
|
561
|
+
-f, --fieldset-name=<value> (required) FieldsetName__c — the field set to add to the selector's queried field list.
|
|
562
|
+
Unique org-wide across every SObject, not per-SObject.
|
|
563
|
+
-n, --developer-name=<value> (required) The record's DeveloperName. Must start with a letter, contain only letters,
|
|
564
|
+
numbers, and single underscores, not end with an underscore, and be 40 characters or
|
|
565
|
+
fewer.
|
|
566
|
+
-o, --target-org=<value> Deploy the generated field set inclusion to this org after writing it.
|
|
567
|
+
-s, --sobject=<value> (required) The SObject API name to bind the field set to (BindingSObject__c, or
|
|
568
|
+
BindingSObjectAlternate__c with --sobject-alternate).
|
|
569
|
+
--[no-]active IsActive__c. Defaults to true, matching the Custom Metadata Type's own default. Pass
|
|
570
|
+
--no-active to create it inactive.
|
|
571
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
572
|
+
--force Write (and deploy) even if validation finds an error-severity issue. Validation still
|
|
573
|
+
runs and its issues are still printed and returned.
|
|
574
|
+
--label=<value> The record's label. Defaults to --developer-name. Must be 40 characters or fewer.
|
|
575
|
+
--[no-]sobject-alternate Write --sobject to BindingSObjectAlternate__c instead of BindingSObject__c. Use this for
|
|
576
|
+
a SObject that can't be referenced through an EntityDefinition field at all (for example
|
|
577
|
+
ServiceResource and other Setup objects).
|
|
578
|
+
--wait=<value> [default: 33] Deploy poll timeout, in minutes. Only meaningful with --target-org.
|
|
579
|
+
|
|
580
|
+
GLOBAL FLAGS
|
|
581
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
582
|
+
--json Format output as json.
|
|
583
|
+
|
|
584
|
+
DESCRIPTION
|
|
585
|
+
Create a new AT4DX Selector field set inclusion (SelectorConfig_FieldSetInclusion__mdt) in local source and/or a
|
|
586
|
+
connected org.
|
|
587
|
+
|
|
588
|
+
Generates a `SelectorConfig_FieldSetInclusion.<DeveloperName>.md-meta.xml` file from the given flags and writes it
|
|
589
|
+
under --source-dir, deploys it to --target-org, or both. Validates the resulting record — alongside everything else
|
|
590
|
+
already in scope — with the same rules `simply aep at4dx field-set-inclusion validate` uses, and refuses to write if
|
|
591
|
+
that introduces an error-severity issue unless --force is passed. At least one of --source-dir/--target-org is
|
|
592
|
+
required; both may be given at once (write to source and deploy it live in the same run). Given --target-org alone,
|
|
593
|
+
the file is written to a temporary directory, deployed, and discarded — no working-tree footprint.
|
|
594
|
+
|
|
595
|
+
--sobject writes BindingSObject__c by default (pass --sobject-alternate to write BindingSObjectAlternate__c instead,
|
|
596
|
+
for a SObject — such as ServiceResource and other Setup objects — that can't be referenced through an EntityDefinition
|
|
597
|
+
field at all).
|
|
598
|
+
|
|
599
|
+
EXAMPLES
|
|
600
|
+
$ sf simply aep at4dx field-set-inclusion create --source-dir sfdx-source/core --developer-name Account_Contact_Fields --sobject Account --fieldset-name ContactRelatedFields
|
|
601
|
+
|
|
602
|
+
$ sf simply aep at4dx field-set-inclusion create --target-org myOrg --developer-name ServiceResource_Skills --sobject ServiceResource --sobject-alternate --fieldset-name SkillFields
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
_See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/create.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.7.0/packages/simply-aep/lib/commands/simply/aep/at4dx/field-set-inclusion/create.js)_
|
|
606
|
+
|
|
607
|
+
## `sf simply aep at4dx field-set-inclusion list`
|
|
608
|
+
|
|
609
|
+
List the AT4DX Selector field set inclusions configured in an org or local source.
|
|
610
|
+
|
|
611
|
+
```
|
|
612
|
+
USAGE
|
|
613
|
+
$ sf simply aep at4dx field-set-inclusion list [--json] [--flags-dir <value>] [-o <value>] [--api-version <value>] [-d
|
|
614
|
+
<value>...]
|
|
615
|
+
|
|
616
|
+
FLAGS
|
|
617
|
+
-d, --source-dir=<value>... One or more paths to directories containing Salesforce DX source. Use this for
|
|
618
|
+
local-source discovery.
|
|
619
|
+
-o, --target-org=<value> Username or alias of the org to read field set inclusions from. Use this for live-org
|
|
620
|
+
discovery.
|
|
621
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
622
|
+
|
|
623
|
+
GLOBAL FLAGS
|
|
624
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
625
|
+
--json Format output as json.
|
|
626
|
+
|
|
627
|
+
DESCRIPTION
|
|
628
|
+
List the AT4DX Selector field set inclusions configured in an org or local source.
|
|
629
|
+
|
|
630
|
+
Reads `SelectorConfig_FieldSetInclusion__mdt` — either from a live org or from local Salesforce DX source — and lists
|
|
631
|
+
every record found. Unlike `simply aep at4dx binding list`, there's no priority/winner concept: every `IsActive__c:
|
|
632
|
+
true` record for a selector's SObject contributes its field set simultaneously, so this is a flat table, not a
|
|
633
|
+
resolved one. Exactly one of `--target-org` or `--source-dir` must be specified.
|
|
634
|
+
|
|
635
|
+
EXAMPLES
|
|
636
|
+
$ sf simply aep at4dx field-set-inclusion list --target-org myOrg
|
|
637
|
+
|
|
638
|
+
$ sf simply aep at4dx field-set-inclusion list --source-dir sfdx-source/core --source-dir sfdx-source/app
|
|
639
|
+
|
|
640
|
+
$ sf simply aep at4dx field-set-inclusion list --target-org myOrg --json
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
_See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/list.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.7.0/packages/simply-aep/lib/commands/simply/aep/at4dx/field-set-inclusion/list.js)_
|
|
644
|
+
|
|
645
|
+
## `sf simply aep at4dx field-set-inclusion update`
|
|
646
|
+
|
|
647
|
+
Update an existing AT4DX Selector field set inclusion (SelectorConfig_FieldSetInclusion__mdt) in local source and/or a connected org.
|
|
648
|
+
|
|
649
|
+
```
|
|
650
|
+
USAGE
|
|
651
|
+
$ sf simply aep at4dx field-set-inclusion update -n <value> [--json] [--flags-dir <value>] [-d <value>...] [-o <value>] [--api-version <value>]
|
|
652
|
+
[--wait <value>] [--label <value>] [-s <value>] [--sobject-alternate] [-f <value>] [--active] [--force]
|
|
653
|
+
|
|
654
|
+
FLAGS
|
|
655
|
+
-d, --source-dir=<value>... One or more paths to directories containing Salesforce DX source, searched for the
|
|
656
|
+
record to update.
|
|
657
|
+
-f, --fieldset-name=<value> FieldsetName__c — the field set to add to the selector's queried field list. Changing it
|
|
658
|
+
changes which field set is included. If not given, the existing value is kept.
|
|
659
|
+
-n, --developer-name=<value> (required) The DeveloperName of the record to update.
|
|
660
|
+
-o, --target-org=<value> Locate (when --source-dir isn't given) and/or deploy the record to this org.
|
|
661
|
+
-s, --sobject=<value> The SObject API name to bind the field set to. If not given, the existing value is kept.
|
|
662
|
+
--[no-]active IsActive__c. If not given, the existing value is kept. Pass --no-active to deactivate.
|
|
663
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
664
|
+
--force Write (and deploy) even if validation finds an error-severity issue. Validation still
|
|
665
|
+
runs and its issues are still printed and returned.
|
|
666
|
+
--label=<value> The record's label. If not given, the existing label is kept.
|
|
667
|
+
--[no-]sobject-alternate Write --sobject to BindingSObjectAlternate__c instead of BindingSObject__c, for a
|
|
668
|
+
SObject that can't be referenced through an EntityDefinition field at all (for example
|
|
669
|
+
ServiceResource and other Setup objects). If not given, the record keeps whichever field
|
|
670
|
+
it already uses — this flag only needs to be passed to change it.
|
|
671
|
+
--wait=<value> [default: 33] Deploy poll timeout, in minutes. Only meaningful with --target-org.
|
|
672
|
+
|
|
673
|
+
GLOBAL FLAGS
|
|
674
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
675
|
+
--json Format output as json.
|
|
676
|
+
|
|
677
|
+
DESCRIPTION
|
|
678
|
+
Update an existing AT4DX Selector field set inclusion (SelectorConfig_FieldSetInclusion__mdt) in local source and/or a
|
|
679
|
+
connected org.
|
|
680
|
+
|
|
681
|
+
Finds the field set inclusion named --developer-name in local source and/or a connected org, applies only the fields
|
|
682
|
+
given as flags — everything else, including which SObject reference field it uses, is preserved from the found record
|
|
683
|
+
— and rewrites its `.md-meta.xml` file. Validates the resulting record — alongside everything else already in scope —
|
|
684
|
+
with the same rules `simply aep at4dx field-set-inclusion validate` uses, and refuses to write if that introduces an
|
|
685
|
+
error-severity issue unless --force is passed.
|
|
686
|
+
|
|
687
|
+
When --source-dir is given, the record is located there (searched across every directory given, same as
|
|
688
|
+
`list`/`validate`) and that exact file is rewritten; the found file is also deployed if --target-org is given. When
|
|
689
|
+
only --target-org is given, the record is located and updated directly in the org via a temporary file, deployed, then
|
|
690
|
+
discarded — no working-tree footprint.
|
|
691
|
+
|
|
692
|
+
--developer-name identifies the record to update and can't itself be changed by this command.
|
|
693
|
+
|
|
694
|
+
EXAMPLES
|
|
695
|
+
$ sf simply aep at4dx field-set-inclusion update --source-dir sfdx-source/core --source-dir sfdx-source/app --developer-name Account_Contact_Fields --no-active
|
|
696
|
+
|
|
697
|
+
$ sf simply aep at4dx field-set-inclusion update --target-org myOrg --developer-name Account_Contact_Fields --fieldset-name ContactRelatedFieldsV2
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
_See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/update.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.7.0/packages/simply-aep/lib/commands/simply/aep/at4dx/field-set-inclusion/update.js)_
|
|
701
|
+
|
|
702
|
+
## `sf simply aep at4dx field-set-inclusion validate`
|
|
703
|
+
|
|
704
|
+
Validate the AT4DX Selector field set inclusions configured in an org or local source, failing when a wiring problem is found.
|
|
705
|
+
|
|
706
|
+
```
|
|
707
|
+
USAGE
|
|
708
|
+
$ sf simply aep at4dx field-set-inclusion validate [--json] [--flags-dir <value>] [-o <value>] [--api-version <value>]
|
|
709
|
+
[-d <value>...]
|
|
710
|
+
|
|
711
|
+
FLAGS
|
|
712
|
+
-d, --source-dir=<value>... One or more paths to directories containing Salesforce DX source. Use this for
|
|
713
|
+
local-source discovery.
|
|
714
|
+
-o, --target-org=<value> Username or alias of the org to read field set inclusions from. Use this for live-org
|
|
715
|
+
discovery.
|
|
716
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
717
|
+
|
|
718
|
+
GLOBAL FLAGS
|
|
719
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
720
|
+
--json Format output as json.
|
|
721
|
+
|
|
722
|
+
DESCRIPTION
|
|
723
|
+
Validate the AT4DX Selector field set inclusions configured in an org or local source, failing when a wiring problem
|
|
724
|
+
is found.
|
|
725
|
+
|
|
726
|
+
Reads `SelectorConfig_FieldSetInclusion__mdt` — either from a live org or from local Salesforce DX source — and checks
|
|
727
|
+
them for problems `simply aep at4dx field-set-inclusion list` doesn't fail on: a record with no resolvable SObject, an
|
|
728
|
+
ambiguous SObject reference, a SObject reference naming a standard object that can't actually go through an
|
|
729
|
+
EntityDefinition metadata relationship, two records sharing a FieldsetName__c value (unique org-wide, not
|
|
730
|
+
per-SObject), and the same DeveloperName defined more than once. Exactly one of `--target-org` or `--source-dir` must
|
|
731
|
+
be specified.
|
|
732
|
+
|
|
733
|
+
Prints a table of every issue found. Exits non-zero when any issue is an error (a warning alone doesn't fail the
|
|
734
|
+
command) — use this in CI to gate on AT4DX field set inclusion wiring problems before they reach an org.
|
|
735
|
+
|
|
736
|
+
EXAMPLES
|
|
737
|
+
$ sf simply aep at4dx field-set-inclusion validate --target-org myOrg
|
|
738
|
+
|
|
739
|
+
$ sf simply aep at4dx field-set-inclusion validate --source-dir sfdx-source/core --source-dir sfdx-source/app
|
|
740
|
+
|
|
741
|
+
$ sf simply aep at4dx field-set-inclusion validate --target-org myOrg --json
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
_See code: [lib/commands/simply/aep/at4dx/field-set-inclusion/validate.js](https://github.com/SimplySF/simply-node/blob/@simplysf/simply-aep@0.7.0/packages/simply-aep/lib/commands/simply/aep/at4dx/field-set-inclusion/validate.js)_
|
|
544
745
|
<!-- commandsstop -->
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { type At4dxFieldSetInclusionCreateResult } from '@simplysf/simply-aep-core';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new AT4DX Selector field set inclusion (`SelectorConfig_FieldSetInclusion__mdt`) in local
|
|
5
|
+
* DX source and/or a connected org, validating it against everything already scanned before writing.
|
|
6
|
+
*/
|
|
7
|
+
export default class At4dxFieldSetInclusionCreate extends SfCommand<At4dxFieldSetInclusionCreateResult> {
|
|
8
|
+
static readonly summary: string;
|
|
9
|
+
static readonly description: string;
|
|
10
|
+
static readonly examples: string[];
|
|
11
|
+
static readonly flags: {
|
|
12
|
+
'source-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
wait: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
'developer-name': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
label: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
sobject: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
'sobject-alternate': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
20
|
+
'fieldset-name': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
active: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
22
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
23
|
+
'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
|
+
};
|
|
25
|
+
run(): Promise<At4dxFieldSetInclusionCreateResult>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
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 { createFieldSetInclusion, } from '@simplysf/simply-aep-core';
|
|
20
|
+
import { toFieldSetInclusionCliError } from '../../../../../common/fieldSetInclusionWriteError.js';
|
|
21
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
22
|
+
const messages = Messages.loadMessages('@simplysf/simply-aep', 'simply.aep.at4dx.field-set-inclusion.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 Selector field set inclusion (`SelectorConfig_FieldSetInclusion__mdt`) in local
|
|
33
|
+
* DX source and/or a connected org, validating it against everything already scanned before writing.
|
|
34
|
+
*/
|
|
35
|
+
export default class At4dxFieldSetInclusionCreate extends SfCommand {
|
|
36
|
+
static summary = messages.getMessage('summary');
|
|
37
|
+
static description = messages.getMessage('description');
|
|
38
|
+
static examples = messages.getMessages('examples');
|
|
39
|
+
static flags = {
|
|
40
|
+
...SfCommand.baseFlags,
|
|
41
|
+
'source-dir': Flags.directory({
|
|
42
|
+
summary: messages.getMessage('flags.source-dir.summary'),
|
|
43
|
+
char: 'd',
|
|
44
|
+
}),
|
|
45
|
+
'target-org': Flags.optionalOrg({
|
|
46
|
+
summary: messages.getMessage('flags.target-org.summary'),
|
|
47
|
+
char: 'o',
|
|
48
|
+
}),
|
|
49
|
+
'api-version': Flags.orgApiVersion(),
|
|
50
|
+
wait: Flags.string({ summary: messages.getMessage('flags.wait.summary'), default: '33' }),
|
|
51
|
+
'developer-name': Flags.string({
|
|
52
|
+
summary: messages.getMessage('flags.developer-name.summary'),
|
|
53
|
+
char: 'n',
|
|
54
|
+
required: true,
|
|
55
|
+
}),
|
|
56
|
+
label: Flags.string({ summary: messages.getMessage('flags.label.summary') }),
|
|
57
|
+
sobject: Flags.string({
|
|
58
|
+
summary: messages.getMessage('flags.sobject.summary'),
|
|
59
|
+
char: 's',
|
|
60
|
+
required: true,
|
|
61
|
+
}),
|
|
62
|
+
'sobject-alternate': Flags.boolean({
|
|
63
|
+
summary: messages.getMessage('flags.sobject-alternate.summary'),
|
|
64
|
+
allowNo: true,
|
|
65
|
+
}),
|
|
66
|
+
'fieldset-name': Flags.string({
|
|
67
|
+
summary: messages.getMessage('flags.fieldset-name.summary'),
|
|
68
|
+
char: 'f',
|
|
69
|
+
required: true,
|
|
70
|
+
}),
|
|
71
|
+
active: Flags.boolean({
|
|
72
|
+
summary: messages.getMessage('flags.active.summary'),
|
|
73
|
+
allowNo: true,
|
|
74
|
+
default: true,
|
|
75
|
+
}),
|
|
76
|
+
force: Flags.boolean({ summary: messages.getMessage('flags.force.summary'), default: false }),
|
|
77
|
+
};
|
|
78
|
+
async run() {
|
|
79
|
+
const { flags } = await this.parse(At4dxFieldSetInclusionCreate);
|
|
80
|
+
const sourceDir = flags['source-dir'];
|
|
81
|
+
const targetOrg = flags['target-org'];
|
|
82
|
+
if (!sourceDir && !targetOrg) {
|
|
83
|
+
throw messages.createError('error.sourceDirOrTargetOrgRequired');
|
|
84
|
+
}
|
|
85
|
+
const connection = targetOrg?.getConnection(flags['api-version']);
|
|
86
|
+
try {
|
|
87
|
+
const result = await createFieldSetInclusion({
|
|
88
|
+
developerName: flags['developer-name'],
|
|
89
|
+
label: flags.label,
|
|
90
|
+
sobject: flags.sobject,
|
|
91
|
+
sobjectAlternate: flags['sobject-alternate'],
|
|
92
|
+
fieldsetName: flags['fieldset-name'],
|
|
93
|
+
isActive: flags.active,
|
|
94
|
+
force: flags.force,
|
|
95
|
+
}, { sourceDir, connection, wait: Duration.minutes(Number(flags.wait)) });
|
|
96
|
+
if (result.issues.length > 0) {
|
|
97
|
+
this.table({ data: result.issues.map(toIssueDisplayRow), columns: ISSUE_TABLE_COLUMNS });
|
|
98
|
+
}
|
|
99
|
+
this.info(messages.getMessage(result.filePath ? 'info.created' : 'info.createdInOrg', [result.developerName]));
|
|
100
|
+
if (result.deploy) {
|
|
101
|
+
this.info(messages.getMessage('info.deployed', [result.deploy.id]));
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
throw toFieldSetInclusionCliError(error, messages, (issues) => {
|
|
107
|
+
this.table({ data: issues.map(toIssueDisplayRow), columns: ISSUE_TABLE_COLUMNS });
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../../../src/commands/simply/aep/at4dx/field-set-inclusion/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,uBAAuB,GA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AC,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,2BAA2B,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE;gBAC5D,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,20 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { type At4dxFieldSetInclusionListResult } from '@simplysf/simply-aep-core';
|
|
3
|
+
/**
|
|
4
|
+
* Lists the AT4DX Selector field set inclusions (`SelectorConfig_FieldSetInclusion__mdt`) configured
|
|
5
|
+
* in a target org or local DX source. Unlike `binding list`, there's no priority/winner concept — every
|
|
6
|
+
* active record contributes its field set to its SObject's selector.
|
|
7
|
+
*/
|
|
8
|
+
export default class At4dxFieldSetInclusionList extends SfCommand<At4dxFieldSetInclusionListResult> {
|
|
9
|
+
static readonly summary: string;
|
|
10
|
+
static readonly description: string;
|
|
11
|
+
static readonly examples: string[];
|
|
12
|
+
static readonly flags: {
|
|
13
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
'source-dir': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
};
|
|
18
|
+
/** @returns The field set inclusion records found for the requested source. */
|
|
19
|
+
run(): Promise<At4dxFieldSetInclusionListResult>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
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 { scanLocalFieldSetInclusions, scanOrgFieldSetInclusions, } from '@simplysf/simply-aep-core';
|
|
19
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
20
|
+
const messages = Messages.loadMessages('@simplysf/simply-aep', 'simply.aep.at4dx.field-set-inclusion.list');
|
|
21
|
+
function toDisplayRow(record) {
|
|
22
|
+
return {
|
|
23
|
+
developerName: record.developerName,
|
|
24
|
+
sobject: record.sobject,
|
|
25
|
+
fieldsetName: record.fieldsetName,
|
|
26
|
+
active: String(record.isActive),
|
|
27
|
+
source: record.source,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Lists the AT4DX Selector field set inclusions (`SelectorConfig_FieldSetInclusion__mdt`) configured
|
|
32
|
+
* in a target org or local DX source. Unlike `binding list`, there's no priority/winner concept — every
|
|
33
|
+
* active record contributes its field set to its SObject's selector.
|
|
34
|
+
*/
|
|
35
|
+
export default class At4dxFieldSetInclusionList extends SfCommand {
|
|
36
|
+
static summary = messages.getMessage('summary');
|
|
37
|
+
static description = messages.getMessage('description');
|
|
38
|
+
static examples = messages.getMessages('examples');
|
|
39
|
+
static flags = {
|
|
40
|
+
...SfCommand.baseFlags,
|
|
41
|
+
'target-org': Flags.optionalOrg({
|
|
42
|
+
summary: messages.getMessage('flags.target-org.summary'),
|
|
43
|
+
char: 'o',
|
|
44
|
+
}),
|
|
45
|
+
'api-version': Flags.orgApiVersion(),
|
|
46
|
+
'source-dir': Flags.directory({
|
|
47
|
+
summary: messages.getMessage('flags.source-dir.summary'),
|
|
48
|
+
char: 'd',
|
|
49
|
+
exists: true,
|
|
50
|
+
multiple: true,
|
|
51
|
+
}),
|
|
52
|
+
};
|
|
53
|
+
/** @returns The field set inclusion records found for the requested source. */
|
|
54
|
+
async run() {
|
|
55
|
+
const { flags } = await this.parse(At4dxFieldSetInclusionList);
|
|
56
|
+
const targetOrg = flags['target-org'];
|
|
57
|
+
const sourceDirs = flags['source-dir'] ?? [];
|
|
58
|
+
if ((targetOrg && sourceDirs.length > 0) || (!targetOrg && sourceDirs.length === 0)) {
|
|
59
|
+
throw messages.createError('error.targetOrgOrSourceDirRequired');
|
|
60
|
+
}
|
|
61
|
+
let source;
|
|
62
|
+
let records;
|
|
63
|
+
if (targetOrg) {
|
|
64
|
+
const connection = targetOrg.getConnection(flags['api-version']);
|
|
65
|
+
source = targetOrg.getUsername() ?? 'org';
|
|
66
|
+
this.spinner.start(messages.getMessage('info.queryingOrg', [source]));
|
|
67
|
+
let scanResult;
|
|
68
|
+
try {
|
|
69
|
+
scanResult = await scanOrgFieldSetInclusions(connection);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
this.spinner.stop();
|
|
73
|
+
throw messages.createError('error.orgQueryFailed', [error.message]);
|
|
74
|
+
}
|
|
75
|
+
this.spinner.stop();
|
|
76
|
+
if (scanResult.missing) {
|
|
77
|
+
throw messages.createError('error.at4dxNotDetected');
|
|
78
|
+
}
|
|
79
|
+
records = scanResult.records;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
source = 'local';
|
|
83
|
+
this.spinner.start(messages.getMessage('info.scanningLocalSource'));
|
|
84
|
+
try {
|
|
85
|
+
({ records } = scanLocalFieldSetInclusions(sourceDirs));
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
this.spinner.stop();
|
|
89
|
+
throw messages.createError('error.localScanFailed', [error.message]);
|
|
90
|
+
}
|
|
91
|
+
this.spinner.stop();
|
|
92
|
+
if (records.length === 0) {
|
|
93
|
+
throw messages.createError('error.at4dxNotDetected');
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
this.table({
|
|
97
|
+
data: records.map(toDisplayRow),
|
|
98
|
+
columns: [
|
|
99
|
+
{ key: 'developerName', name: 'DEVELOPER NAME' },
|
|
100
|
+
{ key: 'sobject', name: 'SOBJECT' },
|
|
101
|
+
{ key: 'fieldsetName', name: 'FIELDSET NAME' },
|
|
102
|
+
{ key: 'active', name: 'ACTIVE' },
|
|
103
|
+
{ key: 'source', name: 'SOURCE' },
|
|
104
|
+
],
|
|
105
|
+
});
|
|
106
|
+
this.info(messages.getMessage('info.complete', [records.length, source]));
|
|
107
|
+
return { source, records };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../../../src/commands/simply/aep/at4dx/field-set-inclusion/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,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EH,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QAE1E,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC7B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { type At4dxFieldSetInclusionUpdateResult } from '@simplysf/simply-aep-core';
|
|
3
|
+
/**
|
|
4
|
+
* Updates an existing AT4DX Selector field set inclusion (`SelectorConfig_FieldSetInclusion__mdt`) in
|
|
5
|
+
* local DX source and/or a connected org — only the fields given change; everything else, including
|
|
6
|
+
* which SObject reference field it uses, is preserved from the found record.
|
|
7
|
+
*/
|
|
8
|
+
export default class At4dxFieldSetInclusionUpdate extends SfCommand<At4dxFieldSetInclusionUpdateResult> {
|
|
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
|
+
sobject: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
'sobject-alternate': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
21
|
+
'fieldset-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
active: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
23
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
24
|
+
'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
};
|
|
26
|
+
run(): Promise<At4dxFieldSetInclusionUpdateResult>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
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 { updateFieldSetInclusion, } from '@simplysf/simply-aep-core';
|
|
20
|
+
import { toFieldSetInclusionCliError } from '../../../../../common/fieldSetInclusionWriteError.js';
|
|
21
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
22
|
+
const messages = Messages.loadMessages('@simplysf/simply-aep', 'simply.aep.at4dx.field-set-inclusion.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 Selector field set inclusion (`SelectorConfig_FieldSetInclusion__mdt`) in
|
|
33
|
+
* local DX source and/or a connected org — only the fields given change; everything else, including
|
|
34
|
+
* which SObject reference field it uses, is preserved from the found record.
|
|
35
|
+
*/
|
|
36
|
+
export default class At4dxFieldSetInclusionUpdate 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
|
+
exists: true,
|
|
46
|
+
multiple: true,
|
|
47
|
+
}),
|
|
48
|
+
'target-org': Flags.optionalOrg({
|
|
49
|
+
summary: messages.getMessage('flags.target-org.summary'),
|
|
50
|
+
char: 'o',
|
|
51
|
+
}),
|
|
52
|
+
'api-version': Flags.orgApiVersion(),
|
|
53
|
+
wait: Flags.string({ summary: messages.getMessage('flags.wait.summary'), default: '33' }),
|
|
54
|
+
'developer-name': Flags.string({
|
|
55
|
+
summary: messages.getMessage('flags.developer-name.summary'),
|
|
56
|
+
char: 'n',
|
|
57
|
+
required: true,
|
|
58
|
+
}),
|
|
59
|
+
label: Flags.string({ summary: messages.getMessage('flags.label.summary') }),
|
|
60
|
+
sobject: Flags.string({ summary: messages.getMessage('flags.sobject.summary'), char: 's' }),
|
|
61
|
+
'sobject-alternate': Flags.boolean({
|
|
62
|
+
summary: messages.getMessage('flags.sobject-alternate.summary'),
|
|
63
|
+
allowNo: true,
|
|
64
|
+
}),
|
|
65
|
+
'fieldset-name': Flags.string({
|
|
66
|
+
summary: messages.getMessage('flags.fieldset-name.summary'),
|
|
67
|
+
char: 'f',
|
|
68
|
+
}),
|
|
69
|
+
active: Flags.boolean({
|
|
70
|
+
summary: messages.getMessage('flags.active.summary'),
|
|
71
|
+
allowNo: true,
|
|
72
|
+
}),
|
|
73
|
+
force: Flags.boolean({ summary: messages.getMessage('flags.force.summary'), default: false }),
|
|
74
|
+
};
|
|
75
|
+
async run() {
|
|
76
|
+
const { flags } = await this.parse(At4dxFieldSetInclusionUpdate);
|
|
77
|
+
const sourceDirs = flags['source-dir'] ?? [];
|
|
78
|
+
const targetOrg = flags['target-org'];
|
|
79
|
+
if (sourceDirs.length === 0 && !targetOrg) {
|
|
80
|
+
throw messages.createError('error.sourceDirOrTargetOrgRequired');
|
|
81
|
+
}
|
|
82
|
+
const connection = targetOrg?.getConnection(flags['api-version']);
|
|
83
|
+
try {
|
|
84
|
+
const result = await updateFieldSetInclusion({
|
|
85
|
+
developerName: flags['developer-name'],
|
|
86
|
+
label: flags.label,
|
|
87
|
+
sobject: flags.sobject,
|
|
88
|
+
sobjectAlternate: flags['sobject-alternate'],
|
|
89
|
+
fieldsetName: flags['fieldset-name'],
|
|
90
|
+
isActive: flags.active,
|
|
91
|
+
force: flags.force,
|
|
92
|
+
}, { sourceDirs, connection, wait: Duration.minutes(Number(flags.wait)) });
|
|
93
|
+
if (result.issues.length > 0) {
|
|
94
|
+
this.table({ data: result.issues.map(toIssueDisplayRow), columns: ISSUE_TABLE_COLUMNS });
|
|
95
|
+
}
|
|
96
|
+
this.info(messages.getMessage(result.filePath ? 'info.updated' : 'info.updatedInOrg', [result.developerName]));
|
|
97
|
+
if (result.deploy) {
|
|
98
|
+
this.info(messages.getMessage('info.deployed', [result.deploy.id]));
|
|
99
|
+
}
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
throw toFieldSetInclusionCliError(error, messages, (issues) => {
|
|
104
|
+
this.table({ data: issues.map(toIssueDisplayRow), columns: ISSUE_TABLE_COLUMNS });
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../../../src/commands/simply/aep/at4dx/field-set-inclusion/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,uBAAuB,GAGxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AAEnG,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,sBAAsB,EAAE,6CAA6C,CAAC,CAAC;AAI9G,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,KAA6B;IACtD,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,CAA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force/sf-plugins-core';
|
|
2
|
+
import { type At4dxFieldSetInclusionValidateResult } from '@simplysf/simply-aep-core';
|
|
3
|
+
/**
|
|
4
|
+
* Validates the AT4DX Selector field set inclusions (`SelectorConfig_FieldSetInclusion__mdt`)
|
|
5
|
+
* configured in a target org or local DX source — wiring problems that are invisible to
|
|
6
|
+
* `field-set-inclusion list` — and fails (non-zero exit) when any of them is a real bug, for use as a
|
|
7
|
+
* CI gate.
|
|
8
|
+
*/
|
|
9
|
+
export default class At4dxFieldSetInclusionValidate extends SfCommand<At4dxFieldSetInclusionValidateResult> {
|
|
10
|
+
static readonly summary: string;
|
|
11
|
+
static readonly description: string;
|
|
12
|
+
static readonly examples: string[];
|
|
13
|
+
static readonly flags: {
|
|
14
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
'source-dir': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
};
|
|
19
|
+
/** @returns The validation issues found for the requested source. Sets `process.exitCode = 1` when any issue is severity `error`. */
|
|
20
|
+
run(): Promise<At4dxFieldSetInclusionValidateResult>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
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 { scanLocalFieldSetInclusions, scanOrgFieldSetInclusions, validateFieldSetInclusions, } from '@simplysf/simply-aep-core';
|
|
19
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
20
|
+
const messages = Messages.loadMessages('@simplysf/simply-aep', 'simply.aep.at4dx.field-set-inclusion.validate');
|
|
21
|
+
function toDisplayRow(issue) {
|
|
22
|
+
return {
|
|
23
|
+
severity: issue.severity,
|
|
24
|
+
rule: issue.rule,
|
|
25
|
+
sobject: issue.sobject ?? '',
|
|
26
|
+
developerName: issue.developerName ?? '',
|
|
27
|
+
source: issue.source,
|
|
28
|
+
message: issue.message,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const ISSUE_TABLE_COLUMNS = [
|
|
32
|
+
{ key: 'severity', name: 'SEVERITY' },
|
|
33
|
+
{ key: 'rule', name: 'RULE' },
|
|
34
|
+
{ key: 'sobject', name: 'SOBJECT' },
|
|
35
|
+
{ key: 'developerName', name: 'DEVELOPER NAME' },
|
|
36
|
+
{ key: 'source', name: 'SOURCE' },
|
|
37
|
+
{ key: 'message', name: 'MESSAGE' },
|
|
38
|
+
];
|
|
39
|
+
/**
|
|
40
|
+
* Validates the AT4DX Selector field set inclusions (`SelectorConfig_FieldSetInclusion__mdt`)
|
|
41
|
+
* configured in a target org or local DX source — wiring problems that are invisible to
|
|
42
|
+
* `field-set-inclusion list` — and fails (non-zero exit) when any of them is a real bug, for use as a
|
|
43
|
+
* CI gate.
|
|
44
|
+
*/
|
|
45
|
+
export default class At4dxFieldSetInclusionValidate extends SfCommand {
|
|
46
|
+
static summary = messages.getMessage('summary');
|
|
47
|
+
static description = messages.getMessage('description');
|
|
48
|
+
static examples = messages.getMessages('examples');
|
|
49
|
+
static flags = {
|
|
50
|
+
...SfCommand.baseFlags,
|
|
51
|
+
'target-org': Flags.optionalOrg({
|
|
52
|
+
summary: messages.getMessage('flags.target-org.summary'),
|
|
53
|
+
char: 'o',
|
|
54
|
+
}),
|
|
55
|
+
'api-version': Flags.orgApiVersion(),
|
|
56
|
+
'source-dir': Flags.directory({
|
|
57
|
+
summary: messages.getMessage('flags.source-dir.summary'),
|
|
58
|
+
char: 'd',
|
|
59
|
+
exists: true,
|
|
60
|
+
multiple: true,
|
|
61
|
+
}),
|
|
62
|
+
};
|
|
63
|
+
/** @returns The validation issues found for the requested source. Sets `process.exitCode = 1` when any issue is severity `error`. */
|
|
64
|
+
async run() {
|
|
65
|
+
const { flags } = await this.parse(At4dxFieldSetInclusionValidate);
|
|
66
|
+
const targetOrg = flags['target-org'];
|
|
67
|
+
const sourceDirs = flags['source-dir'] ?? [];
|
|
68
|
+
if ((targetOrg && sourceDirs.length > 0) || (!targetOrg && sourceDirs.length === 0)) {
|
|
69
|
+
throw messages.createError('error.targetOrgOrSourceDirRequired');
|
|
70
|
+
}
|
|
71
|
+
let source;
|
|
72
|
+
let recordCount;
|
|
73
|
+
let issues;
|
|
74
|
+
if (targetOrg) {
|
|
75
|
+
const connection = targetOrg.getConnection(flags['api-version']);
|
|
76
|
+
source = targetOrg.getUsername() ?? 'org';
|
|
77
|
+
this.spinner.start(messages.getMessage('info.queryingOrg', [source]));
|
|
78
|
+
let scanResult;
|
|
79
|
+
try {
|
|
80
|
+
scanResult = await scanOrgFieldSetInclusions(connection);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
this.spinner.stop();
|
|
84
|
+
throw messages.createError('error.orgQueryFailed', [error.message]);
|
|
85
|
+
}
|
|
86
|
+
this.spinner.stop();
|
|
87
|
+
if (scanResult.missing) {
|
|
88
|
+
throw messages.createError('error.at4dxNotDetected');
|
|
89
|
+
}
|
|
90
|
+
recordCount = scanResult.records.length;
|
|
91
|
+
issues = validateFieldSetInclusions(scanResult.records, {
|
|
92
|
+
malformed: scanResult.malformed,
|
|
93
|
+
ambiguous: scanResult.ambiguous,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
source = 'local';
|
|
98
|
+
this.spinner.start(messages.getMessage('info.scanningLocalSource'));
|
|
99
|
+
let scanResult;
|
|
100
|
+
try {
|
|
101
|
+
scanResult = scanLocalFieldSetInclusions(sourceDirs);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
this.spinner.stop();
|
|
105
|
+
throw messages.createError('error.localScanFailed', [error.message]);
|
|
106
|
+
}
|
|
107
|
+
this.spinner.stop();
|
|
108
|
+
if (scanResult.records.length === 0 && scanResult.malformed.length === 0) {
|
|
109
|
+
throw messages.createError('error.at4dxNotDetected');
|
|
110
|
+
}
|
|
111
|
+
recordCount = scanResult.records.length;
|
|
112
|
+
issues = validateFieldSetInclusions(scanResult.records, {
|
|
113
|
+
malformed: scanResult.malformed,
|
|
114
|
+
ambiguous: scanResult.ambiguous,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
if (issues.length > 0) {
|
|
118
|
+
this.table({ data: issues.map(toDisplayRow), columns: ISSUE_TABLE_COLUMNS });
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
this.info(messages.getMessage('info.valid', [recordCount, source]));
|
|
122
|
+
}
|
|
123
|
+
if (issues.some((issue) => issue.severity === 'error')) {
|
|
124
|
+
process.exitCode = 1;
|
|
125
|
+
}
|
|
126
|
+
return { source, recordCount, issues };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../../../src/commands/simply/aep/at4dx/field-set-inclusion/validate.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
/**
|
|
4
|
+
* Maps a `FieldSetInclusionWriteError` thrown by `createFieldSetInclusion`/`updateFieldSetInclusion`
|
|
5
|
+
* onto the calling command's own `error.*` message keys, shared by `create.ts`/`update.ts` since both
|
|
6
|
+
* throw the same error type for the same set of codes. Mirrors `bindingWriteError.ts`'s
|
|
7
|
+
* `toBindingCliError` — see docs/design/0016-at4dx-selector-config-field-set-inclusion.md.
|
|
8
|
+
*
|
|
9
|
+
* @param error - Whatever `createFieldSetInclusion`/`updateFieldSetInclusion` rejected with.
|
|
10
|
+
* @param messages - The calling command's own loaded message catalog.
|
|
11
|
+
* @param printIssues - Renders a validation issue table (the command's own `this.table`-based printer).
|
|
12
|
+
* @returns An `Error` ready to throw from the command's `run()` — an `SfError` built from a message key when `error` is a recognized `FieldSetInclusionWriteError`, or `error` itself (coerced to `Error`) otherwise.
|
|
13
|
+
*/
|
|
14
|
+
export declare function toFieldSetInclusionCliError(error: unknown, messages: Messages<string>, printIssues: (issues: FieldSetInclusionIssue[]) => void): Error;
|
|
@@ -0,0 +1,56 @@
|
|
|
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 { FieldSetInclusionWriteError } from '@simplysf/simply-aep-core';
|
|
17
|
+
/**
|
|
18
|
+
* Maps a `FieldSetInclusionWriteError` thrown by `createFieldSetInclusion`/`updateFieldSetInclusion`
|
|
19
|
+
* onto the calling command's own `error.*` message keys, shared by `create.ts`/`update.ts` since both
|
|
20
|
+
* throw the same error type for the same set of codes. Mirrors `bindingWriteError.ts`'s
|
|
21
|
+
* `toBindingCliError` — see docs/design/0016-at4dx-selector-config-field-set-inclusion.md.
|
|
22
|
+
*
|
|
23
|
+
* @param error - Whatever `createFieldSetInclusion`/`updateFieldSetInclusion` rejected with.
|
|
24
|
+
* @param messages - The calling command's own loaded message catalog.
|
|
25
|
+
* @param printIssues - Renders a validation issue table (the command's own `this.table`-based printer).
|
|
26
|
+
* @returns An `Error` ready to throw from the command's `run()` — an `SfError` built from a message key when `error` is a recognized `FieldSetInclusionWriteError`, or `error` itself (coerced to `Error`) otherwise.
|
|
27
|
+
*/
|
|
28
|
+
export function toFieldSetInclusionCliError(error, messages, printIssues) {
|
|
29
|
+
if (!(error instanceof FieldSetInclusionWriteError)) {
|
|
30
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
31
|
+
}
|
|
32
|
+
switch (error.code) {
|
|
33
|
+
case 'source-or-target-required':
|
|
34
|
+
return messages.createError('error.sourceDirOrTargetOrgRequired');
|
|
35
|
+
case 'invalid-developer-name':
|
|
36
|
+
return messages.createError('error.invalidDeveloperName', [error.message]);
|
|
37
|
+
case 'label-too-long':
|
|
38
|
+
return messages.createError('error.labelTooLong', [error.message]);
|
|
39
|
+
case 'developer-name-already-exists':
|
|
40
|
+
return messages.createError('error.developerNameAlreadyExists', [error.message]);
|
|
41
|
+
case 'developer-name-not-found':
|
|
42
|
+
return messages.createError('error.developerNameNotFound', [error.message]);
|
|
43
|
+
case 'no-fields-to-update':
|
|
44
|
+
return messages.createError('error.noFieldsToUpdate');
|
|
45
|
+
case 'at4dx-not-detected':
|
|
46
|
+
return messages.createError('error.at4dxNotDetected', [error.message]);
|
|
47
|
+
case 'validation-failed':
|
|
48
|
+
printIssues(error.issues ?? []);
|
|
49
|
+
return messages.createError('error.validationFailed');
|
|
50
|
+
case 'deploy-failed':
|
|
51
|
+
return messages.createError('error.deployFailed', [error.message]);
|
|
52
|
+
default:
|
|
53
|
+
return error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=fieldSetInclusionWriteError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldSetInclusionWriteError.js","sourceRoot":"","sources":["../../src/common/fieldSetInclusionWriteError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,2BAA2B,EAA+B,MAAM,2BAA2B,CAAC;AAErG;;;;;;;;;;GAUG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAAc,EACd,QAA0B,EAC1B,WAAuD;IAEvD,IAAI,CAAC,CAAC,KAAK,YAAY,2BAA2B,CAAC,EAAE,CAAC;QACpD,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,103 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Create a new AT4DX Selector field set inclusion (SelectorConfig_FieldSetInclusion__mdt) in local source and/or a connected org.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Generates a `SelectorConfig_FieldSetInclusion.<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 field-set-inclusion 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
|
+
--sobject writes BindingSObject__c by default (pass --sobject-alternate to write BindingSObjectAlternate__c instead, for a SObject — such as ServiceResource and other Setup objects — that can't be referenced through an EntityDefinition field at all).
|
|
10
|
+
|
|
11
|
+
# flags.source-dir.summary
|
|
12
|
+
|
|
13
|
+
The package directory to create the field set inclusion'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 field set inclusion 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.sobject.summary
|
|
32
|
+
|
|
33
|
+
The SObject API name to bind the field set to (BindingSObject__c, or BindingSObjectAlternate__c with --sobject-alternate).
|
|
34
|
+
|
|
35
|
+
# flags.sobject-alternate.summary
|
|
36
|
+
|
|
37
|
+
Write --sobject to BindingSObjectAlternate__c instead of BindingSObject__c. Use this for a SObject that can't be referenced through an EntityDefinition field at all (for example ServiceResource and other Setup objects).
|
|
38
|
+
|
|
39
|
+
# flags.fieldset-name.summary
|
|
40
|
+
|
|
41
|
+
FieldsetName__c — the field set to add to the selector's queried field list. Unique org-wide across every SObject, not per-SObject.
|
|
42
|
+
|
|
43
|
+
# flags.active.summary
|
|
44
|
+
|
|
45
|
+
IsActive__c. Defaults to true, matching the Custom Metadata Type's own default. Pass --no-active to create it inactive.
|
|
46
|
+
|
|
47
|
+
# flags.force.summary
|
|
48
|
+
|
|
49
|
+
Write (and deploy) even if validation finds an error-severity issue. Validation still runs and its issues are still printed and returned.
|
|
50
|
+
|
|
51
|
+
# examples
|
|
52
|
+
|
|
53
|
+
- <%= config.bin %> <%= command.id %> --source-dir sfdx-source/core --developer-name Account_Contact_Fields --sobject Account --fieldset-name ContactRelatedFields
|
|
54
|
+
|
|
55
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg --developer-name ServiceResource_Skills --sobject ServiceResource --sobject-alternate --fieldset-name SkillFields
|
|
56
|
+
|
|
57
|
+
# error.sourceDirOrTargetOrgRequired
|
|
58
|
+
|
|
59
|
+
You must specify at least one of --source-dir or --target-org.
|
|
60
|
+
|
|
61
|
+
# error.invalidDeveloperName
|
|
62
|
+
|
|
63
|
+
%s
|
|
64
|
+
|
|
65
|
+
# error.labelTooLong
|
|
66
|
+
|
|
67
|
+
%s
|
|
68
|
+
|
|
69
|
+
# error.developerNameAlreadyExists
|
|
70
|
+
|
|
71
|
+
%s
|
|
72
|
+
|
|
73
|
+
# error.developerNameNotFound
|
|
74
|
+
|
|
75
|
+
%s
|
|
76
|
+
|
|
77
|
+
# error.noFieldsToUpdate
|
|
78
|
+
|
|
79
|
+
At least one field besides --developer-name must be given to update.
|
|
80
|
+
|
|
81
|
+
# error.at4dxNotDetected
|
|
82
|
+
|
|
83
|
+
%s
|
|
84
|
+
|
|
85
|
+
# error.validationFailed
|
|
86
|
+
|
|
87
|
+
Writing this record would introduce a wiring problem AT4DX validation already knows how to catch. Pass --force to write anyway.
|
|
88
|
+
|
|
89
|
+
# error.deployFailed
|
|
90
|
+
|
|
91
|
+
%s
|
|
92
|
+
|
|
93
|
+
# info.created
|
|
94
|
+
|
|
95
|
+
Created %s
|
|
96
|
+
|
|
97
|
+
# info.createdInOrg
|
|
98
|
+
|
|
99
|
+
Created %s in the org
|
|
100
|
+
|
|
101
|
+
# info.deployed
|
|
102
|
+
|
|
103
|
+
Deployed (id: %s)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
List the AT4DX Selector field set inclusions configured in an org or local source.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Reads `SelectorConfig_FieldSetInclusion__mdt` — either from a live org or from local Salesforce DX source — and lists every record found. Unlike `simply aep at4dx binding list`, there's no priority/winner concept: every `IsActive__c: true` record for a selector's SObject contributes its field set simultaneously, so this is a flat table, not a resolved one. Exactly one of `--target-org` or `--source-dir` must be specified.
|
|
8
|
+
|
|
9
|
+
# flags.target-org.summary
|
|
10
|
+
|
|
11
|
+
Username or alias of the org to read field set inclusions from. Use this for live-org discovery.
|
|
12
|
+
|
|
13
|
+
# flags.source-dir.summary
|
|
14
|
+
|
|
15
|
+
One or more paths to directories containing Salesforce DX source. Use this for local-source discovery.
|
|
16
|
+
|
|
17
|
+
# examples
|
|
18
|
+
|
|
19
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg
|
|
20
|
+
|
|
21
|
+
- <%= config.bin %> <%= command.id %> --source-dir sfdx-source/core --source-dir sfdx-source/app
|
|
22
|
+
|
|
23
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg --json
|
|
24
|
+
|
|
25
|
+
# error.targetOrgOrSourceDirRequired
|
|
26
|
+
|
|
27
|
+
You must specify either --target-org or --source-dir, but not both.
|
|
28
|
+
|
|
29
|
+
# error.at4dxNotDetected
|
|
30
|
+
|
|
31
|
+
AT4DX doesn't appear to be present in this source: the SelectorConfig_FieldSetInclusion__mdt Custom Metadata Type wasn't found.
|
|
32
|
+
|
|
33
|
+
# error.localScanFailed
|
|
34
|
+
|
|
35
|
+
Failed to scan the project directory: %s
|
|
36
|
+
|
|
37
|
+
# error.orgQueryFailed
|
|
38
|
+
|
|
39
|
+
Failed to query field set inclusions from the org: %s
|
|
40
|
+
|
|
41
|
+
# info.queryingOrg
|
|
42
|
+
|
|
43
|
+
Querying field set inclusions from %s...
|
|
44
|
+
|
|
45
|
+
# info.scanningLocalSource
|
|
46
|
+
|
|
47
|
+
Scanning local source for field set inclusions...
|
|
48
|
+
|
|
49
|
+
# info.complete
|
|
50
|
+
|
|
51
|
+
Found %s field set inclusion(s) in %s
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Update an existing AT4DX Selector field set inclusion (SelectorConfig_FieldSetInclusion__mdt) in local source and/or a connected org.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Finds the field set inclusion named --developer-name in local source and/or a connected org, applies only the fields given as flags — everything else, including which SObject reference field it uses, 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 field-set-inclusion 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.
|
|
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.sobject.summary
|
|
34
|
+
|
|
35
|
+
The SObject API name to bind the field set to. If not given, the existing value is kept.
|
|
36
|
+
|
|
37
|
+
# flags.sobject-alternate.summary
|
|
38
|
+
|
|
39
|
+
Write --sobject to BindingSObjectAlternate__c instead of BindingSObject__c, for a SObject that can't be referenced through an EntityDefinition field at all (for example ServiceResource and other Setup objects). If not given, the record keeps whichever field it already uses — this flag only needs to be passed to change it.
|
|
40
|
+
|
|
41
|
+
# flags.fieldset-name.summary
|
|
42
|
+
|
|
43
|
+
FieldsetName__c — the field set to add to the selector's queried field list. Changing it changes which field set is included. If not given, the existing value is kept.
|
|
44
|
+
|
|
45
|
+
# flags.active.summary
|
|
46
|
+
|
|
47
|
+
IsActive__c. If not given, the existing value is kept. Pass --no-active to deactivate.
|
|
48
|
+
|
|
49
|
+
# flags.force.summary
|
|
50
|
+
|
|
51
|
+
Write (and deploy) even if validation finds an error-severity issue. Validation still runs and its issues are still printed and returned.
|
|
52
|
+
|
|
53
|
+
# examples
|
|
54
|
+
|
|
55
|
+
- <%= config.bin %> <%= command.id %> --source-dir sfdx-source/core --source-dir sfdx-source/app --developer-name Account_Contact_Fields --no-active
|
|
56
|
+
|
|
57
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg --developer-name Account_Contact_Fields --fieldset-name ContactRelatedFieldsV2
|
|
58
|
+
|
|
59
|
+
# error.sourceDirOrTargetOrgRequired
|
|
60
|
+
|
|
61
|
+
You must specify at least one of --source-dir or --target-org.
|
|
62
|
+
|
|
63
|
+
# error.invalidDeveloperName
|
|
64
|
+
|
|
65
|
+
%s
|
|
66
|
+
|
|
67
|
+
# error.labelTooLong
|
|
68
|
+
|
|
69
|
+
%s
|
|
70
|
+
|
|
71
|
+
# error.developerNameAlreadyExists
|
|
72
|
+
|
|
73
|
+
%s
|
|
74
|
+
|
|
75
|
+
# error.developerNameNotFound
|
|
76
|
+
|
|
77
|
+
%s
|
|
78
|
+
|
|
79
|
+
# error.noFieldsToUpdate
|
|
80
|
+
|
|
81
|
+
At least one field besides --developer-name must be given to update.
|
|
82
|
+
|
|
83
|
+
# error.at4dxNotDetected
|
|
84
|
+
|
|
85
|
+
%s
|
|
86
|
+
|
|
87
|
+
# error.validationFailed
|
|
88
|
+
|
|
89
|
+
Writing this record would introduce a wiring problem AT4DX validation already knows how to catch. Pass --force to write anyway.
|
|
90
|
+
|
|
91
|
+
# error.deployFailed
|
|
92
|
+
|
|
93
|
+
%s
|
|
94
|
+
|
|
95
|
+
# info.updated
|
|
96
|
+
|
|
97
|
+
Updated %s
|
|
98
|
+
|
|
99
|
+
# info.updatedInOrg
|
|
100
|
+
|
|
101
|
+
Updated %s in the org
|
|
102
|
+
|
|
103
|
+
# info.deployed
|
|
104
|
+
|
|
105
|
+
Deployed (id: %s)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Validate the AT4DX Selector field set inclusions configured in an org or local source, failing when a wiring problem is found.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Reads `SelectorConfig_FieldSetInclusion__mdt` — either from a live org or from local Salesforce DX source — and checks them for problems `simply aep at4dx field-set-inclusion list` doesn't fail on: a record with no resolvable SObject, an ambiguous SObject reference, a SObject reference naming a standard object that can't actually go through an EntityDefinition metadata relationship, two records sharing a FieldsetName__c value (unique org-wide, not per-SObject), and the same DeveloperName defined more than once. Exactly one of `--target-org` or `--source-dir` must be specified.
|
|
8
|
+
|
|
9
|
+
Prints a table of every issue found. Exits non-zero when any issue is an error (a warning alone doesn't fail the command) — use this in CI to gate on AT4DX field set inclusion wiring problems before they reach an org.
|
|
10
|
+
|
|
11
|
+
# flags.target-org.summary
|
|
12
|
+
|
|
13
|
+
Username or alias of the org to read field set inclusions from. Use this for live-org discovery.
|
|
14
|
+
|
|
15
|
+
# flags.source-dir.summary
|
|
16
|
+
|
|
17
|
+
One or more paths to directories containing Salesforce DX source. Use this for local-source discovery.
|
|
18
|
+
|
|
19
|
+
# examples
|
|
20
|
+
|
|
21
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg
|
|
22
|
+
|
|
23
|
+
- <%= config.bin %> <%= command.id %> --source-dir sfdx-source/core --source-dir sfdx-source/app
|
|
24
|
+
|
|
25
|
+
- <%= config.bin %> <%= command.id %> --target-org myOrg --json
|
|
26
|
+
|
|
27
|
+
# error.targetOrgOrSourceDirRequired
|
|
28
|
+
|
|
29
|
+
You must specify either --target-org or --source-dir, but not both.
|
|
30
|
+
|
|
31
|
+
# error.at4dxNotDetected
|
|
32
|
+
|
|
33
|
+
AT4DX doesn't appear to be present in this source: the SelectorConfig_FieldSetInclusion__mdt Custom Metadata Type wasn't found.
|
|
34
|
+
|
|
35
|
+
# error.localScanFailed
|
|
36
|
+
|
|
37
|
+
Failed to scan the project directory: %s
|
|
38
|
+
|
|
39
|
+
# error.orgQueryFailed
|
|
40
|
+
|
|
41
|
+
Failed to query field set inclusions from the org: %s
|
|
42
|
+
|
|
43
|
+
# info.queryingOrg
|
|
44
|
+
|
|
45
|
+
Querying field set inclusions from %s...
|
|
46
|
+
|
|
47
|
+
# info.scanningLocalSource
|
|
48
|
+
|
|
49
|
+
Scanning local source for field set inclusions...
|
|
50
|
+
|
|
51
|
+
# info.valid
|
|
52
|
+
|
|
53
|
+
No issues found across %s field set inclusion(s) in %s
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysf/simply-aep",
|
|
3
3
|
"description": "Commands for Apex Enterprise Patterns tooling (fflib, force-di, AT4DX)",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.1",
|
|
5
5
|
"author": "@ClayChipps",
|
|
6
6
|
"homepage": "https://github.com/SimplySF/simply-node",
|
|
7
7
|
"bugs": "https://github.com/SimplySF/simply-node/issues",
|
|
@@ -60,11 +60,11 @@
|
|
|
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.8.0",
|
|
64
64
|
"@simplysf/simply-core": "^1.5.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@oclif/plugin-command-snapshot": "^5.
|
|
67
|
+
"@oclif/plugin-command-snapshot": "^5.4.0",
|
|
68
68
|
"@salesforce/plugin-command-reference": "^3.1.99",
|
|
69
69
|
"@salesforce/source-deploy-retrieve": "^12.37.2",
|
|
70
70
|
"@vitest/coverage-v8": "^4.1.10",
|
|
@@ -208,5 +208,5 @@
|
|
|
208
208
|
"output": []
|
|
209
209
|
}
|
|
210
210
|
},
|
|
211
|
-
"gitHead": "
|
|
211
|
+
"gitHead": "9f306290cf56e9d59bb54dcd209d84fddb0adabb"
|
|
212
212
|
}
|