@contrail/cli 3.0.6 → 3.1.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/README.md CHANGED
@@ -17,7 +17,7 @@ $ npm install -g @contrail/cli
17
17
  $ contrail COMMAND
18
18
  running command...
19
19
  $ contrail (--version)
20
- @contrail/cli/3.0.6 darwin-x64 node-v20.19.1
20
+ @contrail/cli/3.1.0 darwin-arm64 node-v20.18.0
21
21
  $ contrail --help [COMMAND]
22
22
  USAGE
23
23
  $ contrail COMMAND
@@ -34,6 +34,8 @@ To get instructions on how to set up autocomplete for your shell, run `contrail
34
34
  <!-- commands -->
35
35
  * [`contrail app create`](#contrail-app-create)
36
36
  * [`contrail app delete`](#contrail-app-delete)
37
+ * [`contrail app extension deploy`](#contrail-app-extension-deploy)
38
+ * [`contrail app extension deployment list`](#contrail-app-extension-deployment-list)
37
39
  * [`contrail app getApiKey`](#contrail-app-getapikey)
38
40
  * [`contrail app init`](#contrail-app-init)
39
41
  * [`contrail app install`](#contrail-app-install)
@@ -59,15 +61,6 @@ To get instructions on how to set up autocomplete for your shell, run `contrail
59
61
  * [`contrail load custom-entity DATAFILE CONFIGFILE`](#contrail-load-custom-entity-datafile-configfile)
60
62
  * [`contrail load line-sheet DATAFILE CONFIGFILE`](#contrail-load-line-sheet-datafile-configfile)
61
63
  * [`contrail load upload-and-load INCOMINGFILE CONFIGFILENAME`](#contrail-load-upload-and-load-incomingfile-configfilename)
62
- * [`contrail plugins`](#contrail-plugins)
63
- * [`contrail plugins:install PLUGIN...`](#contrail-pluginsinstall-plugin)
64
- * [`contrail plugins:inspect PLUGIN...`](#contrail-pluginsinspect-plugin)
65
- * [`contrail plugins:install PLUGIN...`](#contrail-pluginsinstall-plugin-1)
66
- * [`contrail plugins:link PLUGIN`](#contrail-pluginslink-plugin)
67
- * [`contrail plugins:uninstall PLUGIN...`](#contrail-pluginsuninstall-plugin)
68
- * [`contrail plugins:uninstall PLUGIN...`](#contrail-pluginsuninstall-plugin-1)
69
- * [`contrail plugins:uninstall PLUGIN...`](#contrail-pluginsuninstall-plugin-2)
70
- * [`contrail plugins update`](#contrail-plugins-update)
71
64
  * [`contrail projects export PROJECTNAME`](#contrail-projects-export-projectname)
72
65
  * [`contrail projects list`](#contrail-projects-list)
73
66
  * [`contrail projects load TEMPLATEFILELOCATION`](#contrail-projects-load-templatefilelocation)
@@ -108,7 +101,7 @@ To get instructions on how to set up autocomplete for your shell, run `contrail
108
101
 
109
102
  ## `contrail app create`
110
103
 
111
- Create an app from a template
104
+ Create a new app. The current organization will be set as the owner of the app
112
105
 
113
106
  ```
114
107
  USAGE
@@ -121,7 +114,7 @@ FLAGS
121
114
  <options: error|warn|info|debug>
122
115
 
123
116
  DESCRIPTION
124
- Create an app from a template
117
+ Create a new app. The current organization will be set as the owner of the app
125
118
 
126
119
  EXAMPLES
127
120
  $ contrail app create
@@ -148,9 +141,54 @@ EXAMPLES
148
141
  $ contrail app delete
149
142
  ```
150
143
 
144
+ ## `contrail app extension deploy`
145
+
146
+ Deploy an extension from the extensions directory to a VibeIQ managed URL.
147
+
148
+ ```
149
+ USAGE
150
+ $ contrail app extension deploy -i <value> [-l error|warn|info|debug] [-e true|false]
151
+
152
+ FLAGS
153
+ -e, --alwaysConfirmEnv=<option> [default: true] The Environment variables
154
+ <options: true|false>
155
+ -i, --identifier=<value> (required) The extension identifier to deploy. The identifier of the extension is the
156
+ "identifier" property in the extension defined in the app.yml
157
+ -l, --logLevel=<option> The Log Level
158
+ <options: error|warn|info|debug>
159
+
160
+ DESCRIPTION
161
+ Deploy an extension from the extensions directory to a VibeIQ managed URL.
162
+
163
+ EXAMPLES
164
+ $ contrail extension deploy --identifier <extensionIdentifier>
165
+ ```
166
+
167
+ ## `contrail app extension deployment list`
168
+
169
+ List extension deployments
170
+
171
+ ```
172
+ USAGE
173
+ $ contrail app extension deployment list [-l error|warn|info|debug] [-e true|false] [-a]
174
+
175
+ FLAGS
176
+ -a, --all List all extension deployments. By default, only the latest 20 are shown
177
+ -e, --alwaysConfirmEnv=<option> [default: true] The Environment variables
178
+ <options: true|false>
179
+ -l, --logLevel=<option> The Log Level
180
+ <options: error|warn|info|debug>
181
+
182
+ DESCRIPTION
183
+ List extension deployments
184
+
185
+ EXAMPLES
186
+ $ contrail extension deployment list
187
+ ```
188
+
151
189
  ## `contrail app getApiKey`
152
190
 
153
- Get an api key for an app
191
+ Get an api key for an installed app
154
192
 
155
193
  ```
156
194
  USAGE
@@ -164,7 +202,7 @@ FLAGS
164
202
  <options: error|warn|info|debug>
165
203
 
166
204
  DESCRIPTION
167
- Get an api key for an app
205
+ Get an api key for an installed app
168
206
 
169
207
  EXAMPLES
170
208
  $ contrail app getApiKey
@@ -193,7 +231,7 @@ EXAMPLES
193
231
 
194
232
  ## `contrail app install`
195
233
 
196
- Install an app from the marketplace
234
+ Install an app from the marketplace to a specific organization
197
235
 
198
236
  ```
199
237
  USAGE
@@ -208,7 +246,7 @@ FLAGS
208
246
  -w, --installWorkflowTemplates "Install the app's accompanying workflows"
209
247
 
210
248
  DESCRIPTION
211
- Install an app from the marketplace
249
+ Install an app from the marketplace to a specific organization
212
250
 
213
251
  EXAMPLES
214
252
  $ contrail app install --appIdentifier @VibeIQ/Flex-PLM-Connector
@@ -216,7 +254,7 @@ EXAMPLES
216
254
 
217
255
  ## `contrail app publish`
218
256
 
219
- Publish the app
257
+ Publish the app to the marketplace. This visibility of your app depends on the app.yml configuration ("visibility" property)
220
258
 
221
259
  ```
222
260
  USAGE
@@ -233,7 +271,8 @@ FLAGS
233
271
  -v, --verbose Debug the app deployment step and do not remove the intermediate build artifacts.
234
272
 
235
273
  DESCRIPTION
236
- Publish the app
274
+ Publish the app to the marketplace. This visibility of your app depends on the app.yml configuration ("visibility"
275
+ property)
237
276
 
238
277
  EXAMPLES
239
278
  $ contrail app publish
@@ -241,7 +280,7 @@ EXAMPLES
241
280
 
242
281
  ## `contrail app uninstall`
243
282
 
244
- Uninstall an app that is currently installed
283
+ Uninstall an app that is currently installed in a specific organization
245
284
 
246
285
  ```
247
286
  USAGE
@@ -256,7 +295,7 @@ FLAGS
256
295
  <options: error|warn|info|debug>
257
296
 
258
297
  DESCRIPTION
259
- Uninstall an app that is currently installed
298
+ Uninstall an app that is currently installed in a specific organization
260
299
 
261
300
  EXAMPLES
262
301
  $ contrail app uninstall --name @vibeiq/flexplm-connector
@@ -264,7 +303,7 @@ EXAMPLES
264
303
 
265
304
  ## `contrail app upgrade`
266
305
 
267
- Upgrade an installed app
306
+ Upgrade an installed app in a specific organization
268
307
 
269
308
  ```
270
309
  USAGE
@@ -279,7 +318,7 @@ FLAGS
279
318
  <options: error|warn|info|debug>
280
319
 
281
320
  DESCRIPTION
282
- Upgrade an installed app
321
+ Upgrade an installed app in a specific organization
283
322
 
284
323
  EXAMPLES
285
324
  $ contrail app upgrade --appIdentifier @VibeIQ/Flex-PLM-Connector --latest
@@ -401,7 +440,7 @@ EXAMPLES
401
440
 
402
441
  ## `contrail config describe [NAME]`
403
442
 
404
- Describe a configuration file
443
+ Display the contents of a configuration file
405
444
 
406
445
  ```
407
446
  USAGE
@@ -417,7 +456,7 @@ FLAGS
417
456
  <options: error|warn|info|debug>
418
457
 
419
458
  DESCRIPTION
420
- Describe a configuration file
459
+ Display the contents of a configuration file
421
460
 
422
461
  EXAMPLES
423
462
  $ contrail config describe demo-org
@@ -737,249 +776,6 @@ EXAMPLES
737
776
  $ contrail load-processor upload-and-load <File Path> <Config Path>
738
777
  ```
739
778
 
740
- ## `contrail plugins`
741
-
742
- List installed plugins.
743
-
744
- ```
745
- USAGE
746
- $ contrail plugins [--core]
747
-
748
- FLAGS
749
- --core Show core plugins.
750
-
751
- DESCRIPTION
752
- List installed plugins.
753
-
754
- EXAMPLES
755
- $ contrail plugins
756
- ```
757
-
758
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v2.3.2/src/commands/plugins/index.ts)_
759
-
760
- ## `contrail plugins:install PLUGIN...`
761
-
762
- Installs a plugin into the CLI.
763
-
764
- ```
765
- USAGE
766
- $ contrail plugins:install PLUGIN...
767
-
768
- ARGUMENTS
769
- PLUGIN Plugin to install.
770
-
771
- FLAGS
772
- -f, --force Run yarn install with force flag.
773
- -h, --help Show CLI help.
774
- -v, --verbose
775
-
776
- DESCRIPTION
777
- Installs a plugin into the CLI.
778
- Can be installed from npm or a git url.
779
-
780
- Installation of a user-installed plugin will override a core plugin.
781
-
782
- e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
783
- will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
784
- the CLI without the need to patch and update the whole CLI.
785
-
786
-
787
- ALIASES
788
- $ contrail plugins add
789
-
790
- EXAMPLES
791
- $ contrail plugins:install myplugin
792
-
793
- $ contrail plugins:install https://github.com/someuser/someplugin
794
-
795
- $ contrail plugins:install someuser/someplugin
796
- ```
797
-
798
- ## `contrail plugins:inspect PLUGIN...`
799
-
800
- Displays installation properties of a plugin.
801
-
802
- ```
803
- USAGE
804
- $ contrail plugins:inspect PLUGIN...
805
-
806
- ARGUMENTS
807
- PLUGIN [default: .] Plugin to inspect.
808
-
809
- FLAGS
810
- -h, --help Show CLI help.
811
- -v, --verbose
812
-
813
- GLOBAL FLAGS
814
- --json Format output as json.
815
-
816
- DESCRIPTION
817
- Displays installation properties of a plugin.
818
-
819
- EXAMPLES
820
- $ contrail plugins:inspect myplugin
821
- ```
822
-
823
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v2.3.2/src/commands/plugins/inspect.ts)_
824
-
825
- ## `contrail plugins:install PLUGIN...`
826
-
827
- Installs a plugin into the CLI.
828
-
829
- ```
830
- USAGE
831
- $ contrail plugins:install PLUGIN...
832
-
833
- ARGUMENTS
834
- PLUGIN Plugin to install.
835
-
836
- FLAGS
837
- -f, --force Run yarn install with force flag.
838
- -h, --help Show CLI help.
839
- -v, --verbose
840
-
841
- DESCRIPTION
842
- Installs a plugin into the CLI.
843
- Can be installed from npm or a git url.
844
-
845
- Installation of a user-installed plugin will override a core plugin.
846
-
847
- e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
848
- will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
849
- the CLI without the need to patch and update the whole CLI.
850
-
851
-
852
- ALIASES
853
- $ contrail plugins add
854
-
855
- EXAMPLES
856
- $ contrail plugins:install myplugin
857
-
858
- $ contrail plugins:install https://github.com/someuser/someplugin
859
-
860
- $ contrail plugins:install someuser/someplugin
861
- ```
862
-
863
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v2.3.2/src/commands/plugins/install.ts)_
864
-
865
- ## `contrail plugins:link PLUGIN`
866
-
867
- Links a plugin into the CLI for development.
868
-
869
- ```
870
- USAGE
871
- $ contrail plugins:link PLUGIN
872
-
873
- ARGUMENTS
874
- PATH [default: .] path to plugin
875
-
876
- FLAGS
877
- -h, --help Show CLI help.
878
- -v, --verbose
879
-
880
- DESCRIPTION
881
- Links a plugin into the CLI for development.
882
- Installation of a linked plugin will override a user-installed or core plugin.
883
-
884
- e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
885
- command will override the user-installed or core plugin implementation. This is useful for development work.
886
-
887
-
888
- EXAMPLES
889
- $ contrail plugins:link myplugin
890
- ```
891
-
892
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v2.3.2/src/commands/plugins/link.ts)_
893
-
894
- ## `contrail plugins:uninstall PLUGIN...`
895
-
896
- Removes a plugin from the CLI.
897
-
898
- ```
899
- USAGE
900
- $ contrail plugins:uninstall PLUGIN...
901
-
902
- ARGUMENTS
903
- PLUGIN plugin to uninstall
904
-
905
- FLAGS
906
- -h, --help Show CLI help.
907
- -v, --verbose
908
-
909
- DESCRIPTION
910
- Removes a plugin from the CLI.
911
-
912
- ALIASES
913
- $ contrail plugins unlink
914
- $ contrail plugins remove
915
- ```
916
-
917
- ## `contrail plugins:uninstall PLUGIN...`
918
-
919
- Removes a plugin from the CLI.
920
-
921
- ```
922
- USAGE
923
- $ contrail plugins:uninstall PLUGIN...
924
-
925
- ARGUMENTS
926
- PLUGIN plugin to uninstall
927
-
928
- FLAGS
929
- -h, --help Show CLI help.
930
- -v, --verbose
931
-
932
- DESCRIPTION
933
- Removes a plugin from the CLI.
934
-
935
- ALIASES
936
- $ contrail plugins unlink
937
- $ contrail plugins remove
938
- ```
939
-
940
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v2.3.2/src/commands/plugins/uninstall.ts)_
941
-
942
- ## `contrail plugins:uninstall PLUGIN...`
943
-
944
- Removes a plugin from the CLI.
945
-
946
- ```
947
- USAGE
948
- $ contrail plugins:uninstall PLUGIN...
949
-
950
- ARGUMENTS
951
- PLUGIN plugin to uninstall
952
-
953
- FLAGS
954
- -h, --help Show CLI help.
955
- -v, --verbose
956
-
957
- DESCRIPTION
958
- Removes a plugin from the CLI.
959
-
960
- ALIASES
961
- $ contrail plugins unlink
962
- $ contrail plugins remove
963
- ```
964
-
965
- ## `contrail plugins update`
966
-
967
- Update installed plugins.
968
-
969
- ```
970
- USAGE
971
- $ contrail plugins update [-h] [-v]
972
-
973
- FLAGS
974
- -h, --help Show CLI help.
975
- -v, --verbose
976
-
977
- DESCRIPTION
978
- Update installed plugins.
979
- ```
980
-
981
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v2.3.2/src/commands/plugins/update.ts)_
982
-
983
779
  ## `contrail projects export PROJECTNAME`
984
780
 
985
781
  Export a project.
@@ -0,0 +1,2 @@
1
+ import { AppExtensionDeployment } from '../interfaces';
2
+ export declare function getAppExtensionDeployment(deploymentId: string): Promise<AppExtensionDeployment>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAppExtensionDeployment = void 0;
4
+ const sdk_1 = require("@contrail/sdk");
5
+ async function getAppExtensionDeployment(deploymentId) {
6
+ return await new sdk_1.Entities().get({
7
+ entityName: 'app-extension-deployment',
8
+ id: deploymentId,
9
+ });
10
+ }
11
+ exports.getAppExtensionDeployment = getAppExtensionDeployment;
@@ -0,0 +1,2 @@
1
+ import { AppExtensionPackage } from '../interfaces';
2
+ export declare function getAppExtensionPackage(packageId: string): Promise<AppExtensionPackage>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAppExtensionPackage = void 0;
4
+ const sdk_1 = require("@contrail/sdk");
5
+ async function getAppExtensionPackage(packageId) {
6
+ return await new sdk_1.Entities().get({
7
+ entityName: 'app-extension-package',
8
+ id: packageId,
9
+ });
10
+ }
11
+ exports.getAppExtensionPackage = getAppExtensionPackage;
@@ -1,5 +1,4 @@
1
1
  export declare function getOptionSets(): Promise<any[]>;
2
- export declare function getUserLists(): Promise<any[]>;
3
2
  export declare function getOptionSetHierarchies(): Promise<any[]>;
4
3
  export declare function getOptionSetHierarchyLinks(): Promise<any[]>;
5
4
  export declare function getRuleSets(): Promise<any[]>;
package/dist/api/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTypePolicyLinks = exports.getTypePolicies = exports.getTypePropertyPolicyLinks = exports.getTypePropertyPolicies = exports.getUsageInfo = exports.getRuleSetLinks = exports.getRuleSets = exports.getOptionSetHierarchyLinks = exports.getOptionSetHierarchies = exports.getUserLists = exports.getOptionSets = void 0;
3
+ exports.getTypePolicyLinks = exports.getTypePolicies = exports.getTypePropertyPolicyLinks = exports.getTypePropertyPolicies = exports.getUsageInfo = exports.getRuleSetLinks = exports.getRuleSets = exports.getOptionSetHierarchyLinks = exports.getOptionSetHierarchies = exports.getOptionSets = void 0;
4
4
  const sdk_1 = require("@contrail/sdk");
5
5
  async function getOptionSets() {
6
6
  return await new sdk_1.Entities().get({
@@ -8,12 +8,6 @@ async function getOptionSets() {
8
8
  });
9
9
  }
10
10
  exports.getOptionSets = getOptionSets;
11
- async function getUserLists() {
12
- return await new sdk_1.Entities().get({
13
- entityName: 'user-list',
14
- });
15
- }
16
- exports.getUserLists = getUserLists;
17
11
  async function getOptionSetHierarchies() {
18
12
  const entitiesClient = new sdk_1.Entities();
19
13
  return await entitiesClient.get({
@@ -7,10 +7,8 @@ const login_1 = require("../../auth/login");
7
7
  const basecommand_1 = require("../../basecommand");
8
8
  const setup_template_1 = require("../../helpers/app/setup-template");
9
9
  const logger_1 = tslib_1.__importDefault(require("../../logger"));
10
- const app_deployer_1 = require("../../helpers/app/app-deployer");
11
- const load_app_config_1 = require("../../helpers/app/load-app-config");
12
10
  class CreateApp extends basecommand_1.BaseCommand {
13
- static description = 'Create an app from a template';
11
+ static description = 'Create a new app. The current organization will be set as the owner of the app';
14
12
  static examples = [
15
13
  `$ contrail app create
16
14
  `,
@@ -82,14 +80,6 @@ class CreateApp extends basecommand_1.BaseCommand {
82
80
  appDescription: answers.appDescription,
83
81
  appPublisher: answers.appPublisher,
84
82
  });
85
- try {
86
- let appDeclaration = (0, load_app_config_1.loadAppConfig)();
87
- await new app_deployer_1.AppDeployer().deploy(appDeclaration);
88
- }
89
- catch (error) {
90
- logger_1.default.error(`Failed to deploy the app: ${error}`);
91
- this.exit(1);
92
- }
93
83
  }
94
84
  }
95
85
  exports.default = CreateApp;
@@ -0,0 +1,17 @@
1
+ import { BaseCommand } from '../../../basecommand';
2
+ export default class DeployExtension extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ identifier: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
+ alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
+ logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ };
10
+ run(): Promise<void>;
11
+ private pollUntilPackageIsReady;
12
+ private pollUntilDeploymentIsReady;
13
+ private getAppDeclaration;
14
+ private getExistingApp;
15
+ private validateExtensionDeclaration;
16
+ private getExtensionDirectory;
17
+ }
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const core_1 = require("@oclif/core");
5
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
+ const fs = tslib_1.__importStar(require("fs"));
7
+ const path = tslib_1.__importStar(require("path"));
8
+ const app_extension_deployments_1 = require("../../../api/app-extension-deployments");
9
+ const app_extension_packages_1 = require("../../../api/app-extension-packages");
10
+ const apps_1 = require("../../../api/apps");
11
+ const login_1 = require("../../../auth/login");
12
+ const basecommand_1 = require("../../../basecommand");
13
+ const extension_package_1 = require("../../../helpers/app/extension-package");
14
+ const load_app_config_1 = require("../../../helpers/app/load-app-config");
15
+ const interfaces_1 = require("../../../interfaces");
16
+ const logger_1 = tslib_1.__importDefault(require("../../../logger"));
17
+ class DeployExtension extends basecommand_1.BaseCommand {
18
+ static description = 'Deploy an extension from the extensions directory to a VibeIQ managed URL.';
19
+ static examples = [`$ contrail extension deploy --identifier <extensionIdentifier>`];
20
+ static flags = {
21
+ ...basecommand_1.BaseCommand.baseFlags,
22
+ identifier: core_1.Flags.string({
23
+ char: 'i',
24
+ description: 'The extension identifier to deploy. The identifier of the extension is the "identifier" property in the extension defined in the app.yml',
25
+ required: true,
26
+ }),
27
+ };
28
+ async run() {
29
+ await (0, login_1.authUser)();
30
+ try {
31
+ const extensionIdentifier = this.flags.identifier;
32
+ // 1. Validate manifest and extension existence
33
+ const appDeclaration = this.getAppDeclaration();
34
+ const app = await this.getExistingApp(appDeclaration);
35
+ await this.validateExtensionDeclaration(appDeclaration, extensionIdentifier);
36
+ const extensionDir = this.getExtensionDirectory(extensionIdentifier);
37
+ // 2. Package and upload extension
38
+ const createdPackage = await (0, extension_package_1.createExtensionPackage)(app.id, extensionDir);
39
+ // 3. Poll until package is ready (timeout after 1 minute)
40
+ const readyPackage = await this.pollUntilPackageIsReady(createdPackage);
41
+ logger_1.default.info("Extension package is ready...Checking for extension deployment");
42
+ logger_1.default.debug(JSON.stringify(readyPackage, null, 2));
43
+ const deployment = await this.pollUntilDeploymentIsReady(readyPackage.deploymentId);
44
+ logger_1.default.info(`${chalk_1.default.green.bold('SUCCESS')} Extension package is ready.`);
45
+ logger_1.default.info(`${chalk_1.default.green.bold('SUCCESS')} Please note that it may take a few minutes for the extension to be available if it is the first time you are deploying it.`);
46
+ logger_1.default.info(`${chalk_1.default.green.bold('SUCCESS')} Extension deployment URL: ${deployment.cloudFrontUrl}/packages/${readyPackage.id}/index.html`);
47
+ }
48
+ catch (error) {
49
+ logger_1.default.info(`${chalk_1.default.red.bold('FAIL')} Extension Deployment Failed. ${error}`);
50
+ }
51
+ }
52
+ async pollUntilPackageIsReady(createdPackage) {
53
+ let currentPackage = createdPackage;
54
+ const startTime = Date.now();
55
+ const timeoutMs = 120000; // 2 minutes
56
+ while (currentPackage.status !== interfaces_1.AppExtensionPackageStatus.READY) {
57
+ if (Date.now() - startTime > timeoutMs) {
58
+ throw new Error('Timed out waiting for package to be ready');
59
+ }
60
+ await new Promise((resolve) => setTimeout(resolve, 2000));
61
+ currentPackage = await (0, app_extension_packages_1.getAppExtensionPackage)(currentPackage.id);
62
+ logger_1.default.info(`Package status: ${currentPackage.status}`);
63
+ if (currentPackage.status === interfaces_1.AppExtensionPackageStatus.FAILED) {
64
+ throw new Error('Package failed to build');
65
+ }
66
+ }
67
+ return currentPackage;
68
+ }
69
+ async pollUntilDeploymentIsReady(deploymentId) {
70
+ let currentDeployment = await (0, app_extension_deployments_1.getAppExtensionDeployment)(deploymentId);
71
+ const startTime = Date.now();
72
+ const timeoutMs = 60000; // 1 minute
73
+ while (currentDeployment.status !== interfaces_1.AppExtensionDeploymentStatus.DEPLOYED) {
74
+ if (Date.now() - startTime > timeoutMs) {
75
+ throw new Error('Timed out waiting for deployment to be ready');
76
+ }
77
+ await new Promise((resolve) => setTimeout(resolve, 2000));
78
+ currentDeployment = await (0, app_extension_deployments_1.getAppExtensionDeployment)(currentDeployment.id);
79
+ logger_1.default.info(`Deployment status: ${currentDeployment.status}`);
80
+ if (currentDeployment.status === interfaces_1.AppExtensionDeploymentStatus.FAILED) {
81
+ throw new Error('Deployment failed');
82
+ }
83
+ }
84
+ return currentDeployment;
85
+ }
86
+ getAppDeclaration() {
87
+ return (0, load_app_config_1.loadAppConfig)();
88
+ }
89
+ async getExistingApp(appDeclaration) {
90
+ const apps = await (0, apps_1.getAvailableApps)();
91
+ const foundApp = apps.find((app) => app.identifier === appDeclaration.appIdentifier);
92
+ if (!foundApp) {
93
+ throw new Error(`App ${appDeclaration.appIdentifier} not found. Extensions can only be deployed for existing apps.`);
94
+ }
95
+ return foundApp;
96
+ }
97
+ async validateExtensionDeclaration(appDeclaration, extensionIdentifier) {
98
+ const extensions = appDeclaration.extensions;
99
+ if (!Array.isArray(extensions) || extensions.length === 0) {
100
+ throw new Error('No extensions defined in app.yml.');
101
+ }
102
+ const extensionDecl = extensions.find((ext) => ext.identifier === extensionIdentifier);
103
+ if (!extensionDecl) {
104
+ logger_1.default.info(`${chalk_1.default.red.bold('FAIL')} Extension '${extensionIdentifier}' not found in app.yml.`);
105
+ return null;
106
+ }
107
+ return extensionDecl;
108
+ }
109
+ getExtensionDirectory(extensionIdentifier) {
110
+ const extensionDir = path.resolve(process.cwd(), 'extensions', extensionIdentifier);
111
+ if (!fs.existsSync(extensionDir)) {
112
+ logger_1.default.info(`${chalk_1.default.red.bold('FAIL')} Extension directory '${extensionDir}' does not exist.`);
113
+ return null;
114
+ }
115
+ return extensionDir;
116
+ }
117
+ }
118
+ exports.default = DeployExtension;
@@ -0,0 +1,14 @@
1
+ import { BaseCommand } from '../../../../basecommand';
2
+ import { AppExtensionPackage } from '../../../../interfaces';
3
+ export default class ListExtensionDeployments extends BaseCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ all: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ };
11
+ run(): Promise<void>;
12
+ getLatest20ExtensionPackages(appId: string): Promise<AppExtensionPackage[]>;
13
+ getAllExtensionPackages(appId: string): Promise<AppExtensionPackage[]>;
14
+ }