@forge/cli 0.0.0-experimental-a9f00a0 → 0.0.0-experimental-2b3dfe1

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 (261) hide show
  1. package/CHANGELOG.md +1 -9
  2. package/npm-shrinkwrap.json +31 -2432
  3. package/out/autocomplete/autocomplete-config.json +2 -242
  4. package/out/bin/cli.d.ts +0 -1
  5. package/out/bin/cli.d.ts.map +1 -1
  6. package/out/bin/cli.js +1 -4
  7. package/out/bin/postinstall.d.ts +0 -1
  8. package/out/bin/postinstall.js +1 -9
  9. package/package.json +2 -5
  10. package/out/command-line/anon-user-id.d.ts +0 -3
  11. package/out/command-line/anon-user-id.d.ts.map +0 -1
  12. package/out/command-line/anon-user-id.js +0 -17
  13. package/out/command-line/command.d.ts +0 -79
  14. package/out/command-line/command.d.ts.map +0 -1
  15. package/out/command-line/command.js +0 -348
  16. package/out/command-line/controller/assertUnreachable.d.ts +0 -2
  17. package/out/command-line/controller/assertUnreachable.d.ts.map +0 -1
  18. package/out/command-line/controller/assertUnreachable.js +0 -7
  19. package/out/command-line/controller/autocomplete-controller.d.ts +0 -12
  20. package/out/command-line/controller/autocomplete-controller.d.ts.map +0 -1
  21. package/out/command-line/controller/autocomplete-controller.js +0 -54
  22. package/out/command-line/controller/deploy-controller.d.ts +0 -43
  23. package/out/command-line/controller/deploy-controller.d.ts.map +0 -1
  24. package/out/command-line/controller/deploy-controller.js +0 -139
  25. package/out/command-line/controller/feedback-controller.d.ts +0 -9
  26. package/out/command-line/controller/feedback-controller.d.ts.map +0 -1
  27. package/out/command-line/controller/feedback-controller.js +0 -19
  28. package/out/command-line/controller/getNodeVersion.d.ts +0 -2
  29. package/out/command-line/controller/getNodeVersion.d.ts.map +0 -1
  30. package/out/command-line/controller/getNodeVersion.js +0 -7
  31. package/out/command-line/controller/install-controller.d.ts +0 -35
  32. package/out/command-line/controller/install-controller.d.ts.map +0 -1
  33. package/out/command-line/controller/install-controller.js +0 -154
  34. package/out/command-line/controller/lint-controller.d.ts +0 -9
  35. package/out/command-line/controller/lint-controller.d.ts.map +0 -1
  36. package/out/command-line/controller/lint-controller.js +0 -20
  37. package/out/command-line/controller/pre-command-controller.d.ts +0 -25
  38. package/out/command-line/controller/pre-command-controller.d.ts.map +0 -1
  39. package/out/command-line/controller/pre-command-controller.js +0 -57
  40. package/out/command-line/controller/prerequisites-controller.d.ts +0 -11
  41. package/out/command-line/controller/prerequisites-controller.d.ts.map +0 -1
  42. package/out/command-line/controller/prerequisites-controller.js +0 -34
  43. package/out/command-line/controller/settings-controller.d.ts +0 -19
  44. package/out/command-line/controller/settings-controller.d.ts.map +0 -1
  45. package/out/command-line/controller/settings-controller.js +0 -48
  46. package/out/command-line/controller/stubController.d.ts +0 -9
  47. package/out/command-line/controller/stubController.d.ts.map +0 -1
  48. package/out/command-line/controller/stubController.js +0 -15
  49. package/out/command-line/controller/tunnel-controller.d.ts +0 -14
  50. package/out/command-line/controller/tunnel-controller.d.ts.map +0 -1
  51. package/out/command-line/controller/tunnel-controller.js +0 -42
  52. package/out/command-line/dependency-injection.d.ts +0 -69
  53. package/out/command-line/dependency-injection.d.ts.map +0 -1
  54. package/out/command-line/dependency-injection.js +0 -186
  55. package/out/command-line/environment.d.ts +0 -2
  56. package/out/command-line/environment.d.ts.map +0 -1
  57. package/out/command-line/environment.js +0 -15
  58. package/out/command-line/errors.d.ts +0 -6
  59. package/out/command-line/errors.d.ts.map +0 -1
  60. package/out/command-line/errors.js +0 -12
  61. package/out/command-line/index.d.ts +0 -5
  62. package/out/command-line/index.d.ts.map +0 -1
  63. package/out/command-line/index.js +0 -66
  64. package/out/command-line/register-app-commands.d.ts +0 -10
  65. package/out/command-line/register-app-commands.d.ts.map +0 -1
  66. package/out/command-line/register-app-commands.js +0 -128
  67. package/out/command-line/register-authentication-command.d.ts +0 -16
  68. package/out/command-line/register-authentication-command.d.ts.map +0 -1
  69. package/out/command-line/register-authentication-command.js +0 -92
  70. package/out/command-line/register-autocomplete-commands.d.ts +0 -3
  71. package/out/command-line/register-autocomplete-commands.d.ts.map +0 -1
  72. package/out/command-line/register-autocomplete-commands.js +0 -13
  73. package/out/command-line/register-deployment-commands.d.ts +0 -22
  74. package/out/command-line/register-deployment-commands.d.ts.map +0 -1
  75. package/out/command-line/register-deployment-commands.js +0 -15
  76. package/out/command-line/register-environment-variables-commands.d.ts +0 -3
  77. package/out/command-line/register-environment-variables-commands.d.ts.map +0 -1
  78. package/out/command-line/register-environment-variables-commands.js +0 -99
  79. package/out/command-line/register-feedback-commands.d.ts +0 -3
  80. package/out/command-line/register-feedback-commands.d.ts.map +0 -1
  81. package/out/command-line/register-feedback-commands.js +0 -31
  82. package/out/command-line/register-installation-commands.d.ts +0 -6
  83. package/out/command-line/register-installation-commands.d.ts.map +0 -1
  84. package/out/command-line/register-installation-commands.js +0 -140
  85. package/out/command-line/register-lint-command.d.ts +0 -8
  86. package/out/command-line/register-lint-command.d.ts.map +0 -1
  87. package/out/command-line/register-lint-command.js +0 -15
  88. package/out/command-line/register-log-commands.d.ts +0 -4
  89. package/out/command-line/register-log-commands.d.ts.map +0 -1
  90. package/out/command-line/register-log-commands.js +0 -138
  91. package/out/command-line/register-providers-commands.d.ts +0 -3
  92. package/out/command-line/register-providers-commands.d.ts.map +0 -1
  93. package/out/command-line/register-providers-commands.js +0 -43
  94. package/out/command-line/register-settings-commands.d.ts +0 -3
  95. package/out/command-line/register-settings-commands.d.ts.map +0 -1
  96. package/out/command-line/register-settings-commands.js +0 -37
  97. package/out/command-line/register-tunnel-commands.d.ts +0 -3
  98. package/out/command-line/register-tunnel-commands.d.ts.map +0 -1
  99. package/out/command-line/register-tunnel-commands.js +0 -14
  100. package/out/command-line/register-webtrigger-commands.d.ts +0 -3
  101. package/out/command-line/register-webtrigger-commands.d.ts.map +0 -1
  102. package/out/command-line/register-webtrigger-commands.js +0 -55
  103. package/out/command-line/unique-machine-id.d.ts +0 -3
  104. package/out/command-line/unique-machine-id.d.ts.map +0 -1
  105. package/out/command-line/unique-machine-id.js +0 -18
  106. package/out/command-line/version-info.d.ts +0 -8
  107. package/out/command-line/version-info.d.ts.map +0 -1
  108. package/out/command-line/version-info.js +0 -34
  109. package/out/command-line/view/analytics-settings-view.d.ts +0 -7
  110. package/out/command-line/view/analytics-settings-view.d.ts.map +0 -1
  111. package/out/command-line/view/analytics-settings-view.js +0 -18
  112. package/out/command-line/view/deploy-view.d.ts +0 -21
  113. package/out/command-line/view/deploy-view.d.ts.map +0 -1
  114. package/out/command-line/view/deploy-view.js +0 -57
  115. package/out/command-line/view/install-view.d.ts +0 -18
  116. package/out/command-line/view/install-view.d.ts.map +0 -1
  117. package/out/command-line/view/install-view.js +0 -55
  118. package/out/command-line/view/lint-view.d.ts +0 -12
  119. package/out/command-line/view/lint-view.d.ts.map +0 -1
  120. package/out/command-line/view/lint-view.js +0 -31
  121. package/out/command-line/view/lite-lint-view.d.ts +0 -10
  122. package/out/command-line/view/lite-lint-view.d.ts.map +0 -1
  123. package/out/command-line/view/lite-lint-view.js +0 -18
  124. package/out/command-line/view/settings-view.d.ts +0 -8
  125. package/out/command-line/view/settings-view.d.ts.map +0 -1
  126. package/out/command-line/view/settings-view.js +0 -21
  127. package/out/command-line/view/tunnel-view.d.ts +0 -18
  128. package/out/command-line/view/tunnel-view.d.ts.map +0 -1
  129. package/out/command-line/view/tunnel-view.js +0 -89
  130. package/out/deploy/deployer/deploy-monitor-graphql-client.d.ts +0 -24
  131. package/out/deploy/deployer/deploy-monitor-graphql-client.d.ts.map +0 -1
  132. package/out/deploy/deployer/deploy-monitor-graphql-client.js +0 -57
  133. package/out/deploy/deployer/deployer.d.ts +0 -31
  134. package/out/deploy/deployer/deployer.d.ts.map +0 -1
  135. package/out/deploy/deployer/deployer.js +0 -154
  136. package/out/deploy/deployer/index.d.ts +0 -4
  137. package/out/deploy/deployer/index.d.ts.map +0 -1
  138. package/out/deploy/deployer/index.js +0 -6
  139. package/out/deploy/deployer/trigger-deploy-graphql-client.d.ts +0 -19
  140. package/out/deploy/deployer/trigger-deploy-graphql-client.d.ts.map +0 -1
  141. package/out/deploy/deployer/trigger-deploy-graphql-client.js +0 -45
  142. package/out/deploy/index.d.ts +0 -5
  143. package/out/deploy/index.d.ts.map +0 -1
  144. package/out/deploy/index.js +0 -7
  145. package/out/deploy/package-upload-deploy.d.ts +0 -18
  146. package/out/deploy/package-upload-deploy.d.ts.map +0 -1
  147. package/out/deploy/package-upload-deploy.js +0 -28
  148. package/out/deploy/packager/archiver.d.ts +0 -24
  149. package/out/deploy/packager/archiver.d.ts.map +0 -1
  150. package/out/deploy/packager/archiver.js +0 -62
  151. package/out/deploy/packager/index.d.ts +0 -3
  152. package/out/deploy/packager/index.d.ts.map +0 -1
  153. package/out/deploy/packager/index.js +0 -5
  154. package/out/deploy/packager/packager.d.ts +0 -33
  155. package/out/deploy/packager/packager.d.ts.map +0 -1
  156. package/out/deploy/packager/packager.js +0 -38
  157. package/out/deploy/uploader/artifact-graphql-client.d.ts +0 -26
  158. package/out/deploy/uploader/artifact-graphql-client.d.ts.map +0 -1
  159. package/out/deploy/uploader/artifact-graphql-client.js +0 -92
  160. package/out/deploy/uploader/index.d.ts +0 -3
  161. package/out/deploy/uploader/index.d.ts.map +0 -1
  162. package/out/deploy/uploader/index.js +0 -5
  163. package/out/deploy/uploader/uploader.d.ts +0 -19
  164. package/out/deploy/uploader/uploader.d.ts.map +0 -1
  165. package/out/deploy/uploader/uploader.js +0 -43
  166. package/out/environment-variables/delete-environment-variable.d.ts +0 -18
  167. package/out/environment-variables/delete-environment-variable.d.ts.map +0 -1
  168. package/out/environment-variables/delete-environment-variable.js +0 -14
  169. package/out/environment-variables/graphql-client.d.ts +0 -16
  170. package/out/environment-variables/graphql-client.d.ts.map +0 -1
  171. package/out/environment-variables/graphql-client.js +0 -105
  172. package/out/environment-variables/list-environment-variables.d.ts +0 -22
  173. package/out/environment-variables/list-environment-variables.d.ts.map +0 -1
  174. package/out/environment-variables/list-environment-variables.js +0 -14
  175. package/out/environment-variables/set-environment-variable.d.ts +0 -20
  176. package/out/environment-variables/set-environment-variable.d.ts.map +0 -1
  177. package/out/environment-variables/set-environment-variable.js +0 -14
  178. package/out/installations/graphql-client.d.ts +0 -59
  179. package/out/installations/graphql-client.d.ts.map +0 -1
  180. package/out/installations/graphql-client.js +0 -346
  181. package/out/installations/install-app-site.d.ts +0 -21
  182. package/out/installations/install-app-site.d.ts.map +0 -1
  183. package/out/installations/install-app-site.js +0 -19
  184. package/out/installations/shared.d.ts +0 -5
  185. package/out/installations/shared.d.ts.map +0 -1
  186. package/out/installations/shared.js +0 -19
  187. package/out/installations/uninstall-app.d.ts +0 -25
  188. package/out/installations/uninstall-app.d.ts.map +0 -1
  189. package/out/installations/uninstall-app.js +0 -43
  190. package/out/migration-keys/graphql-client.d.ts +0 -8
  191. package/out/migration-keys/graphql-client.d.ts.map +0 -1
  192. package/out/migration-keys/graphql-client.js +0 -55
  193. package/out/providers/configure-provider.d.ts +0 -19
  194. package/out/providers/configure-provider.d.ts.map +0 -1
  195. package/out/providers/configure-provider.js +0 -14
  196. package/out/providers/graphql-client.d.ts +0 -12
  197. package/out/providers/graphql-client.d.ts.map +0 -1
  198. package/out/providers/graphql-client.js +0 -47
  199. package/out/service/cached-config-service.d.ts +0 -8
  200. package/out/service/cached-config-service.d.ts.map +0 -1
  201. package/out/service/cached-config-service.js +0 -16
  202. package/out/service/command-suggestion-service.d.ts +0 -4
  203. package/out/service/command-suggestion-service.d.ts.map +0 -1
  204. package/out/service/command-suggestion-service.js +0 -17
  205. package/out/service/docker-service.d.ts +0 -24
  206. package/out/service/docker-service.d.ts.map +0 -1
  207. package/out/service/docker-service.js +0 -71
  208. package/out/service/installation-service.d.ts +0 -51
  209. package/out/service/installation-service.d.ts.map +0 -1
  210. package/out/service/installation-service.js +0 -89
  211. package/out/service/lint-service.d.ts +0 -23
  212. package/out/service/lint-service.d.ts.map +0 -1
  213. package/out/service/lint-service.js +0 -39
  214. package/out/service/lite-lint-service.d.ts +0 -10
  215. package/out/service/lite-lint-service.d.ts.map +0 -1
  216. package/out/service/lite-lint-service.js +0 -27
  217. package/out/service/migration-keys-service.d.ts +0 -19
  218. package/out/service/migration-keys-service.d.ts.map +0 -1
  219. package/out/service/migration-keys-service.js +0 -14
  220. package/out/service/port-finding-service.d.ts +0 -12
  221. package/out/service/port-finding-service.d.ts.map +0 -1
  222. package/out/service/port-finding-service.js +0 -34
  223. package/out/service/resource-packaging-service.d.ts +0 -46
  224. package/out/service/resource-packaging-service.d.ts.map +0 -1
  225. package/out/service/resource-packaging-service.js +0 -128
  226. package/out/service/resources-uploader-service.d.ts +0 -16
  227. package/out/service/resources-uploader-service.d.ts.map +0 -1
  228. package/out/service/resources-uploader-service.js +0 -34
  229. package/out/service/tunnel-analytics-service.d.ts +0 -6
  230. package/out/service/tunnel-analytics-service.d.ts.map +0 -1
  231. package/out/service/tunnel-analytics-service.js +0 -13
  232. package/out/service/tunnel-service.d.ts +0 -47
  233. package/out/service/tunnel-service.d.ts.map +0 -1
  234. package/out/service/tunnel-service.js +0 -187
  235. package/out/webtrigger/get-webtrigger-url.d.ts +0 -27
  236. package/out/webtrigger/get-webtrigger-url.d.ts.map +0 -1
  237. package/out/webtrigger/get-webtrigger-url.js +0 -23
  238. package/out/webtrigger/graphql-client.d.ts +0 -14
  239. package/out/webtrigger/graphql-client.d.ts.map +0 -1
  240. package/out/webtrigger/graphql-client.js +0 -52
  241. package/out/workers/analytics-message-worker.d.ts +0 -12
  242. package/out/workers/analytics-message-worker.d.ts.map +0 -1
  243. package/out/workers/analytics-message-worker.js +0 -29
  244. package/out/workers/forge-cli-workers.d.ts +0 -2
  245. package/out/workers/forge-cli-workers.d.ts.map +0 -1
  246. package/out/workers/forge-cli-workers.js +0 -21
  247. package/out/workers/tunnel-clean-up-worker.d.ts +0 -8
  248. package/out/workers/tunnel-clean-up-worker.d.ts.map +0 -1
  249. package/out/workers/tunnel-clean-up-worker.js +0 -31
  250. package/out/workers/version-check-worker.d.ts +0 -8
  251. package/out/workers/version-check-worker.d.ts.map +0 -1
  252. package/out/workers/version-check-worker.js +0 -20
  253. package/out/workers/worker-info.d.ts +0 -8
  254. package/out/workers/worker-info.d.ts.map +0 -1
  255. package/out/workers/worker-info.js +0 -14
  256. package/out/workers/worker.d.ts +0 -6
  257. package/out/workers/worker.d.ts.map +0 -1
  258. package/out/workers/worker.js +0 -7
  259. package/out/workers/workers-starter.d.ts +0 -5
  260. package/out/workers/workers-starter.d.ts.map +0 -1
  261. package/out/workers/workers-starter.js +0 -22
