@contentstack/apps-cli 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.
Files changed (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +200 -0
  3. package/bin/dev +17 -0
  4. package/bin/dev.cmd +3 -0
  5. package/bin/run +5 -0
  6. package/bin/run.cmd +3 -0
  7. package/lib/commands/app/base-command.d.ts +51 -0
  8. package/lib/commands/app/base-command.js +123 -0
  9. package/lib/commands/app/create.d.ts +68 -0
  10. package/lib/commands/app/create.js +288 -0
  11. package/lib/commands/app/delete.d.ts +10 -0
  12. package/lib/commands/app/delete.js +72 -0
  13. package/lib/commands/app/get.d.ts +12 -0
  14. package/lib/commands/app/get.js +57 -0
  15. package/lib/commands/app/index.d.ts +7 -0
  16. package/lib/commands/app/index.js +35 -0
  17. package/lib/commands/app/install.d.ts +11 -0
  18. package/lib/commands/app/install.js +77 -0
  19. package/lib/commands/app/uninstall.d.ts +11 -0
  20. package/lib/commands/app/uninstall.js +51 -0
  21. package/lib/commands/app/update.d.ts +34 -0
  22. package/lib/commands/app/update.js +190 -0
  23. package/lib/config/index.d.ts +16 -0
  24. package/lib/config/index.js +20 -0
  25. package/lib/config/manifest.json +69 -0
  26. package/lib/index.d.ts +2 -0
  27. package/lib/index.js +3 -0
  28. package/lib/messages/index.d.ts +83 -0
  29. package/lib/messages/index.js +101 -0
  30. package/lib/types/app.d.ts +101 -0
  31. package/lib/types/app.js +29 -0
  32. package/lib/types/index.d.ts +2 -0
  33. package/lib/types/index.js +5 -0
  34. package/lib/types/utils.d.ts +18 -0
  35. package/lib/types/utils.js +2 -0
  36. package/lib/util/common-utils.d.ts +18 -0
  37. package/lib/util/common-utils.js +148 -0
  38. package/lib/util/fs.d.ts +2 -0
  39. package/lib/util/fs.js +36 -0
  40. package/lib/util/index.d.ts +4 -0
  41. package/lib/util/index.js +9 -0
  42. package/lib/util/inquirer.d.ts +34 -0
  43. package/lib/util/inquirer.js +198 -0
  44. package/lib/util/log.d.ts +41 -0
  45. package/lib/util/log.js +150 -0
  46. package/package.json +99 -0
@@ -0,0 +1,34 @@
1
+ import { BaseCommand } from "./base-command";
2
+ export default class Update extends BaseCommand<typeof Update> {
3
+ private orgUid;
4
+ private manifestPathRetry;
5
+ private manifestData;
6
+ static hidden: boolean;
7
+ static description: string;
8
+ static examples: string[];
9
+ static flags: {
10
+ "app-manifest": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ };
12
+ run(): Promise<void>;
13
+ /**
14
+ * @method validateManifest
15
+ *
16
+ * @return {*} {Promise<void>}
17
+ * @memberof Create
18
+ */
19
+ validateManifest(): Promise<void>;
20
+ /**
21
+ * @method validateAppUidAndVersion
22
+ *
23
+ * @return {*} {Promise<void>}
24
+ * @memberof Create
25
+ */
26
+ validateAppUidAndVersion(): Promise<void>;
27
+ /**
28
+ * @method updateAppOnDeveloperHub
29
+ *
30
+ * @return {*} {Promise<void>}
31
+ * @memberof Create
32
+ */
33
+ updateAppOnDeveloperHub(): Promise<void>;
34
+ }
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const pick_1 = tslib_1.__importDefault(require("lodash/pick"));
5
+ const merge_1 = tslib_1.__importDefault(require("lodash/merge"));
6
+ const isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
7
+ const cli_utilities_1 = require("@contentstack/cli-utilities");
8
+ const fs_1 = require("fs");
9
+ const base_command_1 = require("./base-command");
10
+ const messages_1 = require("../../messages");
11
+ const util_1 = require("../../util");
12
+ class Update extends base_command_1.BaseCommand {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.manifestPathRetry = 0;
16
+ }
17
+ async run() {
18
+ try {
19
+ await this.validateManifest();
20
+ this.orgUid = this.flags.org || this.manifestData.organization_uid;
21
+ this.sharedConfig.org = await (0, util_1.getOrg)({ org: this.orgUid }, {
22
+ log: this.log,
23
+ managementSdk: this.managementSdk,
24
+ });
25
+ await this.validateAppUidAndVersion();
26
+ await this.updateAppOnDeveloperHub();
27
+ }
28
+ catch (error) {
29
+ if ((error === null || error === void 0 ? void 0 : error.errorMessage) || (error === null || error === void 0 ? void 0 : error.message) || !(0, isEmpty_1.default)(error)) {
30
+ this.log((error === null || error === void 0 ? void 0 : error.errorMessage) || (error === null || error === void 0 ? void 0 : error.message) || error, "error");
31
+ }
32
+ this.exit(1);
33
+ }
34
+ }
35
+ /**
36
+ * @method validateManifest
37
+ *
38
+ * @return {*} {Promise<void>}
39
+ * @memberof Create
40
+ */
41
+ async validateManifest() {
42
+ if (!this.flags["app-manifest"]) {
43
+ this.flags["app-manifest"] = (await this.getValPrompt({
44
+ name: "appManifest",
45
+ validate: (val) => {
46
+ if (!val)
47
+ return this.$t(this.messages.NOT_EMPTY, {
48
+ value: "App manifest path",
49
+ });
50
+ return true;
51
+ },
52
+ message: this.$t(this.messages.FILE_PATH, {
53
+ fileName: "app manifest.json",
54
+ }),
55
+ }));
56
+ }
57
+ const manifestPath = this.flags["app-manifest"];
58
+ let hasError = false;
59
+ if ((0, fs_1.existsSync)(manifestPath)) {
60
+ try {
61
+ this.manifestData = JSON.parse((0, fs_1.readFileSync)(manifestPath, {
62
+ encoding: "utf-8",
63
+ }));
64
+ }
65
+ catch (error) {
66
+ hasError = true;
67
+ this.log(error, "error");
68
+ }
69
+ }
70
+ else {
71
+ hasError = true;
72
+ this.$t(this.messages.PATH_NOT_FOUND, {
73
+ path: manifestPath,
74
+ });
75
+ }
76
+ if (hasError) {
77
+ this.manifestPathRetry++;
78
+ if (this.manifestPathRetry < 3) {
79
+ this.flags["app-manifest"] = "";
80
+ await this.validateManifest();
81
+ }
82
+ else {
83
+ this.log(this.messages.MAX_RETRY_LIMIT, "warn");
84
+ throw new Error();
85
+ }
86
+ }
87
+ }
88
+ /**
89
+ * @method validateAppUidAndVersion
90
+ *
91
+ * @return {*} {Promise<void>}
92
+ * @memberof Create
93
+ */
94
+ async validateAppUidAndVersion() {
95
+ var _a;
96
+ let appData;
97
+ if (!this.manifestData.uid) {
98
+ appData = (await (0, util_1.getApp)(this.flags, this.orgUid, {
99
+ managementSdk: this.managementAppSdk,
100
+ log: this.log,
101
+ }));
102
+ this.manifestData.uid = appData.uid;
103
+ }
104
+ else {
105
+ appData = await (0, util_1.fetchApp)({ "app-uid": this.manifestData.uid }, this.orgUid, {
106
+ managementSdk: this.managementAppSdk,
107
+ log: this.log,
108
+ });
109
+ }
110
+ if (appData.uid !== ((_a = this.manifestData) === null || _a === void 0 ? void 0 : _a.uid)) {
111
+ this.log(this.messages.APP_UID_NOT_MATCH, "error");
112
+ this.manifestData.uid = "";
113
+ return await this.validateAppUidAndVersion();
114
+ }
115
+ if ((appData === null || appData === void 0 ? void 0 : appData.version) !== this.manifestData.version) {
116
+ this.log(this.messages.APP_VERSION_MISS_MATCH, "warn");
117
+ throw new Error();
118
+ }
119
+ }
120
+ /**
121
+ * @method updateAppOnDeveloperHub
122
+ *
123
+ * @return {*} {Promise<void>}
124
+ * @memberof Create
125
+ */
126
+ async updateAppOnDeveloperHub() {
127
+ let app = this.managementAppSdk
128
+ .organization(this.orgUid)
129
+ .app(this.manifestData.uid);
130
+ app = Object.assign(app, this.manifestData);
131
+ await app
132
+ .update()
133
+ .then((response) => {
134
+ const validKeys = [
135
+ "uid",
136
+ "name",
137
+ "icon",
138
+ "oauth",
139
+ "version",
140
+ "visibility",
141
+ "created_by",
142
+ "created_at",
143
+ "updated_by",
144
+ "updated_at",
145
+ "target_type",
146
+ "description",
147
+ "ui_location",
148
+ "organization_uid",
149
+ "framework_version",
150
+ ];
151
+ this.manifestData = (0, merge_1.default)(this.manifestData, (0, pick_1.default)(response, validKeys));
152
+ (0, fs_1.writeFileSync)(this.flags["app-manifest"], JSON.stringify(this.manifestData), {
153
+ encoding: "utf8",
154
+ flag: "w",
155
+ });
156
+ this.log(this.messages.APP_UPDATE_SUCCESS, "info");
157
+ })
158
+ .catch((er) => {
159
+ switch (er.status) {
160
+ case 400:
161
+ this.log(this.messages.INVALID_APP_ID, "error");
162
+ break;
163
+ case 403:
164
+ this.log(this.messages.APP_INVALID_ORG, "error");
165
+ break;
166
+ case 409:
167
+ this.log(this.$t(this.messages.DUPLICATE_APP_NAME, {
168
+ appName: this.manifestData.name,
169
+ }), "warn");
170
+ break;
171
+ default:
172
+ this.log(this.messages.APP_UPDATE_FAILED, "warn");
173
+ break;
174
+ }
175
+ throw er;
176
+ });
177
+ }
178
+ }
179
+ Update.hidden = false;
180
+ Update.description = "Update the existing app in developer hub";
181
+ Update.examples = [
182
+ "$ <%= config.bin %> <%= command.id %>",
183
+ "$ <%= config.bin %> <%= command.id %> --app-manifest ./boilerplate/manifest.json",
184
+ ];
185
+ Update.flags = {
186
+ "app-manifest": cli_utilities_1.flags.string({
187
+ description: (0, messages_1.$t)(messages_1.appUpdate.FILE_PATH, { fileName: "app manifest.json" }),
188
+ }),
189
+ };
190
+ exports.default = Update;
@@ -0,0 +1,16 @@
1
+ declare const config: {
2
+ defaultAppName: string;
3
+ manifestPath: string;
4
+ boilerplateName: string;
5
+ developerHubBaseUrl: string;
6
+ developerHubUrls: {
7
+ "https://api.contentstack.io": string;
8
+ "https://eu-api.contentstack.com": string;
9
+ "https://azure-na-api.contentstack.com": string;
10
+ "https://azure-eu-api.contentstack.com": string;
11
+ "https://stag-api.csnonprod.com": string;
12
+ };
13
+ appBoilerplateGithubUrl: string;
14
+ defaultAppFileName: string;
15
+ };
16
+ export default config;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path_1 = require("path");
4
+ const config = {
5
+ defaultAppName: "app-boilerplate",
6
+ manifestPath: (0, path_1.resolve)(__dirname, "manifest.json"),
7
+ boilerplateName: "marketplace-app-boilerplate-1.2.3",
8
+ developerHubBaseUrl: "",
9
+ developerHubUrls: {
10
+ // NOTE CDA url used as developer-hub url mapper to avoid conflict if user used any custom name
11
+ "https://api.contentstack.io": "developerhub-api.contentstack.com",
12
+ "https://eu-api.contentstack.com": "eu-developerhub-api.contentstack.com",
13
+ "https://azure-na-api.contentstack.com": "azure-na-developerhub-api.contentstack.com",
14
+ "https://azure-eu-api.contentstack.com": "azure-eu-developerhub-api.contentstack.com",
15
+ "https://stag-api.csnonprod.com": "stag-developerhub-api.csnonprod.com",
16
+ },
17
+ appBoilerplateGithubUrl: "https://github.com/contentstack/marketplace-app-boilerplate/archive/refs/tags/1.2.3.zip",
18
+ defaultAppFileName: "manifest",
19
+ };
20
+ exports.default = config;
@@ -0,0 +1,69 @@
1
+ {
2
+ "icon": "",
3
+ "description": "",
4
+ "target_type": "stack",
5
+ "name": "",
6
+ "visibility": "private",
7
+ "organization_uid": "",
8
+ "ui_location": {
9
+ "signed": false,
10
+ "base_url": "http://localhost:3000",
11
+ "locations": [
12
+ {
13
+ "type": "cs.cm.stack.custom_field",
14
+ "meta": [
15
+ {
16
+ "path": "/custom-field",
17
+ "signed": true,
18
+ "enabled": true,
19
+ "data_type": "number"
20
+ }
21
+ ]
22
+ },
23
+ {
24
+ "type": "cs.cm.stack.config",
25
+ "meta": [
26
+ {
27
+ "path": "/app-configuration",
28
+ "signed": true,
29
+ "enabled": true
30
+ }
31
+ ]
32
+ },
33
+ {
34
+ "type": "cs.cm.stack.asset_sidebar",
35
+ "meta": [
36
+ {
37
+ "blur": false,
38
+ "path": "/asset-sidebar",
39
+ "signed": true,
40
+ "enabled": true,
41
+ "width": 500
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ "type": "cs.cm.stack.dashboard",
47
+ "meta": [
48
+ {
49
+ "path": "/stack-dashboard",
50
+ "signed": true,
51
+ "enabled": true,
52
+ "default_width": "half"
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ "type": "cs.cm.stack.sidebar",
58
+ "meta": [
59
+ {
60
+ "path": "/entry-sidebar",
61
+ "signed": true,
62
+ "enabled": true
63
+ }
64
+ ]
65
+ }
66
+ ]
67
+ },
68
+ "uid": ""
69
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
package/lib/index.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {};
@@ -0,0 +1,83 @@
1
+ declare const errors: {
2
+ NOT_EMPTY: string;
3
+ INVALID_APP_ID: string;
4
+ ORG_UID_NOT_FOUND: string;
5
+ BASE_URL_EMPTY: string;
6
+ INVALID_ORG_UID: string;
7
+ PATH_NOT_FOUND: string;
8
+ INVALID_NAME: string;
9
+ FILE_GENERATION_FAILURE: string;
10
+ APP_CREATION_FAILURE: string;
11
+ APP_UID_NOT_MATCH: string;
12
+ APP_CREATION_CONSTRAINT_FAILURE: string;
13
+ APP_INVALID_ORG: string;
14
+ DUPLICATE_APP_NAME: string;
15
+ };
16
+ declare const commonMsg: {
17
+ CONFIG: string;
18
+ MAX_RETRY_LIMIT: string;
19
+ PROVIDE_ORG_UID: string;
20
+ CURRENT_WORKING_DIR: string;
21
+ SKIP_CONFIRMATION: string;
22
+ DEVELOPER_HUB_URL_PROMPT: string;
23
+ APP_UID: string;
24
+ APP_TYPE_DESCRIPTION: string;
25
+ CONTACT_SUPPORT: string;
26
+ STACK_API_KEY: string;
27
+ USER_TERMINATION: string;
28
+ };
29
+ declare const appCreate: {
30
+ ORG_UID: string;
31
+ NAME: string;
32
+ UNZIP: string;
33
+ APP_TYPE_DESCRIPTION: string;
34
+ CHOOSE_ORG: string;
35
+ DIR_EXIST: string;
36
+ ROLLBACK_BOILERPLATE: string;
37
+ APP_UPDATE_FAILED: string;
38
+ INSTALL_DEPENDENCIES: string;
39
+ NAME_DESCRIPTION: string;
40
+ APP_CREATION_SUCCESS: string;
41
+ CLONE_BOILERPLATE: string;
42
+ CONFIRM_CLONE_BOILERPLATE: string;
43
+ REGISTER_THE_APP_ON_DEVELOPER_HUB: string;
44
+ START_APP_COMMAND: string;
45
+ };
46
+ declare const getApp: {
47
+ CHOOSE_APP: string;
48
+ APP_UID_NOT_FOUND: string;
49
+ FILE_WRITTEN_SUCCESS: string;
50
+ APPS_NOT_FOUND: string;
51
+ FILE_ALREADY_EXISTS: string;
52
+ };
53
+ declare const appUpdate: {
54
+ APP_UID: string;
55
+ FILE_PATH: string;
56
+ APP_UPDATE_SUCCESS: string;
57
+ APP_VERSION_MISS_MATCH: string;
58
+ };
59
+ declare const deleteAppMsg: {
60
+ APP_IS_INSTALLED: string;
61
+ APP_DELETED_SUCCESSFULLY: string;
62
+ APP_UID_INVALID: string;
63
+ PLEASE_SELECT_APP_FROM_LIST: string;
64
+ DELETE_CONFIRMATION: string;
65
+ };
66
+ declare const installAppMsg: {
67
+ CHOOSE_A_STACK: string;
68
+ APP_INSTALLED_SUCCESSFULLY: string;
69
+ INSTALL_ORG_APP_TO_STACK: string;
70
+ MISSING_STACK_API_KEY: string;
71
+ INSTALLING_APP_NOTICE: string;
72
+ };
73
+ declare const uninstallAppMsg: {
74
+ CHOOSE_AN_INSTALLATION: string;
75
+ INSTALLATION_UID: string;
76
+ NO_INSTALLATIONS_FOUND: string;
77
+ APP_UNINSTALLED: string;
78
+ UNINSTALLING_APP: string;
79
+ };
80
+ declare const messages: typeof errors & typeof commonMsg & typeof appCreate & typeof appUpdate & typeof getApp & typeof deleteAppMsg & typeof installAppMsg & typeof uninstallAppMsg;
81
+ declare const $t: (msg: string, args: Record<string, string>) => string;
82
+ export default messages;
83
+ export { $t, errors, commonMsg, appCreate, appUpdate, getApp, deleteAppMsg, installAppMsg, uninstallAppMsg };
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uninstallAppMsg = exports.installAppMsg = exports.deleteAppMsg = exports.getApp = exports.appUpdate = exports.appCreate = exports.commonMsg = exports.errors = exports.$t = void 0;
4
+ const errors = {
5
+ NOT_EMPTY: "{value} cannot be empty.",
6
+ INVALID_APP_ID: "Please enter a valid app UID.",
7
+ ORG_UID_NOT_FOUND: "Organization UID not found. Please enter a valid organization UID.",
8
+ BASE_URL_EMPTY: "Developer Hub URL cannot be empty.",
9
+ INVALID_ORG_UID: "Please enter a valid organization UID.",
10
+ PATH_NOT_FOUND: "Failed to locate the provided path '{path}'. Please enter a valid path.",
11
+ INVALID_NAME: "Please enter a valid name that is {min} to {max} characters long.",
12
+ FILE_GENERATION_FAILURE: "Failed to generate the file! Please try running the command again.",
13
+ APP_CREATION_FAILURE: "App could not be registered on Developer Hub.",
14
+ APP_UID_NOT_MATCH: "Provided app UID is not matching with the app manifest.json app UID",
15
+ APP_CREATION_CONSTRAINT_FAILURE: "App could not be registered. Please go through the constraints on the app name and try running the command again.",
16
+ APP_INVALID_ORG: "App could not be registered. Please verify the inputs and try again.",
17
+ DUPLICATE_APP_NAME: "The {appName} app already exists. Please create an app with a different name.",
18
+ };
19
+ exports.errors = errors;
20
+ const commonMsg = {
21
+ CONFIG: "Path of the external config",
22
+ MAX_RETRY_LIMIT: "Maximum retry limit reached.",
23
+ PROVIDE_ORG_UID: "Provide the organization UID",
24
+ CURRENT_WORKING_DIR: "Current working directory.",
25
+ SKIP_CONFIRMATION: "Use this flag to skip the confirmation.",
26
+ DEVELOPER_HUB_URL_PROMPT: "Enter the Developer Hub Base URL for the {name} region: ",
27
+ APP_UID: "Provide the app UID",
28
+ APP_TYPE_DESCRIPTION: "Type of App",
29
+ CONTACT_SUPPORT: "Please contact the support team.",
30
+ STACK_API_KEY: "API key of the stack where the app is to be installed.",
31
+ USER_TERMINATION: "Process terminated by the user."
32
+ };
33
+ exports.commonMsg = commonMsg;
34
+ const appCreate = {
35
+ ORG_UID: "Organization UID",
36
+ NAME: "{target} name",
37
+ UNZIP: "Unzipping the boilerplate...",
38
+ APP_TYPE_DESCRIPTION: "Type of App",
39
+ CHOOSE_ORG: "Choose an organization",
40
+ DIR_EXIST: "Directory name already exists.",
41
+ ROLLBACK_BOILERPLATE: "Rolling back boilerplate...",
42
+ APP_UPDATE_FAILED: "App update process failed!",
43
+ INSTALL_DEPENDENCIES: "Installing dependencies...",
44
+ NAME_DESCRIPTION: "Name of the app to be created",
45
+ APP_CREATION_SUCCESS: "App created successfully!",
46
+ CLONE_BOILERPLATE: "Fetching the app template from GitHub...",
47
+ CONFIRM_CLONE_BOILERPLATE: "Would you like to fetch the app template from GitHub?",
48
+ REGISTER_THE_APP_ON_DEVELOPER_HUB: "Registering the app with the name {appName} on the Developer Hub...",
49
+ START_APP_COMMAND: "Start the app using the following command: {command}",
50
+ };
51
+ exports.appCreate = appCreate;
52
+ const getApp = {
53
+ CHOOSE_APP: "Choose an app",
54
+ APP_UID_NOT_FOUND: "App UID was not found!",
55
+ FILE_WRITTEN_SUCCESS: "App data has been written to {file} successfully.",
56
+ APPS_NOT_FOUND: "No apps found!",
57
+ FILE_ALREADY_EXISTS: "{file} already exists. Do you want to overwrite this file? (y/n) (Selecting 'n' creates a new file)",
58
+ };
59
+ exports.getApp = getApp;
60
+ const appUpdate = {
61
+ APP_UID: "Provide the app UID",
62
+ FILE_PATH: "Path to the {fileName} file:",
63
+ APP_UPDATE_SUCCESS: "App updated successfully!",
64
+ APP_VERSION_MISS_MATCH: "App versions mismatch! Please download the latest file using the `csdx app:get` command and sync the file with the latest downloaded file.",
65
+ };
66
+ exports.appUpdate = appUpdate;
67
+ const deleteAppMsg = {
68
+ APP_IS_INSTALLED: "This app is installed in one of your stacks. Please uninstall the app from your stack to proceed with the delete operation.",
69
+ APP_DELETED_SUCCESSFULLY: "{app} deleted successfully.",
70
+ APP_UID_INVALID: "App UID must be valid.",
71
+ PLEASE_SELECT_APP_FROM_LIST: "Please select an app from the list",
72
+ DELETE_CONFIRMATION: "Are you sure you want to delete this app?"
73
+ };
74
+ exports.deleteAppMsg = deleteAppMsg;
75
+ const installAppMsg = {
76
+ CHOOSE_A_STACK: "Please select a stack",
77
+ APP_INSTALLED_SUCCESSFULLY: "{app} installed successfully in {target}.",
78
+ INSTALL_ORG_APP_TO_STACK: "{app} is an organization app. It cannot be installed to a stack. Do you want to proceed?",
79
+ MISSING_STACK_API_KEY: "As {app} is a stack app, it can only be installed in a stack. Please select a stack.",
80
+ INSTALLING_APP_NOTICE: "Installing {app} on {type} {target}."
81
+ };
82
+ exports.installAppMsg = installAppMsg;
83
+ const uninstallAppMsg = {
84
+ CHOOSE_AN_INSTALLATION: "Please select the stack from where the app must be uninstalled",
85
+ INSTALLATION_UID: "Provide the installation ID of the app that needs to be uninstalled.",
86
+ NO_INSTALLATIONS_FOUND: "Cannot find any installations for this app.",
87
+ APP_UNINSTALLED: "{app} uninstalled successfully.",
88
+ UNINSTALLING_APP: "Uninstalling app from {type}..."
89
+ };
90
+ exports.uninstallAppMsg = uninstallAppMsg;
91
+ const messages = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, errors), commonMsg), appCreate), appUpdate), getApp), deleteAppMsg), installAppMsg), uninstallAppMsg);
92
+ const $t = (msg, args) => {
93
+ if (!msg)
94
+ return "";
95
+ for (const key of Object.keys(args)) {
96
+ msg = msg.replace(new RegExp(`{${key}}`, 'g'), args[key]);
97
+ }
98
+ return msg;
99
+ };
100
+ exports.$t = $t;
101
+ exports.default = messages;
@@ -0,0 +1,101 @@
1
+ export interface TokenConfiguration {
2
+ enabled?: boolean;
3
+ scopes?: string[];
4
+ }
5
+ export interface UserTokenConfiguration extends TokenConfiguration {
6
+ allow_pkce?: boolean;
7
+ }
8
+ export interface OAuthConfiguration {
9
+ client_id?: string;
10
+ client_secret?: string;
11
+ redirect_uri?: string;
12
+ user_token_config?: UserTokenConfiguration;
13
+ app_token_config?: TokenConfiguration;
14
+ }
15
+ export declare enum AppLocation {
16
+ STACK_CONFIG = "cs.cm.stack.config",
17
+ DASHBOARD = "cs.cm.stack.dashboard",
18
+ SIDEBAR = "cs.cm.stack.sidebar",
19
+ CUSTOM_FIELD = "cs.cm.stack.custom_field",
20
+ RTE = "cs.cm.stack.rte",
21
+ ASSET_SIDEBAR = "cs.cm.stack.asset_sidebar",
22
+ ORG_CONFIG = "cs.org.config"
23
+ }
24
+ export declare enum ExtensionWidth {
25
+ FULL = "full",
26
+ HALF = "half"
27
+ }
28
+ export interface ExtensionMeta {
29
+ uid?: string;
30
+ name?: string;
31
+ description?: string;
32
+ path?: string;
33
+ signed: boolean;
34
+ extension_uid?: string;
35
+ data_type?: string;
36
+ enabled?: boolean;
37
+ width?: number;
38
+ blur?: boolean;
39
+ default_width?: ExtensionWidth;
40
+ }
41
+ export interface Extension {
42
+ type: AppLocation;
43
+ meta: ExtensionMeta[];
44
+ }
45
+ export interface LocationConfiguration {
46
+ signed: boolean;
47
+ base_url: string;
48
+ locations: Extension[];
49
+ }
50
+ export interface CustomHeader {
51
+ value: string;
52
+ header_name: string;
53
+ }
54
+ export interface WebhookConfiguration {
55
+ name?: string;
56
+ signed: boolean;
57
+ enabled: boolean;
58
+ target_url: string;
59
+ channels: string[];
60
+ http_basic_auth?: string;
61
+ http_basic_password?: string;
62
+ custom_headers?: CustomHeader[];
63
+ concise_payload?: boolean;
64
+ retry_policy?: string;
65
+ }
66
+ export interface User {
67
+ uid: string;
68
+ first_name?: string;
69
+ last_name?: string;
70
+ }
71
+ export declare enum AppType {
72
+ STACK = "stack",
73
+ ORGANIZATION = "organization"
74
+ }
75
+ export declare enum VisibilityType {
76
+ PRIVATE = "private",
77
+ PUBLIC = "public",
78
+ PUBLIC_UNLISTED = "public_unlisted"
79
+ }
80
+ export interface AppManifest {
81
+ uid: string;
82
+ framework_version?: string;
83
+ version?: number;
84
+ name: string;
85
+ icon?: string;
86
+ target_type: AppType;
87
+ description: string;
88
+ visibility: VisibilityType;
89
+ webhook?: WebhookConfiguration;
90
+ ui_location: LocationConfiguration;
91
+ created_by?: User;
92
+ created_at?: Date;
93
+ updated_by?: User;
94
+ updated_at?: Date;
95
+ organization_uid: string;
96
+ oauth?: OAuthConfiguration;
97
+ hosting?: any;
98
+ }
99
+ export interface AppManifestWithUiLocation extends AppManifest {
100
+ ui_location: LocationConfiguration;
101
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VisibilityType = exports.AppType = exports.ExtensionWidth = exports.AppLocation = void 0;
4
+ var AppLocation;
5
+ (function (AppLocation) {
6
+ AppLocation["STACK_CONFIG"] = "cs.cm.stack.config";
7
+ AppLocation["DASHBOARD"] = "cs.cm.stack.dashboard";
8
+ AppLocation["SIDEBAR"] = "cs.cm.stack.sidebar";
9
+ AppLocation["CUSTOM_FIELD"] = "cs.cm.stack.custom_field";
10
+ AppLocation["RTE"] = "cs.cm.stack.rte";
11
+ AppLocation["ASSET_SIDEBAR"] = "cs.cm.stack.asset_sidebar";
12
+ AppLocation["ORG_CONFIG"] = "cs.org.config";
13
+ })(AppLocation || (exports.AppLocation = AppLocation = {}));
14
+ var ExtensionWidth;
15
+ (function (ExtensionWidth) {
16
+ ExtensionWidth["FULL"] = "full";
17
+ ExtensionWidth["HALF"] = "half";
18
+ })(ExtensionWidth || (exports.ExtensionWidth = ExtensionWidth = {}));
19
+ var AppType;
20
+ (function (AppType) {
21
+ AppType["STACK"] = "stack";
22
+ AppType["ORGANIZATION"] = "organization";
23
+ })(AppType || (exports.AppType = AppType = {}));
24
+ var VisibilityType;
25
+ (function (VisibilityType) {
26
+ VisibilityType["PRIVATE"] = "private";
27
+ VisibilityType["PUBLIC"] = "public";
28
+ VisibilityType["PUBLIC_UNLISTED"] = "public_unlisted";
29
+ })(VisibilityType || (exports.VisibilityType = VisibilityType = {}));
@@ -0,0 +1,2 @@
1
+ export * from "./app";
2
+ export * from "./utils";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./app"), exports);
5
+ tslib_1.__exportStar(require("./utils"), exports);