@workos-inc/node 2.20.0 → 3.0.0-alpha.2
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.spec.js +2 -1
- package/lib/common/interfaces/index.d.ts +2 -0
- package/lib/common/interfaces/index.js +2 -0
- package/lib/common/interfaces/list.interface.d.ts +8 -0
- package/lib/common/interfaces/workos-response-error.interface.d.ts +8 -0
- package/lib/common/serializers/index.d.ts +1 -0
- package/lib/common/serializers/index.js +17 -0
- package/lib/common/serializers/list.serializer.d.ts +2 -0
- package/lib/common/serializers/list.serializer.js +9 -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 +7 -12
- package/lib/directory-sync/directory-sync.js +8 -6
- package/lib/directory-sync/directory-sync.spec.js +95 -20
- package/lib/directory-sync/interfaces/directory-group.interface.d.ts +20 -0
- package/lib/directory-sync/interfaces/directory-user.interface.d.ts +48 -0
- package/lib/directory-sync/interfaces/directory.interface.d.ts +12 -0
- 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-directory-users-options.interface.js +2 -0
- package/lib/directory-sync/serializers/directory-group.serializer.d.ts +2 -0
- package/lib/directory-sync/serializers/directory-group.serializer.js +14 -0
- package/lib/directory-sync/serializers/directory-user.serializer.d.ts +3 -0
- package/lib/directory-sync/serializers/directory-user.serializer.js +23 -0
- package/lib/directory-sync/serializers/directory.serializer.d.ts +2 -0
- package/lib/directory-sync/serializers/directory.serializer.js +16 -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 +10 -8
- package/lib/events/events.d.ts +3 -3
- package/lib/events/events.js +3 -1
- package/lib/events/events.spec.js +19 -3
- package/lib/events/interfaces/event.interface.d.ts +4 -1
- package/lib/events/interfaces/list-events-options.interface.d.ts +2 -2
- package/lib/events/serializers/event.serializer.d.ts +2 -0
- package/lib/events/serializers/event.serializer.js +10 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- 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/mfa/serializers/index.js +19 -0
- 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 +8 -6
- package/lib/organizations/organizations.spec.js +4 -3
- 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 +20 -1
- 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 +17 -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 +18 -9
- package/lib/sso/sso.spec.js +27 -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 +21 -0
- package/lib/users/fixtures/session.json +6 -0
- package/lib/users/fixtures/user.json +12 -0
- package/lib/users/interfaces/add-user-to-organization-options.interface.d.ts +7 -0
- package/lib/users/interfaces/add-user-to-organization-options.interface.js +2 -0
- package/lib/users/interfaces/authenticate-user-with-password-options.interface.d.ts +21 -0
- package/lib/users/interfaces/authenticate-user-with-password-options.interface.js +2 -0
- package/lib/users/interfaces/authenticate-user-with-token-options.interface.d.ts +15 -0
- package/lib/users/interfaces/authenticate-user-with-token-options.interface.js +2 -0
- package/lib/users/interfaces/authentication-response.interface.d.ts +10 -0
- package/lib/users/interfaces/authentication-response.interface.js +2 -0
- package/lib/users/interfaces/complete-password-reset-options.interface.d.ts +8 -0
- package/lib/users/interfaces/complete-password-reset-options.interface.js +2 -0
- package/lib/users/interfaces/create-email-verification-challenge-options.interface.d.ts +16 -0
- package/lib/users/interfaces/create-email-verification-challenge-options.interface.js +2 -0
- package/lib/users/interfaces/create-password-reset-challenge-options.interface.d.ts +17 -0
- package/lib/users/interfaces/create-password-reset-challenge-options.interface.js +2 -0
- package/lib/users/interfaces/create-user-options.interface.d.ts +14 -0
- package/lib/users/interfaces/create-user-options.interface.js +2 -0
- package/lib/users/interfaces/index.d.ts +15 -0
- package/lib/users/interfaces/index.js +31 -0
- package/lib/users/interfaces/list-users-options.interface.d.ts +6 -0
- package/lib/users/interfaces/list-users-options.interface.js +2 -0
- package/lib/users/interfaces/remove-user-from-organization-options.interface.d.ts +4 -0
- package/lib/users/interfaces/remove-user-from-organization-options.interface.js +2 -0
- package/lib/users/interfaces/revoke-session-options.interface.d.ts +15 -0
- package/lib/users/interfaces/revoke-session-options.interface.js +2 -0
- package/lib/users/interfaces/session.interface.d.ts +12 -0
- package/lib/users/interfaces/session.interface.js +2 -0
- package/lib/users/interfaces/update-user-options.interface.d.ts +9 -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 +59 -0
- package/lib/users/interfaces/user.interface.js +2 -0
- package/lib/users/interfaces/verify-session.interface.d.ts +18 -0
- package/lib/users/interfaces/verify-session.interface.js +2 -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 +12 -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 +13 -0
- package/lib/users/serializers/index.js +29 -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/session.serializer.d.ts +2 -0
- package/lib/users/serializers/session.serializer.js +10 -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 +31 -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 +23 -0
- package/lib/users/users.js +124 -0
- package/lib/users/users.spec.d.ts +1 -0
- package/lib/users/users.spec.js +318 -0
- package/lib/webhooks/fixtures/webhook.json +1 -1
- package/lib/webhooks/interfaces/webhook-directory-user.interface.d.ts +2 -2
- package/lib/webhooks/interfaces/webhook.interface.d.ts +1 -0
- package/lib/workos.d.ts +6 -4
- package/lib/workos.js +3 -1
- package/package.json +13 -14
- package/lib/directory-sync/interfaces/group.interface.d.ts +0 -10
- package/lib/directory-sync/interfaces/user.interface.d.ts +0 -23
- /package/lib/{directory-sync/interfaces/group.interface.js → common/interfaces/workos-response-error.interface.js} +0 -0
- /package/lib/directory-sync/interfaces/{list-users-options.interface.js → directory-group.interface.js} +0 -0
- /package/lib/directory-sync/interfaces/{user.interface.js → directory-user.interface.js} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeFactor = void 0;
|
|
4
|
+
const sms_serializer_1 = require("./sms.serializer");
|
|
5
|
+
const totp_serializer_1 = require("./totp.serializer");
|
|
6
|
+
const deserializeFactor = (factor) => (Object.assign(Object.assign({ object: factor.object, id: factor.id, createdAt: factor.created_at, updatedAt: factor.updated_at, type: factor.type }, (factor.sms ? { sms: (0, sms_serializer_1.deserializeSms)(factor.sms) } : {})), (factor.totp ? { totp: (0, totp_serializer_1.deserializeTotp)(factor.totp) } : {})));
|
|
7
|
+
exports.deserializeFactor = deserializeFactor;
|
|
@@ -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("./challenge.serializer"), exports);
|
|
18
|
+
__exportStar(require("./factor.serializer"), exports);
|
|
19
|
+
__exportStar(require("./verify-response.serializer"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeTotp = void 0;
|
|
4
|
+
const deserializeTotp = (totp) => ({
|
|
5
|
+
issuer: totp.issuer,
|
|
6
|
+
user: totp.user,
|
|
7
|
+
qrCode: totp.qr_code,
|
|
8
|
+
secret: totp.secret,
|
|
9
|
+
uri: totp.uri,
|
|
10
|
+
});
|
|
11
|
+
exports.deserializeTotp = deserializeTotp;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeVerifyResponse = void 0;
|
|
4
|
+
const challenge_serializer_1 = require("./challenge.serializer");
|
|
5
|
+
const deserializeVerifyResponse = (verifyResponse) => ({
|
|
6
|
+
challenge: (0, challenge_serializer_1.deserializeChallenge)(verifyResponse.challenge),
|
|
7
|
+
valid: verifyResponse.valid,
|
|
8
|
+
});
|
|
9
|
+
exports.deserializeVerifyResponse = deserializeVerifyResponse;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { PostOptions } from '../../common/interfaces';
|
|
2
2
|
export interface CreateOrganizationOptions {
|
|
3
|
+
name: string;
|
|
4
|
+
allowProfilesOutsideOrganization?: boolean;
|
|
5
|
+
domains?: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface SerializedCreateOrganizationOptions {
|
|
3
8
|
name: string;
|
|
4
9
|
allow_profiles_outside_organization?: boolean;
|
|
5
10
|
domains?: string[];
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { OrganizationDomain } from './organization-domain.interface';
|
|
2
2
|
export interface Organization {
|
|
3
|
+
object: 'organization';
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
allowProfilesOutsideOrganization: boolean;
|
|
7
|
+
domains: OrganizationDomain[];
|
|
8
|
+
createdAt: string;
|
|
9
|
+
updatedAt: string;
|
|
10
|
+
}
|
|
11
|
+
export interface OrganizationResponse {
|
|
3
12
|
object: 'organization';
|
|
4
13
|
id: string;
|
|
5
14
|
name: string;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export interface UpdateOrganizationOptions {
|
|
2
2
|
organization: string;
|
|
3
|
+
name: string;
|
|
4
|
+
allowProfilesOutsideOrganization?: boolean;
|
|
5
|
+
domains?: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface SerializedUpdateOrganizationOptions {
|
|
3
8
|
name: string;
|
|
4
9
|
allow_profiles_outside_organization?: boolean;
|
|
5
10
|
domains?: string[];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DeserializedList } from '../common/interfaces';
|
|
2
2
|
import { WorkOS } from '../workos';
|
|
3
3
|
import { CreateOrganizationOptions, CreateOrganizationRequestOptions, ListOrganizationsOptions, Organization, UpdateOrganizationOptions } from './interfaces';
|
|
4
4
|
export declare class Organizations {
|
|
5
5
|
private readonly workos;
|
|
6
6
|
constructor(workos: WorkOS);
|
|
7
|
-
listOrganizations(options?: ListOrganizationsOptions): Promise<
|
|
7
|
+
listOrganizations(options?: ListOrganizationsOptions): Promise<DeserializedList<Organization>>;
|
|
8
8
|
createOrganization(payload: CreateOrganizationOptions, requestOptions?: CreateOrganizationRequestOptions): Promise<Organization>;
|
|
9
9
|
deleteOrganization(id: string): Promise<void>;
|
|
10
10
|
getOrganization(id: string): Promise<Organization>;
|
|
@@ -21,6 +21,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.Organizations = void 0;
|
|
24
|
+
const serializers_1 = require("../common/serializers");
|
|
25
|
+
const serializers_2 = require("./serializers");
|
|
24
26
|
class Organizations {
|
|
25
27
|
constructor(workos) {
|
|
26
28
|
this.workos = workos;
|
|
@@ -30,13 +32,13 @@ class Organizations {
|
|
|
30
32
|
const { data } = yield this.workos.get('/organizations', {
|
|
31
33
|
query: options,
|
|
32
34
|
});
|
|
33
|
-
return data;
|
|
35
|
+
return (0, serializers_1.deserializeList)(data, serializers_2.deserializeOrganization);
|
|
34
36
|
});
|
|
35
37
|
}
|
|
36
38
|
createOrganization(payload, requestOptions = {}) {
|
|
37
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const { data } = yield this.workos.post('/organizations', payload, requestOptions);
|
|
39
|
-
return data;
|
|
40
|
+
const { data } = yield this.workos.post('/organizations', (0, serializers_2.serializeCreateOrganizationOptions)(payload), requestOptions);
|
|
41
|
+
return (0, serializers_2.deserializeOrganization)(data);
|
|
40
42
|
});
|
|
41
43
|
}
|
|
42
44
|
deleteOrganization(id) {
|
|
@@ -47,14 +49,14 @@ class Organizations {
|
|
|
47
49
|
getOrganization(id) {
|
|
48
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
51
|
const { data } = yield this.workos.get(`/organizations/${id}`);
|
|
50
|
-
return data;
|
|
52
|
+
return (0, serializers_2.deserializeOrganization)(data);
|
|
51
53
|
});
|
|
52
54
|
}
|
|
53
55
|
updateOrganization(options) {
|
|
54
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
57
|
const { organization: organizationId } = options, payload = __rest(options, ["organization"]);
|
|
56
|
-
const { data } = yield this.workos.put(`/organizations/${organizationId}`, payload);
|
|
57
|
-
return data;
|
|
58
|
+
const { data } = yield this.workos.put(`/organizations/${organizationId}`, (0, serializers_2.serializeUpdateOrganizationOptions)(payload));
|
|
59
|
+
return (0, serializers_2.deserializeOrganization)(data);
|
|
58
60
|
});
|
|
59
61
|
}
|
|
60
62
|
}
|
|
@@ -28,7 +28,7 @@ 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,
|
|
31
|
+
const { data, listMetadata } = yield workos.organizations.listOrganizations();
|
|
32
32
|
expect(mock.history.get[0].params).toBeUndefined();
|
|
33
33
|
expect(mock.history.get[0].url).toEqual('/organizations');
|
|
34
34
|
expect(data).toHaveLength(7);
|
|
@@ -110,6 +110,7 @@ describe('Organizations', () => {
|
|
|
110
110
|
describe('createOrganization', () => {
|
|
111
111
|
describe('with an idempotency key', () => {
|
|
112
112
|
it('includes an idempotency key with request', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
113
|
+
var _a;
|
|
113
114
|
mock
|
|
114
115
|
.onPost('/organizations', {
|
|
115
116
|
domains: ['example.com'],
|
|
@@ -122,7 +123,7 @@ describe('Organizations', () => {
|
|
|
122
123
|
}, {
|
|
123
124
|
idempotencyKey: 'the-idempotency-key',
|
|
124
125
|
});
|
|
125
|
-
expect(mock.history.post[0].headers['Idempotency-Key']).toEqual('the-idempotency-key');
|
|
126
|
+
expect((_a = mock.history.post[0].headers) === null || _a === void 0 ? void 0 : _a['Idempotency-Key']).toEqual('the-idempotency-key');
|
|
126
127
|
}));
|
|
127
128
|
});
|
|
128
129
|
describe('with a valid payload', () => {
|
|
@@ -170,7 +171,7 @@ describe('Organizations', () => {
|
|
|
170
171
|
expect(mock.history.get[0].url).toEqual('/organizations/org_01EHT88Z8J8795GZNQ4ZP1J81T');
|
|
171
172
|
expect(subject.id).toEqual('org_01EHT88Z8J8795GZNQ4ZP1J81T');
|
|
172
173
|
expect(subject.name).toEqual('Test Organization 3');
|
|
173
|
-
expect(subject.
|
|
174
|
+
expect(subject.allowProfilesOutsideOrganization).toEqual(false);
|
|
174
175
|
expect(subject.domains).toHaveLength(1);
|
|
175
176
|
}));
|
|
176
177
|
});
|
|
@@ -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 = {}));
|
|
@@ -5,12 +5,31 @@ export interface ConnectionDomain {
|
|
|
5
5
|
domain: string;
|
|
6
6
|
}
|
|
7
7
|
export interface Connection {
|
|
8
|
+
object: 'connection';
|
|
9
|
+
id: string;
|
|
10
|
+
organizationId?: string;
|
|
11
|
+
name: string;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated The connectionType parameter has been deprecated. Please use type.
|
|
14
|
+
*/
|
|
15
|
+
connectionType: ConnectionType;
|
|
16
|
+
state: 'draft' | 'active' | 'inactive' | 'validating';
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated The status parameter has been deprecated. Please use state.
|
|
19
|
+
*/
|
|
20
|
+
status: 'linked' | 'unlinked';
|
|
21
|
+
domains: ConnectionDomain[];
|
|
22
|
+
type: ConnectionType;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ConnectionResponse {
|
|
8
27
|
object: 'connection';
|
|
9
28
|
id: string;
|
|
10
29
|
organization_id?: string;
|
|
11
30
|
name: string;
|
|
12
31
|
connection_type: ConnectionType;
|
|
13
|
-
state: 'draft' | 'active' | 'inactive';
|
|
32
|
+
state: 'draft' | 'active' | 'inactive' | 'validating';
|
|
14
33
|
/**
|
|
15
34
|
* @deprecated The status parameter has been deprecated. Please use state.
|
|
16
35
|
*/
|
|
@@ -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,17 @@
|
|
|
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
|
+
status: connection.status,
|
|
13
|
+
domains: connection.domains,
|
|
14
|
+
createdAt: connection.created_at,
|
|
15
|
+
updatedAt: connection.updated_at,
|
|
16
|
+
});
|
|
17
|
+
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;
|