@kedaruma/revlm-client 1.0.15 → 1.0.22

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 CHANGED
@@ -5,6 +5,9 @@ import { Timestamp, Long } from 'bson';
5
5
  type RevlmErrorResponse = {
6
6
  ok: false;
7
7
  error: string;
8
+ code?: number;
9
+ status?: number;
10
+ reason?: string;
8
11
  };
9
12
  type LoginSuccess = {
10
13
  ok: true;
package/dist/index.d.ts CHANGED
@@ -5,6 +5,9 @@ import { Timestamp, Long } from 'bson';
5
5
  type RevlmErrorResponse = {
6
6
  ok: false;
7
7
  error: string;
8
+ code?: number;
9
+ status?: number;
10
+ reason?: string;
8
11
  };
9
12
  type LoginSuccess = {
10
13
  ok: true;
package/dist/index.js CHANGED
@@ -386,9 +386,18 @@ var App = class {
386
386
  throw new Error("Unsupported credentials type");
387
387
  }
388
388
  const res = await this.__revlm.login(cred.email, cred.password);
389
+ console.log("### App:login res:", res);
389
390
  if (!res || !res.ok || !res.token) {
390
391
  const errMsg = res && !res.ok ? res.error : "login failed";
391
- throw new Error(errMsg);
392
+ const err = new Error(errMsg);
393
+ const anyRes = res;
394
+ if (anyRes && typeof anyRes === "object") {
395
+ if (anyRes.code !== void 0) err.code = anyRes.code;
396
+ if (anyRes.status !== void 0) err.status = anyRes.status;
397
+ if (anyRes.reason !== void 0) err.reason = anyRes.reason;
398
+ err.response = anyRes;
399
+ }
400
+ throw err;
392
401
  }
393
402
  this.__revlm.setToken(res.token);
394
403
  const user = new User(this, res.token, res.user);
package/dist/index.mjs CHANGED
@@ -341,9 +341,18 @@ var App = class {
341
341
  throw new Error("Unsupported credentials type");
342
342
  }
343
343
  const res = await this.__revlm.login(cred.email, cred.password);
344
+ console.log("### App:login res:", res);
344
345
  if (!res || !res.ok || !res.token) {
345
346
  const errMsg = res && !res.ok ? res.error : "login failed";
346
- throw new Error(errMsg);
347
+ const err = new Error(errMsg);
348
+ const anyRes = res;
349
+ if (anyRes && typeof anyRes === "object") {
350
+ if (anyRes.code !== void 0) err.code = anyRes.code;
351
+ if (anyRes.status !== void 0) err.status = anyRes.status;
352
+ if (anyRes.reason !== void 0) err.reason = anyRes.reason;
353
+ err.response = anyRes;
354
+ }
355
+ throw err;
347
356
  }
348
357
  this.__revlm.setToken(res.token);
349
358
  const user = new User(this, res.token, res.user);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kedaruma/revlm-client",
3
- "version": "1.0.15",
3
+ "version": "1.0.22",
4
4
  "private": false,
5
5
  "description": "TypeScript client SDK for talking to the Revlm server replacement for MongoDB Realm.",
6
6
  "keywords": [