@forge/cli-shared 2.6.2 → 3.0.0-next.2
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 +23 -0
- package/out/auth/index.d.ts +0 -1
- package/out/auth/index.d.ts.map +1 -1
- package/out/auth/index.js +0 -1
- package/out/auth/personal/credential-store.d.ts +51 -0
- package/out/auth/personal/credential-store.d.ts.map +1 -0
- package/out/auth/personal/credential-store.js +170 -0
- package/out/auth/personal/index.d.ts +1 -4
- package/out/auth/personal/index.d.ts.map +1 -1
- package/out/auth/personal/index.js +1 -4
- package/out/auth/personal/login.d.ts +2 -2
- package/out/auth/personal/login.d.ts.map +1 -1
- package/out/auth/personal/login.js +1 -1
- package/out/auth/personal/logout.d.ts +2 -2
- package/out/auth/personal/logout.d.ts.map +1 -1
- 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 +4 -4
- package/out/graphql/graphql-types.d.ts +384 -27
- package/out/graphql/graphql-types.d.ts.map +1 -1
- package/out/graphql/graphql-types.js +31 -1
- package/out/graphql/mutation-aware-graphql-client.d.ts +1 -1
- package/out/service/feature-flag-service.d.ts +3 -3
- package/out/service/feature-flag-service.d.ts.map +1 -1
- package/out/service/feature-flag-service.js +3 -3
- package/out/shared/product.d.ts +4 -1
- package/out/shared/product.d.ts.map +1 -1
- package/out/shared/product.js +11 -4
- package/out/shared/validate.d.ts +1 -1
- package/out/shared/validate.d.ts.map +1 -1
- package/out/shared/validate.js +5 -1
- package/out/ui/text.d.ts +9 -3
- package/out/ui/text.d.ts.map +1 -1
- package/out/ui/text.js +27 -9
- package/package.json +3 -5
- package/out/auth/credentials-store-provider.d.ts +0 -4
- package/out/auth/credentials-store-provider.d.ts.map +0 -1
- package/out/auth/credentials-store-provider.js +0 -11
- package/out/auth/personal/abstract-token-store-getter.d.ts +0 -13
- package/out/auth/personal/abstract-token-store-getter.d.ts.map +0 -1
- package/out/auth/personal/abstract-token-store-getter.js +0 -31
- package/out/auth/personal/token-store-cache.d.ts +0 -12
- package/out/auth/personal/token-store-cache.d.ts.map +0 -1
- package/out/auth/personal/token-store-cache.js +0 -41
- package/out/auth/personal/token-store-keytar.d.ts +0 -23
- package/out/auth/personal/token-store-keytar.d.ts.map +0 -1
- package/out/auth/personal/token-store-keytar.js +0 -101
- package/out/auth/personal/token-store.d.ts +0 -28
- package/out/auth/personal/token-store.d.ts.map +0 -1
- package/out/auth/personal/token-store.js +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @forge/cli-shared
|
|
2
2
|
|
|
3
|
+
## 3.0.0-next.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 35172f2: Add ngrok debug logs
|
|
8
|
+
|
|
9
|
+
## 3.0.0-next.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [c9f0e83]
|
|
14
|
+
- @forge/manifest@4.1.0-next.0
|
|
15
|
+
|
|
16
|
+
## 3.0.0-next.0
|
|
17
|
+
|
|
18
|
+
### Major Changes
|
|
19
|
+
|
|
20
|
+
- 5972825c: Refuse to store credentials in plaintext
|
|
21
|
+
|
|
22
|
+
### Minor Changes
|
|
23
|
+
|
|
24
|
+
- edab85a5: Adding silent BBC app installation
|
|
25
|
+
|
|
3
26
|
## 2.6.2
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/out/auth/index.d.ts
CHANGED
package/out/auth/index.d.ts.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/out/auth/index.js
CHANGED
|
@@ -3,5 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./personal"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./authenticator"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./credentials-store-provider"), exports);
|
|
7
6
|
tslib_1.__exportStar(require("./instruction"), exports);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as t from 'io-ts';
|
|
2
|
+
import { Logger } from '../../ui';
|
|
3
|
+
import { CachedConf } from '../../cache';
|
|
4
|
+
export declare const EMAIL_KEY = "FORGE_EMAIL";
|
|
5
|
+
export declare const API_TOKEN_KEY = "FORGE_API_TOKEN";
|
|
6
|
+
export interface Keytar {
|
|
7
|
+
getPassword(service: string, account: string): Promise<string | null>;
|
|
8
|
+
setPassword(service: string, account: string, password: string): Promise<void>;
|
|
9
|
+
deletePassword(service: string, account: string): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare const personalApiCredentialsShape: t.TypeC<{
|
|
12
|
+
email: t.StringC;
|
|
13
|
+
token: t.StringC;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const personalApiCredentialsValidatedShape: t.TypeC<{
|
|
16
|
+
email: t.StringC;
|
|
17
|
+
token: t.StringC;
|
|
18
|
+
accountId: t.StringC;
|
|
19
|
+
}>;
|
|
20
|
+
export declare type PersonalApiCredentials = t.TypeOf<typeof personalApiCredentialsShape>;
|
|
21
|
+
export declare type PersonalApiCredentialsValidated = t.TypeOf<typeof personalApiCredentialsValidatedShape>;
|
|
22
|
+
export declare class NoTokenInStoreError extends Error {
|
|
23
|
+
constructor();
|
|
24
|
+
}
|
|
25
|
+
export interface CredentialGetter {
|
|
26
|
+
getCredentials(): Promise<PersonalApiCredentialsValidated>;
|
|
27
|
+
getInstructionsWhenInvalid(): string;
|
|
28
|
+
}
|
|
29
|
+
export interface CredentialStore extends CredentialGetter {
|
|
30
|
+
setCredentials(credentials: PersonalApiCredentialsValidated): Promise<void>;
|
|
31
|
+
deleteCredentials(): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export declare class CredentialStoreImpl implements CredentialStore {
|
|
34
|
+
private readonly logger;
|
|
35
|
+
private readonly instructionsURL;
|
|
36
|
+
private readonly keytar;
|
|
37
|
+
private readonly cachedConfig;
|
|
38
|
+
private keytarAccount;
|
|
39
|
+
constructor(logger: Logger, instructionsURL: string, keytar: Keytar | null, cachedConfig: CachedConf);
|
|
40
|
+
private wrapKeytarError;
|
|
41
|
+
decodeCredentials(credentialsString: string | null): PersonalApiCredentialsValidated;
|
|
42
|
+
getCredentialsKeytar(keytar: Keytar): Promise<PersonalApiCredentialsValidated | undefined>;
|
|
43
|
+
popInsecurePlaintextCredentials(): PersonalApiCredentialsValidated | undefined;
|
|
44
|
+
deleteInsecurePlaintextCredentials(): void;
|
|
45
|
+
getCredentials(): Promise<PersonalApiCredentialsValidated>;
|
|
46
|
+
setCredentials(credentials: PersonalApiCredentialsValidated): Promise<void>;
|
|
47
|
+
deleteCredentials(): Promise<void>;
|
|
48
|
+
getInstructionsWhenInvalid(): string;
|
|
49
|
+
}
|
|
50
|
+
export declare function getCredentialStore(logger: Logger): CredentialStore;
|
|
51
|
+
//# sourceMappingURL=credential-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-store.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/credential-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAQ,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC,eAAO,MAAM,SAAS,gBAAgB,CAAC;AACvC,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAa/C,MAAM,WAAW,MAAM;IACrB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACtE,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE;AAUD,eAAO,MAAM,2BAA2B;;;EAGtC,CAAC;AAEH,eAAO,MAAM,oCAAoC;;;;EAI/C,CAAC;AAEH,oBAAY,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAClF,oBAAY,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAEpG,qBAAa,mBAAoB,SAAQ,KAAK;;CAI7C;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,IAAI,OAAO,CAAC,+BAA+B,CAAC,CAAC;IAC3D,0BAA0B,IAAI,MAAM,CAAC;CACtC;AAED,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,cAAc,CAAC,WAAW,EAAE,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5E,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED,qBAAa,mBAAoB,YAAW,eAAe;IAIvD,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAN/B,OAAO,CAAC,aAAa,CAAS;gBAGX,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,YAAY,EAAE,UAAU;IAK3C,OAAO,CAAC,eAAe;IAoBvB,iBAAiB,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,GAAG,+BAA+B;IAoB9E,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,+BAA+B,GAAG,SAAS,CAAC;IAehG,+BAA+B,IAAI,+BAA+B,GAAG,SAAS;IAS9E,kCAAkC,IAAI,IAAI;IAIpC,cAAc,IAAI,OAAO,CAAC,+BAA+B,CAAC;IA6B1D,cAAc,CAAC,WAAW,EAAE,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ3E,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAQxC,0BAA0B,IAAI,MAAM;CAMrC;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAKlE"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCredentialStore = exports.CredentialStoreImpl = exports.NoTokenInStoreError = exports.personalApiCredentialsValidatedShape = exports.personalApiCredentialsShape = exports.API_TOKEN_KEY = exports.EMAIL_KEY = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const os_1 = require("os");
|
|
6
|
+
const Either_1 = require("fp-ts/lib/Either");
|
|
7
|
+
const t = tslib_1.__importStar(require("io-ts"));
|
|
8
|
+
const ui_1 = require("../../ui");
|
|
9
|
+
const cache_1 = require("../../cache");
|
|
10
|
+
const instruction_1 = require("../instruction");
|
|
11
|
+
const graphql_1 = require("../../graphql");
|
|
12
|
+
const shared_1 = require("../../shared");
|
|
13
|
+
exports.EMAIL_KEY = 'FORGE_EMAIL';
|
|
14
|
+
exports.API_TOKEN_KEY = 'FORGE_API_TOKEN';
|
|
15
|
+
const AAID_KEY = 'FORGE_AAID';
|
|
16
|
+
const KEYTAR_SERVICE = 'Atlassian';
|
|
17
|
+
const FORGE_CLI_PACKAGE = '@forge/cli';
|
|
18
|
+
const CACHE_CREDENTIALS_KEY = 'forge-credentials';
|
|
19
|
+
var KeytarAccount;
|
|
20
|
+
(function (KeytarAccount) {
|
|
21
|
+
KeytarAccount["DEV"] = "Ecosystem-staging";
|
|
22
|
+
KeytarAccount["STG"] = "Ecosystem-staging";
|
|
23
|
+
KeytarAccount["PROD"] = "Ecosystem";
|
|
24
|
+
})(KeytarAccount || (KeytarAccount = {}));
|
|
25
|
+
function getKeytar() {
|
|
26
|
+
try {
|
|
27
|
+
return require('keytar');
|
|
28
|
+
}
|
|
29
|
+
catch (_a) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.personalApiCredentialsShape = t.type({
|
|
34
|
+
email: t.string,
|
|
35
|
+
token: t.string
|
|
36
|
+
});
|
|
37
|
+
exports.personalApiCredentialsValidatedShape = t.type({
|
|
38
|
+
email: t.string,
|
|
39
|
+
token: t.string,
|
|
40
|
+
accountId: t.string
|
|
41
|
+
});
|
|
42
|
+
class NoTokenInStoreError extends Error {
|
|
43
|
+
constructor() {
|
|
44
|
+
super(ui_1.Text.error.noTokenStored);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.NoTokenInStoreError = NoTokenInStoreError;
|
|
48
|
+
class CredentialStoreImpl {
|
|
49
|
+
constructor(logger, instructionsURL, keytar, cachedConfig) {
|
|
50
|
+
this.logger = logger;
|
|
51
|
+
this.instructionsURL = instructionsURL;
|
|
52
|
+
this.keytar = keytar;
|
|
53
|
+
this.cachedConfig = cachedConfig;
|
|
54
|
+
this.keytarAccount = graphql_1.getEnvironment(KeytarAccount);
|
|
55
|
+
}
|
|
56
|
+
wrapKeytarError(e) {
|
|
57
|
+
const message = shared_1.wrapError(e).message;
|
|
58
|
+
let error;
|
|
59
|
+
const currentPlatform = os_1.platform();
|
|
60
|
+
switch (currentPlatform) {
|
|
61
|
+
case 'darwin':
|
|
62
|
+
error = ui_1.Text.error.keytarAccessError.mac(message);
|
|
63
|
+
break;
|
|
64
|
+
case 'linux':
|
|
65
|
+
error = ui_1.Text.error.keytarAccessError.linux(message);
|
|
66
|
+
break;
|
|
67
|
+
case 'win32':
|
|
68
|
+
error = ui_1.Text.error.keytarAccessError.windows(message);
|
|
69
|
+
break;
|
|
70
|
+
default:
|
|
71
|
+
error = ui_1.Text.error.keytarAccessError.other(message);
|
|
72
|
+
}
|
|
73
|
+
throw new Error(error);
|
|
74
|
+
}
|
|
75
|
+
decodeCredentials(credentialsString) {
|
|
76
|
+
if (!credentialsString) {
|
|
77
|
+
throw new NoTokenInStoreError();
|
|
78
|
+
}
|
|
79
|
+
let credentials;
|
|
80
|
+
try {
|
|
81
|
+
credentials = JSON.parse(credentialsString);
|
|
82
|
+
}
|
|
83
|
+
catch (_a) {
|
|
84
|
+
throw new NoTokenInStoreError();
|
|
85
|
+
}
|
|
86
|
+
const decodeResult = exports.personalApiCredentialsValidatedShape.decode(credentials);
|
|
87
|
+
if (Either_1.isLeft(decodeResult)) {
|
|
88
|
+
throw new NoTokenInStoreError();
|
|
89
|
+
}
|
|
90
|
+
return decodeResult.right;
|
|
91
|
+
}
|
|
92
|
+
async getCredentialsKeytar(keytar) {
|
|
93
|
+
let stringifiedPersonalApiCredentials;
|
|
94
|
+
try {
|
|
95
|
+
stringifiedPersonalApiCredentials = await keytar.getPassword(KEYTAR_SERVICE, this.keytarAccount);
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
this.wrapKeytarError(e);
|
|
99
|
+
}
|
|
100
|
+
if (!stringifiedPersonalApiCredentials) {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
return this.decodeCredentials(stringifiedPersonalApiCredentials);
|
|
104
|
+
}
|
|
105
|
+
popInsecurePlaintextCredentials() {
|
|
106
|
+
const result = this.cachedConfig.get(CACHE_CREDENTIALS_KEY);
|
|
107
|
+
if (result) {
|
|
108
|
+
this.logger.warn(ui_1.Text.warning.plaintextCredentialsFound(this.instructionsURL));
|
|
109
|
+
this.deleteInsecurePlaintextCredentials();
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
deleteInsecurePlaintextCredentials() {
|
|
114
|
+
this.cachedConfig.delete(CACHE_CREDENTIALS_KEY);
|
|
115
|
+
}
|
|
116
|
+
async getCredentials() {
|
|
117
|
+
const plaintextCredentials = this.popInsecurePlaintextCredentials();
|
|
118
|
+
if (plaintextCredentials) {
|
|
119
|
+
if (this.keytar) {
|
|
120
|
+
await this.setCredentials(plaintextCredentials);
|
|
121
|
+
this.logger.warn(ui_1.Text.warning.plaintextCredentialsMigrated);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
this.logger.warn(ui_1.Text.warning.plaintextCredentialsNotMigrated);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (process.env[exports.API_TOKEN_KEY] && process.env[exports.EMAIL_KEY]) {
|
|
128
|
+
return {
|
|
129
|
+
email: process.env[exports.EMAIL_KEY],
|
|
130
|
+
token: process.env[exports.API_TOKEN_KEY],
|
|
131
|
+
accountId: process.env[AAID_KEY] || ''
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
if (this.keytar) {
|
|
135
|
+
const result = await this.getCredentialsKeytar(this.keytar);
|
|
136
|
+
if (result) {
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
throw new NoTokenInStoreError();
|
|
141
|
+
}
|
|
142
|
+
async setCredentials(credentials) {
|
|
143
|
+
if (this.keytar) {
|
|
144
|
+
await this.keytar.setPassword(KEYTAR_SERVICE, this.keytarAccount, JSON.stringify(credentials));
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
throw new Error(ui_1.Text.error.noKeytar);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
async deleteCredentials() {
|
|
151
|
+
if (this.keytar) {
|
|
152
|
+
await this.keytar.deletePassword(KEYTAR_SERVICE, this.keytarAccount);
|
|
153
|
+
}
|
|
154
|
+
this.deleteInsecurePlaintextCredentials();
|
|
155
|
+
}
|
|
156
|
+
getInstructionsWhenInvalid() {
|
|
157
|
+
if (process.env[exports.API_TOKEN_KEY] && process.env[exports.EMAIL_KEY]) {
|
|
158
|
+
return ui_1.Text.error.invalidTokenInEnv(this.instructionsURL, exports.EMAIL_KEY, exports.API_TOKEN_KEY);
|
|
159
|
+
}
|
|
160
|
+
return ui_1.Text.error.invalidTokenInKeytar;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
exports.CredentialStoreImpl = CredentialStoreImpl;
|
|
164
|
+
function getCredentialStore(logger) {
|
|
165
|
+
const keytar = getKeytar();
|
|
166
|
+
const cachedConfig = cache_1.CachedConf.getCache(FORGE_CLI_PACKAGE);
|
|
167
|
+
const instructionsUrl = instruction_1.getInstructionsUrl(graphql_1.getGraphqlGateway());
|
|
168
|
+
return new CredentialStoreImpl(logger, instructionsUrl, keytar, cachedConfig);
|
|
169
|
+
}
|
|
170
|
+
exports.getCredentialStore = getCredentialStore;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './credential-store';
|
|
2
2
|
export * from './login';
|
|
3
3
|
export * from './logout';
|
|
4
4
|
export * from './me-graphql-client';
|
|
5
5
|
export * from './token-authenticator';
|
|
6
|
-
export * from './token-store';
|
|
7
|
-
export * from './token-store-cache';
|
|
8
|
-
export * from './token-store-keytar';
|
|
9
6
|
//# 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,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./
|
|
4
|
+
tslib_1.__exportStar(require("./credential-store"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./login"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./logout"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./me-graphql-client"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./token-authenticator"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./token-store"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./token-store-cache"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./token-store-keytar"), exports);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { GraphQLClient, User } from '../../graphql';
|
|
2
2
|
import { Logger } from '../../ui';
|
|
3
3
|
import { Authenticator } from '../../auth';
|
|
4
|
-
import {
|
|
4
|
+
import { CredentialStore, PersonalApiCredentials, PersonalApiCredentialsValidated } from './credential-store';
|
|
5
5
|
export declare class LoginCommand {
|
|
6
6
|
private readonly createGraphQLClient;
|
|
7
7
|
private readonly store;
|
|
8
8
|
private readonly logger;
|
|
9
|
-
constructor(createGraphQLClient: (authenticator: Authenticator) => GraphQLClient, store:
|
|
9
|
+
constructor(createGraphQLClient: (authenticator: Authenticator) => GraphQLClient, store: CredentialStore, logger: Logger);
|
|
10
10
|
execute(credentials: PersonalApiCredentials): Promise<{
|
|
11
11
|
user: User;
|
|
12
12
|
creds: PersonalApiCredentialsValidated;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/login.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,YAAY,CAAC;AAI3C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/login.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,YAAY,CAAC;AAI3C,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AAE9G,qBAAa,YAAY;IAErB,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAFN,mBAAmB,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,aAAa,EACpE,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,MAAM;IAGpB,OAAO,CAClB,WAAW,EAAE,sBAAsB,GAClC,OAAO,CAAC;QACT,IAAI,EAAE,IAAI,CAAC;QACX,KAAK,EAAE,+BAA+B,CAAC;QACvC,SAAS,EAAE;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;KAC/B,CAAC;IAmBW,OAAO,CAAC,WAAW,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;CAUzE"}
|
|
@@ -23,7 +23,7 @@ class LoginCommand {
|
|
|
23
23
|
}
|
|
24
24
|
async getUser(credentials) {
|
|
25
25
|
const authenticator = new token_authenticator_1.PersonalTokenAuthenticator({
|
|
26
|
-
getCredentials: () =>
|
|
26
|
+
getCredentials: async () => (Object.assign(Object.assign({}, credentials), { accountId: '' })),
|
|
27
27
|
getInstructionsWhenInvalid: this.store.getInstructionsWhenInvalid
|
|
28
28
|
});
|
|
29
29
|
const graphqlClient = this.createGraphQLClient(authenticator);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CredentialStore } from './credential-store';
|
|
2
2
|
export declare class LogoutCommand {
|
|
3
3
|
private readonly store;
|
|
4
|
-
constructor(store:
|
|
4
|
+
constructor(store: CredentialStore);
|
|
5
5
|
execute(): Promise<void>;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=logout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
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,8 +1,8 @@
|
|
|
1
|
-
import { PersonalApiCredentialsGetter } from './token-store';
|
|
2
1
|
import { Authenticator } from '../authenticator';
|
|
2
|
+
import { CredentialGetter } from './credential-store';
|
|
3
3
|
export declare class PersonalTokenAuthenticator implements Authenticator {
|
|
4
|
-
private readonly
|
|
5
|
-
constructor(
|
|
4
|
+
private readonly credentialStore;
|
|
5
|
+
constructor(credentialStore: CredentialGetter);
|
|
6
6
|
getAuthorizationHeader(): Promise<import("../authenticator").AuthorizationHeader>;
|
|
7
7
|
getInstructionsWhenInvalid(): string;
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-authenticator.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/token-authenticator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"token-authenticator.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/token-authenticator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,qBAAa,0BAA2B,YAAW,aAAa;IAClD,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,gBAAgB;IAEjD,sBAAsB;IAO5B,0BAA0B,IAAI,MAAM;CAG5C"}
|
|
@@ -3,15 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PersonalTokenAuthenticator = void 0;
|
|
4
4
|
const authenticator_1 = require("../authenticator");
|
|
5
5
|
class PersonalTokenAuthenticator {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
6
|
+
constructor(credentialStore) {
|
|
7
|
+
this.credentialStore = credentialStore;
|
|
8
8
|
}
|
|
9
9
|
async getAuthorizationHeader() {
|
|
10
|
-
const { email, token } = await this.
|
|
10
|
+
const { email, token } = await this.credentialStore.getCredentials();
|
|
11
11
|
return authenticator_1.getBasicAuthorizationHeader(email, token);
|
|
12
12
|
}
|
|
13
13
|
getInstructionsWhenInvalid() {
|
|
14
|
-
return this.
|
|
14
|
+
return this.credentialStore.getInstructionsWhenInvalid();
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
exports.PersonalTokenAuthenticator = PersonalTokenAuthenticator;
|