@workos-inc/node 3.6.0 → 3.7.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.
Files changed (54) hide show
  1. package/lib/users/fixtures/list-factors.json +23 -0
  2. package/lib/users/interfaces/{authenticate-user-with-token-options.interface.d.ts → authenticate-with-code-options.interface.d.ts} +6 -2
  3. package/lib/users/interfaces/{authenticate-user-with-magic-auth-options.interface.d.ts → authenticate-with-magic-auth-options.interface.d.ts} +4 -4
  4. package/lib/users/interfaces/{authenticate-user-with-password-options.interface.d.ts → authenticate-with-password-options.interface.d.ts} +2 -2
  5. package/lib/users/interfaces/authenticate-with-totp-options.interface.d.ts +21 -0
  6. package/lib/users/interfaces/{enroll-user-in-mfa-factor.interface.d.ts → enroll-auth-factor.interface.d.ts} +1 -1
  7. package/lib/users/interfaces/index.d.ts +8 -7
  8. package/lib/users/interfaces/index.js +8 -7
  9. package/lib/users/interfaces/list-auth-factors-options.interface.d.ts +4 -0
  10. package/lib/users/interfaces/reset-password-options.interface.d.ts +8 -0
  11. package/lib/users/interfaces/send-magic-auth-code-options.interface.d.ts +2 -2
  12. package/lib/users/interfaces/{create-password-reset-challenge-options.interface.d.ts → send-password-reset-options.interface.d.ts} +4 -4
  13. package/lib/users/interfaces/send-password-reset-options.interface.js +2 -0
  14. package/lib/users/serializers/authenticate-with-code-options.serializer.d.ts +2 -0
  15. package/lib/users/serializers/authenticate-with-code-options.serializer.js +12 -0
  16. package/lib/users/serializers/authenticate-with-magic-auth-options.serializer.d.ts +2 -0
  17. package/lib/users/serializers/{authenticate-user-with-magic-auth-options.serializer.js → authenticate-with-magic-auth-options.serializer.js} +4 -4
  18. package/lib/users/serializers/authenticate-with-password-options.serializer.d.ts +2 -0
  19. package/lib/users/serializers/{authenticate-user-with-password-options.serializer.js → authenticate-with-password-options.serializer.js} +3 -3
  20. package/lib/users/serializers/authenticate-with-totp-options.serializer.d.ts +2 -0
  21. package/lib/users/serializers/authenticate-with-totp-options.serializer.js +14 -0
  22. package/lib/users/serializers/enroll-auth-factor-options.serializer.d.ts +2 -0
  23. package/lib/users/serializers/enroll-auth-factor-options.serializer.js +9 -0
  24. package/lib/users/serializers/index.d.ts +7 -5
  25. package/lib/users/serializers/index.js +7 -5
  26. package/lib/users/serializers/reset-password-options.serializer.d.ts +2 -0
  27. package/lib/users/serializers/reset-password-options.serializer.js +8 -0
  28. package/lib/users/serializers/send-magic-auth-code-options.serializer.js +1 -1
  29. package/lib/users/serializers/send-password-reset-email.serializer.d.ts +3 -0
  30. package/lib/users/serializers/send-password-reset-email.serializer.js +14 -0
  31. package/lib/users/users.d.ts +14 -8
  32. package/lib/users/users.js +26 -16
  33. package/lib/users/users.spec.js +73 -17
  34. package/lib/workos.js +1 -1
  35. package/package.json +1 -1
  36. package/lib/users/interfaces/complete-password-reset-options.interface.d.ts +0 -8
  37. package/lib/users/interfaces/magic-auth-challenge.interface.d.ts +0 -3
  38. package/lib/users/serializers/authenticate-user-with-code-options.serializer.d.ts +0 -2
  39. package/lib/users/serializers/authenticate-user-with-code-options.serializer.js +0 -10
  40. package/lib/users/serializers/authenticate-user-with-magic-auth-options.serializer.d.ts +0 -2
  41. package/lib/users/serializers/authenticate-user-with-password-options.serializer.d.ts +0 -2
  42. package/lib/users/serializers/complete-password-reset-options.serializer.d.ts +0 -2
  43. package/lib/users/serializers/complete-password-reset-options.serializer.js +0 -8
  44. package/lib/users/serializers/create-password-reset-challenge.serializer.d.ts +0 -3
  45. package/lib/users/serializers/create-password-reset-challenge.serializer.js +0 -14
  46. package/lib/users/serializers/enroll-user-in-mfa-factor-options.serializer.d.ts +0 -2
  47. package/lib/users/serializers/enroll-user-in-mfa-factor-options.serializer.js +0 -9
  48. /package/lib/users/interfaces/{authenticate-user-with-magic-auth-options.interface.js → authenticate-with-code-options.interface.js} +0 -0
  49. /package/lib/users/interfaces/{authenticate-user-with-password-options.interface.js → authenticate-with-magic-auth-options.interface.js} +0 -0
  50. /package/lib/users/interfaces/{authenticate-user-with-token-options.interface.js → authenticate-with-password-options.interface.js} +0 -0
  51. /package/lib/users/interfaces/{complete-password-reset-options.interface.js → authenticate-with-totp-options.interface.js} +0 -0
  52. /package/lib/users/interfaces/{create-password-reset-challenge-options.interface.js → enroll-auth-factor.interface.js} +0 -0
  53. /package/lib/users/interfaces/{enroll-user-in-mfa-factor.interface.js → list-auth-factors-options.interface.js} +0 -0
  54. /package/lib/users/interfaces/{magic-auth-challenge.interface.js → reset-password-options.interface.js} +0 -0
