@salesforce/plugin-orchestrator 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +28 -0
- package/LICENSE.txt +12 -0
- package/README.md +145 -0
- package/lib/commands/orchestrator/create/app.d.ts +19 -0
- package/lib/commands/orchestrator/create/app.js +144 -0
- package/lib/commands/orchestrator/create/app.js.map +1 -0
- package/lib/commands/orchestrator/create/template.d.ts +17 -0
- package/lib/commands/orchestrator/create/template.js +96 -0
- package/lib/commands/orchestrator/create/template.js.map +1 -0
- package/lib/commands/orchestrator/decouple/app.d.ts +14 -0
- package/lib/commands/orchestrator/decouple/app.js +106 -0
- package/lib/commands/orchestrator/decouple/app.js.map +1 -0
- package/lib/commands/orchestrator/delete/app.d.ts +15 -0
- package/lib/commands/orchestrator/delete/app.js +102 -0
- package/lib/commands/orchestrator/delete/app.js.map +1 -0
- package/lib/commands/orchestrator/delete/template.d.ts +15 -0
- package/lib/commands/orchestrator/delete/template.js +108 -0
- package/lib/commands/orchestrator/delete/template.js.map +1 -0
- package/lib/commands/orchestrator/display/app.d.ts +15 -0
- package/lib/commands/orchestrator/display/app.js +85 -0
- package/lib/commands/orchestrator/display/app.js.map +1 -0
- package/lib/commands/orchestrator/display/template.d.ts +15 -0
- package/lib/commands/orchestrator/display/template.js +105 -0
- package/lib/commands/orchestrator/display/template.js.map +1 -0
- package/lib/commands/orchestrator/list/app.d.ts +13 -0
- package/lib/commands/orchestrator/list/app.js +62 -0
- package/lib/commands/orchestrator/list/app.js.map +1 -0
- package/lib/commands/orchestrator/list/template.d.ts +14 -0
- package/lib/commands/orchestrator/list/template.js +64 -0
- package/lib/commands/orchestrator/list/template.js.map +1 -0
- package/lib/commands/orchestrator/template/create.d.ts +17 -0
- package/lib/commands/orchestrator/template/create.js +96 -0
- package/lib/commands/orchestrator/template/create.js.map +1 -0
- package/lib/commands/orchestrator/template/delete.d.ts +15 -0
- package/lib/commands/orchestrator/template/delete.js +108 -0
- package/lib/commands/orchestrator/template/delete.js.map +1 -0
- package/lib/commands/orchestrator/template/display.d.ts +15 -0
- package/lib/commands/orchestrator/template/display.js +105 -0
- package/lib/commands/orchestrator/template/display.js.map +1 -0
- package/lib/commands/orchestrator/template/list.d.ts +13 -0
- package/lib/commands/orchestrator/template/list.js +62 -0
- package/lib/commands/orchestrator/template/list.js.map +1 -0
- package/lib/commands/orchestrator/template/update.d.ts +17 -0
- package/lib/commands/orchestrator/template/update.js +107 -0
- package/lib/commands/orchestrator/template/update.js.map +1 -0
- package/lib/commands/orchestrator/update/app.d.ts +20 -0
- package/lib/commands/orchestrator/update/app.js +145 -0
- package/lib/commands/orchestrator/update/app.js.map +1 -0
- package/lib/commands/orchestrator/update/template.d.ts +17 -0
- package/lib/commands/orchestrator/update/template.js +107 -0
- package/lib/commands/orchestrator/update/template.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -0
- package/lib/utils/app/appDisplayUtil.d.ts +26 -0
- package/lib/utils/app/appDisplayUtil.js +153 -0
- package/lib/utils/app/appDisplayUtil.js.map +1 -0
- package/lib/utils/app/appListUtils.d.ts +34 -0
- package/lib/utils/app/appListUtils.js +81 -0
- package/lib/utils/app/appListUtils.js.map +1 -0
- package/lib/utils/app/appTypes.d.ts +44 -0
- package/lib/utils/app/appTypes.js +8 -0
- package/lib/utils/app/appTypes.js.map +1 -0
- package/lib/utils/app/appframeworkapp.d.ts +64 -0
- package/lib/utils/app/appframeworkapp.js +175 -0
- package/lib/utils/app/appframeworkapp.js.map +1 -0
- package/lib/utils/display/displayUtil.d.ts +27 -0
- package/lib/utils/display/displayUtil.js +80 -0
- package/lib/utils/display/displayUtil.js.map +1 -0
- package/lib/utils/request.d.ts +15 -0
- package/lib/utils/request.js +18 -0
- package/lib/utils/request.js.map +1 -0
- package/lib/utils/template/appframeworktemplate.d.ts +67 -0
- package/lib/utils/template/appframeworktemplate.js +114 -0
- package/lib/utils/template/appframeworktemplate.js.map +1 -0
- package/lib/utils/template/templateDisplayUtil.d.ts +42 -0
- package/lib/utils/template/templateDisplayUtil.js +142 -0
- package/lib/utils/template/templateDisplayUtil.js.map +1 -0
- package/lib/utils/template/templateHighlighter.d.ts +23 -0
- package/lib/utils/template/templateHighlighter.js +68 -0
- package/lib/utils/template/templateHighlighter.js.map +1 -0
- package/lib/utils/template/templateListUtils.d.ts +40 -0
- package/lib/utils/template/templateListUtils.js +126 -0
- package/lib/utils/template/templateListUtils.js.map +1 -0
- package/lib/utils/template/templateTypes.d.ts +114 -0
- package/lib/utils/template/templateTypes.js +15 -0
- package/lib/utils/template/templateTypes.js.map +1 -0
- package/lib/utils/utils.d.ts +21 -0
- package/lib/utils/utils.js +49 -0
- package/lib/utils/utils.js.map +1 -0
- package/messages/appframework.create.app.md +124 -0
- package/messages/appframework.create.template.md +82 -0
- package/messages/appframework.decouple.app.md +82 -0
- package/messages/appframework.delete.app.md +94 -0
- package/messages/appframework.delete.template.md +162 -0
- package/messages/appframework.display.app.md +70 -0
- package/messages/appframework.display.template.md +101 -0
- package/messages/appframework.list.app.md +126 -0
- package/messages/appframework.list.template.md +78 -0
- package/messages/appframework.template.create.md +82 -0
- package/messages/appframework.template.delete.md +162 -0
- package/messages/appframework.template.display.md +101 -0
- package/messages/appframework.template.list.md +78 -0
- package/messages/appframework.template.update.md +78 -0
- package/messages/appframework.update.app.md +142 -0
- package/messages/appframework.update.template.md +78 -0
- package/npm-shrinkwrap.json +14309 -0
- package/oclif.lock +7751 -0
- package/oclif.manifest.json +1731 -0
- package/package.json +226 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AppData, RawApp } from './appTypes.js';
|
|
2
|
+
/**
|
|
3
|
+
* Utility class for processing app list data
|
|
4
|
+
*/
|
|
5
|
+
export declare class AppListUtil {
|
|
6
|
+
/**
|
|
7
|
+
* Process raw apps from the API into a structured format
|
|
8
|
+
*
|
|
9
|
+
* @param rawApps - Raw app data from the API
|
|
10
|
+
* @returns Processed app data
|
|
11
|
+
*/
|
|
12
|
+
static processApps(rawApps: RawApp[]): AppData[];
|
|
13
|
+
/**
|
|
14
|
+
* Process apps for display
|
|
15
|
+
*
|
|
16
|
+
* @param apps - App data array
|
|
17
|
+
* @returns Processed app data for display
|
|
18
|
+
*/
|
|
19
|
+
static processOutput(apps: AppData[]): Array<Record<string, string | undefined>>;
|
|
20
|
+
/**
|
|
21
|
+
* Process apps for simple display
|
|
22
|
+
*
|
|
23
|
+
* @param apps - App data array
|
|
24
|
+
* @returns Processed app data for simple display
|
|
25
|
+
*/
|
|
26
|
+
static processSimpleOutput(apps: AppData[]): Array<Record<string, string | undefined>>;
|
|
27
|
+
/**
|
|
28
|
+
* Process a single raw app into a structured format
|
|
29
|
+
*
|
|
30
|
+
* @param rawApp - Raw app data from the API
|
|
31
|
+
* @returns Processed app data
|
|
32
|
+
*/
|
|
33
|
+
private static processApp;
|
|
34
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility class for processing app list data
|
|
3
|
+
*/
|
|
4
|
+
export class AppListUtil {
|
|
5
|
+
/**
|
|
6
|
+
* Process raw apps from the API into a structured format
|
|
7
|
+
*
|
|
8
|
+
* @param rawApps - Raw app data from the API
|
|
9
|
+
* @returns Processed app data
|
|
10
|
+
*/
|
|
11
|
+
static processApps(rawApps) {
|
|
12
|
+
if (!rawApps || !Array.isArray(rawApps)) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
return rawApps.map((app) => this.processApp(app));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Process apps for display
|
|
19
|
+
*
|
|
20
|
+
* @param apps - App data array
|
|
21
|
+
* @returns Processed app data for display
|
|
22
|
+
*/
|
|
23
|
+
static processOutput(apps) {
|
|
24
|
+
return apps.map((app) => ({
|
|
25
|
+
Name: app.name,
|
|
26
|
+
Label: app.label,
|
|
27
|
+
ID: app.id,
|
|
28
|
+
Type: app.templateType,
|
|
29
|
+
'Template ID': app.templateSourceId,
|
|
30
|
+
Status: app.status,
|
|
31
|
+
Created: app.created,
|
|
32
|
+
Modified: app.modified,
|
|
33
|
+
Description: app.description ?? 'n/a',
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Process apps for simple display
|
|
38
|
+
*
|
|
39
|
+
* @param apps - App data array
|
|
40
|
+
* @returns Processed app data for simple display
|
|
41
|
+
*/
|
|
42
|
+
static processSimpleOutput(apps) {
|
|
43
|
+
return apps.map((app) => ({
|
|
44
|
+
ID: app.id,
|
|
45
|
+
Name: app.name,
|
|
46
|
+
Label: app.label,
|
|
47
|
+
Type: app.templateType,
|
|
48
|
+
SubType: app.templateSubtype ?? 'n/a',
|
|
49
|
+
'Template ID': app.templateSourceId ?? 'n/a',
|
|
50
|
+
Status: app.status ?? 'n/a',
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Process a single raw app into a structured format
|
|
55
|
+
*
|
|
56
|
+
* @param rawApp - Raw app data from the API
|
|
57
|
+
* @returns Processed app data
|
|
58
|
+
*/
|
|
59
|
+
static processApp(rawApp) {
|
|
60
|
+
return {
|
|
61
|
+
id: rawApp.id,
|
|
62
|
+
name: rawApp.name,
|
|
63
|
+
label: rawApp.label,
|
|
64
|
+
description: rawApp.description,
|
|
65
|
+
templateSourceId: rawApp.templateSourceId,
|
|
66
|
+
templateType: rawApp.templateType,
|
|
67
|
+
templateSubtype: rawApp.templateSubtype,
|
|
68
|
+
templateVersion: rawApp.templateVersion,
|
|
69
|
+
namespace: rawApp.namespace,
|
|
70
|
+
created: rawApp.createdDate ? new Date(rawApp.createdDate).toLocaleDateString() : 'n/a',
|
|
71
|
+
modified: rawApp.lastModifiedDate ? new Date(rawApp.lastModifiedDate).toLocaleDateString() : 'n/a',
|
|
72
|
+
runtimeMethod: rawApp.runtimeMethod,
|
|
73
|
+
logLevel: rawApp.logLevel,
|
|
74
|
+
status: rawApp.status,
|
|
75
|
+
url: rawApp.url,
|
|
76
|
+
configurationUrl: rawApp.configurationUrl,
|
|
77
|
+
readinessUrl: rawApp.readinessUrl,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=appListUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appListUtils.js","sourceRoot":"","sources":["../../../src/utils/app/appListUtils.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,OAAO,WAAW;IACtB;;;;;OAKG;IACI,MAAM,CAAC,WAAW,CAAC,OAAiB;QACzC,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACxC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IACpD,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,aAAa,CAAC,IAAe;QACzC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACxB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,EAAE,EAAE,GAAG,CAAC,EAAE;YACV,IAAI,EAAE,GAAG,CAAC,YAAY;YACtB,aAAa,EAAE,GAAG,CAAC,gBAAgB;YACnC,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,WAAW,EAAE,GAAG,CAAC,WAAW,IAAI,KAAK;SACtC,CAAC,CAAC,CAAC;IACN,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,mBAAmB,CAAC,IAAe;QAC/C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,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E,MAAM,CAAC,YAAY;SAClC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raw app data as returned from the API
|
|
3
|
+
*/
|
|
4
|
+
export type RawApp = {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
templateSourceId?: string;
|
|
10
|
+
templateType?: string;
|
|
11
|
+
templateSubtype?: string;
|
|
12
|
+
templateVersion?: string;
|
|
13
|
+
namespace?: string;
|
|
14
|
+
createdDate?: string;
|
|
15
|
+
lastModifiedDate?: string;
|
|
16
|
+
runtimeMethod?: string;
|
|
17
|
+
logLevel?: string;
|
|
18
|
+
status?: string;
|
|
19
|
+
url?: string;
|
|
20
|
+
configurationUrl?: string;
|
|
21
|
+
readinessUrl?: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Processed app data for display and usage in commands
|
|
25
|
+
*/
|
|
26
|
+
export type AppData = {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
label?: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
templateSourceId?: string;
|
|
32
|
+
templateType?: string;
|
|
33
|
+
templateSubtype?: string;
|
|
34
|
+
templateVersion?: string;
|
|
35
|
+
namespace?: string;
|
|
36
|
+
created?: string;
|
|
37
|
+
modified?: string;
|
|
38
|
+
runtimeMethod?: string;
|
|
39
|
+
logLevel?: string;
|
|
40
|
+
status?: string;
|
|
41
|
+
url?: string;
|
|
42
|
+
configurationUrl?: string;
|
|
43
|
+
readinessUrl?: string;
|
|
44
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025, salesforce.com, inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=appTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appTypes.js","sourceRoot":"","sources":["../../../src/utils/app/appTypes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Connection } from '@salesforce/core';
|
|
2
|
+
import { RawApp } from './appTypes.js';
|
|
3
|
+
export default class AppFrameworkApp {
|
|
4
|
+
private readonly connection;
|
|
5
|
+
constructor(connection: Connection);
|
|
6
|
+
/**
|
|
7
|
+
* List apps in the org
|
|
8
|
+
*
|
|
9
|
+
* @returns Array of app objects
|
|
10
|
+
*/
|
|
11
|
+
list(): Promise<RawApp[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Get a specific app by ID or name
|
|
14
|
+
*
|
|
15
|
+
* @param idOrName - ID or name of the app to retrieve
|
|
16
|
+
* @returns App object or null if not found
|
|
17
|
+
*/
|
|
18
|
+
getApp(idOrName: string): Promise<RawApp | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Create a new app from a template
|
|
21
|
+
*
|
|
22
|
+
* @param options - App creation options
|
|
23
|
+
* @returns The ID of the newly created app
|
|
24
|
+
*/
|
|
25
|
+
create(options: {
|
|
26
|
+
name: string;
|
|
27
|
+
label?: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
templateSourceId: string;
|
|
30
|
+
templateValues?: Record<string, unknown>;
|
|
31
|
+
namespace?: string;
|
|
32
|
+
runtimeMethod?: string;
|
|
33
|
+
logLevel?: string;
|
|
34
|
+
}): Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Decouple an app from its template
|
|
37
|
+
*
|
|
38
|
+
* @param appId - ID of the app to decouple
|
|
39
|
+
* @param templateId - ID of the template to decouple from
|
|
40
|
+
* @returns The ID of the decoupled app
|
|
41
|
+
*/
|
|
42
|
+
decoupleApp(appId: string, templateId: string): Promise<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Delete an app
|
|
45
|
+
*
|
|
46
|
+
* @param appId - ID of the app to delete
|
|
47
|
+
*/
|
|
48
|
+
deleteApp(appId: string): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Update an existing app with a new template
|
|
51
|
+
*
|
|
52
|
+
* @param appId - ID of the app to update
|
|
53
|
+
* @param options - Update options
|
|
54
|
+
* @returns The ID of the updated app
|
|
55
|
+
*/
|
|
56
|
+
updateApp(appId: string, options: {
|
|
57
|
+
templateSourceId: string;
|
|
58
|
+
label?: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
templateValues?: Record<string, unknown>;
|
|
61
|
+
runtimeMethod?: string;
|
|
62
|
+
logLevel?: string;
|
|
63
|
+
}): Promise<string>;
|
|
64
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { request } from '../request.js';
|
|
2
|
+
export default class AppFrameworkApp {
|
|
3
|
+
connection;
|
|
4
|
+
constructor(connection) {
|
|
5
|
+
this.connection = connection;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* List apps in the org
|
|
9
|
+
*
|
|
10
|
+
* @returns Array of app objects
|
|
11
|
+
*/
|
|
12
|
+
async list() {
|
|
13
|
+
const url = '/apps';
|
|
14
|
+
const response = await request(this.connection, {
|
|
15
|
+
method: 'GET',
|
|
16
|
+
url,
|
|
17
|
+
});
|
|
18
|
+
return response?.apps ?? [];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get a specific app by ID or name
|
|
22
|
+
*
|
|
23
|
+
* @param idOrName - ID or name of the app to retrieve
|
|
24
|
+
* @returns App object or null if not found
|
|
25
|
+
*/
|
|
26
|
+
async getApp(idOrName) {
|
|
27
|
+
if (!idOrName) {
|
|
28
|
+
throw new Error('App ID or name must be provided');
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
const url = `/apps/${idOrName}`;
|
|
32
|
+
const app = await request(this.connection, {
|
|
33
|
+
method: 'GET',
|
|
34
|
+
url,
|
|
35
|
+
});
|
|
36
|
+
return app;
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
if (error.statusCode !== 404) {
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const apps = await this.list();
|
|
44
|
+
const app = apps.find((a) => a.name === idOrName);
|
|
45
|
+
return app ?? null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create a new app from a template
|
|
49
|
+
*
|
|
50
|
+
* @param options - App creation options
|
|
51
|
+
* @returns The ID of the newly created app
|
|
52
|
+
*/
|
|
53
|
+
async create(options) {
|
|
54
|
+
const url = '/apps';
|
|
55
|
+
const body = Object.fromEntries(Object.entries({
|
|
56
|
+
name: options.name,
|
|
57
|
+
label: options.label,
|
|
58
|
+
description: options.description,
|
|
59
|
+
templateSourceId: options.templateSourceId,
|
|
60
|
+
templateValues: options.templateValues ?? {},
|
|
61
|
+
namespace: options.namespace,
|
|
62
|
+
runtimeMethod: options.runtimeMethod,
|
|
63
|
+
logLevel: options.logLevel,
|
|
64
|
+
}).filter((entries) => entries[1] !== undefined));
|
|
65
|
+
const response = await request(this.connection, {
|
|
66
|
+
method: 'POST',
|
|
67
|
+
url,
|
|
68
|
+
body,
|
|
69
|
+
});
|
|
70
|
+
if (response && typeof response === 'object') {
|
|
71
|
+
if ('id' in response && typeof response.id === 'string') {
|
|
72
|
+
return response.id;
|
|
73
|
+
}
|
|
74
|
+
else if ('app' in response && response.app && typeof response.app === 'object' && 'id' in response.app) {
|
|
75
|
+
return response.app.id;
|
|
76
|
+
}
|
|
77
|
+
else if ('apps' in response &&
|
|
78
|
+
Array.isArray(response.apps) &&
|
|
79
|
+
response.apps.length > 0 &&
|
|
80
|
+
response.apps[0]?.id) {
|
|
81
|
+
return response.apps[0].id;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Default return if no ID is found
|
|
85
|
+
return 'App created successfully, but ID could not be determined';
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Decouple an app from its template
|
|
89
|
+
*
|
|
90
|
+
* @param appId - ID of the app to decouple
|
|
91
|
+
* @param templateId - ID of the template to decouple from
|
|
92
|
+
* @returns The ID of the decoupled app
|
|
93
|
+
*/
|
|
94
|
+
async decoupleApp(appId, templateId) {
|
|
95
|
+
if (!appId) {
|
|
96
|
+
throw new Error('App ID must be provided');
|
|
97
|
+
}
|
|
98
|
+
if (!templateId) {
|
|
99
|
+
throw new Error('Template ID must be provided for decoupling');
|
|
100
|
+
}
|
|
101
|
+
const url = `/apps/${appId}`;
|
|
102
|
+
const body = {
|
|
103
|
+
templateSourceId: templateId,
|
|
104
|
+
templateOptions: { appAction: 'DecoupleApp' },
|
|
105
|
+
};
|
|
106
|
+
const response = await request(this.connection, {
|
|
107
|
+
method: 'PUT',
|
|
108
|
+
url,
|
|
109
|
+
body,
|
|
110
|
+
});
|
|
111
|
+
if (response && typeof response === 'object') {
|
|
112
|
+
if ('id' in response && typeof response.id === 'string') {
|
|
113
|
+
return response.id;
|
|
114
|
+
}
|
|
115
|
+
else if ('app' in response && response.app && typeof response.app === 'object' && 'id' in response.app) {
|
|
116
|
+
return response.app.id;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return appId; // Return the original app ID if no specific ID was found in the response
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Delete an app
|
|
123
|
+
*
|
|
124
|
+
* @param appId - ID of the app to delete
|
|
125
|
+
*/
|
|
126
|
+
async deleteApp(appId) {
|
|
127
|
+
if (!appId) {
|
|
128
|
+
throw new Error('App ID must be provided');
|
|
129
|
+
}
|
|
130
|
+
const url = `/apps/${appId}`;
|
|
131
|
+
await request(this.connection, {
|
|
132
|
+
method: 'DELETE',
|
|
133
|
+
url,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Update an existing app with a new template
|
|
138
|
+
*
|
|
139
|
+
* @param appId - ID of the app to update
|
|
140
|
+
* @param options - Update options
|
|
141
|
+
* @returns The ID of the updated app
|
|
142
|
+
*/
|
|
143
|
+
async updateApp(appId, options) {
|
|
144
|
+
if (!appId) {
|
|
145
|
+
throw new Error('App ID must be provided');
|
|
146
|
+
}
|
|
147
|
+
if (!options.templateSourceId) {
|
|
148
|
+
throw new Error('Template ID must be provided for update');
|
|
149
|
+
}
|
|
150
|
+
const url = `/apps/${appId}`;
|
|
151
|
+
const body = Object.fromEntries(Object.entries({
|
|
152
|
+
templateSourceId: options.templateSourceId,
|
|
153
|
+
label: options.label,
|
|
154
|
+
description: options.description,
|
|
155
|
+
templateValues: options.templateValues ?? {},
|
|
156
|
+
runtimeMethod: options.runtimeMethod,
|
|
157
|
+
logLevel: options.logLevel,
|
|
158
|
+
}).filter((entries) => entries[1] !== undefined));
|
|
159
|
+
const response = await request(this.connection, {
|
|
160
|
+
method: 'POST',
|
|
161
|
+
url,
|
|
162
|
+
body,
|
|
163
|
+
});
|
|
164
|
+
if (response && typeof response === 'object') {
|
|
165
|
+
if ('id' in response && typeof response.id === 'string') {
|
|
166
|
+
return response.id;
|
|
167
|
+
}
|
|
168
|
+
else if ('app' in response && response.app && typeof response.app === 'object' && 'id' in response.app) {
|
|
169
|
+
return response.app.id;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return appId; // Return the original app ID if no specific ID was found in the response
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=appframeworkapp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appframeworkapp.js","sourceRoot":"","sources":["../../../src/utils/app/appframeworkapp.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,MAAM,CAAC,OAAO,OAAO,eAAe;IACjB,UAAU,CAAa;IAExC,YAAmB,UAAsB;QACvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACI,KAAK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G,IAAI,OAAO,QAAQ,CAAC,GAAG,KAAK,QAAQ,IAAI,IAAI,IAAI,QAAQ,CAAC,GAAG,EAAE,CAAC;gBACzG,OAAO,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,CAAC,yEAAyE;IACzF,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { TemplateData } from '../template/templateTypes.js';
|
|
3
|
+
export declare class TemplateDisplayUtil {
|
|
4
|
+
/**
|
|
5
|
+
* Display a list of templates in a table format
|
|
6
|
+
*
|
|
7
|
+
* @param command - The SfCommand instance
|
|
8
|
+
* @param templates - The template data to display
|
|
9
|
+
* @param title - Optional title for the table
|
|
10
|
+
*/
|
|
11
|
+
static displayTemplateList(command: SfCommand<unknown>, templates: TemplateData[], title?: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* Display detailed information about a single template
|
|
14
|
+
*
|
|
15
|
+
* @param command - The SfCommand instance
|
|
16
|
+
* @param template - The template data to display
|
|
17
|
+
*/
|
|
18
|
+
static displayTemplateDetail(command: SfCommand<unknown>, template: TemplateData): void;
|
|
19
|
+
/**
|
|
20
|
+
* Process templates data for table display
|
|
21
|
+
* This can be expanded with any additional processing needs
|
|
22
|
+
*
|
|
23
|
+
* @param templates - Raw template data
|
|
24
|
+
* @returns Processed template data ready for display
|
|
25
|
+
*/
|
|
26
|
+
static processTemplatesForDisplay(templates: TemplateData[]): TemplateData[];
|
|
27
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025, salesforce.com, inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
export class TemplateDisplayUtil {
|
|
8
|
+
/**
|
|
9
|
+
* Display a list of templates in a table format
|
|
10
|
+
*
|
|
11
|
+
* @param command - The SfCommand instance
|
|
12
|
+
* @param templates - The template data to display
|
|
13
|
+
* @param title - Optional title for the table
|
|
14
|
+
*/
|
|
15
|
+
static displayTemplateList(command, templates, title = 'AppFramework Templates') {
|
|
16
|
+
if (templates.length === 0) {
|
|
17
|
+
command.log('No templates found.');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
command.log('');
|
|
21
|
+
command.styledHeader(`Found ${templates.length} template(s)`);
|
|
22
|
+
const tableData = templates.map((template) => ({
|
|
23
|
+
...template,
|
|
24
|
+
}));
|
|
25
|
+
command.table({
|
|
26
|
+
data: tableData,
|
|
27
|
+
title,
|
|
28
|
+
columns: ['id', 'name', 'label', 'namespace', 'templateSubtype', 'applicationSourceId'],
|
|
29
|
+
sort: {
|
|
30
|
+
label: 'asc',
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
command.log('');
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Display detailed information about a single template
|
|
37
|
+
*
|
|
38
|
+
* @param command - The SfCommand instance
|
|
39
|
+
* @param template - The template data to display
|
|
40
|
+
*/
|
|
41
|
+
static displayTemplateDetail(command, template) {
|
|
42
|
+
command.log('');
|
|
43
|
+
command.styledHeader(`Template Details: ${String(template.label ?? template.name ?? template.id)}`);
|
|
44
|
+
command.log('=== Basic Information');
|
|
45
|
+
command.log(`ID: ${template.id ?? 'n/a'}`);
|
|
46
|
+
command.log(`Name: ${template.name ?? 'n/a'}`);
|
|
47
|
+
command.log(`Label: ${template.label ?? 'n/a'}`);
|
|
48
|
+
command.log(`Description: ${template.description ?? 'n/a'}`);
|
|
49
|
+
command.log(`Type: ${template.templateType ?? 'n/a'}`);
|
|
50
|
+
command.log(`Subtype: ${template.templateSubtype ?? 'n/a'}`);
|
|
51
|
+
command.log(`Namespace: ${template.namespace ?? 'n/a'}`);
|
|
52
|
+
command.log(`Origin App ID: ${template.applicationSourceId ?? 'n/a'}`);
|
|
53
|
+
command.log('');
|
|
54
|
+
command.log('=== Version Information');
|
|
55
|
+
command.log(`Template Version: ${template.templateVersion ?? 'n/a'}`);
|
|
56
|
+
command.log(`Asset Version: ${template.assetVersion ?? 'n/a'}`);
|
|
57
|
+
command.log(`Created: ${template.created ?? 'n/a'}`);
|
|
58
|
+
command.log(`Last Modified: ${template.modified ?? 'n/a'}`);
|
|
59
|
+
command.log('');
|
|
60
|
+
command.log('=== References');
|
|
61
|
+
command.log(`Template ID: ${template.templateId ?? 'n/a'}`);
|
|
62
|
+
command.log(`Folder ID: ${template.folderId ?? 'n/a'}`);
|
|
63
|
+
command.log('');
|
|
64
|
+
command.log('=== Content Details');
|
|
65
|
+
command.log(`Industries: ${template.industries ?? 'n/a'}`);
|
|
66
|
+
command.log(`Target Audience: ${template.audience ?? 'n/a'}`);
|
|
67
|
+
command.log('');
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Process templates data for table display
|
|
71
|
+
* This can be expanded with any additional processing needs
|
|
72
|
+
*
|
|
73
|
+
* @param templates - Raw template data
|
|
74
|
+
* @returns Processed template data ready for display
|
|
75
|
+
*/
|
|
76
|
+
static processTemplatesForDisplay(templates) {
|
|
77
|
+
return templates;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=displayUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"displayUtil.js","sourceRoot":"","sources":["../../../src/utils/display/displayUtil.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,MAAM,OAAO,mBAAmB;IAC9B;;;;;;OAMG;IACI,MAAM,CAAC,mBAAmB,CAC/B,OAA2B,EAC3B,SAAyB,EACzB,KAAK,GAAG,wBAAwB;QAEhC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;YACnC,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AU,IAAI,KAAK,EAAE,CAAC,CAAC;QACjE,OAAO,CAAC,GAAG,CAAC,qBAAqB,QAAQ,CAAC,QAAQ,IAAI,KAAK,EAAE,CAAC,CAAC;QAC/D,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,0BAA0B,CAAC,SAAyB;QAChE,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Connection } from '@salesforce/core';
|
|
2
|
+
type RequestOptions = {
|
|
3
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
4
|
+
url: string;
|
|
5
|
+
body?: unknown;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Make a request to the Salesforce REST API
|
|
9
|
+
*
|
|
10
|
+
* @param connection - Salesforce connection
|
|
11
|
+
* @param options - Request options
|
|
12
|
+
* @returns Response data
|
|
13
|
+
*/
|
|
14
|
+
export declare function request<T>(connection: Connection, options: RequestOptions): Promise<T>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Make a request to the Salesforce REST API
|
|
3
|
+
*
|
|
4
|
+
* @param connection - Salesforce connection
|
|
5
|
+
* @param options - Request options
|
|
6
|
+
* @returns Response data
|
|
7
|
+
*/
|
|
8
|
+
export async function request(connection, options) {
|
|
9
|
+
const { method, url, body } = options;
|
|
10
|
+
const apiPath = `/services/data/v${connection.getApiVersion()}/app-framework${url}`;
|
|
11
|
+
const response = await connection.request({
|
|
12
|
+
method,
|
|
13
|
+
url: apiPath,
|
|
14
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
15
|
+
});
|
|
16
|
+
return response;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/utils/request.ts"],"names":[],"mappings":"AAcA;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAI,UAAsB,EAAE,OAAuB;IAC9E,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IAEtC,MAAM,OAAO,GAAG,mBAAmB,UAAU,CAAC,aAAa,EAAE,iBAAiB,GAAG,EAAE,CAAC;IAEpF,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAI;QAC3C,MAAM;QACN,GAAG,EAAE,OAAO;QACZ,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;KAC9C,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Connection } from '@salesforce/core';
|
|
2
|
+
import { RawTemplate } from './templateTypes.js';
|
|
3
|
+
export default class AppFrameworkTemplate {
|
|
4
|
+
private readonly connection;
|
|
5
|
+
constructor(connection: Connection);
|
|
6
|
+
/**
|
|
7
|
+
* List templates in the org
|
|
8
|
+
*
|
|
9
|
+
* @returns Array of template objects
|
|
10
|
+
*/
|
|
11
|
+
list(): Promise<RawTemplate[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Get a specific template by ID or name
|
|
14
|
+
*
|
|
15
|
+
* @param idOrName - ID or name of the template to retrieve
|
|
16
|
+
* @returns Template object or null if not found
|
|
17
|
+
*/
|
|
18
|
+
getTemplate(idOrName: string): Promise<RawTemplate | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Create a new template
|
|
21
|
+
*
|
|
22
|
+
* @param options - Template creation options
|
|
23
|
+
* @returns The ID of the newly created template
|
|
24
|
+
*/
|
|
25
|
+
create(options: {
|
|
26
|
+
name: string;
|
|
27
|
+
templateType?: string;
|
|
28
|
+
templateSubtype?: string;
|
|
29
|
+
label?: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
maxAppCount?: number;
|
|
32
|
+
tags?: {
|
|
33
|
+
industries?: string[];
|
|
34
|
+
targetAudience?: string[];
|
|
35
|
+
highlights?: string[];
|
|
36
|
+
requirements?: string[];
|
|
37
|
+
includes?: string[];
|
|
38
|
+
categories?: string[];
|
|
39
|
+
};
|
|
40
|
+
releaseInfo?: {
|
|
41
|
+
templateVersion?: string;
|
|
42
|
+
notesFile?: string | null;
|
|
43
|
+
};
|
|
44
|
+
}): Promise<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Update an existing template
|
|
47
|
+
*
|
|
48
|
+
* Note: Only label and description fields can be updated directly.
|
|
49
|
+
* The template's name cannot be updated as it's a unique identifier.
|
|
50
|
+
*
|
|
51
|
+
* @param templateIdOrName - ID or name of the template to update
|
|
52
|
+
* @param options - Optional update options
|
|
53
|
+
* @param options.label - Optional new label for the template
|
|
54
|
+
* @param options.description - Optional new description for the template
|
|
55
|
+
* @returns The updated template data
|
|
56
|
+
*/
|
|
57
|
+
update(templateIdOrName: string, options?: {
|
|
58
|
+
label?: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
}): Promise<RawTemplate>;
|
|
61
|
+
/**
|
|
62
|
+
* Delete a template
|
|
63
|
+
*
|
|
64
|
+
* @param templateId - ID of the template to delete
|
|
65
|
+
*/
|
|
66
|
+
deleteTemplate(templateId: string): Promise<void>;
|
|
67
|
+
}
|