@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 +1 @@
1
- {"version":3,"file":"credential-store.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/credential-store.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,eAAO,MAAM,SAAS,gBAAgB,CAAC;AACvC,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAiB/C,eAAO,MAAM,2BAA2B;;;EAGtC,CAA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CACpC;AAID,MAAM,MAAM,4BAA4B,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAezG,wBAAgB,sBAAsB,CACpC,eAAe,kBAAa,EAC5B,WAAW,GAAE,MAAM,CAAC,UAAwB,EAC5C,QAAQ,SAAY,GACnB,MAAM,CAwBR;AAED,qBAAa,mBAAoB,YAAW,eAAe;IAIvD,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAPhC,OAAO,CAAC,cAAc,CAA8B;gBAGjC,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,MAAM,EACf,mBAAmB,SAA2B,EAC9C,eAAe,kBAAa,EAC5B,aAAa,GAAE,4BAAwD;YAG5E,iBAAiB;YAWjB,eAAe;YAaf,oBAAoB;YA0BpB,kBAAkB;YAiDlB,aAAa;YAab,mBAAmB;IA4B3B,cAAc,IAAI,OAAO,CAAC,+BAA+B,CAAC;IAkB1D,cAAc,CAAC,WAAW,EAAE,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB3E,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;CA2BzC;AAED,wBAAgB,kBAAkB,CAAC,cAAc,EAAE,cAAc,GAAG,eAAe,CAElF"}
@@ -1,21 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FileCredentialStore = exports.CredentialStoreSecurityError = exports.NoTokenInStoreError = exports.personalApiCredentialsValidatedShape = exports.personalApiCredentialsShape = exports.API_TOKEN_KEY = exports.EMAIL_KEY = void 0;
4
- exports.getCredentialsFilePath = getCredentialsFilePath;
5
- exports.getCredentialStore = getCredentialStore;
6
- const tslib_1 = require("tslib");
7
- const child_process_1 = require("child_process");
8
- const fs_1 = require("fs");
9
- const os_1 = require("os");
10
- const path_1 = tslib_1.__importDefault(require("path"));
11
- const util_1 = require("util");
12
- const Either_1 = require("fp-ts/lib/Either");
13
- const t = tslib_1.__importStar(require("io-ts"));
14
- const graphql_1 = require("../../graphql");
15
- const shared_1 = require("../../shared");
16
- const ui_1 = require("../../ui");
17
- exports.EMAIL_KEY = 'FORGE_EMAIL';
18
- exports.API_TOKEN_KEY = 'FORGE_API_TOKEN';
1
+ import { execFile } from 'child_process';
2
+ import { promises as fs } from 'fs';
3
+ import { homedir, platform } from 'os';
4
+ import path from 'path';
5
+ import { promisify } from 'util';
6
+ import { isLeft } from 'fp-ts/lib/Either.js';
7
+ import * as t from 'io-ts';
8
+ import { getEnvironmentConfig } from '../../graphql/index.js';
9
+ import { UserError } from '../../shared/index.js';
10
+ import { Text } from '../../ui/index.js';
11
+ export const EMAIL_KEY = 'FORGE_EMAIL';
12
+ export const API_TOKEN_KEY = 'FORGE_API_TOKEN';
19
13
  const CREDENTIALS_FILE_NAME = 'credentials.json';
20
14
  const CREDENTIALS_DIRECTORY_MODE = 0o700;
21
15
  const CREDENTIALS_FILE_MODE = 0o600;
@@ -30,39 +24,37 @@ var CredentialAccount;
30
24
  CredentialAccount["FEDRAMP_MODERATE_STAGING"] = "Ecosystem-fedm-staging";
31
25
  CredentialAccount["FEDRAMP_MODERATE_PROD"] = "Ecosystem-fedm-prod";
32
26
  })(CredentialAccount || (CredentialAccount = {}));
