@forge/cli 10.13.3 → 10.13.4-next.1-experimental-19bd64d

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/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # @forge/cli
2
2
 
3
+ ## 10.13.4-next.1-experimental-19bd64d
4
+
5
+ ### Minor Changes
6
+
7
+ - c5efb5f: Added command for app versions details
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [c5efb5f]
12
+ - Updated dependencies [19c93e7]
13
+ - Updated dependencies [1815689]
14
+ - Updated dependencies [a808a56]
15
+ - @forge/cli-shared@6.5.2-next.1-experimental-19bd64d
16
+ - @forge/manifest@8.4.1-next.1-experimental-19bd64d
17
+ - @forge/bundler@4.20.5-next.1-experimental-19bd64d
18
+ - @forge/lint@5.6.5-next.1-experimental-19bd64d
19
+ - @forge/tunnel@5.8.1-next.1-experimental-19bd64d
20
+
21
+ ## 10.13.4-next.1
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [1815689]
26
+ - Updated dependencies [a808a56]
27
+ - @forge/manifest@8.4.1-next.1
28
+ - @forge/cli-shared@6.5.2-next.1
29
+ - @forge/bundler@4.20.5-next.1
30
+ - @forge/lint@5.6.5-next.1
31
+ - @forge/tunnel@5.8.1-next.1
32
+
33
+ ## 10.13.4-next.0
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [19c93e7]
38
+ - @forge/manifest@8.4.1-next.0
39
+ - @forge/bundler@4.20.5-next.0
40
+ - @forge/cli-shared@6.5.2-next.0
41
+ - @forge/lint@5.6.5-next.0
42
+ - @forge/tunnel@5.8.1-next.0
43
+
3
44
  ## 10.13.3
4
45
 
5
46
  ### Patch Changes
