@getpara/user-management-client 2.20.0 → 2.22.0

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.
@@ -338,17 +338,19 @@ class Client {
338
338
  const res = yield this.baseRequest.post(`/users/${userId}/wallets`, body);
339
339
  return res.data;
340
340
  });
341
- // POST /wallets/pregen
341
+ /** @deprecated Use the REST API (`POST /v1/wallets`) instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
342
342
  this.createPregenWallet = (body) => __async(this, null, function* () {
343
343
  const res = yield this.baseRequest.post(`/wallets/pregen`, body);
344
344
  return res.data;
345
345
  });
346
+ /** @deprecated Use the REST API (`GET /v1/wallets`) instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
346
347
  this.getPregenWallets = (pregenIds, isPortal = false, userId) => __async(this, null, function* () {
347
348
  const res = yield this.baseRequest.get("/wallets/pregen", {
348
349
  params: { ids: pregenIds, expand: isPortal, userId }
349
350
  });
350
351
  return res.data;
351
352
  });
353
+ /** @deprecated Use the REST API (`POST /v1/wallets`) instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
352
354
  this.claimPregenWallets = (body) => __async(this, null, function* () {
353
355
  const res = yield this.baseRequest.post(`/wallets/pregen/claim`, body);
354
356
  return res.data;
@@ -370,7 +372,7 @@ class Client {
370
372
  const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/refresh`, body);
371
373
  return res;
372
374
  });
373
- // PATCH /wallets/pregen/:walletId
375
+ /** @deprecated Use the REST API (`PATCH /v1/wallets/:id`) instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
374
376
  this.updatePregenWallet = (walletId, body) => __async(this, null, function* () {
375
377
  const res = yield this.baseRequest.patch(`/wallets/pregen/${walletId}`, body);
376
378
  return res.data;
@@ -631,9 +633,28 @@ class Client {
631
633
  ];
632
634
  }
633
635
  this.baseRequest = import_axios.default.create(axiosConfig);
636
+ this.baseRequest.interceptors.request.use((config) => {
637
+ if (retrieveSessionCookie) {
638
+ const cookie = retrieveSessionCookie();
639
+ if (cookie) {
640
+ config.headers.set(import_consts.SESSION_COOKIE_HEADER_NAME, cookie);
641
+ }
642
+ }
643
+ if (version) {
644
+ config.headers.set(import_consts.VERSION_HEADER_NAME, version);
645
+ }
646
+ return config;
647
+ });
634
648
  if (opts == null ? void 0 : opts.useFetchAdapter) {
635
649
  import_axios.default.defaults.adapter = function(config) {
636
- return fetch(config.baseURL + config.url.substring(1), {
650
+ let url = config.baseURL + config.url.substring(1);
651
+ if (config.params) {
652
+ const params = new URLSearchParams(config.params).toString();
653
+ if (params) {
654
+ url += (url.includes("?") ? "&" : "?") + params;
655
+ }
656
+ }
657
+ return fetch(url, {
637
658
  method: config.method,
638
659
  headers: config.headers,
639
660
  body: config.data,
@@ -266,17 +266,19 @@ class Client {
266
266
  const res = yield this.baseRequest.post(`/users/${userId}/wallets`, body);
267
267
  return res.data;
268
268
  });
269
- // POST /wallets/pregen
269
+ /** @deprecated Use the REST API (`POST /v1/wallets`) instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
270
270
  this.createPregenWallet = (body) => __async(this, null, function* () {
271
271
  const res = yield this.baseRequest.post(`/wallets/pregen`, body);
272
272
  return res.data;
273
273
  });
274
+ /** @deprecated Use the REST API (`GET /v1/wallets`) instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
274
275
  this.getPregenWallets = (pregenIds, isPortal = false, userId) => __async(this, null, function* () {
275
276
  const res = yield this.baseRequest.get("/wallets/pregen", {
276
277
  params: { ids: pregenIds, expand: isPortal, userId }
277
278
  });
278
279
  return res.data;
279
280
  });
281
+ /** @deprecated Use the REST API (`POST /v1/wallets`) instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
280
282
  this.claimPregenWallets = (body) => __async(this, null, function* () {
281
283
  const res = yield this.baseRequest.post(`/wallets/pregen/claim`, body);
282
284
  return res.data;
@@ -298,7 +300,7 @@ class Client {
298
300
  const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/refresh`, body);
299
301
  return res;
300
302
  });
301
- // PATCH /wallets/pregen/:walletId
303
+ /** @deprecated Use the REST API (`PATCH /v1/wallets/:id`) instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
302
304
  this.updatePregenWallet = (walletId, body) => __async(this, null, function* () {
303
305
  const res = yield this.baseRequest.patch(`/wallets/pregen/${walletId}`, body);
304
306
  return res.data;
@@ -559,9 +561,28 @@ class Client {
559
561
  ];
560
562
  }
561
563
  this.baseRequest = axios.create(axiosConfig);
564
+ this.baseRequest.interceptors.request.use((config) => {
565
+ if (retrieveSessionCookie) {
566
+ const cookie = retrieveSessionCookie();
567
+ if (cookie) {
568
+ config.headers.set(SESSION_COOKIE_HEADER_NAME, cookie);
569
+ }
570
+ }
571
+ if (version) {
572
+ config.headers.set(VERSION_HEADER_NAME, version);
573
+ }
574
+ return config;
575
+ });
562
576
  if (opts == null ? void 0 : opts.useFetchAdapter) {
563
577
  axios.defaults.adapter = function(config) {
564
- return fetch(config.baseURL + config.url.substring(1), {
578
+ let url = config.baseURL + config.url.substring(1);
579
+ if (config.params) {
580
+ const params = new URLSearchParams(config.params).toString();
581
+ if (params) {
582
+ url += (url.includes("?") ? "&" : "?") + params;
583
+ }
584
+ }
585
+ return fetch(url, {
565
586
  method: config.method,
566
587
  headers: config.headers,
567
588
  body: config.data,
@@ -242,16 +242,20 @@ declare class Client {
242
242
  getSessionChallenge: (userId: string) => Promise<any>;
243
243
  verifySessionChallenge: (userId: string, body: verifySessionChallengeBody) => Promise<any>;
244
244
  createWallet: (userId: string, body?: createWalletBody) => Promise<createWalletRes>;
245
+ /** @deprecated Use the REST API (`POST /v1/wallets`) instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
245
246
  createPregenWallet: (body?: createPregenWalletBody) => Promise<createWalletRes>;
247
+ /** @deprecated Use the REST API (`GET /v1/wallets`) instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
246
248
  getPregenWallets: (pregenIds: PregenIds, isPortal?: boolean, userId?: string) => Promise<{
247
249
  wallets: WalletEntity[];
248
250
  }>;
251
+ /** @deprecated Use the REST API (`POST /v1/wallets`) instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
249
252
  claimPregenWallets: (body?: claimPreGenWalletsBody) => Promise<{
250
253
  walletIds: string[];
251
254
  }>;
252
255
  sendTransaction: (userId: string, walletId: string, body: sendTransactionBody) => Promise<any>;
253
256
  signTransaction: (userId: string, walletId: string, body: signTransactionBody) => Promise<any>;
254
257
  refreshKeys: (userId: string, walletId: string, oldPartnerId?: string, newPartnerId?: string, keyShareProtocolId?: string) => Promise<any>;
258
+ /** @deprecated Use the REST API (`PATCH /v1/wallets/:id`) instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
255
259
  updatePregenWallet: (walletId: string, body: updatePregenWalletBody) => Promise<any>;
256
260
  getWallets: (userId: string, includePartnerData?: boolean) => Promise<AxiosResponse<GetWalletsRes, any>>;
257
261
  getAllWallets: (userId: string) => Promise<AxiosResponse<GetWalletsRes, any>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/user-management-client",
3
- "version": "2.20.0",
3
+ "version": "2.22.0",
4
4
  "dependencies": {
5
5
  "@getpara/shared": "^1.14.0",
6
6
  "axios": "^1.8.4",
@@ -21,7 +21,7 @@
21
21
  "dist",
22
22
  "package.json"
23
23
  ],
24
- "gitHead": "a8443bcc4018864f5e582f238ade1bb3b4e121f4",
24
+ "gitHead": "7191b8c823ec592eb1da16c9a085f8e69c6bf377",
25
25
  "main": "dist/cjs/index.js",
26
26
  "module": "dist/esm/index.js",
27
27
  "scripts": {