33
- exports.personalApiCredentialsShape = t.type({
27
+ export const personalApiCredentialsShape = t.type({
34
28
  email: t.string,
35
29
  token: t.string
36
30
  });
37
- exports.personalApiCredentialsValidatedShape = t.type({
31
+ export const personalApiCredentialsValidatedShape = t.type({
38
32
  email: t.string,
39
33
  token: t.string,
40
34
  accountId: t.string
41
35
  });
42
- class NoTokenInStoreError extends shared_1.UserError {
36
+ export class NoTokenInStoreError extends UserError {
43
37
  constructor() {
44
- super(ui_1.Text.error.noTokenStored);
38
+ super(Text.error.noTokenStored);
45
39
  }
46
40
  }
47
- exports.NoTokenInStoreError = NoTokenInStoreError;
48
- class CredentialStoreSecurityError extends shared_1.UserError {
41
+ export class CredentialStoreSecurityError extends UserError {
49
42
  constructor(cause) {
50
- super(ui_1.Text.error.credentialsFilePermissions);
43
+ super(Text.error.credentialsFilePermissions);
51
44
  this.cause = cause;
52
45
  }
53
46
  }
54
- exports.CredentialStoreSecurityError = CredentialStoreSecurityError;
55
- const execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
47
+ const execFileAsync = promisify(execFile);
56
48
  const runCredentialStoreCommand = async (command, args) => {
57
49
  const { stdout } = await execFileAsync(command, [...args], { encoding: 'utf8', windowsHide: true });
58
50
  return stdout;
59
51
  };
60
- const credentialsByAccountShape = t.record(t.string, exports.personalApiCredentialsValidatedShape);
52
+ const credentialsByAccountShape = t.record(t.string, personalApiCredentialsValidatedShape);
61
53
  function isFileNotFoundError(error) {
62
54
  return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';
63
55
  }
64
- function getCredentialsFilePath(currentPlatform = (0, os_1.platform)(), environment = process.env, userHome = (0, os_1.homedir)()) {
65
- const platformPath = currentPlatform === 'win32' ? path_1.default.win32 : path_1.default.posix;
56
+ export function getCredentialsFilePath(currentPlatform = platform(), environment = process.env, userHome = homedir()) {
57
+ const platformPath = currentPlatform === 'win32' ? path.win32 : path.posix;
66
58
  let credentialsDirectory;
67
59
  switch (currentPlatform) {
68
60
  case 'darwin':
@@ -76,14 +68,14 @@ function getCredentialsFilePath(currentPlatform = (0, os_1.platform)(), environm
76
68
  }
77
69
  return platformPath.join(credentialsDirectory, CREDENTIALS_FILE_NAME);
78
70
  }
79
- class FileCredentialStore {
71
+ export class FileCredentialStore {
80
72
  userRepository;
81
73
  account;
82
74
  credentialsFilePath;
83
75
  currentPlatform;
84
76
  commandRunner;
85
77
  windowsUserSid;
86
- constructor(userRepository, account, credentialsFilePath = getCredentialsFilePath(), currentPlatform = (0, os_1.platform)(), commandRunner = runCredentialStoreCommand) {
78
+ constructor(userRepository, account, credentialsFilePath = getCredentialsFilePath(), currentPlatform = platform(), commandRunner = runCredentialStoreCommand) {
87
79
  this.userRepository = userRepository;
88
80
  this.account = account;
89
81
  this.credentialsFilePath = credentialsFilePath;
@@ -115,7 +107,7 @@ class FileCredentialStore {
115
107
  async secureWindowsStorage(createFile) {
116
108
  let fileExists = true;
117
109
  try {
118
- await fs_1.promises.access(this.credentialsFilePath);
110
+ await fs.access(this.credentialsFilePath);
119
111
  }
120
112
  catch (error) {
121
113
  if (!isFileNotFoundError(error)) {
@@ -126,18 +118,18 @@ class FileCredentialStore {
126
118
  if (!fileExists && !createFile) {
127
119
  return;
128
120
  }
129
- const credentialsDirectory = path_1.default.dirname(this.credentialsFilePath);
130
- await fs_1.promises.mkdir(credentialsDirectory, { recursive: true });
121
+ const credentialsDirectory = path.dirname(this.credentialsFilePath);
122
+ await fs.mkdir(credentialsDirectory, { recursive: true });
131
123
  await this.applyWindowsAcl(credentialsDirectory, true);
132
124
  if (!fileExists) {
133
- await fs_1.promises.writeFile(this.credentialsFilePath, '', { flag: 'wx' });
125
+ await fs.writeFile(this.credentialsFilePath, '', { flag: 'wx' });
134
126
  }
135
127
  await this.applyWindowsAcl(this.credentialsFilePath, false);
136
128
  }
137
129
  async securePosixStorage(createFile) {
138
130
  let fileExists = true;
139
131
  try {
140
- await fs_1.promises.access(this.credentialsFilePath);
132
+ await fs.access(this.credentialsFilePath);
141
133
  }
142
134
  catch (error) {
143
135
  if (!isFileNotFoundError(error)) {
@@ -148,13 +140,13 @@ class FileCredentialStore {
148
140
  if (!fileExists && !createFile) {
149
141
  return;
150
142
  }
151
- const credentialsDirectory = path_1.default.dirname(this.credentialsFilePath);
152
- await fs_1.promises.mkdir(credentialsDirectory, {
143
+ const credentialsDirectory = path.dirname(this.credentialsFilePath);
144
+ await fs.mkdir(credentialsDirectory, {
153
145
  recursive: true,
154
146
  mode: CREDENTIALS_DIRECTORY_MODE
155
147
  });
156
- await fs_1.promises.chmod(credentialsDirectory, CREDENTIALS_DIRECTORY_MODE);
157
- const directoryStat = await fs_1.promises.stat(credentialsDirectory);
148
+ await fs.chmod(credentialsDirectory, CREDENTIALS_DIRECTORY_MODE);
149
+ const directoryStat = await fs.stat(credentialsDirectory);
158
150
  const currentUserId = process.getuid?.();
159
151
  if (currentUserId === undefined ||
160
152
  !directoryStat.isDirectory() ||
@@ -163,11 +155,11 @@ class FileCredentialStore {
163
155
  throw new Error('The credentials directory is not owned exclusively by the current user');
164
156
  }
165
157
  if (!fileExists) {
166
- const file = await fs_1.promises.open(this.credentialsFilePath, 'wx', CREDENTIALS_FILE_MODE);
158
+ const file = await fs.open(this.credentialsFilePath, 'wx', CREDENTIALS_FILE_MODE);
167
159
  await file.close();
168
160
  }
169
- await fs_1.promises.chmod(this.credentialsFilePath, CREDENTIALS_FILE_MODE);
170
- const fileStat = await fs_1.promises.stat(this.credentialsFilePath);
161
+ await fs.chmod(this.credentialsFilePath, CREDENTIALS_FILE_MODE);
162
+ const fileStat = await fs.stat(this.credentialsFilePath);
171
163
  if (!fileStat.isFile() ||
172
164
  fileStat.uid !== currentUserId ||
173
165
  (fileStat.mode & PERMISSION_BITS_MASK) !== CREDENTIALS_FILE_MODE) {
@@ -184,7 +176,7 @@ class FileCredentialStore {
184
176
  }
185
177
  }
186
178
  catch (error) {
187
- await fs_1.promises.rm(this.credentialsFilePath, { force: true }).catch(() => undefined);
179
+ await fs.rm(this.credentialsFilePath, { force: true }).catch(() => undefined);
188
180
  throw new CredentialStoreSecurityError(error);
189
181
  }
190
182
  }
@@ -192,7 +184,7 @@ class FileCredentialStore {
192
184
  let contents;
193
185
  try {
194
186
  await this.secureStorage(false);
195
- contents = await fs_1.promises.readFile(this.credentialsFilePath, 'utf8');
187
+ contents = await fs.readFile(this.credentialsFilePath, 'utf8');
196
188
  }
197
189
  catch (error) {
198
190
  if (isFileNotFoundError(error)) {
@@ -208,16 +200,16 @@ class FileCredentialStore {
208
200
  throw new NoTokenInStoreError();
209
201
  }
210
202
  const decodeResult = credentialsByAccountShape.decode(parsed);
211
- if ((0, Either_1.isLeft)(decodeResult)) {
203
+ if (isLeft(decodeResult)) {
212
204
  throw new NoTokenInStoreError();
213
205
  }
214
206
  return decodeResult.right;
215
207
  }
216
208
  async getCredentials() {
217
- if (process.env[exports.API_TOKEN_KEY] && process.env[exports.EMAIL_KEY]) {
209
+ if (process.env[API_TOKEN_KEY] && process.env[EMAIL_KEY]) {
218
210
  const credentials = {
219
- email: process.env[exports.EMAIL_KEY],
220
- token: process.env[exports.API_TOKEN_KEY]
211
+ email: process.env[EMAIL_KEY],
212
+ token: process.env[API_TOKEN_KEY]
221
213
  };
222
214
  const { accountId } = await this.userRepository.getUser(credentials);
223
215
  return { ...credentials, accountId };
@@ -241,7 +233,7 @@ class FileCredentialStore {
241
233
  }
242
234
  credentialsByAccount[this.account] = credentials;
243
235
  await this.secureStorage(true);
244
- await fs_1.promises.writeFile(this.credentialsFilePath, `${JSON.stringify(credentialsByAccount, null, 2)}\n`, 'utf8');
236
+ await fs.writeFile(this.credentialsFilePath, `${JSON.stringify(credentialsByAccount, null, 2)}\n`, 'utf8');
245
237
  await this.secureStorage(false);
246
238
  }
247
239
  async deleteCredentials() {
@@ -253,13 +245,13 @@ class FileCredentialStore {
253
245
  if (!(error instanceof NoTokenInStoreError)) {
254
246
  throw error;
255
247
  }
256
- await fs_1.promises.rm(this.credentialsFilePath, { force: true });
248
+ await fs.rm(this.credentialsFilePath, { force: true });
257
249
  return;
258
250
  }
259
251
  delete credentialsByAccount[this.account];
260
252
  if (Object.keys(credentialsByAccount).length === 0) {
261
253
  try {
262
- await fs_1.promises.unlink(this.credentialsFilePath);
254
+ await fs.unlink(this.credentialsFilePath);
263
255
  }
264
256
  catch (error) {
265
257
  if (!isFileNotFoundError(error)) {
@@ -268,11 +260,10 @@ class FileCredentialStore {
268
260
  }
269
261
  return;
270
262
  }
271
- await fs_1.promises.writeFile(this.credentialsFilePath, `${JSON.stringify(credentialsByAccount, null, 2)}\n`, 'utf8');
263
+ await fs.writeFile(this.credentialsFilePath, `${JSON.stringify(credentialsByAccount, null, 2)}\n`, 'utf8');
272
264
  await this.secureStorage(false);
273
265
  }
274
266
  }
275
- exports.FileCredentialStore = FileCredentialStore;
276
- function getCredentialStore(userRepository) {
277
- return new FileCredentialStore(userRepository, (0, graphql_1.getEnvironmentConfig)(CredentialAccount));
267
+ export function getCredentialStore(userRepository) {
268
+ return new FileCredentialStore(userRepository, getEnvironmentConfig(CredentialAccount));
278
269
  }
@@ -1,7 +1,7 @@
1
- export * from './credential-store';
2
- export * from './login';
3
- export * from './logout';
4
- export * from './me-graphql-client';
5
- export * from './token-authenticator';
6
- export * from './user-repository';
1
+ export * from './credential-store.js';
2
+ export * from './login.js';
3
+ export * from './logout.js';
4
+ export * from './me-graphql-client.js';
5
+ export * from './token-authenticator.js';
6
+ export * from './user-repository.js';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/index.ts"],"names":[],"mappings":"AAEA,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC"}
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./credential-store"), exports);
5
- tslib_1.__exportStar(require("./login"), exports);
6
- tslib_1.__exportStar(require("./logout"), exports);
7
- tslib_1.__exportStar(require("./me-graphql-client"), exports);
8
- tslib_1.__exportStar(require("./token-authenticator"), exports);
9
- tslib_1.__exportStar(require("./user-repository"), exports);
1
+ export * from './credential-store.js';
2
+ export * from './login.js';
3
+ export * from './logout.js';
4
+ export * from './me-graphql-client.js';
5
+ export * from './token-authenticator.js';
6
+ export * from './user-repository.js';
@@ -1,6 +1,6 @@
1
- import { User } from '../../graphql';
2
- import { UserRepository } from '../../auth';
3
- import { CredentialStore, PersonalApiCredentials } from './credential-store';
1
+ import { User } from '../../graphql/index.js';
2
+ import { UserRepository } from '../../auth/index.js';
3
+ import { CredentialStore, PersonalApiCredentials } from './credential-store.js';
4
4
  export declare class LoginCommand {
5
5
  private readonly userRepository;
6
6
  private readonly store;
@@ -1 +1 @@
1
- {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE7E,qBAAa,YAAY;IAErB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK;gBADL,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,eAAe;IAG5B,OAAO,CAAC,WAAW,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;CAOzE"}
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEhF,qBAAa,YAAY;IAErB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK;gBADL,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,eAAe;IAG5B,OAAO,CAAC,WAAW,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;CAOzE"}
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LoginCommand = void 0;
4
- class LoginCommand {
1
+ export class LoginCommand {
5
2
  userRepository;
6
3
  store;
7
4
  constructor(userRepository, store) {
@@ -14,4 +11,3 @@ class LoginCommand {
14
11
  return user;
15
12
  }
16
13
  }
17
- exports.LoginCommand = LoginCommand;
@@ -1,4 +1,4 @@
1
- import { CredentialStore } from './credential-store';
1
+ import { CredentialStore } from './credential-store.js';
2
2
  export declare class LogoutCommand {
3
3
  private readonly store;
4
4
  constructor(store: CredentialStore);
@@ -1 +1 @@
1
- {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,eAAe;IAE5C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC"}
1
+ {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,eAAe;IAE5C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC"}
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LogoutCommand = void 0;
4
- class LogoutCommand {
1
+ export class LogoutCommand {
5
2
  store;
6
3
  constructor(store) {
7
4
  this.store = store;
@@ -10,4 +7,3 @@ class LogoutCommand {
10
7
  return this.store.deleteCredentials();
11
8
  }
12
9
  }
13
- exports.LogoutCommand = LogoutCommand;
@@ -1,6 +1,6 @@
1
- import { GraphQLClient, User } from '../../graphql';
2
- import { UserError } from '../../shared';
3
- import { Logger } from '../../ui';
1
+ import { GraphQLClient, User } from '../../graphql/index.js';
2
+ import { UserError } from '../../shared/index.js';
3
+ import { Logger } from '../../ui/index.js';
4
4
  export declare class UserNotFoundError extends UserError {
5
5
  }
6
6
  export declare class MeGraphqlClient {
@@ -1 +1 @@
1
- {"version":3,"file":"me-graphql-client.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/me-graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAW,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAC;AAEhD,qBAAa,iBAAkB,SAAQ,SAAS;CAAG;AAEnD,qBAAa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM;IAGpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAyBtC"}
1
+ {"version":3,"file":"me-graphql-client.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/me-graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAW,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAgB,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEzD,qBAAa,iBAAkB,SAAQ,SAAS;CAAG;AAEnD,qBAAa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM;IAGpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAyBtC"}
@@ -1,13 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MeGraphqlClient = exports.UserNotFoundError = void 0;
4
- const graphql_1 = require("../../graphql");
5
- const shared_1 = require("../../shared");
6
- const ui_1 = require("../../ui");
7
- class UserNotFoundError extends shared_1.UserError {
1
+ import { graphql } from '../../graphql/index.js';
2
+ import { UserError } from '../../shared/index.js';
3
+ import { errorMessage } from '../../ui/index.js';
4
+ export class UserNotFoundError extends UserError {
8
5
  }
9
- exports.UserNotFoundError = UserNotFoundError;
10
- class MeGraphqlClient {
6
+ export class MeGraphqlClient {
11
7
  graphqlClient;
12
8
  logger;
13
9
  constructor(graphqlClient, logger) {
@@ -16,7 +12,7 @@ class MeGraphqlClient {
16
12
  }
17
13
  async getUser() {
18
14
  try {
19
- const query = (0, graphql_1.graphql)(`
15
+ const query = graphql(`
20
16
  query forge_cli_getUserDetails {
21
17
  me {
22
18
  user {
@@ -33,9 +29,8 @@ class MeGraphqlClient {
33
29
  }
34
30
  }
35
31
  catch (error) {
36
- this.logger.debug((0, ui_1.errorMessage)(error));
32
+ this.logger.debug(errorMessage(error));
37
33
  }
38
34
  throw new UserNotFoundError();
39
35
  }
40
36
  }
41
- exports.MeGraphqlClient = MeGraphqlClient;
@@ -1,9 +1,9 @@
1
- import { Authenticator } from '../authenticator';
2
- import { CredentialGetter } from './credential-store';
1
+ import { Authenticator } from '../authenticator.js';
2
+ import { CredentialGetter } from './credential-store.js';
3
3
  export declare class PersonalTokenAuthenticator implements Authenticator {
4
4
  private readonly credentialStore;
5
5
  constructor(credentialStore: CredentialGetter);
6
- getAuthorizationHeader(): Promise<import("../authenticator").AuthorizationHeader>;
6
+ getAuthorizationHeader(): Promise<import("../authenticator.js").AuthorizationHeader>;
7
7
  getInstructionsWhenInvalid(): string;
8
8
  }
9
9
  //# sourceMappingURL=token-authenticator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"token-authenticator.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/token-authenticator.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAAiB,gBAAgB,EAAa,MAAM,oBAAoB,CAAC;AAEhF,qBAAa,0BAA2B,YAAW,aAAa;IAClD,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,gBAAgB;IAEjD,sBAAsB;IAO5B,0BAA0B,IAAI,MAAM;CAO5C"}
1
+ {"version":3,"file":"token-authenticator.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/token-authenticator.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAiB,gBAAgB,EAAa,MAAM,uBAAuB,CAAC;AAEnF,qBAAa,0BAA2B,YAAW,aAAa;IAClD,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,gBAAgB;IAEjD,sBAAsB;IAO5B,0BAA0B,IAAI,MAAM;CAO5C"}
@@ -1,25 +1,21 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PersonalTokenAuthenticator = void 0;
4
- const ui_1 = require("../../ui");
5
- const authenticator_1 = require("../authenticator");
6
- const instruction_1 = require("../instruction");
7
- const credential_store_1 = require("./credential-store");
8
- class PersonalTokenAuthenticator {
1
+ import { Text } from '../../ui/index.js';
2
+ import { getBasicAuthorizationHeader } from '../authenticator.js';
3
+ import { getInstructionsUrl } from '../instruction.js';
4
+ import { API_TOKEN_KEY, EMAIL_KEY } from './credential-store.js';
5
+ export class PersonalTokenAuthenticator {
9
6
  credentialStore;
10
7
  constructor(credentialStore) {
11
8
  this.credentialStore = credentialStore;
12
9
  }
13
10
  async getAuthorizationHeader() {
14
11
  const { email, token } = await this.credentialStore.getCredentials();
15
- return (0, authenticator_1.getBasicAuthorizationHeader)(email, token);
12
+ return getBasicAuthorizationHeader(email, token);
16
13
  }
17
14
  getInstructionsWhenInvalid() {
18
- const instructionsUrl = (0, instruction_1.getInstructionsUrl)();
19
- if (process.env[credential_store_1.API_TOKEN_KEY] && process.env[credential_store_1.EMAIL_KEY]) {
20
- return ui_1.Text.error.invalidTokenInEnv(instructionsUrl, credential_store_1.EMAIL_KEY, credential_store_1.API_TOKEN_KEY);
15
+ const instructionsUrl = getInstructionsUrl();
16
+ if (process.env[API_TOKEN_KEY] && process.env[EMAIL_KEY]) {
17
+ return Text.error.invalidTokenInEnv(instructionsUrl, EMAIL_KEY, API_TOKEN_KEY);
21
18
  }
22
- return ui_1.Text.error.invalidTokenInCredentialFile;
19
+ return Text.error.invalidTokenInCredentialFile;
23
20
  }
24
21
  }
25
- exports.PersonalTokenAuthenticator = PersonalTokenAuthenticator;
@@ -1,7 +1,7 @@
1
- import { GraphQLClient, User } from '../../graphql';
2
- import { Logger } from '../../ui';
3
- import { Authenticator } from '..';
4
- import { PersonalApiCredentials } from './credential-store';
1
+ import { GraphQLClient, User } from '../../graphql/index.js';
2
+ import { Logger } from '../../ui/index.js';
3
+ import { Authenticator } from '../index.js';
4
+ import { PersonalApiCredentials } from './credential-store.js';
5
5
  export interface UserRepository {
6
6
  getUser(credentials: PersonalApiCredentials): Promise<User>;
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"user-repository.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/user-repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAInC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,WAAW,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D;AAED,qBAAa,kBAAkB;IAI3B,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJzB,OAAO,CAAC,KAAK,CAA+C;gBAGzC,mBAAmB,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,aAAa,EACpE,MAAM,EAAE,MAAM;IAGjC,OAAO,CAAC,aAAa;IAWR,OAAO,CAAC,WAAW,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;CAkBzE"}
1
+ {"version":3,"file":"user-repository.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/user-repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,WAAW,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D;AAED,qBAAa,kBAAkB;IAI3B,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJzB,OAAO,CAAC,KAAK,CAA+C;gBAGzC,mBAAmB,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,aAAa,EACpE,MAAM,EAAE,MAAM;IAGjC,OAAO,CAAC,aAAa;IAWR,OAAO,CAAC,WAAW,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;CAkBzE"}
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserRepositoryImpl = void 0;
4
- const me_graphql_client_1 = require("./me-graphql-client");
5
- const token_authenticator_1 = require("./token-authenticator");
6
- class UserRepositoryImpl {
1
+ import { MeGraphqlClient } from './me-graphql-client.js';
2
+ import { PersonalTokenAuthenticator } from './token-authenticator.js';
3
+ export class UserRepositoryImpl {
7
4
  createGraphQLClient;
8
5
  logger;
9
6
  cache = null;
@@ -26,14 +23,13 @@ class UserRepositoryImpl {
26
23
  if (cachedUser) {
27
24
  return cachedUser;
28
25
  }
29
- const authenticator = new token_authenticator_1.PersonalTokenAuthenticator({
26
+ const authenticator = new PersonalTokenAuthenticator({
30
27
  getCredentials: async () => ({ ...credentials, accountId: '' })
31
28
  });
32
29
  const graphqlClient = this.createGraphQLClient(authenticator);
33
- const meClient = new me_graphql_client_1.MeGraphqlClient(graphqlClient, this.logger);
30
+ const meClient = new MeGraphqlClient(graphqlClient, this.logger);
34
31
  const user = await meClient.getUser();
35
32
  this.cache = [credentials, user];
36
33
  return user;
37
34
  }
38
35
  }
39
- exports.UserRepositoryImpl = UserRepositoryImpl;
@@ -1 +1 @@
1
- {"version":3,"file":"cached-conf.d.ts","sourceRoot":"","sources":["../../src/cache/cached-conf.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,QAAuD,CAAC;AAExF,UAAU,WAAW,CAAC,CAAC;IACrB,KAAK,EAAE,CAAC,CAAC;IACT,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,UAAU,SAAS;IACjB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC/C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAChD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAID,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI,C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E,MAAM,GAAG,IAAI,CAAC;CAC3B;AAID,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;gBAErB,WAAW,EAAE,MAAM;gBACnB,KAAK,EAAE,SAAS;IAerB,GAAG,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAapD,GAAG,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAOnE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAWzB,MAAM,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC;IAC1E,MAAM,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAkBnG,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU;IAQhD,MAAM,CAAC,WAAW,IAAI,UAAU;CAGjC"}
@@ -1,16 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CachedConf = exports.CONFIG_PROJECT_NAME = void 0;
4
- const tslib_1 = require("tslib");
5
- const conf_1 = tslib_1.__importDefault(require("conf"));
6
- const shared_1 = require("../shared");
7
- exports.CONFIG_PROJECT_NAME = process.env.CONFIG_PROJECT_NAME || shared_1.FORGE_CLI_PACKAGE;
1
+ import Conf from 'conf';
2
+ import { FORGE_CLI_PACKAGE } from '../shared/index.js';
3
+ export const CONFIG_PROJECT_NAME = process.env.CONFIG_PROJECT_NAME || FORGE_CLI_PACKAGE;
8
4
  const isThenable = (input) => input && typeof input.then === 'function';
9
- class CachedConf {
5
+ export class CachedConf {
10
6
  conf;
11
7
  constructor(arg) {
12
8
  if (typeof arg === 'string') {
13
- this.conf = new conf_1.default({
9
+ this.conf = new Conf.default({
14
10
  projectName: arg
15
11
  });
16
12
  }
@@ -61,4 +57,3 @@ class CachedConf {
61
57
  return new CachedConf(new Map());
62
58
  }
63
59
  }
64
- exports.CachedConf = CachedConf;
@@ -1,2 +1,2 @@
1
- export * from './cached-conf';
1
+ export * from './cached-conf.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
@@ -1,4 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./cached-conf"), exports);
1
+ export * from './cached-conf.js';
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,7 +1,7 @@
1
1
  import * as t from 'io-ts';
2
- import { ConfigReader } from './config';
3
- import { Codec, CodecType, InnerType } from './config-codec-types';
4
- import { ConfigSectionReader } from './config-section';
2
+ import { ConfigReader } from './config.js';
3
+ import { Codec, CodecType, InnerType } from './config-codec-types.js';
4
+ import { ConfigSectionReader } from './config-section.js';
5
5
  export declare const NO_VALIDATION: t.TypeC<{}>;
6
6
  export type NO_VALIDATION_TYPE = t.TypeOf<typeof NO_VALIDATION>;
7
7
  export declare class ConfigFileSectionReader {
@@ -1 +1 @@
1
- {"version":3,"file":"config-file-section-reader.d.ts","sourceRoot":"","sources":["../../src/config/config-file-section-reader.ts"],"names":[],"mappings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AM,CAAC,OAAO,aAAa,CAAC,CAAC;AAEhE,qBAAa,uBAAuB;IACtB,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAAZ,YAAY,EAAE,YAAY;IAE1C,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,KAAK,EAC9D,GAAG,EAAE,CAAC,EACN,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,SAAS,CAAC;CAWjD;AAcD,eAAO,MAAM,0BAA0B,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,KAAK,EAC1E,KAAK,CAAC,EACN,QAAQ,SAAS,CAAC,CAAC,CAAC,EACpB,cAAc,YAAY,KACzB,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAElC,CAAC"}
@@ -1,10 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.configFileReaderForSection = exports.ConfigFileSectionReader = exports.NO_VALIDATION = void 0;
4
- const tslib_1 = require("tslib");
5
- const t = tslib_1.__importStar(require("io-ts"));
6
- exports.NO_VALIDATION = t.type({});
7
- class ConfigFileSectionReader {
1
+ import * as t from 'io-ts';
2
+ export const NO_VALIDATION = t.type({});
3
+ export class ConfigFileSectionReader {
8
4
  configReader;
9
5
  constructor(configReader) {
10
6
  this.configReader = configReader;
@@ -23,7 +19,6 @@ class ConfigFileSectionReader {
23
19
  }
24
20
  }
25
21
  }
26
- exports.ConfigFileSectionReader = ConfigFileSectionReader;
27
22
  class ShapedConfigFileSectionReader {
28
23
  configSectionReader;
29
24
  key;
@@ -37,7 +32,6 @@ class ShapedConfigFileSectionReader {
37
32
  return this.configSectionReader.readConfigSection(this.key, this.schema);
38
33
  }
39
34
  }
40
- const configFileReaderForSection = (key, schema, configReader) => {
35
+ export const configFileReaderForSection = (key, schema, configReader) => {
41
36
  return new ShapedConfigFileSectionReader(new ConfigFileSectionReader(configReader), key, schema);
42
37
  };
43
- exports.configFileReaderForSection = configFileReaderForSection;