@@ -1,346 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InstallationsGraphqlClient = exports.InvalidAtlassianSiteError = exports.UnknownSiteWithoutCloudIdError = exports.InstallationNotFoundError = exports.MissingAppUninstallTask = exports.MissingAppError = exports.InstallationRequestFailedError = exports.MissingTaskIdError = exports.EnvironmentNotFoundError = exports.UpgradeError = exports.InstallationError = exports.AlreadyInstalledError = exports.PermissionDeniedError = exports.ALREADY_UPGRADED_CODE = exports.UNINSTALLATION_EVENT_POLL_INTERVAL = void 0;
4
- const cli_shared_1 = require("@forge/cli-shared");
5
- const cli_shared_2 = require("@forge/cli-shared");
6
- const cli_shared_3 = require("@forge/cli-shared");
7
- exports.UNINSTALLATION_EVENT_POLL_INTERVAL = 500;
8
- exports.ALREADY_UPGRADED_CODE = 'INSTALLATION_ALREADY_UPGRADED';
9
- const ALREADY_INSTALLED_CODE = 'APP_ALREADY_INSTALLED';
10
- const PERMISSION_DENIED = 'PERMISSION_DENIED';
11
- class PermissionDeniedError extends cli_shared_1.GraphQlMutationError {
12
- constructor(requestId = 'unknown', appId = 'unknown') {
13
- super(cli_shared_3.Text.install.error.permissionsDeniedInstructions(requestId, appId), PERMISSION_DENIED);
14
- }
15
- }
16
- exports.PermissionDeniedError = PermissionDeniedError;
17
- class AlreadyInstalledError extends cli_shared_1.GraphQlMutationError {
18
- constructor() {
19
- super(cli_shared_3.Text.install.error.alreadyInstalledError, ALREADY_INSTALLED_CODE);
20
- }
21
- }
22
- exports.AlreadyInstalledError = AlreadyInstalledError;
23
- class InstallationError extends cli_shared_1.GraphQlMutationError {
24
- constructor(message, code) {
25
- super(cli_shared_3.Text.install.error.serverSideInstallationError(message), code);
26
- }
27
- }
28
- exports.InstallationError = InstallationError;
29
- class UpgradeError extends cli_shared_1.GraphQlMutationError {
30
- constructor(message, code) {
31
- super(cli_shared_3.Text.upgrade.error.serverSideInstallationError(message), code);
32
- }
33
- }
34
- exports.UpgradeError = UpgradeError;
35
- class EnvironmentNotFoundError extends Error {
36
- }
37
- exports.EnvironmentNotFoundError = EnvironmentNotFoundError;
38
- class MissingTaskIdError extends Error {
39
- }
40
- exports.MissingTaskIdError = MissingTaskIdError;
41
- class InstallationRequestFailedError extends Error {
42
- }
43
- exports.InstallationRequestFailedError = InstallationRequestFailedError;
44
- class MissingAppError extends Error {
45
- }
46
- exports.MissingAppError = MissingAppError;
47
- class MissingAppUninstallTask extends Error {
48
- }
49
- exports.MissingAppUninstallTask = MissingAppUninstallTask;
50
- class InstallationNotFoundError extends Error {
51
- }
52
- exports.InstallationNotFoundError = InstallationNotFoundError;
53
- class UnknownSiteWithoutCloudIdError extends Error {
54
- constructor() {
55
- super(cli_shared_3.Text.installList.noCloudId);
56
- }
57
- }
58
- exports.UnknownSiteWithoutCloudIdError = UnknownSiteWithoutCloudIdError;
59
- class InvalidAtlassianSiteError extends Error {
60
- constructor(url) {
61
- super(cli_shared_3.Text.install.error.invalidAtlassianSite(url));
62
- }
63
- }
64
- exports.InvalidAtlassianSiteError = InvalidAtlassianSiteError;
65
- const tenantContextsToCloudId = (url, contexts) => {
66
- if (!contexts.length) {
67
- throw new InvalidAtlassianSiteError(url);
68
- }
69
- const context = contexts[0];
70
- if (!context || !context.cloudId) {
71
- throw new InvalidAtlassianSiteError(url);
72
- }
73
- return context.cloudId;
74
- };
75
- class InstallationsGraphqlClient {
76
- constructor(graphqlClient, pause) {
77
- this.graphqlClient = graphqlClient;
78
- this.pause = pause;
79
- }
80
- static buildInstallationContext(product, cloudId) {
81
- return '';
82
- }
83
- async installAppIntoSite({ environmentKey, site, product, appId }) {
84
- const cloudId = await this.getCloudId(site);
85
- const installationContext = InstallationsGraphqlClient.buildInstallationContext(product, cloudId);
86
- const query = `
87
- mutation forge_cli_installApplication($input: AppInstallationInput!) {
88
- installApp(input: $input) {
89
- success
90
- taskId
91
- errors {
92
- message
93
- extensions {
94
- errorType
95
- }
96
- }
97
- }
98
- }
99
- `;
100
- const variables = {
101
- input: {
102
- installationContext,
103
- appId,
104
- environmentKey,
105
- async: true
106
- }
107
- };
108
- const { response: { installApp: { success, taskId, errors } }, requestId } = await this.graphqlClient.mutate(query, variables);
109
- const error = cli_shared_2.getError(errors);
110
- if (!success) {
111
- if (error.code === ALREADY_INSTALLED_CODE) {
112
- throw new AlreadyInstalledError();
113
- }
114
- if (error.code === PERMISSION_DENIED) {
115
- throw new Error();
116
- }
117
- throw new InstallationError(`${error.message} (requestId: ${requestId || 'unknown'})`, error.code);
118
- }
119
- if (!taskId) {
120
- throw new MissingTaskIdError(error.message);
121
- }
122
- await this.monitorAppInstallOrUpgrade(taskId);
123
- }
124
- async upgradeInstallation({ site, product, environmentKey, appId }) {
125
- const cloudId = await this.getCloudId(site);
126
- const installationContext = InstallationsGraphqlClient.buildInstallationContext(product, cloudId);
127
- const query = `
128
- mutation forge_cli_upgradeApplication($input: AppInstallationUpgradeInput!) {
129
- upgradeApp(input: $input) {
130
- success
131
- taskId
132
- errors {
133
- message
134
- extensions {
135
- errorType
136
- }
137
- }
138
- }
139
- }
140
- `;
141
- const variables = {
142
- input: {
143
- installationContext,
144
- appId,
145
- environmentKey,
146
- async: true
147
- }
148
- };
149
- const { response: { upgradeApp: { success, errors, taskId } }, requestId } = await this.graphqlClient.mutate(query, variables);
150
- const error = cli_shared_2.getError(errors);
151
- if (!success) {
152
- throw new UpgradeError(`${error.message} (requestId: ${requestId || 'unknown'})`, error.code);
153
- }
154
- if (!taskId) {
155
- throw new MissingTaskIdError(error.message);
156
- }
157
- await this.monitorAppInstallOrUpgrade(taskId);
158
- }
159
- async monitorAppInstallOrUpgrade(taskId) {
160
- let status = cli_shared_1.AppTaskState.Pending;
161
- while (status !== cli_shared_1.AppTaskState.Complete) {
162
- const { state, errors } = await this.getAppInstallationTask(taskId);
163
- status = state;
164
- if (status === cli_shared_1.AppTaskState.Failed) {
165
- throw new InstallationRequestFailedError((errors === null || errors === void 0 ? void 0 : errors[0].message) || undefined);
166
- }
167
- if (status !== cli_shared_1.AppTaskState.Complete)
168
- await this.pause(exports.UNINSTALLATION_EVENT_POLL_INTERVAL);
169
- }
170
- }
171
- async uninstallApp(input) {
172
- const query = `
173
- mutation forge_cli_uninstallApplication($input: AppUninstallationInput!) {
174
- uninstallApp(input: $input) {
175
- success
176
- taskId
177
- errors {
178
- message
179
- extensions {
180
- errorType
181
- }
182
- }
183
- }
184
- }
185
- `;
186
- const { response: { uninstallApp: { success, errors, taskId } }, requestId } = await this.graphqlClient.mutate(query, { input });
187
- const error = cli_shared_2.getError(errors);
188
- if (!success) {
189
- throw new cli_shared_1.GraphQlMutationError(`${error.message} (requestId: ${requestId || 'unknown'})`, error.code);
190
- }
191
- return this.monitorUninstallApp(taskId);
192
- }
193
- async uninstallMultipleApps(apps) {
194
- const uninstallsResult = [];
195
- for (const app of apps) {
196
- try {
197
- const [success] = await Promise.all([
198
- this.uninstallApp(app),
199
- new Promise((resolve) => setTimeout(resolve, 1000))
200
- ]);
201
- uninstallsResult.push(Object.assign(Object.assign({}, app), { successful: success }));
202
- }
203
- catch (err) {
204
- uninstallsResult.push(Object.assign(Object.assign({}, app), { successful: false }));
205
- }
206
- }
207
- return uninstallsResult;
208
- }
209
- async listInstallations(appId) {
210
- const installations = await this.getAllInstallations(appId);
211
- return await this.resolveInstallationsHostnames(installations);
212
- }
213
- async getInstallation(appId, installationId) {
214
- const installations = await this.listInstallations(appId);
215
- const matchedInstallation = installations.find(({ id }) => id === installationId);
216
- if (matchedInstallation) {
217
- return matchedInstallation;
218
- }
219
- throw new InstallationNotFoundError(cli_shared_3.Text.installationId.errors.notFound(installationId));
220
- }
221
- async getAppInstallationTask(taskId) {
222
- const query = `
223
- query forge_cli_getInstallationTask($id: ID!) {
224
- appInstallationTask(id: $id) {
225
- state
226
- errors {
227
- message
228
- extensions {
229
- errorType
230
- }
231
- }
232
- }
233
- }
234
- `;
235
- const { appInstallationTask } = await this.graphqlClient.query(query, {
236
- id: taskId
237
- });
238
- if (!appInstallationTask) {
239
- throw new MissingAppUninstallTask(cli_shared_3.Text.uninstall.missingUninstallTask);
240
- }
241
- const { state, errors } = appInstallationTask;
242
- return {
243
- errors,
244
- state
245
- };
246
- }
247
- async monitorUninstallApp(taskId) {
248
- let status = cli_shared_1.AppTaskState.Pending;
249
- while (status !== cli_shared_1.AppTaskState.Complete) {
250
- const { state } = await this.getAppInstallationTask(taskId);
251
- status = state;
252
- if (status === cli_shared_1.AppTaskState.Failed) {
253
- return false;
254
- }
255
- if (status !== cli_shared_1.AppTaskState.Complete)
256
- await this.pause(exports.UNINSTALLATION_EVENT_POLL_INTERVAL);
257
- }
258
- return true;
259
- }
260
- async resolveInstallationsHostnames(installations) {
261
- return [];
262
- }
263
- async getAllInstallations(appId) {
264
- const query = `
265
- query forge_cli_getApplicationInstallations($id: ID!) {
266
- app(id: $id) {
267
- environments {
268
- key
269
- installations {
270
- id
271
- installationContext,
272
- version {
273
- isLatest
274
- }
275
- }
276
- }
277
- }
278
- }
279
- `;
280
- const result = await this.graphqlClient.query(query, { id: appId });
281
- if (!result.app) {
282
- throw new MissingAppError();
283
- }
284
- const output = [];
285
- for (const { key, installations } of result.app.environments) {
286
- if (installations) {
287
- for (const installation of installations) {
288
- output.push({
289
- environment: key,
290
- installation
291
- });
292
- }
293
- }
294
- }
295
- return output;
296
- }
297
- async getCloudId(site) {
298
- const query = `
299
- query forge_cli_getCloudIfForTenantContexts($hostNames: [String!]) {
300
- tenantContexts(hostNames: $hostNames) {
301
- cloudId
302
- }
303
- }
304
- `;
305
- const result = await this.graphqlClient.query(query, {
306
- hostNames: [site.hostname]
307
- });
308
- const tenantContexts = result.tenantContexts || [];
309
- return tenantContextsToCloudId(site, tenantContexts);
310
- }
311
- async getVersions(appId, environmentKey, firstN = 1) {
312
- const query = `
313
- query forge_cli_getApplicationEnvironmentLatestVersions($appId: ID!, $environmentKey: String!, $firstN: Int!) {
314
- app(id: $appId) {
315
- environmentByKey(key: $environmentKey) {
316
- versions(first: $firstN) {
317
- nodes {
318
- permissions {
319
- egress {
320
- addresses
321
- }
322
- scopes {
323
- key
324
- }
325
- }
326
- }
327
- }
328
- }
329
- }
330
- }
331
- `;
332
- const result = await this.graphqlClient.query(query, {
333
- appId,
334
- environmentKey,
335
- firstN
336
- });
337
- if (!result.app) {
338
- throw new MissingAppError();
339
- }
340
- if (!result.app.environmentByKey) {
341
- throw new EnvironmentNotFoundError();
342
- }
343
- return result.app.environmentByKey.versions;
344
- }
345
- }
346
- exports.InstallationsGraphqlClient = InstallationsGraphqlClient;
@@ -1,21 +0,0 @@
1
- /// <reference types="node" />
2
- import { URL } from 'url';
3
- import { AppConfigProvider } from '@forge/cli-shared';
4
- export interface TriggerAppSiteInstallDetails {
5
- site: URL;
6
- product: string;
7
- environmentKey: string;
8
- }
9
- export interface AppInstallSiteDetails extends TriggerAppSiteInstallDetails {
10
- appId: string;
11
- }
12
- export interface InstallAppClient {
13
- installAppIntoSite(appInstallDetails: AppInstallSiteDetails): Promise<void>;
14
- }
15
- export declare class InstallAppSiteCommand {
16
- private readonly getAppConfig;
17
- private readonly installAppClient;
18
- constructor(getAppConfig: AppConfigProvider, installAppClient: InstallAppClient);
19
- execute({ environmentKey, site, product }: TriggerAppSiteInstallDetails): Promise<void>;
20
- }
21
- //# sourceMappingURL=install-app-site.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install-app-site.d.ts","sourceRoot":"","sources":["../../src/installations/install-app-site.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,GAAG,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,qBAAsB,SAAQ,4BAA4B;IACzE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,kBAAkB,CAAC,iBAAiB,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7E;AAED,qBAAa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAAqB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAAlE,YAAY,EAAE,iBAAiB,EAAmB,gBAAgB,EAAE,gBAAgB;IAEpG,OAAO,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,4BAA4B;CASrF"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InstallAppSiteCommand = void 0;
4
- class InstallAppSiteCommand {
5
- constructor(getAppConfig, installAppClient) {
6
- this.getAppConfig = getAppConfig;
7
- this.installAppClient = installAppClient;
8
- }
9
- async execute({ environmentKey, site, product }) {
10
- const { id: appId } = await this.getAppConfig();
11
- return await this.installAppClient.installAppIntoSite({
12
- appId,
13
- environmentKey,
14
- site,
15
- product
16
- });
17
- }
18
- }
19
- exports.InstallAppSiteCommand = InstallAppSiteCommand;
@@ -1,5 +0,0 @@
1
- import { Installation } from '../service/installation-service';
2
- export declare class UninstallAppError extends Error {
3
- }
4
- export declare const getHangingIdentityInstallationsFromSite: (allInstallations: Installation[], remainingApps: Installation[], sites: Set<string>) => Installation[];
5
- //# sourceMappingURL=shared.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/installations/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,qBAAa,iBAAkB,SAAQ,KAAK;CAAG;AAE/C,eAAO,MAAM,uCAAuC,qBAChC,YAAY,EAAE,iBACjB,YAAY,EAAE,SACtB,GAAG,CAAC,MAAM,CAAC,KACjB,YAAY,EAkBd,CAAC"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getHangingIdentityInstallationsFromSite = exports.UninstallAppError = void 0;
4
- class UninstallAppError extends Error {
5
- }
6
- exports.UninstallAppError = UninstallAppError;
7
- exports.getHangingIdentityInstallationsFromSite = (allInstallations, remainingApps, sites) => {
8
- const hangingIdentityInstalls = [];
9
- sites.forEach((site) => {
10
- const shouldUninstallIdentity = remainingApps.filter((app) => app.site === site).length === 0;
11
- if (shouldUninstallIdentity) {
12
- const identityInstall = allInstallations.find((install) => install.site === site && install.product === 'identity');
13
- if (identityInstall) {
14
- hangingIdentityInstalls.push(identityInstall);
15
- }
16
- }
17
- });
18
- return hangingIdentityInstalls;
19
- };
@@ -1,25 +0,0 @@
1
- import { AppConfigProvider } from '@forge/cli-shared';
2
- import { AppUninstallationInput } from '@forge/cli-shared';
3
- import { Installation } from '../service/installation-service';
4
- export interface UninstallAppOutput {
5
- product: string;
6
- site: string;
7
- environmentKey: string;
8
- successful?: boolean;
9
- }
10
- export interface AsyncAppUninstallationInput extends AppUninstallationInput {
11
- async: true;
12
- }
13
- export interface UninstallAppClient {
14
- getInstallation(appId: string, installationId: string): Promise<Installation>;
15
- uninstallApp(input: AsyncAppUninstallationInput): Promise<boolean>;
16
- uninstallMultipleApps(input: AsyncAppUninstallationInput[]): Promise<Partial<UninstallAppOutput>[]>;
17
- }
18
- export declare class UninstallAppCommand {
19
- private readonly getAppConfig;
20
- private readonly client;
21
- constructor(getAppConfig: AppConfigProvider, client: UninstallAppClient);
22
- execute(installationId: string): Promise<UninstallAppOutput>;
23
- batchExecute(installationIds?: string[], installationInfos?: Installation[]): Promise<UninstallAppOutput[]>;
24
- }
25
- //# sourceMappingURL=uninstall-app.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uninstall-app.d.ts","sourceRoot":"","sources":["../../src/installations/uninstall-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,2BAA4B,SAAQ,sBAAsB;IACzE,KAAK,EAAE,IAAI,CAAC;CACb;AAED,MAAM,WAAW,kBAAkB;IACjC,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC9E,YAAY,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnE,qBAAqB,CAAC,KAAK,EAAE,2BAA2B,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;CACrG;AAED,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAAqB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAxD,YAAY,EAAE,iBAAiB,EAAmB,MAAM,EAAE,kBAAkB;IAE5F,OAAO,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAY5D,YAAY,CACvB,eAAe,GAAE,MAAM,EAAO,EAC9B,iBAAiB,CAAC,EAAE,YAAY,EAAE,GACjC,OAAO,CAAC,kBAAkB,EAAE,CAAC;CA4BjC"}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UninstallAppCommand = void 0;
4
- class UninstallAppCommand {
5
- constructor(getAppConfig, client) {
6
- this.getAppConfig = getAppConfig;
7
- this.client = client;
8
- }
9
- async execute(installationId) {
10
- const { id: appId } = await this.getAppConfig();
11
- const { product, site, environmentKey } = await this.client.getInstallation(appId, installationId);
12
- const success = await this.client.uninstallApp({ appId, environmentKey, installationId, async: true });
13
- return {
14
- product,
15
- site,
16
- environmentKey,
17
- successful: success
18
- };
19
- }
20
- async batchExecute(installationIds = [], installationInfos) {
21
- const { id: appId } = await this.getAppConfig();
22
- let appsInstallInfo;
23
- if (installationInfos && installationInfos.length) {
24
- appsInstallInfo = installationInfos;
25
- }
26
- else {
27
- appsInstallInfo = await Promise.all(installationIds.map((installId) => this.client.getInstallation(appId, installId)));
28
- }
29
- const uninstallOutput = await this.client.uninstallMultipleApps(appsInstallInfo.map((installInfo) => ({
30
- appId,
31
- environmentKey: installInfo.environmentKey,
32
- installationId: installInfo.id,
33
- async: true
34
- })));
35
- return appsInstallInfo.map(({ product, site, environmentKey }, index) => ({
36
- product,
37
- site,
38
- environmentKey,
39
- successful: uninstallOutput[index].successful
40
- }));
41
- }
42
- }
43
- exports.UninstallAppCommand = UninstallAppCommand;
@@ -1,8 +0,0 @@
1
- import { GraphQLClient } from '@forge/cli-shared';
2
- import { AppEnvironmentMigrationKeys } from '../service/migration-keys-service';
3
- export declare class GraphqlClient {
4
- private readonly graphqlClient;
5
- constructor(graphqlClient: GraphQLClient);
6
- getLatestMigrationKeys(appId: string, environmentKey: string): Promise<AppEnvironmentMigrationKeys>;
7
- }
8
- //# sourceMappingURL=graphql-client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/migration-keys/graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA+C,MAAM,mBAAmB,CAAC;AAC/F,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAE5C,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC;CA+CjH"}
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GraphqlClient = void 0;
4
- const cli_shared_1 = require("@forge/cli-shared");
5
- class GraphqlClient {
6
- constructor(graphqlClient) {
7
- this.graphqlClient = graphqlClient;
8
- }
9
- async getLatestMigrationKeys(appId, environmentKey) {
10
- var _a, _b;
11
- const query = `
12
- query forge_cli_getMigrationKeys($id: ID!, $key: String!) {
13
- app(id: $id) {
14
- environmentByKey(key: $key) {
15
- id
16
- versions(first: 1) {
17
- edges {
18
- node {
19
- isLatest
20
- migrationKeys {
21
- jira
22
- confluence
23
- }
24
- }
25
- }
26
- }
27
- }
28
- marketplaceApp {
29
- appKey
30
- }
31
- }
32
- }
33
- `;
34
- const result = await this.graphqlClient.query(query, {
35
- id: appId,
36
- key: environmentKey
37
- });
38
- if (!result.app) {
39
- throw new cli_shared_1.MissingAppError();
40
- }
41
- if (!result.app.environmentByKey) {
42
- throw new cli_shared_1.MissingAppEnvironmentError();
43
- }
44
- const mpacAppKey = (_a = result.app.marketplaceApp) === null || _a === void 0 ? void 0 : _a.appKey;
45
- const versions = result.app.environmentByKey.versions;
46
- let migrationKeys;
47
- for (const edge of (versions === null || versions === void 0 ? void 0 : versions.edges) || []) {
48
- if (edge) {
49
- migrationKeys = (_b = edge.node) === null || _b === void 0 ? void 0 : _b.migrationKeys;
50
- }
51
- }
52
- return { migrationKeys, mpacAppKey };
53
- }
54
- }
55
- exports.GraphqlClient = GraphqlClient;
@@ -1,19 +0,0 @@
1
- import { AppConfigProvider } from '@forge/cli-shared';
2
- export interface ProviderDetails {
3
- environment: string;
4
- providerKey: string;
5
- clientSecret: string;
6
- }
7
- export interface AppProviderDetails extends ProviderDetails {
8
- appId: string;
9
- }
10
- export interface ConfigureProviderClient {
11
- configureProvider(details: AppProviderDetails): Promise<void>;
12
- }
13
- export declare class ConfigureProviderCommand {
14
- private readonly client;
15
- private readonly getAppConfig;
16
- constructor(client: ConfigureProviderClient, getAppConfig: AppConfigProvider);
17
- execute(details: ProviderDetails): Promise<void>;
18
- }
19
- //# sourceMappingURL=configure-provider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"configure-provider.d.ts","sourceRoot":"","sources":["../../src/providers/configure-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D;AAED,qBAAa,wBAAwB;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAA2B,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAA9D,MAAM,EAAE,uBAAuB,EAAmB,YAAY,EAAE,iBAAiB;IAEjG,OAAO,CAAC,OAAO,EAAE,eAAe;CAO9C"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConfigureProviderCommand = void 0;
4
- class ConfigureProviderCommand {
5
- constructor(client, getAppConfig) {
6
- this.client = client;
7
- this.getAppConfig = getAppConfig;
8
- }
9
- async execute(details) {
10
- const { id: appId } = await this.getAppConfig();
11
- await this.client.configureProvider(Object.assign(Object.assign({}, details), { appId }));
12
- }
13
- }
14
- exports.ConfigureProviderCommand = ConfigureProviderCommand;
@@ -1,12 +0,0 @@
1
- import { GraphQLClient } from '@forge/cli-shared';
2
- import { AppProviderDetails, ConfigureProviderClient } from './configure-provider';
3
- export declare class MissingAppError extends Error {
4
- }
5
- export declare class MissingAppEnvironmentError extends Error {
6
- }
7
- export declare class GraphqlClient implements ConfigureProviderClient {
8
- private readonly graphqlClient;
9
- constructor(graphqlClient: GraphQLClient);
10
- configureProvider(details: AppProviderDetails): Promise<void>;
11
- }
12
- //# sourceMappingURL=graphql-client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/providers/graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,aAAa,EAAwB,MAAM,mBAAmB,CAAC;AAElF,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEnF,qBAAa,eAAgB,SAAQ,KAAK;CAAG;AAC7C,qBAAa,0BAA2B,SAAQ,KAAK;CAAG;AAExD,qBAAa,aAAc,YAAW,uBAAuB;IAC/C,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAE5C,iBAAiB,CAAC,OAAO,EAAE,kBAAkB;CA0C3D"}
@@ -1,47 +0,0 @@
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;