@forge/cli 0.0.0-experimental-e8bfa83 → 0.0.0-experimental-c3effe3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/CHANGELOG.md +3781 -7
  2. package/README.md +18 -19
  3. package/npm-shrinkwrap.json +2709 -3555
  4. package/out/analytics-client/analytics-client.d.ts +3 -1
  5. package/out/analytics-client/analytics-client.d.ts.map +1 -1
  6. package/out/analytics-client/analytics-client.js +5 -1
  7. package/out/autocomplete/autocomplete-config.json +24 -20
  8. package/out/autocomplete/isSupportedShell.d.ts +2 -0
  9. package/out/autocomplete/isSupportedShell.d.ts.map +1 -0
  10. package/out/autocomplete/isSupportedShell.js +11 -0
  11. package/out/bin/cli.js +0 -2
  12. package/out/bin/postinstall.js +9 -2
  13. package/out/command-line/anon-user-id.js +6 -10
  14. package/out/command-line/command.d.ts +27 -8
  15. package/out/command-line/command.d.ts.map +1 -1
  16. package/out/command-line/command.js +188 -50
  17. package/out/command-line/controller/autocomplete-controller.d.ts +1 -0
  18. package/out/command-line/controller/autocomplete-controller.d.ts.map +1 -1
  19. package/out/command-line/controller/autocomplete-controller.js +11 -1
  20. package/out/command-line/controller/deploy-controller.d.ts +13 -2
  21. package/out/command-line/controller/deploy-controller.d.ts.map +1 -1
  22. package/out/command-line/controller/deploy-controller.js +79 -5
  23. package/out/command-line/controller/getNodeVersion.d.ts +2 -0
  24. package/out/command-line/controller/getNodeVersion.d.ts.map +1 -0
  25. package/out/command-line/controller/getNodeVersion.js +7 -0
  26. package/out/command-line/controller/install-controller.d.ts +5 -4
  27. package/out/command-line/controller/install-controller.d.ts.map +1 -1
  28. package/out/command-line/controller/install-controller.js +31 -56
  29. package/out/command-line/controller/lint-controller.js +1 -1
  30. package/out/command-line/controller/pre-command-controller.d.ts +8 -1
  31. package/out/command-line/controller/pre-command-controller.d.ts.map +1 -1
  32. package/out/command-line/controller/pre-command-controller.js +22 -2
  33. package/out/command-line/controller/prerequisites-controller.d.ts +11 -0
  34. package/out/command-line/controller/prerequisites-controller.d.ts.map +1 -0
  35. package/out/command-line/controller/prerequisites-controller.js +34 -0
  36. package/out/command-line/controller/settings-controller.d.ts +19 -0
  37. package/out/command-line/controller/settings-controller.d.ts.map +1 -0
  38. package/out/command-line/controller/settings-controller.js +48 -0
  39. package/out/command-line/controller/stubController.d.ts +9 -0
  40. package/out/command-line/controller/stubController.d.ts.map +1 -0
  41. package/out/command-line/controller/stubController.js +15 -0
  42. package/out/command-line/dependency-injection.d.ts +13 -3
  43. package/out/command-line/dependency-injection.d.ts.map +1 -1
  44. package/out/command-line/dependency-injection.js +52 -22
  45. package/out/command-line/index.d.ts.map +1 -1
  46. package/out/command-line/index.js +10 -30
  47. package/out/command-line/register-app-commands.d.ts.map +1 -1
  48. package/out/command-line/register-app-commands.js +2 -12
  49. package/out/command-line/register-authentication-command.d.ts.map +1 -1
  50. package/out/command-line/register-authentication-command.js +1 -16
  51. package/out/command-line/register-deployment-commands.d.ts +8 -0
  52. package/out/command-line/register-deployment-commands.d.ts.map +1 -1
  53. package/out/command-line/register-deployment-commands.js +1 -0
  54. package/out/command-line/register-environment-variables-commands.d.ts +1 -1
  55. package/out/command-line/register-environment-variables-commands.d.ts.map +1 -1
  56. package/out/command-line/register-environment-variables-commands.js +22 -7
  57. package/out/command-line/register-installation-commands.d.ts +4 -1
  58. package/out/command-line/register-installation-commands.d.ts.map +1 -1
  59. package/out/command-line/register-installation-commands.js +39 -23
  60. package/out/command-line/register-providers-commands.d.ts +3 -0
  61. package/out/command-line/register-providers-commands.d.ts.map +1 -0
  62. package/out/command-line/register-providers-commands.js +43 -0
  63. package/out/command-line/register-settings-commands.d.ts +3 -0
  64. package/out/command-line/register-settings-commands.d.ts.map +1 -0
  65. package/out/command-line/register-settings-commands.js +37 -0
  66. package/out/command-line/register-webtrigger-commands.d.ts.map +1 -1
  67. package/out/command-line/register-webtrigger-commands.js +9 -11
  68. package/out/command-line/unique-machine-id.d.ts +1 -0
  69. package/out/command-line/unique-machine-id.d.ts.map +1 -1
  70. package/out/command-line/unique-machine-id.js +3 -12
  71. package/out/command-line/version-info.d.ts +1 -0
  72. package/out/command-line/version-info.d.ts.map +1 -1
  73. package/out/command-line/version-info.js +3 -2
  74. package/out/command-line/view/analytics-settings-view.d.ts +7 -0
  75. package/out/command-line/view/analytics-settings-view.d.ts.map +1 -0
  76. package/out/command-line/view/analytics-settings-view.js +18 -0
  77. package/out/command-line/view/deploy-view.d.ts +7 -1
  78. package/out/command-line/view/deploy-view.d.ts.map +1 -1
  79. package/out/command-line/view/deploy-view.js +25 -3
  80. package/out/command-line/view/install-view.d.ts +5 -3
  81. package/out/command-line/view/install-view.d.ts.map +1 -1
  82. package/out/command-line/view/install-view.js +19 -10
  83. package/out/command-line/view/lint-view.d.ts +3 -2
  84. package/out/command-line/view/lint-view.d.ts.map +1 -1
  85. package/out/command-line/view/lint-view.js +3 -0
  86. package/out/command-line/view/lite-lint-view.d.ts +3 -2
  87. package/out/command-line/view/lite-lint-view.d.ts.map +1 -1
  88. package/out/command-line/view/lite-lint-view.js +3 -0
  89. package/out/command-line/view/settings-view.d.ts +8 -0
  90. package/out/command-line/view/settings-view.d.ts.map +1 -0
  91. package/out/command-line/view/settings-view.js +21 -0
  92. package/out/deploy/deployer/deploy-monitor-graphql-client.js +1 -1
  93. package/out/deploy/deployer/deployer.d.ts.map +1 -1
  94. package/out/deploy/deployer/deployer.js +17 -1
  95. package/out/deploy/deployer/trigger-deploy-graphql-client.d.ts.map +1 -1
  96. package/out/deploy/deployer/trigger-deploy-graphql-client.js +9 -6
  97. package/out/deploy/packager/archiver.d.ts +3 -2
  98. package/out/deploy/packager/archiver.d.ts.map +1 -1
  99. package/out/deploy/packager/archiver.js +10 -2
  100. package/out/deploy/packager/packager.d.ts.map +1 -1
  101. package/out/deploy/packager/packager.js +20 -20
  102. package/out/deploy/uploader/artifact-graphql-client.d.ts.map +1 -1
  103. package/out/deploy/uploader/artifact-graphql-client.js +12 -9
  104. package/out/environment-variables/graphql-client.d.ts +1 -1
  105. package/out/environment-variables/graphql-client.d.ts.map +1 -1
  106. package/out/environment-variables/graphql-client.js +19 -13
  107. package/out/installations/graphql-client.d.ts +19 -13
  108. package/out/installations/graphql-client.d.ts.map +1 -1
  109. package/out/installations/graphql-client.js +161 -56
  110. package/out/installations/install-app-site.d.ts +2 -12
  111. package/out/installations/install-app-site.d.ts.map +1 -1
  112. package/out/installations/install-app-site.js +3 -14
  113. package/out/installations/uninstall-app.d.ts +5 -3
  114. package/out/installations/uninstall-app.d.ts.map +1 -1
  115. package/out/installations/uninstall-app.js +7 -7
  116. package/out/migration-keys/graphql-client.d.ts +8 -0
  117. package/out/migration-keys/graphql-client.d.ts.map +1 -0
  118. package/out/migration-keys/graphql-client.js +55 -0
  119. package/out/providers/configure-provider.d.ts +19 -0
  120. package/out/providers/configure-provider.d.ts.map +1 -0
  121. package/out/providers/configure-provider.js +14 -0
  122. package/out/providers/graphql-client.d.ts +12 -0
  123. package/out/providers/graphql-client.d.ts.map +1 -0
  124. package/out/providers/graphql-client.js +47 -0
  125. package/out/service/cached-config-service.d.ts +8 -0
  126. package/out/service/cached-config-service.d.ts.map +1 -0
  127. package/out/service/cached-config-service.js +16 -0
  128. package/out/service/installation-service.d.ts +13 -13
  129. package/out/service/installation-service.d.ts.map +1 -1
  130. package/out/service/installation-service.js +38 -23
  131. package/out/service/lint-service.d.ts +2 -2
  132. package/out/service/lint-service.d.ts.map +1 -1
  133. package/out/service/lint-service.js +3 -3
  134. package/out/service/lite-lint-service.d.ts +3 -3
  135. package/out/service/lite-lint-service.d.ts.map +1 -1
  136. package/out/service/lite-lint-service.js +2 -2
  137. package/out/service/migration-keys-service.d.ts +19 -0
  138. package/out/service/migration-keys-service.d.ts.map +1 -0
  139. package/out/service/migration-keys-service.js +14 -0
  140. package/out/service/port-finding-service.d.ts +12 -0
  141. package/out/service/port-finding-service.d.ts.map +1 -0
  142. package/out/service/port-finding-service.js +34 -0
  143. package/out/service/resource-packaging-service.d.ts +3 -2
  144. package/out/service/resource-packaging-service.d.ts.map +1 -1
  145. package/out/service/resource-packaging-service.js +6 -2
  146. package/out/service/tunnel-service.d.ts +6 -2
  147. package/out/service/tunnel-service.d.ts.map +1 -1
  148. package/out/service/tunnel-service.js +53 -12
  149. package/out/webtrigger/get-webtrigger-url.d.ts +10 -4
  150. package/out/webtrigger/get-webtrigger-url.d.ts.map +1 -1
  151. package/out/webtrigger/get-webtrigger-url.js +11 -18
  152. package/out/webtrigger/graphql-client.d.ts +14 -0
  153. package/out/webtrigger/graphql-client.d.ts.map +1 -0
  154. package/out/webtrigger/graphql-client.js +52 -0
  155. package/out/workers/analytics-message-worker.d.ts +3 -1
  156. package/out/workers/analytics-message-worker.d.ts.map +1 -1
  157. package/out/workers/analytics-message-worker.js +9 -2
  158. package/out/workers/forge-cli-workers.js +6 -1
  159. package/package.json +17 -17
  160. package/out/bin/preinstall.d.ts +0 -3
  161. package/out/bin/preinstall.d.ts.map +0 -1
  162. package/out/bin/preinstall.js +0 -9
  163. package/out/command-line/cli-prerequisites.d.ts +0 -3
  164. package/out/command-line/cli-prerequisites.d.ts.map +0 -1
  165. package/out/command-line/cli-prerequisites.js +0 -37
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GraphqlClient = exports.MissingAppEnvironmentError = exports.MissingAppError = void 0;
4
+ const cli_shared_1 = require("@forge/cli-shared");
5
+ class MissingAppError extends Error {
6
+ }
7
+ exports.MissingAppError = MissingAppError;
8
+ class MissingAppEnvironmentError extends Error {
9
+ }
10
+ exports.MissingAppEnvironmentError = MissingAppEnvironmentError;
11
+ class GraphqlClient {
12
+ constructor(graphqlClient) {
13
+ this.graphqlClient = graphqlClient;
14
+ }
15
+ async configureProvider(details) {
16
+ const mutation = `
17
+ mutation forge_cli_setExternalAuthCredentials($input: SetExternalAuthCredentialsInput!) {
18
+ setExternalAuthCredentials(input: $input) {
19
+ success
20
+ errors {
21
+ message
22
+ extensions {
23
+ errorType
24
+ }
25
+ }
26
+ }
27
+ }
28
+ `;
29
+ const { response: { setExternalAuthCredentials: { success, errors } }, requestId } = await this.graphqlClient.mutate(mutation, {
30
+ input: {
31
+ environment: {
32
+ appId: details.appId,
33
+ key: details.environment
34
+ },
35
+ serviceKey: details.providerKey,
36
+ credentials: {
37
+ clientSecret: details.clientSecret
38
+ }
39
+ }
40
+ });
41
+ const error = cli_shared_1.getError(errors);
42
+ if (!success) {
43
+ throw new cli_shared_1.GraphQlMutationError(`${error.message} (requestId: ${requestId || 'unknown'})`, error.code);
44
+ }
45
+ }
46
+ }
47
+ exports.GraphqlClient = GraphqlClient;
@@ -0,0 +1,8 @@
1
+ import { CachedConf } from '@forge/cli-shared';
2
+ export declare class CachedConfigService {
3
+ private readonly cachedConf;
4
+ constructor(cachedConf: CachedConf);
5
+ getAnalyticsPreferences(): boolean | undefined;
6
+ setAnalyticsPreferences(preference: boolean): void;
7
+ }
8
+ //# sourceMappingURL=cached-config-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cached-config-service.d.ts","sourceRoot":"","sources":["../../src/service/cached-config-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAE5C,uBAAuB,IAAI,OAAO,GAAG,SAAS;IAI9C,uBAAuB,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI;CAG1D"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CachedConfigService = void 0;
4
+ const ANALYTICS_PREFERENCES_KEY = 'analytics-preferences';
5
+ class CachedConfigService {
6
+ constructor(cachedConf) {
7
+ this.cachedConf = cachedConf;
8
+ }
9
+ getAnalyticsPreferences() {
10
+ return this.cachedConf.get(ANALYTICS_PREFERENCES_KEY);
11
+ }
12
+ setAnalyticsPreferences(preference) {
13
+ this.cachedConf.set(ANALYTICS_PREFERENCES_KEY, preference);
14
+ }
15
+ }
16
+ exports.CachedConfigService = CachedConfigService;
@@ -1,26 +1,26 @@
1
1
  /// <reference types="node" />
