@tbs-fitness/contract 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -43,6 +43,10 @@ const result = createFlagSchema.safeParse(input); // The same rules as the API.
|
|
|
43
43
|
|
|
44
44
|
Requests have two types. Clients use `*Input`, where fields with a default are optional. The backend uses `*Body`, which is the result after validation. List queries come from the URL as strings, so they have no `*Input`: use `Partial<PaginationQuery>` or `Partial<AuditLogQuery>`.
|
|
45
45
|
|
|
46
|
+
## Version 0.8.0 (breaking)
|
|
47
|
+
|
|
48
|
+
- `newPasswordSchema` now matches the new-password screens: at least 8 characters (was 12) and at least one number. `MIN_PASSWORD_LENGTH` is `8`, and the new `PASSWORD_DIGIT_PATTERN` lets apps show the number rule as it is typed. Sign-up, password change and reset all use it; login does not, so existing passwords keep working.
|
|
49
|
+
|
|
46
50
|
## Version 0.7.0
|
|
47
51
|
|
|
48
52
|
Permission names, CSRF names and the client feature-flag response. Additive; consumers install `^0.7.0` explicitly.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const MIN_PASSWORD_LENGTH =
|
|
2
|
+
export declare const MIN_PASSWORD_LENGTH = 8;
|
|
3
3
|
export declare const MAX_PASSWORD_LENGTH = 128;
|
|
4
|
+
/** A new password must contain at least one character that matches this. */
|
|
5
|
+
export declare const PASSWORD_DIGIT_PATTERN: RegExp;
|
|
4
6
|
/** Every one-time code the API sends has this many digits. */
|
|
5
7
|
export declare const OTP_LENGTH = 6;
|
|
6
8
|
export declare const otpCodeSchema: z.ZodString;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.revokedSessionsResponseSchema = exports.adminAccountResponseSchema = exports.passwordResetRequestedResponseSchema = exports.logoutAllResponseSchema = exports.sessionResponseSchema = exports.loginResponseSchema = exports.accountResponseSchema = exports.updateTimezoneSchema = exports.timezonePreferenceSchema = exports.tokenResponseSchema = exports.idParamSchema = exports.setStatusSchema = exports.setRoleSchema = exports.passwordResetConfirmSchema = exports.passwordResetRequestSchema = exports.changePasswordSchema = exports.refreshSchema = exports.loginSchema = exports.opaqueTokenSchema = exports.submittedPasswordSchema = exports.newPasswordSchema = exports.otpCodeSchema = exports.OTP_LENGTH = exports.MAX_PASSWORD_LENGTH = exports.MIN_PASSWORD_LENGTH = void 0;
|
|
3
|
+
exports.revokedSessionsResponseSchema = exports.adminAccountResponseSchema = exports.passwordResetRequestedResponseSchema = exports.logoutAllResponseSchema = exports.sessionResponseSchema = exports.loginResponseSchema = exports.accountResponseSchema = exports.updateTimezoneSchema = exports.timezonePreferenceSchema = exports.tokenResponseSchema = exports.idParamSchema = exports.setStatusSchema = exports.setRoleSchema = exports.passwordResetConfirmSchema = exports.passwordResetRequestSchema = exports.changePasswordSchema = exports.refreshSchema = exports.loginSchema = exports.opaqueTokenSchema = exports.submittedPasswordSchema = exports.newPasswordSchema = exports.otpCodeSchema = exports.OTP_LENGTH = exports.PASSWORD_DIGIT_PATTERN = exports.MAX_PASSWORD_LENGTH = exports.MIN_PASSWORD_LENGTH = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const contact_schema_js_1 = require("../common/contact.schema.js");
|
|
6
6
|
const date_time_schema_js_1 = require("../common/date-time.schema.js");
|
|
7
7
|
const safe_text_schema_js_1 = require("../common/safe-text.schema.js");
|
|
8
8
|
const index_js_1 = require("../enums/index.js");
|
|
9
|
-
//
|
|
10
|
-
// stops very long inputs from being used to exhaust the hashing function.
|
|
11
|
-
exports.MIN_PASSWORD_LENGTH =
|
|
9
|
+
// The product's new-password rules: at least 8 characters and one number. The
|
|
10
|
+
// upper limit stops very long inputs from being used to exhaust the hashing function.
|
|
11
|
+
exports.MIN_PASSWORD_LENGTH = 8;
|
|
12
12
|
exports.MAX_PASSWORD_LENGTH = 128;
|
|
13
|
+
/** A new password must contain at least one character that matches this. */
|
|
14
|
+
exports.PASSWORD_DIGIT_PATTERN = /\d/;
|
|
13
15
|
const MAX_OPAQUE_TOKEN_LENGTH = 512;
|
|
14
16
|
/** Every one-time code the API sends has this many digits. */
|
|
15
17
|
exports.OTP_LENGTH = 6;
|
|
@@ -22,7 +24,8 @@ exports.otpCodeSchema = zod_1.z
|
|
|
22
24
|
exports.newPasswordSchema = zod_1.z
|
|
23
25
|
.string()
|
|
24
26
|
.min(exports.MIN_PASSWORD_LENGTH)
|
|
25
|
-
.max(exports.MAX_PASSWORD_LENGTH)
|
|
27
|
+
.max(exports.MAX_PASSWORD_LENGTH)
|
|
28
|
+
.regex(exports.PASSWORD_DIGIT_PATTERN, { error: 'Include at least one number' });
|
|
26
29
|
/** No minimum at login, so an old short password fails like any wrong password. */
|
|
27
30
|
exports.submittedPasswordSchema = zod_1.z
|
|
28
31
|
.string()
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const MIN_PASSWORD_LENGTH =
|
|
2
|
+
export declare const MIN_PASSWORD_LENGTH = 8;
|
|
3
3
|
export declare const MAX_PASSWORD_LENGTH = 128;
|
|
4
|
+
/** A new password must contain at least one character that matches this. */
|
|
5
|
+
export declare const PASSWORD_DIGIT_PATTERN: RegExp;
|
|
4
6
|
/** Every one-time code the API sends has this many digits. */
|
|
5
7
|
export declare const OTP_LENGTH = 6;
|
|
6
8
|
export declare const otpCodeSchema: z.ZodString;
|
|
@@ -3,10 +3,12 @@ import { emailSchema } from '../common/contact.schema.js';
|
|
|
3
3
|
import { timezoneSchema, utcTimestampSchema, } from '../common/date-time.schema.js';
|
|
4
4
|
import { safeTextSchema } from '../common/safe-text.schema.js';
|
|
5
5
|
import { ACCOUNT_STATUSES, ADMIN_SETTABLE_ACCOUNT_STATUSES, ROLES, TIMEZONE_SOURCES, TOKEN_TRANSPORTS, } from '../enums/index.js';
|
|
6
|
-
//
|
|
7
|
-
// stops very long inputs from being used to exhaust the hashing function.
|
|
8
|
-
export const MIN_PASSWORD_LENGTH =
|
|
6
|
+
// The product's new-password rules: at least 8 characters and one number. The
|
|
7
|
+
// upper limit stops very long inputs from being used to exhaust the hashing function.
|
|
8
|
+
export const MIN_PASSWORD_LENGTH = 8;
|
|
9
9
|
export const MAX_PASSWORD_LENGTH = 128;
|
|
10
|
+
/** A new password must contain at least one character that matches this. */
|
|
11
|
+
export const PASSWORD_DIGIT_PATTERN = /\d/;
|
|
10
12
|
const MAX_OPAQUE_TOKEN_LENGTH = 512;
|
|
11
13
|
/** Every one-time code the API sends has this many digits. */
|
|
12
14
|
export const OTP_LENGTH = 6;
|
|
@@ -19,7 +21,8 @@ export const otpCodeSchema = z
|
|
|
19
21
|
export const newPasswordSchema = z
|
|
20
22
|
.string()
|
|
21
23
|
.min(MIN_PASSWORD_LENGTH)
|
|
22
|
-
.max(MAX_PASSWORD_LENGTH)
|
|
24
|
+
.max(MAX_PASSWORD_LENGTH)
|
|
25
|
+
.regex(PASSWORD_DIGIT_PATTERN, { error: 'Include at least one number' });
|
|
23
26
|
/** No minimum at login, so an old short password fails like any wrong password. */
|
|
24
27
|
export const submittedPasswordSchema = z
|
|
25
28
|
.string()
|
package/package.json
CHANGED