volleyballsimtypes 0.0.369 → 0.0.372
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/dist/cjs/src/data/models/user-settings.d.ts +2 -0
- package/dist/cjs/src/data/models/user-settings.js +5 -0
- package/dist/cjs/src/service/team/index.d.ts +1 -0
- package/dist/cjs/src/service/team/index.js +1 -0
- package/dist/cjs/src/service/team/team-name.d.ts +15 -0
- package/dist/cjs/src/service/team/team-name.js +29 -0
- package/dist/esm/src/data/models/user-settings.d.ts +2 -0
- package/dist/esm/src/data/models/user-settings.js +5 -0
- package/dist/esm/src/service/team/index.d.ts +1 -0
- package/dist/esm/src/service/team/index.js +1 -0
- package/dist/esm/src/service/team/team-name.d.ts +15 -0
- package/dist/esm/src/service/team/team-name.js +24 -0
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ export type AutoDismissSettings = Record<string, AutoDismissRarityConfig>;
|
|
|
9
9
|
export interface UserSettingsAttributes {
|
|
10
10
|
user_id: string;
|
|
11
11
|
auto_dismiss: AutoDismissSettings;
|
|
12
|
+
locale: string | null;
|
|
12
13
|
}
|
|
13
14
|
export type UserSettingsPk = 'user_id';
|
|
14
15
|
export type UserSettingsId = UserSettingsModel[UserSettingsPk];
|
|
@@ -16,6 +17,7 @@ export type UserSettingsCreationAttributes = UserSettingsAttributes;
|
|
|
16
17
|
export declare class UserSettingsModel extends Model<UserSettingsAttributes, UserSettingsCreationAttributes> implements UserSettingsAttributes {
|
|
17
18
|
user_id: string;
|
|
18
19
|
auto_dismiss: AutoDismissSettings;
|
|
20
|
+
locale: string | null;
|
|
19
21
|
user: AuthUserModel;
|
|
20
22
|
getUser: Sequelize.BelongsToGetAssociationMixin<AuthUserModel>;
|
|
21
23
|
setUser: Sequelize.BelongsToSetAssociationMixin<AuthUserModel, AuthUserId>;
|
|
@@ -18,6 +18,11 @@ class UserSettingsModel extends sequelize_1.Model {
|
|
|
18
18
|
type: sequelize_1.DataTypes.JSONB,
|
|
19
19
|
allowNull: false,
|
|
20
20
|
defaultValue: {}
|
|
21
|
+
},
|
|
22
|
+
locale: {
|
|
23
|
+
type: sequelize_1.DataTypes.STRING(8),
|
|
24
|
+
allowNull: true,
|
|
25
|
+
defaultValue: null
|
|
21
26
|
}
|
|
22
27
|
}, {
|
|
23
28
|
sequelize,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const TEAM_NAME_MIN_LENGTH = 3;
|
|
2
|
+
export declare const TEAM_NAME_MAX_LENGTH = 40;
|
|
3
|
+
/**
|
|
4
|
+
* Allowed team-name characters: Unicode letters (any script — Latin incl. ñ and
|
|
5
|
+
* Polish letters, Cyrillic, Greek, etc.), combining marks, digits, spaces, and
|
|
6
|
+
* basic name punctuation (hyphen, apostrophe, period).
|
|
7
|
+
*/
|
|
8
|
+
export declare const TEAM_NAME_PATTERN: RegExp;
|
|
9
|
+
/** Trim surrounding whitespace and normalise to NFC for consistent Unicode handling. */
|
|
10
|
+
export declare function normalizeTeamName(raw: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Validate a raw (untrimmed) team name. Normalises first (NFC + trim), then checks
|
|
13
|
+
* length, the allowed character set, and that it contains at least one letter or digit.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isValidTeamName(raw: string): boolean;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TEAM_NAME_PATTERN = exports.TEAM_NAME_MAX_LENGTH = exports.TEAM_NAME_MIN_LENGTH = void 0;
|
|
4
|
+
exports.normalizeTeamName = normalizeTeamName;
|
|
5
|
+
exports.isValidTeamName = isValidTeamName;
|
|
6
|
+
exports.TEAM_NAME_MIN_LENGTH = 3;
|
|
7
|
+
exports.TEAM_NAME_MAX_LENGTH = 40;
|
|
8
|
+
/**
|
|
9
|
+
* Allowed team-name characters: Unicode letters (any script — Latin incl. ñ and
|
|
10
|
+
* Polish letters, Cyrillic, Greek, etc.), combining marks, digits, spaces, and
|
|
11
|
+
* basic name punctuation (hyphen, apostrophe, period).
|
|
12
|
+
*/
|
|
13
|
+
exports.TEAM_NAME_PATTERN = /^[\p{L}\p{M}\p{N} .'-]+$/u;
|
|
14
|
+
const HAS_ALPHANUMERIC = /[\p{L}\p{N}]/u;
|
|
15
|
+
/** Trim surrounding whitespace and normalise to NFC for consistent Unicode handling. */
|
|
16
|
+
function normalizeTeamName(raw) {
|
|
17
|
+
return raw.normalize('NFC').trim();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Validate a raw (untrimmed) team name. Normalises first (NFC + trim), then checks
|
|
21
|
+
* length, the allowed character set, and that it contains at least one letter or digit.
|
|
22
|
+
*/
|
|
23
|
+
function isValidTeamName(raw) {
|
|
24
|
+
const name = normalizeTeamName(raw);
|
|
25
|
+
return (name.length >= exports.TEAM_NAME_MIN_LENGTH &&
|
|
26
|
+
name.length <= exports.TEAM_NAME_MAX_LENGTH &&
|
|
27
|
+
exports.TEAM_NAME_PATTERN.test(name) &&
|
|
28
|
+
HAS_ALPHANUMERIC.test(name));
|
|
29
|
+
}
|
|
@@ -9,6 +9,7 @@ export type AutoDismissSettings = Record<string, AutoDismissRarityConfig>;
|
|
|
9
9
|
export interface UserSettingsAttributes {
|
|
10
10
|
user_id: string;
|
|
11
11
|
auto_dismiss: AutoDismissSettings;
|
|
12
|
+
locale: string | null;
|
|
12
13
|
}
|
|
13
14
|
export type UserSettingsPk = 'user_id';
|
|
14
15
|
export type UserSettingsId = UserSettingsModel[UserSettingsPk];
|
|
@@ -16,6 +17,7 @@ export type UserSettingsCreationAttributes = UserSettingsAttributes;
|
|
|
16
17
|
export declare class UserSettingsModel extends Model<UserSettingsAttributes, UserSettingsCreationAttributes> implements UserSettingsAttributes {
|
|
17
18
|
user_id: string;
|
|
18
19
|
auto_dismiss: AutoDismissSettings;
|
|
20
|
+
locale: string | null;
|
|
19
21
|
user: AuthUserModel;
|
|
20
22
|
getUser: Sequelize.BelongsToGetAssociationMixin<AuthUserModel>;
|
|
21
23
|
setUser: Sequelize.BelongsToSetAssociationMixin<AuthUserModel, AuthUserId>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const TEAM_NAME_MIN_LENGTH = 3;
|
|
2
|
+
export declare const TEAM_NAME_MAX_LENGTH = 40;
|
|
3
|
+
/**
|
|
4
|
+
* Allowed team-name characters: Unicode letters (any script — Latin incl. ñ and
|
|
5
|
+
* Polish letters, Cyrillic, Greek, etc.), combining marks, digits, spaces, and
|
|
6
|
+
* basic name punctuation (hyphen, apostrophe, period).
|
|
7
|
+
*/
|
|
8
|
+
export declare const TEAM_NAME_PATTERN: RegExp;
|
|
9
|
+
/** Trim surrounding whitespace and normalise to NFC for consistent Unicode handling. */
|
|
10
|
+
export declare function normalizeTeamName(raw: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Validate a raw (untrimmed) team name. Normalises first (NFC + trim), then checks
|
|
13
|
+
* length, the allowed character set, and that it contains at least one letter or digit.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isValidTeamName(raw: string): boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const TEAM_NAME_MIN_LENGTH = 3;
|
|
2
|
+
export const TEAM_NAME_MAX_LENGTH = 40;
|
|
3
|
+
/**
|
|
4
|
+
* Allowed team-name characters: Unicode letters (any script — Latin incl. ñ and
|
|
5
|
+
* Polish letters, Cyrillic, Greek, etc.), combining marks, digits, spaces, and
|
|
6
|
+
* basic name punctuation (hyphen, apostrophe, period).
|
|
7
|
+
*/
|
|
8
|
+
export const TEAM_NAME_PATTERN = /^[\p{L}\p{M}\p{N} .'-]+$/u;
|
|
9
|
+
const HAS_ALPHANUMERIC = /[\p{L}\p{N}]/u;
|
|
10
|
+
/** Trim surrounding whitespace and normalise to NFC for consistent Unicode handling. */
|
|
11
|
+
export function normalizeTeamName(raw) {
|
|
12
|
+
return raw.normalize('NFC').trim();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Validate a raw (untrimmed) team name. Normalises first (NFC + trim), then checks
|
|
16
|
+
* length, the allowed character set, and that it contains at least one letter or digit.
|
|
17
|
+
*/
|
|
18
|
+
export function isValidTeamName(raw) {
|
|
19
|
+
const name = normalizeTeamName(raw);
|
|
20
|
+
return (name.length >= TEAM_NAME_MIN_LENGTH &&
|
|
21
|
+
name.length <= TEAM_NAME_MAX_LENGTH &&
|
|
22
|
+
TEAM_NAME_PATTERN.test(name) &&
|
|
23
|
+
HAS_ALPHANUMERIC.test(name));
|
|
24
|
+
}
|