@forge/cli-shared 8.3.1-next.4 → 8.4.0-next.6
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 +12 -0
- package/out/auth/personal/credential-store.d.ts +0 -1
- package/out/auth/personal/credential-store.d.ts.map +1 -1
- package/out/auth/personal/credential-store.js +0 -7
- package/out/auth/personal/user-repository.d.ts +2 -0
- package/out/auth/personal/user-repository.d.ts.map +1 -1
- package/out/auth/personal/user-repository.js +18 -1
- package/out/graphql/graphql-types.d.ts +271 -49
- package/out/graphql/graphql-types.d.ts.map +1 -1
- package/out/graphql/graphql-types.js +30 -23
- package/out/ui/text.d.ts +5 -0
- package/out/ui/text.d.ts.map +1 -1
- package/out/ui/text.js +5 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @forge/cli-shared
|
|
2
2
|
|
|
3
|
+
## 8.4.0-next.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 84dcafe: Cache user credentials in UserRepository
|
|
8
|
+
|
|
9
|
+
## 8.4.0-next.5
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- b003963: Added deploy list command
|
|
14
|
+
|
|
3
15
|
## 8.3.1-next.4
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -43,7 +43,6 @@ export declare class CredentialStoreImpl implements CredentialStore {
|
|
|
43
43
|
private readonly cachedConfig;
|
|
44
44
|
private readonly userRepository;
|
|
45
45
|
private keytarAccount;
|
|
46
|
-
private cached;
|
|
47
46
|
constructor(logger: Logger, instructionsURL: string, keytar: Keytar | null, cachedConfig: CachedConf, userRepository: UserRepository);
|
|
48
47
|
private wrapKeytarError;
|
|
49
48
|
decodeCredentials(credentialsString: string | null): PersonalApiCredentialsValidated;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cred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@ -61,7 +61,6 @@ class CredentialStoreImpl {
|
|
|
61
61
|
cachedConfig;
|
|
62
62
|
userRepository;
|
|
63
63
|
keytarAccount;
|
|
64
|
-
cached = null;
|
|
65
64
|
constructor(logger, instructionsURL, keytar, cachedConfig, userRepository) {
|
|
66
65
|
this.logger = logger;
|
|
67
66
|
this.instructionsURL = instructionsURL;
|
|
@@ -131,9 +130,6 @@ class CredentialStoreImpl {
|
|
|
131
130
|
this.cachedConfig.delete(CACHE_CREDENTIALS_KEY);
|
|
132
131
|
}
|
|
133
132
|
async getCredentials() {
|
|
134
|
-
if (this.cached) {
|
|
135
|
-
return this.cached;
|
|
136
|
-
}
|
|
137
133
|
let result;
|
|
138
134
|
const plaintextCredentials = this.popInsecurePlaintextCredentials();
|
|
139
135
|
if (plaintextCredentials) {
|
|
@@ -157,13 +153,11 @@ class CredentialStoreImpl {
|
|
|
157
153
|
result = await this.getCredentialsKeytar(this.keytar);
|
|
158
154
|
}
|
|
159
155
|
if (result) {
|
|
160
|
-
this.cached = result;
|
|
161
156
|
return result;
|
|
162
157
|
}
|
|
163
158
|
throw new NoTokenInStoreError();
|
|
164
159
|
}
|
|
165
160
|
async setCredentials(credentials) {
|
|
166
|
-
this.cached = null;
|
|
167
161
|
if (this.keytar) {
|
|
168
162
|
try {
|
|
169
163
|
await this.keytar.setPassword(KEYTAR_SERVICE, this.keytarAccount, JSON.stringify(credentials));
|
|
@@ -177,7 +171,6 @@ class CredentialStoreImpl {
|
|
|
177
171
|
}
|
|
178
172
|
}
|
|
179
173
|
async deleteCredentials() {
|
|
180
|
-
this.cached = null;
|
|
181
174
|
if (this.keytar) {
|
|
182
175
|
try {
|
|
183
176
|
await this.keytar.deletePassword(KEYTAR_SERVICE, this.keytarAccount);
|
|
@@ -8,7 +8,9 @@ export interface UserRepository {
|
|
|
8
8
|
export declare class UserRepositoryImpl {
|
|
9
9
|
private readonly createGraphQLClient;
|
|
10
10
|
private readonly logger;
|
|
11
|
+
private cache;
|
|
11
12
|
constructor(createGraphQLClient: (authenticator: Authenticator) => GraphQLClient, logger: Logger);
|
|
13
|
+
private getCachedUser;
|
|
12
14
|
getUser(credentials: PersonalApiCredentials): Promise<User>;
|
|
13
15
|
}
|
|
14
16
|
//# sourceMappingURL=user-repository.d.ts.map
|
|
@@ -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;
|
|
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"}
|
|
@@ -6,17 +6,34 @@ const token_authenticator_1 = require("./token-authenticator");
|
|
|
6
6
|
class UserRepositoryImpl {
|
|
7
7
|
createGraphQLClient;
|
|
8
8
|
logger;
|
|
9
|
+
cache = null;
|
|
9
10
|
constructor(createGraphQLClient, logger) {
|
|
10
11
|
this.createGraphQLClient = createGraphQLClient;
|
|
11
12
|
this.logger = logger;
|
|
12
13
|
}
|
|
14
|
+
getCachedUser(credentials) {
|
|
15
|
+
if (this.cache === null) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const [cachedCredentials, cachedUser] = this.cache;
|
|
19
|
+
if (cachedCredentials.email === credentials.email && cachedCredentials.token === credentials.token) {
|
|
20
|
+
return cachedUser;
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
13
24
|
async getUser(credentials) {
|
|
25
|
+
const cachedUser = this.getCachedUser(credentials);
|
|
26
|
+
if (cachedUser) {
|
|
27
|
+
return cachedUser;
|
|
28
|
+
}
|
|
14
29
|
const authenticator = new token_authenticator_1.PersonalTokenAuthenticator({
|
|
15
30
|
getCredentials: async () => ({ ...credentials, accountId: '' })
|
|
16
31
|
});
|
|
17
32
|
const graphqlClient = this.createGraphQLClient(authenticator);
|
|
18
33
|
const meClient = new me_graphql_client_1.MeGraphqlClient(graphqlClient, this.logger);
|
|
19
|
-
|
|
34
|
+
const user = await meClient.getUser();
|
|
35
|
+
this.cache = [credentials, user];
|
|
36
|
+
return user;
|
|
20
37
|
}
|
|
21
38
|
}
|
|
22
39
|
exports.UserRepositoryImpl = UserRepositoryImpl;
|