@@ -0,0 +1,23 @@
1
+ {
2
+ "object": "list",
3
+ "data": [
4
+ {
5
+ "object": "authentication_factor",
6
+ "id": "auth_factor_1234",
7
+ "created_at": "2022-03-15T20:39:19.892Z",
8
+ "updated_at": "2022-03-15T20:39:19.892Z",
9
+ "type": "totp",
10
+ "totp": {
11
+ "issuer": "WorkOS",
12
+ "qr_code": "qr-code-test",
13
+ "secret": "secret-test",
14
+ "uri": "uri-test",
15
+ "user": "some_user"
16
+ }
17
+ }
18
+ ],
19
+ "list_metadata": {
20
+ "before": null,
21
+ "after": null
22
+ }
23
+ }
@@ -1,13 +1,17 @@
1
- export interface AuthenticateUserWithCodeOptions {
1
+ export interface AuthenticateWithCodeOptions {
2
2
  clientId: string;
3
3
  code: string;
4
+ ipAddress?: string;
5
+ userAgent?: string;
4
6
  }
5
7
  export interface AuthenticateUserWithCodeCredentials {
6
8
  clientSecret: string | undefined;
7
9
  }
8
- export interface SerializedAuthenticateUserWithCodeOptions {
10
+ export interface SerializedAuthenticateWithCodeOptions {
9
11
  grant_type: 'authorization_code';
10
12
  client_id: string;
11
13
  client_secret: string | undefined;
12
14
  code: string;
15
+ ip_address?: string;
16
+ user_agent?: string;
13
17
  }
@@ -1,19 +1,19 @@
1
- export interface AuthenticateUserWithMagicAuthOptions {
1
+ export interface AuthenticateWithMagicAuthOptions {
2
2
  clientId: string;
3
3
  code: string;
4
- magicAuthChallengeId: string;
4
+ userId: string;
5
5
  ipAddress?: string;
6
6
  userAgent?: string;
7
7
  }
8
8
  export interface AuthenticateUserWithMagicAuthCredentials {
9
9
  clientSecret: string | undefined;
10
10
  }
11
- export interface SerializedAuthenticateUserWithMagicAuthOptions {
11
+ export interface SerializedAuthenticateWithMagicAuthOptions {
12
12
  grant_type: 'urn:workos:oauth:grant-type:magic-auth:code';
13
13
  client_id: string;
14
14
  client_secret: string | undefined;
15
15
  code: string;
16
- magic_auth_challenge_id: string;
16
+ user_id: string;
17
17
  ip_address?: string;
18
18
  user_agent?: string;
19
19
  }
@@ -1,4 +1,4 @@
1
- export interface AuthenticateUserWithPasswordOptions {
1
+ export interface AuthenticateWithPasswordOptions {
2
2
  clientId: string;
3
3
  email: string;
4
4
  password: string;
@@ -8,7 +8,7 @@ export interface AuthenticateUserWithPasswordOptions {
8
8
  export interface AuthenticateUserWithPasswordCredentials {
9
9
  clientSecret: string | undefined;
10
10
  }
11
- export interface SerializedAuthenticateUserWithPasswordOptions {
11
+ export interface SerializedAuthenticateWithPasswordOptions {
12
12
  grant_type: 'password';
13
13
  client_id: string;
14
14
  client_secret: string | undefined;
@@ -0,0 +1,21 @@
1
+ export interface AuthenticateWithTotpOptions {
2
+ clientId: string;
3
+ code: string;
4
+ pendingAuthenticationToken: string;
5
+ authenticationChallengeId: string;
6
+ ipAddress?: string;
7
+ userAgent?: string;
8
+ }
9
+ export interface AuthenticateUserWithTotpCredentials {
10
+ clientSecret: string | undefined;
11
+ }
12
+ export interface SerializedAuthenticateWithTotpOptions {
13
+ grant_type: 'urn:workos:oauth:grant-type:mfa-totp';
14
+ client_id: string;
15
+ client_secret: string | undefined;
16
+ code: string;
17
+ pending_authentication_token: string;
18
+ authentication_challenge_id: string;
19
+ ip_address?: string;
20
+ user_agent?: string;
21
+ }
@@ -1,4 +1,4 @@
1
- export interface EnrollUserInMfaFactorOptions {
1
+ export interface EnrollAuthFactorOptions {
2
2
  userId: string;
3
3
  type: 'totp';
4
4
  totpIssuer: string;
@@ -1,15 +1,16 @@
1
1
  export * from './add-user-to-organization-options.interface';
2
- export * from './authenticate-user-with-magic-auth-options.interface';
3
- export * from './authenticate-user-with-password-options.interface';
4
- export * from './authenticate-user-with-token-options.interface';
2
+ export * from './authenticate-with-magic-auth-options.interface';
3
+ export * from './authenticate-with-password-options.interface';
4
+ export * from './authenticate-with-code-options.interface';
5
+ export * from './authenticate-with-totp-options.interface';
5
6
  export * from './authentication-response.interface';
6
- export * from './complete-password-reset-options.interface';
7
- export * from './create-password-reset-challenge-options.interface';
7
+ export * from './reset-password-options.interface';
8
+ export * from './send-password-reset-options.interface';
8
9
  export * from './create-user-options.interface';
9
10
  export * from './delete-user-options.interface';
10
- export * from './enroll-user-in-mfa-factor.interface';
11
+ export * from './enroll-auth-factor.interface';
11
12
  export * from './list-users-options.interface';
12
- export * from './magic-auth-challenge.interface';
13
+ export * from './list-auth-factors-options.interface';
13
14
  export * from './remove-user-from-organization-options.interface';
14
15
  export * from './send-magic-auth-code-options.interface';
15
16
  export * from './send-verification-email-options';
@@ -15,17 +15,18 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./add-user-to-organization-options.interface"), exports);
18
- __exportStar(require("./authenticate-user-with-magic-auth-options.interface"), exports);
19
- __exportStar(require("./authenticate-user-with-password-options.interface"), exports);
20
- __exportStar(require("./authenticate-user-with-token-options.interface"), exports);
18
+ __exportStar(require("./authenticate-with-magic-auth-options.interface"), exports);
19
+ __exportStar(require("./authenticate-with-password-options.interface"), exports);
20
+ __exportStar(require("./authenticate-with-code-options.interface"), exports);
21
+ __exportStar(require("./authenticate-with-totp-options.interface"), exports);
21
22
  __exportStar(require("./authentication-response.interface"), exports);
22
- __exportStar(require("./complete-password-reset-options.interface"), exports);
23
- __exportStar(require("./create-password-reset-challenge-options.interface"), exports);
23
+ __exportStar(require("./reset-password-options.interface"), exports);
24
+ __exportStar(require("./send-password-reset-options.interface"), exports);
24
25
  __exportStar(require("./create-user-options.interface"), exports);
25
26
  __exportStar(require("./delete-user-options.interface"), exports);
26
- __exportStar(require("./enroll-user-in-mfa-factor.interface"), exports);
27
+ __exportStar(require("./enroll-auth-factor.interface"), exports);
27
28
  __exportStar(require("./list-users-options.interface"), exports);
28
- __exportStar(require("./magic-auth-challenge.interface"), exports);
29
+ __exportStar(require("./list-auth-factors-options.interface"), exports);
29
30
  __exportStar(require("./remove-user-from-organization-options.interface"), exports);
30
31
  __exportStar(require("./send-magic-auth-code-options.interface"), exports);
31
32
  __exportStar(require("./send-verification-email-options"), exports);
@@ -0,0 +1,4 @@
1
+ import { PaginationOptions } from '../../common/interfaces';
2
+ export interface ListAuthFactorsOptions extends PaginationOptions {
3
+ userId: string;
4
+ }
@@ -0,0 +1,8 @@
1
+ export interface ResetPasswordOptions {
2
+ token: string;
3
+ newPassword: string;
4
+ }
5
+ export interface SerializedResetPasswordOptions {
6
+ token: string;
7
+ new_password: string;
8
+ }
@@ -1,6 +1,6 @@
1
1
  export interface SendMagicAuthCodeOptions {
2
- emailAddress: string;
2
+ email: string;
3
3
  }
4
4
  export interface SerializedSendMagicAuthCodeOptions {
5
- email_address: string;
5
+ email: string;
6
6
  }
@@ -1,17 +1,17 @@
1
1
  import { User, UserResponse } from './user.interface';
2
- export interface CreatePasswordResetChallengeOptions {
2
+ export interface SendPasswordResetEmailOptions {
3
3
  email: string;
4
4
  passwordResetUrl: string;
5
5
  }
6
- export interface SerializedCreatePasswordResetChallengeOptions {
6
+ export interface SerializedSendPasswordResetEmailOptions {
7
7
  email: string;
8
8
  password_reset_url: string;
9
9
  }
10
- export interface CreatePasswordResetChallengeResponse {
10
+ export interface SendPasswordResetEmailResponse {
11
11
  token: string;
12
12
  user: User;
13
13
  }
14
- export interface CreatePasswordResetChallengeResponseResponse {
14
+ export interface SendPasswordResetEmailResponseResponse {
15
15
  token: string;
16
16
  user: UserResponse;
17
17
  }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import { AuthenticateUserWithCodeCredentials, AuthenticateWithCodeOptions, SerializedAuthenticateWithCodeOptions } from '../interfaces';
2
+ export declare const serializeAuthenticateWithCodeOptions: (options: AuthenticateWithCodeOptions & AuthenticateUserWithCodeCredentials) => SerializedAuthenticateWithCodeOptions;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serializeAuthenticateWithCodeOptions = void 0;
4
+ const serializeAuthenticateWithCodeOptions = (options) => ({
5
+ grant_type: 'authorization_code',
6
+ client_id: options.clientId,
7
+ client_secret: options.clientSecret,
8
+ code: options.code,
9
+ ip_address: options.ipAddress,
10
+ user_agent: options.userAgent,
11
+ });
12
+ exports.serializeAuthenticateWithCodeOptions = serializeAuthenticateWithCodeOptions;
@@ -0,0 +1,2 @@
1
+ import { AuthenticateUserWithMagicAuthCredentials, AuthenticateWithMagicAuthOptions, SerializedAuthenticateWithMagicAuthOptions } from '../interfaces';
2
+ export declare const serializeAuthenticateWithMagicAuthOptions: (options: AuthenticateWithMagicAuthOptions & AuthenticateUserWithMagicAuthCredentials) => SerializedAuthenticateWithMagicAuthOptions;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializeAuthenticateUserWithMagicAuthOptions = void 0;
4
- const serializeAuthenticateUserWithMagicAuthOptions = (options) => ({
3
+ exports.serializeAuthenticateWithMagicAuthOptions = void 0;
4
+ const serializeAuthenticateWithMagicAuthOptions = (options) => ({
5
5
  grant_type: 'urn:workos:oauth:grant-type:magic-auth:code',
6
6
  client_id: options.clientId,
7
7
  client_secret: options.clientSecret,
8
8
  code: options.code,
9
- magic_auth_challenge_id: options.magicAuthChallengeId,
9
+ user_id: options.userId,
10
10
  ip_address: options.ipAddress,
11
11
  user_agent: options.userAgent,
12
12
  });
13
- exports.serializeAuthenticateUserWithMagicAuthOptions = serializeAuthenticateUserWithMagicAuthOptions;
13
+ exports.serializeAuthenticateWithMagicAuthOptions = serializeAuthenticateWithMagicAuthOptions;
@@ -0,0 +1,2 @@
1
+ import { AuthenticateUserWithPasswordCredentials, AuthenticateWithPasswordOptions, SerializedAuthenticateWithPasswordOptions } from '../interfaces';
2
+ export declare const serializeAuthenticateWithPasswordOptions: (options: AuthenticateWithPasswordOptions & AuthenticateUserWithPasswordCredentials) => SerializedAuthenticateWithPasswordOptions;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializeAuthenticateUserWithPasswordOptions = void 0;
4
- const serializeAuthenticateUserWithPasswordOptions = (options) => ({
3
+ exports.serializeAuthenticateWithPasswordOptions = void 0;
4
+ const serializeAuthenticateWithPasswordOptions = (options) => ({
5
5
  grant_type: 'password',
6
6
  client_id: options.clientId,
7
7
  client_secret: options.clientSecret,
@@ -10,4 +10,4 @@ const serializeAuthenticateUserWithPasswordOptions = (options) => ({
10
10
  ip_address: options.ipAddress,
11
11
  user_agent: options.userAgent,
12
12
  });
13
- exports.serializeAuthenticateUserWithPasswordOptions = serializeAuthenticateUserWithPasswordOptions;
13
+ exports.serializeAuthenticateWithPasswordOptions = serializeAuthenticateWithPasswordOptions;
@@ -0,0 +1,2 @@
1
+ import { AuthenticateUserWithTotpCredentials, AuthenticateWithTotpOptions, SerializedAuthenticateWithTotpOptions } from '../interfaces';
2
+ export declare const serializeAuthenticateWithTotpOptions: (options: AuthenticateWithTotpOptions & AuthenticateUserWithTotpCredentials) => SerializedAuthenticateWithTotpOptions;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serializeAuthenticateWithTotpOptions = void 0;
4
+ const serializeAuthenticateWithTotpOptions = (options) => ({
5
+ grant_type: 'urn:workos:oauth:grant-type:mfa-totp',
6
+ client_id: options.clientId,
7
+ client_secret: options.clientSecret,
8
+ code: options.code,
9
+ authentication_challenge_id: options.authenticationChallengeId,
10
+ pending_authentication_token: options.pendingAuthenticationToken,
11
+ ip_address: options.ipAddress,
12
+ user_agent: options.userAgent,
13
+ });
14
+ exports.serializeAuthenticateWithTotpOptions = serializeAuthenticateWithTotpOptions;
@@ -0,0 +1,2 @@
1
+ import { EnrollAuthFactorOptions, SerializedEnrollUserInMfaFactorOptions } from '../interfaces';
2
+ export declare const serializeEnrollAuthFactorOptions: (options: EnrollAuthFactorOptions) => SerializedEnrollUserInMfaFactorOptions;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serializeEnrollAuthFactorOptions = void 0;
4
+ const serializeEnrollAuthFactorOptions = (options) => ({
5
+ type: options.type,
6
+ totp_issuer: options.totpIssuer,
7
+ totp_user: options.totpUser,
8
+ });
9
+ exports.serializeEnrollAuthFactorOptions = serializeEnrollAuthFactorOptions;
@@ -1,9 +1,11 @@
1
- export * from './authenticate-user-with-code-options.serializer';
2
- export * from './authenticate-user-with-magic-auth-options.serializer';
3
- export * from './authenticate-user-with-password-options.serializer';
1
+ export * from './authenticate-with-code-options.serializer';
2
+ export * from './authenticate-with-magic-auth-options.serializer';
3
+ export * from './authenticate-with-password-options.serializer';
4
+ export * from './authenticate-with-totp-options.serializer';
4
5
  export * from './authentication-response.serializer';
5
- export * from './complete-password-reset-options.serializer';
6
- export * from './create-password-reset-challenge.serializer';
6
+ export * from './enroll-auth-factor-options.serializer';
7
+ export * from './reset-password-options.serializer';
8
+ export * from './send-password-reset-email.serializer';
7
9
  export * from './create-user-options.serializer';
8
10
  export * from './send-magic-auth-code-options.serializer';
9
11
  export * from './update-user-options.serializer';
@@ -14,12 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./authenticate-user-with-code-options.serializer"), exports);
18
- __exportStar(require("./authenticate-user-with-magic-auth-options.serializer"), exports);
19
- __exportStar(require("./authenticate-user-with-password-options.serializer"), exports);
17
+ __exportStar(require("./authenticate-with-code-options.serializer"), exports);
18
+ __exportStar(require("./authenticate-with-magic-auth-options.serializer"), exports);
19
+ __exportStar(require("./authenticate-with-password-options.serializer"), exports);
20
+ __exportStar(require("./authenticate-with-totp-options.serializer"), exports);
20
21
  __exportStar(require("./authentication-response.serializer"), exports);
21
- __exportStar(require("./complete-password-reset-options.serializer"), exports);
22
- __exportStar(require("./create-password-reset-challenge.serializer"), exports);
22
+ __exportStar(require("./enroll-auth-factor-options.serializer"), exports);
23
+ __exportStar(require("./reset-password-options.serializer"), exports);
24
+ __exportStar(require("./send-password-reset-email.serializer"), exports);
23
25
  __exportStar(require("./create-user-options.serializer"), exports);
24
26
  __exportStar(require("./send-magic-auth-code-options.serializer"), exports);
25
27
  __exportStar(require("./update-user-options.serializer"), exports);
@@ -0,0 +1,2 @@
1
+ import { ResetPasswordOptions, SerializedResetPasswordOptions } from '../interfaces';
2
+ export declare const serializeResetPasswordOptions: (options: ResetPasswordOptions) => SerializedResetPasswordOptions;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serializeResetPasswordOptions = void 0;
4
+ const serializeResetPasswordOptions = (options) => ({
5
+ token: options.token,
6
+ new_password: options.newPassword,
7
+ });
8
+ exports.serializeResetPasswordOptions = serializeResetPasswordOptions;
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.serializeSendMagicAuthCodeOptions = void 0;
4
4
  const serializeSendMagicAuthCodeOptions = (options) => ({
5
- email_address: options.emailAddress,
5
+ email: options.email,
6
6
  });
7
7
  exports.serializeSendMagicAuthCodeOptions = serializeSendMagicAuthCodeOptions;
@@ -0,0 +1,3 @@
1
+ import { SendPasswordResetEmailOptions, SendPasswordResetEmailResponse, SendPasswordResetEmailResponseResponse, SerializedSendPasswordResetEmailOptions } from '../interfaces';
2
+ export declare const deserializeSendPasswordResetEmailResponse: (sendPasswordResetEmailResponse: SendPasswordResetEmailResponseResponse) => SendPasswordResetEmailResponse;
3
+ export declare const serializeSendPasswordResetEmailOptions: (options: SendPasswordResetEmailOptions) => SerializedSendPasswordResetEmailOptions;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serializeSendPasswordResetEmailOptions = exports.deserializeSendPasswordResetEmailResponse = void 0;
4
+ const user_serializer_1 = require("./user.serializer");
5
+ const deserializeSendPasswordResetEmailResponse = (sendPasswordResetEmailResponse) => ({
6
+ token: sendPasswordResetEmailResponse.token,
7
+ user: (0, user_serializer_1.deserializeUser)(sendPasswordResetEmailResponse.user),
8
+ });
9
+ exports.deserializeSendPasswordResetEmailResponse = deserializeSendPasswordResetEmailResponse;
10
+ const serializeSendPasswordResetEmailOptions = (options) => ({
11
+ email: options.email,
12
+ password_reset_url: options.passwordResetUrl,
13
+ });
14
+ exports.serializeSendPasswordResetEmailOptions = serializeSendPasswordResetEmailOptions;
@@ -1,6 +1,6 @@
1
1
  import { WorkOS } from '../workos';
2
2
  import { AutoPaginatable } from '../common/utils/pagination';
3
- import { AddUserToOrganizationOptions, AuthenticateUserWithCodeOptions, AuthenticateUserWithMagicAuthOptions, AuthenticateUserWithPasswordOptions, AuthenticationResponse, CompletePasswordResetOptions, CreatePasswordResetChallengeOptions, CreatePasswordResetChallengeResponse, CreateUserOptions, DeleteUserOptions, EnrollUserInMfaFactorOptions, ListUsersOptions, RemoveUserFromOrganizationOptions, SendMagicAuthCodeOptions, SendVerificationEmailOptions, UpdateUserOptions, UpdateUserPasswordOptions, User, VerifyEmailCodeOptions } from './interfaces';
3
+ import { AddUserToOrganizationOptions, AuthenticateWithCodeOptions, AuthenticateWithMagicAuthOptions, AuthenticateWithPasswordOptions, AuthenticateWithTotpOptions, AuthenticationResponse, ResetPasswordOptions, SendPasswordResetEmailOptions, SendPasswordResetEmailResponse, CreateUserOptions, DeleteUserOptions, EnrollAuthFactorOptions, ListAuthFactorsOptions, ListUsersOptions, RemoveUserFromOrganizationOptions, SendMagicAuthCodeOptions, SendVerificationEmailOptions, UpdateUserOptions, UpdateUserPasswordOptions, User, VerifyEmailCodeOptions } from './interfaces';
4
4
  import { Challenge, Factor } from '../mfa/interfaces';
5
5
  export declare class Users {
6
6
  private readonly workos;
@@ -8,25 +8,31 @@ export declare class Users {
8
8
  getUser(userId: string): Promise<User>;
9
9
  listUsers(options?: ListUsersOptions): Promise<AutoPaginatable<User>>;
10
10
  createUser(payload: CreateUserOptions): Promise<User>;
11
- authenticateUserWithMagicAuth(payload: AuthenticateUserWithMagicAuthOptions): Promise<AuthenticationResponse>;
12
- authenticateUserWithPassword(payload: AuthenticateUserWithPasswordOptions): Promise<AuthenticationResponse>;
13
- authenticateUserWithCode(payload: AuthenticateUserWithCodeOptions): Promise<AuthenticationResponse>;
11
+ authenticateWithMagicAuth(payload: AuthenticateWithMagicAuthOptions): Promise<AuthenticationResponse>;
12
+ authenticateWithPassword(payload: AuthenticateWithPasswordOptions): Promise<AuthenticationResponse>;
13
+ authenticateWithCode(payload: AuthenticateWithCodeOptions): Promise<AuthenticationResponse>;
14
+ authenticateWithTotp(payload: AuthenticateWithTotpOptions): Promise<AuthenticationResponse>;
14
15
  sendVerificationEmail({ userId, }: SendVerificationEmailOptions): Promise<{
15
16
  user: User;
16
17
  }>;
17
18
  sendMagicAuthCode(options: SendMagicAuthCodeOptions): Promise<{
18
19
  user: User;
19
20
  }>;
20
- verifyEmailCode({ code, userId, }: VerifyEmailCodeOptions): Promise<User>;
21
- createPasswordResetChallenge(payload: CreatePasswordResetChallengeOptions): Promise<CreatePasswordResetChallengeResponse>;
22
- completePasswordReset(payload: CompletePasswordResetOptions): Promise<User>;
21
+ verifyEmailCode({ code, userId, }: VerifyEmailCodeOptions): Promise<{
22
+ user: User;
23
+ }>;
24
+ sendPasswordResetEmail(payload: SendPasswordResetEmailOptions): Promise<SendPasswordResetEmailResponse>;
25
+ resetPassword(payload: ResetPasswordOptions): Promise<{
26
+ user: User;
27
+ }>;
23
28
  addUserToOrganization({ userId, organizationId, }: AddUserToOrganizationOptions): Promise<User>;
24
29
  removeUserFromOrganization({ userId, organizationId, }: RemoveUserFromOrganizationOptions): Promise<User>;
25
30
  updateUser(payload: UpdateUserOptions): Promise<User>;
26
31
  updateUserPassword(payload: UpdateUserPasswordOptions): Promise<User>;
27
- enrollUserInMfaFactor(payload: EnrollUserInMfaFactorOptions): Promise<{
32
+ enrollAuthFactor(payload: EnrollAuthFactorOptions): Promise<{
28
33
  authenticationFactor: Factor;
29
34
  authenticationChallenge: Challenge;
30
35
  }>;
36
+ listAuthFactors(options: ListAuthFactorsOptions): Promise<AutoPaginatable<Factor>>;
31
37
  deleteUser(payload: DeleteUserOptions): Promise<void>;
32
38
  }
@@ -14,7 +14,6 @@ const pagination_1 = require("../common/utils/pagination");
14
14
  const serializers_1 = require("./serializers");
15
15
  const fetch_and_deserialize_1 = require("../common/utils/fetch-and-deserialize");
16
16
  const serializers_2 = require("../mfa/serializers");
17
- const enroll_user_in_mfa_factor_options_serializer_1 = require("./serializers/enroll-user-in-mfa-factor-options.serializer");
18
17
  class Users {
19
18
  constructor(workos) {
20
19
  this.workos = workos;
@@ -36,21 +35,27 @@ class Users {
36
35
  return (0, serializers_1.deserializeUser)(data);
37
36
  });
38
37
  }
39
- authenticateUserWithMagicAuth(payload) {
38
+ authenticateWithMagicAuth(payload) {
40
39
  return __awaiter(this, void 0, void 0, function* () {
41
- const { data } = yield this.workos.post('/users/authenticate', (0, serializers_1.serializeAuthenticateUserWithMagicAuthOptions)(Object.assign(Object.assign({}, payload), { clientSecret: this.workos.key })));
40
+ const { data } = yield this.workos.post('/users/authenticate', (0, serializers_1.serializeAuthenticateWithMagicAuthOptions)(Object.assign(Object.assign({}, payload), { clientSecret: this.workos.key })));
42
41
  return (0, serializers_1.deserializeAuthenticationResponse)(data);
43
42
  });
44
43
  }
45
- authenticateUserWithPassword(payload) {
44
+ authenticateWithPassword(payload) {
46
45
  return __awaiter(this, void 0, void 0, function* () {
47
- const { data } = yield this.workos.post('/users/authenticate', (0, serializers_1.serializeAuthenticateUserWithPasswordOptions)(Object.assign(Object.assign({}, payload), { clientSecret: this.workos.key })));
46
+ const { data } = yield this.workos.post('/users/authenticate', (0, serializers_1.serializeAuthenticateWithPasswordOptions)(Object.assign(Object.assign({}, payload), { clientSecret: this.workos.key })));
48
47
  return (0, serializers_1.deserializeAuthenticationResponse)(data);
49
48
  });
50
49
  }
51
- authenticateUserWithCode(payload) {
50
+ authenticateWithCode(payload) {
52
51
  return __awaiter(this, void 0, void 0, function* () {
53
- const { data } = yield this.workos.post('/users/authenticate', (0, serializers_1.serializeAuthenticateUserWithCodeOptions)(Object.assign(Object.assign({}, payload), { clientSecret: this.workos.key })));
52
+ const { data } = yield this.workos.post('/users/authenticate', (0, serializers_1.serializeAuthenticateWithCodeOptions)(Object.assign(Object.assign({}, payload), { clientSecret: this.workos.key })));
53
+ return (0, serializers_1.deserializeAuthenticationResponse)(data);
54
+ });
55
+ }
56
+ authenticateWithTotp(payload) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ const { data } = yield this.workos.post('/users/authenticate', (0, serializers_1.serializeAuthenticateWithTotpOptions)(Object.assign(Object.assign({}, payload), { clientSecret: this.workos.key })));
54
59
  return (0, serializers_1.deserializeAuthenticationResponse)(data);
55
60
  });
56
61
  }
@@ -71,19 +76,19 @@ class Users {
71
76
  const { data } = yield this.workos.post(`/users/${userId}/verify_email_code`, {
72
77
  code,
73
78
  });
74
- return (0, serializers_1.deserializeUser)(data);
79
+ return { user: (0, serializers_1.deserializeUser)(data.user) };
75
80
  });
76
81
  }
77
- createPasswordResetChallenge(payload) {
82
+ sendPasswordResetEmail(payload) {
78
83
  return __awaiter(this, void 0, void 0, function* () {
79
- const { data } = yield this.workos.post('/users/password_reset_challenge', (0, serializers_1.serializeCreatePasswordResetChallengeOptions)(payload));
80
- return (0, serializers_1.deserializeCreatePasswordResetChallengeResponse)(data);
84
+ const { data } = yield this.workos.post('/users/send_password_reset_email', (0, serializers_1.serializeSendPasswordResetEmailOptions)(payload));
85
+ return (0, serializers_1.deserializeSendPasswordResetEmailResponse)(data);
81
86
  });
82
87
  }
83
- completePasswordReset(payload) {
88
+ resetPassword(payload) {
84
89
  return __awaiter(this, void 0, void 0, function* () {
85
- const { data } = yield this.workos.post('/users/password_reset', (0, serializers_1.serializeCompletePasswordResetOptions)(payload));
86
- return (0, serializers_1.deserializeUser)(data);
90
+ const { data } = yield this.workos.post('/users/password_reset', (0, serializers_1.serializeResetPasswordOptions)(payload));
91
+ return { user: (0, serializers_1.deserializeUser)(data.user) };
87
92
  });
88
93
  }
89
94
  addUserToOrganization({ userId, organizationId, }) {
@@ -112,15 +117,20 @@ class Users {
112
117
  return (0, serializers_1.deserializeUser)(data);
113
118
  });
114
119
  }
115
- enrollUserInMfaFactor(payload) {
120
+ enrollAuthFactor(payload) {
116
121
  return __awaiter(this, void 0, void 0, function* () {
117
- const { data } = yield this.workos.post(`/users/${payload.userId}/auth/factors`, (0, enroll_user_in_mfa_factor_options_serializer_1.serializeEnrollUserInMfaFactorOptions)(payload));
122
+ const { data } = yield this.workos.post(`/users/${payload.userId}/auth/factors`, (0, serializers_1.serializeEnrollAuthFactorOptions)(payload));
118
123
  return {
119
124
  authenticationFactor: (0, serializers_2.deserializeFactor)(data.authentication_factor),
120
125
  authenticationChallenge: (0, serializers_2.deserializeChallenge)(data.authentication_challenge),
121
126
  };
122
127
  });
123
128
  }
129
+ listAuthFactors(options) {
130
+ return __awaiter(this, void 0, void 0, function* () {
131
+ return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/users/${options.userId}/auth/factors`, serializers_2.deserializeFactor, options), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, `/users/${options.userId}/auth/factors`, serializers_2.deserializeFactor, params), options);
132
+ });
133
+ }
124
134
  deleteUser(payload) {
125
135
  return __awaiter(this, void 0, void 0, function* () {
126
136
  yield this.workos.delete(`/users/${payload.userId}`);
@@ -17,6 +17,7 @@ const axios_mock_adapter_1 = __importDefault(require("axios-mock-adapter"));
17
17
  const workos_1 = require("../workos");
18
18
  const user_json_1 = __importDefault(require("./fixtures/user.json"));
19
19
  const list_users_json_1 = __importDefault(require("./fixtures/list-users.json"));
20
+ const list_factors_json_1 = __importDefault(require("./fixtures/list-factors.json"));
20
21
  const mock = new axios_mock_adapter_1.default(axios_1.default);
21
22
  const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
22
23
  const userId = 'user_01H5JQDV7R7ATEYZDEG0W5PRYS';
@@ -100,10 +101,10 @@ describe('UserManagement', () => {
100
101
  mock.onPost('/users/authenticate').reply(200, {
101
102
  user: user_json_1.default,
102
103
  });
103
- const resp = yield workos.users.authenticateUserWithMagicAuth({
104
+ const resp = yield workos.users.authenticateWithMagicAuth({
104
105
  clientId: 'proj_whatever',
105
106
  code: '123456',
106
- magicAuthChallengeId: 'auth_challenge_123',
107
+ userId: user_json_1.default.id,
107
108
  });
108
109
  expect(mock.history.post[0].url).toEqual('/users/authenticate');
109
110
  expect(resp).toMatchObject({
@@ -118,7 +119,7 @@ describe('UserManagement', () => {
118
119
  mock.onPost('/users/authenticate').reply(200, {
119
120
  user: user_json_1.default,
120
121
  });
121
- const resp = yield workos.users.authenticateUserWithPassword({
122
+ const resp = yield workos.users.authenticateWithPassword({
122
123
  clientId: 'proj_whatever',
123
124
  email: 'test01@example.com',
124
125
  password: 'extra-secure',
@@ -134,7 +135,7 @@ describe('UserManagement', () => {
134
135
  describe('authenticateUserWithCode', () => {
135
136
  it('sends a token authentication request', () => __awaiter(void 0, void 0, void 0, function* () {
136
137
  mock.onPost('/users/authenticate').reply(200, { user: user_json_1.default });
137
- const resp = yield workos.users.authenticateUserWithCode({
138
+ const resp = yield workos.users.authenticateWithCode({
138
139
  clientId: 'proj_whatever',
139
140
  code: 'or this',
140
141
  });
@@ -150,6 +151,31 @@ describe('UserManagement', () => {
150
151
  });
151
152
  }));
152
153
  });
154
+ describe('authenticateUserWithTotp', () => {
155
+ it('sends a token authentication request', () => __awaiter(void 0, void 0, void 0, function* () {
156
+ mock.onPost('/users/authenticate').reply(200, { user: user_json_1.default });
157
+ const resp = yield workos.users.authenticateWithTotp({
158
+ clientId: 'proj_whatever',
159
+ code: 'or this',
160
+ authenticationChallengeId: 'auth_challenge_01H96FETXGTW1QMBSBT2T36PW0',
161
+ pendingAuthenticationToken: 'cTDQJTTkTkkVYxQUlKBIxEsFs',
162
+ });
163
+ expect(mock.history.post[0].url).toEqual('/users/authenticate');
164
+ expect(JSON.parse(mock.history.post[0].data)).toMatchObject({
165
+ client_id: 'proj_whatever',
166
+ code: 'or this',
167
+ client_secret: 'sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU',
168
+ grant_type: 'urn:workos:oauth:grant-type:mfa-totp',
169
+ authentication_challenge_id: 'auth_challenge_01H96FETXGTW1QMBSBT2T36PW0',
170
+ pending_authentication_token: 'cTDQJTTkTkkVYxQUlKBIxEsFs',
171
+ });
172
+ expect(resp).toMatchObject({
173
+ user: {
174
+ email: 'test01@example.com',
175
+ },
176
+ });
177
+ }));
178
+ });
153
179
  describe('sendVerificationEmail', () => {
154
180
  it('sends a Create Email Verification Challenge request', () => __awaiter(void 0, void 0, void 0, function* () {
155
181
  mock
@@ -176,13 +202,13 @@ describe('UserManagement', () => {
176
202
  it('sends a Complete Email Verification request', () => __awaiter(void 0, void 0, void 0, function* () {
177
203
  mock
178
204
  .onPost(`/users/user_123/verify_email_code`)
179
- .reply(200, user_json_1.default);
205
+ .reply(200, { user: user_json_1.default });
180
206
  const resp = yield workos.users.verifyEmailCode({
181
207
  userId: 'user_123',
182
208
  code: '123456',
183
209
  });
184
210
  expect(mock.history.post[0].url).toEqual(`/users/user_123/verify_email_code`);
185
- expect(resp).toMatchObject({
211
+ expect(resp.user).toMatchObject({
186
212
  email: 'test01@example.com',
187
213
  });
188
214
  }));
@@ -192,7 +218,7 @@ describe('UserManagement', () => {
192
218
  it('sends a Send Magic Auth Code request', () => __awaiter(void 0, void 0, void 0, function* () {
193
219
  mock
194
220
  .onPost('/users/magic_auth/send', {
195
- email_address: 'bob.loblaw@example.com',
221
+ email: 'bob.loblaw@example.com',
196
222
  })
197
223
  .reply(200, {
198
224
  user: {
@@ -206,7 +232,7 @@ describe('UserManagement', () => {
206
232
  },
207
233
  });
208
234
  const response = yield workos.users.sendMagicAuthCode({
209
- emailAddress: 'bob.loblaw@example.com',
235
+ email: 'bob.loblaw@example.com',
210
236
  });
211
237
  expect(mock.history.post[0].url).toEqual('/users/magic_auth/send');
212
238
  expect(response).toMatchObject({
@@ -224,15 +250,15 @@ describe('UserManagement', () => {
224
250
  });
225
251
  describe('createPasswordResetChallenge', () => {
226
252
  it('sends a Create Password Reset Challenge request', () => __awaiter(void 0, void 0, void 0, function* () {
227
- mock.onPost(`/users/password_reset_challenge`).reply(200, {
253
+ mock.onPost(`/users/send_password_reset_email`).reply(200, {
228
254
  token: 'password-reset-token',
229
255
  user: user_json_1.default,
230
256
  });
231
- const resp = yield workos.users.createPasswordResetChallenge({
257
+ const resp = yield workos.users.sendPasswordResetEmail({
232
258
  email: 'test01@example.com',
233
259
  passwordResetUrl: 'https://example.com/forgot-password',
234
260
  });
235
- expect(mock.history.post[0].url).toEqual(`/users/password_reset_challenge`);
261
+ expect(mock.history.post[0].url).toEqual(`/users/send_password_reset_email`);
236
262
  expect(resp).toMatchObject({
237
263
  token: 'password-reset-token',
238
264
  user: {
@@ -243,13 +269,13 @@ describe('UserManagement', () => {
243
269
  });
244
270
  describe('completePasswordReset', () => {
245
271
  it('sends a completePasswordReset request', () => __awaiter(void 0, void 0, void 0, function* () {
246
- mock.onPost(`/users/password_reset`).reply(200, user_json_1.default);
247
- const resp = yield workos.users.completePasswordReset({
272
+ mock.onPost(`/users/password_reset`).reply(200, { user: user_json_1.default });
273
+ const resp = yield workos.users.resetPassword({
248
274
  token: '',
249
275
  newPassword: 'correct horse battery staple',
250
276
  });
251
277
  expect(mock.history.post[0].url).toEqual(`/users/password_reset`);
252
- expect(resp).toMatchObject({
278
+ expect(resp.user).toMatchObject({
253
279
  email: 'test01@example.com',
254
280
  });
255
281
  }));
@@ -332,8 +358,8 @@ describe('UserManagement', () => {
332
358
  });
333
359
  }));
334
360
  });
335
- describe('enrollUserInMfaFactor', () => {
336
- it('sends an enrollUserInMfaFactor request', () => __awaiter(void 0, void 0, void 0, function* () {
361
+ describe('enrollAuthFactor', () => {
362
+ it('sends an enrollAuthFactor request', () => __awaiter(void 0, void 0, void 0, function* () {
337
363
  mock.onPost(`/users/${userId}/auth/factors`).reply(200, {
338
364
  authentication_factor: {
339
365
  object: 'authentication_factor',
@@ -359,7 +385,7 @@ describe('UserManagement', () => {
359
385
  authentication_factor_id: 'auth_factor_1234',
360
386
  },
361
387
  });
362
- const resp = yield workos.users.enrollUserInMfaFactor({
388
+ const resp = yield workos.users.enrollAuthFactor({
363
389
  userId,
364
390
  type: 'totp',
365
391
  totpIssuer: 'WorkOS',
@@ -393,6 +419,36 @@ describe('UserManagement', () => {
393
419
  });
394
420
  }));
395
421
  });
422
+ describe('listAuthFactors', () => {
423
+ it('sends a listAuthFactors request', () => __awaiter(void 0, void 0, void 0, function* () {
424
+ mock.onGet(`/users/${userId}/auth/factors`).reply(200, list_factors_json_1.default);
425
+ const resp = yield workos.users.listAuthFactors({ userId });
426
+ expect(mock.history.get[0].url).toEqual(`/users/${userId}/auth/factors`);
427
+ expect(resp).toMatchObject({
428
+ object: 'list',
429
+ data: [
430
+ {
431
+ object: 'authentication_factor',
432
+ id: 'auth_factor_1234',
433
+ createdAt: '2022-03-15T20:39:19.892Z',
434
+ updatedAt: '2022-03-15T20:39:19.892Z',
435
+ type: 'totp',
436
+ totp: {
437
+ issuer: 'WorkOS',
438
+ qrCode: 'qr-code-test',
439
+ secret: 'secret-test',
440
+ uri: 'uri-test',
441
+ user: 'some_user',
442
+ },
443
+ },
444
+ ],
445
+ listMetadata: {
446
+ before: null,
447
+ after: null,
448
+ },
449
+ });
450
+ }));
451
+ });
396
452
  describe('deleteUser', () => {
397
453
  it('sends a deleteUser request', () => __awaiter(void 0, void 0, void 0, function* () {
398
454
  mock.onDelete(`/users/${userId}`).reply(200);
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 users_1 = require("./users/users");
29
29
  const bad_request_exception_1 = require("./common/exceptions/bad-request.exception");
30
- const VERSION = '3.6.0';
30
+ const VERSION = '3.7.0';
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": "3.6.0",
2
+ "version": "3.7.0",
3
3
  "name": "@workos-inc/node",
4
4
  "author": "WorkOS",
5
5
  "description": "A Node wrapper for the WorkOS API",
@@ -1,8 +0,0 @@
1
- export interface CompletePasswordResetOptions {
2
- token: string;
3
- newPassword: string;
4
- }
5
- export interface SerializedCompletePasswordResetOptions {
6
- token: string;
7
- new_password: string;
8
- }
@@ -1,3 +0,0 @@
1
- export interface MagicAuthChallenge {
2
- id: string;
3
- }
@@ -1,2 +0,0 @@
1
- import { AuthenticateUserWithCodeCredentials, AuthenticateUserWithCodeOptions, SerializedAuthenticateUserWithCodeOptions } from '../interfaces';
2
- export declare const serializeAuthenticateUserWithCodeOptions: (options: AuthenticateUserWithCodeOptions & AuthenticateUserWithCodeCredentials) => SerializedAuthenticateUserWithCodeOptions;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializeAuthenticateUserWithCodeOptions = void 0;
4
- const serializeAuthenticateUserWithCodeOptions = (options) => ({
5
- grant_type: 'authorization_code',
6
- client_id: options.clientId,
7
- client_secret: options.clientSecret,
8
- code: options.code,
9
- });
10
- exports.serializeAuthenticateUserWithCodeOptions = serializeAuthenticateUserWithCodeOptions;
@@ -1,2 +0,0 @@
1
- import { AuthenticateUserWithMagicAuthCredentials, AuthenticateUserWithMagicAuthOptions, SerializedAuthenticateUserWithMagicAuthOptions } from '../interfaces';
2
- export declare const serializeAuthenticateUserWithMagicAuthOptions: (options: AuthenticateUserWithMagicAuthOptions & AuthenticateUserWithMagicAuthCredentials) => SerializedAuthenticateUserWithMagicAuthOptions;
@@ -1,2 +0,0 @@
1
- import { AuthenticateUserWithPasswordCredentials, AuthenticateUserWithPasswordOptions, SerializedAuthenticateUserWithPasswordOptions } from '../interfaces';
2
- export declare const serializeAuthenticateUserWithPasswordOptions: (options: AuthenticateUserWithPasswordOptions & AuthenticateUserWithPasswordCredentials) => SerializedAuthenticateUserWithPasswordOptions;
@@ -1,2 +0,0 @@
1
- import { CompletePasswordResetOptions, SerializedCompletePasswordResetOptions } from '../interfaces';
2
- export declare const serializeCompletePasswordResetOptions: (options: CompletePasswordResetOptions) => SerializedCompletePasswordResetOptions;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializeCompletePasswordResetOptions = void 0;
4
- const serializeCompletePasswordResetOptions = (options) => ({
5
- token: options.token,
6
- new_password: options.newPassword,
7
- });
8
- exports.serializeCompletePasswordResetOptions = serializeCompletePasswordResetOptions;
@@ -1,3 +0,0 @@
1
- import { CreatePasswordResetChallengeOptions, CreatePasswordResetChallengeResponse, CreatePasswordResetChallengeResponseResponse, SerializedCreatePasswordResetChallengeOptions } from '../interfaces';
2
- export declare const deserializeCreatePasswordResetChallengeResponse: (createPasswordResetChallengeResponse: CreatePasswordResetChallengeResponseResponse) => CreatePasswordResetChallengeResponse;
3
- export declare const serializeCreatePasswordResetChallengeOptions: (options: CreatePasswordResetChallengeOptions) => SerializedCreatePasswordResetChallengeOptions;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializeCreatePasswordResetChallengeOptions = exports.deserializeCreatePasswordResetChallengeResponse = void 0;
4
- const user_serializer_1 = require("./user.serializer");
5
- const deserializeCreatePasswordResetChallengeResponse = (createPasswordResetChallengeResponse) => ({
6
- token: createPasswordResetChallengeResponse.token,
7
- user: (0, user_serializer_1.deserializeUser)(createPasswordResetChallengeResponse.user),
8
- });
9
- exports.deserializeCreatePasswordResetChallengeResponse = deserializeCreatePasswordResetChallengeResponse;
10
- const serializeCreatePasswordResetChallengeOptions = (options) => ({
11
- email: options.email,
12
- password_reset_url: options.passwordResetUrl,
13
- });
14
- exports.serializeCreatePasswordResetChallengeOptions = serializeCreatePasswordResetChallengeOptions;
@@ -1,2 +0,0 @@
1
- import { EnrollUserInMfaFactorOptions, SerializedEnrollUserInMfaFactorOptions } from '../interfaces';
2
- export declare const serializeEnrollUserInMfaFactorOptions: (options: EnrollUserInMfaFactorOptions) => SerializedEnrollUserInMfaFactorOptions;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializeEnrollUserInMfaFactorOptions = void 0;
4
- const serializeEnrollUserInMfaFactorOptions = (options) => ({
5
- type: options.type,
6
- totp_issuer: options.totpIssuer,
7
- totp_user: options.totpUser,
8
- });
9
- exports.serializeEnrollUserInMfaFactorOptions = serializeEnrollUserInMfaFactorOptions;