@workos-inc/node 3.0.0 → 3.1.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.
|
@@ -2,6 +2,7 @@ export declare class GenericServerException extends Error {
|
|
|
2
2
|
readonly status: number;
|
|
3
3
|
readonly requestID: string;
|
|
4
4
|
readonly name: string;
|
|
5
|
+
readonly rawData: unknown;
|
|
5
6
|
readonly message: string;
|
|
6
|
-
constructor(status: number, message: string | undefined, requestID: string);
|
|
7
|
+
constructor(status: number, message: string | undefined, rawData: unknown, requestID: string);
|
|
7
8
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GenericServerException = void 0;
|
|
4
4
|
class GenericServerException extends Error {
|
|
5
|
-
constructor(status, message, requestID) {
|
|
5
|
+
constructor(status, message, rawData, requestID) {
|
|
6
6
|
super();
|
|
7
7
|
this.status = status;
|
|
8
8
|
this.requestID = requestID;
|
|
@@ -10,6 +10,7 @@ class GenericServerException extends Error {
|
|
|
10
10
|
this.message = 'The request could not be completed.';
|
|
11
11
|
if (message) {
|
|
12
12
|
this.message = message;
|
|
13
|
+
this.rawData = rawData;
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './audit-logs/interfaces';
|
|
|
3
3
|
export * from './audit-trail/interfaces';
|
|
4
4
|
export * from './common/exceptions';
|
|
5
5
|
export * from './common/interfaces';
|
|
6
|
+
export * from './common/utils/pagination';
|
|
6
7
|
export * from './directory-sync/interfaces';
|
|
7
8
|
export * from './directory-sync/utils/get-primary-email';
|
|
8
9
|
export * from './events/interfaces';
|
package/lib/index.js
CHANGED
|
@@ -21,6 +21,7 @@ __exportStar(require("./audit-logs/interfaces"), exports);
|
|
|
21
21
|
__exportStar(require("./audit-trail/interfaces"), exports);
|
|
22
22
|
__exportStar(require("./common/exceptions"), exports);
|
|
23
23
|
__exportStar(require("./common/interfaces"), exports);
|
|
24
|
+
__exportStar(require("./common/utils/pagination"), exports);
|
|
24
25
|
__exportStar(require("./directory-sync/interfaces"), exports);
|
|
25
26
|
__exportStar(require("./directory-sync/utils/get-primary-email"), exports);
|
|
26
27
|
__exportStar(require("./events/interfaces"), exports);
|
package/lib/workos.js
CHANGED
|
@@ -27,7 +27,7 @@ const mfa_1 = require("./mfa/mfa");
|
|
|
27
27
|
const audit_logs_1 = require("./audit-logs/audit-logs");
|
|
28
28
|
const users_1 = require("./users/users");
|
|
29
29
|
const bad_request_exception_1 = require("./common/exceptions/bad-request.exception");
|
|
30
|
-
const VERSION = '3.
|
|
30
|
+
const VERSION = '3.1.0';
|
|
31
31
|
const DEFAULT_HOSTNAME = 'api.workos.com';
|
|
32
32
|
class WorkOS {
|
|
33
33
|
constructor(key, options = {}) {
|
|
@@ -183,7 +183,7 @@ class WorkOS {
|
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
185
|
else {
|
|
186
|
-
throw new exceptions_1.GenericServerException(status, data.message, requestID);
|
|
186
|
+
throw new exceptions_1.GenericServerException(status, data.message, data, requestID);
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
}
|
package/lib/workos.spec.js
CHANGED
|
@@ -140,7 +140,7 @@ describe('WorkOS', () => {
|
|
|
140
140
|
'X-Request-ID': 'a-request-id',
|
|
141
141
|
});
|
|
142
142
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
143
|
-
yield expect(workos.post('/path', {})).rejects.toStrictEqual(new exceptions_1.GenericServerException(500, undefined, 'a-request-id'));
|
|
143
|
+
yield expect(workos.post('/path', {})).rejects.toStrictEqual(new exceptions_1.GenericServerException(500, undefined, {}, 'a-request-id'));
|
|
144
144
|
}));
|
|
145
145
|
});
|
|
146
146
|
describe('when the api responds with a 400 and an error/error_description', () => {
|
package/package.json
CHANGED