@forge/cli-shared 10.0.0-next.13 → 10.0.0-next.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/out/app-logs/graphql-client.d.ts +2 -2
- package/out/app-logs/graphql-client.d.ts.map +1 -1
- package/out/app-logs/graphql-client.js +9 -17
- package/out/app-logs/index.d.ts +2 -2
- package/out/app-logs/index.d.ts.map +1 -1
- package/out/app-logs/index.js +2 -5
- package/out/app-logs/view-logs.d.ts +4 -4
- package/out/app-logs/view-logs.d.ts.map +1 -1
- package/out/app-logs/view-logs.js +8 -12
- package/out/apps/app-config.d.ts +2 -2
- package/out/apps/app-config.d.ts.map +1 -1
- package/out/apps/app-config.js +13 -20
- package/out/apps/create-an-app.d.ts +4 -4
- package/out/apps/create-an-app.d.ts.map +1 -1
- package/out/apps/create-an-app.js +6 -11
- package/out/apps/create-app-graphql-client.d.ts +2 -2
- package/out/apps/create-app-graphql-client.d.ts.map +1 -1
- package/out/apps/create-app-graphql-client.js +9 -14
- package/out/apps/get-app-owner.d.ts +4 -4
- package/out/apps/get-app-owner.d.ts.map +1 -1
- package/out/apps/get-app-owner.js +8 -13
- package/out/apps/index.d.ts +9 -9
- package/out/apps/index.d.ts.map +1 -1
- package/out/apps/index.js +9 -12
- package/out/apps/package-installer.d.ts +1 -1
- package/out/apps/package-installer.d.ts.map +1 -1
- package/out/apps/package-installer.js +9 -14
- package/out/apps/register-app.d.ts +4 -4
- package/out/apps/register-app.d.ts.map +1 -1
- package/out/apps/register-app.js +9 -13
- package/out/apps/sites.js +1 -4
- package/out/apps/template-module.js +27 -33
- package/out/apps/template.d.ts +3 -3
- package/out/apps/template.d.ts.map +1 -1
- package/out/apps/template.js +36 -47
- package/out/ari/ari.js +48 -63
- package/out/ari/index.d.ts +1 -1
- package/out/ari/index.d.ts.map +1 -1
- package/out/ari/index.js +1 -4
- package/out/auth/authenticator.js +2 -6
- package/out/auth/index.d.ts +3 -3
- package/out/auth/index.d.ts.map +1 -1
- package/out/auth/index.js +3 -6
- package/out/auth/instruction.js +3 -6
- package/out/auth/personal/credential-store.d.ts +2 -2
- package/out/auth/personal/credential-store.d.ts.map +1 -1
- package/out/auth/personal/credential-store.js +48 -57
- package/out/auth/personal/index.d.ts +6 -6
- package/out/auth/personal/index.d.ts.map +1 -1
- package/out/auth/personal/index.js +6 -9
- package/out/auth/personal/login.d.ts +3 -3
- package/out/auth/personal/login.d.ts.map +1 -1
- package/out/auth/personal/login.js +1 -5
- package/out/auth/personal/logout.d.ts +1 -1
- package/out/auth/personal/logout.d.ts.map +1 -1
- package/out/auth/personal/logout.js +1 -5
- package/out/auth/personal/me-graphql-client.d.ts +3 -3
- package/out/auth/personal/me-graphql-client.d.ts.map +1 -1
- package/out/auth/personal/me-graphql-client.js +7 -12
- package/out/auth/personal/token-authenticator.d.ts +3 -3
- package/out/auth/personal/token-authenticator.d.ts.map +1 -1
- package/out/auth/personal/token-authenticator.js +10 -14
- package/out/auth/personal/user-repository.d.ts +4 -4
- package/out/auth/personal/user-repository.d.ts.map +1 -1
- package/out/auth/personal/user-repository.js +5 -9
- package/out/cache/cached-conf.d.ts.map +1 -1
- package/out/cache/cached-conf.js +5 -10
- package/out/cache/index.d.ts +1 -1
- package/out/cache/index.d.ts.map +1 -1
- package/out/cache/index.js +1 -4
- package/out/config/config-codec-types.js +1 -2
- package/out/config/config-file-section-reader.d.ts +3 -3
- package/out/config/config-file-section-reader.d.ts.map +1 -1
- package/out/config/config-file-section-reader.js +4 -10
- package/out/config/config-file-section-writer.d.ts +3 -3
- package/out/config/config-file-section-writer.d.ts.map +1 -1
- package/out/config/config-file-section-writer.js +2 -7
- package/out/config/config-file.d.ts +3 -3
- package/out/config/config-file.d.ts.map +1 -1
- package/out/config/config-file.js +40 -49
- package/out/config/config-section.js +4 -11
- package/out/config/config.d.ts +1 -1
- package/out/config/config.d.ts.map +1 -1
- package/out/config/config.js +7 -13
- package/out/config/index.d.ts +6 -6
- package/out/config/index.d.ts.map +1 -1
- package/out/config/index.js +6 -9
- package/out/file-system/archiver.d.ts +2 -2
- package/out/file-system/archiver.d.ts.map +1 -1
- package/out/file-system/archiver.js +20 -29
- package/out/file-system/file-system-reader.d.ts.map +1 -1
- package/out/file-system/file-system-reader.js +21 -26
- package/out/file-system/file-system-writer.js +5 -10
- package/out/file-system/index.d.ts +5 -5
- package/out/file-system/index.d.ts.map +1 -1
- package/out/file-system/index.js +5 -8
- package/out/file-system/util.js +1 -4
- package/out/file-system/zip-accessor.js +3 -8
- package/out/graphql/app-environment-graphql-client.d.ts +2 -2
- package/out/graphql/app-environment-graphql-client.d.ts.map +1 -1
- package/out/graphql/app-environment-graphql-client.js +10 -16
- package/out/graphql/app-oauth-client-id-graphql-client.d.ts +1 -1
- package/out/graphql/app-oauth-client-id-graphql-client.d.ts.map +1 -1
- package/out/graphql/app-oauth-client-id-graphql-client.js +6 -10
- package/out/graphql/debugging-graphql-runner.d.ts +2 -2
- package/out/graphql/debugging-graphql-runner.d.ts.map +1 -1
- package/out/graphql/debugging-graphql-runner.js +5 -10
- package/out/graphql/gateway.js +15 -23
- package/out/graphql/get-mutation-error.js +4 -8
- package/out/graphql/gql/gql.d.ts +82 -82
- package/out/graphql/gql/gql.d.ts.map +1 -1
- package/out/graphql/gql/gql.js +2 -6
- package/out/graphql/gql/graphql.d.ts +214 -12
- package/out/graphql/gql/graphql.d.ts.map +1 -1
- package/out/graphql/gql/graphql.js +83 -88
- package/out/graphql/gql/index.d.ts +1 -1
- package/out/graphql/gql/index.d.ts.map +1 -1
- package/out/graphql/gql/index.js +1 -4
- package/out/graphql/graphql-client.js +1 -2
- package/out/graphql/graphql-domain-types.d.ts +1 -1
- package/out/graphql/graphql-domain-types.d.ts.map +1 -1
- package/out/graphql/graphql-domain-types.js +1 -2
- package/out/graphql/graphql-runtime-enums.js +16 -19
- package/out/graphql/index.d.ts +12 -12
- package/out/graphql/index.d.ts.map +1 -1
- package/out/graphql/index.js +12 -17
- package/out/graphql/minimal-graphql-runner.d.ts +4 -4
- package/out/graphql/minimal-graphql-runner.d.ts.map +1 -1
- package/out/graphql/minimal-graphql-runner.js +31 -40
- package/out/graphql/mutation-aware-graphql-client.d.ts +2 -2
- package/out/graphql/mutation-aware-graphql-client.d.ts.map +1 -1
- package/out/graphql/mutation-aware-graphql-client.js +4 -10
- package/out/graphql/path-based-graphql-client-resolver.d.ts +1 -1
- package/out/graphql/path-based-graphql-client-resolver.d.ts.map +1 -1
- package/out/graphql/path-based-graphql-client-resolver.js +3 -7
- package/out/http-client/feedback-post-client.js +1 -5
- package/out/http-client/file-uploader.d.ts +1 -1
- package/out/http-client/file-uploader.d.ts.map +1 -1
- package/out/http-client/file-uploader.js +11 -18
- package/out/http-client/global-edge-http-client.js +8 -14
- package/out/http-client/index.d.ts +5 -5
- package/out/http-client/index.d.ts.map +1 -1
- package/out/http-client/index.js +5 -8
- package/out/http-client/node-request.js +10 -16
- package/out/http-client/trace.js +1 -4
- package/out/index.d.ts +13 -13
- package/out/index.d.ts.map +1 -1
- package/out/index.js +13 -16
- package/out/service/bridge-script-service.js +5 -9
- package/out/service/i18n-resource-bundling-service.js +24 -30
- package/out/service/iframe-resizer-script-service.js +5 -9
- package/out/service/index.d.ts +5 -5
- package/out/service/index.d.ts.map +1 -1
- package/out/service/index.js +5 -8
- package/out/service/statsig-service.d.ts +1 -1
- package/out/service/statsig-service.d.ts.map +1 -1
- package/out/service/statsig-service.js +9 -15
- package/out/service/supported-products-service.d.ts +2 -2
- package/out/service/supported-products-service.d.ts.map +1 -1
- package/out/service/supported-products-service.js +13 -18
- package/out/shared/assertUnreachable.js +1 -4
- package/out/shared/assistant-cli.d.ts +1 -1
- package/out/shared/assistant-cli.d.ts.map +1 -1
- package/out/shared/assistant-cli.js +15 -24
- package/out/shared/cli-details.js +6 -11
- package/out/shared/developer-console.js +12 -18
- package/out/shared/directories.js +4 -8
- package/out/shared/environment.d.ts +1 -1
- package/out/shared/environment.d.ts.map +1 -1
- package/out/shared/environment.js +19 -25
- package/out/shared/error-handling.d.ts +1 -1
- package/out/shared/error-handling.d.ts.map +1 -1
- package/out/shared/error-handling.js +24 -44
- package/out/shared/forge-cli-attribution.js +6 -11
- package/out/shared/index.d.ts +13 -13
- package/out/shared/index.d.ts.map +1 -1
- package/out/shared/index.js +13 -16
- package/out/shared/installations.js +1 -4
- package/out/shared/pause.js +1 -5
- package/out/shared/product.d.ts.map +1 -1
- package/out/shared/product.js +5 -10
- package/out/shared/read-app-config-files.d.ts +1 -1
- package/out/shared/read-app-config-files.d.ts.map +1 -1
- package/out/shared/read-app-config-files.js +6 -12
- package/out/shared/runner-signals.js +1 -5
- package/out/shared/test.d.ts +1 -1
- package/out/shared/test.d.ts.map +1 -1
- package/out/shared/test.js +24 -29
- package/out/tunnel/docker-compose-lifecycle.d.ts +3 -3
- package/out/tunnel/docker-compose-lifecycle.d.ts.map +1 -1
- package/out/tunnel/docker-compose-lifecycle.js +53 -70
- package/out/tunnel/index.d.ts +2 -2
- package/out/tunnel/index.d.ts.map +1 -1
- package/out/tunnel/index.js +2 -5
- package/out/tunnel/tunnel-options.js +13 -18
- package/out/ui/command-line-ui.d.ts +2 -2
- package/out/ui/command-line-ui.d.ts.map +1 -1
- package/out/ui/command-line-ui.js +53 -58
- package/out/ui/hint-rotation.d.ts +2 -2
- package/out/ui/hint-rotation.d.ts.map +1 -1
- package/out/ui/hint-rotation.js +2 -6
- package/out/ui/index.d.ts +8 -8
- package/out/ui/index.d.ts.map +1 -1
- package/out/ui/index.js +8 -11
- package/out/ui/log-color.js +16 -20
- package/out/ui/log-symbols.js +10 -13
- package/out/ui/logger.js +2 -6
- package/out/ui/multiple-table-prompt.d.ts +1 -1
- package/out/ui/multiple-table-prompt.d.ts.map +1 -1
- package/out/ui/multiple-table-prompt.js +13 -20
- package/out/ui/runtime-log.js +12 -16
- package/out/ui/single-table-prompt.d.ts +1 -1
- package/out/ui/single-table-prompt.d.ts.map +1 -1
- package/out/ui/single-table-prompt.js +12 -19
- package/out/ui/table-prompt.d.ts +1 -1
- package/out/ui/table-prompt.d.ts.map +1 -1
- package/out/ui/table-prompt.js +11 -16
- package/out/ui/table.d.ts.map +1 -1
- package/out/ui/table.js +4 -7
- package/out/ui/text.d.ts +1 -1
- package/out/ui/text.d.ts.map +1 -1
- package/out/ui/text.js +208 -214
- package/out/ui/ui.d.ts +2 -2
- package/out/ui/ui.d.ts.map +1 -1
- package/out/ui/ui.js +1 -2
- package/package.json +3 -2
|
@@ -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,
|
|
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,uBAAuB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,eAAO,MAAM,SAAS,gBAAgB,CAAC;AACvC,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAiB/C,eAAO,MAAM,2BAA2B;;;EAGtC,CAAC;AAEH,eAAO,MAAM,oCAAoC;;;;EAI/C,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAClF,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAEpG,qBAAa,mBAAoB,SAAQ,SAAS;;CAIjD;AAED,qBAAa,4BAA6B,SAAQ,SAAS;gBAC7C,KAAK,CAAC,EAAE,OAAO;CAI5B;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,IAAI,OAAO,CAAC,+BAA+B,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,cAAc,CAAC,WAAW,EAAE,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5E,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
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
|
-
|
|
27
|
+
export const personalApiCredentialsShape = t.type({
|
|
34
28
|
email: t.string,
|
|
35
29
|
token: t.string
|
|
36
30
|
});
|
|
37
|
-
|
|
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
|
|
36
|
+
export class NoTokenInStoreError extends UserError {
|
|
43
37
|
constructor() {
|
|
44
|
-
super(
|
|
38
|
+
super(Text.error.noTokenStored);
|
|
45
39
|
}
|
|
46
40
|
}
|
|
47
|
-
|
|
48
|
-
class CredentialStoreSecurityError extends shared_1.UserError {
|
|
41
|
+
export class CredentialStoreSecurityError extends UserError {
|
|
49
42
|
constructor(cause) {
|
|
50
|
-
super(
|
|
43
|
+
super(Text.error.credentialsFilePermissions);
|
|
51
44
|
this.cause = cause;
|
|
52
45
|
}
|
|
53
46
|
}
|
|
54
|
-
|
|
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,
|
|
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 =
|
|
65
|
-
const platformPath = currentPlatform === 'win32' ?
|
|
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 =
|
|
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
|
|
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 =
|
|
130
|
-
await
|
|
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
|
|
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
|
|
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 =
|
|
152
|
-
await
|
|
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
|
|
157
|
-
const directoryStat = await
|
|
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
|
|
158
|
+
const file = await fs.open(this.credentialsFilePath, 'wx', CREDENTIALS_FILE_MODE);
|
|
167
159
|
await file.close();
|
|
168
160
|
}
|
|
169
|
-
await
|
|
170
|
-
const fileStat = await
|
|
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
|
|
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
|
|
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 (
|
|
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[
|
|
209
|
+
if (process.env[API_TOKEN_KEY] && process.env[EMAIL_KEY]) {
|
|
218
210
|
const credentials = {
|
|
219
|
-
email: process.env[
|
|
220
|
-
token: process.env[
|
|
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
|
|
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
|
|
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
|
|
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
|
|
263
|
+
await fs.writeFile(this.credentialsFilePath, `${JSON.stringify(credentialsByAccount, null, 2)}\n`, 'utf8');
|
|
272
264
|
await this.secureStorage(false);
|
|
273
265
|
}
|
|
274
266
|
}
|
|
275
|
-
|
|
276
|
-
|
|
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,
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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,
|
|
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
|
-
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
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
|
-
|
|
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,
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
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 =
|
|
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(
|
|
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,
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
|
12
|
+
return getBasicAuthorizationHeader(email, token);
|
|
16
13
|
}
|
|
17
14
|
getInstructionsWhenInvalid() {
|
|
18
|
-
const instructionsUrl =
|
|
19
|
-
if (process.env[
|
|
20
|
-
return
|
|
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
|
|
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,
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
|
26
|
+
const authenticator = new PersonalTokenAuthenticator({
|
|
30
27
|
getCredentials: async () => ({ ...credentials, accountId: '' })
|
|
31
28
|
});
|
|
32
29
|
const graphqlClient = this.createGraphQLClient(authenticator);
|
|
33
|
-
const meClient = new
|
|
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,CAAY;gBAErB,WAAW,EAAE,MAAM;gBACnB,KAAK,EAAE,SAAS;
|
|
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,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"}
|
package/out/cache/cached-conf.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
|
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;
|
package/out/cache/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './cached-conf';
|
|
1
|
+
export * from './cached-conf.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/out/cache/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
package/out/cache/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
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":"AAAA,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"config-file-section-reader.d.ts","sourceRoot":"","sources":["../../src/config/config-file-section-reader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,eAAO,MAAM,aAAa,aAAa,CAAC;AACxC,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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;
|