@forge/cli-shared 10.0.0-next.13 → 10.0.0-next.14

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 (227) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/out/app-logs/graphql-client.d.ts +2 -2
  3. package/out/app-logs/graphql-client.d.ts.map +1 -1
  4. package/out/app-logs/graphql-client.js +9 -17
  5. package/out/app-logs/index.d.ts +2 -2
  6. package/out/app-logs/index.d.ts.map +1 -1
  7. package/out/app-logs/index.js +2 -5
  8. package/out/app-logs/view-logs.d.ts +4 -4
  9. package/out/app-logs/view-logs.d.ts.map +1 -1
  10. package/out/app-logs/view-logs.js +8 -12
  11. package/out/apps/app-config.d.ts +2 -2
  12. package/out/apps/app-config.d.ts.map +1 -1
  13. package/out/apps/app-config.js +13 -20
  14. package/out/apps/create-an-app.d.ts +4 -4
  15. package/out/apps/create-an-app.d.ts.map +1 -1
  16. package/out/apps/create-an-app.js +6 -11
  17. package/out/apps/create-app-graphql-client.d.ts +2 -2
  18. package/out/apps/create-app-graphql-client.d.ts.map +1 -1
  19. package/out/apps/create-app-graphql-client.js +9 -14
  20. package/out/apps/get-app-owner.d.ts +4 -4
  21. package/out/apps/get-app-owner.d.ts.map +1 -1
  22. package/out/apps/get-app-owner.js +8 -13
  23. package/out/apps/index.d.ts +9 -9
  24. package/out/apps/index.d.ts.map +1 -1
  25. package/out/apps/index.js +9 -12
  26. package/out/apps/package-installer.d.ts +1 -1
  27. package/out/apps/package-installer.d.ts.map +1 -1
  28. package/out/apps/package-installer.js +9 -14
  29. package/out/apps/register-app.d.ts +4 -4
  30. package/out/apps/register-app.d.ts.map +1 -1
  31. package/out/apps/register-app.js +9 -13
  32. package/out/apps/sites.js +1 -4
  33. package/out/apps/template-module.js +27 -33
  34. package/out/apps/template.d.ts +3 -3
  35. package/out/apps/template.d.ts.map +1 -1
  36. package/out/apps/template.js +36 -47
  37. package/out/ari/ari.js +48 -63
  38. package/out/ari/index.d.ts +1 -1
  39. package/out/ari/index.d.ts.map +1 -1
  40. package/out/ari/index.js +1 -4
  41. package/out/auth/authenticator.js +2 -6
  42. package/out/auth/index.d.ts +3 -3
  43. package/out/auth/index.d.ts.map +1 -1
  44. package/out/auth/index.js +3 -6
  45. package/out/auth/instruction.js +3 -6
  46. package/out/auth/personal/credential-store.d.ts +2 -2
  47. package/out/auth/personal/credential-store.d.ts.map +1 -1
  48. package/out/auth/personal/credential-store.js +48 -57
  49. package/out/auth/personal/index.d.ts +6 -6
  50. package/out/auth/personal/index.d.ts.map +1 -1
  51. package/out/auth/personal/index.js +6 -9
  52. package/out/auth/personal/login.d.ts +3 -3
  53. package/out/auth/personal/login.d.ts.map +1 -1
  54. package/out/auth/personal/login.js +1 -5
  55. package/out/auth/personal/logout.d.ts +1 -1
  56. package/out/auth/personal/logout.d.ts.map +1 -1
  57. package/out/auth/personal/logout.js +1 -5
  58. package/out/auth/personal/me-graphql-client.d.ts +3 -3
  59. package/out/auth/personal/me-graphql-client.d.ts.map +1 -1
  60. package/out/auth/personal/me-graphql-client.js +7 -12
  61. package/out/auth/personal/token-authenticator.d.ts +3 -3
  62. package/out/auth/personal/token-authenticator.d.ts.map +1 -1
  63. package/out/auth/personal/token-authenticator.js +10 -14
  64. package/out/auth/personal/user-repository.d.ts +4 -4
  65. package/out/auth/personal/user-repository.d.ts.map +1 -1
  66. package/out/auth/personal/user-repository.js +5 -9
  67. package/out/cache/cached-conf.d.ts.map +1 -1
  68. package/out/cache/cached-conf.js +5 -10
  69. package/out/cache/index.d.ts +1 -1
  70. package/out/cache/index.d.ts.map +1 -1
  71. package/out/cache/index.js +1 -4
  72. package/out/config/config-codec-types.js +1 -2
  73. package/out/config/config-file-section-reader.d.ts +3 -3
  74. package/out/config/config-file-section-reader.d.ts.map +1 -1
  75. package/out/config/config-file-section-reader.js +4 -10
  76. package/out/config/config-file-section-writer.d.ts +3 -3
  77. package/out/config/config-file-section-writer.d.ts.map +1 -1
  78. package/out/config/config-file-section-writer.js +2 -7
  79. package/out/config/config-file.d.ts +3 -3
  80. package/out/config/config-file.d.ts.map +1 -1
  81. package/out/config/config-file.js +40 -49
  82. package/out/config/config-section.js +4 -11
  83. package/out/config/config.d.ts +1 -1
  84. package/out/config/config.d.ts.map +1 -1
  85. package/out/config/config.js +7 -13
  86. package/out/config/index.d.ts +6 -6
  87. package/out/config/index.d.ts.map +1 -1
  88. package/out/config/index.js +6 -9
  89. package/out/file-system/archiver.d.ts +2 -2
  90. package/out/file-system/archiver.d.ts.map +1 -1
  91. package/out/file-system/archiver.js +20 -29
  92. package/out/file-system/file-system-reader.d.ts.map +1 -1
  93. package/out/file-system/file-system-reader.js +21 -26
  94. package/out/file-system/file-system-writer.js +5 -10
  95. package/out/file-system/index.d.ts +5 -5
  96. package/out/file-system/index.d.ts.map +1 -1
  97. package/out/file-system/index.js +5 -8
  98. package/out/file-system/util.js +1 -4
  99. package/out/file-system/zip-accessor.js +3 -8
  100. package/out/graphql/app-environment-graphql-client.d.ts +2 -2
  101. package/out/graphql/app-environment-graphql-client.d.ts.map +1 -1
  102. package/out/graphql/app-environment-graphql-client.js +10 -16
  103. package/out/graphql/app-oauth-client-id-graphql-client.d.ts +1 -1
  104. package/out/graphql/app-oauth-client-id-graphql-client.d.ts.map +1 -1
  105. package/out/graphql/app-oauth-client-id-graphql-client.js +6 -10
  106. package/out/graphql/debugging-graphql-runner.d.ts +2 -2
  107. package/out/graphql/debugging-graphql-runner.d.ts.map +1 -1
  108. package/out/graphql/debugging-graphql-runner.js +5 -10
  109. package/out/graphql/gateway.js +15 -23
  110. package/out/graphql/get-mutation-error.js +4 -8
  111. package/out/graphql/gql/gql.d.ts +82 -82
  112. package/out/graphql/gql/gql.d.ts.map +1 -1
  113. package/out/graphql/gql/gql.js +2 -6
  114. package/out/graphql/gql/graphql.d.ts +4 -0
  115. package/out/graphql/gql/graphql.d.ts.map +1 -1
  116. package/out/graphql/gql/graphql.js +83 -88
  117. package/out/graphql/gql/index.d.ts +1 -1
  118. package/out/graphql/gql/index.d.ts.map +1 -1
  119. package/out/graphql/gql/index.js +1 -4
  120. package/out/graphql/graphql-client.js +1 -2
  121. package/out/graphql/graphql-domain-types.d.ts +1 -1
  122. package/out/graphql/graphql-domain-types.d.ts.map +1 -1
  123. package/out/graphql/graphql-domain-types.js +1 -2
  124. package/out/graphql/graphql-runtime-enums.js +16 -19
  125. package/out/graphql/index.d.ts +12 -12
  126. package/out/graphql/index.d.ts.map +1 -1
  127. package/out/graphql/index.js +12 -17
  128. package/out/graphql/minimal-graphql-runner.d.ts +4 -4
  129. package/out/graphql/minimal-graphql-runner.d.ts.map +1 -1
  130. package/out/graphql/minimal-graphql-runner.js +31 -40
  131. package/out/graphql/mutation-aware-graphql-client.d.ts +2 -2
  132. package/out/graphql/mutation-aware-graphql-client.d.ts.map +1 -1
  133. package/out/graphql/mutation-aware-graphql-client.js +4 -10
  134. package/out/graphql/path-based-graphql-client-resolver.d.ts +1 -1
  135. package/out/graphql/path-based-graphql-client-resolver.d.ts.map +1 -1
  136. package/out/graphql/path-based-graphql-client-resolver.js +3 -7
  137. package/out/http-client/feedback-post-client.js +1 -5
  138. package/out/http-client/file-uploader.d.ts +1 -1
  139. package/out/http-client/file-uploader.d.ts.map +1 -1
  140. package/out/http-client/file-uploader.js +11 -18
  141. package/out/http-client/global-edge-http-client.js +8 -14
  142. package/out/http-client/index.d.ts +5 -5
  143. package/out/http-client/index.d.ts.map +1 -1
  144. package/out/http-client/index.js +5 -8
  145. package/out/http-client/node-request.js +10 -16
  146. package/out/http-client/trace.js +1 -4
  147. package/out/index.d.ts +13 -13
  148. package/out/index.d.ts.map +1 -1
  149. package/out/index.js +13 -16
  150. package/out/service/bridge-script-service.js +5 -9
  151. package/out/service/i18n-resource-bundling-service.js +24 -30
  152. package/out/service/iframe-resizer-script-service.js +5 -9
  153. package/out/service/index.d.ts +5 -5
  154. package/out/service/index.d.ts.map +1 -1
  155. package/out/service/index.js +5 -8
  156. package/out/service/statsig-service.d.ts +1 -1
  157. package/out/service/statsig-service.d.ts.map +1 -1
  158. package/out/service/statsig-service.js +9 -15
  159. package/out/service/supported-products-service.d.ts +2 -2
  160. package/out/service/supported-products-service.d.ts.map +1 -1
  161. package/out/service/supported-products-service.js +13 -18
  162. package/out/shared/assertUnreachable.js +1 -4
  163. package/out/shared/assistant-cli.d.ts +1 -1
  164. package/out/shared/assistant-cli.d.ts.map +1 -1
  165. package/out/shared/assistant-cli.js +15 -24
  166. package/out/shared/cli-details.js +6 -11
  167. package/out/shared/developer-console.js +12 -18
  168. package/out/shared/directories.js +4 -8
  169. package/out/shared/environment.d.ts +1 -1
  170. package/out/shared/environment.d.ts.map +1 -1
  171. package/out/shared/environment.js +19 -25
  172. package/out/shared/error-handling.d.ts +1 -1
  173. package/out/shared/error-handling.d.ts.map +1 -1
  174. package/out/shared/error-handling.js +24 -44
  175. package/out/shared/forge-cli-attribution.js +6 -11
  176. package/out/shared/index.d.ts +13 -13
  177. package/out/shared/index.d.ts.map +1 -1
  178. package/out/shared/index.js +13 -16
  179. package/out/shared/installations.js +1 -4
  180. package/out/shared/pause.js +1 -5
  181. package/out/shared/product.d.ts.map +1 -1
  182. package/out/shared/product.js +5 -10
  183. package/out/shared/read-app-config-files.d.ts +1 -1
  184. package/out/shared/read-app-config-files.d.ts.map +1 -1
  185. package/out/shared/read-app-config-files.js +6 -12
  186. package/out/shared/runner-signals.js +1 -5
  187. package/out/shared/test.d.ts +1 -1
  188. package/out/shared/test.d.ts.map +1 -1
  189. package/out/shared/test.js +24 -29
  190. package/out/tunnel/docker-compose-lifecycle.d.ts +3 -3
  191. package/out/tunnel/docker-compose-lifecycle.d.ts.map +1 -1
  192. package/out/tunnel/docker-compose-lifecycle.js +53 -70
  193. package/out/tunnel/index.d.ts +2 -2
  194. package/out/tunnel/index.d.ts.map +1 -1
  195. package/out/tunnel/index.js +2 -5
  196. package/out/tunnel/tunnel-options.js +13 -18
  197. package/out/ui/command-line-ui.d.ts +2 -2
  198. package/out/ui/command-line-ui.d.ts.map +1 -1
  199. package/out/ui/command-line-ui.js +53 -58
  200. package/out/ui/hint-rotation.d.ts +2 -2
  201. package/out/ui/hint-rotation.d.ts.map +1 -1
  202. package/out/ui/hint-rotation.js +2 -6
  203. package/out/ui/index.d.ts +8 -8
  204. package/out/ui/index.d.ts.map +1 -1
  205. package/out/ui/index.js +8 -11
  206. package/out/ui/log-color.js +16 -20
  207. package/out/ui/log-symbols.js +10 -13
  208. package/out/ui/logger.js +2 -6
  209. package/out/ui/multiple-table-prompt.d.ts +1 -1
  210. package/out/ui/multiple-table-prompt.d.ts.map +1 -1
  211. package/out/ui/multiple-table-prompt.js +13 -20
  212. package/out/ui/runtime-log.js +12 -16
  213. package/out/ui/single-table-prompt.d.ts +1 -1
  214. package/out/ui/single-table-prompt.d.ts.map +1 -1
  215. package/out/ui/single-table-prompt.js +12 -19
  216. package/out/ui/table-prompt.d.ts +1 -1
  217. package/out/ui/table-prompt.d.ts.map +1 -1
  218. package/out/ui/table-prompt.js +11 -16
  219. package/out/ui/table.d.ts.map +1 -1
  220. package/out/ui/table.js +4 -7
  221. package/out/ui/text.d.ts +1 -1
  222. package/out/ui/text.d.ts.map +1 -1
  223. package/out/ui/text.js +208 -214
  224. package/out/ui/ui.d.ts +2 -2
  225. package/out/ui/ui.d.ts.map +1 -1
  226. package/out/ui/ui.js +1 -2
  227. package/package.json +2 -1
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RegisterAppCommand = void 0;
4
- const config_1 = require("../config");
5
- const file_system_1 = require("../file-system");
6
- const ui_1 = require("../ui");
7
- class RegisterAppCommand {
1
+ import { findUIKit1Modules } from '../config/index.js';
2
+ import { inDirectory } from '../file-system/index.js';
3
+ import { Text } from '../ui/index.js';
4
+ export class RegisterAppCommand {
8
5
  appClient;
9
6
  appConfigReader;
10
7
  appConfigWriter;
@@ -25,14 +22,14 @@ class RegisterAppCommand {
25
22
  };
26
23
  }
27
24
  async registerApp(input, directory, { shouldPrependAppName, compatibility }) {
28
- this.logger.info(ui_1.Text.create.taskRegister);
25
+ this.logger.info(Text.create.taskRegister);
29
26
  const result = await this.appClient.createApp(input);
30
- await (0, file_system_1.inDirectory)(directory, async () => {
27
+ await inDirectory(directory, async () => {
31
28
  const { modules } = await this.configFile.readConfig();
32
29
  if (modules) {
33
- const uiKit1Modules = (0, config_1.findUIKit1Modules)(modules);
30
+ const uiKit1Modules = findUIKit1Modules(modules);
34
31
  if (uiKit1Modules.length > 0) {
35
- this.logger.warn(ui_1.Text.warning.deprecation.uikit(uiKit1Modules));
32
+ this.logger.warn(Text.warning.deprecation.uikit(uiKit1Modules));
36
33
  }
37
34
  }
38
35
  const section = await this.appConfigReader.readConfigSection();
@@ -51,8 +48,7 @@ class RegisterAppCommand {
51
48
  await this.appConfigWriter.prependAppNameToModules(input.name);
52
49
  }
53
50
  });
54
- this.logger.info(ui_1.Text.create.taskCreateEnvironments);
51
+ this.logger.info(Text.create.taskCreateEnvironments);
55
52
  return result;
56
53
  }
57
54
  }
58
- exports.RegisterAppCommand = RegisterAppCommand;
package/out/apps/sites.js CHANGED
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isSecureSite = isSecureSite;
4
1
  const secureSites = ['product-fabric.atlassian.net', 'hello.atlassian.net'];
5
- function isSecureSite(site) {
2
+ export function isSecureSite(site) {
6
3
  return secureSites.includes(site.host);
7
4
  }
@@ -1,24 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TemplateModuleServices = exports.BifrostFetchError = void 0;
4
- const tslib_1 = require("tslib");
5
- const fs_1 = tslib_1.__importDefault(require("fs"));
6
- const path_1 = tslib_1.__importDefault(require("path"));
7
- const os_1 = tslib_1.__importDefault(require("os"));
8
- const url_1 = require("url");
9
- const adm_zip_1 = tslib_1.__importDefault(require("adm-zip"));
10
- const text_1 = require("../ui/text");
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import os from 'os';
4
+ import { URL } from 'url';
5
+ import AdmZip from 'adm-zip';
6
+ import { Text } from '../ui/text.js';
11
7
  const BIFROST_BASE_URL = 'https://forge-templates-bifrost.prod-east.frontend.public.atl-paas.net/assets/';
12
8
  const MODULE_INDEX_FILE = 'template-modules.json';
13
9
  const MODULE_SHOW_FILE = 'description.json';
14
- class BifrostFetchError extends Error {
10
+ export class BifrostFetchError extends Error {
15
11
  constructor(message) {
16
12
  super(message);
17
13
  this.name = 'BifrostFetchError';
18
14
  }
19
15
  }
20
- exports.BifrostFetchError = BifrostFetchError;
21
- class TemplateModuleServices {
16
+ export class TemplateModuleServices {
22
17
  baseUrl;
23
18
  templatesCache = null;
24
19
  constructor(baseUrl) {
@@ -28,23 +23,23 @@ class TemplateModuleServices {
28
23
  if (this.templatesCache) {
29
24
  return this.templatesCache;
30
25
  }
31
- const indexUrl = new url_1.URL(MODULE_INDEX_FILE, this.baseUrl);
26
+ const indexUrl = new URL(MODULE_INDEX_FILE, this.baseUrl);
32
27
  const res = await fetch(indexUrl);
33
28
  if (!res.ok) {
34
- throw new BifrostFetchError(text_1.Text.module.errors.bifrostIndexFetchFailed(res.status, res.statusText));
29
+ throw new BifrostFetchError(Text.module.errors.bifrostIndexFetchFailed(res.status, res.statusText));
35
30
  }
36
31
  const json = await res.json();
37
32
  if (Array.isArray(json)) {
38
33
  this.templatesCache = json;
39
34
  return this.templatesCache;
40
35
  }
41
- throw new BifrostFetchError(text_1.Text.module.errors.bifrostIndexInvalid);
36
+ throw new BifrostFetchError(Text.module.errors.bifrostIndexInvalid);
42
37
  }
43
38
  async fetchModuleShowMeta(moduleKey) {
44
39
  const url = `${this.baseUrl}${moduleKey}/${MODULE_SHOW_FILE}`;
45
40
  const res = await fetch(url);
46
41
  if (!res.ok) {
47
- throw new BifrostFetchError(text_1.Text.module.errors.bifrostIndexFetchFailed(res.status, res.statusText));
42
+ throw new BifrostFetchError(Text.module.errors.bifrostIndexFetchFailed(res.status, res.statusText));
48
43
  }
49
44
  return (await res.json());
50
45
  }
@@ -52,7 +47,7 @@ class TemplateModuleServices {
52
47
  const url = `${this.baseUrl}${manifestPath}`;
53
48
  const res = await fetch(url);
54
49
  if (!res.ok) {
55
- throw new BifrostFetchError(text_1.Text.module.errors.bifrostManifestFragmentFetchFailed(res.status, res.statusText));
50
+ throw new BifrostFetchError(Text.module.errors.bifrostManifestFragmentFetchFailed(res.status, res.statusText));
56
51
  }
57
52
  return await res.text();
58
53
  }
@@ -61,7 +56,7 @@ class TemplateModuleServices {
61
56
  return { ...template };
62
57
  const variantData = template.variants?.[uiFramework];
63
58
  if (!variantData) {
64
- throw new Error(text_1.Text.module.add.errorInvalidUIFramework(uiFramework, template.moduleKey));
59
+ throw new Error(Text.module.add.errorInvalidUIFramework(uiFramework, template.moduleKey));
65
60
  }
66
61
  return {
67
62
  ...template,
@@ -76,10 +71,10 @@ class TemplateModuleServices {
76
71
  }
77
72
  async prepareModuleMetadata(template, uiFramework) {
78
73
  const resolved = this.applyVariant(template, uiFramework);
79
- const cacheDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'forge-module-'));
74
+ const cacheDir = fs.mkdtempSync(path.join(os.tmpdir(), 'forge-module-'));
80
75
  if (resolved.manifestPath) {
81
76
  const manifestFragment = await this.fetchManifestFragment(resolved.manifestPath);
82
- fs_1.default.writeFileSync(path_1.default.join(cacheDir, 'manifest-fragment.yml'), manifestFragment);
77
+ fs.writeFileSync(path.join(cacheDir, 'manifest-fragment.yml'), manifestFragment);
83
78
  }
84
79
  return { ...resolved, cacheDir };
85
80
  }
@@ -88,7 +83,7 @@ class TemplateModuleServices {
88
83
  return;
89
84
  }
90
85
  if (!template.cacheDir) {
91
- throw new Error(text_1.Text.module.add.errorCacheDirMissing(template.moduleKey));
86
+ throw new Error(Text.module.add.errorCacheDirMissing(template.moduleKey));
92
87
  }
93
88
  const rel = uiFramework ? `${template.moduleKey}/${uiFramework}/bundle.zip` : `${template.moduleKey}/bundle.zip`;
94
89
  const url = `${this.baseUrl}${rel}`;
@@ -98,36 +93,35 @@ class TemplateModuleServices {
98
93
  }
99
94
  catch (err) {
100
95
  const message = err instanceof Error ? err.message : String(err);
101
- throw new Error(text_1.Text.module.add.errorFailedToDownloadBundle(template.moduleKey, message), { cause: err });
96
+ throw new Error(Text.module.add.errorFailedToDownloadBundle(template.moduleKey, message), { cause: err });
102
97
  }
103
98
  if (!res.ok) {
104
- throw new BifrostFetchError(`${text_1.Text.module.errors.bifrostZipFetchFailed(template.moduleKey, res.status, res.statusText)} (last URL: ${url})`);
99
+ throw new BifrostFetchError(`${Text.module.errors.bifrostZipFetchFailed(template.moduleKey, res.status, res.statusText)} (last URL: ${url})`);
105
100
  }
106
101
  const arrayBuffer = await res.arrayBuffer();
107
- const zipPath = path_1.default.join(template.cacheDir, 'bundle.zip');
108
- fs_1.default.writeFileSync(zipPath, Buffer.from(arrayBuffer));
102
+ const zipPath = path.join(template.cacheDir, 'bundle.zip');
103
+ fs.writeFileSync(zipPath, Buffer.from(arrayBuffer));
109
104
  try {
110
- new adm_zip_1.default(zipPath).extractAllTo(template.cacheDir, true);
105
+ new AdmZip(zipPath).extractAllTo(template.cacheDir, true);
111
106
  }
112
107
  catch (err) {
113
- throw new BifrostFetchError(text_1.Text.module.add.errorZipExtractionFailed(template.moduleKey, err.message));
108
+ throw new BifrostFetchError(Text.module.add.errorZipExtractionFailed(template.moduleKey, err.message));
114
109
  }
115
110
  finally {
116
111
  try {
117
- fs_1.default.rmSync(zipPath, { force: true });
112
+ fs.rmSync(zipPath, { force: true });
118
113
  }
119
114
  catch (cleanupErr) {
120
- console.warn(`${text_1.Text.module.add.errorZipCleanupFailed(template.moduleKey)}`);
115
+ console.warn(`${Text.module.add.errorZipCleanupFailed(template.moduleKey)}`);
121
116
  }
122
117
  }
123
118
  }
124
119
  cleanupCache(cacheDir) {
125
120
  try {
126
- fs_1.default.rmSync(cacheDir, { recursive: true, force: true });
121
+ fs.rmSync(cacheDir, { recursive: true, force: true });
127
122
  }
128
123
  catch {
129
- throw new Error(text_1.Text.module.add.errorCacheCleanupFailed(cacheDir));
124
+ throw new Error(Text.module.add.errorCacheCleanupFailed(cacheDir));
130
125
  }
131
126
  }
132
127
  }
133
- exports.TemplateModuleServices = TemplateModuleServices;
@@ -1,6 +1,6 @@
1
- import { UserError } from '../shared/error-handling';
2
- import { ZipAccessor } from '../file-system';
3
- import { Logger } from '../ui';
1
+ import { UserError } from '../shared/error-handling.js';
2
+ import { ZipAccessor } from '../file-system/index.js';
3
+ import { Logger } from '../ui/index.js';
4
4
  export declare class NoTemplateError extends UserError {
5
5
  constructor(template: string);
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/apps/template.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAM/B,qBAAa,eAAgB,SAAQ,SAAS;gBAChC,QAAQ,EAAE,MAAM;CAG7B;AAED,qBAAa,2BAA4B,SAAQ,KAAK;CAAG;AAEzD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChE;AAED,MAAM,WAAW,cAAc;IAC7B,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,SAAU,SAAQ,cAAc;IAC/C,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE;AAED,qBAAa,yBAA0B,YAAW,kBAAkB;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYvE,OAAO,CAAC,WAAW;CAGpB;AAED,qBAAa,oBAAqB,YAAW,iBAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAExC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAc7D,2BAA2B;CAe1C;AAED,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAG5B;AAKD,qBAAa,qBAAsB,YAAW,cAAc;IAC1D,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,wBAAwB;IAOnB,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAcxD;AAED,qBAAa,mBAAoB,YAAW,SAAS;IAEjD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAHN,UAAU,EAAE,kBAAkB,EAC9B,SAAS,EAAE,iBAAiB,EAC5B,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM;IAEpB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBnF,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAG3C"}
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/apps/template.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAMxC,qBAAa,eAAgB,SAAQ,SAAS;gBAChC,QAAQ,EAAE,MAAM;CAG7B;AAED,qBAAa,2BAA4B,SAAQ,KAAK;CAAG;AAEzD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChE;AAED,MAAM,WAAW,cAAc;IAC7B,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,SAAU,SAAQ,cAAc;IAC/C,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE;AAED,qBAAa,yBAA0B,YAAW,kBAAkB;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYvE,OAAO,CAAC,WAAW;CAGpB;AAED,qBAAa,oBAAqB,YAAW,iBAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAExC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAc7D,2BAA2B;CAe1C;AAED,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAG5B;AAKD,qBAAa,qBAAsB,YAAW,cAAc;IAC1D,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,wBAAwB;IAOnB,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAcxD;AAED,qBAAa,mBAAoB,YAAW,SAAS;IAEjD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAHN,UAAU,EAAE,kBAAkB,EAC9B,SAAS,EAAE,iBAAiB,EAC5B,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM;IAEpB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBnF,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAG3C"}
@@ -1,26 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ComposableTemplater = exports.TemplateServiceLister = exports.TemplateFetchError = exports.ZipTemplateExtractor = exports.TemplateServiceDownloader = exports.InvalidTemplateArchiveError = exports.NoTemplateError = void 0;
4
- const tslib_1 = require("tslib");
5
- const fs_1 = tslib_1.__importDefault(require("fs"));
6
- const fs_extra_1 = require("fs-extra");
7
- const path_1 = require("path");
8
- const tmp_1 = tslib_1.__importDefault(require("tmp"));
9
- const url_1 = require("url");
10
- const error_handling_1 = require("../shared/error-handling");
11
- const ui_1 = require("../ui");
1
+ import fs from 'fs';
2
+ import fsExtra from 'fs-extra';
3
+ import { resolve as resolvePath } from 'path';
4
+ import tmp from 'tmp';
5
+ import { URL } from 'url';
6
+ import { UserError } from '../shared/error-handling.js';
7
+ import { Text } from '../ui/index.js';
12
8
  const TEMPLATE_SERVICE_URL = 'https://forge-templates-bifrost.prod-east.frontend.public.atl-paas.net/assets/';
13
9
  const TEMPLATE_MAP = 'templates.json';
14
- class NoTemplateError extends error_handling_1.UserError {
10
+ export class NoTemplateError extends UserError {
15
11
  constructor(template) {
16
- super(ui_1.Text.create.error.template.notFound(template));
12
+ super(Text.create.error.template.notFound(template));
17
13
  }
18
14
  }
19
- exports.NoTemplateError = NoTemplateError;
20
- class InvalidTemplateArchiveError extends Error {
15
+ export class InvalidTemplateArchiveError extends Error {
21
16
  }
22
- exports.InvalidTemplateArchiveError = InvalidTemplateArchiveError;
23
- class TemplateServiceDownloader {
17
+ export class TemplateServiceDownloader {
24
18
  async download(template, zipFile) {
25
19
  const zipUrl = this.buildZipUrl(template);
26
20
  const response = await fetch(zipUrl);
@@ -28,50 +22,47 @@ class TemplateServiceDownloader {
28
22
  throw new NoTemplateError(template);
29
23
  }
30
24
  const zipBytes = await response.arrayBuffer();
31
- fs_1.default.writeFileSync(zipFile, Buffer.from(zipBytes));
25
+ fs.writeFileSync(zipFile, Buffer.from(zipBytes));
32
26
  }
33
27
  buildZipUrl(template) {
34
- return new url_1.URL(`${template}.zip`, TEMPLATE_SERVICE_URL);
28
+ return new URL(`${template}.zip`, TEMPLATE_SERVICE_URL);
35
29
  }
36
30
  }
37
- exports.TemplateServiceDownloader = TemplateServiceDownloader;
38
- class ZipTemplateExtractor {
31
+ export class ZipTemplateExtractor {
39
32
  zipAccessor;
40
33
  constructor(zipAccessor) {
41
34
  this.zipAccessor = zipAccessor;
42
35
  }
43
36
  async extract(zipFile, destDirectory) {
44
- const extractDirectory = tmp_1.default.dirSync({ prefix: 'template', unsafeCleanup: true }).name;
37
+ const extractDirectory = tmp.dirSync({ prefix: 'template', unsafeCleanup: true }).name;
45
38
  try {
46
39
  await this.zipAccessor.extract(zipFile, extractDirectory);
47
40
  await this.moveArchiveFilesToDirectory(extractDirectory, destDirectory);
48
41
  }
49
42
  finally {
50
- (0, fs_extra_1.removeSync)(extractDirectory);
43
+ fsExtra.removeSync(extractDirectory);
51
44
  }
52
45
  }
53
46
  async moveArchiveFilesToDirectory(extractDirectory, destDirectory) {
54
- const archiveChildren = fs_1.default.readdirSync(extractDirectory);
47
+ const archiveChildren = fs.readdirSync(extractDirectory);
55
48
  if (archiveChildren.length !== 1) {
56
- throw new InvalidTemplateArchiveError(ui_1.Text.create.error.template.unexpectedArchiveFormat);
49
+ throw new InvalidTemplateArchiveError(Text.create.error.template.unexpectedArchiveFormat);
57
50
  }
58
- const templateRepoDirectory = (0, path_1.resolve)(extractDirectory, archiveChildren[0]);
59
- const templateEntries = fs_1.default.readdirSync(templateRepoDirectory);
51
+ const templateRepoDirectory = resolvePath(extractDirectory, archiveChildren[0]);
52
+ const templateEntries = fs.readdirSync(templateRepoDirectory);
60
53
  for (const entry of templateEntries) {
61
- const entrySourceFullPath = (0, path_1.resolve)(templateRepoDirectory, entry);
62
- const entryDestFullPath = (0, path_1.resolve)(destDirectory, entry);
63
- (0, fs_extra_1.moveSync)(entrySourceFullPath, entryDestFullPath);
54
+ const entrySourceFullPath = resolvePath(templateRepoDirectory, entry);
55
+ const entryDestFullPath = resolvePath(destDirectory, entry);
56
+ fsExtra.moveSync(entrySourceFullPath, entryDestFullPath);
64
57
  }
65
58
  }
66
59
  }
67
- exports.ZipTemplateExtractor = ZipTemplateExtractor;
68
- class TemplateFetchError extends Error {
60
+ export class TemplateFetchError extends Error {
69
61
  constructor(message) {
70
- super(ui_1.Text.error.templateFetchFailed(message));
62
+ super(Text.error.templateFetchFailed(message));
71
63
  }
72
64
  }
73
- exports.TemplateFetchError = TemplateFetchError;
74
- class TemplateServiceLister {
65
+ export class TemplateServiceLister {
75
66
  isValidTemplateMapEntry(entry) {
76
67
  return typeof entry === 'object' && entry !== null && typeof entry.name === 'string';
77
68
  }
@@ -82,7 +73,7 @@ class TemplateServiceLister {
82
73
  return false;
83
74
  }
84
75
  async getAvailableTemplates() {
85
- const res = await fetch(new url_1.URL(TEMPLATE_MAP, TEMPLATE_SERVICE_URL));
76
+ const res = await fetch(new URL(TEMPLATE_MAP, TEMPLATE_SERVICE_URL));
86
77
  if (!res.ok) {
87
78
  throw new TemplateFetchError(res.statusText);
88
79
  }
@@ -95,8 +86,7 @@ class TemplateServiceLister {
95
86
  }
96
87
  }
97
88
  }
98
- exports.TemplateServiceLister = TemplateServiceLister;
99
- class ComposableTemplater {
89
+ export class ComposableTemplater {
100
90
  downloader;
101
91
  extractor;
102
92
  lister;
@@ -108,26 +98,25 @@ class ComposableTemplater {
108
98
  this.logger = logger;
109
99
  }
110
100
  async downloadAndExtract(template, directory) {
111
- this.logger.info(ui_1.Text.create.taskTemplate.title);
112
- const zipFile = tmp_1.default.fileSync({ postfix: '.zip' }).name;
113
- const destDirectory = (0, path_1.resolve)(process.cwd(), directory);
101
+ this.logger.info(Text.create.taskTemplate.title);
102
+ const zipFile = tmp.fileSync({ postfix: '.zip' }).name;
103
+ const destDirectory = resolvePath(process.cwd(), directory);
114
104
  try {
115
- (0, fs_extra_1.mkdirpSync)(destDirectory);
116
- this.logger.debug(ui_1.Text.create.taskTemplate.downloading(template));
105
+ fsExtra.mkdirpSync(destDirectory);
106
+ this.logger.debug(Text.create.taskTemplate.downloading(template));
117
107
  await this.downloader.download(template, zipFile);
118
- this.logger.debug(ui_1.Text.create.taskTemplate.extracting);
108
+ this.logger.debug(Text.create.taskTemplate.extracting);
119
109
  await this.extractor.extract(zipFile, destDirectory);
120
110
  }
121
111
  catch (err) {
122
- (0, fs_extra_1.removeSync)(destDirectory);
112
+ fsExtra.removeSync(destDirectory);
123
113
  throw err;
124
114
  }
125
115
  finally {
126
- fs_1.default.unlinkSync(zipFile);
116
+ fs.unlinkSync(zipFile);
127
117
  }
128
118
  }
129
119
  getAvailableTemplates() {
130
120
  return this.lister.getAvailableTemplates();
131
121
  }
132
122
  }
133
- exports.ComposableTemplater = ComposableTemplater;
package/out/ari/ari.js CHANGED
@@ -1,34 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createWorkspaceAriByProduct = exports.UnknownInstallationWithoutResourceIdError = exports.UnknownWorkspaceWithoutResourceIdError = exports.UnknownSiteWithoutResourceIdError = exports.CUSTOMER_DATA_PLANE_PLACEMENT_TYPE = exports.REGION_PLACEMENT_TYPE = exports.ISOLATION_CONTEXT_PLACEMENT_TYPE = exports.BITBUCKET_RESOURCE_OWNER = exports.TRELLO_RESOURCE_OWNER = exports.UNIT_RESOURCE_TYPE = exports.INSTALLATION_RESOURCE_TYPE = exports.WORKSPACE_USER_RESOURCE_TYPE = exports.WORKSPACE_RESOURCE_TYPE = exports.SITE_RESOURCE_TYPE = void 0;
4
- exports.isValidPlacementId = isValidPlacementId;
5
- exports.appIdToAriString = appIdToAriString;
6
- exports.placementIdToPlacementType = placementIdToPlacementType;
7
- exports.placementIdToAri = placementIdToAri;
8
- exports.parsePlacementAriString = parsePlacementAriString;
9
- exports.buildContextAri = buildContextAri;
10
- exports.buildExtensionAri = buildExtensionAri;
11
- exports.encodeContext = encodeContext;
12
- exports.parseInstallationContext = parseInstallationContext;
13
- const ari_1 = require("@forge/util/packages/ari");
14
- const shared_1 = require("../shared");
15
- const ui_1 = require("../ui");
16
- exports.SITE_RESOURCE_TYPE = 'site';
17
- exports.WORKSPACE_RESOURCE_TYPE = 'workspace';
18
- exports.WORKSPACE_USER_RESOURCE_TYPE = 'workspace-user';
19
- exports.INSTALLATION_RESOURCE_TYPE = 'installation';
20
- exports.UNIT_RESOURCE_TYPE = 'unit';
21
- exports.TRELLO_RESOURCE_OWNER = 'trello';
22
- exports.BITBUCKET_RESOURCE_OWNER = 'bitbucket';
23
- exports.ISOLATION_CONTEXT_PLACEMENT_TYPE = 'isolation-context';
24
- exports.REGION_PLACEMENT_TYPE = 'region';
25
- exports.CUSTOMER_DATA_PLANE_PLACEMENT_TYPE = 'customer-data-plane';
1
+ import { AnyAri, CompassWorkspaceAri, ConfluenceWorkspaceAri, EcosystemAppPlacementAri, GraphWorkspaceAri, JiraWorkspaceAri } from '@forge/util/packages/ari';
2
+ import { ariResourceOwner } from '../shared/index.js';
3
+ import { Text } from '../ui/index.js';
4
+ export const SITE_RESOURCE_TYPE = 'site';
5
+ export const WORKSPACE_RESOURCE_TYPE = 'workspace';
6
+ export const WORKSPACE_USER_RESOURCE_TYPE = 'workspace-user';
7
+ export const INSTALLATION_RESOURCE_TYPE = 'installation';
8
+ export const UNIT_RESOURCE_TYPE = 'unit';
9
+ export const TRELLO_RESOURCE_OWNER = 'trello';
10
+ export const BITBUCKET_RESOURCE_OWNER = 'bitbucket';
11
+ export const ISOLATION_CONTEXT_PLACEMENT_TYPE = 'isolation-context';
12
+ export const REGION_PLACEMENT_TYPE = 'region';
13
+ export const CUSTOMER_DATA_PLANE_PLACEMENT_TYPE = 'customer-data-plane';
26
14
  const ISOLATION_CONTEXT_ID_PREFIX = 'ic-';
27
15
  const CUSTOMER_DATA_PLANE_ID_PREFIX = 'cdp-';
28
16
  const ISOLATION_CONTEXT_ID_PATTERN = /^ic-[a-z0-9]+$/;
29
17
  const CUSTOMER_DATA_PLANE_ID_PATTERN = /^cdp-[a-z0-9]+$/;
30
18
  const REGION_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
31
- function isValidPlacementId(placementId) {
19
+ export function isValidPlacementId(placementId) {
32
20
  if (placementId.startsWith(ISOLATION_CONTEXT_ID_PREFIX)) {
33
21
  return ISOLATION_CONTEXT_ID_PATTERN.test(placementId);
34
22
  }
@@ -37,80 +25,77 @@ function isValidPlacementId(placementId) {
37
25
  }
38
26
  return REGION_ID_PATTERN.test(placementId);
39
27
  }
40
- function appIdToAriString(appId) {
28
+ export function appIdToAriString(appId) {
41
29
  return `ari:cloud:ecosystem::app/${appId}`;
42
30
  }
43
- function placementIdToPlacementType(placementId) {
31
+ export function placementIdToPlacementType(placementId) {
44
32
  if (ISOLATION_CONTEXT_ID_PATTERN.test(placementId)) {
45
- return exports.ISOLATION_CONTEXT_PLACEMENT_TYPE;
33
+ return ISOLATION_CONTEXT_PLACEMENT_TYPE;
46
34
  }
47
35
  if (CUSTOMER_DATA_PLANE_ID_PATTERN.test(placementId)) {
48
- return exports.CUSTOMER_DATA_PLANE_PLACEMENT_TYPE;
36
+ return CUSTOMER_DATA_PLANE_PLACEMENT_TYPE;
49
37
  }
50
- return exports.REGION_PLACEMENT_TYPE;
38
+ return REGION_PLACEMENT_TYPE;
51
39
  }
52
- function placementIdToAri(placementId) {
53
- return ari_1.EcosystemAppPlacementAri.create({ placementType: placementIdToPlacementType(placementId), placementId });
40
+ export function placementIdToAri(placementId) {
41
+ return EcosystemAppPlacementAri.create({ placementType: placementIdToPlacementType(placementId), placementId });
54
42
  }
55
- function parsePlacementAriString(placementAri) {
56
- return ari_1.EcosystemAppPlacementAri.parse(placementAri);
43
+ export function parsePlacementAriString(placementAri) {
44
+ return EcosystemAppPlacementAri.parse(placementAri);
57
45
  }
58
- function buildContextAri(cloudId, product) {
59
- return ari_1.AnyAri.create({
60
- resourceOwner: (0, shared_1.ariResourceOwner)(product),
61
- resourceType: exports.SITE_RESOURCE_TYPE,
46
+ export function buildContextAri(cloudId, product) {
47
+ return AnyAri.create({
48
+ resourceOwner: ariResourceOwner(product),
49
+ resourceType: SITE_RESOURCE_TYPE,
62
50
  resourceId: cloudId
63
51
  });
64
52
  }
65
- function buildExtensionAri(appId, environmentId, functionKey) {
66
- return ari_1.AnyAri.create({
53
+ export function buildExtensionAri(appId, environmentId, functionKey) {
54
+ return AnyAri.create({
67
55
  resourceOwner: 'ecosystem',
68
56
  resourceType: 'extension',
69
57
  resourceId: `${appId}/${environmentId}/static/${functionKey}`
70
58
  });
71
59
  }
72
- function encodeContext(context, extension) {
60
+ export function encodeContext(context, extension) {
73
61
  const serialised = JSON.stringify({ ctx: context.toString(), ext: extension.toString() });
74
62
  return Buffer.from(serialised, 'utf-8').toString('base64').replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
75
63
  }
76
- class UnknownSiteWithoutResourceIdError extends Error {
64
+ export class UnknownSiteWithoutResourceIdError extends Error {
77
65
  constructor() {
78
- super(ui_1.Text.installList.noResourceId);
66
+ super(Text.installList.noResourceId);
79
67
  }
80
68
  }
81
- exports.UnknownSiteWithoutResourceIdError = UnknownSiteWithoutResourceIdError;
82
- class UnknownWorkspaceWithoutResourceIdError extends Error {
69
+ export class UnknownWorkspaceWithoutResourceIdError extends Error {
83
70
  constructor() {
84
- super(ui_1.Text.installList.noResourceIdInWorkspace);
71
+ super(Text.installList.noResourceIdInWorkspace);
85
72
  }
86
73
  }
87
- exports.UnknownWorkspaceWithoutResourceIdError = UnknownWorkspaceWithoutResourceIdError;
88
- class UnknownInstallationWithoutResourceIdError extends Error {
74
+ export class UnknownInstallationWithoutResourceIdError extends Error {
89
75
  constructor() {
90
- super(ui_1.Text.installList.noResourceIdInInstallation);
76
+ super(Text.installList.noResourceIdInInstallation);
91
77
  }
92
78
  }
93
- exports.UnknownInstallationWithoutResourceIdError = UnknownInstallationWithoutResourceIdError;
94
- function parseInstallationContext(installationContext) {
95
- const context = ari_1.AnyAri.parse(installationContext);
79
+ export function parseInstallationContext(installationContext) {
80
+ const context = AnyAri.parse(installationContext);
96
81
  switch (context.resourceType) {
97
- case exports.SITE_RESOURCE_TYPE:
82
+ case SITE_RESOURCE_TYPE:
98
83
  if (!context.resourceId) {
99
84
  throw new UnknownSiteWithoutResourceIdError();
100
85
  }
101
86
  break;
102
- case exports.WORKSPACE_RESOURCE_TYPE:
87
+ case WORKSPACE_RESOURCE_TYPE:
103
88
  if (!context.resourceId) {
104
89
  throw new UnknownWorkspaceWithoutResourceIdError();
105
90
  }
106
91
  break;
107
- case exports.INSTALLATION_RESOURCE_TYPE:
108
- case exports.UNIT_RESOURCE_TYPE:
92
+ case INSTALLATION_RESOURCE_TYPE:
93
+ case UNIT_RESOURCE_TYPE:
109
94
  if (!context.resourceId) {
110
95
  throw new UnknownInstallationWithoutResourceIdError();
111
96
  }
112
97
  break;
113
- case exports.WORKSPACE_USER_RESOURCE_TYPE:
98
+ case WORKSPACE_USER_RESOURCE_TYPE:
114
99
  const [activationId, userId] = (context.resourceId ?? '')?.split('/');
115
100
  if (!(activationId && userId)) {
116
101
  throw new UnknownWorkspaceWithoutResourceIdError();
@@ -121,9 +106,9 @@ function parseInstallationContext(installationContext) {
121
106
  }
122
107
  return context;
123
108
  }
124
- exports.createWorkspaceAriByProduct = {
125
- jira: (siteId, activationId) => ari_1.JiraWorkspaceAri.create({ siteId, activationId }),
126
- confluence: (siteId, activationId) => ari_1.ConfluenceWorkspaceAri.create({ siteId, activationId }),
127
- compass: (siteId, workspaceId) => ari_1.CompassWorkspaceAri.create({ siteId, workspaceId }),
128
- graph: (_siteId, workspaceId) => ari_1.GraphWorkspaceAri.create({ workspaceId })
109
+ export const createWorkspaceAriByProduct = {
110
+ jira: (siteId, activationId) => JiraWorkspaceAri.create({ siteId, activationId }),
111
+ confluence: (siteId, activationId) => ConfluenceWorkspaceAri.create({ siteId, activationId }),
112
+ compass: (siteId, workspaceId) => CompassWorkspaceAri.create({ siteId, workspaceId }),
113
+ graph: (_siteId, workspaceId) => GraphWorkspaceAri.create({ workspaceId })
129
114
  };
@@ -1,2 +1,2 @@
1
- export * from './ari';
1
+ export * from './ari.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ari/index.ts"],"names":[],"mappings":"AAEA,cAAc,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ari/index.ts"],"names":[],"mappings":"AAEA,cAAc,UAAU,CAAC"}
package/out/ari/index.js CHANGED
@@ -1,4 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./ari"), exports);
1
+ export * from './ari.js';
@@ -1,11 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBasicAuthorizationHeader = getBasicAuthorizationHeader;
4
- exports.getBearerAuthorizationHeader = getBearerAuthorizationHeader;
5
- function getBasicAuthorizationHeader(username, password) {
1
+ export function getBasicAuthorizationHeader(username, password) {
6
2
  const base64 = Buffer.from(`${username}:${password}`).toString('base64');
7
3
  return { authorization: `Basic ${base64}` };
8
4
  }
9
- function getBearerAuthorizationHeader(token) {
5
+ export function getBearerAuthorizationHeader(token) {
10
6
  return { authorization: `Bearer ${token}` };
11
7
  }
@@ -1,4 +1,4 @@
1
- export * from './personal';
2
- export * from './authenticator';
3
- export * from './instruction';
1
+ export * from './personal/index.js';
2
+ export * from './authenticator.js';
3
+ export * from './instruction.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAEA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAEA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
package/out/auth/index.js CHANGED
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./personal"), exports);
5
- tslib_1.__exportStar(require("./authenticator"), exports);
6
- tslib_1.__exportStar(require("./instruction"), exports);
1
+ export * from './personal/index.js';
2
+ export * from './authenticator.js';
3
+ export * from './instruction.js';
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getInstructionsUrl = getInstructionsUrl;
4
- const gateway_1 = require("../graphql/gateway");
1
+ import { getEnvironmentConfig } from '../graphql/gateway.js';
5
2
  const INSTRUCTION_URLS = {
6
3
  DEV: 'https://go.atlassian.com/forge-cli-api-token-stg',
7
4
  STG: 'https://go.atlassian.com/forge-cli-api-token-stg',
@@ -9,6 +6,6 @@ const INSTRUCTION_URLS = {
9
6
  FEDRAMP_MODERATE_STAGING: 'https://go.atlassian.com/forge-cli-api-token-federal-stg',
10
7
  FEDRAMP_MODERATE_PROD: 'https://go.atlassian.com/forge-cli-api-token-federal'
11
8
  };
12
- function getInstructionsUrl() {
13
- return (0, gateway_1.getEnvironmentConfig)(INSTRUCTION_URLS);
9
+ export function getInstructionsUrl() {
10
+ return getEnvironmentConfig(INSTRUCTION_URLS);
14
11
  }
@@ -1,6 +1,6 @@
1
1
  import * as t from 'io-ts';
2
- import { UserError } from '../../shared';
3
- import { UserRepository } from './user-repository';
2
+ import { UserError } from '../../shared/index.js';
3
+ import { UserRepository } from './user-repository.js';
4
4
  export declare const EMAIL_KEY = "FORGE_EMAIL";
5
5
  export declare const API_TOKEN_KEY = "FORGE_API_TOKEN";
6
6
  export declare const personalApiCredentialsShape: t.TypeC<{