@jayree/sfdx-plugin-manifest 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
package/LICENSE.txt ADDED
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2021, jayree
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+
8
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
+
10
+ * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,147 @@
1
+ @jayree/sfdx-plugin-manifest
2
+ ==========================
3
+
4
+ jayree sfdx manifest commands
5
+
6
+ [![sfdx](https://img.shields.io/badge/cli-sfdx-brightgreen.svg)](https://developer.salesforce.com/tools/sfdxcli)
7
+ [![Version](https://img.shields.io/npm/v/@jayree/sfdx-plugin-manifest.svg)](https://npmjs.org/package/@jayree/sfdx-plugin-manifest)
8
+ [![CircleCI](https://circleci.com/gh/jayree/sfdx-plugin-manifest/tree/main.svg?style=shield)](https://circleci.com/gh/jayree/sfdx-plugin-manifest/tree/main)
9
+ [![Downloads/week](https://img.shields.io/npm/dw/@jayree/sfdx-plugin-manifest.svg)](https://npmjs.org/package/@jayree/sfdx-plugin-manifest)
10
+ [![License](https://img.shields.io/npm/l/@jayree/sfdx-plugin-manifest.svg)](https://github.com/jayree-plugins/sfdx-plugin-manifest/blob/main/package.json)
11
+
12
+ <!-- toc -->
13
+
14
+ <!-- tocstop -->
15
+ <!-- install -->
16
+ <!-- usage -->
17
+ ```sh-session
18
+ $ sfdx plugins:install @jayree/sfdx-plugin-manifest
19
+ $ sfdx jayree:COMMAND
20
+ running command...
21
+ $ sfdx plugins
22
+ @jayree/sfdx-plugin-manifest 1.0.0
23
+ $ sfdx help jayree:COMMAND
24
+ USAGE
25
+ $ sfdx jayree:COMMAND
26
+ ...
27
+ ```
28
+ <!-- usagestop -->
29
+ <!-- commands -->
30
+ * [`sfdx jayree:manifest:cleanup`](#sfdx-jayreemanifestcleanup)
31
+ * [`sfdx jayree:manifest:generate`](#sfdx-jayreemanifestgenerate)
32
+ * [`sfdx jayree:manifest:git:diff`](#sfdx-jayreemanifestgitdiff)
33
+
34
+ ### `sfdx jayree:manifest:cleanup`
35
+
36
+ removes those tags from a manifest file that are present in a second manifest file
37
+
38
+ ```
39
+ USAGE
40
+ $ sfdx jayree:manifest:cleanup [-x <filepath>] [-f <filepath>] [--json] [--loglevel
41
+ trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
42
+
43
+ OPTIONS
44
+ -f, --file=file path to the second 'cleanup'
45
+ manifest file
46
+
47
+ -x, --manifest=manifest path to the manifest file
48
+
49
+ --json format output as json
50
+
51
+ --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
52
+ this command invocation
53
+ ```
54
+
55
+ _See code: [commands/jayree/manifest/cleanup.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v1.0.0/commands/jayree/manifest/cleanup.ts)_
56
+
57
+ ### `sfdx jayree:manifest:generate`
58
+
59
+ generate a complete package xml form the specified org
60
+
61
+ ```
62
+ USAGE
63
+ $ sfdx jayree:manifest:generate [-q <array>] [-c] [-w] [--includeflowversions] [-f <string>] [-x] [-u <string>]
64
+ [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
65
+
66
+ OPTIONS
67
+ -c, --matchcase enable 'match case' for the
68
+ quickfilter
69
+
70
+ -f, --file=file write to 'file' instead of stdout
71
+
72
+ -q, --quickfilter=quickfilter csv separated list of metadata type,
73
+ member or file names to filter on
74
+
75
+ -u, --targetusername=targetusername username or alias for the target
76
+ org; overrides default target org
77
+
78
+ -w, --matchwholeword enable 'match whole word' for the
79
+ quickfilter
80
+
81
+ -x, --excludemanaged exclude managed packages from output
82
+
83
+ --apiversion=apiversion override the api version used for
84
+ api requests made by this command
85
+
86
+ --includeflowversions include flow versions as with api
87
+ version 43.0
88
+
89
+ --json format output as json
90
+
91
+ --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
92
+ this command invocation
93
+
94
+ ALIASES
95
+ $ sfdx jayree:packagexml
96
+
97
+ EXAMPLES
98
+ $ sfdx jayree:manifest:generate --targetusername myOrg@example.com
99
+ <?xml version='1.0' encoding='UTF-8'?>
100
+ <Package xmlns='http://soap.sforce.com/2006/04/metadata'>...</Package>
101
+ ```
102
+
103
+ _See code: [commands/jayree/manifest/generate.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v1.0.0/commands/jayree/manifest/generate.ts)_
104
+
105
+ ### `sfdx jayree:manifest:git:diff`
106
+
107
+ create a manifest and destructiveChanges manifest using 'git diff' data
108
+
109
+ ```
110
+ USAGE
111
+ $ sfdx jayree:manifest:git:diff [--json] [--loglevel
112
+ trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
113
+
114
+ ARGUMENTS
115
+ REF1 base commit or branch
116
+ REF2 commit or branch to compare to the base commit
117
+
118
+ OPTIONS
119
+ --json format output as json
120
+
121
+ --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
122
+ this command invocation
123
+
124
+ DESCRIPTION
125
+ Creates a manifest and destructiveChanges manifest using 'git diff' data.
126
+
127
+ You can use all ways to spell <commit> which are valid for 'git diff'.
128
+ (See https://git-scm.com/docs/git-diff)
129
+
130
+ EXAMPLES
131
+ $ sfdx jayree:manifest:git:diff <commit> <commit>
132
+ $ sfdx jayree:manifest:git:diff <commit>..<commit>
133
+ uses the changes between two arbitrary <commit>
134
+
135
+ $ sfdx jayree:manifest:git:diff <commit>...<commit>
136
+ uses the changes on the branch containing and up to the second <commit>, starting at a common ancestor of both
137
+ <commit>.
138
+
139
+ $ sfdx jayree:manifest:git:diff branchA..branchB
140
+ uses the diff of what is unique in branchB (REF2) and unique in branchA (REF1)
141
+
142
+ $ sfdx jayree:manifest:git:diff branchA...branchB
143
+ uses the diff of what is unique in branchB (REF2)
144
+ ```
145
+
146
+ _See code: [commands/jayree/manifest/git/diff.ts](https://github.com/jayree/sfdx-plugin-manifest/blob/v1.0.0/commands/jayree/manifest/git/diff.ts)_
147
+ <!-- commandsstop -->
package/bin/is-sfdx.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ 'use strict'
3
+ process.exit((process.env.SFDX_BINPATH || process.env.SFDX_UPDATE_INSTRUCTIONS) ? 0 : 1)
@@ -0,0 +1,11 @@
1
+ import { FlagsConfig } from '@salesforce/command';
2
+ import { AnyJson } from '@salesforce/ts-types';
3
+ import { JayreeSfdxCommand } from '../../../jayreeSfdxCommand';
4
+ export default class CleanupManifest extends JayreeSfdxCommand {
5
+ static description: string;
6
+ protected static flagsConfig: FlagsConfig;
7
+ protected static requiresUsername: boolean;
8
+ protected static supportsDevhubUsername: boolean;
9
+ protected static requiresProject: boolean;
10
+ run(): Promise<AnyJson>;
11
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /*
4
+ * Copyright (c) 2021, jayree
5
+ * All rights reserved.
6
+ * Licensed under the BSD 3-Clause license.
7
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
8
+ */
9
+ const command_1 = require("@salesforce/command");
10
+ const core_1 = require("@salesforce/core");
11
+ const fs = require("fs-extra");
12
+ const jayreeSfdxCommand_1 = require("../../../jayreeSfdxCommand");
13
+ const manifest_1 = require("../../../utils/manifest");
14
+ core_1.Messages.importMessagesDirectory(__dirname);
15
+ const messages = core_1.Messages.loadMessages('@jayree/sfdx-plugin-manifest', 'manifestcleanup');
16
+ class CleanupManifest extends jayreeSfdxCommand_1.JayreeSfdxCommand {
17
+ async run() {
18
+ const file = this.getFlag('file');
19
+ if (!(await fs.pathExists(file))) {
20
+ await fs.ensureFile(file);
21
+ await fs.writeFile(file, `<?xml version="1.0" encoding="UTF-8"?>
22
+ <Package xmlns="http://soap.sforce.com/2006/04/metadata">
23
+ <types>
24
+ <name>Audience</name>
25
+ <!--Remove all members/the entire type-->
26
+ <members>*</members>
27
+ </types>
28
+ <types>
29
+ <name>SharingRules</name>
30
+ <!--Remove specified members from type E.g. VideoCall-->
31
+ <members>VideoCall</members>
32
+ </types>
33
+ <types>
34
+ <name>Report</name>
35
+ <!--Remove all members from type, but keep members: MyFolder, MyFolder/MyReport. E.g. if you don't need all your reports in your repository-->
36
+ <members>*</members>
37
+ <members>MyFolder</members>
38
+ <members>MyFolder/MyReport</members>
39
+ </types>
40
+ <types>
41
+ <name>CustomObject</name>
42
+ <!--Add members. E.g. if you have used 'excludemanaged' with 'jayree:manifest:generate' to re-add required managed components-->
43
+ <members>!ObjectName1</members>
44
+ <members>!ObjectName2</members>
45
+ </types>
46
+ <version>52.0</version>
47
+ </Package>
48
+ `);
49
+ this.ux.log(`Cleanup manifest file template '${file}' was created`);
50
+ }
51
+ else {
52
+ await (0, manifest_1.cleanupManifestFile)(this.getFlag('manifest'), file);
53
+ }
54
+ return {};
55
+ }
56
+ }
57
+ exports.default = CleanupManifest;
58
+ CleanupManifest.description = messages.getMessage('commandDescription');
59
+ /* public static examples = [
60
+ `$ sfdx jayree:flowtestcoverage
61
+ === Flow Test Coverage
62
+ Coverage: 82%
63
+ ...
64
+ `
65
+ ]; */
66
+ CleanupManifest.flagsConfig = {
67
+ manifest: command_1.flags.filepath({
68
+ char: 'x',
69
+ description: messages.getMessage('manifestFlagDescription'),
70
+ }),
71
+ file: command_1.flags.filepath({
72
+ char: 'f',
73
+ description: messages.getMessage('fileFlagDescription'),
74
+ }),
75
+ };
76
+ CleanupManifest.requiresUsername = false;
77
+ CleanupManifest.supportsDevhubUsername = false;
78
+ CleanupManifest.requiresProject = true;
79
+ //# sourceMappingURL=cleanup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleanup.js","sourceRoot":"","sources":["../../../../src/commands/jayree/manifest/cleanup.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,iDAAyD;AACzD,2CAA4C;AAE5C,+BAA+B;AAC/B,kEAA+D;AAC/D,sDAA8D;AAE9D,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAE5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,8BAA8B,EAAE,iBAAiB,CAAC,CAAC;AAE1F,MAAqB,eAAgB,SAAQ,qCAAiB;IA0BrD,KAAK,CAAC,GAAG;QACd,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAS,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE;YAChC,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAC1B,MAAM,EAAE,CAAC,SAAS,CAChB,IAAI,EACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BP,CACM,CAAC;YACF,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,mCAAmC,IAAI,eAAe,CAAC,CAAC;SACrE;aAAM;YACL,MAAM,IAAA,8BAAmB,EAAC,IAAI,CAAC,OAAO,CAAS,UAAU,CAAC,EAAE,IAAI,CAAC,CAAC;SACnE;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;;AAlEH,kCAmEC;AAlEe,2BAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAEtE;;;;;;KAMK;AAEY,2BAAW,GAAgB;IAC1C,QAAQ,EAAE,eAAK,CAAC,QAAQ,CAAC;QACvB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,yBAAyB,CAAC;KAC5D,CAAC;IACF,IAAI,EAAE,eAAK,CAAC,QAAQ,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,qBAAqB,CAAC;KACxD,CAAC;CACH,CAAC;AAEe,gCAAgB,GAAG,KAAK,CAAC;AACzB,sCAAsB,GAAG,KAAK,CAAC;AAC/B,+BAAe,GAAG,IAAI,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { FlagsConfig } from '@salesforce/command';
2
+ import { FileProperties, ListMetadataQuery } from 'jsforce';
3
+ import { Connection } from '@salesforce/core';
4
+ import { PackageManifestObject } from '@salesforce/source-deploy-retrieve';
5
+ import { JayreeSfdxCommand } from '../../../jayreeSfdxCommand';
6
+ export interface QueryResult {
7
+ size: number;
8
+ totalSize: number;
9
+ done: boolean;
10
+ queryLocator: string;
11
+ entityTypeName: string;
12
+ records: StdValueSetRecord[] | FlowDefinitionRecord[];
13
+ }
14
+ export interface StdValueSetRecord {
15
+ Id: string;
16
+ MasterLabel: string;
17
+ Metadata: {
18
+ standardValue: Array<Record<string, unknown>>;
19
+ };
20
+ }
21
+ export interface FlowDefinitionRecord {
22
+ DeveloperName: string;
23
+ ActiveVersion: {
24
+ VersionNumber: string;
25
+ };
26
+ LatestVersion: {
27
+ VersionNumber: string;
28
+ };
29
+ }
30
+ export default class GeneratePackageXML extends JayreeSfdxCommand {
31
+ static aliases: string[];
32
+ static description: string;
33
+ static examples: string[];
34
+ protected static flagsConfig: FlagsConfig;
35
+ protected static requiresUsername: boolean;
36
+ protected static supportsDevhubUsername: boolean;
37
+ protected static requiresProject: boolean;
38
+ protected cacheConnection: Connection;
39
+ run(): Promise<PackageManifestObject>;
40
+ protected listMembers(query: ListMetadataQuery, apiVersion?: string): Promise<FileProperties[]>;
41
+ }
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /*
4
+ * Copyright (c) 2021, jayree
5
+ * All rights reserved.
6
+ * Licensed under the BSD 3-Clause license.
7
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
8
+ */
9
+ const os = require("os");
10
+ const command_1 = require("@salesforce/command");
11
+ const core_1 = require("@salesforce/core");
12
+ const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
13
+ const utils_1 = require("@salesforce/source-deploy-retrieve/lib/src/utils");
14
+ const fs = require("fs-extra");
15
+ const standardValueSetData = require("../../../metadata/standardvalueset.json");
16
+ const jayreeSfdxCommand_1 = require("../../../jayreeSfdxCommand");
17
+ const stdValueSets = (0, utils_1.deepFreeze)(standardValueSetData);
18
+ const registryAccess = new source_deploy_retrieve_1.RegistryAccess();
19
+ core_1.Messages.importMessagesDirectory(__dirname);
20
+ const messages = core_1.Messages.loadMessages('@jayree/sfdx-plugin-manifest', 'packagexml');
21
+ class GeneratePackageXML extends jayreeSfdxCommand_1.JayreeSfdxCommand {
22
+ // eslint-disable-next-line complexity
23
+ async run() {
24
+ var _a, _b, _c, _d, _e;
25
+ this.warnIfRunByAlias(GeneratePackageXML.aliases, GeneratePackageXML.id);
26
+ await this.org.refreshAuth();
27
+ const file = this.getFlag('file');
28
+ this.ux.startSpinner(`Generating ${file || 'package.xml'}`);
29
+ this.cacheConnection = this.org.getConnection();
30
+ let Aggregator = [];
31
+ const componentPromises = [];
32
+ for (const type of Object.values(source_deploy_retrieve_1.registry.types)) {
33
+ componentPromises.push(this.listMembers({ type: type.name }));
34
+ }
35
+ const childrenPromises = [];
36
+ const componentTypes = new Set();
37
+ for await (const componentResult of componentPromises) {
38
+ Aggregator.push(...componentResult);
39
+ for (const component of componentResult) {
40
+ const componentType = registryAccess.getTypeByName(component.type.toLowerCase());
41
+ componentTypes.add(componentType);
42
+ const folderContentType = componentType.folderContentType;
43
+ if (folderContentType) {
44
+ childrenPromises.push(this.listMembers({
45
+ type: registryAccess.getTypeByName(componentType.folderContentType).name,
46
+ folder: component.fullName,
47
+ }));
48
+ }
49
+ }
50
+ }
51
+ for (const componentType of componentTypes) {
52
+ const childTypes = (_a = componentType.children) === null || _a === void 0 ? void 0 : _a.types;
53
+ if (childTypes) {
54
+ Object.values(childTypes).map((childType) => {
55
+ childrenPromises.push(this.listMembers({ type: childType.name }));
56
+ });
57
+ }
58
+ }
59
+ for await (const childrenResult of childrenPromises) {
60
+ Aggregator.push(...childrenResult);
61
+ }
62
+ if (this.getFlag('excludemanaged')) {
63
+ Aggregator = Aggregator.filter((component) => !((component.namespacePrefix && component.manageableState !== 'unmanaged') ||
64
+ component.manageableState === 'installed'));
65
+ }
66
+ if (this.getFlag('includeflowversions')) {
67
+ const flowPromises = [];
68
+ flowPromises.push(this.listMembers({ type: 'Flow' }, '43.0'));
69
+ for await (const flowResult of flowPromises) {
70
+ for (const component of flowResult) {
71
+ Aggregator.push(component);
72
+ }
73
+ }
74
+ }
75
+ const quickFilter = this.getFlag('quickfilter');
76
+ if (quickFilter) {
77
+ Aggregator = Aggregator.filter((component) => {
78
+ let filter = quickFilter;
79
+ let comp = component;
80
+ if (!this.getFlag('matchcase')) {
81
+ filter = quickFilter.join('~').toLowerCase().split('~');
82
+ comp = Object.fromEntries(Object.entries(component).map(([k, v]) => [k, v === null || v === void 0 ? void 0 : v.toLowerCase()]));
83
+ }
84
+ if (this.getFlag('matchwholeword')) {
85
+ return filter.includes(comp.fullName) || filter.includes(comp.type);
86
+ }
87
+ else {
88
+ for (const f of filter) {
89
+ return comp.fullName.includes(f) || comp.type.includes(f);
90
+ }
91
+ }
92
+ });
93
+ }
94
+ const hasFlows = Aggregator.filter((component) => component.type === 'Flow');
95
+ if (hasFlows.length) {
96
+ try {
97
+ const flowDefinitionQuery = (await this.cacheConnection.tooling.query(`SELECT DeveloperName, ActiveVersion.VersionNumber, LatestVersion.VersionNumber FROM FlowDefinition where DeveloperName in (${hasFlows
98
+ .map((component) => `'${component.fullName}'`)
99
+ .toString()})`));
100
+ const flowDefinitionRecods = flowDefinitionQuery.records;
101
+ for (const record of flowDefinitionRecods) {
102
+ if (((_b = record.LatestVersion) === null || _b === void 0 ? void 0 : _b.VersionNumber) !== ((_c = record.ActiveVersion) === null || _c === void 0 ? void 0 : _c.VersionNumber)) {
103
+ this.ux.log(`Developername: ${record.DeveloperName}, ActiveVersion: ${(_d = record.ActiveVersion) === null || _d === void 0 ? void 0 : _d.VersionNumber}, LatestVersion: ${(_e = record.LatestVersion) === null || _e === void 0 ? void 0 : _e.VersionNumber}`);
104
+ }
105
+ }
106
+ }
107
+ catch (error) {
108
+ this.logger.debug(error.message);
109
+ }
110
+ }
111
+ Aggregator = Aggregator.filter((component) => component.type !== 'FlowDefinition');
112
+ const MetadataComponentAggregator = Aggregator.map((component) => {
113
+ return { fullName: component.fullName, type: registryAccess.getTypeByName(component.type) };
114
+ }).sort((a, b) => {
115
+ if (a.type.name === b.type.name) {
116
+ return a.fullName.toLowerCase() > b.fullName.toLowerCase() ? 1 : -1;
117
+ }
118
+ return a.type.name.toLowerCase() > b.type.name.toLowerCase() ? 1 : -1;
119
+ });
120
+ const pkg = new source_deploy_retrieve_1.ComponentSet(MetadataComponentAggregator, registryAccess);
121
+ pkg.apiVersion = this.cacheConnection.getApiVersion();
122
+ if (file) {
123
+ await fs.ensureFile(file);
124
+ await fs.writeFile(file, pkg.getPackageXml());
125
+ }
126
+ else {
127
+ this.ux.log(pkg.getPackageXml());
128
+ }
129
+ this.ux.stopSpinner();
130
+ return pkg.getObject();
131
+ }
132
+ async listMembers(query, apiVersion) {
133
+ let members;
134
+ try {
135
+ if (!apiVersion) {
136
+ apiVersion = this.cacheConnection.getApiVersion();
137
+ }
138
+ members = (0, utils_1.normalizeToArray)(await this.cacheConnection.metadata.list(query, apiVersion));
139
+ }
140
+ catch (error) {
141
+ members = [];
142
+ this.logger.debug(error.message);
143
+ }
144
+ if (query.type === source_deploy_retrieve_1.registry.types.standardvalueset.name && members.length === 0) {
145
+ const standardValueSetPromises = stdValueSets.fullNames.map(async (standardValueSetFullName) => {
146
+ try {
147
+ const queryResult = (await this.cacheConnection.tooling.query(`SELECT Id, MasterLabel, Metadata FROM StandardValueSet WHERE MasterLabel = '${standardValueSetFullName}'`));
148
+ const standardValueSetRecord = queryResult.records[0];
149
+ return (standardValueSetRecord.Metadata.standardValue.length && {
150
+ fullName: standardValueSetRecord.MasterLabel,
151
+ fileName: `${source_deploy_retrieve_1.registry.types.standardvalueset.directoryName}/${standardValueSetRecord.MasterLabel}.${source_deploy_retrieve_1.registry.types.standardvalueset.suffix}`,
152
+ type: source_deploy_retrieve_1.registry.types.standardvalueset.name,
153
+ createdById: '',
154
+ createdByName: '',
155
+ createdDate: '',
156
+ id: '',
157
+ lastModifiedById: '',
158
+ lastModifiedByName: '',
159
+ lastModifiedDate: '',
160
+ });
161
+ }
162
+ catch (error) {
163
+ this.logger.debug(error.message);
164
+ }
165
+ });
166
+ for await (const standardValueSetResult of standardValueSetPromises) {
167
+ if (standardValueSetResult) {
168
+ members.push(standardValueSetResult);
169
+ }
170
+ }
171
+ }
172
+ return members;
173
+ }
174
+ }
175
+ exports.default = GeneratePackageXML;
176
+ GeneratePackageXML.aliases = ['jayree:packagexml'];
177
+ GeneratePackageXML.description = messages.getMessage('commandDescription');
178
+ GeneratePackageXML.examples = messages.getMessage('examples').split(os.EOL);
179
+ GeneratePackageXML.flagsConfig = {
180
+ quickfilter: command_1.flags.array({
181
+ char: 'q',
182
+ description: messages.getMessage('quickfilterFlagDescription'),
183
+ }),
184
+ matchcase: command_1.flags.boolean({
185
+ char: 'c',
186
+ description: messages.getMessage('matchCaseFlagDescription'),
187
+ }),
188
+ matchwholeword: command_1.flags.boolean({
189
+ char: 'w',
190
+ description: messages.getMessage('matchWholeWordFlagDescription'),
191
+ }),
192
+ includeflowversions: command_1.flags.boolean({
193
+ description: messages.getMessage('includeflowversionsDescription'),
194
+ }),
195
+ file: command_1.flags.string({
196
+ char: 'f',
197
+ description: messages.getMessage('fileFlagDescription'),
198
+ }),
199
+ excludemanaged: command_1.flags.boolean({
200
+ char: 'x',
201
+ description: messages.getMessage('excludeManagedFlagDescription'),
202
+ }),
203
+ };
204
+ GeneratePackageXML.requiresUsername = true;
205
+ GeneratePackageXML.supportsDevhubUsername = false;
206
+ GeneratePackageXML.requiresProject = false;
207
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../../src/commands/jayree/manifest/generate.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iDAAyD;AAEzD,2CAAwD;AACxD,+EAM4C;AAC5C,4EAAgG;AAChG,+BAA+B;AAC/B,gFAAgF;AAChF,kEAA+D;AAE/D,MAAM,YAAY,GAAG,IAAA,kBAAU,EAAC,oBAAoB,CAAC,CAAC;AACtD,MAAM,cAAc,GAAG,IAAI,uCAAc,EAAE,CAAC;AAE5C,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAE5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,Y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,CAAC,OAAO,CAAC;QAC5B,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,+BAA+B,CAAC;KAClE,CAAC;CACH,CAAC;AAEe,mCAAgB,GAAG,IAAI,CAAC;AACxB,yCAAsB,GAAG,KAAK,CAAC;AAC/B,kCAAe,GAAG,KAAK,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { SfdxCommand } from '@salesforce/command';
2
+ import { AnyJson } from '@salesforce/ts-types';
3
+ export default class GitDiff extends SfdxCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static args: {
7
+ name: string;
8
+ required: boolean;
9
+ description: string;
10
+ parse: (input: string) => string;
11
+ hidden: boolean;
12
+ }[];
13
+ protected static requiresUsername: boolean;
14
+ protected static supportsDevhubUsername: boolean;
15
+ protected static requiresProject: boolean;
16
+ private isOutputEnabled;
17
+ run(): Promise<AnyJson>;
18
+ private getGitArgsFromArgv;
19
+ }