@tmlmobilidade/go-types-core 20261107.2347.22 → 20261109.1101.19
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/auth/password-requirements.d.ts +8 -0
- package/dist/auth/password-requirements.js +22 -32
- package/dist/banners/banner.d.ts +5 -5
- package/dist/banners/banner.js +2 -1
- package/dist/banners/link.js +2 -1
- package/dist/changelogs/changelog.d.ts +4 -4
- package/dist/changelogs/changelog.js +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/platform/banners/banner-dismiss-platform-request.d.ts +1 -1
- package/dist/platform/banners/banner-platform-response.d.ts +1 -1
- package/dist/platform/banners/banners-platform-request.d.ts +1 -1
- package/dist/platform/changelogs/changelog-platform-response.d.ts +1 -1
- package/dist/platform/changelogs/changelog-seen-platform-request.js +2 -1
- package/dist/platform/changelogs/changelog-summary-platform-response.d.ts +1 -1
- package/dist/platform/changelogs/changelogs-platform-request.d.ts +1 -1
- package/package.json +2 -1
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
import { type ValidationKey, type ValidationValues } from '@tmlmobilidade/go-utils-validation';
|
|
1
2
|
import { z } from 'zod';
|
|
3
|
+
export interface PasswordRequirement {
|
|
4
|
+
key: ValidationKey;
|
|
5
|
+
valid: boolean;
|
|
6
|
+
values: ValidationValues;
|
|
7
|
+
}
|
|
8
|
+
/** Structured checklist data, independent of the user's language. */
|
|
9
|
+
export declare function getPasswordRequirements(password: string): PasswordRequirement[];
|
|
2
10
|
export declare const PasswordRequirementsSchema: z.ZodObject<{
|
|
3
11
|
password: z.ZodString;
|
|
4
12
|
}, z.core.$strip>;
|
|
@@ -1,37 +1,27 @@
|
|
|
1
1
|
/* * */
|
|
2
|
+
import { validationParams } from '@tmlmobilidade/go-utils-validation';
|
|
2
3
|
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
4
|
+
/** Structured checklist data, independent of the user's language. */
|
|
5
|
+
export function getPasswordRequirements(password) {
|
|
6
|
+
return [
|
|
7
|
+
{ key: 'custom.password.min_length', valid: password.length >= 8, values: { minimum: 8 } },
|
|
8
|
+
{ key: 'custom.password.lowercase', valid: /[a-z]/.test(password), values: {} },
|
|
9
|
+
{ key: 'custom.password.number', valid: /\d/.test(password), values: {} },
|
|
10
|
+
{ key: 'custom.password.special', valid: /[`!@#$%^&*()_\-+=[\]{};':"\\|,.<>/?~ ]/.test(password), values: {} },
|
|
11
|
+
{ key: 'custom.password.uppercase', valid: /[A-Z]/.test(password), values: {} },
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
// Preserve the legacy checklist schema's behavior: it emits the checklist even
|
|
15
|
+
// when every condition passes. Consumers read structured data, never JSON text.
|
|
11
16
|
export const PasswordRequirementsSchema = z
|
|
12
17
|
.object({ password: z.string() })
|
|
13
|
-
.superRefine(({ password },
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} : undefined,
|
|
23
|
-
minNumber: sharedConditions.minNumber > 0 ? {
|
|
24
|
-
message: 'Password must contain at least one number',
|
|
25
|
-
valid: (password.match(/\d/) || []).length >= sharedConditions.minNumber,
|
|
26
|
-
} : undefined,
|
|
27
|
-
minSpecialChar: sharedConditions.minSpecialChar > 0 ? {
|
|
28
|
-
message: 'Password must contain at least one special character',
|
|
29
|
-
valid: (password.match(/[`!@#$%^&*()_\-+=[\]{};':"\\|,.<>/?~ ]/) || []).length >= sharedConditions.minSpecialChar,
|
|
30
|
-
} : undefined,
|
|
31
|
-
minUpperCase: sharedConditions.minUpperCase > 0 ? {
|
|
32
|
-
message: 'Password must contain at least one uppercase character',
|
|
33
|
-
valid: (password.match(/[A-Z]/) || []).length >= sharedConditions.minUpperCase,
|
|
34
|
-
} : undefined,
|
|
35
|
-
};
|
|
36
|
-
checkPassComplexity.addIssue({ code: 'custom', message: JSON.stringify(errObj), path: ['password'] });
|
|
18
|
+
.superRefine(({ password }, context) => {
|
|
19
|
+
context.addIssue({
|
|
20
|
+
code: 'custom',
|
|
21
|
+
params: {
|
|
22
|
+
...validationParams('custom.password.requirements').params,
|
|
23
|
+
requirements: getPasswordRequirements(password),
|
|
24
|
+
},
|
|
25
|
+
path: ['password'],
|
|
26
|
+
});
|
|
37
27
|
});
|
package/dist/banners/banner.d.ts
CHANGED
|
@@ -28,9 +28,9 @@ export declare const BannerBaseSchema: z.ZodObject<{
|
|
|
28
28
|
type: z.ZodLiteral<"platform">;
|
|
29
29
|
}, z.core.$strict>, z.ZodObject<{
|
|
30
30
|
module_ids: z.ZodArray<z.ZodEnum<{
|
|
31
|
+
dates: "dates";
|
|
31
32
|
apex: "apex";
|
|
32
33
|
core: "core";
|
|
33
|
-
dates: "dates";
|
|
34
34
|
exporter: "exporter";
|
|
35
35
|
hub: "hub";
|
|
36
36
|
infrastructure: "infrastructure";
|
|
@@ -78,9 +78,9 @@ export declare const BannerSchema: z.ZodObject<{
|
|
|
78
78
|
type: z.ZodLiteral<"platform">;
|
|
79
79
|
}, z.core.$strict>, z.ZodObject<{
|
|
80
80
|
module_ids: z.ZodArray<z.ZodEnum<{
|
|
81
|
+
dates: "dates";
|
|
81
82
|
apex: "apex";
|
|
82
83
|
core: "core";
|
|
83
|
-
dates: "dates";
|
|
84
84
|
exporter: "exporter";
|
|
85
85
|
hub: "hub";
|
|
86
86
|
infrastructure: "infrastructure";
|
|
@@ -110,9 +110,9 @@ export declare const CreateBannerSchema: z.ZodObject<{
|
|
|
110
110
|
type: z.ZodLiteral<"platform">;
|
|
111
111
|
}, z.core.$strict>, z.ZodObject<{
|
|
112
112
|
module_ids: z.ZodArray<z.ZodEnum<{
|
|
113
|
+
dates: "dates";
|
|
113
114
|
apex: "apex";
|
|
114
115
|
core: "core";
|
|
115
|
-
dates: "dates";
|
|
116
116
|
exporter: "exporter";
|
|
117
117
|
hub: "hub";
|
|
118
118
|
infrastructure: "infrastructure";
|
|
@@ -151,9 +151,9 @@ export declare const UpdateBannerSchema: z.ZodObject<{
|
|
|
151
151
|
type: z.ZodLiteral<"platform">;
|
|
152
152
|
}, z.core.$strict>, z.ZodObject<{
|
|
153
153
|
module_ids: z.ZodArray<z.ZodEnum<{
|
|
154
|
+
dates: "dates";
|
|
154
155
|
apex: "apex";
|
|
155
156
|
core: "core";
|
|
156
|
-
dates: "dates";
|
|
157
157
|
exporter: "exporter";
|
|
158
158
|
hub: "hub";
|
|
159
159
|
infrastructure: "infrastructure";
|
|
@@ -166,7 +166,7 @@ export declare const UpdateBannerSchema: z.ZodObject<{
|
|
|
166
166
|
}, z.core.$strict>], "type">, {
|
|
167
167
|
type: "platform";
|
|
168
168
|
} | {
|
|
169
|
-
module_ids: ("
|
|
169
|
+
module_ids: ("dates" | "apex" | "core" | "exporter" | "hub" | "infrastructure" | "offer" | "operation" | "performance" | "tracker")[];
|
|
170
170
|
type: "modules";
|
|
171
171
|
}>>;
|
|
172
172
|
ends_at: z.ZodOptional<z.ZodPreprocess<z.ZodDefault<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<import("@tmlmobilidade/go-types-shared").UnixMilliseconds, string | number>>>>, string | number | null | undefined>>;
|
package/dist/banners/banner.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* * */
|
|
2
2
|
import { BaseDocumentSchema, ModuleScopeSchema, partialWithoutDefaults, PublishStatusSchema, UnixMillisecondsSchema } from '@tmlmobilidade/go-types-shared';
|
|
3
|
+
import { validationParams } from '@tmlmobilidade/go-utils-validation';
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
import { BannerKindSchema } from './kind.js';
|
|
5
6
|
import { BannerLinkSchema } from './link.js';
|
|
@@ -7,7 +8,7 @@ import { BannerSeveritySchema } from './severity.js';
|
|
|
7
8
|
/* * */
|
|
8
9
|
function validateBannerSchedule(document, context) {
|
|
9
10
|
if (document.starts_at != null && document.ends_at != null && document.ends_at <= document.starts_at) {
|
|
10
|
-
context.addIssue({ code: 'custom',
|
|
11
|
+
context.addIssue({ code: 'custom', ...validationParams('custom.schedule.end_after_start'), path: ['ends_at'] });
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
export const BannerBaseSchema = BaseDocumentSchema.extend({
|
package/dist/banners/link.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* * */
|
|
2
|
+
import { validationMessage } from '@tmlmobilidade/go-utils-validation';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
/* * */
|
|
4
5
|
export const BannerLinkSchema = z.object({
|
|
5
6
|
label: z.string().trim().min(1),
|
|
6
|
-
url: z.string().url().regex(/^https?:\/\//i,
|
|
7
|
+
url: z.string().url().regex(/^https?:\/\//i, { error: validationMessage('custom.banner.link') }),
|
|
7
8
|
});
|
|
@@ -25,9 +25,9 @@ export declare const ChangelogSchema: z.ZodObject<{
|
|
|
25
25
|
type: z.ZodLiteral<"platform">;
|
|
26
26
|
}, z.core.$strict>, z.ZodObject<{
|
|
27
27
|
module_ids: z.ZodArray<z.ZodEnum<{
|
|
28
|
+
dates: "dates";
|
|
28
29
|
apex: "apex";
|
|
29
30
|
core: "core";
|
|
30
|
-
dates: "dates";
|
|
31
31
|
exporter: "exporter";
|
|
32
32
|
hub: "hub";
|
|
33
33
|
infrastructure: "infrastructure";
|
|
@@ -47,9 +47,9 @@ export declare const CreateChangelogSchema: z.ZodObject<{
|
|
|
47
47
|
type: z.ZodLiteral<"platform">;
|
|
48
48
|
}, z.core.$strict>, z.ZodObject<{
|
|
49
49
|
module_ids: z.ZodArray<z.ZodEnum<{
|
|
50
|
+
dates: "dates";
|
|
50
51
|
apex: "apex";
|
|
51
52
|
core: "core";
|
|
52
|
-
dates: "dates";
|
|
53
53
|
exporter: "exporter";
|
|
54
54
|
hub: "hub";
|
|
55
55
|
infrastructure: "infrastructure";
|
|
@@ -78,9 +78,9 @@ export declare const UpdateChangelogSchema: z.ZodObject<{
|
|
|
78
78
|
type: z.ZodLiteral<"platform">;
|
|
79
79
|
}, z.core.$strict>, z.ZodObject<{
|
|
80
80
|
module_ids: z.ZodArray<z.ZodEnum<{
|
|
81
|
+
dates: "dates";
|
|
81
82
|
apex: "apex";
|
|
82
83
|
core: "core";
|
|
83
|
-
dates: "dates";
|
|
84
84
|
exporter: "exporter";
|
|
85
85
|
hub: "hub";
|
|
86
86
|
infrastructure: "infrastructure";
|
|
@@ -93,7 +93,7 @@ export declare const UpdateChangelogSchema: z.ZodObject<{
|
|
|
93
93
|
}, z.core.$strict>], "type">, {
|
|
94
94
|
type: "platform";
|
|
95
95
|
} | {
|
|
96
|
-
module_ids: ("
|
|
96
|
+
module_ids: ("dates" | "apex" | "core" | "exporter" | "hub" | "infrastructure" | "offer" | "operation" | "performance" | "tracker")[];
|
|
97
97
|
type: "modules";
|
|
98
98
|
}>>;
|
|
99
99
|
items: z.ZodOptional<z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/* * */
|
|
2
2
|
import { BaseDocumentSchema, ModuleScopeSchema, partialWithoutDefaults, PublishStatusSchema } from '@tmlmobilidade/go-types-shared';
|
|
3
|
+
import { validationParams } from '@tmlmobilidade/go-utils-validation';
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
import { ChangelogItemSchema } from './item.js';
|
|
5
6
|
/* * */
|
|
6
7
|
export const ChangelogSchema = BaseDocumentSchema.extend({
|
|
7
|
-
items: z.array(ChangelogItemSchema).default([]).refine(items => new Set(items.map(item => item._id)).size === items.length, '
|
|
8
|
+
items: z.array(ChangelogItemSchema).default([]).refine(items => new Set(items.map(item => item._id)).size === items.length, validationParams('custom.unique.changelog_items')),
|
|
8
9
|
publish_status: PublishStatusSchema.default('draft'),
|
|
9
10
|
scope: ModuleScopeSchema,
|
|
10
11
|
summary: z.string().trim().default(''),
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,9 +2,9 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const BannerDismissPlatformRequestSchema: z.ZodObject<{
|
|
3
3
|
dismissal_version: z.ZodNumber;
|
|
4
4
|
module_id: z.ZodOptional<z.ZodEnum<{
|
|
5
|
+
dates: "dates";
|
|
5
6
|
apex: "apex";
|
|
6
7
|
core: "core";
|
|
7
|
-
dates: "dates";
|
|
8
8
|
exporter: "exporter";
|
|
9
9
|
hub: "hub";
|
|
10
10
|
infrastructure: "infrastructure";
|
|
@@ -11,9 +11,9 @@ export declare const BannerPlatformResponseSchema: z.ZodObject<{
|
|
|
11
11
|
type: z.ZodLiteral<"platform">;
|
|
12
12
|
}, z.core.$strict>, z.ZodObject<{
|
|
13
13
|
module_ids: z.ZodArray<z.ZodEnum<{
|
|
14
|
+
dates: "dates";
|
|
14
15
|
apex: "apex";
|
|
15
16
|
core: "core";
|
|
16
|
-
dates: "dates";
|
|
17
17
|
exporter: "exporter";
|
|
18
18
|
hub: "hub";
|
|
19
19
|
infrastructure: "infrastructure";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const BannersPlatformRequestSchema: z.ZodObject<{
|
|
3
3
|
module_id: z.ZodOptional<z.ZodEnum<{
|
|
4
|
+
dates: "dates";
|
|
4
5
|
apex: "apex";
|
|
5
6
|
core: "core";
|
|
6
|
-
dates: "dates";
|
|
7
7
|
exporter: "exporter";
|
|
8
8
|
hub: "hub";
|
|
9
9
|
infrastructure: "infrastructure";
|
|
@@ -6,9 +6,9 @@ export declare const ChangelogPlatformResponseSchema: z.ZodObject<{
|
|
|
6
6
|
type: z.ZodLiteral<"platform">;
|
|
7
7
|
}, z.core.$strict>, z.ZodObject<{
|
|
8
8
|
module_ids: z.ZodArray<z.ZodEnum<{
|
|
9
|
+
dates: "dates";
|
|
9
10
|
apex: "apex";
|
|
10
11
|
core: "core";
|
|
11
|
-
dates: "dates";
|
|
12
12
|
exporter: "exporter";
|
|
13
13
|
hub: "hub";
|
|
14
14
|
infrastructure: "infrastructure";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* * */
|
|
2
|
+
import { validationParams } from '@tmlmobilidade/go-utils-validation';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
/* * */
|
|
4
5
|
export const ChangelogSeenPlatformRequestSchema = z.object({
|
|
5
|
-
release_ids: z.array(z.string().min(1)).min(1).max(100).refine(ids => new Set(ids).size === ids.length, '
|
|
6
|
+
release_ids: z.array(z.string().min(1)).min(1).max(100).refine(ids => new Set(ids).size === ids.length, validationParams('custom.unique.release_ids')),
|
|
6
7
|
});
|
|
@@ -6,9 +6,9 @@ export declare const ChangelogSummaryPlatformResponseSchema: z.ZodObject<{
|
|
|
6
6
|
type: z.ZodLiteral<"platform">;
|
|
7
7
|
}, z.core.$strict>, z.ZodObject<{
|
|
8
8
|
module_ids: z.ZodArray<z.ZodEnum<{
|
|
9
|
+
dates: "dates";
|
|
9
10
|
apex: "apex";
|
|
10
11
|
core: "core";
|
|
11
|
-
dates: "dates";
|
|
12
12
|
exporter: "exporter";
|
|
13
13
|
hub: "hub";
|
|
14
14
|
infrastructure: "infrastructure";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const ChangelogsPlatformRequestSchema: z.ZodObject<{
|
|
3
3
|
module_id: z.ZodOptional<z.ZodEnum<{
|
|
4
|
+
dates: "dates";
|
|
4
5
|
apex: "apex";
|
|
5
6
|
core: "core";
|
|
6
|
-
dates: "dates";
|
|
7
7
|
exporter: "exporter";
|
|
8
8
|
hub: "hub";
|
|
9
9
|
infrastructure: "infrastructure";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmlmobilidade/go-types-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20261109.1101.19",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "iso@tmlmobilidade.pt",
|
|
6
6
|
"name": "TML-ISO"
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"@tmlmobilidade/go-types-operation": "*",
|
|
40
40
|
"@tmlmobilidade/go-types-permissions": "*",
|
|
41
41
|
"@tmlmobilidade/go-types-shared": "*",
|
|
42
|
+
"@tmlmobilidade/go-utils-validation": "*",
|
|
42
43
|
"zod": "4.6.7"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|