@workos-inc/node 4.0.0 → 4.0.1

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.
@@ -1,5 +1,5 @@
1
1
  import { Sms, SmsResponse } from './sms.interface';
2
- import { Totp, TotpResponse, TotpWithSecrets, TotpWithSecretsResponse } from './totp.interface';
2
+ import { Totp, TotpResponse } from './totp.interface';
3
3
  type FactorType = 'sms' | 'totp' | 'generic_otp';
4
4
  export interface Factor {
5
5
  object: 'authentication_factor';
@@ -9,15 +9,7 @@ export interface Factor {
9
9
  type: FactorType;
10
10
  sms?: Sms;
11
11
  totp?: Totp;
12
- }
13
- export interface FactorWithSecrets {
14
- object: 'authentication_factor';
15
- id: string;
16
- createdAt: string;
17
- updatedAt: string;
18
- type: FactorType;
19
- sms?: Sms;
20
- totp?: TotpWithSecrets;
12
+ userId?: string;
21
13
  }
22
14
  export interface FactorResponse {
23
15
  object: 'authentication_factor';
@@ -27,14 +19,6 @@ export interface FactorResponse {
27
19
  type: FactorType;
28
20
  sms?: SmsResponse;
29
21
  totp?: TotpResponse;
30
- }
31
- export interface FactorWithSecretsResponse {
32
- object: 'authentication_factor';
33
- id: string;
34
- created_at: string;
35
- updated_at: string;
36
- type: FactorType;
37
- sms?: SmsResponse;
38
- totp?: TotpWithSecretsResponse;
22
+ user_id?: string;
39
23
  }
40
24
  export {};
@@ -1,18 +1,19 @@
1
- export interface Totp {
1
+ interface TotpObject {
2
2
  issuer: string;
3
3
  user: string;
4
- }
5
- export interface TotpWithSecrets extends Totp {
6
4
  qrCode: string;
7
5
  secret: string;
8
6
  uri: string;
9
7
  }
10
- export interface TotpResponse {
8
+ type TotpObjectWithOnlyIssuerAndUser = Pick<TotpObject, 'issuer' | 'user'>;
9
+ export type Totp = TotpObject | TotpObjectWithOnlyIssuerAndUser;
10
+ interface TotpResponseObject {
11
11
  issuer: string;
12
12
  user: string;
13
- }
14
- export interface TotpWithSecretsResponse extends TotpResponse {
15
13
  qr_code: string;
16
14
  secret: string;
17
15
  uri: string;
18
16
  }
17
+ type TotpResponseObjectWithOnlyIssuerAndUser = Pick<TotpResponseObject, 'issuer' | 'user'>;
18
+ export type TotpResponse = TotpResponseObject | TotpResponseObjectWithOnlyIssuerAndUser;
19
+ export {};
package/lib/mfa/mfa.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { WorkOS } from '../workos';
2
- import { ChallengeFactorOptions, Challenge, EnrollFactorOptions, Factor, VerifyChallengeOptions, VerifyFactorOptions, VerifyResponse, FactorWithSecrets } from './interfaces';
2
+ import { ChallengeFactorOptions, Challenge, EnrollFactorOptions, Factor, VerifyChallengeOptions, VerifyFactorOptions, VerifyResponse } from './interfaces';
3
3
  export declare class Mfa {
4
4
  private readonly workos;
5
5
  constructor(workos: WorkOS);
6
6
  deleteFactor(id: string): Promise<void>;
7
7
  getFactor(id: string): Promise<Factor>;
8
- enrollFactor(options: EnrollFactorOptions): Promise<FactorWithSecrets>;
8
+ enrollFactor(options: EnrollFactorOptions): Promise<Factor>;
9
9
  challengeFactor(options: ChallengeFactorOptions): Promise<Challenge>;
10
10
  /**
11
11
  * @deprecated Please use `verifyChallenge` instead.
package/lib/mfa/mfa.js CHANGED
@@ -43,7 +43,7 @@ class Mfa {
43
43
  return {};
44
44
  }
45
45
  })()));
46
- return (0, serializers_1.deserializeFactorWithSecrets)(data);
46
+ return (0, serializers_1.deserializeFactor)(data);
47
47
  });
48
48
  }
49
49
  challengeFactor(options) {
@@ -28,6 +28,9 @@ describe('MFA', () => {
28
28
  type: 'totp',
29
29
  totp: {
30
30
  issuer: 'WorkOS',
31
+ qrCode: 'qr-code-test',
32
+ secret: 'secret-test',
33
+ uri: 'uri-test',
31
34
  user: 'some_user',
32
35
  },
33
36
  };
@@ -39,6 +42,9 @@ describe('MFA', () => {
39
42
  type: 'totp',
40
43
  totp: {
41
44
  issuer: 'WorkOS',
45
+ qr_code: 'qr-code-test',
46
+ secret: 'secret-test',
47
+ uri: 'uri-test',
42
48
  user: 'some_user',
43
49
  },
44
50
  };
@@ -1,3 +1,2 @@
1
- import { Factor, FactorResponse, FactorWithSecrets, FactorWithSecretsResponse } from '../interfaces';
1
+ import { Factor, FactorResponse } from '../interfaces';
2
2
  export declare const deserializeFactor: (factor: FactorResponse) => Factor;
3
- export declare const deserializeFactorWithSecrets: (factor: FactorWithSecretsResponse) => FactorWithSecrets;
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deserializeFactorWithSecrets = exports.deserializeFactor = void 0;
3
+ exports.deserializeFactor = void 0;
4
4
  const sms_serializer_1 = require("./sms.serializer");
5
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) } : {})));
6
+ const deserializeFactor = (factor) => (Object.assign(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) } : {})), { userId: factor.user_id }));
7
7
  exports.deserializeFactor = deserializeFactor;
8
- const deserializeFactorWithSecrets = (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.deserializeTotpWithSecrets)(factor.totp) } : {})));
9
- exports.deserializeFactorWithSecrets = deserializeFactorWithSecrets;
@@ -1,3 +1,2 @@
1
- import { Totp, TotpResponse, TotpWithSecretsResponse, TotpWithSecrets } from '../interfaces';
1
+ import { Totp, TotpResponse } from '../interfaces';
2
2
  export declare const deserializeTotp: (totp: TotpResponse) => Totp;
3
- export declare const deserializeTotpWithSecrets: (totp: TotpWithSecretsResponse) => TotpWithSecrets;
@@ -1,20 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deserializeTotpWithSecrets = exports.deserializeTotp = void 0;
3
+ exports.deserializeTotp = void 0;
4
4
  const deserializeTotp = (totp) => {
5
- return {
6
- issuer: totp.issuer,
7
- user: totp.user,
8
- };
5
+ if ('qr_code' in totp && 'secret' in totp && 'uri' in totp) {
6
+ return {
7
+ issuer: totp.issuer,
8
+ user: totp.user,
9
+ qrCode: totp.qr_code,
10
+ secret: totp.secret,
11
+ uri: totp.uri,
12
+ };
13
+ }
14
+ else {
15
+ return {
16
+ issuer: totp.issuer,
17
+ user: totp.user,
18
+ };
19
+ }
9
20
  };
10
21
  exports.deserializeTotp = deserializeTotp;
11
- const deserializeTotpWithSecrets = (totp) => {
12
- return {
13
- issuer: totp.issuer,
14
- user: totp.user,
15
- qrCode: totp.qr_code,
16
- secret: totp.secret,
17
- uri: totp.uri,
18
- };
19
- };
20
- exports.deserializeTotpWithSecrets = deserializeTotpWithSecrets;
@@ -9,6 +9,6 @@ export interface AuthorizationURLOptions {
9
9
  domainHint?: string;
10
10
  loginHint?: string;
11
11
  provider?: string;
12
- redirectUri: string;
12
+ redirectURI: string;
13
13
  state?: string;
14
14
  }
package/lib/sso/sso.d.ts CHANGED
@@ -6,7 +6,7 @@ export declare class SSO {
6
6
  constructor(workos: WorkOS);
7
7
  listConnections(options?: ListConnectionsOptions): Promise<AutoPaginatable<Connection>>;
8
8
  deleteConnection(id: string): Promise<void>;
9
- getAuthorizationUrl({ connection, clientId, domain, domainHint, loginHint, organization, provider, redirectUri, state, }: AuthorizationURLOptions): string;
9
+ getAuthorizationUrl({ connection, clientId, domain, domainHint, loginHint, organization, provider, redirectURI, state, }: AuthorizationURLOptions): string;
10
10
  getConnection(id: string): Promise<Connection>;
11
11
  getProfileAndToken({ code, clientId, }: GetProfileAndTokenOptions): Promise<ProfileAndToken>;
12
12
  getProfile({ accessToken }: GetProfileOptions): Promise<Profile>;
package/lib/sso/sso.js CHANGED
@@ -38,7 +38,7 @@ class SSO {
38
38
  yield this.workos.delete(`/connections/${id}`);
39
39
  });
40
40
  }
41
- getAuthorizationUrl({ connection, clientId, domain, domainHint, loginHint, organization, provider, redirectUri, state, }) {
41
+ getAuthorizationUrl({ connection, clientId, domain, domainHint, loginHint, organization, provider, redirectURI, state, }) {
42
42
  if (!domain && !provider && !connection && !organization) {
43
43
  throw new Error(`Incomplete arguments. Need to specify either a 'connection', 'organization', 'domain', or 'provider'.`);
44
44
  }
@@ -53,7 +53,7 @@ class SSO {
53
53
  login_hint: loginHint,
54
54
  provider,
55
55
  client_id: clientId,
56
- redirect_uri: redirectUri,
56
+ redirect_uri: redirectURI,
57
57
  response_type: 'code',
58
58
  state,
59
59
  });
@@ -36,7 +36,7 @@ describe('SSO', () => {
36
36
  const url = workos.sso.getAuthorizationUrl({
37
37
  domain: 'lyft.com',
38
38
  clientId: 'proj_123',
39
- redirectUri: 'example.com/sso/workos/callback',
39
+ redirectURI: 'example.com/sso/workos/callback',
40
40
  });
41
41
  expect(url).toMatchSnapshot();
42
42
  });
@@ -46,7 +46,7 @@ describe('SSO', () => {
46
46
  const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
47
47
  const urlFn = () => workos.sso.getAuthorizationUrl({
48
48
  clientId: 'proj_123',
49
- redirectUri: 'example.com/sso/workos/callback',
49
+ redirectURI: 'example.com/sso/workos/callback',
50
50
  });
51
51
  expect(urlFn).toThrowErrorMatchingSnapshot();
52
52
  });
@@ -59,7 +59,7 @@ describe('SSO', () => {
59
59
  const url = workos.sso.getAuthorizationUrl({
60
60
  provider: 'Google',
61
61
  clientId: 'proj_123',
62
- redirectUri: 'example.com/sso/workos/callback',
62
+ redirectURI: 'example.com/sso/workos/callback',
63
63
  });
64
64
  expect(url).toMatchSnapshot();
65
65
  });
@@ -72,7 +72,7 @@ describe('SSO', () => {
72
72
  const url = workos.sso.getAuthorizationUrl({
73
73
  connection: 'connection_123',
74
74
  clientId: 'proj_123',
75
- redirectUri: 'example.com/sso/workos/callback',
75
+ redirectURI: 'example.com/sso/workos/callback',
76
76
  });
77
77
  expect(url).toMatchSnapshot();
78
78
  });
@@ -85,7 +85,7 @@ describe('SSO', () => {
85
85
  const url = workos.sso.getAuthorizationUrl({
86
86
  organization: 'organization_123',
87
87
  clientId: 'proj_123',
88
- redirectUri: 'example.com/sso/workos/callback',
88
+ redirectURI: 'example.com/sso/workos/callback',
89
89
  });
90
90
  expect(url).toMatchSnapshot();
91
91
  });
@@ -98,7 +98,7 @@ describe('SSO', () => {
98
98
  const url = workos.sso.getAuthorizationUrl({
99
99
  domain: 'lyft.com',
100
100
  clientId: 'proj_123',
101
- redirectUri: 'example.com/sso/workos/callback',
101
+ redirectURI: 'example.com/sso/workos/callback',
102
102
  });
103
103
  expect(url).toMatchSnapshot();
104
104
  });
@@ -109,7 +109,7 @@ describe('SSO', () => {
109
109
  const url = workos.sso.getAuthorizationUrl({
110
110
  domain: 'lyft.com',
111
111
  clientId: 'proj_123',
112
- redirectUri: 'example.com/sso/workos/callback',
112
+ redirectURI: 'example.com/sso/workos/callback',
113
113
  state: 'custom state',
114
114
  });
115
115
  expect(url).toMatchSnapshot();
@@ -122,7 +122,7 @@ describe('SSO', () => {
122
122
  domainHint: 'lyft.com',
123
123
  connection: 'connection_123',
124
124
  clientId: 'proj_123',
125
- redirectUri: 'example.com/sso/workos/callback',
125
+ redirectURI: 'example.com/sso/workos/callback',
126
126
  state: 'custom state',
127
127
  });
128
128
  expect(url).toMatchInlineSnapshot(`"https://api.workos.com/sso/authorize?client_id=proj_123&connection=connection_123&domain_hint=lyft.com&redirect_uri=example.com%2Fsso%2Fworkos%2Fcallback&response_type=code&state=custom+state"`);
@@ -135,7 +135,7 @@ describe('SSO', () => {
135
135
  loginHint: 'foo@workos.com',
136
136
  connection: 'connection_123',
137
137
  clientId: 'proj_123',
138
- redirectUri: 'example.com/sso/workos/callback',
138
+ redirectURI: 'example.com/sso/workos/callback',
139
139
  state: 'custom state',
140
140
  });
141
141
  expect(url).toMatchInlineSnapshot(`"https://api.workos.com/sso/authorize?client_id=proj_123&connection=connection_123&login_hint=foo%40workos.com&redirect_uri=example.com%2Fsso%2Fworkos%2Fcallback&response_type=code&state=custom+state"`);
@@ -9,6 +9,9 @@
9
9
  "type": "totp",
10
10
  "totp": {
11
11
  "issuer": "WorkOS",
12
+ "qr_code": "qr-code-test",
13
+ "secret": "secret-test",
14
+ "uri": "uri-test",
12
15
  "user": "some_user"
13
16
  }
14
17
  }
@@ -5,6 +5,6 @@ export interface AuthorizationURLOptions {
5
5
  domainHint?: string;
6
6
  loginHint?: string;
7
7
  provider?: string;
8
- redirectUri: string;
8
+ redirectURI: string;
9
9
  state?: string;
10
10
  }
@@ -4,7 +4,6 @@ export * from './authenticate-with-password-options.serializer';
4
4
  export * from './authenticate-with-totp-options.serializer';
5
5
  export * from './authentication-response.serializer';
6
6
  export * from './enroll-auth-factor-options.serializer';
7
- export * from './factor.serializer';
8
7
  export * from './reset-password-options.serializer';
9
8
  export * from './send-password-reset-email.serializer';
10
9
  export * from './create-user-options.serializer';
@@ -20,7 +20,6 @@ __exportStar(require("./authenticate-with-password-options.serializer"), exports
20
20
  __exportStar(require("./authenticate-with-totp-options.serializer"), exports);
21
21
  __exportStar(require("./authentication-response.serializer"), exports);
22
22
  __exportStar(require("./enroll-auth-factor-options.serializer"), exports);
23
- __exportStar(require("./factor.serializer"), exports);
24
23
  __exportStar(require("./reset-password-options.serializer"), exports);
25
24
  __exportStar(require("./send-password-reset-email.serializer"), exports);
26
25
  __exportStar(require("./create-user-options.serializer"), exports);
@@ -1,7 +1,7 @@
1
1
  import { WorkOS } from '../workos';
2
2
  import { AutoPaginatable } from '../common/utils/pagination';
3
3
  import { AuthenticateWithCodeOptions, AuthenticateWithMagicAuthOptions, AuthenticateWithPasswordOptions, AuthenticateWithTotpOptions, AuthenticationResponse, ResetPasswordOptions, SendPasswordResetEmailOptions, CreateUserOptions, EnrollAuthFactorOptions, ListAuthFactorsOptions, ListUsersOptions, SendMagicAuthCodeOptions, SendVerificationEmailOptions, UpdateUserOptions, User, VerifyEmailOptions } from './interfaces';
4
- import { Challenge } from '../mfa/interfaces';
4
+ import { Challenge, Factor } from '../mfa/interfaces';
5
5
  import { OrganizationMembership } from './interfaces/organization-membership.interface';
6
6
  import { ListOrganizationMembershipsOptions } from './interfaces/list-organization-memberships-options.interface';
7
7
  import { CreateOrganizationMembershipOptions } from './interfaces/create-organization-membership-options.interface';
@@ -11,7 +11,6 @@ import { SendInvitationOptions } from './interfaces/send-invitation-options.inte
11
11
  import { AuthorizationURLOptions } from './interfaces/authorization-url-options.interface';
12
12
  import { AuthenticateWithEmailVerificationOptions } from './interfaces/authenticate-with-email-verification-options.interface';
13
13
  import { AuthenticateWithOrganizationSelectionOptions } from './interfaces/authenticate-with-organization-selection.interface';
14
- import { Factor, FactorWithSecrets } from './interfaces/factor.interface';
15
14
  export declare class UserManagement {
16
15
  private readonly workos;
17
16
  constructor(workos: WorkOS);
@@ -37,7 +36,7 @@ export declare class UserManagement {
37
36
  }>;
38
37
  updateUser(payload: UpdateUserOptions): Promise<User>;
39
38
  enrollAuthFactor(payload: EnrollAuthFactorOptions): Promise<{
40
- authenticationFactor: FactorWithSecrets;
39
+ authenticationFactor: Factor;
41
40
  authenticationChallenge: Challenge;
42
41
  }>;
43
42
  listAuthFactors(options: ListAuthFactorsOptions): Promise<AutoPaginatable<Factor>>;
@@ -50,5 +49,5 @@ export declare class UserManagement {
50
49
  listInvitations(options: ListInvitationsOptions): Promise<AutoPaginatable<Invitation>>;
51
50
  sendInvitation(payload: SendInvitationOptions): Promise<Invitation>;
52
51
  revokeInvitation(invitationId: string): Promise<Invitation>;
53
- getAuthorizationUrl({ connectionId, clientId, domainHint, loginHint, organizationId, provider, redirectUri, state, }: AuthorizationURLOptions): string;
52
+ getAuthorizationUrl({ connectionId, clientId, domainHint, loginHint, organizationId, provider, redirectURI, state, }: AuthorizationURLOptions): string;
54
53
  }
@@ -23,7 +23,6 @@ const send_invitation_options_serializer_1 = require("./serializers/send-invitat
23
23
  const list_users_options_serializer_1 = require("./serializers/list-users-options.serializer");
24
24
  const authenticate_with_email_verification_serializer_1 = require("./serializers/authenticate-with-email-verification.serializer");
25
25
  const authenticate_with_organization_selection_options_serializer_1 = require("./serializers/authenticate-with-organization-selection-options.serializer");
26
- const factor_serializer_1 = require("./serializers/factor.serializer");
27
26
  const toQueryString = (options) => {
28
27
  const searchParams = new URLSearchParams();
29
28
  const keys = Object.keys(options).sort();
@@ -132,14 +131,14 @@ class UserManagement {
132
131
  return __awaiter(this, void 0, void 0, function* () {
133
132
  const { data } = yield this.workos.post(`/user_management/users/${payload.userId}/auth_factors`, (0, serializers_1.serializeEnrollAuthFactorOptions)(payload));
134
133
  return {
135
- authenticationFactor: (0, serializers_1.deserializeFactorWithSecrets)(data.authentication_factor),
134
+ authenticationFactor: (0, serializers_2.deserializeFactor)(data.authentication_factor),
136
135
  authenticationChallenge: (0, serializers_2.deserializeChallenge)(data.authentication_challenge),
137
136
  };
138
137
  });
139
138
  }
140
139
  listAuthFactors(options) {
141
140
  return __awaiter(this, void 0, void 0, function* () {
142
- return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/user_management/users/${options.userId}/auth_factors`, factor_serializer_1.deserializeFactor, options), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/user_management/users/${options.userId}/auth_factors`, factor_serializer_1.deserializeFactor, params), options);
141
+ return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/user_management/users/${options.userId}/auth_factors`, serializers_2.deserializeFactor, options), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/user_management/users/${options.userId}/auth_factors`, serializers_2.deserializeFactor, params), options);
143
142
  });
144
143
  }
145
144
  deleteUser(userId) {
@@ -194,7 +193,7 @@ class UserManagement {
194
193
  return (0, invitation_serializer_1.deserializeInvitation)(data);
195
194
  });
196
195
  }
197
- getAuthorizationUrl({ connectionId, clientId, domainHint, loginHint, organizationId, provider, redirectUri, state, }) {
196
+ getAuthorizationUrl({ connectionId, clientId, domainHint, loginHint, organizationId, provider, redirectURI, state, }) {
198
197
  if (!provider && !connectionId && !organizationId) {
199
198
  throw new Error(`Incomplete arguments. Need to specify either a 'connectionId', 'organizationId', or 'provider'.`);
200
199
  }
@@ -205,7 +204,7 @@ class UserManagement {
205
204
  login_hint: loginHint,
206
205
  provider,
207
206
  client_id: clientId,
208
- redirect_uri: redirectUri,
207
+ redirect_uri: redirectURI,
209
208
  response_type: 'code',
210
209
  state,
211
210
  });
@@ -429,6 +429,9 @@ describe('UserManagement', () => {
429
429
  type: 'totp',
430
430
  totp: {
431
431
  issuer: 'WorkOS',
432
+ qrCode: 'qr-code-test',
433
+ secret: 'secret-test',
434
+ uri: 'uri-test',
432
435
  user: 'some_user',
433
436
  },
434
437
  },
@@ -642,7 +645,7 @@ describe('UserManagement', () => {
642
645
  const url = workos.userManagement.getAuthorizationUrl({
643
646
  provider: 'Google',
644
647
  clientId: 'proj_123',
645
- redirectUri: 'example.com/auth/workos/callback',
648
+ redirectURI: 'example.com/auth/workos/callback',
646
649
  });
647
650
  expect(url).toMatchSnapshot();
648
651
  });
@@ -652,7 +655,7 @@ describe('UserManagement', () => {
652
655
  const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
653
656
  const urlFn = () => workos.userManagement.getAuthorizationUrl({
654
657
  clientId: 'proj_123',
655
- redirectUri: 'example.com/auth/workos/callback',
658
+ redirectURI: 'example.com/auth/workos/callback',
656
659
  });
657
660
  expect(urlFn).toThrowErrorMatchingSnapshot();
658
661
  });
@@ -663,7 +666,7 @@ describe('UserManagement', () => {
663
666
  const url = workos.userManagement.getAuthorizationUrl({
664
667
  provider: 'Google',
665
668
  clientId: 'proj_123',
666
- redirectUri: 'example.com/auth/workos/callback',
669
+ redirectURI: 'example.com/auth/workos/callback',
667
670
  });
668
671
  expect(url).toMatchSnapshot();
669
672
  });
@@ -674,7 +677,7 @@ describe('UserManagement', () => {
674
677
  const url = workos.userManagement.getAuthorizationUrl({
675
678
  connectionId: 'connection_123',
676
679
  clientId: 'proj_123',
677
- redirectUri: 'example.com/auth/workos/callback',
680
+ redirectURI: 'example.com/auth/workos/callback',
678
681
  });
679
682
  expect(url).toMatchSnapshot();
680
683
  });
@@ -685,7 +688,7 @@ describe('UserManagement', () => {
685
688
  const url = workos.userManagement.getAuthorizationUrl({
686
689
  organizationId: 'organization_123',
687
690
  clientId: 'proj_123',
688
- redirectUri: 'example.com/auth/workos/callback',
691
+ redirectURI: 'example.com/auth/workos/callback',
689
692
  });
690
693
  expect(url).toMatchSnapshot();
691
694
  });
@@ -698,7 +701,7 @@ describe('UserManagement', () => {
698
701
  const url = workos.userManagement.getAuthorizationUrl({
699
702
  organizationId: 'organization_123',
700
703
  clientId: 'proj_123',
701
- redirectUri: 'example.com/auth/workos/callback',
704
+ redirectURI: 'example.com/auth/workos/callback',
702
705
  });
703
706
  expect(url).toMatchSnapshot();
704
707
  });
@@ -709,7 +712,7 @@ describe('UserManagement', () => {
709
712
  const url = workos.userManagement.getAuthorizationUrl({
710
713
  organizationId: 'organization_123',
711
714
  clientId: 'proj_123',
712
- redirectUri: 'example.com/auth/workos/callback',
715
+ redirectURI: 'example.com/auth/workos/callback',
713
716
  state: 'custom state',
714
717
  });
715
718
  expect(url).toMatchSnapshot();
@@ -722,7 +725,7 @@ describe('UserManagement', () => {
722
725
  domainHint: 'example.com',
723
726
  connectionId: 'connection_123',
724
727
  clientId: 'proj_123',
725
- redirectUri: 'example.com/auth/workos/callback',
728
+ redirectURI: 'example.com/auth/workos/callback',
726
729
  state: 'custom state',
727
730
  });
728
731
  expect(url).toMatchInlineSnapshot(`"https://api.workos.com/user_management/authorize?client_id=proj_123&connection_id=connection_123&domain_hint=example.com&redirect_uri=example.com%2Fauth%2Fworkos%2Fcallback&response_type=code&state=custom+state"`);
@@ -735,7 +738,7 @@ describe('UserManagement', () => {
735
738
  loginHint: 'foo@workos.com',
736
739
  connectionId: 'connection_123',
737
740
  clientId: 'proj_123',
738
- redirectUri: 'example.com/auth/workos/callback',
741
+ redirectURI: 'example.com/auth/workos/callback',
739
742
  state: 'custom state',
740
743
  });
741
744
  expect(url).toMatchInlineSnapshot(`"https://api.workos.com/user_management/authorize?client_id=proj_123&connection_id=connection_123&login_hint=foo%40workos.com&redirect_uri=example.com%2Fauth%2Fworkos%2Fcallback&response_type=code&state=custom+state"`);
package/lib/workos.js CHANGED
@@ -27,7 +27,7 @@ const mfa_1 = require("./mfa/mfa");
27
27
  const audit_logs_1 = require("./audit-logs/audit-logs");
28
28
  const user_management_1 = require("./user-management/user-management");
29
29
  const bad_request_exception_1 = require("./common/exceptions/bad-request.exception");
30
- const VERSION = '4.0.0';
30
+ const VERSION = '4.0.1';
31
31
  const DEFAULT_HOSTNAME = 'api.workos.com';
32
32
  class WorkOS {
33
33
  constructor(key, options = {}) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.0.0",
2
+ "version": "4.0.1",
3
3
  "name": "@workos-inc/node",
4
4
  "author": "WorkOS",
5
5
  "description": "A Node wrapper for the WorkOS API",
@@ -34,7 +34,7 @@
34
34
  "prepublishOnly": "yarn run build"
35
35
  },
36
36
  "dependencies": {
37
- "axios": "1.6.0",
37
+ "axios": "~1.6.5",
38
38
  "pluralize": "8.0.0"
39
39
  },
40
40
  "devDependencies": {
@@ -1,37 +0,0 @@
1
- import { Totp, TotpResponse, TotpWithSecrets, TotpWithSecretsResponse } from '../../mfa/interfaces/totp.interface';
2
- export interface Factor {
3
- object: 'authentication_factor';
4
- id: string;
5
- createdAt: string;
6
- updatedAt: string;
7
- type: 'totp';
8
- totp: Totp;
9
- userId: string;
10
- }
11
- export interface FactorWithSecrets {
12
- object: 'authentication_factor';
13
- id: string;
14
- createdAt: string;
15
- updatedAt: string;
16
- type: 'totp';
17
- totp: TotpWithSecrets;
18
- userId: string;
19
- }
20
- export interface FactorResponse {
21
- object: 'authentication_factor';
22
- id: string;
23
- created_at: string;
24
- updated_at: string;
25
- type: 'totp';
26
- totp: TotpResponse;
27
- user_id: string;
28
- }
29
- export interface FactorWithSecretsResponse {
30
- object: 'authentication_factor';
31
- id: string;
32
- created_at: string;
33
- updated_at: string;
34
- type: 'totp';
35
- totp: TotpWithSecretsResponse;
36
- user_id: string;
37
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- import { Factor, FactorResponse, FactorWithSecrets, FactorWithSecretsResponse } from '../interfaces/factor.interface';
2
- export declare const deserializeFactor: (factor: FactorResponse) => Factor;
3
- export declare const deserializeFactorWithSecrets: (factor: FactorWithSecretsResponse) => FactorWithSecrets;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deserializeFactorWithSecrets = exports.deserializeFactor = void 0;
4
- const totp_serializer_1 = require("../../mfa/serializers/totp.serializer");
5
- const deserializeFactor = (factor) => ({
6
- object: factor.object,
7
- id: factor.id,
8
- createdAt: factor.created_at,
9
- updatedAt: factor.updated_at,
10
- type: factor.type,
11
- totp: (0, totp_serializer_1.deserializeTotp)(factor.totp),
12
- userId: factor.user_id,
13
- });
14
- exports.deserializeFactor = deserializeFactor;
15
- const deserializeFactorWithSecrets = (factor) => ({
16
- object: factor.object,
17
- id: factor.id,
18
- createdAt: factor.created_at,
19
- updatedAt: factor.updated_at,
20
- type: factor.type,
21
- totp: (0, totp_serializer_1.deserializeTotpWithSecrets)(factor.totp),
22
- userId: factor.user_id,
23
- });
24
- exports.deserializeFactorWithSecrets = deserializeFactorWithSecrets;