@workos-inc/node 3.0.0-user-management.2 → 3.0.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/audit-logs/audit-logs.js +5 -4
- package/lib/audit-logs/audit-logs.spec.js +87 -87
- package/lib/audit-logs/interfaces/audit-log-export-options.interface.d.ts +13 -3
- package/lib/audit-logs/interfaces/audit-log-export.interface.d.ts +8 -0
- package/lib/audit-logs/interfaces/create-audit-log-event-options.interface.d.ts +13 -1
- package/lib/audit-logs/serializers/audit-log-export-options.serializer.d.ts +2 -0
- package/lib/audit-logs/serializers/audit-log-export-options.serializer.js +14 -0
- package/lib/audit-logs/serializers/audit-log-export.serializer.d.ts +2 -0
- package/lib/audit-logs/serializers/audit-log-export.serializer.js +12 -0
- package/lib/audit-logs/serializers/create-audit-log-event-options.serializer.d.ts +2 -0
- package/lib/audit-logs/serializers/create-audit-log-event-options.serializer.js +16 -0
- package/lib/audit-logs/serializers/index.d.ts +3 -0
- package/lib/audit-logs/serializers/index.js +19 -0
- package/lib/audit-trail/audit-trail.d.ts +2 -2
- package/lib/audit-trail/audit-trail.spec.js +2 -1
- package/lib/common/interfaces/at-least-one-property-of.interface.d.ts +7 -0
- package/lib/common/interfaces/event.interface.d.ts +142 -0
- package/lib/common/interfaces/index.d.ts +5 -0
- package/lib/common/interfaces/index.js +5 -0
- package/lib/common/interfaces/list.interface.d.ts +9 -1
- package/lib/common/interfaces/workos-response-error.interface.d.ts +8 -0
- package/lib/common/serializers/event.serializer.d.ts +2 -0
- package/lib/common/serializers/event.serializer.js +40 -0
- package/lib/common/serializers/index.d.ts +2 -0
- package/lib/common/serializers/index.js +18 -0
- package/lib/common/serializers/list.serializer.d.ts +2 -0
- package/lib/common/serializers/list.serializer.js +9 -0
- package/lib/common/utils/fetch-and-deserialize.d.ts +3 -0
- package/lib/common/utils/fetch-and-deserialize.js +23 -0
- package/lib/common/utils/pagination.d.ts +15 -0
- package/lib/common/utils/pagination.js +90 -0
- package/lib/common/utils/workos-mock-response.d.ts +7 -0
- package/lib/common/utils/workos-mock-response.js +11 -0
- package/lib/directory-sync/directory-sync.d.ts +8 -12
- package/lib/directory-sync/directory-sync.js +9 -15
- package/lib/directory-sync/directory-sync.spec.js +132 -20
- package/lib/directory-sync/interfaces/directory-group.interface.d.ts +40 -0
- package/lib/directory-sync/interfaces/directory-user.interface.d.ts +50 -0
- package/lib/directory-sync/interfaces/directory.interface.d.ts +47 -2
- package/lib/directory-sync/interfaces/index.d.ts +6 -6
- package/lib/directory-sync/interfaces/index.js +20 -0
- package/lib/directory-sync/interfaces/list-directories-options.interface.d.ts +1 -1
- package/lib/directory-sync/interfaces/{list-users-options.interface.d.ts → list-directory-users-options.interface.d.ts} +1 -1
- package/lib/directory-sync/interfaces/list-groups-options.interface.d.ts +1 -1
- package/lib/directory-sync/serializers/directory-group.serializer.d.ts +4 -0
- package/lib/directory-sync/serializers/directory-group.serializer.js +37 -0
- package/lib/directory-sync/serializers/directory-user.serializer.d.ts +4 -0
- package/lib/directory-sync/serializers/directory-user.serializer.js +43 -0
- package/lib/directory-sync/serializers/directory.serializer.d.ts +5 -0
- package/lib/directory-sync/serializers/directory.serializer.js +50 -0
- package/lib/directory-sync/serializers/index.d.ts +3 -0
- package/lib/directory-sync/serializers/index.js +19 -0
- package/lib/directory-sync/utils/get-primary-email.d.ts +2 -2
- package/lib/directory-sync/utils/get-primary-email.spec.js +11 -8
- package/lib/events/events.d.ts +1 -2
- package/lib/events/events.js +2 -1
- package/lib/events/events.spec.js +39 -5
- package/lib/events/interfaces/index.d.ts +0 -1
- package/lib/events/interfaces/index.js +0 -1
- package/lib/events/interfaces/list-events-options.interface.d.ts +4 -4
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/mfa/interfaces/challenge.interface.d.ts +9 -0
- package/lib/mfa/interfaces/factor.interface.d.ts +13 -4
- package/lib/mfa/interfaces/index.d.ts +9 -0
- package/lib/mfa/interfaces/index.js +25 -0
- package/lib/mfa/interfaces/sms.interface.d.ts +3 -0
- package/lib/mfa/interfaces/totp.interface.d.ts +7 -0
- package/lib/mfa/interfaces/verify-challenge-response.d.ts +5 -1
- package/lib/mfa/mfa.d.ts +2 -8
- package/lib/mfa/mfa.js +5 -4
- package/lib/mfa/mfa.spec.js +134 -115
- package/lib/mfa/serializers/challenge.serializer.d.ts +2 -0
- package/lib/mfa/serializers/challenge.serializer.js +13 -0
- package/lib/mfa/serializers/factor.serializer.d.ts +2 -0
- package/lib/mfa/serializers/factor.serializer.js +7 -0
- package/lib/mfa/serializers/index.d.ts +3 -0
- package/lib/{webhooks/interfaces → mfa/serializers}/index.js +3 -4
- package/lib/mfa/serializers/sms.serializer.d.ts +2 -0
- package/lib/mfa/serializers/sms.serializer.js +7 -0
- package/lib/mfa/serializers/totp.serializer.d.ts +2 -0
- package/lib/mfa/serializers/totp.serializer.js +11 -0
- package/lib/mfa/serializers/verify-response.serializer.d.ts +2 -0
- package/lib/mfa/serializers/verify-response.serializer.js +9 -0
- package/lib/organizations/interfaces/create-organization-options.interface.d.ts +5 -0
- package/lib/organizations/interfaces/organization.interface.d.ts +9 -0
- package/lib/organizations/interfaces/update-organization-options.interface.d.ts +5 -0
- package/lib/organizations/organizations.d.ts +2 -2
- package/lib/organizations/organizations.js +9 -9
- package/lib/organizations/organizations.spec.js +11 -4
- package/lib/organizations/serializers/create-organization-options.serializer.d.ts +2 -0
- package/lib/organizations/serializers/create-organization-options.serializer.js +9 -0
- package/lib/organizations/serializers/index.d.ts +3 -0
- package/lib/organizations/serializers/index.js +19 -0
- package/lib/organizations/serializers/organization.serializer.d.ts +2 -0
- package/lib/organizations/serializers/organization.serializer.js +13 -0
- package/lib/organizations/serializers/update-organization-options.serializer.d.ts +2 -0
- package/lib/organizations/serializers/update-organization-options.serializer.js +9 -0
- package/lib/passwordless/interfaces/create-passwordless-session-options.interface.d.ts +8 -0
- package/lib/passwordless/interfaces/index.d.ts +3 -3
- package/lib/passwordless/interfaces/index.js +17 -0
- package/lib/passwordless/interfaces/passwordless-session.interface.d.ts +7 -0
- package/lib/passwordless/passwordless.d.ts +1 -3
- package/lib/passwordless/passwordless.js +2 -1
- package/lib/passwordless/serializers/index.d.ts +0 -0
- package/lib/passwordless/serializers/index.js +1 -0
- package/lib/passwordless/serializers/passwordless-session.serializer.d.ts +2 -0
- package/lib/passwordless/serializers/passwordless-session.serializer.js +11 -0
- package/lib/portal/interfaces/generate-portal-link-intent.interface.js +1 -1
- package/lib/sso/interfaces/connection-type.enum.d.ts +1 -0
- package/lib/sso/interfaces/connection-type.enum.js +2 -1
- package/lib/sso/interfaces/connection.interface.d.ts +16 -5
- package/lib/sso/interfaces/index.d.ts +2 -0
- package/lib/sso/interfaces/index.js +2 -0
- package/lib/sso/interfaces/list-connections-options.interface.d.ts +5 -0
- package/lib/sso/interfaces/profile-and-token.interface.d.ts +6 -2
- package/lib/sso/interfaces/profile.interface.d.ts +14 -0
- package/lib/sso/serializers/connection.serializer.d.ts +2 -0
- package/lib/sso/serializers/connection.serializer.js +16 -0
- package/lib/sso/serializers/index.d.ts +3 -0
- package/lib/sso/serializers/index.js +19 -0
- package/lib/sso/serializers/profile-and-token.serializer.d.ts +2 -0
- package/lib/sso/serializers/profile-and-token.serializer.js +9 -0
- package/lib/sso/serializers/profile.serializer.d.ts +2 -0
- package/lib/sso/serializers/profile.serializer.js +16 -0
- package/lib/sso/sso.d.ts +3 -9
- package/lib/sso/sso.js +23 -16
- package/lib/sso/sso.spec.js +26 -9
- package/lib/users/exceptions/index.d.ts +4 -0
- package/lib/users/exceptions/index.js +10 -0
- package/lib/users/fixtures/list-users.json +0 -1
- package/lib/users/fixtures/session.json +2 -0
- package/lib/users/fixtures/user.json +0 -1
- package/lib/users/interfaces/add-user-to-organization-options.interface.d.ts +4 -1
- package/lib/users/interfaces/authenticate-user-with-magic-auth-options.interface.d.ts +21 -0
- package/lib/users/interfaces/authenticate-user-with-password-options.interface.d.ts +14 -1
- package/lib/users/interfaces/authenticate-user-with-token-options.interface.d.ts +10 -1
- package/lib/users/interfaces/authentication-response.interface.d.ts +7 -3
- package/lib/users/interfaces/complete-password-reset-options.interface.d.ts +4 -0
- package/lib/users/interfaces/create-email-verification-challenge-options.interface.d.ts +9 -2
- package/lib/users/interfaces/create-password-reset-challenge-options.interface.d.ts +9 -1
- package/lib/users/interfaces/create-user-options.interface.d.ts +8 -1
- package/lib/users/interfaces/index.d.ts +7 -0
- package/lib/users/interfaces/index.js +7 -0
- package/lib/users/interfaces/magic-auth-challenge.interface.d.ts +3 -0
- package/lib/users/interfaces/remove-user-from-organization-options.interface.d.ts +2 -2
- package/lib/users/interfaces/revoke-all-sessions-for-user-options.interface.d.ts +3 -0
- package/lib/users/interfaces/revoke-all-sessions-for-user-options.interface.js +2 -0
- package/lib/users/interfaces/revoke-session-options.interface.d.ts +7 -0
- package/lib/users/interfaces/send-magic-auth-code-options.interface.d.ts +6 -0
- package/lib/users/interfaces/send-magic-auth-code-options.interface.js +2 -0
- package/lib/users/interfaces/session.interface.d.ts +35 -0
- package/lib/users/interfaces/update-user-options.interface.d.ts +14 -0
- package/lib/users/interfaces/update-user-options.interface.js +2 -0
- package/lib/users/interfaces/update-user-password-options.interface.d.ts +7 -0
- package/lib/users/interfaces/update-user-password-options.interface.js +2 -0
- package/lib/users/interfaces/user.interface.d.ts +28 -18
- package/lib/users/interfaces/verify-session.interface.d.ts +10 -2
- package/lib/users/serializers/authenticate-user-with-magic-auth-options.serializer.d.ts +2 -0
- package/lib/users/serializers/authenticate-user-with-magic-auth-options.serializer.js +14 -0
- package/lib/users/serializers/authenticate-user-with-password-options.serializer.d.ts +2 -0
- package/lib/users/serializers/authenticate-user-with-password-options.serializer.js +14 -0
- package/lib/users/serializers/authenticate-user-with-token-options.serializer.d.ts +2 -0
- package/lib/users/serializers/authenticate-user-with-token-options.serializer.js +11 -0
- package/lib/users/serializers/authentication-response.serializer.d.ts +2 -0
- package/lib/users/serializers/authentication-response.serializer.js +10 -0
- package/lib/users/serializers/complete-password-reset-options.serializer.d.ts +2 -0
- package/lib/users/serializers/complete-password-reset-options.serializer.js +8 -0
- package/lib/users/serializers/create-email-verification-challenge.serializer.d.ts +2 -0
- package/lib/users/serializers/create-email-verification-challenge.serializer.js +9 -0
- package/lib/users/serializers/create-password-reset-challenge.serializer.d.ts +3 -0
- package/lib/users/serializers/create-password-reset-challenge.serializer.js +14 -0
- package/lib/users/serializers/create-user-options.serializer.d.ts +2 -0
- package/lib/users/serializers/create-user-options.serializer.js +11 -0
- package/lib/users/serializers/index.d.ts +15 -0
- package/lib/users/serializers/index.js +31 -0
- package/lib/users/serializers/revoke-session-options.serializer.d.ts +2 -0
- package/lib/users/serializers/revoke-session-options.serializer.js +14 -0
- package/lib/users/serializers/send-magic-auth-code-options.serializer.d.ts +2 -0
- package/lib/users/serializers/send-magic-auth-code-options.serializer.js +7 -0
- package/lib/users/serializers/session.serializer.d.ts +4 -0
- package/lib/users/serializers/session.serializer.js +22 -0
- package/lib/users/serializers/update-user-options.serializer.d.ts +2 -0
- package/lib/users/serializers/update-user-options.serializer.js +8 -0
- package/lib/users/serializers/update-user-password-options.serializer.d.ts +2 -0
- package/lib/users/serializers/update-user-password-options.serializer.js +7 -0
- package/lib/users/serializers/user.serializer.d.ts +2 -0
- package/lib/users/serializers/user.serializer.js +24 -0
- package/lib/users/serializers/verify-session.serializer.d.ts +3 -0
- package/lib/users/serializers/verify-session.serializer.js +15 -0
- package/lib/users/users.d.ts +11 -7
- package/lib/users/users.js +54 -30
- package/lib/users/users.spec.js +133 -49
- package/lib/webhooks/fixtures/webhook.json +67 -1
- package/lib/webhooks/webhooks.d.ts +2 -2
- package/lib/webhooks/webhooks.js +2 -1
- package/lib/webhooks/webhooks.spec.js +8 -6
- package/lib/workos.d.ts +5 -4
- package/lib/workos.js +4 -1
- package/lib/workos.spec.js +11 -1
- package/package.json +14 -15
- package/lib/directory-sync/interfaces/group.interface.d.ts +0 -10
- package/lib/directory-sync/interfaces/user.interface.d.ts +0 -23
- package/lib/events/interfaces/event.interface.d.ts +0 -63
- package/lib/webhooks/interfaces/index.d.ts +0 -4
- package/lib/webhooks/interfaces/webhook-directory-group.interface.d.ts +0 -10
- package/lib/webhooks/interfaces/webhook-directory-user.interface.d.ts +0 -5
- package/lib/webhooks/interfaces/webhook-directory.interface.d.ts +0 -20
- package/lib/webhooks/interfaces/webhook.interface.d.ts +0 -73
- /package/lib/{directory-sync/interfaces/group.interface.js → common/interfaces/at-least-one-property-of.interface.js} +0 -0
- /package/lib/{events → common}/interfaces/event.interface.js +0 -0
- /package/lib/{directory-sync/interfaces/list-users-options.interface.js → common/interfaces/workos-response-error.interface.js} +0 -0
- /package/lib/directory-sync/interfaces/{user.interface.js → directory-group.interface.js} +0 -0
- /package/lib/{webhooks/interfaces/webhook-directory-group.interface.js → directory-sync/interfaces/directory-user.interface.js} +0 -0
- /package/lib/{webhooks/interfaces/webhook-directory-user.interface.js → directory-sync/interfaces/list-directory-users-options.interface.js} +0 -0
- /package/lib/{webhooks/interfaces/webhook-directory.interface.js → users/interfaces/authenticate-user-with-magic-auth-options.interface.js} +0 -0
- /package/lib/{webhooks/interfaces/webhook.interface.js → users/interfaces/magic-auth-challenge.interface.js} +0 -0
|
@@ -28,8 +28,10 @@ describe('Organizations', () => {
|
|
|
28
28
|
describe('without any options', () => {
|
|
29
29
|
it('returns organizations and metadata', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
30
|
mock.onGet('/organizations').replyOnce(200, list_organizations_json_1.default);
|
|
31
|
-
const { data,
|
|
32
|
-
expect(mock.history.get[0].params).
|
|
31
|
+
const { data, listMetadata } = yield workos.organizations.listOrganizations();
|
|
32
|
+
expect(mock.history.get[0].params).toEqual({
|
|
33
|
+
order: 'desc',
|
|
34
|
+
});
|
|
33
35
|
expect(mock.history.get[0].url).toEqual('/organizations');
|
|
34
36
|
expect(data).toHaveLength(7);
|
|
35
37
|
expect(listMetadata).toEqual({
|
|
@@ -50,6 +52,7 @@ describe('Organizations', () => {
|
|
|
50
52
|
});
|
|
51
53
|
expect(mock.history.get[0].params).toEqual({
|
|
52
54
|
domains: ['example.com'],
|
|
55
|
+
order: 'desc',
|
|
53
56
|
});
|
|
54
57
|
expect(mock.history.get[0].url).toEqual('/organizations');
|
|
55
58
|
expect(data).toHaveLength(7);
|
|
@@ -67,6 +70,7 @@ describe('Organizations', () => {
|
|
|
67
70
|
});
|
|
68
71
|
expect(mock.history.get[0].params).toEqual({
|
|
69
72
|
before: 'before-id',
|
|
73
|
+
order: 'desc',
|
|
70
74
|
});
|
|
71
75
|
expect(mock.history.get[0].url).toEqual('/organizations');
|
|
72
76
|
expect(data).toHaveLength(7);
|
|
@@ -84,6 +88,7 @@ describe('Organizations', () => {
|
|
|
84
88
|
});
|
|
85
89
|
expect(mock.history.get[0].params).toEqual({
|
|
86
90
|
after: 'after-id',
|
|
91
|
+
order: 'desc',
|
|
87
92
|
});
|
|
88
93
|
expect(mock.history.get[0].url).toEqual('/organizations');
|
|
89
94
|
expect(data).toHaveLength(7);
|
|
@@ -101,6 +106,7 @@ describe('Organizations', () => {
|
|
|
101
106
|
});
|
|
102
107
|
expect(mock.history.get[0].params).toEqual({
|
|
103
108
|
limit: 10,
|
|
109
|
+
order: 'desc',
|
|
104
110
|
});
|
|
105
111
|
expect(mock.history.get[0].url).toEqual('/organizations');
|
|
106
112
|
expect(data).toHaveLength(7);
|
|
@@ -110,6 +116,7 @@ describe('Organizations', () => {
|
|
|
110
116
|
describe('createOrganization', () => {
|
|
111
117
|
describe('with an idempotency key', () => {
|
|
112
118
|
it('includes an idempotency key with request', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
119
|
+
var _a;
|
|
113
120
|
mock
|
|
114
121
|
.onPost('/organizations', {
|
|
115
122
|
domains: ['example.com'],
|
|
@@ -122,7 +129,7 @@ describe('Organizations', () => {
|
|
|
122
129
|
}, {
|
|
123
130
|
idempotencyKey: 'the-idempotency-key',
|
|
124
131
|
});
|
|
125
|
-
expect(mock.history.post[0].headers['Idempotency-Key']).toEqual('the-idempotency-key');
|
|
132
|
+
expect((_a = mock.history.post[0].headers) === null || _a === void 0 ? void 0 : _a['Idempotency-Key']).toEqual('the-idempotency-key');
|
|
126
133
|
}));
|
|
127
134
|
});
|
|
128
135
|
describe('with a valid payload', () => {
|
|
@@ -170,7 +177,7 @@ describe('Organizations', () => {
|
|
|
170
177
|
expect(mock.history.get[0].url).toEqual('/organizations/org_01EHT88Z8J8795GZNQ4ZP1J81T');
|
|
171
178
|
expect(subject.id).toEqual('org_01EHT88Z8J8795GZNQ4ZP1J81T');
|
|
172
179
|
expect(subject.name).toEqual('Test Organization 3');
|
|
173
|
-
expect(subject.
|
|
180
|
+
expect(subject.allowProfilesOutsideOrganization).toEqual(false);
|
|
174
181
|
expect(subject.domains).toHaveLength(1);
|
|
175
182
|
}));
|
|
176
183
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeCreateOrganizationOptions = void 0;
|
|
4
|
+
const serializeCreateOrganizationOptions = (options) => ({
|
|
5
|
+
name: options.name,
|
|
6
|
+
allow_profiles_outside_organization: options.allowProfilesOutsideOrganization,
|
|
7
|
+
domains: options.domains,
|
|
8
|
+
});
|
|
9
|
+
exports.serializeCreateOrganizationOptions = serializeCreateOrganizationOptions;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./create-organization-options.serializer"), exports);
|
|
18
|
+
__exportStar(require("./organization.serializer"), exports);
|
|
19
|
+
__exportStar(require("./update-organization-options.serializer"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeOrganization = void 0;
|
|
4
|
+
const deserializeOrganization = (organization) => ({
|
|
5
|
+
object: organization.object,
|
|
6
|
+
id: organization.id,
|
|
7
|
+
name: organization.name,
|
|
8
|
+
allowProfilesOutsideOrganization: organization.allow_profiles_outside_organization,
|
|
9
|
+
domains: organization.domains,
|
|
10
|
+
createdAt: organization.created_at,
|
|
11
|
+
updatedAt: organization.updated_at,
|
|
12
|
+
});
|
|
13
|
+
exports.deserializeOrganization = deserializeOrganization;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeUpdateOrganizationOptions = void 0;
|
|
4
|
+
const serializeUpdateOrganizationOptions = (options) => ({
|
|
5
|
+
name: options.name,
|
|
6
|
+
allow_profiles_outside_organization: options.allowProfilesOutsideOrganization,
|
|
7
|
+
domains: options.domains,
|
|
8
|
+
});
|
|
9
|
+
exports.serializeUpdateOrganizationOptions = serializeUpdateOrganizationOptions;
|
|
@@ -6,3 +6,11 @@ export interface CreatePasswordlessSessionOptions {
|
|
|
6
6
|
connection?: string;
|
|
7
7
|
expiresIn?: number;
|
|
8
8
|
}
|
|
9
|
+
export interface SerializedCreatePasswordlessSessionOptions {
|
|
10
|
+
type: 'MagicLink';
|
|
11
|
+
email: string;
|
|
12
|
+
redirect_uri?: string;
|
|
13
|
+
state?: string;
|
|
14
|
+
connection?: string;
|
|
15
|
+
expires_in?: number;
|
|
16
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export * from './passwordless-session.interface';
|
|
2
|
+
export * from './create-passwordless-session-options.interface';
|
|
3
|
+
export * from './send-session-response.interface';
|
|
@@ -1,2 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./passwordless-session.interface"), exports);
|
|
18
|
+
__exportStar(require("./create-passwordless-session-options.interface"), exports);
|
|
19
|
+
__exportStar(require("./send-session-response.interface"), exports);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { WorkOS } from '../workos';
|
|
2
|
-
import { PasswordlessSession } from './interfaces
|
|
3
|
-
import { CreatePasswordlessSessionOptions } from './interfaces/create-passwordless-session-options.interface';
|
|
4
|
-
import { SendSessionResponse } from './interfaces/send-session-response.interface';
|
|
2
|
+
import { CreatePasswordlessSessionOptions, PasswordlessSession, SendSessionResponse } from './interfaces';
|
|
5
3
|
export declare class Passwordless {
|
|
6
4
|
private readonly workos;
|
|
7
5
|
constructor(workos: WorkOS);
|
|
@@ -21,6 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.Passwordless = void 0;
|
|
24
|
+
const passwordless_session_serializer_1 = require("./serializers/passwordless-session.serializer");
|
|
24
25
|
class Passwordless {
|
|
25
26
|
constructor(workos) {
|
|
26
27
|
this.workos = workos;
|
|
@@ -29,7 +30,7 @@ class Passwordless {
|
|
|
29
30
|
var { redirectURI, expiresIn } = _a, options = __rest(_a, ["redirectURI", "expiresIn"]);
|
|
30
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
32
|
const { data } = yield this.workos.post('/passwordless/sessions', Object.assign(Object.assign({}, options), { redirect_uri: redirectURI, expires_in: expiresIn }));
|
|
32
|
-
return data;
|
|
33
|
+
return (0, passwordless_session_serializer_1.deserializePasswordlessSession)(data);
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
36
|
sendSession(sessionId) {
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializePasswordlessSession = void 0;
|
|
4
|
+
const deserializePasswordlessSession = (passwordlessSession) => ({
|
|
5
|
+
id: passwordlessSession.id,
|
|
6
|
+
email: passwordlessSession.email,
|
|
7
|
+
expiresAt: passwordlessSession.expires_at,
|
|
8
|
+
link: passwordlessSession.link,
|
|
9
|
+
object: passwordlessSession.object,
|
|
10
|
+
});
|
|
11
|
+
exports.deserializePasswordlessSession = deserializePasswordlessSession;
|
|
@@ -7,4 +7,4 @@ var GeneratePortalLinkIntent;
|
|
|
7
7
|
GeneratePortalLinkIntent["DSync"] = "dsync";
|
|
8
8
|
GeneratePortalLinkIntent["LogStreams"] = "log_streams";
|
|
9
9
|
GeneratePortalLinkIntent["SSO"] = "sso";
|
|
10
|
-
})(GeneratePortalLinkIntent
|
|
10
|
+
})(GeneratePortalLinkIntent || (exports.GeneratePortalLinkIntent = GeneratePortalLinkIntent = {}));
|
|
@@ -15,6 +15,7 @@ export declare enum ConnectionType {
|
|
|
15
15
|
JumpCloudSAML = "JumpCloudSAML",
|
|
16
16
|
KeycloakSAML = "KeycloakSAML",
|
|
17
17
|
LastPassSAML = "LastPassSAML",
|
|
18
|
+
LoginGovOidc = "LoginGovOidc",
|
|
18
19
|
MagicLink = "MagicLink",
|
|
19
20
|
MicrosoftOAuth = "MicrosoftOAuth",
|
|
20
21
|
MiniOrangeSAML = "MiniOrangeSAML",
|
|
@@ -19,6 +19,7 @@ var ConnectionType;
|
|
|
19
19
|
ConnectionType["JumpCloudSAML"] = "JumpCloudSAML";
|
|
20
20
|
ConnectionType["KeycloakSAML"] = "KeycloakSAML";
|
|
21
21
|
ConnectionType["LastPassSAML"] = "LastPassSAML";
|
|
22
|
+
ConnectionType["LoginGovOidc"] = "LoginGovOidc";
|
|
22
23
|
ConnectionType["MagicLink"] = "MagicLink";
|
|
23
24
|
ConnectionType["MicrosoftOAuth"] = "MicrosoftOAuth";
|
|
24
25
|
ConnectionType["MiniOrangeSAML"] = "MiniOrangeSAML";
|
|
@@ -34,4 +35,4 @@ var ConnectionType;
|
|
|
34
35
|
ConnectionType["ShibbolethSAML"] = "ShibbolethSAML";
|
|
35
36
|
ConnectionType["SimpleSamlPhpSAML"] = "SimpleSamlPhpSAML";
|
|
36
37
|
ConnectionType["VMwareSAML"] = "VMwareSAML";
|
|
37
|
-
})(ConnectionType
|
|
38
|
+
})(ConnectionType || (exports.ConnectionType = ConnectionType = {}));
|
|
@@ -7,14 +7,25 @@ export interface ConnectionDomain {
|
|
|
7
7
|
export interface Connection {
|
|
8
8
|
object: 'connection';
|
|
9
9
|
id: string;
|
|
10
|
-
|
|
10
|
+
organizationId?: string;
|
|
11
11
|
name: string;
|
|
12
|
-
connection_type: ConnectionType;
|
|
13
|
-
state: 'draft' | 'active' | 'inactive';
|
|
14
12
|
/**
|
|
15
|
-
* @deprecated The
|
|
13
|
+
* @deprecated The connectionType parameter has been deprecated. Please use type.
|
|
16
14
|
*/
|
|
17
|
-
|
|
15
|
+
connectionType: ConnectionType;
|
|
16
|
+
state: 'draft' | 'active' | 'inactive' | 'validating';
|
|
17
|
+
domains: ConnectionDomain[];
|
|
18
|
+
type: ConnectionType;
|
|
19
|
+
createdAt: string;
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ConnectionResponse {
|
|
23
|
+
object: 'connection';
|
|
24
|
+
id: string;
|
|
25
|
+
organization_id?: string;
|
|
26
|
+
name: string;
|
|
27
|
+
connection_type: ConnectionType;
|
|
28
|
+
state: 'draft' | 'active' | 'inactive' | 'validating';
|
|
18
29
|
domains: ConnectionDomain[];
|
|
19
30
|
created_at: string;
|
|
20
31
|
updated_at: string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './authorization-url-options.interface';
|
|
2
2
|
export * from './connection-type.enum';
|
|
3
3
|
export * from './connection.interface';
|
|
4
|
+
export * from './get-profile-options.interface';
|
|
4
5
|
export * from './get-profile-and-token-options.interface';
|
|
6
|
+
export * from './list-connections-options.interface';
|
|
5
7
|
export * from './profile-and-token.interface';
|
|
6
8
|
export * from './profile.interface';
|
|
@@ -17,6 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./authorization-url-options.interface"), exports);
|
|
18
18
|
__exportStar(require("./connection-type.enum"), exports);
|
|
19
19
|
__exportStar(require("./connection.interface"), exports);
|
|
20
|
+
__exportStar(require("./get-profile-options.interface"), exports);
|
|
20
21
|
__exportStar(require("./get-profile-and-token-options.interface"), exports);
|
|
22
|
+
__exportStar(require("./list-connections-options.interface"), exports);
|
|
21
23
|
__exportStar(require("./profile-and-token.interface"), exports);
|
|
22
24
|
__exportStar(require("./profile.interface"), exports);
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { PaginationOptions } from '../../common/interfaces/pagination-options.interface';
|
|
2
2
|
import { ConnectionType } from './connection-type.enum';
|
|
3
3
|
export interface ListConnectionsOptions extends PaginationOptions {
|
|
4
|
+
connectionType?: ConnectionType;
|
|
5
|
+
domain?: string;
|
|
6
|
+
organizationId?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SerializedListConnectionsOptions extends PaginationOptions {
|
|
4
9
|
connection_type?: ConnectionType;
|
|
5
10
|
domain?: string;
|
|
6
11
|
organization_id?: string;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { Profile } from './profile.interface';
|
|
1
|
+
import { Profile, ProfileResponse } from './profile.interface';
|
|
2
2
|
export interface ProfileAndToken {
|
|
3
|
-
|
|
3
|
+
accessToken: string;
|
|
4
4
|
profile: Profile;
|
|
5
5
|
}
|
|
6
|
+
export interface ProfileAndTokenResponse {
|
|
7
|
+
access_token: string;
|
|
8
|
+
profile: ProfileResponse;
|
|
9
|
+
}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { ConnectionType } from './connection-type.enum';
|
|
2
2
|
export interface Profile {
|
|
3
|
+
id: string;
|
|
4
|
+
idpId: string;
|
|
5
|
+
organizationId?: string;
|
|
6
|
+
connectionId: string;
|
|
7
|
+
connectionType: ConnectionType;
|
|
8
|
+
email: string;
|
|
9
|
+
firstName?: string;
|
|
10
|
+
lastName?: string;
|
|
11
|
+
groups?: string[];
|
|
12
|
+
rawAttributes?: {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface ProfileResponse {
|
|
3
17
|
id: string;
|
|
4
18
|
idp_id: string;
|
|
5
19
|
organization_id?: string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeConnection = void 0;
|
|
4
|
+
const deserializeConnection = (connection) => ({
|
|
5
|
+
object: connection.object,
|
|
6
|
+
id: connection.id,
|
|
7
|
+
organizationId: connection.organization_id,
|
|
8
|
+
name: connection.name,
|
|
9
|
+
connectionType: connection.connection_type,
|
|
10
|
+
type: connection.connection_type,
|
|
11
|
+
state: connection.state,
|
|
12
|
+
domains: connection.domains,
|
|
13
|
+
createdAt: connection.created_at,
|
|
14
|
+
updatedAt: connection.updated_at,
|
|
15
|
+
});
|
|
16
|
+
exports.deserializeConnection = deserializeConnection;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./connection.serializer"), exports);
|
|
18
|
+
__exportStar(require("./profile-and-token.serializer"), exports);
|
|
19
|
+
__exportStar(require("./profile.serializer"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeProfileAndToken = void 0;
|
|
4
|
+
const profile_serializer_1 = require("./profile.serializer");
|
|
5
|
+
const deserializeProfileAndToken = (profileAndToken) => ({
|
|
6
|
+
accessToken: profileAndToken.access_token,
|
|
7
|
+
profile: (0, profile_serializer_1.deserializeProfile)(profileAndToken.profile),
|
|
8
|
+
});
|
|
9
|
+
exports.deserializeProfileAndToken = deserializeProfileAndToken;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeProfile = void 0;
|
|
4
|
+
const deserializeProfile = (profile) => ({
|
|
5
|
+
id: profile.id,
|
|
6
|
+
idpId: profile.idp_id,
|
|
7
|
+
organizationId: profile.organization_id,
|
|
8
|
+
connectionId: profile.connection_id,
|
|
9
|
+
connectionType: profile.connection_type,
|
|
10
|
+
email: profile.email,
|
|
11
|
+
firstName: profile.first_name,
|
|
12
|
+
lastName: profile.last_name,
|
|
13
|
+
groups: profile.groups,
|
|
14
|
+
rawAttributes: profile.raw_attributes,
|
|
15
|
+
});
|
|
16
|
+
exports.deserializeProfile = deserializeProfile;
|
package/lib/sso/sso.d.ts
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AutoPaginatable } from '../common/utils/pagination';
|
|
2
2
|
import { WorkOS } from '../workos';
|
|
3
|
-
import { AuthorizationURLOptions } from './interfaces
|
|
4
|
-
import { Connection } from './interfaces/connection.interface';
|
|
5
|
-
import { GetProfileAndTokenOptions } from './interfaces/get-profile-and-token-options.interface';
|
|
6
|
-
import { GetProfileOptions } from './interfaces/get-profile-options.interface';
|
|
7
|
-
import { ListConnectionsOptions } from './interfaces/list-connections-options.interface';
|
|
8
|
-
import { ProfileAndToken } from './interfaces/profile-and-token.interface';
|
|
9
|
-
import { Profile } from './interfaces/profile.interface';
|
|
3
|
+
import { AuthorizationURLOptions, Connection, GetProfileAndTokenOptions, GetProfileOptions, ListConnectionsOptions, Profile, ProfileAndToken } from './interfaces';
|
|
10
4
|
export declare class SSO {
|
|
11
5
|
private readonly workos;
|
|
12
6
|
constructor(workos: WorkOS);
|
|
7
|
+
listConnections(options?: ListConnectionsOptions): Promise<AutoPaginatable<Connection>>;
|
|
13
8
|
deleteConnection(id: string): Promise<void>;
|
|
14
9
|
getAuthorizationURL({ connection, clientID, domain, domainHint, loginHint, organization, provider, redirectURI, state, }: AuthorizationURLOptions): string;
|
|
15
10
|
getConnection(id: string): Promise<Connection>;
|
|
16
11
|
getProfileAndToken({ code, clientID, }: GetProfileAndTokenOptions): Promise<ProfileAndToken>;
|
|
17
12
|
getProfile({ accessToken }: GetProfileOptions): Promise<Profile>;
|
|
18
|
-
listConnections(options?: ListConnectionsOptions): Promise<List<Connection>>;
|
|
19
13
|
}
|
package/lib/sso/sso.js
CHANGED
|
@@ -8,16 +8,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.SSO = void 0;
|
|
16
|
-
const
|
|
13
|
+
const pagination_1 = require("../common/utils/pagination");
|
|
14
|
+
const serializers_1 = require("./serializers");
|
|
15
|
+
const fetch_and_deserialize_1 = require("../common/utils/fetch-and-deserialize");
|
|
16
|
+
const toQueryString = (options) => {
|
|
17
|
+
const searchParams = new URLSearchParams();
|
|
18
|
+
const keys = Object.keys(options).sort();
|
|
19
|
+
for (const key of keys) {
|
|
20
|
+
const value = options[key];
|
|
21
|
+
if (value) {
|
|
22
|
+
searchParams.append(key, value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return searchParams.toString();
|
|
26
|
+
};
|
|
17
27
|
class SSO {
|
|
18
28
|
constructor(workos) {
|
|
19
29
|
this.workos = workos;
|
|
20
30
|
}
|
|
31
|
+
listConnections(options) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/connections', serializers_1.deserializeConnection, options), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/connections', serializers_1.deserializeConnection, params), options);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
21
36
|
deleteConnection(id) {
|
|
22
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
38
|
yield this.workos.delete(`/connections/${id}`);
|
|
@@ -30,7 +45,7 @@ class SSO {
|
|
|
30
45
|
if (domain) {
|
|
31
46
|
this.workos.emitWarning('The `domain` parameter for `getAuthorizationURL` is deprecated. Please use `organization` instead.');
|
|
32
47
|
}
|
|
33
|
-
const query =
|
|
48
|
+
const query = toQueryString({
|
|
34
49
|
connection,
|
|
35
50
|
organization,
|
|
36
51
|
domain,
|
|
@@ -47,7 +62,7 @@ class SSO {
|
|
|
47
62
|
getConnection(id) {
|
|
48
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
64
|
const { data } = yield this.workos.get(`/connections/${id}`);
|
|
50
|
-
return data;
|
|
65
|
+
return (0, serializers_1.deserializeConnection)(data);
|
|
51
66
|
});
|
|
52
67
|
}
|
|
53
68
|
getProfileAndToken({ code, clientID, }) {
|
|
@@ -59,7 +74,7 @@ class SSO {
|
|
|
59
74
|
code,
|
|
60
75
|
});
|
|
61
76
|
const { data } = yield this.workos.post('/sso/token', form);
|
|
62
|
-
return data;
|
|
77
|
+
return (0, serializers_1.deserializeProfileAndToken)(data);
|
|
63
78
|
});
|
|
64
79
|
}
|
|
65
80
|
getProfile({ accessToken }) {
|
|
@@ -67,15 +82,7 @@ class SSO {
|
|
|
67
82
|
const { data } = yield this.workos.get('/sso/profile', {
|
|
68
83
|
accessToken,
|
|
69
84
|
});
|
|
70
|
-
return data;
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
listConnections(options) {
|
|
74
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const { data } = yield this.workos.get(`/connections`, {
|
|
76
|
-
query: options,
|
|
77
|
-
});
|
|
78
|
-
return data;
|
|
85
|
+
return (0, serializers_1.deserializeProfile)(data);
|
|
79
86
|
});
|
|
80
87
|
}
|
|
81
88
|
}
|