@workos-inc/node 2.13.0 → 2.15.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.
- package/lib/directory-sync/directory-sync.spec.js +3 -0
- package/lib/directory-sync/interfaces/user.interface.d.ts +1 -0
- package/lib/directory-sync/utils/get-primary-email.d.ts +2 -0
- package/lib/directory-sync/utils/get-primary-email.js +9 -0
- package/lib/directory-sync/utils/get-primary-email.spec.d.ts +1 -0
- package/lib/directory-sync/utils/get-primary-email.spec.js +31 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/portal/portal.d.ts +2 -1
- package/lib/portal/portal.js +2 -1
- package/lib/webhooks/fixtures/webhook.json +1 -1
- package/lib/webhooks/webhooks.spec.js +2 -1
- package/lib/workos.js +1 -1
- package/package.json +4 -4
|
@@ -61,6 +61,7 @@ describe('DirectorySync', () => {
|
|
|
61
61
|
groups: [groupResponse],
|
|
62
62
|
idp_id: 'idp_foo',
|
|
63
63
|
last_name: 'Snow',
|
|
64
|
+
job_title: 'Knight of the Watch',
|
|
64
65
|
raw_attributes: {},
|
|
65
66
|
state: 'active',
|
|
66
67
|
username: 'jonsnow',
|
|
@@ -176,6 +177,7 @@ describe('DirectorySync', () => {
|
|
|
176
177
|
emails: [],
|
|
177
178
|
first_name: 'Virginia',
|
|
178
179
|
last_name: 'Stoltenberg',
|
|
180
|
+
job_title: 'Software Engineer',
|
|
179
181
|
state: 'active',
|
|
180
182
|
raw_attributes: {},
|
|
181
183
|
custom_attributes: {
|
|
@@ -200,6 +202,7 @@ describe('DirectorySync', () => {
|
|
|
200
202
|
emails: [],
|
|
201
203
|
first_name: 'Eli',
|
|
202
204
|
last_name: 'Leffler',
|
|
205
|
+
job_title: 'Software Engineer',
|
|
203
206
|
state: 'active',
|
|
204
207
|
raw_attributes: {},
|
|
205
208
|
custom_attributes: {
|
|
@@ -15,6 +15,7 @@ export interface User<TCustomAttributes extends object = DefaultCustomAttributes
|
|
|
15
15
|
}[];
|
|
16
16
|
username: string;
|
|
17
17
|
last_name: string;
|
|
18
|
+
job_title: string | null;
|
|
18
19
|
state: 'active' | 'inactive' | 'suspended';
|
|
19
20
|
}
|
|
20
21
|
export interface UserWithGroups<TCustomAttributes extends object = DefaultCustomAttributes> extends User<TCustomAttributes> {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPrimaryEmail = void 0;
|
|
4
|
+
function getPrimaryEmail(user) {
|
|
5
|
+
var _a;
|
|
6
|
+
const primaryEmail = (_a = user.emails) === null || _a === void 0 ? void 0 : _a.find((email) => email.primary);
|
|
7
|
+
return primaryEmail === null || primaryEmail === void 0 ? void 0 : primaryEmail.value;
|
|
8
|
+
}
|
|
9
|
+
exports.getPrimaryEmail = getPrimaryEmail;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const get_primary_email_1 = require("./get-primary-email");
|
|
4
|
+
describe('getPrimaryEmail', () => {
|
|
5
|
+
const user = {
|
|
6
|
+
id: 'user_123',
|
|
7
|
+
custom_attributes: {
|
|
8
|
+
custom: true,
|
|
9
|
+
},
|
|
10
|
+
directory_id: 'dir_123',
|
|
11
|
+
organization_id: 'org_123',
|
|
12
|
+
emails: [
|
|
13
|
+
{
|
|
14
|
+
primary: true,
|
|
15
|
+
type: 'type',
|
|
16
|
+
value: 'jonsnow@workos.com',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
first_name: 'Jon',
|
|
20
|
+
idp_id: 'idp_foo',
|
|
21
|
+
last_name: 'Snow',
|
|
22
|
+
raw_attributes: {},
|
|
23
|
+
state: 'active',
|
|
24
|
+
username: 'jonsnow',
|
|
25
|
+
job_title: 'Knight of the Watch',
|
|
26
|
+
};
|
|
27
|
+
it(`returns primary email value`, () => {
|
|
28
|
+
const primaryEmail = (0, get_primary_email_1.getPrimaryEmail)(user);
|
|
29
|
+
expect(primaryEmail).toEqual('jonsnow@workos.com');
|
|
30
|
+
});
|
|
31
|
+
});
|
package/lib/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './audit-trail/interfaces';
|
|
|
4
4
|
export * from './common/exceptions';
|
|
5
5
|
export * from './common/interfaces';
|
|
6
6
|
export * from './directory-sync/interfaces';
|
|
7
|
+
export * from './directory-sync/utils/get-primary-email';
|
|
7
8
|
export * from './organizations/interfaces';
|
|
8
9
|
export * from './passwordless/interfaces';
|
|
9
10
|
export * from './portal/interfaces';
|
package/lib/index.js
CHANGED
|
@@ -22,6 +22,7 @@ __exportStar(require("./audit-trail/interfaces"), exports);
|
|
|
22
22
|
__exportStar(require("./common/exceptions"), exports);
|
|
23
23
|
__exportStar(require("./common/interfaces"), exports);
|
|
24
24
|
__exportStar(require("./directory-sync/interfaces"), exports);
|
|
25
|
+
__exportStar(require("./directory-sync/utils/get-primary-email"), exports);
|
|
25
26
|
__exportStar(require("./organizations/interfaces"), exports);
|
|
26
27
|
__exportStar(require("./passwordless/interfaces"), exports);
|
|
27
28
|
__exportStar(require("./portal/interfaces"), exports);
|
package/lib/portal/portal.d.ts
CHANGED
|
@@ -3,10 +3,11 @@ import { GeneratePortalLinkIntent } from './interfaces/generate-portal-link-inte
|
|
|
3
3
|
export declare class Portal {
|
|
4
4
|
private readonly workos;
|
|
5
5
|
constructor(workos: WorkOS);
|
|
6
|
-
generateLink({ intent, organization, returnUrl, }: {
|
|
6
|
+
generateLink({ intent, organization, returnUrl, successUrl, }: {
|
|
7
7
|
intent: GeneratePortalLinkIntent;
|
|
8
8
|
organization: string;
|
|
9
9
|
returnUrl?: string;
|
|
10
|
+
successUrl?: string;
|
|
10
11
|
}): Promise<{
|
|
11
12
|
link: string;
|
|
12
13
|
}>;
|
package/lib/portal/portal.js
CHANGED
|
@@ -14,12 +14,13 @@ class Portal {
|
|
|
14
14
|
constructor(workos) {
|
|
15
15
|
this.workos = workos;
|
|
16
16
|
}
|
|
17
|
-
generateLink({ intent, organization, returnUrl, }) {
|
|
17
|
+
generateLink({ intent, organization, returnUrl, successUrl, }) {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
const { data } = yield this.workos.post('/portal/generate_link', {
|
|
20
20
|
intent,
|
|
21
21
|
organization,
|
|
22
22
|
return_url: returnUrl,
|
|
23
|
+
success_url: successUrl,
|
|
23
24
|
});
|
|
24
25
|
return data;
|
|
25
26
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "id": "wh_123", "data": { "id": "directory_user_01FAEAJCR3ZBZ30D8BD1924TVG", "state": "active", "emails": [{ "type": "work", "value": "blair@foo-corp.com", "primary": true }], "idp_id": "00u1e8mutl6wlH3lL4x7", "object": "directory_user", "username": "blair@foo-corp.com", "last_name": "Lunchford", "first_name": "Blair", "directory_id": "directory_01F9M7F68PZP8QXP8G7X5QRHS7", "raw_attributes": { "name": { "givenName": "Blair", "familyName": "Lunchford", "middleName": "Elizabeth", "honorificPrefix": "Ms." }, "title": "
|
|
1
|
+
{ "id": "wh_123", "data": { "id": "directory_user_01FAEAJCR3ZBZ30D8BD1924TVG", "state": "active", "emails": [{ "type": "work", "value": "blair@foo-corp.com", "primary": true }], "idp_id": "00u1e8mutl6wlH3lL4x7", "object": "directory_user", "username": "blair@foo-corp.com", "last_name": "Lunchford", "first_name": "Blair", "job_title": "Software Engineer", "directory_id": "directory_01F9M7F68PZP8QXP8G7X5QRHS7", "raw_attributes": { "name": { "givenName": "Blair", "familyName": "Lunchford", "middleName": "Elizabeth", "honorificPrefix": "Ms." }, "title": "Software Engineer", "active": true, "emails": [{ "type": "work", "value": "blair@foo-corp.com", "primary": true }], "groups": [], "locale": "en-US", "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User", "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"], "userName": "blair@foo-corp.com", "addresses": [{ "region": "CA", "primary": true, "locality": "San Francisco", "postalCode": "94016" }], "externalId": "00u1e8mutl6wlH3lL4x7", "displayName": "Blair Lunchford", "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": { "manager": { "value": "2", "displayName": "Kate Chapman" }, "division": "Engineering", "department": "Customer Success" } } }, "event": "dsync.user.created" }
|
|
@@ -40,6 +40,7 @@ describe('Webhooks', () => {
|
|
|
40
40
|
username: 'blair@foo-corp.com',
|
|
41
41
|
last_name: 'Lunchford',
|
|
42
42
|
first_name: 'Blair',
|
|
43
|
+
job_title: 'Software Engineer',
|
|
43
44
|
directory_id: 'directory_01F9M7F68PZP8QXP8G7X5QRHS7',
|
|
44
45
|
raw_attributes: {
|
|
45
46
|
name: {
|
|
@@ -48,7 +49,7 @@ describe('Webhooks', () => {
|
|
|
48
49
|
middleName: 'Elizabeth',
|
|
49
50
|
honorificPrefix: 'Ms.',
|
|
50
51
|
},
|
|
51
|
-
title: '
|
|
52
|
+
title: 'Software Engineer',
|
|
52
53
|
active: true,
|
|
53
54
|
emails: [
|
|
54
55
|
{
|
package/lib/workos.js
CHANGED
|
@@ -25,7 +25,7 @@ const webhooks_1 = require("./webhooks/webhooks");
|
|
|
25
25
|
const mfa_1 = require("./mfa/mfa");
|
|
26
26
|
const audit_logs_1 = require("./audit-logs/audit-logs");
|
|
27
27
|
const bad_request_exception_1 = require("./common/exceptions/bad-request.exception");
|
|
28
|
-
const VERSION = '2.
|
|
28
|
+
const VERSION = '2.15.0';
|
|
29
29
|
const DEFAULT_HOSTNAME = 'api.workos.com';
|
|
30
30
|
class WorkOS {
|
|
31
31
|
constructor(key, options = {}) {
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.15.0",
|
|
3
3
|
"name": "@workos-inc/node",
|
|
4
4
|
"author": "WorkOS",
|
|
5
5
|
"description": "A Node wrapper for the WorkOS API",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"workos"
|
|
10
10
|
],
|
|
11
11
|
"volta": {
|
|
12
|
-
"node": "14.20.
|
|
12
|
+
"node": "14.20.1",
|
|
13
13
|
"yarn": "1.22.19"
|
|
14
14
|
},
|
|
15
15
|
"main": "lib/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/jest": "27.5.2",
|
|
43
|
-
"@types/node": "14.18.
|
|
43
|
+
"@types/node": "14.18.32",
|
|
44
44
|
"@types/pluralize": "0.0.29",
|
|
45
45
|
"axios-mock-adapter": "1.21.2",
|
|
46
46
|
"jest": "27.5.1",
|
|
@@ -48,6 +48,6 @@
|
|
|
48
48
|
"supertest": "6.2.3",
|
|
49
49
|
"ts-jest": "27.1.5",
|
|
50
50
|
"tslint": "6.1.3",
|
|
51
|
-
"typescript": "4.8.
|
|
51
|
+
"typescript": "4.8.4"
|
|
52
52
|
}
|
|
53
53
|
}
|