@forge/cli 10.13.4 → 10.13.5-next.0-experimental-4d5d98e

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,26 @@
1
1
  # @forge/cli
2
2
 
3
+ ## 10.13.5-next.0-experimental-4d5d98e
4
+
5
+ ### Minor Changes
6
+
7
+ - e1c8dde: Added command for app versions details
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [e1c8dde]
12
+ - @forge/cli-shared@6.5.2-experimental-4d5d98e
13
+ - @forge/bundler@4.20.6-next.0-experimental-4d5d98e
14
+ - @forge/lint@5.6.5-experimental-4d5d98e
15
+ - @forge/tunnel@5.8.2-next.0-experimental-4d5d98e
16
+
17
+ ## 10.13.5-next.0
18
+
19
+ ### Patch Changes
20
+
21
+ - @forge/bundler@4.20.6-next.0
22
+ - @forge/tunnel@5.8.2-next.0
23
+
3
24
  ## 10.13.4
4
25
 
5
26
  ### Patch Changes
@@ -1,24 +1,25 @@
1
1
  {
2
2
  "name": "@forge/cli",
3
- "version": "10.13.4",
3
+ "version": "10.13.5-next.0-experimental-4d5d98e",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@forge/cli",
9
- "version": "10.13.4",
9
+ "version": "10.13.5-next.0-experimental-4d5d98e",
10
10
  "hasInstallScript": true,
11
11
  "license": "UNLICENSED",
12
12
  "dependencies": {
13
- "@forge/bundler": "4.20.5",
14
- "@forge/cli-shared": "6.5.2",
13
+ "@forge/bundler": "4.20.6-next.0-experimental-4d5d98e",
14
+ "@forge/cli-shared": "6.5.2-experimental-4d5d98e",
15
15
  "@forge/egress": "1.3.0",
16
16
  "@forge/i18n": "0.0.2",
17
- "@forge/lint": "5.6.5",
17
+ "@forge/lint": "5.6.5-experimental-4d5d98e",
18
18
  "@forge/manifest": "8.4.1",
19
19
  "@forge/runtime": "5.10.4",
20
- "@forge/tunnel": "5.8.1",
20
+ "@forge/tunnel": "5.8.2-next.0-experimental-4d5d98e",
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.5",
841
- "resolved": "https://registry.npmjs.org/@forge/bundler/-/bundler-4.20.5.tgz",
842
- "integrity": "sha512-7of1vd+Oz0OdXVPlxNUifq8aNGD9iHcCRxuKGyN/JLdXZZk7yvdD3H+nuBLXcbanfYoj/eHJ/NisPOwyT6YtZA==",
843
+ "version": "4.20.6-next.0-experimental-4d5d98e",
844
+ "resolved": "https://registry.npmjs.org/@forge/bundler/-/bundler-4.20.6-next.0-experimental-4d5d98e.tgz",
845
+ "integrity": "sha512-HJIRZuV5lIBRJhwDitVRxSgBnEGocEgFoUOgKLMZVPbxTW9c7ZZ89Y2NGh6A1vv2XzETnRDQDbvk/MFIzApq+Q==",
843
846
  "license": "UNLICENSED",
844
847
  "dependencies": {
845
848
  "@babel/core": "^7.24.0",
@@ -849,11 +852,11 @@
849
852
  "@babel/plugin-transform-optional-chaining": "^7.23.4",
850
853
  "@babel/plugin-transform-react-jsx": "^7.23.4",
851
854
  "@babel/preset-typescript": "^7.23.3",
852
- "@forge/api": "4.2.0",
855
+ "@forge/api": "4.2.1-next.0-experimental-4d5d98e",
853
856
  "@forge/babel-plugin-transform-ui": "1.1.19",
854
- "@forge/cli-shared": "6.5.2",
857
+ "@forge/cli-shared": "6.5.2-experimental-4d5d98e",
855
858
  "@forge/i18n": "0.0.2",
856
- "@forge/lint": "5.6.5",
859
+ "@forge/lint": "5.6.5-experimental-4d5d98e",
857
860
  "@forge/manifest": "8.4.1",
858
861
  "@forge/util": "1.4.6",
859
862
  "assert": "^2.1.0",
@@ -893,9 +896,9 @@
893
896
  }
894
897
  },
895
898
  "node_modules/@forge/bundler/node_modules/@forge/api": {
896
- "version": "4.2.0",
897
- "resolved": "https://registry.npmjs.org/@forge/api/-/api-4.2.0.tgz",
898
- "integrity": "sha512-DhfhdbpLuscRevsEiEnTN0JjQkION2E9G9jtLFN3sbJUS6IswzH/0tW1LYMgrO68Hdr0lZE6ivn2ATEhYR2QRw==",
899
+ "version": "4.2.1-next.0-experimental-4d5d98e",
900
+ "resolved": "https://registry.npmjs.org/@forge/api/-/api-4.2.1-next.0-experimental-4d5d98e.tgz",
901
+ "integrity": "sha512-mtp2OHCLEcK2fqByLwSTqY71ovTThxziayb9lFK/Skn1g+Txuopv0PrWhc93vuA0lhLY0eUYMDG6e7Qv2nD0tA==",
899
902
  "license": "UNLICENSED",
900
903
  "dependencies": {
901
904
  "@forge/auth": "0.0.5",
@@ -913,9 +916,9 @@
913
916
  "license": "UNLICENSED"
914
917
  },
915
918
  "node_modules/@forge/cli-shared": {
916
- "version": "6.5.2",
917
- "resolved": "https://registry.npmjs.org/@forge/cli-shared/-/cli-shared-6.5.2.tgz",
918
- "integrity": "sha512-fmIf7hfxLE91eS13GTxHnQYaho8PARCYadPsJbllf4t5vRbHzmibjmPQZplDDMGvzz1gKBZfv6uIqbp5V+bZRg==",
919
+ "version": "6.5.2-experimental-4d5d98e",
920
+ "resolved": "https://registry.npmjs.org/@forge/cli-shared/-/cli-shared-6.5.2-experimental-4d5d98e.tgz",
921
+ "integrity": "sha512-bUPScBSh7EaCyevQWVWuk6ePlR8Gc4ULJbdcXft/Rb9n5UwQ3fdRQIbqAJHvYRltuIb8m1VIR1JJHihIVyKtpQ==",
919
922
  "license": "UNLICENSED",
920
923
  "dependencies": {
921
924
  "@forge/i18n": "0.0.2",
@@ -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-4d5d98e",
960
+ "resolved": "https://registry.npmjs.org/@forge/csp/-/csp-3.6.0-experimental-4d5d98e.tgz",
961
+ "integrity": "sha512-cUOKHPNZYSmWCqrji+pE8qYU755cgfa7bNRCRX973vH82NPpIZQLNf2XJo7EQ3JZ3b83VWSo0Xv4Gvb59w7ocQ==",
959
962
  "license": "UNLICENSED",
960
963
  "dependencies": {
961
964
  "cheerio": "^0.22.0",
@@ -981,12 +984,12 @@
981
984
  }
982
985
  },
983
986
  "node_modules/@forge/lint": {
984
- "version": "5.6.5",
985
- "resolved": "https://registry.npmjs.org/@forge/lint/-/lint-5.6.5.tgz",
986
- "integrity": "sha512-+r0aTR84X7nwgw8QyqNE7Fl4sKZnFHTiL/7H1pLIKZb+C5J/aLWKWnkbZ70K4qAq+vKhhSIzy8wK0GBTgQiA1w==",
987
+ "version": "5.6.5-experimental-4d5d98e",
988
+ "resolved": "https://registry.npmjs.org/@forge/lint/-/lint-5.6.5-experimental-4d5d98e.tgz",
989
+ "integrity": "sha512-wX5lzkJm1UuXJtmhO0sQTf9uCOcHP4PdyATVZv1ckvVjsPjYAVY+/B7KH/vnDmJtU/AdtbSzFZxymAd6SHla2A==",
987
990
  "license": "UNLICENSED",
988
991
  "dependencies": {
989
- "@forge/cli-shared": "6.5.2",
992
+ "@forge/cli-shared": "6.5.2-experimental-4d5d98e",
990
993
  "@forge/egress": "1.3.0",
991
994
  "@forge/manifest": "8.4.1",
992
995
  "@typescript-eslint/typescript-estree": "^5.62.0",
@@ -1030,14 +1033,14 @@
1030
1033
  }
1031
1034
  },
1032
1035
  "node_modules/@forge/tunnel": {
1033
- "version": "5.8.1",
1034
- "resolved": "https://registry.npmjs.org/@forge/tunnel/-/tunnel-5.8.1.tgz",
1035
- "integrity": "sha512-LfSu6H+hAWiwHjPT3F7A4GawWHBqKbuPYWEhb8p9ZTDkD2B2fit8p+/aFD2Sa12sfwCMDh0e5Kf+G5rMLK0daw==",
1036
+ "version": "5.8.2-next.0-experimental-4d5d98e",
1037
+ "resolved": "https://registry.npmjs.org/@forge/tunnel/-/tunnel-5.8.2-next.0-experimental-4d5d98e.tgz",
1038
+ "integrity": "sha512-v+ewfEVccABgq7zsTSDbgDeMPk9oBqsTveyJbveTyUkQXf21n/qyxnZlZv3S7orcoAPsbI8UbBkazK6GvO524w==",
1036
1039
  "license": "UNLICENSED",
1037
1040
  "dependencies": {
1038
- "@forge/bundler": "4.20.5",
1039
- "@forge/cli-shared": "6.5.2",
1040
- "@forge/csp": "3.6.0",
1041
+ "@forge/bundler": "4.20.6-next.0-experimental-4d5d98e",
1042
+ "@forge/cli-shared": "6.5.2-experimental-4d5d98e",
1043
+ "@forge/csp": "3.6.0-experimental-4d5d98e",
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,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,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;AAG5E,eAAO,MAAM,eAAe,eAAsB,UAAU,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmXvE,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"}
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,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,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,CASpF;AA2DD,eAAO,MAAM,gBAAgB,SAAU,YAAY,SAMlD,CAAC"}
@@ -0,0 +1,76 @@
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
+ const version = parseInt(majorVersionStr, 10);
10
+ if (version < 1) {
11
+ throw new cli_shared_1.ValidationError(cli_shared_1.Text.version.check.error.invalidMajorVersion(property));
12
+ }
13
+ return version;
14
+ }
15
+ exports.parseMajorVersion = parseMajorVersion;
16
+ const registerDetailsCommands = (parent, { controllers: { versionController } }) => {
17
+ parent
18
+ .command(cli_shared_1.Text.version.check.cmdName)
19
+ .description(cli_shared_1.Text.version.check.desc)
20
+ .requireAppId()
21
+ .environmentOption()
22
+ .nonInteractiveOption()
23
+ .option('-v, --major-version [version]', cli_shared_1.Text.version.check.option.majorVersion)
24
+ .option('--json', cli_shared_1.Text.version.check.option.json)
25
+ .option('-f, --out-file [outFile]', cli_shared_1.Text.version.check.option.outFile)
26
+ .action(async ({ environment, majorVersion, json, outFile, nonInteractive }) => {
27
+ const majorVersionInt = majorVersion ? parseMajorVersion(majorVersion) : undefined;
28
+ await versionController.getAppVersionDetails({
29
+ environment,
30
+ majorVersion: majorVersionInt,
31
+ json,
32
+ outFile,
33
+ nonInteractive
34
+ });
35
+ });
36
+ };
37
+ const registerListCommands = (parent, { controllers: { versionController } }) => {
38
+ parent
39
+ .command(cli_shared_1.Text.version.list.cmdName)
40
+ .description(cli_shared_1.Text.version.list.desc)
41
+ .requireAppId()
42
+ .environmentOption()
43
+ .nonInteractiveOption()
44
+ .option('--json', cli_shared_1.Text.version.list.option.json)
45
+ .option('-f, --out-file [outFile]', cli_shared_1.Text.version.list.option.outFile)
46
+ .action(async ({ environment, json, outFile, nonInteractive }) => {
47
+ await versionController.getVersionList({ environment, json, outFile, nonInteractive });
48
+ });
49
+ };
50
+ const registerDiffCommands = (parent, { controllers: { versionController } }) => {
51
+ parent
52
+ .command(cli_shared_1.Text.version.diff.cmdName)
53
+ .description(cli_shared_1.Text.version.diff.desc)
54
+ .requireAppId()
55
+ .environmentOption()
56
+ .nonInteractiveOption()
57
+ .option('-v1, --version1 [version]', cli_shared_1.Text.version.diff.option.version1)
58
+ .option('-v2, --version2 [version]', cli_shared_1.Text.version.diff.option.version2)
59
+ .option('-f, --out-file [outFile]', cli_shared_1.Text.version.diff.option.outFile)
60
+ .action(async ({ environment, version1, version2, outFile }) => {
61
+ if (!version1 || !version2) {
62
+ throw new cli_shared_1.ValidationError(cli_shared_1.Text.version.diff.error.noVersionProvided);
63
+ }
64
+ const version1Int = parseMajorVersion(version1, '--version1');
65
+ const version2Int = parseMajorVersion(version2, '--version2');
66
+ await versionController.getAppVersionDiff({ environment, version1: version1Int, version2: version2Int, outFile });
67
+ });
68
+ };
69
+ const registerCommands = (deps) => {
70
+ const { cmd } = deps;
71
+ const version = cmd.command(cli_shared_1.Text.version.cmd.cmdName).description(cli_shared_1.Text.version.cmd.desc);
72
+ registerDetailsCommands(version, deps);
73
+ registerDiffCommands(version, deps);
74
+ registerListCommands(version, deps);
75
+ };
76
+ 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,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAG9B,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,EAAE;IAEtB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC;IAIxF,mBAAmB,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,cAAc,EAAE,CAAC,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAIzF,mBAAmB,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAI3F,8BAA8B,IAAI,OAAO,CAAC,CAAC,MAAM,cAAc,CAAC,EAAE,CAAC;IAsDzE,2BAA2B,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAMlG,qBAAqB,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IA0DpD,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAI7C,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAMxG,kBAAkB,CAAC,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,GAAG,IAAI;IAkCxG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,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;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,GAAG,CAAA;SAAE,EAAE,CAAA;KAAE,EAAE,CAAC;IACvE,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;IAClD,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;IACjD,WAAW,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,GAAG,SAAS,CAAC;IAC5D,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,GAAG,SAAS,CAAC;CAC/E;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,IAAI,CAAC;IACzB,eAAe,EAAE,kBAAkB,CAAC;IACpC,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IACJ,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IACJ,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IACJ,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,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;CAwB3F"}
@@ -0,0 +1,136 @@
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
118
+ .map((version) => this.getMajorVersion(version))
119
+ .filter((majorVersion) => majorVersion > 0);
120
+ const versionDetails = await Promise.all(majorVersions.map(async (version) => await this.getAppVersionDetails(environmentKey, version)));
121
+ return versionDetails.map((entry) => ({
122
+ version: entry.appVersion,
123
+ deploymentDateTime: entry.deploymentDateTime,
124
+ environmentType: entry.environmentType,
125
+ egresses: entry.egresses.map((egress) => ({ type: egress.type, count: egress.addresses.length })),
126
+ policies: entry.policies.map((policy) => ({ type: policy.type, count: policy.policies.length })),
127
+ scopes: (entry.scopes.length || 0).toString(),
128
+ connectKeys: (entry.connectKeys?.length || 0).toString(),
129
+ functions: (entry.functions?.length || 0).toString(),
130
+ remotes: (entry.remotes?.length || 0).toString(),
131
+ modules: entry.modules.map((module) => ({ type: module.type, count: module.items.length })),
132
+ requiresLicense: entry.requiresLicense
133
+ }));
134
+ }
135
+ }
136
+ exports.VersionService = VersionService;
@@ -0,0 +1,25 @@
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 AppVersionDetailsClient {
20
+ private readonly graphqlClient;
21
+ constructor(graphqlClient: GraphQLClient);
22
+ getVersionDetails(appId: string, environmentKey: string, majorVersion?: number): Promise<AppVersionDetailsData>;
23
+ getVersionList(appId: string, environmentKey: string): Promise<string[]>;
24
+ }
25
+ //# 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,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;IAqFpB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAuDtF"}
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppVersionDetailsClient = 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 AppVersionDetailsClient {
18
+ graphqlClient;
19
+ constructor(graphqlClient) {
20
+ this.graphqlClient = graphqlClient;
21
+ }
22
+ async getVersionDetails(appId, environmentKey, majorVersion) {
23
+ const query = `
24
+ query forge_cli_getApplicationVersionDetails($appId: ID!, $environmentKey: String!, $firstN: Int!, $majorVersion: Int) {
25
+ app(id: $appId) {
26
+ environmentByKey(key: $environmentKey) {
27
+ type
28
+ versions(first: $firstN, majorVersion: $majorVersion) {
29
+ nodes {
30
+ version
31
+ createdAt
32
+ isLatest
33
+ requiresLicense
34
+ permissions {
35
+ scopes {
36
+ key
37
+ }
38
+ egress {
39
+ type
40
+ addresses
41
+ }
42
+ securityPolicies {
43
+ type
44
+ policies
45
+ }
46
+ }
47
+ extensions {
48
+ nodes {
49
+ id
50
+ key
51
+ extensionData
52
+ }
53
+ }
54
+ storage {
55
+ hosted {
56
+ classifications
57
+ locations
58
+ }
59
+ remotes {
60
+ key
61
+ baseUrl
62
+ classifications
63
+ locations
64
+ }
65
+ }
66
+ migrationKeys {
67
+ jira
68
+ confluence
69
+ }
70
+ }
71
+ }
72
+ }
73
+ }
74
+ }
75
+ `;
76
+ const result = await this.graphqlClient.query(query, {
77
+ appId,
78
+ environmentKey,
79
+ firstN: 1,
80
+ majorVersion
81
+ });
82
+ if (!result.app) {
83
+ throw new MissingAppError();
84
+ }
85
+ if (!result.app.environmentByKey) {
86
+ throw new EnvironmentNotFoundError(environmentKey);
87
+ }
88
+ if (!result.app.environmentByKey.versions?.nodes?.length || !result.app.environmentByKey.versions?.nodes?.[0]) {
89
+ throw new MissingAppVersionError();
90
+ }
91
+ return {
92
+ migrationKeys: result.app.environmentByKey.versions?.nodes?.[0]?.migrationKeys,
93
+ environmentType: result.app.environmentByKey.type,
94
+ appVersion: result.app.environmentByKey.versions?.nodes?.[0]?.version,
95
+ deploymentDateTime: new Date(Number.parseInt(result.app.environmentByKey.versions?.nodes?.[0]?.createdAt)),
96
+ storage: result.app.environmentByKey.versions?.nodes?.[0]?.storage,
97
+ requiresLicense: result.app.environmentByKey.versions?.nodes?.[0]?.requiresLicense,
98
+ permissions: result.app.environmentByKey.versions?.nodes?.[0]?.permissions,
99
+ modules: result.app.environmentByKey.versions?.nodes?.[0]?.extensions?.nodes
100
+ };
101
+ }
102
+ async getVersionList(appId, environmentKey) {
103
+ const query = `
104
+ query forge_cli_getApplicationVersionList($appId: ID!, $first: Int, $after: String) {
105
+ app(id: $appId) {
106
+ environments {
107
+ key
108
+ versions(first: $first, after: $after) {
109
+ nodes {
110
+ version
111
+ }
112
+ pageInfo {
113
+ hasNextPage
114
+ endCursor
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+ `;
121
+ const output = [];
122
+ let cursor = undefined;
123
+ let hasNext = undefined;
124
+ do {
125
+ const result = await this.graphqlClient.query(query, {
126
+ appId,
127
+ first: 20,
128
+ after: cursor
129
+ });
130
+ if (!result.app) {
131
+ throw new MissingAppError();
132
+ }
133
+ if (!result.app.environments) {
134
+ throw new MissingAppVersionError();
135
+ }
136
+ const environment = result.app.environments.filter((env) => env.key === environmentKey)[0];
137
+ cursor = environment?.versions?.pageInfo.endCursor;
138
+ hasNext = environment?.versions?.pageInfo.hasNextPage;
139
+ output.push(...(environment?.versions?.nodes?.map((node) => node?.version) || []).filter((item) => Boolean(item)));
140
+ } while (hasNext && cursor);
141
+ return output;
142
+ }
143
+ }
144
+ exports.AppVersionDetailsClient = AppVersionDetailsClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/cli",
3
- "version": "10.13.4",
3
+ "version": "10.13.5-next.0-experimental-4d5d98e",
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.5",
22
- "@forge/cli-shared": "6.5.2",
21
+ "@forge/bundler": "4.20.6-next.0-experimental-4d5d98e",
22
+ "@forge/cli-shared": "6.5.2-experimental-4d5d98e",
23
23
  "@forge/egress": "1.3.0",
24
- "@forge/lint": "5.6.5",
24
+ "@forge/lint": "5.6.5-experimental-4d5d98e",
25
25
  "@forge/manifest": "8.4.1",
26
26
  "@forge/runtime": "5.10.4",
27
- "@forge/tunnel": "5.8.1",
27
+ "@forge/tunnel": "5.8.2-next.0-experimental-4d5d98e",
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",