@@ -1,24 +1,25 @@
1
1
  {
2
2
  "name": "@forge/cli",
3
- "version": "10.13.3",
3
+ "version": "10.13.4-next.1-experimental-19bd64d",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@forge/cli",
9
- "version": "10.13.3",
9
+ "version": "10.13.4-next.1-experimental-19bd64d",
10
10
  "hasInstallScript": true,
11
11
  "license": "UNLICENSED",
12
12
  "dependencies": {
13
- "@forge/bundler": "4.20.4",
14
- "@forge/cli-shared": "6.5.1",
13
+ "@forge/bundler": "4.20.5-next.1-experimental-19bd64d",
14
+ "@forge/cli-shared": "6.5.2-next.1-experimental-19bd64d",
15
15
  "@forge/egress": "1.3.0",
16
16
  "@forge/i18n": "0.0.2",
17
- "@forge/lint": "5.6.4",
18
- "@forge/manifest": "8.4.0",
17
+ "@forge/lint": "5.6.5-next.1-experimental-19bd64d",
18
+ "@forge/manifest": "8.4.1-next.1-experimental-19bd64d",
19
19
  "@forge/runtime": "5.10.4",
20
- "@forge/tunnel": "5.8.0",
20
+ "@forge/tunnel": "5.8.1-next.1-experimental-19bd64d",
21
21
  "@forge/util": "1.4.6",
22
+ "@sandfox/arn": "^2.1.0",
22
23
  "@sentry/node": "7.106.0",
23
24
  "ajv": "^8.12.0",
24
25
  "archiver": "^6.0.2",
@@ -31,6 +32,7 @@
31
32
  "cross-spawn": "^7.0.3",
32
33
  "dayjs": "^1.11.10",
33
34
  "didyoumean": "^1.2.2",
35
+ "diff": "^7.0.0",
34
36
  "env-paths": "^2.2.1",
35
37
  "exponential-backoff": "^3.1.1",
36
38
  "form-data": "^4.0.0",
@@ -58,6 +60,7 @@
58
60
  "@types/command-exists": "^1.2.3",
59
61
  "@types/cross-spawn": "^6.0.6",
60
62
  "@types/didyoumean": "^1.2.2",
63
+ "@types/diff": "^6.0.0",
61
64
  "@types/fs-extra": "^11.0.4",
62
65
  "@types/hidefile": "^3.0.3",
63
66
  "@types/inquirer": "^8.2.10",
@@ -837,9 +840,9 @@
837
840
  "license": "UNLICENSED"
838
841
  },
839
842
  "node_modules/@forge/bundler": {
840
- "version": "4.20.4",
841
- "resolved": "https://registry.npmjs.org/@forge/bundler/-/bundler-4.20.4.tgz",
842
- "integrity": "sha512-4V6RiER6rRo5sXPBRLaQglY9WOqs2QcaMCxG/CzUwmxYdR3rr39A8cI8G6/EWNqSBotgK3/otdrztzgXqYiF4w==",
843
+ "version": "4.20.5-next.1-experimental-19bd64d",
844
+ "resolved": "https://registry.npmjs.org/@forge/bundler/-/bundler-4.20.5-next.1-experimental-19bd64d.tgz",
845
+ "integrity": "sha512-xn4GQKDvmE63El5CKQ59BGo6596mbN9vDurBv2EATdWD9wD9KlB2p4z1k8Xenm2E4cC/aNoU1rOCszZTaGPCLA==",
843
846
  "license": "UNLICENSED",
844
847
  "dependencies": {
845
848
  "@babel/core": "^7.24.0",
@@ -851,10 +854,10 @@
851
854
  "@babel/preset-typescript": "^7.23.3",
852
855
  "@forge/api": "4.2.0",
853
856
  "@forge/babel-plugin-transform-ui": "1.1.19",
854
- "@forge/cli-shared": "6.5.1",
857
+ "@forge/cli-shared": "6.5.2-next.1-experimental-19bd64d",
855
858
  "@forge/i18n": "0.0.2",
856
- "@forge/lint": "5.6.4",
857
- "@forge/manifest": "8.4.0",
859
+ "@forge/lint": "5.6.5-next.1-experimental-19bd64d",
860
+ "@forge/manifest": "8.4.1-next.1-experimental-19bd64d",
858
861
  "@forge/util": "1.4.6",
859
862
  "assert": "^2.1.0",
860
863
  "babel-loader": "^8.3.0",
@@ -913,13 +916,13 @@
913
916
  "license": "UNLICENSED"
914
917
  },
915
918
  "node_modules/@forge/cli-shared": {
916
- "version": "6.5.1",
917
- "resolved": "https://registry.npmjs.org/@forge/cli-shared/-/cli-shared-6.5.1.tgz",
918
- "integrity": "sha512-2wFz4UDSr8DooV1qQXx7I5OpmxdZcto0bro3eGmT6ODHBBOB3QqCat9v82LOZRluFWcwkMrDYd8tZIErBh38WA==",
919
+ "version": "6.5.2-next.1-experimental-19bd64d",
920
+ "resolved": "https://registry.npmjs.org/@forge/cli-shared/-/cli-shared-6.5.2-next.1-experimental-19bd64d.tgz",
921
+ "integrity": "sha512-krz4PUBjtxE/L3P0E8jvqhc3TshqHY72v2HbQMGSxKS6HFsieZktr35Q0oxaZnMuLbKax3Jb770lNJNowHPcqw==",
919
922
  "license": "UNLICENSED",
920
923
  "dependencies": {
921
924
  "@forge/i18n": "0.0.2",
922
- "@forge/manifest": "8.4.0",
925
+ "@forge/manifest": "8.4.1-next.1-experimental-19bd64d",
923
926
  "@forge/util": "1.4.6",
924
927
  "@sentry/node": "7.106.0",
925
928
  "adm-zip": "^0.5.10",
@@ -953,9 +956,9 @@
953
956
  }
954
957
  },
955
958
  "node_modules/@forge/csp": {
956
- "version": "3.6.0",
957
- "resolved": "https://registry.npmjs.org/@forge/csp/-/csp-3.6.0.tgz",
958
- "integrity": "sha512-F+9wL0VoB9X65J2SWwpDbWr1RHBmL/M47Fk9swQNzRk1h6+MbTnnraPJeTo3VfoxcC2AlmkVRYMYDmc1hbNSnw==",
959
+ "version": "3.6.0-experimental-19bd64d",
960
+ "resolved": "https://registry.npmjs.org/@forge/csp/-/csp-3.6.0-experimental-19bd64d.tgz",
961
+ "integrity": "sha512-eJvMbaqUr35rfmciyOYpJhqDtqYUkimsYdgI+ME13WZXMrQLyibCdh2AALFYC1v0xwOif0G+EgCgoWQfZpw34A==",
959
962
  "license": "UNLICENSED",
960
963
  "dependencies": {
961
964
  "cheerio": "^0.22.0",
@@ -981,14 +984,14 @@
981
984
  }
982
985
  },
983
986
  "node_modules/@forge/lint": {
984
- "version": "5.6.4",
985
- "resolved": "https://registry.npmjs.org/@forge/lint/-/lint-5.6.4.tgz",
986
- "integrity": "sha512-fOaB1q8r6OubcWK2gSeQOIurPO58HCHQ1RDJaZdgTjpdtkBg+7p3fvnZb+9taOB/tZSmtKqBVx/GIlDPiVOPZw==",
987
+ "version": "5.6.5-next.1-experimental-19bd64d",
988
+ "resolved": "https://registry.npmjs.org/@forge/lint/-/lint-5.6.5-next.1-experimental-19bd64d.tgz",
989
+ "integrity": "sha512-ttOrL0ChBXVoAwOiK9pvECIHPJbMrf6c1OhTGEXFlWdz8jUEu0ygDUSrzM/WMuUdLG9Ew33Jeh3z+tWKTTFkyA==",
987
990
  "license": "UNLICENSED",
988
991
  "dependencies": {
989
- "@forge/cli-shared": "6.5.1",
992
+ "@forge/cli-shared": "6.5.2-next.1-experimental-19bd64d",
990
993
  "@forge/egress": "1.3.0",
991
- "@forge/manifest": "8.4.0",
994
+ "@forge/manifest": "8.4.1-next.1-experimental-19bd64d",
992
995
  "@typescript-eslint/typescript-estree": "^5.62.0",
993
996
  "array.prototype.flatmap": "^1.3.2",
994
997
  "atlassian-openapi": "^1.0.18",
@@ -997,9 +1000,9 @@
997
1000
  }
998
1001
  },
999
1002
  "node_modules/@forge/manifest": {
1000
- "version": "8.4.0",
1001
- "resolved": "https://registry.npmjs.org/@forge/manifest/-/manifest-8.4.0.tgz",
1002
- "integrity": "sha512-DCGG/8o788q9ouIy5haOlLSmeFDW+t5w/3ldQ2kGtn+5bbk1eoYOgpCag6GuaxFHSgg7dOPc2FEz+6KyFJjJ/g==",
1003
+ "version": "8.4.1-next.1-experimental-19bd64d",
1004
+ "resolved": "https://registry.npmjs.org/@forge/manifest/-/manifest-8.4.1-next.1-experimental-19bd64d.tgz",
1005
+ "integrity": "sha512-5/PyJQkhFpZakyHIiZSQ0QgqZbPgtPtjJzyABCLOuyBAAy4eLf47ISLmQofrHqQM0p8pPz9054H4TwrQ/MsHYA==",
1003
1006
  "license": "UNLICENSED",
1004
1007
  "dependencies": {
1005
1008
  "@forge/i18n": "0.0.2",
@@ -1030,14 +1033,14 @@
1030
1033
  }
1031
1034
  },
1032
1035
  "node_modules/@forge/tunnel": {
1033
- "version": "5.8.0",
1034
- "resolved": "https://registry.npmjs.org/@forge/tunnel/-/tunnel-5.8.0.tgz",
1035
- "integrity": "sha512-6YJJzBJ0VD5f/PQ9wdC3M0uxTgYwUcb3cnYjv/yZQpHSYVUZGS8WhXmN2Nciyr4npbuV45aaCNrcUZ4EF+u9kg==",
1036
+ "version": "5.8.1-next.1-experimental-19bd64d",
1037
+ "resolved": "https://registry.npmjs.org/@forge/tunnel/-/tunnel-5.8.1-next.1-experimental-19bd64d.tgz",
1038
+ "integrity": "sha512-/mq0hPP789yhCEgymhUyhGDV1pgZ1Os4Pp7A/4XdGx1qr6ffJO8DlGpKlDGiq6yP75kJxaFEmu/hzcYK+eHQMw==",
1036
1039
  "license": "UNLICENSED",
1037
1040
  "dependencies": {
1038
- "@forge/bundler": "4.20.4",
1039
- "@forge/cli-shared": "6.5.1",
1040
- "@forge/csp": "3.6.0",
1041
+ "@forge/bundler": "4.20.5-next.1-experimental-19bd64d",
1042
+ "@forge/cli-shared": "6.5.2-next.1-experimental-19bd64d",
1043
+ "@forge/csp": "3.6.0-experimental-19bd64d",
1041
1044
  "@forge/runtime": "5.10.4",
1042
1045
  "chokidar": "^3.6.0",
1043
1046
  "cloudflared": "^0.5.2",
@@ -1282,6 +1285,11 @@
1282
1285
  "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.21.tgz",
1283
1286
  "integrity": "sha1-XeWiOFo1MJQn9gEZkrVEUU1VmqE= sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g=="
1284
1287
  },
1288
+ "node_modules/@sandfox/arn": {
1289
+ "version": "2.1.0",
1290
+ "resolved": "https://registry.npmjs.org/@sandfox/arn/-/arn-2.1.0.tgz",
1291
+ "integrity": "sha1-v+MIFn/vKZcFUHqkCxcxLIckcPI= sha512-KUW6t0yJ4YZ6RBoB+8/ypVhDI+ZAvrLtZxQC+1i0yD2SvWe4RXboLXB4wcmsjw+g+gMBeyYu9sQj4NTx787+FA=="
1292
+ },
1285
1293
  "node_modules/@scarf/scarf": {
1286
1294
  "version": "1.3.0",
1287
1295
  "resolved": "https://registry.npmjs.org/@scarf/scarf/-/scarf-1.3.0.tgz",
@@ -3612,6 +3620,14 @@
3612
3620
  "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
3613
3621
  "integrity": "sha1-mJNG/+noObRVXs9WZu3qDT6K0Dc= sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw=="
3614
3622
  },
3623
+ "node_modules/diff": {
3624
+ "version": "7.0.0",
3625
+ "resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz",
3626
+ "integrity": "sha1-P7NNOHzXbYA/buvqZ7kh2rAYKpo= sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==",
3627
+ "engines": {
3628
+ "node": ">=0.3.1"
3629
+ }
3630
+ },
3615
3631
  "node_modules/diffie-hellman": {
3616
3632
  "version": "5.0.3",
3617
3633
  "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
@@ -258,6 +258,14 @@
258
258
  "--help": {
259
259
  "requireUserArg": false
260
260
  }
261
+ },
262
+ "version": {
263
+ "--verbose": {
264
+ "requireUserArg": false
265
+ },
266
+ "--help": {
267
+ "requireUserArg": false
268
+ }
261
269
  }
262
270
  },
263
271
  "options": {
@@ -0,0 +1,36 @@
1
+ import { VersionView } from '../view/version-view';
2
+ import { VersionService } from '../../service/version-service';
3
+ interface AppVersionOptions {
4
+ environment: string;
5
+ majorVersion?: number;
6
+ json?: boolean;
7
+ outFile?: string;
8
+ nonInteractive?: boolean;
9
+ }
10
+ interface AppVersionDiffOptions {
11
+ environment: string;
12
+ version1: number;
13
+ version2: number;
14
+ outFile?: string;
15
+ }
16
+ interface AppVersionListOptions {
17
+ environment: string;
18
+ json?: boolean;
19
+ outFile?: string;
20
+ nonInteractive?: boolean;
21
+ }
22
+ export declare class VersionController {
23
+ private readonly versionService;
24
+ private readonly view;
25
+ constructor(versionService: VersionService, view: VersionView);
26
+ getAppVersionDiff({ environment, version1, version2, outFile }: AppVersionDiffOptions): Promise<void>;
27
+ getAppVersionDetails({ environment, majorVersion, json, outFile, nonInteractive }: AppVersionOptions): Promise<void>;
28
+ private writeToFile;
29
+ private displayInJson;
30
+ private displayDetailsInTable;
31
+ private displayDiffInText;
32
+ private writeDiffToFile;
33
+ getVersionList({ environment, json, outFile, nonInteractive }: AppVersionListOptions): Promise<void>;
34
+ }
35
+ export {};
36
+ //# sourceMappingURL=version-controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/version-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAkB,MAAM,+BAA+B,CAAC;AAI/E,UAAU,iBAAiB;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,UAAU,qBAAqB;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,qBAAqB;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,qBAAa,iBAAiB;IAE1B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADJ,cAAc,EAAE,cAAc,EAC9B,IAAI,EAAE,WAAW;IAGvB,iBAAiB,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAyBrG,oBAAoB,CAAC,EAChC,WAAW,EACX,YAAY,EACZ,IAAY,EACZ,OAAO,EACP,cAAc,EACf,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgCpC,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,qBAAqB;IAK7B,OAAO,CAAC,iBAAiB;IA4BzB,OAAO,CAAC,eAAe;IAWV,cAAc,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;CAgBlH"}
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VersionController = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fs_1 = require("fs");
6
+ const diff = tslib_1.__importStar(require("diff"));
7
+ class VersionController {
8
+ versionService;
9
+ view;
10
+ constructor(versionService, view) {
11
+ this.versionService = versionService;
12
+ this.view = view;
13
+ }
14
+ async getAppVersionDiff({ environment, version1, version2, outFile }) {
15
+ const [version1Details, version2Details] = await this.view.displayDiffProgress(() => Promise.all([
16
+ this.versionService.getAppVersionDetails(environment, version1),
17
+ this.versionService.getAppVersionDetails(environment, version2)
18
+ ]));
19
+ const omitRegions = (versionDetails) => {
20
+ return {
21
+ ...versionDetails,
22
+ functions: versionDetails.functions?.map((f) => {
23
+ const { regions, ...rest } = f;
24
+ return rest;
25
+ })
26
+ };
27
+ };
28
+ if (outFile) {
29
+ this.writeDiffToFile(omitRegions(version1Details), omitRegions(version2Details), outFile);
30
+ }
31
+ else {
32
+ this.displayDiffInText(omitRegions(version1Details), omitRegions(version2Details), environment);
33
+ }
34
+ }
35
+ async getAppVersionDetails({ environment, majorVersion, json = false, outFile, nonInteractive }) {
36
+ const defaultProperties = ['appVersion', 'deploymentDateTime', 'environmentType'];
37
+ let filteredProperties = [];
38
+ if (!nonInteractive) {
39
+ filteredProperties = await this.view.promptVersionDetailsProperties();
40
+ }
41
+ const request = this.versionService.getAppVersionDetails(environment, majorVersion);
42
+ const versionDetails = nonInteractive ? await request : await this.view.displayDetailsProgress(() => request);
43
+ if (filteredProperties.length === 0) {
44
+ filteredProperties = Object.keys(versionDetails);
45
+ }
46
+ const filteredVersionDetails = Object.keys(versionDetails)
47
+ .filter((key) => [...filteredProperties, ...defaultProperties].includes(key))
48
+ .reduce((obj, key) => {
49
+ obj[key] = versionDetails[key];
50
+ return obj;
51
+ }, {});
52
+ if (outFile) {
53
+ this.writeToFile(filteredVersionDetails, outFile);
54
+ }
55
+ else if (json) {
56
+ this.displayInJson(filteredVersionDetails);
57
+ }
58
+ else {
59
+ this.displayDetailsInTable(filteredVersionDetails, environment);
60
+ }
61
+ }
62
+ writeToFile(data, outFile) {
63
+ this.view.displayWriteToFile(outFile);
64
+ (0, fs_1.writeFileSync)(outFile, JSON.stringify(data, null, 2));
65
+ }
66
+ displayInJson(data) {
67
+ this.view.displayDataInJson(data);
68
+ }
69
+ displayDetailsInTable(details, environment) {
70
+ this.view.displayVersionDetailsBanner(details.appVersion, environment, details.environmentType);
71
+ this.view.displayDetailsAsTable(details);
72
+ }
73
+ displayDiffInText(version1, version2, environment) {
74
+ this.view.displayDiffBanner(version1.appVersion, version2.appVersion, environment, version1.environmentType);
75
+ this.view.displayDiffAsTable({ v1: version1.appVersion, v2: version2.appVersion }, [
76
+ {
77
+ key: 'scopes',
78
+ diff: diff.diffJson(version1.scopes, version2.scopes)
79
+ },
80
+ {
81
+ key: 'deployment date',
82
+ diff: diff.diffJson(version1.deploymentDateTime, version2.deploymentDateTime)
83
+ },
84
+ {
85
+ key: 'egress',
86
+ diff: diff.diffJson(version1.egresses, version2.egresses)
87
+ },
88
+ { key: 'policies', diff: diff.diffJson(version1.policies || [], version2.policies || []) },
89
+ { key: 'connect keys', diff: diff.diffJson(version1.connectKeys || [], version2.connectKeys || []) },
90
+ {
91
+ key: 'functions',
92
+ diff: diff.diffJson(version1.functions || [], version2.functions || [])
93
+ },
94
+ { key: 'modules', diff: diff.diffJson(version1.modules || [], version2.modules || []) },
95
+ { key: 'remotes', diff: diff.diffJson(version1.remotes || [], version2.remotes || []) },
96
+ { key: 'license', diff: diff.diffJson('' + version1.requiresLicense, '' + version2.requiresLicense) }
97
+ ]);
98
+ }
99
+ writeDiffToFile(version1, version2, outFile) {
100
+ this.view.displayWriteToFile(outFile);
101
+ const patch = diff.createTwoFilesPatch(`${version1.appVersion}`, `${version2.appVersion}`, JSON.stringify(version1, null, 2), JSON.stringify(version2, null, 2));
102
+ (0, fs_1.writeFileSync)(outFile, patch);
103
+ }
104
+ async getVersionList({ environment, json, outFile, nonInteractive }) {
105
+ const request = this.versionService.getAppVersionOverviewList(environment);
106
+ const versionList = nonInteractive || json ? await request : await this.view.displayListProgress(() => request);
107
+ if (!nonInteractive && !json) {
108
+ this.view.displayListBanner(versionList.length, environment, versionList[0].environmentType);
109
+ }
110
+ if (outFile) {
111
+ this.writeToFile(versionList, outFile);
112
+ }
113
+ else if (json) {
114
+ this.displayInJson(versionList);
115
+ }
116
+ else {
117
+ this.view.displayVersionList(versionList);
118
+ }
119
+ }
120
+ }
121
+ exports.VersionController = VersionController;
@@ -29,6 +29,7 @@ import { StubController } from './controller/stubController';
29
29
  import { PrerequisitesController } from './controller/prerequisites-controller';
30
30
  import { DefaultEnvironmentController } from './controller/default-environment-controller';
31
31
  import { EligibilityController } from './controller/eligibility-controller';
32
+ import { VersionController } from './controller/version-controller';
32
33
  export declare const getDependencies: (cliDetails: CLIDetails | undefined) => Promise<{
33
34
  ui: CommandLineUI;
34
35
  cmd: Command<[], import("./command").DefaultOpts>;
@@ -79,6 +80,7 @@ export declare const getDependencies: (cliDetails: CLIDetails | undefined) => Pr
79
80
  stubController: StubController;
80
81
  prerequisitesController: PrerequisitesController;
81
82
  defaultEnvironmentController: DefaultEnvironmentController;
83
+ versionController: VersionController;
82
84
  };
83
85
  }>;
84
86
  declare type PromiseType<T> = T extends Promise<infer R> ? R : never;
@@ -1 +1 @@
1
- {"version":3,"file":"dependency-injection.d.ts","sourceRoot":"","sources":["../../src/command-line/dependency-injection.ts"],"names":[],"mappings":"AAIA,OAAO,EASL,UAAU,EACV,aAAa,EAEb,UAAU,EAGV,gBAAgB,EAGhB,kBAAkB,EAGlB,gBAAgB,EAQhB,YAAY,EACZ,aAAa,EAOb,kBAAkB,EAIlB,kBAAkB,EAElB,kBAAkB,EAKnB,MAAM,mBAAmB,CAAC;AAc3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,OAAO,EAML,0BAA0B,EAG3B,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,gCAAgC,EAAE,MAAM,sDAAsD,CAAC;AAExG,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AAIlG,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAG3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAEtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAM7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAIrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAQtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAI3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAG3E,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,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OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAUlE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAGhF,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAG3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAKpE,eAAO,MAAM,eAAe,eAAsB,UAAU,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyXvE,CAAC;AAGF,aAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAC7D,oBAAY,YAAY,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC"}
@@ -69,6 +69,10 @@ const graphql_client_8 = require("../eligibility/graphql-client");
69
69
  const roa_service_1 = require("../service/roa-service");
70
70
  const eligibility_controller_1 = require("./controller/eligibility-controller");
71
71
  const eligibility_view_1 = require("./view/eligibility-view");
72
+ const version_controller_1 = require("./controller/version-controller");
73
+ const version_service_1 = require("../service/version-service");
74
+ const version_view_1 = require("./view/version-view");
75
+ const graphql_client_9 = require("../version/graphql-client");
72
76
  const getDependencies = async (cliDetails) => {
73
77
  let cmd;
74
78
  const ui = new cli_shared_1.CommandLineUI(() => cmd.verbose);
@@ -164,6 +168,7 @@ const getDependencies = async (cliDetails) => {
164
168
  const installController = new install_controller_1.InstallController(assertiveAppConfigReader, configFile, ui, installAppSiteCommand, installationsService, installView, statsigService);
165
169
  const feedbackController = new feedback_controller_1.FeedbackController(credentialStore, feedbackPostClient);
166
170
  const eligibilityController = new eligibility_controller_1.EligibilityController(new roa_service_1.RoaService(assertiveAppConfigReader, new graphql_client_8.RoaEligibilityClient(graphQLClient)), new eligibility_view_1.EligibilityView(ui));
171
+ const versionController = new version_controller_1.VersionController(new version_service_1.VersionService(assertiveAppConfigReader, new graphql_client_9.AppVersionDetailsClient(graphQLClient)), new version_view_1.VersionView(ui));
167
172
  const lintService = new lint_service_1.LintService(configFile, fileReader);
168
173
  const lintView = new lint_view_1.LintView(ui);
169
174
  const lintController = new lint_controller_1.LintController(lintService, lintView);
@@ -242,7 +247,8 @@ const getDependencies = async (cliDetails) => {
242
247
  settingsController,
243
248
  stubController,
244
249
  prerequisitesController,
245
- defaultEnvironmentController
250
+ defaultEnvironmentController,
251
+ versionController
246
252
  }
247
253
  };
248
254
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command-line/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAoBvE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,QAiBlD;AAQD,eAAO,MAAM,IAAI,QAAa,QAAQ,IAAI,CAUzC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command-line/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAqBvE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,QAkBlD;AAQD,eAAO,MAAM,IAAI,QAAa,QAAQ,IAAI,CAUzC,CAAC"}
@@ -20,6 +20,7 @@ const register_providers_commands_1 = require("./register-providers-commands");
20
20
  const register_environments_commands_1 = require("./register-environments-commands");
21
21
  const register_storage_commands_1 = require("./register-storage-commands");
22
22
  const register_eligibility_commands_1 = require("./register-eligibility-commands");
23
+ const register_version_commands_1 = require("./register-version-commands");
23
24
  function registerCommands(deps) {
24
25
  (0, register_autocomplete_commands_1.registerCommands)(deps);
25
26
  (0, register_authentication_command_1.registerCommands)(deps);
@@ -37,6 +38,7 @@ function registerCommands(deps) {
37
38
  (0, register_providers_commands_1.registerCommands)(deps);
38
39
  (0, register_storage_commands_1.registerCommands)(deps);
39
40
  (0, register_eligibility_commands_1.registerCommands)(deps);
41
+ (0, register_version_commands_1.registerCommands)(deps);
40
42
  }
41
43
  exports.registerCommands = registerCommands;
42
44
  const registerEvents = ({ ui }) => {
@@ -0,0 +1,4 @@
1
+ import { Dependencies } from './dependency-injection';
2
+ export declare function parseMajorVersion(majorVersionStr: string, property?: string): number;
3
+ export declare const registerCommands: (deps: Dependencies) => void;
4
+ //# sourceMappingURL=register-version-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-version-commands.d.ts","sourceRoot":"","sources":["../../src/command-line/register-version-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAItD,wBAAgB,iBAAiB,CAAC,eAAe,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAKpF;AA2DD,eAAO,MAAM,gBAAgB,SAAU,YAAY,SAMlD,CAAC"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerCommands = exports.parseMajorVersion = void 0;
4
+ const cli_shared_1 = require("@forge/cli-shared");
5
+ function parseMajorVersion(majorVersionStr, property) {
6
+ if (!/^\d+$/.test(majorVersionStr)) {
7
+ throw new cli_shared_1.ValidationError(cli_shared_1.Text.version.check.error.invalidMajorVersion(property));
8
+ }
9
+ return parseInt(majorVersionStr, 10);
10
+ }
11
+ exports.parseMajorVersion = parseMajorVersion;
12
+ const registerDetailsCommands = (parent, { controllers: { versionController } }) => {
13
+ parent
14
+ .command(cli_shared_1.Text.version.check.cmdName)
15
+ .description(cli_shared_1.Text.version.check.desc)
16
+ .requireAppId()
17
+ .environmentOption()
18
+ .nonInteractiveOption()
19
+ .option('-v, --major-version [version]', cli_shared_1.Text.version.check.option.majorVersion)
20
+ .option('--json', cli_shared_1.Text.version.check.option.json)
21
+ .option('-f, --out-file [outFile]', cli_shared_1.Text.version.check.option.outFile)
22
+ .action(async ({ environment, majorVersion, json, outFile, nonInteractive }) => {
23
+ const majorVersionInt = majorVersion ? parseMajorVersion(majorVersion) : undefined;
24
+ await versionController.getAppVersionDetails({
25
+ environment,
26
+ majorVersion: majorVersionInt,
27
+ json,
28
+ outFile,
29
+ nonInteractive
30
+ });
31
+ });
32
+ };
33
+ const registerListCommands = (parent, { controllers: { versionController } }) => {
34
+ parent
35
+ .command(cli_shared_1.Text.version.list.cmdName)
36
+ .description(cli_shared_1.Text.version.list.desc)
37
+ .requireAppId()
38
+ .environmentOption()
39
+ .nonInteractiveOption()
40
+ .option('--json', cli_shared_1.Text.version.list.option.json)
41
+ .option('-f, --out-file [outFile]', cli_shared_1.Text.version.list.option.outFile)
42
+ .action(async ({ environment, json, outFile, nonInteractive }) => {
43
+ await versionController.getVersionList({ environment, json, outFile, nonInteractive });
44
+ });
45
+ };
46
+ const registerDiffCommands = (parent, { controllers: { versionController } }) => {
47
+ parent
48
+ .command(cli_shared_1.Text.version.diff.cmdName)
49
+ .description(cli_shared_1.Text.version.diff.desc)
50
+ .requireAppId()
51
+ .environmentOption()
52
+ .nonInteractiveOption()
53
+ .option('-v1, --version1 [version]', cli_shared_1.Text.version.diff.option.version1)
54
+ .option('-v2, --version2 [version]', cli_shared_1.Text.version.diff.option.version2)
55
+ .option('-f, --out-file [outFile]', cli_shared_1.Text.version.diff.option.outFile)
56
+ .action(async ({ environment, version1, version2, outFile }) => {
57
+ if (!version1 || !version2) {
58
+ throw new cli_shared_1.ValidationError(cli_shared_1.Text.version.diff.error.noVersionProvided);
59
+ }
60
+ const version1Int = parseMajorVersion(version1, '--version1');
61
+ const version2Int = parseMajorVersion(version2, '--version2');
62
+ await versionController.getAppVersionDiff({ environment, version1: version1Int, version2: version2Int, outFile });
63
+ });
64
+ };
65
+ const registerCommands = (deps) => {
66
+ const { cmd } = deps;
67
+ const version = cmd.command(cli_shared_1.Text.version.cmd.cmdName).description(cli_shared_1.Text.version.cmd.desc);
68
+ registerDetailsCommands(version, deps);
69
+ registerDiffCommands(version, deps);
70
+ registerListCommands(version, deps);
71
+ };
72
+ exports.registerCommands = registerCommands;
@@ -0,0 +1,26 @@
1
+ import { AppEnvironmentType, UI } from '@forge/cli-shared';
2
+ import { VersionDetails, VersionOverview } from '../../service/version-service';
3
+ import { Change } from 'diff';
4
+ export declare class VersionView {
5
+ private readonly ui;
6
+ constructor(ui: UI);
7
+ displayDetailsProgress(progress: () => Promise<VersionDetails>): Promise<VersionDetails>;
8
+ displayDiffProgress(progress: () => Promise<VersionDetails[]>): Promise<VersionDetails[]>;
9
+ displayListProgress(progress: () => Promise<VersionOverview[]>): Promise<VersionOverview[]>;
10
+ promptVersionDetailsProperties(): Promise<(keyof VersionDetails)[]>;
11
+ displayVersionDetailsBanner(appVersion: number, envKey: string, envType: AppEnvironmentType): void;
12
+ displayDetailsAsTable(details: VersionDetails): void;
13
+ displayDataInJson(data: VersionDetails): void;
14
+ displayDiffBanner(version1: number, version2: number, envKey: string, envType: AppEnvironmentType): void;
15
+ displayDiffAsTable(versions: {
16
+ v1: number;
17
+ v2: number;
18
+ }, input: {
19
+ key: string;
20
+ diff: Change[];
21
+ }[]): void;
22
+ displayListBanner(versions: number, envKey: string, envType: AppEnvironmentType): void;
23
+ displayWriteToFile(outFile: string): void;
24
+ displayVersionList(data: VersionOverview[]): void;
25
+ }
26
+ //# sourceMappingURL=version-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-view.d.ts","sourceRoot":"","sources":["../../../src/command-line/view/version-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAQ,EAAE,EAAE,MAA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,IAAI;IAMtF,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIzC,kBAAkB,CAAC,IAAI,EAAE,eAAe,EAAE,GAAG,IAAI;CAwBzD"}
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VersionView = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const cli_shared_1 = require("@forge/cli-shared");
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ class VersionView {
8
+ ui;
9
+ constructor(ui) {
10
+ this.ui = ui;
11
+ }
12
+ async displayDetailsProgress(progress) {
13
+ return this.ui.displayProgress(progress, cli_shared_1.Text.version.check.start, cli_shared_1.Text.version.check.end);
14
+ }
15
+ async displayDiffProgress(progress) {
16
+ return this.ui.displayProgress(progress, cli_shared_1.Text.version.diff.start, cli_shared_1.Text.version.diff.end);
17
+ }
18
+ async displayListProgress(progress) {
19
+ return this.ui.displayProgress(progress, cli_shared_1.Text.version.list.start, cli_shared_1.Text.version.list.end);
20
+ }
21
+ async promptVersionDetailsProperties() {
22
+ const propsOptions = [
23
+ {
24
+ names: ['License', cli_shared_1.Text.version.check.details.prompt.properties.descriptions.license],
25
+ property: 'requiresLicense'
26
+ },
27
+ {
28
+ names: ['Scopes', cli_shared_1.Text.version.check.details.prompt.properties.descriptions.scopes],
29
+ property: 'scopes'
30
+ },
31
+ {
32
+ names: ['Egress', cli_shared_1.Text.version.check.details.prompt.properties.descriptions.egress],
33
+ property: 'egresses'
34
+ },
35
+ {
36
+ names: ['Policies', cli_shared_1.Text.version.check.details.prompt.properties.descriptions.policies],
37
+ property: 'policies'
38
+ },
39
+ {
40
+ names: ['Connect Key', cli_shared_1.Text.version.check.details.prompt.properties.descriptions.connectKeys],
41
+ property: 'connectKeys'
42
+ },
43
+ {
44
+ names: ['Functions', cli_shared_1.Text.version.check.details.prompt.properties.descriptions.functions],
45
+ property: 'functions'
46
+ },
47
+ {
48
+ names: ['Modules', cli_shared_1.Text.version.check.details.prompt.properties.descriptions.modules],
49
+ property: 'modules'
50
+ },
51
+ {
52
+ names: ['Remotes', cli_shared_1.Text.version.check.details.prompt.properties.descriptions.remotes],
53
+ property: 'remotes'
54
+ }
55
+ ];
56
+ const allOrNot = await this.ui.promptForList(cli_shared_1.Text.version.check.details.prompt.options.banner, [
57
+ cli_shared_1.Text.version.check.details.prompt.options.choices.all,
58
+ cli_shared_1.Text.version.check.details.prompt.options.choices.manual
59
+ ]);
60
+ if (allOrNot === cli_shared_1.Text.version.check.details.prompt.options.choices.manual) {
61
+ const choices = await this.ui.promptForTable(cli_shared_1.Text.version.check.details.prompt.properties.banner, cli_shared_1.Text.version.check.details.prompt.properties.info, cli_shared_1.Text.version.check.details.prompt.properties.headers, propsOptions);
62
+ return choices.map((index) => propsOptions[index].property);
63
+ }
64
+ return [];
65
+ }
66
+ displayVersionDetailsBanner(appVersion, envKey, envType) {
67
+ this.ui.emptyLine();
68
+ this.ui.info(cli_shared_1.Text.version.check.details.banner(envKey, envType, appVersion));
69
+ this.ui.emptyLine();
70
+ }
71
+ displayDetailsAsTable(details) {
72
+ this.ui.table([
73
+ ['entry', 'Property'],
74
+ ['details', 'Details']
75
+ ], [
76
+ {
77
+ entry: 'deployment date',
78
+ details: cli_shared_1.Text.version.check.details.deploymentDate(details.deploymentDateTime),
79
+ property: 'deploymentDateTime'
80
+ },
81
+ {
82
+ entry: 'functions',
83
+ details: cli_shared_1.Text.version.check.details.functions(details.functions || []),
84
+ property: 'functions'
85
+ },
86
+ {
87
+ entry: 'modules',
88
+ details: cli_shared_1.Text.version.check.details.modules(details.modules || []),
89
+ property: 'modules'
90
+ },
91
+ {
92
+ entry: 'license',
93
+ details: cli_shared_1.Text.version.check.details.license(details.requiresLicense),
94
+ property: 'requiresLicense'
95
+ },
96
+ {
97
+ entry: 'scopes',
98
+ details: cli_shared_1.Text.version.check.details.scopes(details.scopes || []),
99
+ property: 'scopes'
100
+ },
101
+ {
102
+ entry: 'egress',
103
+ details: cli_shared_1.Text.version.check.details.egress(details.egresses || []),
104
+ property: 'egresses'
105
+ },
106
+ {
107
+ entry: 'policies',
108
+ details: cli_shared_1.Text.version.check.details.securityPolicies(details.policies || []),
109
+ property: 'policies'
110
+ },
111
+ {
112
+ entry: 'connect keys',
113
+ details: cli_shared_1.Text.version.check.details.connectKeys(details.connectKeys || []),
114
+ property: 'connectKeys'
115
+ },
116
+ {
117
+ entry: 'remotes',
118
+ details: cli_shared_1.Text.version.check.details.remotes(details.remotes || []),
119
+ property: 'remotes'
120
+ }
121
+ ]
122
+ .sort((a, b) => a.entry.localeCompare(b.entry))
123
+ .filter(({ property }) => Object.keys(details).includes(property)));
124
+ }
125
+ displayDataInJson(data) {
126
+ this.ui.info(JSON.stringify(data, null, 2));
127
+ }
128
+ displayDiffBanner(version1, version2, envKey, envType) {
129
+ this.ui.emptyLine();
130
+ this.ui.info(cli_shared_1.Text.version.diff.details.banner(envKey, envType, version1, version2));
131
+ this.ui.emptyLine();
132
+ }
133
+ displayDiffAsTable(versions, input) {
134
+ this.ui.table([
135
+ ['entry', 'Property'],
136
+ ['v1', `Version 1 [${versions.v1}]`],
137
+ ['v2', `Version 2 [${versions.v2}]`]
138
+ ], input
139
+ .filter(({ diff }) => diff.filter((change) => change.added || change.removed).length > 0)
140
+ .map(({ key, diff }) => ({
141
+ entry: key,
142
+ v1: diff
143
+ .filter((change) => !change.added)
144
+ .map((change) => {
145
+ if (!change.removed) {
146
+ return chalk_1.default.gray(change.value);
147
+ }
148
+ return change.value;
149
+ })
150
+ .join(''),
151
+ v2: diff
152
+ .filter((change) => !change.removed)
153
+ .map((change) => {
154
+ if (!change.added) {
155
+ return chalk_1.default.gray(change.value);
156
+ }
157
+ return change.value;
158
+ })
159
+ .join('')
160
+ }))
161
+ .sort((a, b) => a.entry.localeCompare(b.entry)));
162
+ }
163
+ displayListBanner(versions, envKey, envType) {
164
+ this.ui.emptyLine();
165
+ this.ui.info(cli_shared_1.Text.version.list.details.banner(envKey, envType, versions));
166
+ this.ui.emptyLine();
167
+ }
168
+ displayWriteToFile(outFile) {
169
+ this.ui.info(cli_shared_1.Text.version.check.details.writeToFile(outFile));
170
+ }
171
+ displayVersionList(data) {
172
+ this.ui.table([
173
+ ['version', 'Major Versions'],
174
+ ['deploymentDate', 'Deployment Date'],
175
+ ['egresses', 'Egress'],
176
+ ['policies', 'Policies'],
177
+ ['scopes', 'Scopes'],
178
+ ['connectKeys', 'Connect keys'],
179
+ ['functions', 'Functions'],
180
+ ['remotes', 'Remotes'],
181
+ ['modules', 'Modules'],
182
+ ['requiresLicense', 'License']
183
+ ], data.map(({ version, egresses, modules, policies, deploymentDateTime, ...rest }) => ({
184
+ ...rest,
185
+ version: version.toString(),
186
+ deploymentDate: cli_shared_1.Text.version.list.details.deploymentDate(deploymentDateTime),
187
+ egresses: cli_shared_1.Text.version.list.details.egresses(egresses),
188
+ policies: cli_shared_1.Text.version.list.details.policies(policies),
189
+ modules: cli_shared_1.Text.version.list.details.modules(modules)
190
+ })));
191
+ }
192
+ }
193
+ exports.VersionView = VersionView;
@@ -0,0 +1,74 @@
1
+ import { AppConfigProvider, AppEnvironmentType } from '@forge/cli-shared';
2
+ import { AppVersionDetailsClient } from '../version/graphql-client';
3
+ export interface VersionDetails {
4
+ appVersion: number;
5
+ deploymentDateTime: Date;
6
+ environmentType: AppEnvironmentType;
7
+ functions: {
8
+ key: string;
9
+ runtimeName: string;
10
+ regions: string[];
11
+ handler: string;
12
+ }[] | undefined;
13
+ modules: {
14
+ type: string;
15
+ items: {
16
+ key: string;
17
+ properties: any;
18
+ }[];
19
+ }[];
20
+ requiresLicense: boolean;
21
+ egresses: {
22
+ type: string;
23
+ addresses: string[];
24
+ }[];
25
+ scopes: string[];
26
+ policies: {
27
+ type: string;
28
+ policies: string[];
29
+ }[];
30
+ connectKeys: {
31
+ product: string;
32
+ key: string;
33
+ }[] | undefined;
34
+ remotes: {
35
+ key: string;
36
+ baseUrl: string;
37
+ operations: string[];
38
+ }[] | undefined;
39
+ }
40
+ export interface VersionOverview {
41
+ version: number;
42
+ deploymentDateTime: Date;
43
+ environmentType: AppEnvironmentType;
44
+ egresses: {
45
+ type: string;
46
+ count: number;
47
+ }[];
48
+ policies: {
49
+ type: string;
50
+ count: number;
51
+ }[];
52
+ scopes: string;
53
+ connectKeys: string;
54
+ functions: string;
55
+ remotes: string;
56
+ modules: {
57
+ type: string;
58
+ count: number;
59
+ }[];
60
+ requiresLicense: boolean;
61
+ }
62
+ export declare class VersionService {
63
+ private readonly getAppConfig;
64
+ private readonly versionDetailsClient;
65
+ constructor(getAppConfig: AppConfigProvider, versionDetailsClient: AppVersionDetailsClient);
66
+ private getMajorVersion;
67
+ getAppVersionDetails(environmentKey: string, majorVersion?: number): Promise<VersionDetails>;
68
+ private getTypeFromPermissionType;
69
+ private getModulesGroupedByTypes;
70
+ private removeInternalPropertiesFromObject;
71
+ private getAppVersions;
72
+ getAppVersionOverviewList(environmentKey: string): Promise<VersionOverview[]>;
73
+ }
74
+ //# sourceMappingURL=version-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-service.d.ts","sourceRoot":"","sources":["../../src/service/version-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAInB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAIpE,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,IAAI,CAAC;IACzB,eAAe,EAAE,kBAAkB,CAAC;IACpC,SAAS,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,GAAG,SAAS,CAAC;IAClG,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE;YAA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C,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBADpB,YAAY,EAAE,iBAAiB,EAC/B,oBAAoB,EAAE,uBAAuB;IAGhE,OAAO,CAAC,eAAe;IAIV,oBAAoB,CAAC,cAAc,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA+EzG,OAAO,CAAC,yBAAyB;IAajC,OAAO,CAAC,wBAAwB;IAwBhC,OAAO,CAAC,kCAAkC;YAM5B,cAAc;IAKf,yBAAyB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;CAsB3F"}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VersionService = void 0;
4
+ const cli_shared_1 = require("@forge/cli-shared");
5
+ const manifest_1 = require("@forge/manifest");
6
+ const arn_1 = require("@sandfox/arn");
7
+ class VersionService {
8
+ getAppConfig;
9
+ versionDetailsClient;
10
+ constructor(getAppConfig, versionDetailsClient) {
11
+ this.getAppConfig = getAppConfig;
12
+ this.versionDetailsClient = versionDetailsClient;
13
+ }
14
+ getMajorVersion(version) {
15
+ return parseInt(version.split('.')[0]);
16
+ }
17
+ async getAppVersionDetails(environmentKey, majorVersion) {
18
+ const { id: appId } = await this.getAppConfig();
19
+ const data = await this.versionDetailsClient.getVersionDetails(appId, environmentKey, majorVersion);
20
+ const functionModules = data.modules?.filter((mod) => mod?.extensionData.type === manifest_1.AllModuleTypes.CoreFunction);
21
+ const remoteModules = data.modules?.filter((mod) => mod?.extensionData.type === manifest_1.AllModuleTypes.CoreRemote);
22
+ const allModules = this.getModulesGroupedByTypes(data.modules);
23
+ return {
24
+ requiresLicense: data.requiresLicense,
25
+ egresses: data.permissions?.[0].egress
26
+ ?.filter((entry) => entry !== undefined && entry !== null)
27
+ .filter((entry) => {
28
+ if (entry.type === 'FETCH_BACKEND_SIDE') {
29
+ entry.addresses = entry.addresses?.filter((address) => !remoteModules?.map((remote) => remote?.extensionData.baseUrl).includes(address));
30
+ }
31
+ return entry;
32
+ })
33
+ .filter((entry) => entry?.addresses?.length !== 0)
34
+ .map((entry) => ({
35
+ type: this.getTypeFromPermissionType(entry?.type),
36
+ addresses: entry.addresses
37
+ })) || [],
38
+ scopes: data.permissions?.[0].scopes.map((scope) => scope.key).sort() || [],
39
+ policies: data.permissions?.[0].securityPolicies
40
+ ?.filter((entry) => entry.type !== undefined && entry.type !== null)
41
+ .map((entry) => ({
42
+ type: this.getTypeFromPermissionType(entry?.type),
43
+ policies: entry.policies
44
+ })) || [],
45
+ connectKeys: data.migrationKeys
46
+ ? Object.keys(data.migrationKeys).map((key) => ({
47
+ product: key,
48
+ key: data.migrationKeys[key]
49
+ }))
50
+ : undefined,
51
+ appVersion: this.getMajorVersion(data.appVersion),
52
+ deploymentDateTime: data.deploymentDateTime,
53
+ environmentType: data.environmentType,
54
+ functions: functionModules?.map((entry) => ({
55
+ key: entry?.key || 'N/A',
56
+ runtimeName: (entry?.extensionData.functions?.[Object.keys(entry?.extensionData.functions || {})[0]]?.runtime
57
+ ?.identifier ||
58
+ entry?.extensionData.runtime?.identifier ||
59
+ 'sandbox')
60
+ .replace('provided.al2', 'sandbox')
61
+ .replace('provided', 'sandbox'),
62
+ regions: entry?.extensionData.functions
63
+ ? Object.keys(entry?.extensionData.functions)
64
+ : [(0, arn_1.parse)(entry?.extensionData.functionName).region],
65
+ handler: entry?.extensionData.handler
66
+ })) || [],
67
+ modules: Object.keys(allModules)
68
+ .filter((type) => !['function', 'remote'].includes(type))
69
+ .map((type) => ({ type, items: allModules[type] })) || [],
70
+ remotes: remoteModules?.map((entry) => ({
71
+ key: entry?.key || 'N/A',
72
+ baseUrl: entry?.extensionData.baseUrl,
73
+ operations: entry?.extensionData.operations || []
74
+ })) || []
75
+ };
76
+ }
77
+ getTypeFromPermissionType(permissionType) {
78
+ switch (permissionType) {
79
+ case cli_shared_1.AppNetworkPermissionType.FetchBackendSide:
80
+ return 'fetch.backend';
81
+ case cli_shared_1.AppNetworkPermissionType.FetchClientSide:
82
+ return 'fetch.client';
83
+ default:
84
+ return permissionType?.toLowerCase().replaceAll('_', '.');
85
+ }
86
+ }
87
+ getModulesGroupedByTypes(modules) {
88
+ const rawModules = modules
89
+ ?.filter((mod) => manifest_1.SUPPORTED_MODULES.includes(mod?.extensionData.type))
90
+ ?.filter((mod) => ![manifest_1.AllModuleTypes.CoreFunction, manifest_1.AllModuleTypes.CoreRemote].includes(mod?.extensionData.type))
91
+ .map((entry) => ({
92
+ key: entry?.key || 'N/A',
93
+ type: entry?.extensionData.type,
94
+ properties: {
95
+ ...this.removeInternalPropertiesFromObject(entry?.extensionData)
96
+ }
97
+ })) || [];
98
+ return rawModules.reduce((acc, entry) => {
99
+ const type = (0, manifest_1.cleanKey)(entry.type);
100
+ if (acc[type] === undefined) {
101
+ acc[type] = [];
102
+ }
103
+ acc[type].push(entry);
104
+ return acc;
105
+ }, {});
106
+ }
107
+ removeInternalPropertiesFromObject(obj) {
108
+ const { type, functions, outboundAuthContainerId, resourceUploadId, key, ...rest } = obj || {};
109
+ return rest;
110
+ }
111
+ async getAppVersions(environmentKey) {
112
+ const { id: appId } = await this.getAppConfig();
113
+ return await this.versionDetailsClient.getVersionList(appId, environmentKey);
114
+ }
115
+ async getAppVersionOverviewList(environmentKey) {
116
+ const versions = await this.getAppVersions(environmentKey);
117
+ const majorVersions = versions.map((version) => this.getMajorVersion(version));
118
+ const versionDetails = await Promise.all(majorVersions.map(async (version) => await this.getAppVersionDetails(environmentKey, version)));
119
+ return versionDetails.map((entry) => ({
120
+ version: entry.appVersion,
121
+ deploymentDateTime: entry.deploymentDateTime,
122
+ environmentType: entry.environmentType,
123
+ egresses: entry.egresses.map((egress) => ({ type: egress.type, count: egress.addresses.length })),
124
+ policies: entry.policies.map((policy) => ({ type: policy.type, count: policy.policies.length })),
125
+ scopes: (entry.scopes.length || 0).toString(),
126
+ connectKeys: (entry.connectKeys?.length || 0).toString(),
127
+ functions: (entry.functions?.length || 0).toString(),
128
+ remotes: (entry.remotes?.length || 0).toString(),
129
+ modules: entry.modules.map((module) => ({ type: module.type, count: module.items.length })),
130
+ requiresLicense: entry.requiresLicense
131
+ }));
132
+ }
133
+ }
134
+ exports.VersionService = VersionService;
@@ -0,0 +1,27 @@
1
+ import { AppEnvironmentType, AppPermission, AppVersionExtension, GraphQLClient, Maybe, MigrationKeys, Storage, UserError } from '@forge/cli-shared';
2
+ export interface AppVersionDetailsData {
3
+ migrationKeys?: Maybe<MigrationKeys> | null;
4
+ permissions?: Array<AppPermission> | null;
5
+ modules: Array<AppVersionExtension | null> | null | undefined;
6
+ environmentType: AppEnvironmentType;
7
+ appVersion: string;
8
+ deploymentDateTime: Date;
9
+ requiresLicense: boolean;
10
+ storage: Storage;
11
+ }
12
+ export declare class MissingAppError extends UserError {
13
+ }
14
+ export declare class EnvironmentNotFoundError extends UserError {
15
+ constructor(environmentKey: string);
16
+ }
17
+ export declare class MissingAppVersionError extends Error {
18
+ }
19
+ export declare class MissingAppEnvironmentError extends Error {
20
+ }
21
+ export declare class AppVersionDetailsClient {
22
+ private readonly graphqlClient;
23
+ constructor(graphqlClient: GraphQLClient);
24
+ getVersionDetails(appId: string, environmentKey: string, majorVersion?: number): Promise<AppVersionDetailsData>;
25
+ getVersionList(appId: string, environmentKey: string): Promise<string[]>;
26
+ }
27
+ //# sourceMappingURL=graphql-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/version/graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,KAAK,EACL,aAAa,EAEb,OAAO,EAEP,SAAS,EACV,MAAM,mBAAmB,CAAC;AAS3B,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;IAC5C,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;IAC1C,OAAO,EAAE,KAAK,CAAC,mBAAmB,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IAC9D,eAAe,EAAE,kBAAkB,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,IAAI,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,qBAAa,eAAgB,SAAQ,SAAS;CAAG;AAEjD,qBAAa,wBAAyB,SAAQ,SAAS;gBACzC,cAAc,EAAE,MAAM;CAGnC;AAED,qBAAa,sBAAuB,SAAQ,KAAK;CAAG;AAEpD,qBAAa,0BAA2B,SAAQ,KAAK;CAAG;AAExD,qBAAa,uBAAuB;IACtB,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAE5C,iBAAiB,CAC5B,KAAK,EAAE,MAAM,EACb,cAAc,EAAE,MAAM,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,qBAAqB,CAAC;IAyFpB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAuDtF"}
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppVersionDetailsClient = exports.MissingAppEnvironmentError = exports.MissingAppVersionError = exports.EnvironmentNotFoundError = exports.MissingAppError = void 0;
4
+ const cli_shared_1 = require("@forge/cli-shared");
5
+ class MissingAppError extends cli_shared_1.UserError {
6
+ }
7
+ exports.MissingAppError = MissingAppError;
8
+ class EnvironmentNotFoundError extends cli_shared_1.UserError {
9
+ constructor(environmentKey) {
10
+ super(cli_shared_1.Text.env.error.envNotExist(environmentKey));
11
+ }
12
+ }
13
+ exports.EnvironmentNotFoundError = EnvironmentNotFoundError;
14
+ class MissingAppVersionError extends Error {
15
+ }
16
+ exports.MissingAppVersionError = MissingAppVersionError;
17
+ class MissingAppEnvironmentError extends Error {
18
+ }
19
+ exports.MissingAppEnvironmentError = MissingAppEnvironmentError;
20
+ class AppVersionDetailsClient {
21
+ graphqlClient;
22
+ constructor(graphqlClient) {
23
+ this.graphqlClient = graphqlClient;
24
+ }
25
+ async getVersionDetails(appId, environmentKey, majorVersion) {
26
+ const query = `
27
+ query forge_cli_getApplicationVersionDetails($appId: ID!, $environmentKey: String!, $firstN: Int!, $majorVersion: Int) {
28
+ app(id: $appId) {
29
+ environmentByKey(key: $environmentKey) {
30
+ type
31
+ versions(first: $firstN, majorVersion: $majorVersion) {
32
+ nodes {
33
+ version
34
+ createdAt
35
+ isLatest
36
+ requiresLicense
37
+ permissions {
38
+ scopes {
39
+ key
40
+ }
41
+ egress {
42
+ type
43
+ addresses
44
+ }
45
+ securityPolicies {
46
+ type
47
+ policies
48
+ }
49
+ }
50
+ extensions {
51
+ nodes {
52
+ id
53
+ key
54
+ extensionData
55
+ }
56
+ }
57
+ storage {
58
+ hosted {
59
+ classifications
60
+ locations
61
+ }
62
+ remotes {
63
+ key
64
+ baseUrl
65
+ classifications
66
+ locations
67
+ }
68
+ }
69
+ migrationKeys {
70
+ jira
71
+ confluence
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
78
+ `;
79
+ const result = await this.graphqlClient.query(query, {
80
+ appId,
81
+ environmentKey,
82
+ firstN: 1,
83
+ majorVersion
84
+ });
85
+ if (!result.app) {
86
+ throw new MissingAppError();
87
+ }
88
+ if (!result.app.environmentByKey) {
89
+ throw new EnvironmentNotFoundError(environmentKey);
90
+ }
91
+ if (!result.app.environmentByKey.versions?.nodes?.length) {
92
+ throw new MissingAppEnvironmentError();
93
+ }
94
+ if (!result.app.environmentByKey.versions?.nodes?.[0]?.version) {
95
+ throw new MissingAppVersionError();
96
+ }
97
+ return {
98
+ migrationKeys: result.app.environmentByKey.versions?.nodes?.[0]?.migrationKeys,
99
+ environmentType: result.app.environmentByKey.type,
100
+ appVersion: result.app.environmentByKey.versions?.nodes?.[0]?.version,
101
+ deploymentDateTime: new Date(Number.parseInt(result.app.environmentByKey.versions?.nodes?.[0]?.createdAt)),
102
+ storage: result.app.environmentByKey.versions?.nodes?.[0]?.storage,
103
+ requiresLicense: result.app.environmentByKey.versions?.nodes?.[0]?.requiresLicense,
104
+ permissions: result.app.environmentByKey.versions?.nodes?.[0]?.permissions,
105
+ modules: result.app.environmentByKey.versions?.nodes?.[0]?.extensions?.nodes
106
+ };
107
+ }
108
+ async getVersionList(appId, environmentKey) {
109
+ const query = `
110
+ query forge_cli_getApplicationVersionList($appId: ID!, $first: Int, $after: String) {
111
+ app(id: $appId) {
112
+ environments {
113
+ key
114
+ versions(first: $first, after: $after) {
115
+ nodes {
116
+ version
117
+ }
118
+ pageInfo {
119
+ hasNextPage
120
+ endCursor
121
+ }
122
+ }
123
+ }
124
+ }
125
+ }
126
+ `;
127
+ const output = [];
128
+ let cursor = undefined;
129
+ let hasNext = undefined;
130
+ do {
131
+ const result = await this.graphqlClient.query(query, {
132
+ appId,
133
+ first: 20,
134
+ after: cursor
135
+ });
136
+ if (!result.app) {
137
+ throw new MissingAppError();
138
+ }
139
+ if (!result.app.environments) {
140
+ throw new MissingAppVersionError();
141
+ }
142
+ const environment = result.app.environments.filter((env) => env.key === environmentKey)[0];
143
+ cursor = environment?.versions?.pageInfo.endCursor;
144
+ hasNext = environment?.versions?.pageInfo.hasNextPage;
145
+ output.push(...(environment?.versions?.nodes?.map((node) => node?.version) || []).filter((item) => Boolean(item)));
146
+ } while (hasNext && cursor);
147
+ return output;
148
+ }
149
+ }
150
+ exports.AppVersionDetailsClient = AppVersionDetailsClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/cli",
3
- "version": "10.13.3",
3
+ "version": "10.13.4-next.1-experimental-19bd64d",
4
4
  "description": "A command line interface for managing Atlassian-hosted apps",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",
@@ -18,16 +18,17 @@
18
18
  "postinstall": "node -e \"fs.existsSync('./out/bin/postinstall.js') && require('./out/bin/postinstall.js')\""
19
19
  },
20
20
  "dependencies": {
21
- "@forge/bundler": "4.20.4",
22
- "@forge/cli-shared": "6.5.1",
21
+ "@forge/bundler": "4.20.5-next.1-experimental-19bd64d",
22
+ "@forge/cli-shared": "6.5.2-next.1-experimental-19bd64d",
23
23
  "@forge/egress": "1.3.0",
24
- "@forge/lint": "5.6.4",
25
- "@forge/manifest": "8.4.0",
24
+ "@forge/lint": "5.6.5-next.1-experimental-19bd64d",
25
+ "@forge/manifest": "8.4.1-next.1-experimental-19bd64d",
26
26
  "@forge/runtime": "5.10.4",
27
- "@forge/tunnel": "5.8.0",
27
+ "@forge/tunnel": "5.8.1-next.1-experimental-19bd64d",
28
28
  "@forge/util": "1.4.6",
29
29
  "@sentry/node": "7.106.0",
30
30
  "@forge/i18n": "0.0.2",
31
+ "@sandfox/arn": "^2.1.0",
31
32
  "ajv": "^8.12.0",
32
33
  "archiver": "^6.0.2",
33
34
  "case": "^1.6.3",
@@ -39,6 +40,7 @@
39
40
  "cross-spawn": "^7.0.3",
40
41
  "dayjs": "^1.11.10",
41
42
  "didyoumean": "^1.2.2",
43
+ "diff": "^7.0.0",
42
44
  "env-paths": "^2.2.1",
43
45
  "exponential-backoff": "^3.1.1",
44
46
  "form-data": "^4.0.0",
@@ -63,6 +65,7 @@
63
65
  "@types/command-exists": "^1.2.3",
64
66
  "@types/cross-spawn": "^6.0.6",
65
67
  "@types/didyoumean": "^1.2.2",
68
+ "@types/diff": "^6.0.0",
66
69
  "@types/fs-extra": "^11.0.4",
67
70
  "@types/hidefile": "^3.0.3",
68
71
  "@types/inquirer": "^8.2.10",