@usecapsule/user-management-client
Advanced tools
Comparing version 1.4.1 to 1.5.0
@@ -172,6 +172,6 @@ "use strict"; | ||
}); | ||
// PATCH /users/:userId/wallets/:walletId | ||
this.updateWallet = (userId, walletId) => __awaiter(this, void 0, void 0, function* () { | ||
const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}`); | ||
return res; | ||
// PATCH /wallets/pregen/:walletId | ||
this.updatePregenWallet = (walletId, body) => __awaiter(this, void 0, void 0, function* () { | ||
const res = yield this.baseRequest.patch(`wallets/pregen/${walletId}`, body); | ||
return res.data; | ||
}); | ||
@@ -223,3 +223,3 @@ // GET /users/:userId/wallets | ||
// TODO remove after this is not optional anymore | ||
const headers = apiKey ? { "X-External-API-Key": apiKey } : undefined; | ||
const headers = apiKey ? { 'X-External-API-Key': apiKey } : undefined; | ||
const axiosConfig = { | ||
@@ -231,5 +231,5 @@ baseURL: userManagementHost, | ||
if (retrieveSessionCookie) { | ||
const defaultTransformRequest = Array.isArray(axios_1.default.defaults.transformRequest) ? | ||
axios_1.default.defaults.transformRequest : | ||
[axios_1.default.defaults.transformRequest]; | ||
const defaultTransformRequest = Array.isArray(axios_1.default.defaults.transformRequest) | ||
? axios_1.default.defaults.transformRequest | ||
: [axios_1.default.defaults.transformRequest]; | ||
axiosConfig.transformRequest = [ | ||
@@ -247,5 +247,5 @@ function (data, headers) { | ||
if (persistSessionCookie) { | ||
const defaultTransformResponse = Array.isArray(axios_1.default.defaults.transformResponse) ? | ||
axios_1.default.defaults.transformResponse : | ||
[axios_1.default.defaults.transformResponse]; | ||
const defaultTransformResponse = Array.isArray(axios_1.default.defaults.transformResponse) | ||
? axios_1.default.defaults.transformResponse | ||
: [axios_1.default.defaults.transformResponse]; | ||
axiosConfig.transformResponse = [ | ||
@@ -268,4 +268,5 @@ ...defaultTransformResponse, | ||
body: config.data, | ||
credentials: config.withCredentials ? 'include' : undefined | ||
}).then(response => response.text().then(text => ({ | ||
credentials: config.withCredentials ? 'include' : undefined, | ||
}) | ||
.then((response) => response.text().then((text) => ({ | ||
data: text, | ||
@@ -276,4 +277,5 @@ status: response.status, | ||
config: config, | ||
request: fetch | ||
}))).catch(function (reason) { | ||
request: fetch, | ||
}))) | ||
.catch(function (reason) { | ||
throw reason; | ||
@@ -280,0 +282,0 @@ }); |
@@ -166,6 +166,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}); | ||
// PATCH /users/:userId/wallets/:walletId | ||
this.updateWallet = (userId, walletId) => __awaiter(this, void 0, void 0, function* () { | ||
const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}`); | ||
return res; | ||
// PATCH /wallets/pregen/:walletId | ||
this.updatePregenWallet = (walletId, body) => __awaiter(this, void 0, void 0, function* () { | ||
const res = yield this.baseRequest.patch(`wallets/pregen/${walletId}`, body); | ||
return res.data; | ||
}); | ||
@@ -217,3 +217,3 @@ // GET /users/:userId/wallets | ||
// TODO remove after this is not optional anymore | ||
const headers = apiKey ? { "X-External-API-Key": apiKey } : undefined; | ||
const headers = apiKey ? { 'X-External-API-Key': apiKey } : undefined; | ||
const axiosConfig = { | ||
@@ -225,5 +225,5 @@ baseURL: userManagementHost, | ||
if (retrieveSessionCookie) { | ||
const defaultTransformRequest = Array.isArray(axios.defaults.transformRequest) ? | ||
axios.defaults.transformRequest : | ||
[axios.defaults.transformRequest]; | ||
const defaultTransformRequest = Array.isArray(axios.defaults.transformRequest) | ||
? axios.defaults.transformRequest | ||
: [axios.defaults.transformRequest]; | ||
axiosConfig.transformRequest = [ | ||
@@ -241,5 +241,5 @@ function (data, headers) { | ||
if (persistSessionCookie) { | ||
const defaultTransformResponse = Array.isArray(axios.defaults.transformResponse) ? | ||
axios.defaults.transformResponse : | ||
[axios.defaults.transformResponse]; | ||
const defaultTransformResponse = Array.isArray(axios.defaults.transformResponse) | ||
? axios.defaults.transformResponse | ||
: [axios.defaults.transformResponse]; | ||
axiosConfig.transformResponse = [ | ||
@@ -262,4 +262,5 @@ ...defaultTransformResponse, | ||
body: config.data, | ||
credentials: config.withCredentials ? 'include' : undefined | ||
}).then(response => response.text().then(text => ({ | ||
credentials: config.withCredentials ? 'include' : undefined, | ||
}) | ||
.then((response) => response.text().then((text) => ({ | ||
data: text, | ||
@@ -270,4 +271,5 @@ status: response.status, | ||
config: config, | ||
request: fetch | ||
}))).catch(function (reason) { | ||
request: fetch, | ||
}))) | ||
.catch(function (reason) { | ||
throw reason; | ||
@@ -274,0 +276,0 @@ }); |
@@ -112,2 +112,5 @@ export declare const USER_NOT_VERIFIED = "user must verify biometrics"; | ||
} | ||
interface updatePregenWalletBody { | ||
email: string; | ||
} | ||
interface createWalletRes { | ||
@@ -180,3 +183,3 @@ protocolId: string; | ||
refreshKeys: (userId: string, walletId: string) => Promise<any>; | ||
updateWallet: (userId: string, walletId: string) => Promise<any>; | ||
updatePregenWallet: (walletId: string, body: updatePregenWalletBody) => Promise<any>; | ||
getWallets: (userId: string) => Promise<any>; | ||
@@ -183,0 +186,0 @@ login: (props: { |
{ | ||
"name": "@usecapsule/user-management-client", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"main": "dist/cjs/index.js", | ||
@@ -33,3 +33,3 @@ "module": "dist/esm/index.js", | ||
}, | ||
"gitHead": "6e398e072e850563e48f7f8c2d62ebd792bb78a3" | ||
"gitHead": "18b6d11b654f3c05995e1a5dff9f0dedcbc37c0a" | ||
} |
55132
1205
9
1