@jskit-ai/auth-core 0.1.54 → 0.1.55

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,12 +1,12 @@
1
- import { Type } from "typebox";
2
- import { normalizeObjectInput } from "../inputNormalization.js";
1
+ import { createSchema } from "json-rest-schema";
2
+ import { deepFreeze } from "@jskit-ai/kernel/shared/support/deepFreeze";
3
3
  import {
4
- authAccessTokenValidator,
5
- authRecoveryTokenValidator,
6
- authRefreshTokenValidator,
4
+ authAccessTokenFieldDefinition,
5
+ authRecoveryTokenFieldDefinition,
6
+ authRefreshTokenFieldDefinition,
7
7
  createCommandMessages,
8
- oauthCompleteResponseValidator,
9
- oauthProviderValidator
8
+ oauthCompleteOutputValidator,
9
+ oauthProviderFieldDefinition
10
10
  } from "./authCommandValidators.js";
11
11
 
12
12
  const AUTH_LOGIN_OAUTH_COMPLETE_MESSAGES = createCommandMessages({
@@ -27,41 +27,36 @@ const AUTH_LOGIN_OAUTH_COMPLETE_MESSAGES = createCommandMessages({
27
27
  }
28
28
  });
29
29
 
30
- const authLoginOAuthCompleteBodyValidator = Object.freeze({
31
- schema: Type.Object(
32
- {
33
- provider: Type.Optional(oauthProviderValidator.schema),
34
- code: Type.Optional(authRecoveryTokenValidator.schema),
35
- accessToken: Type.Optional(authAccessTokenValidator.schema),
36
- refreshToken: Type.Optional(authRefreshTokenValidator.schema),
37
- error: Type.Optional(Type.String({ minLength: 1, maxLength: 128 })),
38
- errorDescription: Type.Optional(Type.String({ minLength: 1, maxLength: 1024 })),
39
- error_code: Type.Optional(Type.String({ minLength: 1, maxLength: 128 })),
40
- error_description: Type.Optional(Type.String({ minLength: 1, maxLength: 1024 }))
41
- },
42
- {
43
- additionalProperties: false
44
- }
45
- ),
46
- normalize: normalizeObjectInput,
30
+ const authLoginOAuthCompleteBodyValidator = deepFreeze({
31
+ schema: createSchema({
32
+ provider: { ...oauthProviderFieldDefinition, required: false },
33
+ code: { ...authRecoveryTokenFieldDefinition, required: false },
34
+ accessToken: { ...authAccessTokenFieldDefinition, required: false },
35
+ refreshToken: { ...authRefreshTokenFieldDefinition, required: false },
36
+ error: { type: "string", required: false, minLength: 1, maxLength: 128 },
37
+ errorDescription: { type: "string", required: false, minLength: 1, maxLength: 1024 },
38
+ error_code: { type: "string", required: false, minLength: 1, maxLength: 128 },
39
+ error_description: { type: "string", required: false, minLength: 1, maxLength: 1024 }
40
+ }),
41
+ mode: "patch",
47
42
  messages: AUTH_LOGIN_OAUTH_COMPLETE_MESSAGES
48
43
  });
49
44
 
50
- const authLoginOAuthCompleteCommand = Object.freeze({
45
+ const authLoginOAuthCompleteCommand = deepFreeze({
51
46
  command: "auth.login.oauth.complete",
52
- operation: Object.freeze({
47
+ operation: {
53
48
  method: "POST",
54
- bodyValidator: authLoginOAuthCompleteBodyValidator,
55
- responseValidator: oauthCompleteResponseValidator,
49
+ body: authLoginOAuthCompleteBodyValidator,
50
+ response: oauthCompleteOutputValidator,
56
51
  messages: AUTH_LOGIN_OAUTH_COMPLETE_MESSAGES,
57
52
  idempotent: false,
58
- invalidates: Object.freeze(["auth.session.read"])
59
- })
53
+ invalidates: ["auth.session.read"]
54
+ }
60
55
  });
61
56
 
62
57
  export {
63
58
  authLoginOAuthCompleteBodyValidator,
64
- oauthCompleteResponseValidator,
59
+ oauthCompleteOutputValidator,
65
60
  AUTH_LOGIN_OAUTH_COMPLETE_MESSAGES,
66
61
  authLoginOAuthCompleteCommand
67
62
  };
@@ -1,9 +1,9 @@
1
- import { Type } from "typebox";
2
- import { normalizeObjectInput } from "../inputNormalization.js";
1
+ import { createSchema } from "json-rest-schema";
2
+ import { deepFreeze } from "@jskit-ai/kernel/shared/support/deepFreeze";
3
3
  import {
4
4
  createCommandMessages,
5
- oauthProviderValidator,
6
- oauthReturnToValidator
5
+ oauthProviderFieldDefinition,
6
+ oauthReturnToFieldDefinition
7
7
  } from "./authCommandValidators.js";
8
8
 
9
9
  const AUTH_LOGIN_OAUTH_START_MESSAGES = createCommandMessages({
@@ -20,53 +20,48 @@ const AUTH_LOGIN_OAUTH_START_MESSAGES = createCommandMessages({
20
20
  }
21
21
  });
22
22
 
23
- const authLoginOAuthStartParamsValidator = Object.freeze({
24
- schema: Type.Object(
25
- {
26
- provider: oauthProviderValidator.schema
27
- },
28
- {
29
- additionalProperties: false
30
- }
31
- ),
32
- normalize: normalizeObjectInput,
23
+ const authLoginOAuthStartParamsValidator = deepFreeze({
24
+ schema: createSchema({
25
+ provider: { ...oauthProviderFieldDefinition, required: true }
26
+ }),
27
+ mode: "patch",
33
28
  messages: AUTH_LOGIN_OAUTH_START_MESSAGES
34
29
  });
35
30
 
36
- const authLoginOAuthStartQueryValidator = Object.freeze({
37
- schema: Type.Object(
38
- {
39
- returnTo: Type.Optional(oauthReturnToValidator.schema)
40
- },
41
- {
42
- additionalProperties: false
43
- }
44
- ),
45
- normalize: normalizeObjectInput,
31
+ const authLoginOAuthStartQueryValidator = deepFreeze({
32
+ schema: createSchema({
33
+ returnTo: { ...oauthReturnToFieldDefinition, required: false }
34
+ }),
35
+ mode: "patch",
46
36
  messages: AUTH_LOGIN_OAUTH_START_MESSAGES
47
37
  });
48
38
 
49
- const authLoginOAuthStartResponseValidator = Object.freeze({
50
- schema: Type.Unknown()
39
+ const authLoginOAuthStartOutputValidator = deepFreeze({
40
+ schema: createSchema({
41
+ provider: { ...oauthProviderFieldDefinition, required: true },
42
+ returnTo: { ...oauthReturnToFieldDefinition, required: true },
43
+ url: { type: "string", required: true, minLength: 1, maxLength: 4096 }
44
+ }),
45
+ mode: "replace"
51
46
  });
52
47
 
53
- const authLoginOAuthStartCommand = Object.freeze({
48
+ const authLoginOAuthStartCommand = deepFreeze({
54
49
  command: "auth.login.oauth.start",
55
- operation: Object.freeze({
50
+ operation: {
56
51
  method: "GET",
57
- paramsValidator: authLoginOAuthStartParamsValidator,
58
- queryValidator: authLoginOAuthStartQueryValidator,
59
- responseValidator: authLoginOAuthStartResponseValidator,
52
+ params: authLoginOAuthStartParamsValidator,
53
+ query: authLoginOAuthStartQueryValidator,
54
+ response: authLoginOAuthStartOutputValidator,
60
55
  messages: AUTH_LOGIN_OAUTH_START_MESSAGES,
61
56
  idempotent: true,
62
- invalidates: Object.freeze([])
63
- })
57
+ invalidates: []
58
+ }
64
59
  });
65
60
 
66
61
  export {
67
62
  authLoginOAuthStartParamsValidator,
68
63
  authLoginOAuthStartQueryValidator,
69
- authLoginOAuthStartResponseValidator,
64
+ authLoginOAuthStartOutputValidator,
70
65
  AUTH_LOGIN_OAUTH_START_MESSAGES,
71
66
  authLoginOAuthStartCommand
72
67
  };
@@ -1,10 +1,10 @@
1
- import { Type } from "typebox";
2
- import { normalizeObjectInput } from "../inputNormalization.js";
1
+ import { createSchema } from "json-rest-schema";
2
+ import { deepFreeze } from "@jskit-ai/kernel/shared/support/deepFreeze";
3
3
  import {
4
- authEmailValidator,
4
+ authEmailFieldDefinition,
5
5
  createCommandMessages,
6
- oauthReturnToValidator,
7
- okMessageResponseValidator
6
+ oauthReturnToFieldDefinition,
7
+ okMessageOutputValidator
8
8
  } from "./authCommandValidators.js";
9
9
 
10
10
  const AUTH_LOGIN_OTP_REQUEST_MESSAGES = createCommandMessages({
@@ -22,35 +22,30 @@ const AUTH_LOGIN_OTP_REQUEST_MESSAGES = createCommandMessages({
22
22
  }
23
23
  });
24
24
 
25
- const authLoginOtpRequestBodyValidator = Object.freeze({
26
- schema: Type.Object(
27
- {
28
- email: authEmailValidator.schema,
29
- returnTo: Type.Optional(oauthReturnToValidator.schema)
30
- },
31
- {
32
- additionalProperties: false
33
- }
34
- ),
35
- normalize: normalizeObjectInput,
25
+ const authLoginOtpRequestBodyValidator = deepFreeze({
26
+ schema: createSchema({
27
+ email: { ...authEmailFieldDefinition, required: true },
28
+ returnTo: { ...oauthReturnToFieldDefinition, required: false }
29
+ }),
30
+ mode: "create",
36
31
  messages: AUTH_LOGIN_OTP_REQUEST_MESSAGES
37
32
  });
38
33
 
39
- const authLoginOtpRequestCommand = Object.freeze({
34
+ const authLoginOtpRequestCommand = deepFreeze({
40
35
  command: "auth.login.otp.request",
41
- operation: Object.freeze({
36
+ operation: {
42
37
  method: "POST",
43
- bodyValidator: authLoginOtpRequestBodyValidator,
44
- responseValidator: okMessageResponseValidator,
38
+ body: authLoginOtpRequestBodyValidator,
39
+ response: okMessageOutputValidator,
45
40
  messages: AUTH_LOGIN_OTP_REQUEST_MESSAGES,
46
41
  idempotent: false,
47
- invalidates: Object.freeze([])
48
- })
42
+ invalidates: []
43
+ }
49
44
  });
50
45
 
51
46
  export {
52
47
  authLoginOtpRequestBodyValidator,
53
- okMessageResponseValidator,
48
+ okMessageOutputValidator,
54
49
  AUTH_LOGIN_OTP_REQUEST_MESSAGES,
55
50
  authLoginOtpRequestCommand
56
51
  };
@@ -1,10 +1,10 @@
1
- import { Type } from "typebox";
2
- import { normalizeObjectInput } from "../inputNormalization.js";
1
+ import { createSchema } from "json-rest-schema";
2
+ import { deepFreeze } from "@jskit-ai/kernel/shared/support/deepFreeze";
3
3
  import {
4
4
  authEmailValidator,
5
5
  authRecoveryTokenValidator,
6
6
  createCommandMessages,
7
- otpVerifyResponseValidator
7
+ otpVerifyOutputValidator
8
8
  } from "./authCommandValidators.js";
9
9
 
10
10
  const AUTH_LOGIN_OTP_VERIFY_MESSAGES = createCommandMessages({
@@ -27,38 +27,45 @@ const AUTH_LOGIN_OTP_VERIFY_MESSAGES = createCommandMessages({
27
27
  }
28
28
  });
29
29
 
30
- const authLoginOtpVerifyBodyValidator = Object.freeze({
31
- schema: Type.Object(
32
- {
33
- email: Type.Optional(authEmailValidator.schema),
34
- token: Type.Optional(authRecoveryTokenValidator.schema),
35
- tokenHash: Type.Optional(authRecoveryTokenValidator.schema),
36
- type: Type.Optional(Type.Literal("email"))
30
+ const authLoginOtpVerifyBodyValidator = deepFreeze({
31
+ schema: createSchema({
32
+ email: {
33
+ ...authEmailValidator,
34
+ required: false
35
+ },
36
+ token: {
37
+ ...authRecoveryTokenValidator,
38
+ required: false
37
39
  },
38
- {
39
- additionalProperties: false,
40
- minProperties: 1
40
+ tokenHash: {
41
+ ...authRecoveryTokenValidator,
42
+ required: false
43
+ },
44
+ type: {
45
+ type: "string",
46
+ required: false,
47
+ enum: ["email"]
41
48
  }
42
- ),
43
- normalize: normalizeObjectInput,
49
+ }),
50
+ mode: "patch",
44
51
  messages: AUTH_LOGIN_OTP_VERIFY_MESSAGES
45
52
  });
46
53
 
47
- const authLoginOtpVerifyCommand = Object.freeze({
54
+ const authLoginOtpVerifyCommand = deepFreeze({
48
55
  command: "auth.login.otp.verify",
49
- operation: Object.freeze({
56
+ operation: {
50
57
  method: "POST",
51
- bodyValidator: authLoginOtpVerifyBodyValidator,
52
- responseValidator: otpVerifyResponseValidator,
58
+ body: authLoginOtpVerifyBodyValidator,
59
+ response: otpVerifyOutputValidator,
53
60
  messages: AUTH_LOGIN_OTP_VERIFY_MESSAGES,
54
61
  idempotent: false,
55
- invalidates: Object.freeze(["auth.session.read"])
56
- })
62
+ invalidates: ["auth.session.read"]
63
+ }
57
64
  });
58
65
 
59
66
  export {
60
67
  authLoginOtpVerifyBodyValidator,
61
- otpVerifyResponseValidator,
68
+ otpVerifyOutputValidator,
62
69
  AUTH_LOGIN_OTP_VERIFY_MESSAGES,
63
70
  authLoginOtpVerifyCommand
64
71
  };
@@ -1,10 +1,10 @@
1
- import { Type } from "typebox";
2
- import { normalizeObjectInput } from "../inputNormalization.js";
1
+ import { createSchema } from "json-rest-schema";
2
+ import { deepFreeze } from "@jskit-ai/kernel/shared/support/deepFreeze";
3
3
  import {
4
- authEmailValidator,
5
- authLoginPasswordValidator,
4
+ authEmailFieldDefinition,
5
+ authLoginPasswordFieldDefinition,
6
6
  createCommandMessages,
7
- loginResponseValidator
7
+ loginOutputValidator
8
8
  } from "./authCommandValidators.js";
9
9
 
10
10
  const AUTH_LOGIN_PASSWORD_MESSAGES = createCommandMessages({
@@ -23,35 +23,30 @@ const AUTH_LOGIN_PASSWORD_MESSAGES = createCommandMessages({
23
23
  }
24
24
  });
25
25
 
26
- const authLoginPasswordBodyValidator = Object.freeze({
27
- schema: Type.Object(
28
- {
29
- email: authEmailValidator.schema,
30
- password: authLoginPasswordValidator.schema
31
- },
32
- {
33
- additionalProperties: false
34
- }
35
- ),
36
- normalize: normalizeObjectInput,
26
+ const authLoginPasswordBodyValidator = deepFreeze({
27
+ schema: createSchema({
28
+ email: { ...authEmailFieldDefinition, required: true },
29
+ password: { ...authLoginPasswordFieldDefinition, required: true }
30
+ }),
31
+ mode: "create",
37
32
  messages: AUTH_LOGIN_PASSWORD_MESSAGES
38
33
  });
39
34
 
40
- const authLoginPasswordCommand = Object.freeze({
35
+ const authLoginPasswordCommand = deepFreeze({
41
36
  command: "auth.login.password",
42
- operation: Object.freeze({
37
+ operation: {
43
38
  method: "POST",
44
- bodyValidator: authLoginPasswordBodyValidator,
45
- responseValidator: loginResponseValidator,
39
+ body: authLoginPasswordBodyValidator,
40
+ response: loginOutputValidator,
46
41
  messages: AUTH_LOGIN_PASSWORD_MESSAGES,
47
42
  idempotent: false,
48
- invalidates: Object.freeze(["auth.session.read"])
49
- })
43
+ invalidates: ["auth.session.read"]
44
+ }
50
45
  });
51
46
 
52
47
  export {
53
48
  authLoginPasswordBodyValidator,
54
- loginResponseValidator,
49
+ loginOutputValidator,
55
50
  AUTH_LOGIN_PASSWORD_MESSAGES,
56
51
  authLoginPasswordCommand
57
52
  };
@@ -1,23 +1,24 @@
1
1
  import {
2
2
  createCommandMessages,
3
- logoutResponseValidator
3
+ logoutOutputValidator
4
4
  } from "./authCommandValidators.js";
5
+ import { deepFreeze } from "@jskit-ai/kernel/shared/support/deepFreeze";
5
6
 
6
7
  const AUTH_LOGOUT_MESSAGES = createCommandMessages();
7
8
 
8
- const authLogoutCommand = Object.freeze({
9
+ const authLogoutCommand = deepFreeze({
9
10
  command: "auth.logout",
10
- operation: Object.freeze({
11
+ operation: {
11
12
  method: "POST",
12
- responseValidator: logoutResponseValidator,
13
+ response: logoutOutputValidator,
13
14
  messages: AUTH_LOGOUT_MESSAGES,
14
15
  idempotent: false,
15
- invalidates: Object.freeze(["auth.session.read"])
16
- })
16
+ invalidates: ["auth.session.read"]
17
+ }
17
18
  });
18
19
 
19
20
  export {
20
- logoutResponseValidator,
21
+ logoutOutputValidator,
21
22
  AUTH_LOGOUT_MESSAGES,
22
23
  authLogoutCommand
23
24
  };
@@ -1,11 +1,11 @@
1
- import { Type } from "typebox";
2
- import { normalizeObjectInput } from "../inputNormalization.js";
1
+ import { createSchema } from "json-rest-schema";
2
+ import { deepFreeze } from "@jskit-ai/kernel/shared/support/deepFreeze";
3
3
  import {
4
4
  authAccessTokenValidator,
5
5
  authRecoveryTokenValidator,
6
6
  authRefreshTokenValidator,
7
7
  createCommandMessages,
8
- okResponseValidator
8
+ okOutputValidator
9
9
  } from "./authCommandValidators.js";
10
10
 
11
11
  const AUTH_PASSWORD_RECOVERY_COMPLETE_MESSAGES = createCommandMessages({
@@ -29,39 +29,49 @@ const AUTH_PASSWORD_RECOVERY_COMPLETE_MESSAGES = createCommandMessages({
29
29
  }
30
30
  });
31
31
 
32
- const authPasswordRecoveryCompleteBodyValidator = Object.freeze({
33
- schema: Type.Object(
34
- {
35
- code: Type.Optional(authRecoveryTokenValidator.schema),
36
- tokenHash: Type.Optional(authRecoveryTokenValidator.schema),
37
- accessToken: Type.Optional(authAccessTokenValidator.schema),
38
- refreshToken: Type.Optional(authRefreshTokenValidator.schema),
39
- type: Type.Optional(Type.Literal("recovery"))
32
+ const authPasswordRecoveryCompleteBodyValidator = deepFreeze({
33
+ schema: createSchema({
34
+ code: {
35
+ ...authRecoveryTokenValidator,
36
+ required: false
37
+ },
38
+ tokenHash: {
39
+ ...authRecoveryTokenValidator,
40
+ required: false
41
+ },
42
+ accessToken: {
43
+ ...authAccessTokenValidator,
44
+ required: false
40
45
  },
41
- {
42
- additionalProperties: false,
43
- minProperties: 1
46
+ refreshToken: {
47
+ ...authRefreshTokenValidator,
48
+ required: false
49
+ },
50
+ type: {
51
+ type: "string",
52
+ required: false,
53
+ enum: ["recovery"]
44
54
  }
45
- ),
46
- normalize: normalizeObjectInput,
55
+ }),
56
+ mode: "patch",
47
57
  messages: AUTH_PASSWORD_RECOVERY_COMPLETE_MESSAGES
48
58
  });
49
59
 
50
- const authPasswordRecoveryCompleteCommand = Object.freeze({
60
+ const authPasswordRecoveryCompleteCommand = deepFreeze({
51
61
  command: "auth.password.recovery.complete",
52
- operation: Object.freeze({
62
+ operation: {
53
63
  method: "POST",
54
- bodyValidator: authPasswordRecoveryCompleteBodyValidator,
55
- responseValidator: okResponseValidator,
64
+ body: authPasswordRecoveryCompleteBodyValidator,
65
+ response: okOutputValidator,
56
66
  messages: AUTH_PASSWORD_RECOVERY_COMPLETE_MESSAGES,
57
67
  idempotent: false,
58
- invalidates: Object.freeze(["auth.session.read"])
59
- })
68
+ invalidates: ["auth.session.read"]
69
+ }
60
70
  });
61
71
 
62
72
  export {
63
73
  authPasswordRecoveryCompleteBodyValidator,
64
- okResponseValidator,
74
+ okOutputValidator,
65
75
  AUTH_PASSWORD_RECOVERY_COMPLETE_MESSAGES,
66
76
  authPasswordRecoveryCompleteCommand
67
77
  };
@@ -1,9 +1,9 @@
1
- import { Type } from "typebox";
2
- import { normalizeObjectInput } from "../inputNormalization.js";
1
+ import { createSchema } from "json-rest-schema";
2
+ import { deepFreeze } from "@jskit-ai/kernel/shared/support/deepFreeze";
3
3
  import {
4
- authPasswordValidator,
4
+ authPasswordFieldDefinition,
5
5
  createCommandMessages,
6
- okMessageResponseValidator
6
+ okMessageOutputValidator
7
7
  } from "./authCommandValidators.js";
8
8
 
9
9
  const AUTH_PASSWORD_RESET_MESSAGES = createCommandMessages({
@@ -16,34 +16,29 @@ const AUTH_PASSWORD_RESET_MESSAGES = createCommandMessages({
16
16
  }
17
17
  });
18
18
 
19
- const authPasswordResetBodyValidator = Object.freeze({
20
- schema: Type.Object(
21
- {
22
- password: authPasswordValidator.schema
23
- },
24
- {
25
- additionalProperties: false
26
- }
27
- ),
28
- normalize: normalizeObjectInput,
19
+ const authPasswordResetBodyValidator = deepFreeze({
20
+ schema: createSchema({
21
+ password: { ...authPasswordFieldDefinition, required: true }
22
+ }),
23
+ mode: "create",
29
24
  messages: AUTH_PASSWORD_RESET_MESSAGES
30
25
  });
31
26
 
32
- const authPasswordResetCommand = Object.freeze({
27
+ const authPasswordResetCommand = deepFreeze({
33
28
  command: "auth.password.reset",
34
- operation: Object.freeze({
29
+ operation: {
35
30
  method: "POST",
36
- bodyValidator: authPasswordResetBodyValidator,
37
- responseValidator: okMessageResponseValidator,
31
+ body: authPasswordResetBodyValidator,
32
+ response: okMessageOutputValidator,
38
33
  messages: AUTH_PASSWORD_RESET_MESSAGES,
39
34
  idempotent: false,
40
- invalidates: Object.freeze(["auth.session.read"])
41
- })
35
+ invalidates: ["auth.session.read"]
36
+ }
42
37
  });
43
38
 
44
39
  export {
45
40
  authPasswordResetBodyValidator,
46
- okMessageResponseValidator,
41
+ okMessageOutputValidator,
47
42
  AUTH_PASSWORD_RESET_MESSAGES,
48
43
  authPasswordResetCommand
49
44
  };
@@ -1,9 +1,9 @@
1
- import { Type } from "typebox";
2
- import { normalizeObjectInput } from "../inputNormalization.js";
1
+ import { createSchema } from "json-rest-schema";
2
+ import { deepFreeze } from "@jskit-ai/kernel/shared/support/deepFreeze";
3
3
  import {
4
- authEmailValidator,
4
+ authEmailFieldDefinition,
5
5
  createCommandMessages,
6
- okMessageResponseValidator
6
+ okMessageOutputValidator
7
7
  } from "./authCommandValidators.js";
8
8
 
9
9
  const AUTH_PASSWORD_RESET_REQUEST_MESSAGES = createCommandMessages({
@@ -17,34 +17,29 @@ const AUTH_PASSWORD_RESET_REQUEST_MESSAGES = createCommandMessages({
17
17
  }
18
18
  });
19
19
 
20
- const authPasswordResetRequestBodyValidator = Object.freeze({
21
- schema: Type.Object(
22
- {
23
- email: authEmailValidator.schema
24
- },
25
- {
26
- additionalProperties: false
27
- }
28
- ),
29
- normalize: normalizeObjectInput,
20
+ const authPasswordResetRequestBodyValidator = deepFreeze({
21
+ schema: createSchema({
22
+ email: { ...authEmailFieldDefinition, required: true }
23
+ }),
24
+ mode: "create",
30
25
  messages: AUTH_PASSWORD_RESET_REQUEST_MESSAGES
31
26
  });
32
27
 
33
- const authPasswordResetRequestCommand = Object.freeze({
28
+ const authPasswordResetRequestCommand = deepFreeze({
34
29
  command: "auth.password.reset.request",
35
- operation: Object.freeze({
30
+ operation: {
36
31
  method: "POST",
37
- bodyValidator: authPasswordResetRequestBodyValidator,
38
- responseValidator: okMessageResponseValidator,
32
+ body: authPasswordResetRequestBodyValidator,
33
+ response: okMessageOutputValidator,
39
34
  messages: AUTH_PASSWORD_RESET_REQUEST_MESSAGES,
40
35
  idempotent: false,
41
- invalidates: Object.freeze([])
42
- })
36
+ invalidates: []
37
+ }
43
38
  });
44
39
 
45
40
  export {
46
41
  authPasswordResetRequestBodyValidator,
47
- okMessageResponseValidator,
42
+ okMessageOutputValidator,
48
43
  AUTH_PASSWORD_RESET_REQUEST_MESSAGES,
49
44
  authPasswordResetRequestCommand
50
45
  };