@vulog/aima-client 1.1.9 → 1.1.11
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/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -3
- package/dist/index.mjs +5 -3
- package/package.json +1 -1
- package/src/getClient.ts +8 -4
- package/src/types.ts +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -31,7 +31,7 @@ type ClientError = {
|
|
|
31
31
|
originalError: any;
|
|
32
32
|
};
|
|
33
33
|
type Client = AxiosInstance & {
|
|
34
|
-
signInWithPassword: (username: string, password: string) => Promise<
|
|
34
|
+
signInWithPassword: (username: string, password: string) => Promise<Token>;
|
|
35
35
|
clientOptions: ClientOptions;
|
|
36
36
|
};
|
|
37
37
|
|
package/dist/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ type ClientError = {
|
|
|
31
31
|
originalError: any;
|
|
32
32
|
};
|
|
33
33
|
type Client = AxiosInstance & {
|
|
34
|
-
signInWithPassword: (username: string, password: string) => Promise<
|
|
34
|
+
signInWithPassword: (username: string, password: string) => Promise<Token>;
|
|
35
35
|
clientOptions: ClientOptions;
|
|
36
36
|
};
|
|
37
37
|
|
package/dist/index.js
CHANGED
|
@@ -240,11 +240,13 @@ var getClient = (options) => {
|
|
|
240
240
|
withCredentials: false
|
|
241
241
|
}
|
|
242
242
|
);
|
|
243
|
-
const
|
|
244
|
-
await store.setToken({
|
|
243
|
+
const newToken = {
|
|
245
244
|
accessToken: token.access_token,
|
|
246
245
|
refreshToken: token.refresh_token
|
|
247
|
-
}
|
|
246
|
+
};
|
|
247
|
+
const store = options.store ?? getMemoryStore(options);
|
|
248
|
+
await store.setToken(newToken);
|
|
249
|
+
return newToken;
|
|
248
250
|
};
|
|
249
251
|
client.interceptors.request.use(async (request) => {
|
|
250
252
|
const newRequest = request;
|
package/dist/index.mjs
CHANGED
|
@@ -204,11 +204,13 @@ var getClient = (options) => {
|
|
|
204
204
|
withCredentials: false
|
|
205
205
|
}
|
|
206
206
|
);
|
|
207
|
-
const
|
|
208
|
-
await store.setToken({
|
|
207
|
+
const newToken = {
|
|
209
208
|
accessToken: token.access_token,
|
|
210
209
|
refreshToken: token.refresh_token
|
|
211
|
-
}
|
|
210
|
+
};
|
|
211
|
+
const store = options.store ?? getMemoryStore(options);
|
|
212
|
+
await store.setToken(newToken);
|
|
213
|
+
return newToken;
|
|
212
214
|
};
|
|
213
215
|
client.interceptors.request.use(async (request) => {
|
|
214
216
|
const newRequest = request;
|
package/package.json
CHANGED
package/src/getClient.ts
CHANGED
|
@@ -132,7 +132,7 @@ const getClient = (options: ClientOptions): Client => {
|
|
|
132
132
|
return token.access_token;
|
|
133
133
|
};
|
|
134
134
|
|
|
135
|
-
client.signInWithPassword = async (username: string, password: string): Promise<
|
|
135
|
+
client.signInWithPassword = async (username: string, password: string): Promise<Token> => {
|
|
136
136
|
if (!options.secure) {
|
|
137
137
|
throw new Error('Not secure');
|
|
138
138
|
}
|
|
@@ -155,11 +155,15 @@ const getClient = (options: ClientOptions): Client => {
|
|
|
155
155
|
withCredentials: false,
|
|
156
156
|
}
|
|
157
157
|
);
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
|
|
159
|
+
const newToken: Token = {
|
|
160
160
|
accessToken: token.access_token,
|
|
161
161
|
refreshToken: token.refresh_token,
|
|
162
|
-
}
|
|
162
|
+
};
|
|
163
|
+
const store = options.store ?? getMemoryStore(options);
|
|
164
|
+
await store.setToken(newToken);
|
|
165
|
+
|
|
166
|
+
return newToken;
|
|
163
167
|
};
|
|
164
168
|
|
|
165
169
|
client.interceptors.request.use(async (request) => {
|
package/src/types.ts
CHANGED
|
@@ -35,6 +35,6 @@ export type ClientError = {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
export type Client = AxiosInstance & {
|
|
38
|
-
signInWithPassword: (username: string, password: string) => Promise<
|
|
38
|
+
signInWithPassword: (username: string, password: string) => Promise<Token>;
|
|
39
39
|
clientOptions: ClientOptions;
|
|
40
40
|
};
|