@workos-inc/node 3.0.0-user-management.1 → 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 -88
- 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/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 +4 -0
- package/lib/common/interfaces/index.js +4 -0
- package/lib/common/interfaces/list.interface.d.ts +9 -1
- 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 +9 -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/sso/interfaces/connection.interface.d.ts +15 -4
- 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 +11 -11
- package/lib/sso/sso.spec.js +23 -6
- 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-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 +4 -4
- 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 -74
- /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 → directory-group.interface.js} +0 -0
- /package/lib/directory-sync/interfaces/{user.interface.js → directory-user.interface.js} +0 -0
- /package/lib/{webhooks/interfaces/webhook-directory-group.interface.js → directory-sync/interfaces/list-directory-users-options.interface.js} +0 -0
- /package/lib/{webhooks/interfaces/webhook-directory-user.interface.js → users/interfaces/authenticate-user-with-magic-auth-options.interface.js} +0 -0
- /package/lib/{webhooks/interfaces/webhook-directory.interface.js → users/interfaces/magic-auth-challenge.interface.js} +0 -0
- /package/lib/{webhooks/interfaces/webhook.interface.js → users/interfaces/revoke-all-sessions-for-user-options.interface.js} +0 -0
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.AuditLogs = void 0;
|
|
13
|
+
const serializers_1 = require("./serializers");
|
|
13
14
|
class AuditLogs {
|
|
14
15
|
constructor(workos) {
|
|
15
16
|
this.workos = workos;
|
|
@@ -17,21 +18,21 @@ class AuditLogs {
|
|
|
17
18
|
createEvent(organization, event, options = {}) {
|
|
18
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
20
|
yield this.workos.post('/audit_logs/events', {
|
|
20
|
-
event,
|
|
21
|
+
event: (0, serializers_1.serializeCreateAuditLogEventOptions)(event),
|
|
21
22
|
organization_id: organization,
|
|
22
23
|
}, options);
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
26
|
createExport(options) {
|
|
26
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
const { data } = yield this.workos.post('/audit_logs/exports', options);
|
|
28
|
-
return data;
|
|
28
|
+
const { data } = yield this.workos.post('/audit_logs/exports', (0, serializers_1.serializeAuditLogExportOptions)(options));
|
|
29
|
+
return (0, serializers_1.deserializeAuditLogExport)(data);
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
32
|
getExport(auditLogExportId) {
|
|
32
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
34
|
const { data } = yield this.workos.get(`/audit_logs/exports/${auditLogExportId}`);
|
|
34
|
-
return data;
|
|
35
|
+
return (0, serializers_1.deserializeAuditLogExport)(data);
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
38
|
}
|
|
@@ -8,30 +8,16 @@ 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 __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
-
var t = {};
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
-
t[p] = s[p];
|
|
15
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
-
t[p[i]] = s[p[i]];
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
-
};
|
|
25
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const axios_1 =
|
|
27
|
-
const axios_mock_adapter_1 = __importDefault(require("axios-mock-adapter"));
|
|
12
|
+
const axios_1 = require("axios");
|
|
28
13
|
const exceptions_1 = require("../common/exceptions");
|
|
29
14
|
const bad_request_exception_1 = require("../common/exceptions/bad-request.exception");
|
|
15
|
+
const workos_mock_response_1 = require("../common/utils/workos-mock-response");
|
|
30
16
|
const workos_1 = require("../workos");
|
|
31
|
-
const
|
|
17
|
+
const serializers_1 = require("./serializers");
|
|
32
18
|
const event = {
|
|
33
19
|
action: 'document.updated',
|
|
34
|
-
|
|
20
|
+
occurredAt: new Date(),
|
|
35
21
|
actor: {
|
|
36
22
|
id: 'user_1',
|
|
37
23
|
name: 'Jon Smith',
|
|
@@ -44,94 +30,91 @@ const event = {
|
|
|
44
30
|
},
|
|
45
31
|
],
|
|
46
32
|
context: {
|
|
47
|
-
location: '
|
|
48
|
-
|
|
33
|
+
location: '192.0.0.8',
|
|
34
|
+
userAgent: 'Firefox',
|
|
49
35
|
},
|
|
50
36
|
metadata: {
|
|
51
37
|
successful: true,
|
|
52
38
|
},
|
|
53
39
|
};
|
|
54
|
-
const serializeEventOptions = (options) => (Object.assign(Object.assign({}, options), { occurred_at: options.occurred_at.toISOString() }));
|
|
55
40
|
describe('AuditLogs', () => {
|
|
56
41
|
describe('createEvent', () => {
|
|
57
42
|
describe('with an idempotency key', () => {
|
|
58
43
|
it('includes an idempotency key with request', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
.onPost('/audit_logs/events', {
|
|
62
|
-
event: serializeEventOptions(event),
|
|
63
|
-
organization_id: 'org_123',
|
|
64
|
-
})
|
|
65
|
-
.replyOnce(201, { success: true });
|
|
44
|
+
const workosSpy = jest.spyOn(workos_1.WorkOS.prototype, 'post');
|
|
45
|
+
workosSpy.mockResolvedValueOnce((0, workos_mock_response_1.mockWorkOsResponse)(201, { success: true }));
|
|
66
46
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
67
47
|
yield expect(workos.auditLogs.createEvent('org_123', event, {
|
|
68
48
|
idempotencyKey: 'the-idempotency-key',
|
|
69
49
|
})).resolves.toBeUndefined();
|
|
70
|
-
expect(
|
|
50
|
+
expect(workosSpy).toHaveBeenCalledWith('/audit_logs/events', {
|
|
51
|
+
event: (0, serializers_1.serializeCreateAuditLogEventOptions)(event),
|
|
52
|
+
organization_id: 'org_123',
|
|
53
|
+
}, { idempotencyKey: 'the-idempotency-key' });
|
|
71
54
|
}));
|
|
72
55
|
});
|
|
73
56
|
describe('when the api responds with a 200', () => {
|
|
74
57
|
it('returns void', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
organization_id: 'org_123',
|
|
78
|
-
event: serializeEventOptions(event),
|
|
79
|
-
})
|
|
80
|
-
.replyOnce(201, { success: true });
|
|
58
|
+
const workosSpy = jest.spyOn(workos_1.WorkOS.prototype, 'post');
|
|
59
|
+
workosSpy.mockResolvedValueOnce((0, workos_mock_response_1.mockWorkOsResponse)(201, { success: true }));
|
|
81
60
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
82
61
|
yield expect(workos.auditLogs.createEvent('org_123', event)).resolves.toBeUndefined();
|
|
62
|
+
expect(workosSpy).toHaveBeenCalledWith('/audit_logs/events', {
|
|
63
|
+
event: (0, serializers_1.serializeCreateAuditLogEventOptions)(event),
|
|
64
|
+
organization_id: 'org_123',
|
|
65
|
+
}, {});
|
|
83
66
|
}));
|
|
84
67
|
});
|
|
85
68
|
describe('when the api responds with a 401', () => {
|
|
86
69
|
it('throws an UnauthorizedException', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
})
|
|
92
|
-
.replyOnce(401, {
|
|
93
|
-
message: 'Unauthorized',
|
|
94
|
-
}, { 'X-Request-ID': 'a-request-id' });
|
|
70
|
+
const workosSpy = jest.spyOn(workos_1.WorkOS.prototype, 'post');
|
|
71
|
+
workosSpy.mockImplementationOnce(() => {
|
|
72
|
+
throw new axios_1.AxiosError('Could not authorize the request. Maybe your API key is invalid?', '401');
|
|
73
|
+
});
|
|
95
74
|
const workos = new workos_1.WorkOS('invalid apikey');
|
|
96
|
-
yield expect(workos.auditLogs.createEvent('org_123', event)).rejects.
|
|
75
|
+
yield expect(workos.auditLogs.createEvent('org_123', event)).rejects.toThrowError(new exceptions_1.UnauthorizedException('a-request-id'));
|
|
97
76
|
}));
|
|
98
77
|
});
|
|
99
78
|
describe('when the api responds with a 400', () => {
|
|
100
79
|
it('throws an BadRequestException', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
80
|
+
const workosSpy = jest.spyOn(workos_1.WorkOS.prototype, 'post');
|
|
101
81
|
const errors = [
|
|
102
82
|
{
|
|
103
83
|
field: 'occurred_at',
|
|
104
84
|
code: 'occurred_at must be an ISO 8601 date string',
|
|
105
85
|
},
|
|
106
86
|
];
|
|
107
|
-
|
|
108
|
-
.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
errors,
|
|
116
|
-
}, { 'X-Request-ID': 'a-request-id' });
|
|
87
|
+
workosSpy.mockImplementationOnce(() => {
|
|
88
|
+
throw new bad_request_exception_1.BadRequestException({
|
|
89
|
+
code: '400',
|
|
90
|
+
errors,
|
|
91
|
+
message: 'Audit Log could not be processed due to missing or incorrect data.',
|
|
92
|
+
requestID: 'a-request-id',
|
|
93
|
+
});
|
|
94
|
+
});
|
|
117
95
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
118
96
|
yield expect(workos.auditLogs.createEvent('org_123', event)).rejects.toThrow(bad_request_exception_1.BadRequestException);
|
|
119
97
|
}));
|
|
120
98
|
});
|
|
121
99
|
});
|
|
122
100
|
describe('createExport', () => {
|
|
123
|
-
const serializeExportOptions = (_a) => {
|
|
124
|
-
var { range_end, range_start } = _a, options = __rest(_a, ["range_end", "range_start"]);
|
|
125
|
-
return (Object.assign({ range_start: range_start.toISOString(), range_end: range_end.toISOString() }, options));
|
|
126
|
-
};
|
|
127
101
|
describe('when the api responds with a 201', () => {
|
|
128
102
|
it('returns `audit_log_export`', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
103
|
+
const workosSpy = jest.spyOn(workos_1.WorkOS.prototype, 'post');
|
|
129
104
|
const options = {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
105
|
+
organizationId: 'org_123',
|
|
106
|
+
rangeStart: new Date(),
|
|
107
|
+
rangeEnd: new Date(),
|
|
133
108
|
};
|
|
134
109
|
const auditLogExport = {
|
|
110
|
+
object: 'audit_log_export',
|
|
111
|
+
id: 'audit_log_export_1234',
|
|
112
|
+
state: 'pending',
|
|
113
|
+
url: undefined,
|
|
114
|
+
createdAt: new Date().toISOString(),
|
|
115
|
+
updatedAt: new Date().toISOString(),
|
|
116
|
+
};
|
|
117
|
+
const auditLogExportResponse = {
|
|
135
118
|
object: 'audit_log_export',
|
|
136
119
|
id: 'audit_log_export_1234',
|
|
137
120
|
state: 'pending',
|
|
@@ -139,26 +122,34 @@ describe('AuditLogs', () => {
|
|
|
139
122
|
created_at: new Date().toISOString(),
|
|
140
123
|
updated_at: new Date().toISOString(),
|
|
141
124
|
};
|
|
142
|
-
|
|
143
|
-
.onPost('/audit_logs/exports', serializeExportOptions(options))
|
|
144
|
-
.replyOnce(201, auditLogExport);
|
|
125
|
+
workosSpy.mockResolvedValueOnce((0, workos_mock_response_1.mockWorkOsResponse)(201, auditLogExportResponse));
|
|
145
126
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
146
127
|
yield expect(workos.auditLogs.createExport(options)).resolves.toEqual(auditLogExport);
|
|
128
|
+
expect(workosSpy).toHaveBeenCalledWith('/audit_logs/exports', (0, serializers_1.serializeAuditLogExportOptions)(options));
|
|
147
129
|
}));
|
|
148
130
|
});
|
|
149
131
|
describe('when additional filters are defined', () => {
|
|
150
132
|
it('returns `audit_log_export`', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
133
|
+
const workosSpy = jest.spyOn(workos_1.WorkOS.prototype, 'post');
|
|
151
134
|
const options = {
|
|
152
135
|
actions: ['foo', 'bar'],
|
|
153
136
|
actors: ['Jon', 'Smith'],
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
137
|
+
actorNames: ['Jon', 'Smith'],
|
|
138
|
+
actorIds: ['user_foo', 'user_bar'],
|
|
139
|
+
organizationId: 'org_123',
|
|
140
|
+
rangeEnd: new Date(),
|
|
141
|
+
rangeStart: new Date(),
|
|
159
142
|
targets: ['user', 'team'],
|
|
160
143
|
};
|
|
161
144
|
const auditLogExport = {
|
|
145
|
+
object: 'audit_log_export',
|
|
146
|
+
id: 'audit_log_export_1234',
|
|
147
|
+
state: 'pending',
|
|
148
|
+
url: undefined,
|
|
149
|
+
createdAt: new Date().toISOString(),
|
|
150
|
+
updatedAt: new Date().toISOString(),
|
|
151
|
+
};
|
|
152
|
+
const auditLogExportResponse = {
|
|
162
153
|
object: 'audit_log_export',
|
|
163
154
|
id: 'audit_log_export_1234',
|
|
164
155
|
state: 'pending',
|
|
@@ -166,34 +157,41 @@ describe('AuditLogs', () => {
|
|
|
166
157
|
created_at: new Date().toISOString(),
|
|
167
158
|
updated_at: new Date().toISOString(),
|
|
168
159
|
};
|
|
169
|
-
|
|
170
|
-
.onPost('/audit_logs/exports', serializeExportOptions(options))
|
|
171
|
-
.replyOnce(201, auditLogExport);
|
|
160
|
+
workosSpy.mockResolvedValueOnce((0, workos_mock_response_1.mockWorkOsResponse)(201, auditLogExportResponse));
|
|
172
161
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
173
162
|
yield expect(workos.auditLogs.createExport(options)).resolves.toEqual(auditLogExport);
|
|
163
|
+
expect(workosSpy).toHaveBeenCalledWith('/audit_logs/exports', (0, serializers_1.serializeAuditLogExportOptions)(options));
|
|
174
164
|
}));
|
|
175
165
|
});
|
|
176
166
|
describe('when the api responds with a 401', () => {
|
|
177
167
|
it('throws an UnauthorizedException', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
168
|
+
const workosSpy = jest.spyOn(workos_1.WorkOS.prototype, 'post');
|
|
178
169
|
const options = {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
170
|
+
organizationId: 'org_123',
|
|
171
|
+
rangeStart: new Date(),
|
|
172
|
+
rangeEnd: new Date(),
|
|
182
173
|
};
|
|
183
|
-
|
|
184
|
-
.
|
|
185
|
-
|
|
186
|
-
message: 'Unauthorized',
|
|
187
|
-
}, { 'X-Request-ID': 'a-request-id' });
|
|
174
|
+
workosSpy.mockImplementationOnce(() => {
|
|
175
|
+
throw new axios_1.AxiosError('Could not authorize the request. Maybe your API key is invalid?', '401');
|
|
176
|
+
});
|
|
188
177
|
const workos = new workos_1.WorkOS('invalid apikey');
|
|
189
|
-
yield expect(workos.auditLogs.createExport(options)).rejects.
|
|
178
|
+
yield expect(workos.auditLogs.createExport(options)).rejects.toThrowError(new exceptions_1.UnauthorizedException('a-request-id'));
|
|
190
179
|
}));
|
|
191
180
|
});
|
|
192
181
|
});
|
|
193
182
|
describe('getExport', () => {
|
|
194
183
|
describe('when the api responds with a 201', () => {
|
|
195
184
|
it('returns `audit_log_export`', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
185
|
+
const workosSpy = jest.spyOn(workos_1.WorkOS.prototype, 'get');
|
|
196
186
|
const auditLogExport = {
|
|
187
|
+
object: 'audit_log_export',
|
|
188
|
+
id: 'audit_log_export_1234',
|
|
189
|
+
state: 'pending',
|
|
190
|
+
url: undefined,
|
|
191
|
+
createdAt: new Date().toISOString(),
|
|
192
|
+
updatedAt: new Date().toISOString(),
|
|
193
|
+
};
|
|
194
|
+
const auditLogExportResponse = {
|
|
197
195
|
object: 'audit_log_export',
|
|
198
196
|
id: 'audit_log_export_1234',
|
|
199
197
|
state: 'pending',
|
|
@@ -201,20 +199,21 @@ describe('AuditLogs', () => {
|
|
|
201
199
|
created_at: new Date().toISOString(),
|
|
202
200
|
updated_at: new Date().toISOString(),
|
|
203
201
|
};
|
|
204
|
-
|
|
205
|
-
.onGet(`/audit_logs/exports/${auditLogExport.id}`)
|
|
206
|
-
.replyOnce(200, auditLogExport);
|
|
202
|
+
workosSpy.mockResolvedValueOnce((0, workos_mock_response_1.mockWorkOsResponse)(201, auditLogExportResponse));
|
|
207
203
|
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
208
204
|
yield expect(workos.auditLogs.getExport(auditLogExport.id)).resolves.toEqual(auditLogExport);
|
|
205
|
+
expect(workosSpy).toHaveBeenCalledWith(`/audit_logs/exports/${auditLogExport.id}`);
|
|
209
206
|
}));
|
|
210
207
|
});
|
|
211
208
|
describe('when the api responds with a 401', () => {
|
|
212
209
|
it('throws an UnauthorizedException', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
210
|
+
const workosSpy = jest.spyOn(workos_1.WorkOS.prototype, 'get');
|
|
211
|
+
workosSpy.mockImplementationOnce(() => {
|
|
212
|
+
throw new axios_1.AxiosError('Could not authorize the request. Maybe your API key is invalid?', '401');
|
|
213
|
+
});
|
|
216
214
|
const workos = new workos_1.WorkOS('invalid apikey');
|
|
217
|
-
yield expect(workos.auditLogs.getExport('audit_log_export_1234')).rejects.
|
|
215
|
+
yield expect(workos.auditLogs.getExport('audit_log_export_1234')).rejects.toThrowError(new exceptions_1.UnauthorizedException('a-request-id'));
|
|
216
|
+
expect(workosSpy).toHaveBeenCalledWith(`/audit_logs/exports/audit_log_export_1234`);
|
|
218
217
|
}));
|
|
219
218
|
});
|
|
220
219
|
});
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
export interface AuditLogExportOptions {
|
|
2
2
|
actions?: string[];
|
|
3
3
|
/**
|
|
4
|
-
* @deprecated Please use `
|
|
4
|
+
* @deprecated Please use `actorNames` instead.
|
|
5
5
|
*/
|
|
6
6
|
actors?: string[];
|
|
7
|
+
actorNames?: string[];
|
|
8
|
+
actorIds?: string[];
|
|
9
|
+
organizationId: string;
|
|
10
|
+
rangeEnd: Date;
|
|
11
|
+
rangeStart: Date;
|
|
12
|
+
targets?: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface SerializedAuditLogExportOptions {
|
|
15
|
+
actions?: string[];
|
|
16
|
+
actors?: string[];
|
|
7
17
|
actor_names?: string[];
|
|
8
18
|
actor_ids?: string[];
|
|
9
19
|
organization_id: string;
|
|
10
|
-
range_end:
|
|
11
|
-
range_start:
|
|
20
|
+
range_end: string;
|
|
21
|
+
range_start: string;
|
|
12
22
|
targets?: string[];
|
|
13
23
|
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
export interface AuditLogExport {
|
|
2
|
+
object: 'audit_log_export';
|
|
3
|
+
id: string;
|
|
4
|
+
state: 'pending' | 'ready' | 'error';
|
|
5
|
+
url?: string;
|
|
6
|
+
createdAt: string;
|
|
7
|
+
updatedAt: string;
|
|
8
|
+
}
|
|
9
|
+
export interface AuditLogExportResponse {
|
|
2
10
|
object: 'audit_log_export';
|
|
3
11
|
id: string;
|
|
4
12
|
state: 'pending' | 'ready' | 'error';
|
|
@@ -14,7 +14,19 @@ export interface AuditLogTarget {
|
|
|
14
14
|
export interface CreateAuditLogEventOptions {
|
|
15
15
|
action: string;
|
|
16
16
|
version?: number;
|
|
17
|
-
|
|
17
|
+
occurredAt: Date;
|
|
18
|
+
actor: AuditLogActor;
|
|
19
|
+
targets: AuditLogTarget[];
|
|
20
|
+
context: {
|
|
21
|
+
location: string;
|
|
22
|
+
userAgent?: string;
|
|
23
|
+
};
|
|
24
|
+
metadata?: Record<string, string | number | boolean>;
|
|
25
|
+
}
|
|
26
|
+
export interface SerializedCreateAuditLogEventOptions {
|
|
27
|
+
action: string;
|
|
28
|
+
version?: number;
|
|
29
|
+
occurred_at: string;
|
|
18
30
|
actor: AuditLogActor;
|
|
19
31
|
targets: AuditLogTarget[];
|
|
20
32
|
context: {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeAuditLogExportOptions = void 0;
|
|
4
|
+
const serializeAuditLogExportOptions = (options) => ({
|
|
5
|
+
actions: options.actions,
|
|
6
|
+
actors: options.actors,
|
|
7
|
+
actor_names: options.actorNames,
|
|
8
|
+
actor_ids: options.actorIds,
|
|
9
|
+
organization_id: options.organizationId,
|
|
10
|
+
range_end: options.rangeEnd.toISOString(),
|
|
11
|
+
range_start: options.rangeStart.toISOString(),
|
|
12
|
+
targets: options.targets,
|
|
13
|
+
});
|
|
14
|
+
exports.serializeAuditLogExportOptions = serializeAuditLogExportOptions;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeAuditLogExport = void 0;
|
|
4
|
+
const deserializeAuditLogExport = (auditLogExport) => ({
|
|
5
|
+
object: auditLogExport.object,
|
|
6
|
+
id: auditLogExport.id,
|
|
7
|
+
state: auditLogExport.state,
|
|
8
|
+
url: auditLogExport.url,
|
|
9
|
+
createdAt: auditLogExport.created_at,
|
|
10
|
+
updatedAt: auditLogExport.updated_at,
|
|
11
|
+
});
|
|
12
|
+
exports.deserializeAuditLogExport = deserializeAuditLogExport;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeCreateAuditLogEventOptions = void 0;
|
|
4
|
+
const serializeCreateAuditLogEventOptions = (event) => ({
|
|
5
|
+
action: event.action,
|
|
6
|
+
version: event.version,
|
|
7
|
+
occurred_at: event.occurredAt.toISOString(),
|
|
8
|
+
actor: event.actor,
|
|
9
|
+
targets: event.targets,
|
|
10
|
+
context: {
|
|
11
|
+
location: event.context.location,
|
|
12
|
+
user_agent: event.context.userAgent,
|
|
13
|
+
},
|
|
14
|
+
metadata: event.metadata,
|
|
15
|
+
});
|
|
16
|
+
exports.serializeCreateAuditLogEventOptions = serializeCreateAuditLogEventOptions;
|
|
@@ -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("./audit-log-export.serializer"), exports);
|
|
18
|
+
__exportStar(require("./audit-log-export-options.serializer"), exports);
|
|
19
|
+
__exportStar(require("./create-audit-log-event-options.serializer"), exports);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { CreateEventOptions } from './interfaces/create-event-options.interface';
|
|
2
2
|
import { AuditTrailEvent } from './interfaces/event.interface';
|
|
3
3
|
import { EventOptions } from './interfaces/event-options.interface';
|
|
4
|
-
import {
|
|
4
|
+
import { ListResponse } from '../common/interfaces';
|
|
5
5
|
import { ListEventsOptions } from './interfaces/list-events-options.interface';
|
|
6
6
|
import { WorkOS } from '../workos';
|
|
7
7
|
export declare class AuditTrail {
|
|
8
8
|
private readonly workos;
|
|
9
9
|
constructor(workos: WorkOS);
|
|
10
10
|
createEvent(event: EventOptions, { idempotencyKey }?: CreateEventOptions): Promise<void>;
|
|
11
|
-
listEvents(options?: ListEventsOptions): Promise<
|
|
11
|
+
listEvents(options?: ListEventsOptions): Promise<ListResponse<AuditTrailEvent>>;
|
|
12
12
|
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { DirectoryUser, DirectoryUserResponse, EventDirectory, EventDirectoryGroup, EventDirectoryGroupResponse, EventDirectoryResponse } from '../../directory-sync/interfaces';
|
|
2
|
+
import { Connection, ConnectionResponse } from '../../sso/interfaces';
|
|
3
|
+
export interface EventBase {
|
|
4
|
+
id: string;
|
|
5
|
+
createdAt: string;
|
|
6
|
+
}
|
|
7
|
+
interface EventResponseBase {
|
|
8
|
+
id: string;
|
|
9
|
+
created_at: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ConnectionActivatedEvent extends EventBase {
|
|
12
|
+
event: 'connection.activated';
|
|
13
|
+
data: Connection;
|
|
14
|
+
}
|
|
15
|
+
export interface ConnectionActivatedEventResponse extends EventResponseBase {
|
|
16
|
+
event: 'connection.activated';
|
|
17
|
+
data: ConnectionResponse;
|
|
18
|
+
}
|
|
19
|
+
export interface ConnectionDeactivatedEvent extends EventBase {
|
|
20
|
+
event: 'connection.deactivated';
|
|
21
|
+
data: Connection;
|
|
22
|
+
}
|
|
23
|
+
export interface ConnectionDeactivatedEventResponse extends EventResponseBase {
|
|
24
|
+
event: 'connection.deactivated';
|
|
25
|
+
data: ConnectionResponse;
|
|
26
|
+
}
|
|
27
|
+
export interface ConnectionDeletedEvent extends EventBase {
|
|
28
|
+
event: 'connection.deleted';
|
|
29
|
+
data: Connection;
|
|
30
|
+
}
|
|
31
|
+
export interface ConnectionDeletedEventResponse extends EventResponseBase {
|
|
32
|
+
event: 'connection.deleted';
|
|
33
|
+
data: ConnectionResponse;
|
|
34
|
+
}
|
|
35
|
+
export interface DsyncActivatedEvent extends EventBase {
|
|
36
|
+
event: 'dsync.activated';
|
|
37
|
+
data: EventDirectory;
|
|
38
|
+
}
|
|
39
|
+
export interface DsyncActivatedEventResponse extends EventResponseBase {
|
|
40
|
+
event: 'dsync.activated';
|
|
41
|
+
data: EventDirectoryResponse;
|
|
42
|
+
}
|
|
43
|
+
export interface DsyncDeactivatedEvent extends EventBase {
|
|
44
|
+
event: 'dsync.deactivated';
|
|
45
|
+
data: EventDirectory;
|
|
46
|
+
}
|
|
47
|
+
export interface DsyncDeactivatedEventResponse extends EventResponseBase {
|
|
48
|
+
event: 'dsync.deactivated';
|
|
49
|
+
data: EventDirectoryResponse;
|
|
50
|
+
}
|
|
51
|
+
export interface DsyncDeletedEvent extends EventBase {
|
|
52
|
+
event: 'dsync.deleted';
|
|
53
|
+
data: Omit<EventDirectory, 'domains' | 'externalKey'>;
|
|
54
|
+
}
|
|
55
|
+
export interface DsyncDeletedEventResponse extends EventResponseBase {
|
|
56
|
+
event: 'dsync.deleted';
|
|
57
|
+
data: Omit<EventDirectoryResponse, 'domains' | 'external_key'>;
|
|
58
|
+
}
|
|
59
|
+
export interface DsyncGroupCreatedEvent extends EventBase {
|
|
60
|
+
event: 'dsync.group.created';
|
|
61
|
+
data: EventDirectoryGroup;
|
|
62
|
+
}
|
|
63
|
+
export interface DsyncGroupCreatedEventResponse extends EventResponseBase {
|
|
64
|
+
event: 'dsync.group.created';
|
|
65
|
+
data: EventDirectoryGroupResponse;
|
|
66
|
+
}
|
|
67
|
+
export interface DsyncGroupDeletedEvent extends EventBase {
|
|
68
|
+
event: 'dsync.group.deleted';
|
|
69
|
+
data: EventDirectoryGroup;
|
|
70
|
+
}
|
|
71
|
+
export interface DsyncGroupDeletedEventResponse extends EventResponseBase {
|
|
72
|
+
event: 'dsync.group.deleted';
|
|
73
|
+
data: EventDirectoryGroupResponse;
|
|
74
|
+
}
|
|
75
|
+
export interface DsyncGroupUpdatedEvent extends EventBase {
|
|
76
|
+
event: 'dsync.group.updated';
|
|
77
|
+
data: EventDirectoryGroup & Record<'previousAttributes', any>;
|
|
78
|
+
}
|
|
79
|
+
export interface DsyncGroupUpdatedEventResponse extends EventResponseBase {
|
|
80
|
+
event: 'dsync.group.updated';
|
|
81
|
+
data: EventDirectoryGroupResponse & Record<'previous_attributes', any>;
|
|
82
|
+
}
|
|
83
|
+
export interface DsyncGroupUserAddedEvent extends EventBase {
|
|
84
|
+
event: 'dsync.group.user_added';
|
|
85
|
+
data: {
|
|
86
|
+
directoryId: string;
|
|
87
|
+
user: DirectoryUser;
|
|
88
|
+
group: Pick<EventDirectoryGroup, 'id' | 'name'>;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export interface DsyncGroupUserAddedEventResponse extends EventResponseBase {
|
|
92
|
+
event: 'dsync.group.user_added';
|
|
93
|
+
data: {
|
|
94
|
+
directory_id: string;
|
|
95
|
+
user: DirectoryUserResponse;
|
|
96
|
+
group: Pick<EventDirectoryGroupResponse, 'id' | 'name'>;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export interface DsyncGroupUserRemovedEvent extends EventBase {
|
|
100
|
+
event: 'dsync.group.user_removed';
|
|
101
|
+
data: {
|
|
102
|
+
directoryId: string;
|
|
103
|
+
user: DirectoryUser;
|
|
104
|
+
group: Pick<EventDirectoryGroup, 'id' | 'name'>;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export interface DsyncGroupUserRemovedEventResponse extends EventResponseBase {
|
|
108
|
+
event: 'dsync.group.user_removed';
|
|
109
|
+
data: {
|
|
110
|
+
directory_id: string;
|
|
111
|
+
user: DirectoryUserResponse;
|
|
112
|
+
group: Pick<EventDirectoryGroupResponse, 'id' | 'name'>;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
export interface DsyncUserCreatedEvent extends EventBase {
|
|
116
|
+
event: 'dsync.user.created';
|
|
117
|
+
data: DirectoryUser;
|
|
118
|
+
}
|
|
119
|
+
export interface DsyncUserCreatedEventResponse extends EventResponseBase {
|
|
120
|
+
event: 'dsync.user.created';
|
|
121
|
+
data: DirectoryUserResponse;
|
|
122
|
+
}
|
|
123
|
+
export interface DsyncUserDeletedEvent extends EventBase {
|
|
124
|
+
event: 'dsync.user.deleted';
|
|
125
|
+
data: DirectoryUser;
|
|
126
|
+
}
|
|
127
|
+
export interface DsyncUserDeletedEventResponse extends EventResponseBase {
|
|
128
|
+
event: 'dsync.user.deleted';
|
|
129
|
+
data: DirectoryUserResponse;
|
|
130
|
+
}
|
|
131
|
+
export interface DsyncUserUpdatedEvent extends EventBase {
|
|
132
|
+
event: 'dsync.user.updated';
|
|
133
|
+
data: DirectoryUser & Record<'previousAttributes', any>;
|
|
134
|
+
}
|
|
135
|
+
export interface DsyncUserUpdatedEventResponse extends EventResponseBase {
|
|
136
|
+
event: 'dsync.user.updated';
|
|
137
|
+
data: DirectoryUserResponse & Record<'previous_attributes', any>;
|
|
138
|
+
}
|
|
139
|
+
export type Event = ConnectionActivatedEvent | ConnectionDeactivatedEvent | ConnectionDeletedEvent | DsyncActivatedEvent | DsyncDeactivatedEvent | DsyncDeletedEvent | DsyncGroupCreatedEvent | DsyncGroupUpdatedEvent | DsyncGroupDeletedEvent | DsyncGroupUserAddedEvent | DsyncGroupUserRemovedEvent | DsyncUserCreatedEvent | DsyncUserUpdatedEvent | DsyncUserDeletedEvent;
|
|
140
|
+
export type EventResponse = ConnectionActivatedEventResponse | ConnectionDeactivatedEventResponse | ConnectionDeletedEventResponse | DsyncActivatedEventResponse | DsyncDeactivatedEventResponse | DsyncDeletedEventResponse | DsyncGroupCreatedEventResponse | DsyncGroupUpdatedEventResponse | DsyncGroupDeletedEventResponse | DsyncGroupUserAddedEventResponse | DsyncGroupUserRemovedEventResponse | DsyncUserCreatedEventResponse | DsyncUserUpdatedEventResponse | DsyncUserDeletedEventResponse;
|
|
141
|
+
export type EventName = 'connection.activated' | 'connection.deactivated' | 'connection.deleted' | 'dsync.activated' | 'dsync.deactivated' | 'dsync.deleted' | 'dsync.group.created' | 'dsync.group.deleted' | 'dsync.group.updated' | 'dsync.group.user_added' | 'dsync.group.user_removed' | 'dsync.user.created' | 'dsync.user.deleted' | 'dsync.user.updated';
|
|
142
|
+
export {};
|