@salesforce/plugin-orchestrator 1.0.17 → 1.0.20
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 +2 -2
- package/lib/commands/orchestrator/app/update.d.ts +0 -4
- package/lib/commands/orchestrator/app/update.js +4 -44
- package/lib/commands/orchestrator/app/update.js.map +1 -1
- package/lib/commands/orchestrator/app/upgrade.d.ts +32 -0
- package/lib/commands/orchestrator/app/upgrade.js +188 -0
- package/lib/commands/orchestrator/app/upgrade.js.map +1 -0
- package/lib/commands/orchestrator/rules/eval.d.ts +63 -0
- package/lib/commands/orchestrator/rules/eval.js +126 -0
- package/lib/commands/orchestrator/rules/eval.js.map +1 -0
- package/lib/commands/orchestrator/template/list.d.ts +1 -0
- package/lib/commands/orchestrator/template/list.js +12 -2
- package/lib/commands/orchestrator/template/list.js.map +1 -1
- package/lib/utils/app/appDisplayUtil.js +1 -1
- package/lib/utils/app/appDisplayUtil.js.map +1 -1
- package/lib/utils/app/appframeworkapp.d.ts +12 -2
- package/lib/utils/app/appframeworkapp.js +36 -3
- package/lib/utils/app/appframeworkapp.js.map +1 -1
- package/messages/appframework.create.app.md +92 -38
- package/messages/appframework.create.template.md +74 -21
- package/messages/appframework.delete.app.md +101 -17
- package/messages/appframework.delete.template.md +84 -31
- package/messages/appframework.display.app.md +88 -15
- package/messages/appframework.display.template.md +71 -28
- package/messages/appframework.list.app.md +36 -58
- package/messages/appframework.list.template.md +63 -24
- package/messages/appframework.update.app.md +96 -24
- package/messages/appframework.update.template.md +112 -21
- package/messages/orchestrator.app.upgrade.md +141 -0
- package/messages/orchestrator.rules.eval.md +55 -0
- package/npm-shrinkwrap.json +4159 -4068
- package/oclif.lock +3608 -3373
- package/oclif.manifest.json +400 -168
- package/package.json +33 -11
- package/messages/appframework.decouple.app.md +0 -82
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://opensource.org/license/apache-2-0)
|
|
6
6
|
|
|
7
|
-
A Salesforce CLI plugin for working with
|
|
7
|
+
A Salesforce CLI plugin for working with orchestrated apps, templates, assets, and services.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
@@ -59,7 +59,7 @@ yarn test:nuts
|
|
|
59
59
|
|
|
60
60
|
## Commands
|
|
61
61
|
|
|
62
|
-
The plugin provides commands for working with
|
|
62
|
+
The plugin provides commands for working with templates and apps.
|
|
63
63
|
|
|
64
64
|
### Template Commands
|
|
65
65
|
|
|
@@ -9,12 +9,8 @@ export default class UpdateApp extends SfCommand<string> {
|
|
|
9
9
|
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
'app-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
'app-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
-
'template-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
-
'template-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
12
|
label: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
13
|
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
-
'runtime-method': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
-
'log-level': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
14
|
};
|
|
19
15
|
run(): Promise<string>;
|
|
20
16
|
}
|
|
@@ -47,18 +47,6 @@ export default class UpdateApp extends SfCommand {
|
|
|
47
47
|
description: messages.getMessage('flags.app-name.description'),
|
|
48
48
|
exclusive: ['app-id'],
|
|
49
49
|
}),
|
|
50
|
-
'template-id': Flags.string({
|
|
51
|
-
char: 't',
|
|
52
|
-
summary: messages.getMessage('flags.template-id.summary'),
|
|
53
|
-
description: messages.getMessage('flags.template-id.description'),
|
|
54
|
-
exclusive: ['template-name'],
|
|
55
|
-
}),
|
|
56
|
-
'template-name': Flags.string({
|
|
57
|
-
char: 'm',
|
|
58
|
-
summary: messages.getMessage('flags.template-name.summary'),
|
|
59
|
-
description: messages.getMessage('flags.template-name.description'),
|
|
60
|
-
exclusive: ['template-id'],
|
|
61
|
-
}),
|
|
62
50
|
label: Flags.string({
|
|
63
51
|
char: 'l',
|
|
64
52
|
summary: messages.getMessage('flags.label.summary'),
|
|
@@ -69,18 +57,6 @@ export default class UpdateApp extends SfCommand {
|
|
|
69
57
|
summary: messages.getMessage('flags.description.summary'),
|
|
70
58
|
description: messages.getMessage('flags.description.description'),
|
|
71
59
|
}),
|
|
72
|
-
'runtime-method': Flags.string({
|
|
73
|
-
char: 'r',
|
|
74
|
-
summary: messages.getMessage('flags.runtime-method.summary'),
|
|
75
|
-
description: messages.getMessage('flags.runtime-method.description'),
|
|
76
|
-
options: ['sync', 'async'],
|
|
77
|
-
}),
|
|
78
|
-
'log-level': Flags.string({
|
|
79
|
-
char: 'g',
|
|
80
|
-
summary: messages.getMessage('flags.log-level.summary'),
|
|
81
|
-
description: messages.getMessage('flags.log-level.description'),
|
|
82
|
-
options: ['debug', 'info', 'warn', 'error'],
|
|
83
|
-
}),
|
|
84
60
|
};
|
|
85
61
|
async run() {
|
|
86
62
|
const { flags } = await this.parse(UpdateApp);
|
|
@@ -88,9 +64,9 @@ export default class UpdateApp extends SfCommand {
|
|
|
88
64
|
if (!flags['app-id'] && !flags['app-name']) {
|
|
89
65
|
throw new SfError(messages.getMessage('noAppSpecified'), 'AppUpdateError', messages.getMessages('error.UpdateError.Actions'));
|
|
90
66
|
}
|
|
91
|
-
// Check that at least one
|
|
92
|
-
if (!flags
|
|
93
|
-
throw new SfError(messages.getMessage('
|
|
67
|
+
// Check that at least one update field is provided
|
|
68
|
+
if (!flags.label && !flags.description) {
|
|
69
|
+
throw new SfError(messages.getMessage('noUpdateFieldsSpecified'), 'AppUpdateError', messages.getMessages('error.UpdateError.Actions'));
|
|
94
70
|
}
|
|
95
71
|
try {
|
|
96
72
|
const connection = flags['target-org'].getConnection(flags['api-version']);
|
|
@@ -111,27 +87,11 @@ export default class UpdateApp extends SfCommand {
|
|
|
111
87
|
else {
|
|
112
88
|
appId = flags['app-id'] ?? '';
|
|
113
89
|
}
|
|
114
|
-
let templateId = '';
|
|
115
|
-
// Get template ID if template name was provided
|
|
116
|
-
if (flags['template-name']) {
|
|
117
|
-
this.spinner.start(messages.getMessage('fetchingTemplate'));
|
|
118
|
-
// Since we don't have a direct way to list templates,
|
|
119
|
-
// we need to get the template by name from a different utility class
|
|
120
|
-
// For now, we'll throw an error and suggest using template-id instead
|
|
121
|
-
this.spinner.stop();
|
|
122
|
-
throw new SfError(messages.getMessage('noTemplateFound'), 'AppUpdateError', messages.getMessages('error.UpdateError.Actions'));
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
templateId = flags['template-id'] ?? '';
|
|
126
|
-
}
|
|
127
90
|
// Update the app
|
|
128
91
|
this.spinner.start(messages.getMessage('updatingApp'));
|
|
129
|
-
const updatedAppId = await appFrameworkApp.
|
|
130
|
-
templateSourceId: templateId,
|
|
92
|
+
const updatedAppId = await appFrameworkApp.patchApp(appId, {
|
|
131
93
|
label: flags.label,
|
|
132
94
|
description: flags.description,
|
|
133
|
-
runtimeMethod: flags['runtime-method'],
|
|
134
|
-
logLevel: flags['log-level'],
|
|
135
95
|
});
|
|
136
96
|
this.spinner.stop();
|
|
137
97
|
this.log(messages.getMessage('updateSuccess', [updatedAppId]));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/commands/orchestrator/app/update.ts"],"names":[],"mappings":"AAAA;;;;;;;;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;QACtB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAEpB,MAAM,IAAI,OAAO,CACf,QAAQ,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAE,KAAe,CAAC,OAAO,CAAC,CAAC,EACpE,gBAAgB,EAChB,QAAQ,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAClD,CAAC;QACJ,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
export type OrchestratorAppUpgradeResult = {
|
|
3
|
+
appId: string;
|
|
4
|
+
};
|
|
5
|
+
export default class OrchestratorAppUpgrade extends SfCommand<OrchestratorAppUpgradeResult> {
|
|
6
|
+
static readonly summary: string;
|
|
7
|
+
static readonly description: string;
|
|
8
|
+
static readonly examples: string[];
|
|
9
|
+
static readonly state = "preview";
|
|
10
|
+
static readonly flags: {
|
|
11
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'app-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'app-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
'template-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
'template-values': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
'runtime-method': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
'log-level': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
'chain-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
};
|
|
21
|
+
private static validateRequiredFlags;
|
|
22
|
+
private static validateTemplateMatch;
|
|
23
|
+
private static parseTemplateValues;
|
|
24
|
+
private static buildUpdateOptions;
|
|
25
|
+
private static resolveAppById;
|
|
26
|
+
private static handleUpgradeError;
|
|
27
|
+
run(): Promise<OrchestratorAppUpgradeResult>;
|
|
28
|
+
private resolveApp;
|
|
29
|
+
private resolveAppByName;
|
|
30
|
+
private executeUpgrade;
|
|
31
|
+
private displayUpgradedApp;
|
|
32
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025, Salesforce, Inc.
|
|
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 { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
17
|
+
import { Messages, SfError } from '@salesforce/core';
|
|
18
|
+
import AppFrameworkApp from '../../../utils/app/appframeworkapp.js';
|
|
19
|
+
import { AppListUtil } from '../../../utils/app/appListUtils.js';
|
|
20
|
+
import { AppDisplayUtil } from '../../../utils/app/appDisplayUtil.js';
|
|
21
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
22
|
+
const messages = Messages.loadMessages('@salesforce/plugin-orchestrator', 'orchestrator.app.upgrade');
|
|
23
|
+
export default class OrchestratorAppUpgrade extends SfCommand {
|
|
24
|
+
static summary = messages.getMessage('summary');
|
|
25
|
+
static description = messages.getMessage('description');
|
|
26
|
+
static examples = messages.getMessages('examples');
|
|
27
|
+
static state = 'preview';
|
|
28
|
+
static flags = {
|
|
29
|
+
'target-org': Flags.requiredOrg({
|
|
30
|
+
summary: messages.getMessage('flags.target-org.summary'),
|
|
31
|
+
description: messages.getMessage('flags.target-org.description'),
|
|
32
|
+
required: true,
|
|
33
|
+
}),
|
|
34
|
+
'api-version': Flags.orgApiVersion({
|
|
35
|
+
summary: messages.getMessage('flags.api-version.summary'),
|
|
36
|
+
description: messages.getMessage('flags.api-version.description'),
|
|
37
|
+
}),
|
|
38
|
+
'app-id': Flags.string({
|
|
39
|
+
char: 'i',
|
|
40
|
+
summary: messages.getMessage('flags.app-id.summary'),
|
|
41
|
+
description: messages.getMessage('flags.app-id.description'),
|
|
42
|
+
exclusive: ['app-name'],
|
|
43
|
+
}),
|
|
44
|
+
'app-name': Flags.string({
|
|
45
|
+
char: 'n',
|
|
46
|
+
summary: messages.getMessage('flags.app-name.summary'),
|
|
47
|
+
description: messages.getMessage('flags.app-name.description'),
|
|
48
|
+
exclusive: ['app-id'],
|
|
49
|
+
}),
|
|
50
|
+
'template-id': Flags.string({
|
|
51
|
+
char: 't',
|
|
52
|
+
summary: messages.getMessage('flags.template-id.summary'),
|
|
53
|
+
description: messages.getMessage('flags.template-id.description'),
|
|
54
|
+
required: true,
|
|
55
|
+
}),
|
|
56
|
+
'template-values': Flags.string({
|
|
57
|
+
char: 'v',
|
|
58
|
+
summary: messages.getMessage('flags.template-values.summary'),
|
|
59
|
+
description: messages.getMessage('flags.template-values.description'),
|
|
60
|
+
}),
|
|
61
|
+
'runtime-method': Flags.string({
|
|
62
|
+
char: 'r',
|
|
63
|
+
summary: messages.getMessage('flags.runtime-method.summary'),
|
|
64
|
+
description: messages.getMessage('flags.runtime-method.description'),
|
|
65
|
+
options: ['sync', 'async'],
|
|
66
|
+
}),
|
|
67
|
+
'log-level': Flags.string({
|
|
68
|
+
char: 'l',
|
|
69
|
+
summary: messages.getMessage('flags.log-level.summary'),
|
|
70
|
+
description: messages.getMessage('flags.log-level.description'),
|
|
71
|
+
options: ['debug', 'info', 'warn', 'error'],
|
|
72
|
+
}),
|
|
73
|
+
'chain-name': Flags.string({
|
|
74
|
+
char: 'c',
|
|
75
|
+
summary: messages.getMessage('flags.chain-name.summary'),
|
|
76
|
+
description: messages.getMessage('flags.chain-name.description'),
|
|
77
|
+
}),
|
|
78
|
+
};
|
|
79
|
+
static validateRequiredFlags(flags) {
|
|
80
|
+
if (!flags['app-id'] && !flags['app-name']) {
|
|
81
|
+
throw new SfError(messages.getMessage('noAppSpecified'), 'AppUpgradeError', messages.getMessages('error.UpgradeError.Actions'));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
static validateTemplateMatch(app, templateId) {
|
|
85
|
+
if (app.templateSourceId !== templateId) {
|
|
86
|
+
throw new SfError(`Template ID mismatch. App is using template '${app.templateSourceId ?? 'unknown'}' but you specified '${templateId}'. You cannot change the underlying template during an upgrade.`, 'AppUpgradeError', messages.getMessages('error.UpgradeError.Actions'));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
static parseTemplateValues(templateValuesString) {
|
|
90
|
+
if (!templateValuesString) {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
const parsed = JSON.parse(templateValuesString);
|
|
95
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
96
|
+
throw new SfError('Template values must be a valid JSON object, not an array or primitive value.', 'AppUpgradeError', messages.getMessages('error.UpgradeError.Actions'));
|
|
97
|
+
}
|
|
98
|
+
return parsed;
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
if (error instanceof SfError) {
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
throw new SfError(messages.getMessage('invalidTemplateValues'), 'AppUpgradeError', messages.getMessages('error.UpgradeError.Actions'));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
static buildUpdateOptions(flags, templateValues) {
|
|
108
|
+
const updateOptions = {
|
|
109
|
+
templateSourceId: flags['template-id'],
|
|
110
|
+
templateValues,
|
|
111
|
+
runtimeMethod: flags['runtime-method'],
|
|
112
|
+
logLevel: flags['log-level'],
|
|
113
|
+
};
|
|
114
|
+
if (flags['chain-name']) {
|
|
115
|
+
updateOptions.chainName = flags['chain-name'];
|
|
116
|
+
}
|
|
117
|
+
return updateOptions;
|
|
118
|
+
}
|
|
119
|
+
static async resolveAppById(appId, appFrameworkApp) {
|
|
120
|
+
if (!appId) {
|
|
121
|
+
throw new SfError(messages.getMessage('noAppSpecified'), 'AppUpgradeError', messages.getMessages('error.UpgradeError.Actions'));
|
|
122
|
+
}
|
|
123
|
+
const app = await appFrameworkApp.getApp(appId);
|
|
124
|
+
if (!app) {
|
|
125
|
+
throw new SfError(messages.getMessage('noAppFound'), 'AppUpgradeError', messages.getMessages('error.UpgradeError.Actions'));
|
|
126
|
+
}
|
|
127
|
+
return { appId, app };
|
|
128
|
+
}
|
|
129
|
+
static handleUpgradeError(error) {
|
|
130
|
+
if (error instanceof SfError) {
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
throw new SfError(messages.getMessage('error.UpgradeError', [error.message]), 'AppUpgradeError', messages.getMessages('error.UpgradeError.Actions'), undefined, error);
|
|
134
|
+
}
|
|
135
|
+
async run() {
|
|
136
|
+
const { flags } = await this.parse(OrchestratorAppUpgrade);
|
|
137
|
+
OrchestratorAppUpgrade.validateRequiredFlags(flags);
|
|
138
|
+
try {
|
|
139
|
+
const connection = flags['target-org'].getConnection(flags['api-version']);
|
|
140
|
+
const appFrameworkApp = new AppFrameworkApp(connection);
|
|
141
|
+
const { appId, app } = await this.resolveApp(flags, appFrameworkApp);
|
|
142
|
+
OrchestratorAppUpgrade.validateTemplateMatch(app, flags['template-id']);
|
|
143
|
+
const templateValues = OrchestratorAppUpgrade.parseTemplateValues(flags['template-values']);
|
|
144
|
+
const updateOptions = OrchestratorAppUpgrade.buildUpdateOptions(flags, templateValues);
|
|
145
|
+
const upgradedAppId = await this.executeUpgrade(appFrameworkApp, appId, updateOptions);
|
|
146
|
+
await this.displayUpgradedApp(appFrameworkApp, upgradedAppId);
|
|
147
|
+
return { appId: upgradedAppId };
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
this.spinner.stop();
|
|
151
|
+
OrchestratorAppUpgrade.handleUpgradeError(error);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async resolveApp(flags, appFrameworkApp) {
|
|
155
|
+
if (flags['app-name']) {
|
|
156
|
+
return this.resolveAppByName(flags['app-name'], appFrameworkApp);
|
|
157
|
+
}
|
|
158
|
+
return OrchestratorAppUpgrade.resolveAppById(flags['app-id'], appFrameworkApp);
|
|
159
|
+
}
|
|
160
|
+
async resolveAppByName(appName, appFrameworkApp) {
|
|
161
|
+
this.spinner.start(messages.getMessage('fetchingApp'));
|
|
162
|
+
const apps = await appFrameworkApp.list();
|
|
163
|
+
const foundApp = apps.find((a) => a.name === appName);
|
|
164
|
+
if (!foundApp?.id) {
|
|
165
|
+
this.spinner.stop();
|
|
166
|
+
throw new SfError(messages.getMessage('noAppFound'), 'AppUpgradeError', messages.getMessages('error.UpgradeError.Actions'));
|
|
167
|
+
}
|
|
168
|
+
this.spinner.stop();
|
|
169
|
+
return { appId: foundApp.id, app: foundApp };
|
|
170
|
+
}
|
|
171
|
+
async executeUpgrade(appFrameworkApp, appId, updateOptions) {
|
|
172
|
+
this.spinner.start(messages.getMessage('upgradingApp'));
|
|
173
|
+
const upgradedAppId = await appFrameworkApp.updateApp(appId, updateOptions);
|
|
174
|
+
this.spinner.stop();
|
|
175
|
+
this.log(messages.getMessage('upgradeSuccess', [upgradedAppId]));
|
|
176
|
+
return upgradedAppId;
|
|
177
|
+
}
|
|
178
|
+
async displayUpgradedApp(appFrameworkApp, upgradedAppId) {
|
|
179
|
+
const upgradedApp = await appFrameworkApp.getApp(upgradedAppId);
|
|
180
|
+
if (upgradedApp) {
|
|
181
|
+
const processedApps = AppListUtil.processApps([upgradedApp]);
|
|
182
|
+
if (processedApps.length > 0) {
|
|
183
|
+
AppDisplayUtil.displayAppDetails(this, processedApps[0]);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=upgrade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../../../src/commands/orchestrator/app/upgrade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAc,MAAM,kBAAkB,CAAC;AACjE,OAAO,eAAe,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAGtE,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,iCAAiC,EAAE,0BAA0B,CAAC,CAAC;AActG,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,SAAuC;IAClF,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,CAAU,KAAK,GAAG,SAAS,CAAC;IAElC,MAA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,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC7B,cAAc,CAAC,iBAAiB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
type TransformationPayload = {
|
|
3
|
+
document: {
|
|
4
|
+
user: {
|
|
5
|
+
firstName: string;
|
|
6
|
+
lastName: string;
|
|
7
|
+
userName: string;
|
|
8
|
+
id: string;
|
|
9
|
+
hello: string;
|
|
10
|
+
};
|
|
11
|
+
company: {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
namespace: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
values: {
|
|
18
|
+
Variables: {
|
|
19
|
+
hello: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
definition: {
|
|
23
|
+
rules: Array<{
|
|
24
|
+
name: string;
|
|
25
|
+
actions: Array<{
|
|
26
|
+
action: string;
|
|
27
|
+
description: string;
|
|
28
|
+
key: string;
|
|
29
|
+
path: string;
|
|
30
|
+
value: string;
|
|
31
|
+
}>;
|
|
32
|
+
}>;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
type TemplateInfo = {
|
|
36
|
+
name: string;
|
|
37
|
+
path: string;
|
|
38
|
+
source: 'static' | 'local';
|
|
39
|
+
};
|
|
40
|
+
export type TemplatePreviewResult = {
|
|
41
|
+
status: 'success' | 'error';
|
|
42
|
+
template?: TemplateInfo;
|
|
43
|
+
input?: TransformationPayload;
|
|
44
|
+
output?: unknown;
|
|
45
|
+
error?: string;
|
|
46
|
+
executionTime?: string;
|
|
47
|
+
};
|
|
48
|
+
export default class TemplateEval extends SfCommand<TemplatePreviewResult> {
|
|
49
|
+
static readonly summary: string;
|
|
50
|
+
static readonly description: string;
|
|
51
|
+
static readonly examples: string[];
|
|
52
|
+
static readonly flags: {
|
|
53
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
54
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
55
|
+
'template-info': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
56
|
+
variables: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
57
|
+
rules: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
58
|
+
};
|
|
59
|
+
run(): Promise<TemplatePreviewResult>;
|
|
60
|
+
private getTemplatePayload;
|
|
61
|
+
private getDirectFilePayload;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025, Salesforce, Inc.
|
|
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 * as fs from 'node:fs/promises';
|
|
17
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { Messages } from '@salesforce/core';
|
|
19
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
20
|
+
const messages = Messages.loadMessages('@salesforce/plugin-orchestrator', 'orchestrator.rules.eval');
|
|
21
|
+
export default class TemplateEval extends SfCommand {
|
|
22
|
+
static summary = messages.getMessage('summary');
|
|
23
|
+
static description = messages.getMessage('description');
|
|
24
|
+
static examples = messages.getMessages('examples');
|
|
25
|
+
static flags = {
|
|
26
|
+
'target-org': Flags.requiredOrg({
|
|
27
|
+
summary: messages.getMessage('flags.target-org.summary'),
|
|
28
|
+
description: messages.getMessage('flags.target-org.description'),
|
|
29
|
+
required: true,
|
|
30
|
+
}),
|
|
31
|
+
'api-version': Flags.orgApiVersion({
|
|
32
|
+
summary: messages.getMessage('flags.api-version.summary'),
|
|
33
|
+
description: messages.getMessage('flags.api-version.description'),
|
|
34
|
+
}),
|
|
35
|
+
'template-info': Flags.file({
|
|
36
|
+
char: 't',
|
|
37
|
+
summary: messages.getMessage('flags.template-info.summary'),
|
|
38
|
+
description: messages.getMessage('flags.template-info.description'),
|
|
39
|
+
required: true,
|
|
40
|
+
}),
|
|
41
|
+
variables: Flags.file({
|
|
42
|
+
char: 'v',
|
|
43
|
+
summary: messages.getMessage('flags.variables.summary'),
|
|
44
|
+
description: messages.getMessage('flags.variables.description'),
|
|
45
|
+
required: true,
|
|
46
|
+
}),
|
|
47
|
+
rules: Flags.file({
|
|
48
|
+
char: 'r',
|
|
49
|
+
summary: messages.getMessage('flags.rules.summary'),
|
|
50
|
+
description: messages.getMessage('flags.rules.description'),
|
|
51
|
+
required: true,
|
|
52
|
+
}),
|
|
53
|
+
};
|
|
54
|
+
async run() {
|
|
55
|
+
const { flags } = await this.parse(TemplateEval);
|
|
56
|
+
try {
|
|
57
|
+
const connection = flags['target-org'].getConnection(flags['api-version']);
|
|
58
|
+
// Determine template source and payload
|
|
59
|
+
const templateResult = await this.getTemplatePayload(flags);
|
|
60
|
+
this.log(`Testing transformation: ${templateResult.template.name}`);
|
|
61
|
+
this.log(`Source: ${templateResult.template.source}`);
|
|
62
|
+
if (templateResult.template.source === 'local') {
|
|
63
|
+
this.log(`Path: ${templateResult.template.path}`);
|
|
64
|
+
}
|
|
65
|
+
const startTime = Date.now();
|
|
66
|
+
// Make request to jsonxform/transformation endpoint
|
|
67
|
+
const apiPath = `/services/data/v${connection.getApiVersion()}/jsonxform/transformation`;
|
|
68
|
+
const result = await connection.request({
|
|
69
|
+
method: 'POST',
|
|
70
|
+
url: apiPath,
|
|
71
|
+
body: JSON.stringify(templateResult.payload),
|
|
72
|
+
headers: {
|
|
73
|
+
'Content-Type': 'application/json',
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
const executionTime = `${Date.now() - startTime}ms`;
|
|
77
|
+
this.log('Transformation completed successfully!');
|
|
78
|
+
this.log('Results:');
|
|
79
|
+
this.log(JSON.stringify(result, null, 2));
|
|
80
|
+
return {
|
|
81
|
+
status: 'success',
|
|
82
|
+
template: templateResult.template,
|
|
83
|
+
input: templateResult.payload,
|
|
84
|
+
output: result,
|
|
85
|
+
executionTime,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
this.log(`Transformation failed: ${error.message}`);
|
|
90
|
+
return {
|
|
91
|
+
status: 'error',
|
|
92
|
+
error: error.message,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async getTemplatePayload(flags) {
|
|
97
|
+
return this.getDirectFilePayload(flags['template-info'], flags['variables'], flags['rules']);
|
|
98
|
+
}
|
|
99
|
+
async getDirectFilePayload(templateInfoFile, variablesFile, rulesFile) {
|
|
100
|
+
this.log(`Loading template info: ${templateInfoFile}`);
|
|
101
|
+
// Read and parse the template-info file
|
|
102
|
+
const templateInfoContent = await fs.readFile(templateInfoFile, 'utf8');
|
|
103
|
+
const document = JSON.parse(templateInfoContent);
|
|
104
|
+
// Read variables file
|
|
105
|
+
this.log(`Loading variables: ${variablesFile}`);
|
|
106
|
+
const variablesContent = await fs.readFile(variablesFile, 'utf8');
|
|
107
|
+
const values = JSON.parse(variablesContent);
|
|
108
|
+
// Read rules file
|
|
109
|
+
this.log(`Loading rules: ${rulesFile}`);
|
|
110
|
+
const rulesContent = await fs.readFile(rulesFile, 'utf8');
|
|
111
|
+
const definition = JSON.parse(rulesContent);
|
|
112
|
+
return {
|
|
113
|
+
template: {
|
|
114
|
+
name: 'Direct Files',
|
|
115
|
+
path: templateInfoFile,
|
|
116
|
+
source: 'local',
|
|
117
|
+
},
|
|
118
|
+
payload: {
|
|
119
|
+
document: document,
|
|
120
|
+
values: values,
|
|
121
|
+
definition: definition,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=eval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eval.js","sourceRoot":"","sources":["../../../../src/commands/orchestrator/rules/eval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAc,MAAM,kBAAkB,CAAC;AAExD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,iCAAiC,EAAE,yBAAyB,CAAC,CAAC;AAmDrG,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,SAAgC;IACjE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC7B,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC;YAC9B,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,0BAA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tB,MAAM,EAAE,OAAgB;aACzB;YACD,OAAO,EAAE;gBACP,QAAQ,EAAE,QAA6C;gBACvD,MAAM,EAAE,MAAyC;gBACjD,UAAU,EAAE,UAAiD;aAC9D;SACF,CAAC;IACJ,CAAC"}
|
|
@@ -8,6 +8,7 @@ export default class ListTemplate extends SfCommand<TemplateData[]> {
|
|
|
8
8
|
static readonly flags: {
|
|
9
9
|
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
all: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
12
|
};
|
|
12
13
|
run(): Promise<TemplateData[]>;
|
|
13
14
|
}
|
|
@@ -35,6 +35,11 @@ export default class ListTemplate extends SfCommand {
|
|
|
35
35
|
summary: messages.getMessage('flags.api-version.summary'),
|
|
36
36
|
description: messages.getMessage('flags.api-version.description'),
|
|
37
37
|
}),
|
|
38
|
+
all: Flags.boolean({
|
|
39
|
+
summary: messages.getMessage('flags.all.summary'),
|
|
40
|
+
description: messages.getMessage('flags.all.description'),
|
|
41
|
+
default: false,
|
|
42
|
+
}),
|
|
38
43
|
};
|
|
39
44
|
async run() {
|
|
40
45
|
const { flags } = await this.parse(ListTemplate);
|
|
@@ -44,12 +49,17 @@ export default class ListTemplate extends SfCommand {
|
|
|
44
49
|
const appFrameworkTemplate = new AppFrameworkTemplate(connection);
|
|
45
50
|
const rawTemplates = await appFrameworkTemplate.list();
|
|
46
51
|
this.spinner.stop();
|
|
47
|
-
|
|
52
|
+
let templates = TemplateListUtil.processTemplates(rawTemplates);
|
|
53
|
+
// Filter out standard templates by default unless --all flag is used
|
|
54
|
+
if (!flags.all) {
|
|
55
|
+
templates = templates.filter((template) => !template.name?.startsWith('sfdc_internal__'));
|
|
56
|
+
}
|
|
48
57
|
if (templates.length > 0) {
|
|
49
58
|
TemplateDisplayUtil.displayTemplateList(this, templates);
|
|
50
59
|
}
|
|
51
60
|
else {
|
|
52
|
-
|
|
61
|
+
const messageKey = flags.all ? 'noResultsFound' : 'noCustomTemplatesFound';
|
|
62
|
+
this.log(messages.getMessage(messageKey));
|
|
53
63
|
}
|
|
54
64
|
return templates;
|
|
55
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/orchestrator/template/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAc,MAAM,kBAAkB,CAAC;AAEjE,OAAO,oBAAoB,MAAM,iDAAiD,CAAC;AAEnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAErF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,iCAAiC,EAAE,4BAA4B,CAAC,CAAC;AAExG,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,SAAyB;IAC1D,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,CAAU,KAAK,GAAG,SAAS,CAAC;IAElC,MAAM,CAAU,KAAK,GAAG;QAC7B,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC;YAC9B,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,0BAA0B,C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AAU,CAAC,wBAAwB,CAAC,EAC7C,mBAAmB,EACnB,QAAQ,CAAC,WAAW,CAAC,gCAAgC,CAAC,CACvD,CAAC;YACJ,CAAC;iBAAM,IAAI,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzE,MAAM,IAAI,OAAO,CACf,QAAQ,CAAC,UAAU,CAAC,2BAA2B,CAAC,EAChD,mBAAmB,EACnB,QAAQ,CAAC,WAAW,CAAC,mCAAmC,CAAC,CAC1D,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,OAAO,CACf,QAAQ,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC,QAAQ,CAAC,CAAC,EACrD,mBAAmB,EACnB,QAAQ,CAAC,WAAW,CAAC,4BAA4B,CAAC,CACnD,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC"}
|
|
@@ -38,7 +38,7 @@ export class AppDisplayUtil {
|
|
|
38
38
|
* @param apps - The app data to display
|
|
39
39
|
* @param title - Optional title for the table
|
|
40
40
|
*/
|
|
41
|
-
static displayAppList(command, apps, title = '
|
|
41
|
+
static displayAppList(command, apps, title = 'Apps') {
|
|
42
42
|
if (apps.length === 0) {
|
|
43
43
|
command.log('No apps found.');
|
|
44
44
|
return;
|