2
2
  import { AppConfigProvider, AppEnvironment } from '@forge/cli-shared';
3
- import { AppInstallSiteDetails } from '../installations/install-app-site';
4
3
  import { URL } from 'url';
4
+ import { AppInstallSiteDetails } from '../installations/install-app-site';
5
5
  export interface Installation {
6
6
  id: string;
7
7
  product: string;
8
8
  site: string;
9
9
  environmentKey: string;
10
+ context: string;
10
11
  version: {
11
12
  isLatest: boolean;
12
13
  };
13
14
  }
14
15
  export interface AppInstallation {
15
- name: string;
16
16
  installations: Installation[];
17
17
  }
18
- export interface AppUpgradeResult {
19
- installationId: string;
20
- authorizationUrl?: string | null;
18
+ export interface AppEnvironmentVersionPermissions {
19
+ scopes: string[];
20
+ egressAddresses: string[];
21
21
  }
22
- export interface AlreadyUpgradedResult {
23
- alreadyUpdated: true;
22
+ export interface AppEnvironmentPermissions extends AppEnvironmentVersionPermissions {
23
+ addedScopes: string[];
24
24
  }
25
25
  interface InstallationFilterOptions {
26
26
  site?: string;
@@ -29,10 +29,10 @@ interface InstallationFilterOptions {
29
29
  }
30
30
  export interface ListAppInstallationsClient {
31
31
  listInstallations(appId: string): Promise<Installation[]>;
32
- getScopes(appId: string, environmentKey: string): Promise<AppEnvironment['scopes']>;
32
+ getVersions(appId: string, environmentKey: string, firstN: number): Promise<AppEnvironment['versions']>;
33
33
  }
34
34
  export interface UpgradeAppInstallationsClient {
35
- upgradeInstallation({ site, product, environmentKey, appId }: AppInstallSiteDetails): Promise<AppUpgradeResult>;
35
+ upgradeInstallation({ site, product, environmentKey, appId }: AppInstallSiteDetails): Promise<void>;
36
36
  }
37
37
  export declare class InstallationService {
38
38
  private readonly getAppConfig;
@@ -41,11 +41,11 @@ export declare class InstallationService {
41
41
  constructor(getAppConfig: AppConfigProvider, listInstallationsClient: ListAppInstallationsClient, upgradeAppInstallationsClient: UpgradeAppInstallationsClient);
42
42
  private filterInstallations;
43
43
  listAppInstallations(filter?: InstallationFilterOptions): Promise<AppInstallation>;
44
- listNonIdentityAppInstallations(filter?: InstallationFilterOptions): Promise<AppInstallation>;
44
+ listNonTechnicalAppInstallations(filter?: InstallationFilterOptions): Promise<AppInstallation>;
45
45
  hasOutdatedProductInstallation(environment: string): Promise<boolean>;
46
- private addRedirectUrl;
47
- upgradeInstallation(site: URL, product: string, environmentKey: string, appId: string): Promise<AppUpgradeResult | AlreadyUpgradedResult>;
48
- getScopes(appId: string, environmentKey: string): Promise<string[] | null | undefined>;
46
+ upgradeInstallation(site: URL, product: string, environmentKey: string, appId: string): Promise<boolean>;
47
+ private getPermissionsFromAppEnvironmentVersion;
48
+ getAppEnvironmentPermissions(appId: string, environmentKey: string): Promise<AppEnvironmentPermissions | undefined>;
49
49
  }
50
50
  export {};
51
51
  //# sourceMappingURL=installation-service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"installation-service.d.ts","sourceRoot":"","sources":["../../src/service/installation-service.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EAKjB,cAAc,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAoB,MAAM,mCAAmC,CAAC;AAC5F,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAG1B,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE;QACP,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,YAAY,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/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O,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,gBAAgB,GAAG,qBAAqB,CAAC;IAyBvC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;CAG7D"}
1
+ {"version":3,"file":"installation-service.d.ts","sourceRoot":"","sources":["../../src/service/installation-service.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EAQf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAG1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QACP,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,YAAY,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,gCAAgC;IAC/C,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,yBAA0B,SAAQ,gCAAgC;IACjF,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,UAAU,yBAAyB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,0BAA0B;IACzC,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IAC1D,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;CACzG;AAED,MAAM,WAAW,6BAA6B;IAC5C,mBAAmB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrG;AAKD,qBAAa,mBAAmB;IAE5B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IACxC,OAAO,CAAC,QAAQ,CAAC,6BAA6B;gBAF7B,YAAY,EAAE,iBAAiB,EAC/B,uBAAuB,EAAE,0BAA0B,EACnD,6BAA6B,EAAE,6BAA6B;IAG/E,OAAO,CAAC,mBAAmB;IAiBd,oBAAoB,CAAC,MAAM,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,eAAe,CAAC;IAOlF,gCAAgC,CAAC,MAAM,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,eAAe,CAAC;IAU9F,8BAA8B,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAOrE,mBAAmB,CAC9B,IAAI,EAAE,GAAG,EACT,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,OAAO,CAAC;IAkBnB,OAAO,CAAC,uCAAuC;IAgBlC,4BAA4B,CACvC,KAAK,EAAE,MAAM,EACb,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC;CAyBlD"}
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InstallationService = void 0;
4
4
  const cli_shared_1 = require("@forge/cli-shared");
5
- const install_app_site_1 = require("../installations/install-app-site");
6
- const url_1 = require("url");
5
+ const lodash_1 = require("lodash");
7
6
  const graphql_client_1 = require("../installations/graphql-client");
8
7
  const IDENTITY_PRODUCT_NAME = 'identity';
8
+ const JIRA_SERVICE_DESK_PRODUCT_NAME = 'jira-servicedesk';
9
9
  class InstallationService {
10
10
  constructor(getAppConfig, listInstallationsClient, upgradeAppInstallationsClient) {
11
11
  this.getAppConfig = getAppConfig;
@@ -24,51 +24,66 @@ class InstallationService {
24
24
  });
25
25
  }
26
26
  async listAppInstallations(filter) {
27
- const { id: appId, name } = await this.getAppConfig();
27
+ const { id: appId } = await this.getAppConfig();
28
28
  const installations = await this.listInstallationsClient.listInstallations(appId);
29
- return { name, installations: this.filterInstallations(installations, Object.assign({}, filter)) };
29
+ return { installations: this.filterInstallations(installations, Object.assign({}, filter)) };
30
30
  }
31
- async listNonIdentityAppInstallations(filter) {
32
- const { name, installations } = await this.listAppInstallations(filter);
33
- return { name, installations: installations.filter(({ product }) => product !== IDENTITY_PRODUCT_NAME) };
31
+ async listNonTechnicalAppInstallations(filter) {
32
+ const { installations } = await this.listAppInstallations(filter);
33
+ return {
34
+ installations: installations.filter(({ product }) => product !== IDENTITY_PRODUCT_NAME && product !== JIRA_SERVICE_DESK_PRODUCT_NAME)
35
+ };
34
36
  }
35
37
  async hasOutdatedProductInstallation(environment) {
36
- const { installations } = await this.listNonIdentityAppInstallations({
38
+ const { installations } = await this.listNonTechnicalAppInstallations({
37
39
  environment
38
40
  });
39
41
  return installations.some((installation) => !installation.version.isLatest);
40
42
  }
41
- addRedirectUrl(authorizationUrl) {
42
- const url = new url_1.URL(authorizationUrl);
43
- url.searchParams.append('redirectUrl', install_app_site_1.REDIRECT_URL_3LO);
44
- return url.toString();
45
- }
46
43
  async upgradeInstallation(site, product, environmentKey, appId) {
47
44
  try {
48
- const result = await this.upgradeAppInstallationsClient.upgradeInstallation({
45
+ await this.upgradeAppInstallationsClient.upgradeInstallation({
49
46
  site,
50
47
  product,
51
48
  environmentKey,
52
49
  appId
53
50
  });
54
- if (result.authorizationUrl) {
55
- result.authorizationUrl = this.addRedirectUrl(result.authorizationUrl);
56
- }
57
- return result;
51
+ return false;
58
52
  }
59
53
  catch (e) {
60
54
  if (e.code === graphql_client_1.ALREADY_UPGRADED_CODE) {
61
- return {
62
- alreadyUpdated: true
63
- };
55
+ return true;
64
56
  }
65
57
  else {
66
58
  throw e;
67
59
  }
68
60
  }
69
61
  }
70
- async getScopes(appId, environmentKey) {
71
- return await this.listInstallationsClient.getScopes(appId, environmentKey);
62
+ getPermissionsFromAppEnvironmentVersion(appEnvironmentVersion) {
63
+ const permissions = appEnvironmentVersion === null || appEnvironmentVersion === void 0 ? void 0 : appEnvironmentVersion.permissions[0];
64
+ if (!permissions) {
65
+ return { scopes: [], egressAddresses: [] };
66
+ }
67
+ const scopes = permissions.scopes.map((s) => s.key);
68
+ const egressAddresses = (permissions === null || permissions === void 0 ? void 0 : permissions.egress) ? cli_shared_1.flatMap(permissions.egress, ({ addresses }) => addresses !== null && addresses !== void 0 ? addresses : []) : [];
69
+ return { scopes, egressAddresses };
70
+ }
71
+ async getAppEnvironmentPermissions(appId, environmentKey) {
72
+ const versionDetails = await this.listInstallationsClient.getVersions(appId, environmentKey, 2);
73
+ const versions = versionDetails === null || versionDetails === void 0 ? void 0 : versionDetails.nodes;
74
+ if (!versions || versions.length === 0)
75
+ return;
76
+ const [{ scopes }, oldVersion] = versions.map((appEnvironmentVersion) => this.getPermissionsFromAppEnvironmentVersion(appEnvironmentVersion));
77
+ if (!oldVersion) {
78
+ return {
79
+ scopes,
80
+ egressAddresses: [],
81
+ addedScopes: scopes
82
+ };
83
+ }
84
+ const { scopes: oldScopes } = oldVersion;
85
+ const addedScopes = lodash_1.difference(scopes, oldScopes);
86
+ return { scopes, egressAddresses: [], addedScopes };
72
87
  }
73
88
  }
74
89
  exports.InstallationService = InstallationService;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { ConfigFile, FileSystemReader } from '@forge/cli-shared';
3
- import { LintFixState, LintResult, ProblemCount } from '@forge/lint';
3
+ import { LintFixState, LintResult, LintLogger, ProblemCount } from '@forge/lint';
4
4
  interface LintOptions {
5
5
  fix?: boolean;
6
6
  }
@@ -13,7 +13,7 @@ export declare class LintService {
13
13
  private readonly configFile;
14
14
  private readonly fileSystemReader;
15
15
  constructor(configFile: ConfigFile, fileSystemReader: FileSystemReader);
16
- run(environment: string, { fix }: LintOptions, directory?: string, lintFunction?: (filesToLint: string[], manifest: import("@forge/manifest").ManifestSchema, environment: string, parseFunction?: ((filepath: string, parser: (code: string, ...args: any[]) => Promise<import("@forge/lint").ASTParseResult>, readFilePromise?: typeof import("fs").readFile.__promisify__ | undefined) => Promise<import("@forge/lint").LintInput>) | undefined, linters?: import("@forge/lint").LinterInterface[] | undefined) => Promise<LintResult[]>): Promise<RunResult>;
16
+ run(environment: string, { fix }: LintOptions, logger: LintLogger, directory?: string, lintFunction?: (filesToLint: string[], manifest: import("@forge/manifest").ManifestSchema, environment: string, logger: Pick<import("@forge/cli-shared/src").Logger, "info">, parseFunction?: ((filepath: string, parser: (code: string, filepath: string, parseOptions?: Partial<import("@forge/lint").ParseOptions> | undefined) => Promise<import("@forge/lint").ASTParseResult>, readFilePromise?: typeof import("fs").readFile.__promisify__ | undefined) => Promise<import("@forge/lint").LintInput>) | undefined, linters?: import("@forge/lint").LinterInterface[] | undefined) => Promise<LintResult[]>): Promise<RunResult>;
17
17
  private fix;
18
18
  problemCount(lintResults: LintResult[]): ProblemCount;
19
19
  private failedScopesFromLintResult;
@@ -1 +1 @@
1
- {"version":3,"file":"lint-service.d.ts","sourceRoot":"","sources":["../../src/service/lint-service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAEL,YAAY,EACZ,UAAU,EAGV,YAAY,EACb,MAAM,aAAa,CAAC;AAErB,UAAU,WAAW;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,UAAU,SAAS;IACjB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,UAAU,CA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AClB,OAAO,CAAC,SAAS,CAAC;YAYP,GAAG;IASV,YAAY,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,YAAY;IAI5D,OAAO,CAAC,0BAA0B;IAI3B,YAAY,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE;CAOzD"}
@@ -9,10 +9,10 @@ class LintService {
9
9
  this.configFile = configFile;
10
10
  this.fileSystemReader = fileSystemReader;
11
11
  }
12
- async run(environment, { fix }, directory = exports.DEFAULT_DIRECTORY, lintFunction = lint_1.lint) {
12
+ async run(environment, { fix }, logger, directory = exports.DEFAULT_DIRECTORY, lintFunction = lint_1.lint) {
13
13
  const exclude = [...(await cli_shared_1.listGitIgnoreFiles(this.fileSystemReader)), '.git', 'node_modules'];
14
14
  const filesToLint = await this.fileSystemReader.recursiveReadDir(directory, exclude);
15
- const lintResults = await lintFunction(filesToLint, await this.configFile.readConfig(), environment);
15
+ const lintResults = await lintFunction(filesToLint, await this.configFile.readConfig(), environment, logger);
16
16
  if (fix) {
17
17
  return { lintResults, fixResults: await this.fix(lintResults) };
18
18
  }
@@ -26,7 +26,7 @@ class LintService {
26
26
  return lint_1.problemCount(lintResults);
27
27
  }
28
28
  failedScopesFromLintResult({ errors, warnings }) {
29
- return Array.from(lint_1.findMissingScopes(errors, warnings));
29
+ return Array.from(lint_1.findMissingPermissions(errors, warnings, 'missingPermission'));
30
30
  }
31
31
  failedScopes(lintResults) {
32
32
  return lintResults.reduce((acc, lintResult) => {
@@ -1,9 +1,9 @@
1
- import { LintResult } from '@forge/lint';
1
+ import { LintLogger, LintResult } from '@forge/lint';
2
2
  export declare class LiteLintService {
3
3
  private readonly lintService;
4
4
  private readonly problemCounter;
5
- constructor(lintService?: (linter?: import("@forge/lint").LinterInterface | undefined) => Promise<LintResult[]>, problemCounter?: (lintResults: LintResult[]) => import("@forge/lint").ProblemCount);
6
- run(checkSchema: boolean): Promise<LintResult[]>;
5
+ constructor(lintService?: (logger: Pick<import("@forge/cli-shared/src").Logger, "info">, linter?: import("@forge/lint").LinterInterface | undefined) => Promise<LintResult[]>, problemCounter?: (lintResults: LintResult[]) => import("@forge/lint").ProblemCount);
6
+ run(checkSchema: boolean, logger: LintLogger): Promise<LintResult[]>;
7
7
  private filterResults;
8
8
  hasErrors(report: LintResult[]): boolean;
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"lite-lint-service.d.ts","sourceRoot":"","sources":["../../src/service/lite-lint-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,UAAU,EAAE,MAAM,aAAa,CAAC;AAGjE,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,WAAW;IAAa,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAvD,WAAW,wFAAW,EAAmB,cAAc,oEAAe;IAEtF,GAAG,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAK7D,OAAO,CAAC,aAAa;IASd,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO;CAGhD"}
1
+ {"version":3,"file":"lite-lint-service.d.ts","sourceRoot":"","sources":["../../src/service/lite-lint-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,UAAU,EAAgB,UAAU,EAAE,MAAM,aAAa,CAAC;AAG7E,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,WAAW;IAAa,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAvD,WAAW,sJAAW,EAAmB,cAAc,oEAAe;IAEtF,GAAG,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAKjF,OAAO,CAAC,aAAa;IASd,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO;CAGhD"}
@@ -8,8 +8,8 @@ class LiteLintService {
8
8
  this.lintService = lintService;
9
9
  this.problemCounter = problemCounter;
10
10
  }
11
- async run(checkSchema) {
12
- const report = await this.lintService();
11
+ async run(checkSchema, logger) {
12
+ const report = await this.lintService(logger);
13
13
  return this.filterResults(report, checkSchema);
14
14
  }
15
15
  filterResults(report, checkSchema) {
@@ -0,0 +1,19 @@
1
+ import { AppConfigProvider } from 'packages/forge-cli-shared/src/apps';
2
+ export declare type MigrationKeys = {
3
+ jira?: string;
4
+ confluence?: string;
5
+ };
6
+ export interface AppEnvironmentMigrationKeys {
7
+ migrationKeys?: MigrationKeys | null;
8
+ mpacAppKey?: string | null;
9
+ }
10
+ export interface GetMigrationKeysClient {
11
+ getLatestMigrationKeys(appId: string, environmentKey: string): Promise<AppEnvironmentMigrationKeys>;
12
+ }
13
+ export declare class MigrationKeysService {
14
+ private readonly migrationKeysClient;
15
+ private readonly getAppConfig;
16
+ constructor(migrationKeysClient: GetMigrationKeysClient, getAppConfig: AppConfigProvider);
17
+ getMigrationKeysForAppEnvironment(environmentKey: string): Promise<AppEnvironmentMigrationKeys>;
18
+ }
19
+ //# sourceMappingURL=migration-keys-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-keys-service.d.ts","sourceRoot":"","sources":["../../src/service/migration-keys-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,oBAAY,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AACF,MAAM,WAAW,2BAA2B;IAC1C,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AACD,MAAM,WAAW,sBAAsB;IACrC,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;CACrG;AAED,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,YAAY;gBADZ,mBAAmB,EAAE,sBAAsB,EAC3C,YAAY,EAAE,iBAAiB;IAGrC,iCAAiC,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAI7G"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MigrationKeysService = void 0;
4
+ class MigrationKeysService {
5
+ constructor(migrationKeysClient, getAppConfig) {
6
+ this.migrationKeysClient = migrationKeysClient;
7
+ this.getAppConfig = getAppConfig;
8
+ }
9
+ async getMigrationKeysForAppEnvironment(environmentKey) {
10
+ const { id: appId } = await this.getAppConfig();
11
+ return await this.migrationKeysClient.getLatestMigrationKeys(appId, environmentKey);
12
+ }
13
+ }
14
+ exports.MigrationKeysService = MigrationKeysService;
@@ -0,0 +1,12 @@
1
+ import { ConfigFile } from '@forge/cli-shared';
2
+ export interface PortFindingService {
3
+ findPorts(minPort?: number): Promise<Record<string, number>>;
4
+ findPortAfter(portsTaken: number[]): Promise<number | undefined>;
5
+ }
6
+ export declare class ConfigFilePortFindingService implements PortFindingService {
7
+ private readonly configFile;
8
+ constructor(configFile: ConfigFile);
9
+ findPorts(minPort?: number): Promise<Record<string, number>>;
10
+ findPortAfter(portsTaken: number[]): Promise<number | undefined>;
11
+ }
12
+ //# sourceMappingURL=port-finding-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"port-finding-service.d.ts","sourceRoot":"","sources":["../../src/service/port-finding-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAM/C,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7D,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAClE;AAED,qBAAa,4BAA6B,YAAW,kBAAkB;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEtC,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAuB5D,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAM9E"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConfigFilePortFindingService = void 0;
4
+ const portfinder_1 = require("portfinder");
5
+ const util_1 = require("util");
6
+ const getPortsPromise = util_1.promisify(portfinder_1.getPorts);
7
+ class ConfigFilePortFindingService {
8
+ constructor(configFile) {
9
+ this.configFile = configFile;
10
+ }
11
+ async findPorts(minPort) {
12
+ const resources = await this.configFile.getResources();
13
+ const resourceKeys = resources.map((resource) => resource.key);
14
+ if (!resourceKeys.length)
15
+ return {};
16
+ const portOptions = {};
17
+ if (minPort) {
18
+ portOptions['port'] = minPort + 1;
19
+ }
20
+ const ports = await getPortsPromise(resourceKeys.length, portOptions);
21
+ const portMap = {};
22
+ resourceKeys.forEach((resourceKey, idx) => {
23
+ portMap[resourceKey] = ports[idx];
24
+ });
25
+ return portMap;
26
+ }
27
+ async findPortAfter(portsTaken) {
28
+ if (!portsTaken.length)
29
+ return undefined;
30
+ const max = Math.max(...portsTaken);
31
+ return (await getPortsPromise(1, { port: max + 1 }))[0];
32
+ }
33
+ }
34
+ exports.ConfigFilePortFindingService = ConfigFilePortFindingService;
@@ -1,5 +1,5 @@
1
1
  import { Modules } from '@forge/manifest';
2
- import { FileSystemReader, ResourceDetails, BridgeScriptService } from '@forge/cli-shared';
2
+ import { FileSystemReader, ResourceDetails, BridgeScriptService, IframeResizerScriptService } from '@forge/cli-shared';
3
3
  import { Archiver } from '../deploy';
4
4
  export declare class ResourceDirectoryMissingError extends Error {
5
5
  constructor(key: string, dir: string);
@@ -33,7 +33,8 @@ export declare class ResourcePackagingService {
33
33
  private readonly fileSystemReader;
34
34
  private readonly appDir;
35
35
  private readonly bridgeScriptService;
36
- constructor(archiverFactory: () => Archiver, fileSystemReader: FileSystemReader, appDir: string, bridgeScriptService: BridgeScriptService);
36
+ private readonly iframeResizerScriptService;
37
+ constructor(archiverFactory: () => Archiver, fileSystemReader: FileSystemReader, appDir: string, bridgeScriptService: BridgeScriptService, iframeResizerScriptService: IframeResizerScriptService);
37
38
  private getResourcesInformation;
38
39
  private transformRelativeResourcePathsToAbsolute;
39
40
  private processFile;
@@ -1 +1 @@
1
- {"version":3,"file":"resource-packaging-service.d.ts","sourceRoot":"","sources":["../../src/service/resource-packaging-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAsB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC/G,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAKrC,qBAAa,6BAA8B,SAAQ,KAAK;gBAC1C,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;CAGrC;AAED,qBAAa,2BAA4B,SAAQ,KAAK;gBACxC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;CAGrC;AAeD,MAAM,WAAW,gBAAgB;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,qBAAa,4BAA6B,SAAQ,KAAK;;CAItD;AAED,qBAAa,0BAA2B,SAAQ,KAAK;;CAIpD;AAED,qBAAa,kCAAmC,SAAQ,KAAK;gBAC/C,WAAW,EAAE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AAE,CAAC;QACrB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,qBAAa,4BAA6B,SAAQ,KAAK;;CAItD;AAED,qBAAa,0BAA2B,SAAQ,KAAK;;CAIpD;AAED,qBAAa,kCAAmC,SAAQ,KAAK;gBAC/C,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAGnD;AAED,qBAAa,oCAAqC,SAAQ,KAAK;gBACjD,WAAW,EAAE,MAAM;CAGhC;AAED,qBAAa,wBAAwB;IAEjC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,0BAA0B;gBAJ1B,eAAe,EAAE,MAAM,QAAQ,EAC/B,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,MAAM,EACd,mBAAmB,EAAE,mBAAmB,EACxC,0BAA0B,EAAE,0BAA0B;YAG3D,uBAAuB;IAerC,OAAO,CAAC,wCAAwC;IAIhD,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,wBAAwB;IAMhC,OAAO,CAAC,iCAAiC;YAM3B,qBAAqB;IAatB,YAAY,CAAC,SAAS,EAAE,eAAe,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAiCtG"}
@@ -42,11 +42,12 @@ class DetailedMalformedHtmlEntrypointError extends Error {
42
42
  }
43
43
  exports.DetailedMalformedHtmlEntrypointError = DetailedMalformedHtmlEntrypointError;
44
44
  class ResourcePackagingService {
45
- constructor(archiverFactory, fileSystemReader, appDir, bridgeScriptService) {
45
+ constructor(archiverFactory, fileSystemReader, appDir, bridgeScriptService, iframeResizerScriptService) {
46
46
  this.archiverFactory = archiverFactory;
47
47
  this.fileSystemReader = fileSystemReader;
48
48
  this.appDir = appDir;
49
49
  this.bridgeScriptService = bridgeScriptService;
50
+ this.iframeResizerScriptService = iframeResizerScriptService;
50
51
  }
51
52
  async getResourcesInformation(resources) {
52
53
  return await Promise.all(resources.map(async ({ key, directory, resourceType }) => {
@@ -65,7 +66,10 @@ class ResourcePackagingService {
65
66
  }
66
67
  processFile(filePath, content) {
67
68
  if (filePath === CUSTOM_UI_ENTRYPOINT) {
68
- return this.bridgeScriptService.injectBridgeCore(content, () => {
69
+ const contentWithIframeResizerScript = this.iframeResizerScriptService.injectIframeResizer(content, () => {
70
+ throw new MalformedHtmlEntrypointError();
71
+ });
72
+ return this.bridgeScriptService.injectBridgeCore(contentWithIframeResizerScript, () => {
69
73
  throw new MalformedHtmlEntrypointError();
70
74
  });
71
75
  }
@@ -1,6 +1,7 @@
1
1
  import { HiddenError, PersonalApiCredentialsValidated } from '@forge/cli-shared';
2
2
  import { spawn } from 'cross-spawn';
3
3
  import { DockerService } from './docker-service';
4
+ import { ConfigFilePortFindingService } from './port-finding-service';
4
5
  import { TunnelAnalyticsService } from './tunnel-analytics-service';
5
6
  export interface TunnelOptions {
6
7
  debug?: boolean;
@@ -10,9 +11,12 @@ export declare const IMAGE_NAME: string;
10
11
  export declare class HiddenDockerTunnelError extends HiddenError {
11
12
  }
12
13
  export declare abstract class TunnelService {
14
+ protected readonly configFilePortFindingService: ConfigFilePortFindingService;
15
+ constructor(configFilePortFindingService: ConfigFilePortFindingService);
13
16
  abstract run(tunnelOptions: TunnelOptions, creds: PersonalApiCredentialsValidated, debugEnabled: boolean, onError?: (err: Error) => void): Promise<void>;
14
17
  protected getDockerOptions(tunnelOptions: TunnelOptions, debugEnabled: boolean, { email, token }: PersonalApiCredentialsValidated): Promise<string[]>;
15
- protected getPortOptions(port: number): string[];
18
+ protected getPortOptions(port: number, resourcePorts: Record<string, number>, cspReporterPort: number | undefined): string[];
19
+ protected getResourcePortEnvVarOption(resourcePorts: Record<string, number>): string[];
16
20
  protected getUserEnvironmentVariablesOptions(): string[];
17
21
  protected addEnvVarsForLocalTunnel(env: {
18
22
  [key: string]: string;
@@ -33,7 +37,7 @@ export declare class LocalTunnelService extends TunnelService {
33
37
  export declare class DockerTunnelService extends TunnelService {
34
38
  private readonly dockerService;
35
39
  private readonly analyticsService;
36
- constructor(dockerService: DockerService, analyticsService: TunnelAnalyticsService);
40
+ constructor(configFilePortFindingService: ConfigFilePortFindingService, dockerService: DockerService, analyticsService: TunnelAnalyticsService);
37
41
  run(tunnelOptions: TunnelOptions, creds: {
38
42
  email: string;
39
43
  token: string;
@@ -1 +1 @@
1
- {"version":3,"file":"tunnel-service.d.ts","sourceRoot":"","sources":["../../src/service/tunnel-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,WAAW,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAMpC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAKD,eAAO,MAAM,cAAc,wBAAwB,CAAC;AAcpD,eAAO,MAAM,UAAU,QAEuB,CAAC;AAE/C,qBAAa,uBAAwB,SAAQ,WAAW;CAAG;AAE3D,8BAAsB,aAAa;aACjB,GAAG,CACjB,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,+BAA+B,EACtC,YAAY,EAAE,OAAO,EACrB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,GAC7B,OAAO,CAAC,IAAI,CAAC;cAEA,gBAAgB,CAC9B,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,OAAO,EACrB,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,+BAA+B,GAChD,OAAO,CAAC,MAAM,EAAE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