@salesforce/plugin-community 2.0.27 → 2.1.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/LICENSE.txt +1 -1
- package/lib/commands/community/create.d.ts +28 -0
- package/lib/commands/community/create.js +110 -0
- package/lib/commands/community/create.js.map +1 -0
- package/lib/commands/community/list/template.d.ts +19 -0
- package/lib/commands/community/list/template.js +53 -0
- package/lib/commands/community/list/template.js.map +1 -0
- package/lib/commands/community/publish.d.ts +20 -0
- package/lib/commands/community/publish.js +62 -0
- package/lib/commands/community/publish.js.map +1 -0
- package/lib/shared/community/commands/CommunityNameValueParser.d.ts +1 -1
- package/lib/shared/community/commands/CommunityNameValueParser.js +4 -6
- package/lib/shared/community/commands/CommunityNameValueParser.js.map +1 -1
- package/lib/shared/community/connect/CommunityCreateResource.d.ts +4 -7
- package/lib/shared/community/connect/CommunityCreateResource.js +11 -21
- package/lib/shared/community/connect/CommunityCreateResource.js.map +1 -1
- package/lib/shared/community/connect/CommunityPublishResource.d.ts +6 -6
- package/lib/shared/community/connect/CommunityPublishResource.js +8 -25
- package/lib/shared/community/connect/CommunityPublishResource.js.map +1 -1
- package/lib/shared/community/connect/CommunityTemplatesResource.d.ts +0 -3
- package/lib/shared/community/connect/CommunityTemplatesResource.js +7 -20
- package/lib/shared/community/connect/CommunityTemplatesResource.js.map +1 -1
- package/lib/shared/community/defs/CommunityTemplatesListResponse.d.ts +1 -1
- package/lib/shared/connect/services/ConnectExecutor.js +3 -5
- package/lib/shared/connect/services/ConnectExecutor.js.map +1 -1
- package/lib/shared/utils.d.ts +2 -0
- package/lib/shared/utils.js +13 -0
- package/lib/shared/utils.js.map +1 -0
- package/messages/connect-executor.md +3 -0
- package/messages/create.md +77 -0
- package/messages/publish.md +35 -0
- package/messages/template.list.md +21 -0
- package/oclif.manifest.json +1 -1
- package/package.json +21 -21
- package/lib/commands/force/community/create.d.ts +0 -17
- package/lib/commands/force/community/create.js +0 -79
- package/lib/commands/force/community/create.js.map +0 -1
- package/lib/commands/force/community/publish.d.ts +0 -13
- package/lib/commands/force/community/publish.js +0 -39
- package/lib/commands/force/community/publish.js.map +0 -1
- package/lib/commands/force/community/template/list.d.ts +0 -12
- package/lib/commands/force/community/template/list.js +0 -31
- package/lib/commands/force/community/template/list.js.map +0 -1
- package/messages/create.json +0 -34
- package/messages/publish.json +0 -17
- package/messages/template.list.json +0 -8
package/LICENSE.txt
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { JsonMap } from '@salesforce/ts-types';
|
|
2
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
import { CommunityCreateResponse } from '../../shared/community/defs/CommunityCreateResponse';
|
|
4
|
+
/**
|
|
5
|
+
* A command to create a community.
|
|
6
|
+
* This is just an sfdx wrapper around the community create connect endpoint
|
|
7
|
+
*/
|
|
8
|
+
export declare class CommunityCreateCommand extends SfCommand<CommunityCreateResponse> {
|
|
9
|
+
static readonly aliases: string[];
|
|
10
|
+
static readonly summary: string;
|
|
11
|
+
static readonly description: string;
|
|
12
|
+
static readonly examples: string[];
|
|
13
|
+
static readonly strict = false;
|
|
14
|
+
static readonly flags: {
|
|
15
|
+
name: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
16
|
+
'template-name': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
17
|
+
'url-path-prefix': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
18
|
+
description: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
19
|
+
'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org>;
|
|
20
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
21
|
+
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
22
|
+
};
|
|
23
|
+
static readonly validationPatterns: string[];
|
|
24
|
+
private logger;
|
|
25
|
+
run(): Promise<CommunityCreateResponse>;
|
|
26
|
+
protected parseVarargs(args?: string[]): JsonMap;
|
|
27
|
+
private displayResults;
|
|
28
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CommunityCreateCommand = void 0;
|
|
10
|
+
const core_1 = require("@salesforce/core");
|
|
11
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
12
|
+
const CommunityNameValueParser_1 = require("../../shared/community/commands/CommunityNameValueParser");
|
|
13
|
+
const ConnectExecutor_1 = require("../../shared/connect/services/ConnectExecutor");
|
|
14
|
+
const CommunityCreateResource_1 = require("../../shared/community/connect/CommunityCreateResource");
|
|
15
|
+
const utils_1 = require("../../shared/utils");
|
|
16
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
17
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-community', 'create');
|
|
18
|
+
const MESSAGE_KEY = 'message';
|
|
19
|
+
const NAME_KEY = 'name';
|
|
20
|
+
const ACTION_KEY = 'action';
|
|
21
|
+
/**
|
|
22
|
+
* A command to create a community.
|
|
23
|
+
* This is just an sfdx wrapper around the community create connect endpoint
|
|
24
|
+
*/
|
|
25
|
+
class CommunityCreateCommand extends sf_plugins_core_1.SfCommand {
|
|
26
|
+
async run() {
|
|
27
|
+
this.logger = core_1.Logger.childFromRoot(this.constructor.name);
|
|
28
|
+
const { flags, argv } = await this.parse(CommunityCreateCommand);
|
|
29
|
+
const varargs = this.parseVarargs(argv);
|
|
30
|
+
const createCommand = new CommunityCreateResource_1.CommunityCreateResource({
|
|
31
|
+
name: flags.name,
|
|
32
|
+
urlPathPrefix: flags['url-path-prefix'],
|
|
33
|
+
templateName: flags['template-name'],
|
|
34
|
+
description: flags.description,
|
|
35
|
+
templateParams: varargs['templateParams'],
|
|
36
|
+
});
|
|
37
|
+
return new ConnectExecutor_1.ConnectExecutor(createCommand, await (0, utils_1.applyApiVersionToOrg)(flags['target-org'], flags['api-version']))
|
|
38
|
+
.callConnectApi()
|
|
39
|
+
.then((results) => {
|
|
40
|
+
this.displayResults(results);
|
|
41
|
+
return results;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
parseVarargs(args) {
|
|
45
|
+
this.logger.debug(`parseVarargs([${args.join(', ')}])`);
|
|
46
|
+
// It never looks like args is ever undefined as long as varargs is turned on for the command...
|
|
47
|
+
// But since the signature says it's optional, we should probably gate this even though it's unnecessary right now.
|
|
48
|
+
if (args === undefined) {
|
|
49
|
+
return {};
|
|
50
|
+
}
|
|
51
|
+
const parser = new CommunityNameValueParser_1.CommunityNameValueParser(CommunityCreateCommand.validationPatterns);
|
|
52
|
+
const values = parser.parse(args);
|
|
53
|
+
this.logger.debug('parseVarargs result:' + JSON.stringify(values));
|
|
54
|
+
return values;
|
|
55
|
+
}
|
|
56
|
+
displayResults(results) {
|
|
57
|
+
const columns = {
|
|
58
|
+
[NAME_KEY]: { header: 'Name' },
|
|
59
|
+
[MESSAGE_KEY]: { header: 'Message' },
|
|
60
|
+
[ACTION_KEY]: { header: 'Action' },
|
|
61
|
+
};
|
|
62
|
+
this.styledHeader(messages.getMessage('response.styleHeader'));
|
|
63
|
+
this.table([results], columns);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.CommunityCreateCommand = CommunityCreateCommand;
|
|
67
|
+
CommunityCreateCommand.aliases = ['force:community:create'];
|
|
68
|
+
CommunityCreateCommand.summary = messages.getMessage('summary');
|
|
69
|
+
CommunityCreateCommand.description = messages.getMessage('description');
|
|
70
|
+
CommunityCreateCommand.examples = messages.getMessages('examples');
|
|
71
|
+
CommunityCreateCommand.strict = false;
|
|
72
|
+
CommunityCreateCommand.flags = {
|
|
73
|
+
name: sf_plugins_core_1.Flags.string({
|
|
74
|
+
char: 'n',
|
|
75
|
+
summary: messages.getMessage('flags.name.summary'),
|
|
76
|
+
required: true,
|
|
77
|
+
}),
|
|
78
|
+
'template-name': sf_plugins_core_1.Flags.string({
|
|
79
|
+
char: 't',
|
|
80
|
+
summary: messages.getMessage('flags.templateName.summary'),
|
|
81
|
+
description: messages.getMessage('flags.templateName.description'),
|
|
82
|
+
required: true,
|
|
83
|
+
aliases: ['templatename'],
|
|
84
|
+
}),
|
|
85
|
+
'url-path-prefix': sf_plugins_core_1.Flags.string({
|
|
86
|
+
char: 'p',
|
|
87
|
+
summary: messages.getMessage('flags.urlPathPrefix.summary'),
|
|
88
|
+
description: messages.getMessage('flags.urlPathPrefix.description'),
|
|
89
|
+
required: true,
|
|
90
|
+
aliases: ['urlpathprefix'],
|
|
91
|
+
}),
|
|
92
|
+
description: sf_plugins_core_1.Flags.string({
|
|
93
|
+
char: 'd',
|
|
94
|
+
summary: messages.getMessage('flags.description.summary'),
|
|
95
|
+
description: messages.getMessage('flags.description.description'),
|
|
96
|
+
}),
|
|
97
|
+
'target-org': sf_plugins_core_1.requiredOrgFlagWithDeprecations,
|
|
98
|
+
loglevel: sf_plugins_core_1.loglevel,
|
|
99
|
+
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
|
100
|
+
};
|
|
101
|
+
CommunityCreateCommand.validationPatterns = [
|
|
102
|
+
// Exact matches
|
|
103
|
+
'name',
|
|
104
|
+
'urlPathPrefix',
|
|
105
|
+
'templateName',
|
|
106
|
+
'description',
|
|
107
|
+
// templateParams.*, but must be only word characters (e.g. no spaces, special chars)
|
|
108
|
+
'templateParams(\\.\\w+)+',
|
|
109
|
+
];
|
|
110
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/community/create.ts"],"names":[],"mappings":";AA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emplatesListResponse';
|
|
3
|
+
/**
|
|
4
|
+
* A command to fetch available community templates a community. This is just an sfdx wrapper around
|
|
5
|
+
* the get available community templates connect endpoint
|
|
6
|
+
*/
|
|
7
|
+
export declare class CommunityListTemplatesCommand extends SfCommand<CommunityTemplatesListResponse> {
|
|
8
|
+
static readonly aliases: string[];
|
|
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/lib/interfaces").OptionFlag<import("@salesforce/core").Org>;
|
|
14
|
+
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
15
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
16
|
+
};
|
|
17
|
+
run(): Promise<CommunityTemplatesListResponse>;
|
|
18
|
+
private displayResults;
|
|
19
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CommunityListTemplatesCommand = void 0;
|
|
10
|
+
const core_1 = require("@salesforce/core");
|
|
11
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
12
|
+
const CommunityTemplatesResource_1 = require("../../../shared/community/connect/CommunityTemplatesResource");
|
|
13
|
+
const ConnectExecutor_1 = require("../../../shared/connect/services/ConnectExecutor");
|
|
14
|
+
const utils_1 = require("../../../shared/utils");
|
|
15
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
16
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-community', 'template.list');
|
|
17
|
+
/**
|
|
18
|
+
* A command to fetch available community templates a community. This is just an sfdx wrapper around
|
|
19
|
+
* the get available community templates connect endpoint
|
|
20
|
+
*/
|
|
21
|
+
class CommunityListTemplatesCommand extends sf_plugins_core_1.SfCommand {
|
|
22
|
+
async run() {
|
|
23
|
+
const { flags } = await this.parse(CommunityListTemplatesCommand);
|
|
24
|
+
const listTemplateCommand = new CommunityTemplatesResource_1.CommunityTemplatesResource();
|
|
25
|
+
return new ConnectExecutor_1.ConnectExecutor(listTemplateCommand, await (0, utils_1.applyApiVersionToOrg)(flags['target-org'], flags['api-version']))
|
|
26
|
+
.callConnectApi()
|
|
27
|
+
.then((results) => {
|
|
28
|
+
this.displayResults(results);
|
|
29
|
+
return results;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
displayResults(results) {
|
|
33
|
+
const columns = {
|
|
34
|
+
templateName: { header: 'Template Name' },
|
|
35
|
+
publisher: { header: 'Publisher' },
|
|
36
|
+
};
|
|
37
|
+
this.styledHeader(messages.getMessage('response.styledHeader'));
|
|
38
|
+
this.table(results.templates, columns);
|
|
39
|
+
this.log();
|
|
40
|
+
this.log(messages.getMessage('response.TotalField'), results.total.toString());
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.CommunityListTemplatesCommand = CommunityListTemplatesCommand;
|
|
44
|
+
CommunityListTemplatesCommand.aliases = ['force:community:template:list'];
|
|
45
|
+
CommunityListTemplatesCommand.summary = messages.getMessage('summary');
|
|
46
|
+
CommunityListTemplatesCommand.description = messages.getMessage('description');
|
|
47
|
+
CommunityListTemplatesCommand.examples = messages.getMessages('examples');
|
|
48
|
+
CommunityListTemplatesCommand.flags = {
|
|
49
|
+
'target-org': sf_plugins_core_1.requiredOrgFlagWithDeprecations,
|
|
50
|
+
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
|
51
|
+
loglevel: sf_plugins_core_1.loglevel,
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 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U,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjF,CAAC;;AAlCH,sEAmCC;AAlCwB,qCAAO,GAAG,CAAC,+BAA+B,CAAC,CAAC;AAC5C,qCAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACzC,yCAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,sCAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAC5C,mCAAK,GAAG;IAC7B,YAAY,EAAE,iDAA+B;IAC7C,aAAa,EAAE,mDAAiC;IAChD,QAAQ,EAAR,0BAAQ;CACT,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { CommunityPublishResponse } from '../../shared/community/defs/CommunityPublishResponse';
|
|
3
|
+
/**
|
|
4
|
+
* A command to publish a community. This is just an sfdx wrapper around
|
|
5
|
+
* the community publish connect endpoint
|
|
6
|
+
*/
|
|
7
|
+
export declare class CommunityPublishCommand extends SfCommand<CommunityPublishResponse> {
|
|
8
|
+
static readonly aliases: string[];
|
|
9
|
+
static readonly summary: string;
|
|
10
|
+
static readonly description: string;
|
|
11
|
+
static readonly examples: string[];
|
|
12
|
+
static readonly flags: {
|
|
13
|
+
name: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
14
|
+
'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org>;
|
|
15
|
+
'api-version': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
16
|
+
loglevel: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
17
|
+
};
|
|
18
|
+
run(): Promise<CommunityPublishResponse>;
|
|
19
|
+
private displayResults;
|
|
20
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CommunityPublishCommand = void 0;
|
|
10
|
+
const core_1 = require("@salesforce/core");
|
|
11
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
12
|
+
const CommunityPublishResource_1 = require("../../shared/community/connect/CommunityPublishResource");
|
|
13
|
+
const ConnectExecutor_1 = require("../../shared/connect/services/ConnectExecutor");
|
|
14
|
+
const utils_1 = require("../../shared/utils");
|
|
15
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
16
|
+
const messages = core_1.Messages.loadMessages('@salesforce/plugin-community', 'publish');
|
|
17
|
+
/**
|
|
18
|
+
* A command to publish a community. This is just an sfdx wrapper around
|
|
19
|
+
* the community publish connect endpoint
|
|
20
|
+
*/
|
|
21
|
+
class CommunityPublishCommand extends sf_plugins_core_1.SfCommand {
|
|
22
|
+
async run() {
|
|
23
|
+
const { flags } = await this.parse(CommunityPublishCommand);
|
|
24
|
+
const publishCommand = new CommunityPublishResource_1.CommunityPublishResource({
|
|
25
|
+
name: flags.name,
|
|
26
|
+
org: flags['target-org'],
|
|
27
|
+
});
|
|
28
|
+
return new ConnectExecutor_1.ConnectExecutor(publishCommand, await (0, utils_1.applyApiVersionToOrg)(flags['target-org'], flags['api-version']))
|
|
29
|
+
.callConnectApi()
|
|
30
|
+
.then((results) => {
|
|
31
|
+
this.displayResults(results);
|
|
32
|
+
return results;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
displayResults(results) {
|
|
36
|
+
const columns = {
|
|
37
|
+
id: { header: 'Id' },
|
|
38
|
+
message: { header: 'Message' },
|
|
39
|
+
name: { header: 'Name' },
|
|
40
|
+
status: { header: 'Status' },
|
|
41
|
+
url: { header: 'Url' },
|
|
42
|
+
};
|
|
43
|
+
this.styledHeader(messages.getMessage('response.styleHeader'));
|
|
44
|
+
this.table([results], columns);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.CommunityPublishCommand = CommunityPublishCommand;
|
|
48
|
+
CommunityPublishCommand.aliases = ['force:community:publish'];
|
|
49
|
+
CommunityPublishCommand.summary = messages.getMessage('summary');
|
|
50
|
+
CommunityPublishCommand.description = messages.getMessage('description');
|
|
51
|
+
CommunityPublishCommand.examples = messages.getMessages('examples');
|
|
52
|
+
CommunityPublishCommand.flags = {
|
|
53
|
+
name: sf_plugins_core_1.Flags.string({
|
|
54
|
+
char: 'n',
|
|
55
|
+
summary: messages.getMessage('flags.name.summary'),
|
|
56
|
+
required: true,
|
|
57
|
+
}),
|
|
58
|
+
'target-org': sf_plugins_core_1.requiredOrgFlagWithDeprecations,
|
|
59
|
+
'api-version': sf_plugins_core_1.orgApiVersionFlagWithDeprecations,
|
|
60
|
+
loglevel: sf_plugins_core_1.loglevel,
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../../src/commands/community/publish.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2CAA4C;AAC5C,iEAMqC;AACrC,sGAAmG;AACnG,mFAAgF;AAEhF,8CAA0D;AAE1D,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,8BAA8B,EAAE,SAAS,CAAC,CAAC;AAElF;;;GAGG;AACH,MAAa,uBAAwB,SAAQ,2BAAmC;IAgBvE,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC5D,MAAM,cAAc,GAAG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GAAG;QACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC;QAClD,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,YAAY,EAAE,iDAA+B;IAC7C,aAAa,EAAE,mDAAiC;IAChD,QAAQ,EAAR,0BAAQ;CACT,CAAC"}
|
|
@@ -17,7 +17,7 @@ export declare class CommunityNameValueParser {
|
|
|
17
17
|
* parser.parse([ "thename=Demo" ]); // fails
|
|
18
18
|
* parser.parse([ "Name=Demo" ]); // fails
|
|
19
19
|
*
|
|
20
|
-
* The patterns are joined between a /^(...)$/ RegExp enclosure so it only accepts exact matches that are case sensitive. (See validate().)
|
|
20
|
+
* The patterns are joined between a /^(...)$/ RegExp enclosure, so it only accepts exact matches that are case sensitive. (See validate().)
|
|
21
21
|
*
|
|
22
22
|
* However, you can use regular expressions to allow for pattern matches.
|
|
23
23
|
*
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.CommunityNameValueParser = void 0;
|
|
10
|
-
const lodash_1 = require("lodash");
|
|
11
10
|
const core_1 = require("@salesforce/core");
|
|
11
|
+
const kit_1 = require("@salesforce/kit");
|
|
12
12
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
13
13
|
const messages = core_1.Messages.loadMessages('@salesforce/plugin-community', 'create');
|
|
14
14
|
/**
|
|
@@ -28,7 +28,7 @@ class CommunityNameValueParser {
|
|
|
28
28
|
* parser.parse([ "thename=Demo" ]); // fails
|
|
29
29
|
* parser.parse([ "Name=Demo" ]); // fails
|
|
30
30
|
*
|
|
31
|
-
* The patterns are joined between a /^(...)$/ RegExp enclosure so it only accepts exact matches that are case sensitive. (See validate().)
|
|
31
|
+
* The patterns are joined between a /^(...)$/ RegExp enclosure, so it only accepts exact matches that are case sensitive. (See validate().)
|
|
32
32
|
*
|
|
33
33
|
* However, you can use regular expressions to allow for pattern matches.
|
|
34
34
|
*
|
|
@@ -49,11 +49,9 @@ class CommunityNameValueParser {
|
|
|
49
49
|
validate(parsedArgs) {
|
|
50
50
|
const pattern = new RegExp('^(' + this.patterns.join('|') + ')$');
|
|
51
51
|
const errors = parsedArgs
|
|
52
|
-
|
|
53
|
-
.filter(([key, value]) => !pattern.test(key))
|
|
52
|
+
.filter(([key]) => !pattern.test(key))
|
|
54
53
|
.map(([key, value]) => `${key}="${value}"`);
|
|
55
|
-
if (!(0,
|
|
56
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
54
|
+
if (!(0, kit_1.isEmpty)(errors)) {
|
|
57
55
|
throw messages.createError('error.invalidVarargs', errors);
|
|
58
56
|
}
|
|
59
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommunityNameValueParser.js","sourceRoot":"","sources":["../../../../src/shared/community/commands/CommunityNameValueParser.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;
|
|
1
|
+
{"version":3,"file":"CommunityNameValueParser.js","sourceRoot":"","sources":["../../../../src/shared/community/commands/CommunityNameValueParser.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,2CAA4C;AAC5C,yCAA0C;AAE1C,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,8BAA8B,EAAE,QAAQ,CAAC,CAAC;AAEjF;;GAEG;AACH,MAAa,wBAAwB;IACnC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,YAA2B,WAAqB,CAAC,IAAI,CAAC;QAA3B,aAAQ,GAAR,QAAQ,CAAmB;IAAG,CAAC;IAEnD,KAAK,CAAC,IAAc;QACzB,MAAM,QAAQ,GAA4B,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACnE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAExB,MAAM,MAAM,GAAY,yBAAyB,CAAC,QAAQ,CAAC,CAAC;QAE5D,OAAO,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MAAM,IAAI,GAAG,IAAI;SACd,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACZ,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAC3F,IAAI,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;IAEtB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,CAAC,SAAkC,EAAW,EAAE;IAChF,IAAI,OAAO,GAAY,EAAE,CAAC;IAC1B,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACjC,OAAO,GAAG,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { JsonCollection, AnyJson } from '@salesforce/ts-types';
|
|
3
|
-
import { UX } from '@salesforce/command';
|
|
1
|
+
import { JsonCollection } from '@salesforce/ts-types';
|
|
4
2
|
import { HttpMethods } from 'jsforce';
|
|
5
3
|
import { CommunityCreateResponse } from '../defs/CommunityCreateResponse';
|
|
4
|
+
import { CommunityCreateParams } from '../defs/CommunityCreateParams';
|
|
6
5
|
import { ConnectResource } from '../../connect/services/ConnectResource';
|
|
7
6
|
declare const NAME_KEY = "name";
|
|
8
7
|
/**
|
|
9
8
|
* A connect api resource for creating a community
|
|
10
9
|
*/
|
|
11
10
|
export declare class CommunityCreateResource implements ConnectResource<CommunityCreateResponse> {
|
|
12
|
-
private
|
|
13
|
-
|
|
14
|
-
private ux;
|
|
15
|
-
constructor(flags: OutputFlags<any>, params: AnyJson, ux: UX);
|
|
11
|
+
private options;
|
|
12
|
+
constructor(options: CommunityCreateParams);
|
|
16
13
|
handleSuccess(result: JsonCollection & {
|
|
17
14
|
[NAME_KEY]?: string;
|
|
18
15
|
}): CommunityCreateResponse;
|
|
@@ -4,41 +4,31 @@ exports.CommunityCreateResource = void 0;
|
|
|
4
4
|
const core_1 = require("@salesforce/core");
|
|
5
5
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
6
6
|
const messages = core_1.Messages.loadMessages('@salesforce/plugin-community', 'create');
|
|
7
|
-
const MESSAGE_KEY = 'message';
|
|
8
7
|
const NAME_KEY = 'name';
|
|
9
|
-
const ACTION_KEY = 'action';
|
|
10
8
|
/**
|
|
11
9
|
* A connect api resource for creating a community
|
|
12
10
|
*/
|
|
13
11
|
class CommunityCreateResource {
|
|
14
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
-
constructor(
|
|
16
|
-
this.
|
|
17
|
-
this.params = params;
|
|
18
|
-
this.ux = ux;
|
|
13
|
+
constructor(options) {
|
|
14
|
+
this.options = options;
|
|
19
15
|
}
|
|
16
|
+
// eslint-disable-next-line class-methods-use-this
|
|
20
17
|
handleSuccess(result) {
|
|
21
18
|
const response = {
|
|
22
19
|
message: messages.getMessage('response.createMessage'),
|
|
23
20
|
name: result[NAME_KEY],
|
|
24
21
|
action: messages.getMessage('response.action'),
|
|
25
22
|
};
|
|
26
|
-
const columns = {
|
|
27
|
-
[NAME_KEY]: { header: 'Name' },
|
|
28
|
-
[MESSAGE_KEY]: { header: 'Message' },
|
|
29
|
-
[ACTION_KEY]: { header: 'Action' },
|
|
30
|
-
};
|
|
31
|
-
this.ux.styledHeader(messages.getMessage('response.styleHeader'));
|
|
32
|
-
this.ux.table([response], columns);
|
|
33
23
|
return response;
|
|
34
24
|
}
|
|
35
25
|
// eslint-disable-next-line class-methods-use-this
|
|
36
26
|
handleError(error) {
|
|
37
27
|
throw error;
|
|
38
28
|
}
|
|
39
|
-
// eslint-disable-next-line
|
|
40
|
-
|
|
41
|
-
return '/connect/communities';
|
|
29
|
+
// eslint-disable-next-line class-methods-use-this
|
|
30
|
+
fetchRelativeConnectUrl() {
|
|
31
|
+
return Promise.resolve('/connect/communities');
|
|
42
32
|
}
|
|
43
33
|
// eslint-disable-next-line class-methods-use-this
|
|
44
34
|
getRequestMethod() {
|
|
@@ -47,11 +37,11 @@ class CommunityCreateResource {
|
|
|
47
37
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
48
38
|
async fetchPostParams() {
|
|
49
39
|
const params = {
|
|
50
|
-
name: this.
|
|
51
|
-
urlPathPrefix: this.
|
|
52
|
-
templateName: this.
|
|
53
|
-
description: this.
|
|
54
|
-
templateParams: this.
|
|
40
|
+
name: this.options.name,
|
|
41
|
+
urlPathPrefix: this.options.urlPathPrefix,
|
|
42
|
+
templateName: this.options.templateName,
|
|
43
|
+
description: this.options.description,
|
|
44
|
+
templateParams: this.options['templateParams'],
|
|
55
45
|
};
|
|
56
46
|
return JSON.stringify(params);
|
|
57
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommunityCreateResource.js","sourceRoot":"","sources":["../../../../src/shared/community/connect/CommunityCreateResource.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"CommunityCreateResource.js","sourceRoot":"","sources":["../../../../src/shared/community/connect/CommunityCreateResource.ts"],"names":[],"mappings":";;;AAOA,2CAA4C;AAM5C,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,8BAA8B,EAAE,QAAQ,CAAC,CAAC;AAEjF,MAAM,QAAQ,GAAG,MAAM,CAAC;AAExB;;GAEG;AACH,MAAa,uBAAuB;IAClC,8DAA8D;IAC9D,YAA2B,OAA8B;QAA9B,YAAO,GAAP,OAAO,CAAuB;IAAG,CAAC;IAE7D,kDAAkD;IAC3C,aAAa,CAAC,MAAgD;QACnE,MAAM,QAAQ,GAA4B;YACxC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC;YACtD,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC;YACtB,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC;SAC/C,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,kDAAkD;IAC3C,WAAW,CAAC,KAAY;QAC7B,MAAM,KAAK,CAAC;IACd,CAAC;IAED,kDAAkD;IAC3C,uBAAuB;QAC5B,OAAO,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACjD,CAAC;IAED,kDAAkD;IAC3C,gBAAgB;QACrB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,4DAA4D;IACrD,KAAK,CAAC,eAAe;QAC1B,MAAM,MAAM,GAA0B;YACpC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;YACvB,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa;YACzC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY;YACvC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAqB;YAC/C,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC;SAC/C,CAAC;QAEF,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;CACF;AAzCD,0DAyCC"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { OutputFlags } from '@oclif/parser';
|
|
2
|
-
import { UX } from '@salesforce/command';
|
|
3
1
|
import { JsonCollection } from '@salesforce/ts-types';
|
|
4
2
|
import { Org } from '@salesforce/core';
|
|
5
3
|
import { HttpMethods } from 'jsforce';
|
|
@@ -8,12 +6,14 @@ import { ConnectResource } from '../../connect/services/ConnectResource';
|
|
|
8
6
|
/**
|
|
9
7
|
* A connect api resource for publishing a community
|
|
10
8
|
*/
|
|
9
|
+
export type CommunityPublishResourceOptions = {
|
|
10
|
+
name: string;
|
|
11
|
+
org: Org;
|
|
12
|
+
};
|
|
11
13
|
export declare class CommunityPublishResource implements ConnectResource<CommunityPublishResponse> {
|
|
12
|
-
private
|
|
13
|
-
private org;
|
|
14
|
-
private ux;
|
|
14
|
+
private options;
|
|
15
15
|
private info;
|
|
16
|
-
constructor(
|
|
16
|
+
constructor(options: CommunityPublishResourceOptions);
|
|
17
17
|
fetchRelativeConnectUrl(): Promise<string>;
|
|
18
18
|
getRequestMethod(): HttpMethods;
|
|
19
19
|
fetchPostParams(): Promise<string>;
|
|
@@ -12,15 +12,9 @@ const core_1 = require("@salesforce/core");
|
|
|
12
12
|
const CommunitiesServices_1 = require("../service/CommunitiesServices");
|
|
13
13
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
14
14
|
const messages = core_1.Messages.loadMessages('@salesforce/plugin-community', 'publish');
|
|
15
|
-
/**
|
|
16
|
-
* A connect api resource for publishing a community
|
|
17
|
-
*/
|
|
18
15
|
class CommunityPublishResource {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.flags = flags;
|
|
22
|
-
this.org = org;
|
|
23
|
-
this.ux = ux;
|
|
16
|
+
constructor(options) {
|
|
17
|
+
this.options = options;
|
|
24
18
|
}
|
|
25
19
|
async fetchRelativeConnectUrl() {
|
|
26
20
|
return `/connect/communities/${await this.fetchCommunityId()}/publish`;
|
|
@@ -29,38 +23,27 @@ class CommunityPublishResource {
|
|
|
29
23
|
getRequestMethod() {
|
|
30
24
|
return 'POST';
|
|
31
25
|
}
|
|
32
|
-
// eslint-disable-next-line
|
|
33
|
-
|
|
34
|
-
return JSON.stringify({});
|
|
26
|
+
// eslint-disable-next-line class-methods-use-this
|
|
27
|
+
fetchPostParams() {
|
|
28
|
+
return Promise.resolve(JSON.stringify({}));
|
|
35
29
|
}
|
|
36
30
|
handleSuccess(result) {
|
|
37
|
-
|
|
31
|
+
return {
|
|
38
32
|
id: result.id,
|
|
39
33
|
message: messages.getMessage('response.message'),
|
|
40
34
|
name: result.name,
|
|
41
35
|
status: this.info.status,
|
|
42
36
|
url: new url_1.URL(result.url).toString(),
|
|
43
37
|
};
|
|
44
|
-
const columns = {
|
|
45
|
-
id: { header: 'Id' },
|
|
46
|
-
message: { header: 'Message' },
|
|
47
|
-
name: { header: 'Name' },
|
|
48
|
-
status: { header: 'Status' },
|
|
49
|
-
url: { header: 'Url' },
|
|
50
|
-
};
|
|
51
|
-
this.ux.styledHeader(messages.getMessage('response.styleHeader'));
|
|
52
|
-
this.ux.table([response], columns);
|
|
53
|
-
return response;
|
|
54
38
|
}
|
|
55
39
|
// eslint-disable-next-line class-methods-use-this
|
|
56
40
|
handleError(error) {
|
|
57
41
|
throw error;
|
|
58
42
|
}
|
|
59
43
|
async fetchCommunityId() {
|
|
60
|
-
this.info = await CommunitiesServices_1.CommunitiesServices.fetchCommunityInfoFromName(this.org, this.
|
|
44
|
+
this.info = await CommunitiesServices_1.CommunitiesServices.fetchCommunityInfoFromName(this.options.org, this.options.name);
|
|
61
45
|
if (!this.info) {
|
|
62
|
-
|
|
63
|
-
throw messages.createError('error.communityNotExists', [this.flags.name]);
|
|
46
|
+
throw messages.createError('error.communityNotExists', [this.options.name]);
|
|
64
47
|
}
|
|
65
48
|
return this.info.id;
|
|
66
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommunityPublishResource.js","sourceRoot":"","sources":["../../../../src/shared/community/connect/CommunityPublishResource.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,6BAA0B;
|
|
1
|
+
{"version":3,"file":"CommunityPublishResource.js","sourceRoot":"","sources":["../../../../src/shared/community/connect/CommunityPublishResource.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,6BAA0B;AAE1B,2CAAiD;AAIjD,wEAAqE;AAGrE,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,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|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { UX } from '@salesforce/command';
|
|
2
1
|
import { HttpMethods } from 'jsforce';
|
|
3
2
|
import { ConnectResource } from '../../connect/services/ConnectResource';
|
|
4
3
|
import { CommunityTemplatesListResponse } from '../defs/CommunityTemplatesListResponse';
|
|
@@ -6,8 +5,6 @@ import { CommunityTemplatesListResponse } from '../defs/CommunityTemplatesListRe
|
|
|
6
5
|
* A connect api resource for fetching community templates available to context user
|
|
7
6
|
*/
|
|
8
7
|
export declare class CommunityTemplatesResource implements ConnectResource<CommunityTemplatesListResponse> {
|
|
9
|
-
private ux;
|
|
10
|
-
constructor(ux: UX);
|
|
11
8
|
fetchRelativeConnectUrl(): Promise<string>;
|
|
12
9
|
fetchPostParams(): Promise<string>;
|
|
13
10
|
getRequestMethod(): HttpMethods;
|