@tmlmobilidade/go-types-core 20261124.1707.3 → 20261124.2354.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/index.d.ts +2 -4
- package/dist/auth/index.js +2 -4
- package/dist/auth/sessions/cookie-name.d.ts +4 -0
- package/dist/auth/sessions/cookie-name.js +5 -0
- package/dist/auth/sessions/index.d.ts +2 -0
- package/dist/auth/sessions/index.js +2 -0
- package/dist/auth/verification-tokens/index.d.ts +1 -0
- package/dist/auth/verification-tokens/index.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/platform/me/index.d.ts +1 -0
- package/dist/platform/me/index.js +1 -0
- package/dist/platform/me/me-user.d.ts +27 -0
- package/dist/platform/me/me-user.js +18 -0
- package/dist/simplified-users/index.d.ts +1 -0
- package/dist/simplified-users/index.js +1 -0
- package/dist/{users → simplified-users}/simplified-user.d.ts +4 -0
- package/dist/{users → simplified-users}/simplified-user.js +1 -1
- package/dist/users/index.d.ts +0 -1
- package/dist/users/index.js +0 -1
- package/dist/users/user.d.ts +14 -14
- package/dist/users/user.js +1 -1
- package/package.json +1 -1
- package/dist/auth/login.d.ts +0 -6
- package/dist/auth/login.js +0 -7
- package/dist/auth/password-requirements.d.ts +0 -12
- package/dist/auth/password-requirements.js +0 -27
- /package/dist/auth/{session.d.ts → sessions/session.d.ts} +0 -0
- /package/dist/auth/{session.js → sessions/session.js} +0 -0
- /package/dist/auth/{verification-token.d.ts → verification-tokens/verification-token.d.ts} +0 -0
- /package/dist/auth/{verification-token.js → verification-tokens/verification-token.js} +0 -0
package/dist/auth/index.d.ts
CHANGED
package/dist/auth/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './verification-token.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './verification-token.js';
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const MeUserSchema: z.ZodObject<{
|
|
3
|
+
email: z.ZodEmail;
|
|
4
|
+
phone: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
5
|
+
_id: z.ZodString;
|
|
6
|
+
created_at: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<import("@tmlmobilidade/go-types-shared").UnixMilliseconds, string | number>>;
|
|
7
|
+
updated_at: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<import("@tmlmobilidade/go-types-shared").UnixMilliseconds, string | number>>;
|
|
8
|
+
dismissed_banners: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
9
|
+
banner_id: z.ZodString;
|
|
10
|
+
dismissal_version: z.ZodNumber;
|
|
11
|
+
dismissed_at: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<import("@tmlmobilidade/go-types-shared").UnixMilliseconds, string | number>>;
|
|
12
|
+
}, z.core.$strip>>>;
|
|
13
|
+
first_name: z.ZodString;
|
|
14
|
+
last_name: z.ZodString;
|
|
15
|
+
organization_id: z.ZodString;
|
|
16
|
+
preferences: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>>>>;
|
|
17
|
+
seen_changelogs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
18
|
+
changelog_id: z.ZodString;
|
|
19
|
+
seen_at: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<import("@tmlmobilidade/go-types-shared").UnixMilliseconds, string | number>>;
|
|
20
|
+
}, z.core.$strip>>>;
|
|
21
|
+
seen_last_at: z.ZodDefault<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<import("@tmlmobilidade/go-types-shared").UnixMilliseconds, string | number>>>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
/**
|
|
24
|
+
* The MeUser object contains the required information
|
|
25
|
+
* about the current user that is logged in the platform.
|
|
26
|
+
*/
|
|
27
|
+
export type MeUser = z.infer<typeof MeUserSchema>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* * */
|
|
2
|
+
import { UserSchema } from '../../users/user.js';
|
|
3
|
+
/* * */
|
|
4
|
+
export const MeUserSchema = UserSchema
|
|
5
|
+
.pick({
|
|
6
|
+
_id: true,
|
|
7
|
+
created_at: true,
|
|
8
|
+
dismissed_banners: true,
|
|
9
|
+
email: true,
|
|
10
|
+
first_name: true,
|
|
11
|
+
last_name: true,
|
|
12
|
+
organization_id: true,
|
|
13
|
+
phone: true,
|
|
14
|
+
preferences: true,
|
|
15
|
+
seen_changelogs: true,
|
|
16
|
+
seen_last_at: true,
|
|
17
|
+
updated_at: true,
|
|
18
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './simplified-user.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './simplified-user.js';
|
|
@@ -7,4 +7,8 @@ export declare const SimplifiedUserSchema: z.ZodObject<{
|
|
|
7
7
|
seen_last_at: z.ZodDefault<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<import("@tmlmobilidade/go-types-shared").UnixMilliseconds, string | number>>>>;
|
|
8
8
|
organization_name: z.ZodString;
|
|
9
9
|
}, z.core.$strip>;
|
|
10
|
+
/**
|
|
11
|
+
* The simplified user contains the minimum information
|
|
12
|
+
* about a user that is needed for the platform.
|
|
13
|
+
*/
|
|
10
14
|
export type SimplifiedUser = z.infer<typeof SimplifiedUserSchema>;
|
package/dist/users/index.d.ts
CHANGED
package/dist/users/index.js
CHANGED
package/dist/users/user.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare const UserSchema: z.ZodObject<{
|
|
|
13
13
|
dismissal_version: z.ZodNumber;
|
|
14
14
|
dismissed_at: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<import("@tmlmobilidade/go-types-shared").UnixMilliseconds, string | number>>;
|
|
15
15
|
}, z.core.$strip>>>;
|
|
16
|
-
email: z.
|
|
16
|
+
email: z.ZodEmail;
|
|
17
17
|
email_verified: z.ZodDefault<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<import("@tmlmobilidade/go-types-shared").UnixMilliseconds, string | number>>>>;
|
|
18
18
|
first_name: z.ZodString;
|
|
19
19
|
last_name: z.ZodString;
|
|
@@ -310,11 +310,16 @@ export declare const UserSchema: z.ZodObject<{
|
|
|
310
310
|
verification_token_ids: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
311
311
|
}, z.core.$strip>;
|
|
312
312
|
export declare const CreateUserSchema: z.ZodObject<{
|
|
313
|
-
email: z.
|
|
313
|
+
email: z.ZodEmail;
|
|
314
314
|
phone: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
315
315
|
created_by: z.ZodString;
|
|
316
316
|
is_locked: z.ZodDefault<z.ZodBoolean>;
|
|
317
317
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
318
|
+
email_verified: z.ZodDefault<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<import("@tmlmobilidade/go-types-shared").UnixMilliseconds, string | number>>>>;
|
|
319
|
+
first_name: z.ZodString;
|
|
320
|
+
last_name: z.ZodString;
|
|
321
|
+
organization_id: z.ZodString;
|
|
322
|
+
password_hash: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
318
323
|
permissions: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
319
324
|
action: z.ZodEnum<{
|
|
320
325
|
create: "create";
|
|
@@ -594,11 +599,6 @@ export declare const CreateUserSchema: z.ZodObject<{
|
|
|
594
599
|
}, z.core.$strip>>;
|
|
595
600
|
scope: z.ZodLiteral<"zones">;
|
|
596
601
|
}, z.core.$strip>], "scope">>>;
|
|
597
|
-
email_verified: z.ZodDefault<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<import("@tmlmobilidade/go-types-shared").UnixMilliseconds, string | number>>>>;
|
|
598
|
-
first_name: z.ZodString;
|
|
599
|
-
last_name: z.ZodString;
|
|
600
|
-
organization_id: z.ZodString;
|
|
601
|
-
password_hash: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
602
602
|
preferences: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>>>>;
|
|
603
603
|
role_ids: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
604
604
|
seen_last_at: z.ZodDefault<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<import("@tmlmobilidade/go-types-shared").UnixMilliseconds, string | number>>>>;
|
|
@@ -606,10 +606,15 @@ export declare const CreateUserSchema: z.ZodObject<{
|
|
|
606
606
|
verification_token_ids: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
607
607
|
}, z.core.$strip>;
|
|
608
608
|
export declare const UpdateUserSchema: z.ZodObject<{
|
|
609
|
-
email: z.ZodOptional<z.ZodPreprocess<z.
|
|
609
|
+
email: z.ZodOptional<z.ZodPreprocess<z.ZodEmail, string>>;
|
|
610
610
|
phone: z.ZodOptional<z.ZodPreprocess<z.ZodDefault<z.ZodNullable<z.ZodString>>, string | null | undefined>>;
|
|
611
611
|
is_locked: z.ZodOptional<z.ZodPreprocess<z.ZodDefault<z.ZodBoolean>, boolean | undefined>>;
|
|
612
612
|
updated_by: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodString>, string | undefined>>;
|
|
613
|
+
email_verified: 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>>;
|
|
614
|
+
first_name: z.ZodOptional<z.ZodPreprocess<z.ZodString, string>>;
|
|
615
|
+
last_name: z.ZodOptional<z.ZodPreprocess<z.ZodString, string>>;
|
|
616
|
+
organization_id: z.ZodOptional<z.ZodPreprocess<z.ZodString, string>>;
|
|
617
|
+
password_hash: z.ZodOptional<z.ZodPreprocess<z.ZodDefault<z.ZodNullable<z.ZodString>>, string | null | undefined>>;
|
|
613
618
|
permissions: z.ZodOptional<z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
614
619
|
action: z.ZodEnum<{
|
|
615
620
|
create: "create";
|
|
@@ -1011,11 +1016,6 @@ export declare const UpdateUserSchema: z.ZodObject<{
|
|
|
1011
1016
|
agency_ids?: string[] | undefined;
|
|
1012
1017
|
} | undefined;
|
|
1013
1018
|
})[] | undefined>>;
|
|
1014
|
-
email_verified: 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>>;
|
|
1015
|
-
first_name: z.ZodOptional<z.ZodPreprocess<z.ZodString, string>>;
|
|
1016
|
-
last_name: z.ZodOptional<z.ZodPreprocess<z.ZodString, string>>;
|
|
1017
|
-
organization_id: z.ZodOptional<z.ZodPreprocess<z.ZodString, string>>;
|
|
1018
|
-
password_hash: z.ZodOptional<z.ZodPreprocess<z.ZodDefault<z.ZodNullable<z.ZodString>>, string | null | undefined>>;
|
|
1019
1019
|
preferences: z.ZodOptional<z.ZodPreprocess<z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>>>>, Record<string, Record<string, string | number | boolean | string[] | number[]>> | null | undefined>>;
|
|
1020
1020
|
role_ids: z.ZodOptional<z.ZodPreprocess<z.ZodDefault<z.ZodArray<z.ZodString>>, string[] | undefined>>;
|
|
1021
1021
|
seen_last_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>>;
|
|
@@ -1031,7 +1031,7 @@ export declare const UserDisplayFields: {
|
|
|
1031
1031
|
readonly phone: true;
|
|
1032
1032
|
};
|
|
1033
1033
|
export declare const UserDisplaySchema: z.ZodObject<{
|
|
1034
|
-
email: z.
|
|
1034
|
+
email: z.ZodEmail;
|
|
1035
1035
|
phone: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1036
1036
|
_id: z.ZodString;
|
|
1037
1037
|
first_name: z.ZodString;
|
package/dist/users/user.js
CHANGED
|
@@ -15,7 +15,7 @@ export const UserPreferenceValueSchema = z.union([
|
|
|
15
15
|
/* * */
|
|
16
16
|
export const UserSchema = BaseDocumentSchema.extend({
|
|
17
17
|
dismissed_banners: z.array(UserBannerDismissalSchema).default([]),
|
|
18
|
-
email: z.
|
|
18
|
+
email: z.email(),
|
|
19
19
|
email_verified: UnixMillisecondsSchema.nullable().default(null),
|
|
20
20
|
first_name: z.string().min(2),
|
|
21
21
|
last_name: z.string().min(2),
|
package/package.json
CHANGED
package/dist/auth/login.d.ts
DELETED
package/dist/auth/login.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type ValidationKey, type ValidationValues } from '@tmlmobilidade/go-utils-validation';
|
|
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[];
|
|
10
|
-
export declare const PasswordRequirementsSchema: z.ZodObject<{
|
|
11
|
-
password: z.ZodString;
|
|
12
|
-
}, z.core.$strip>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/* * */
|
|
2
|
-
import { validationParams } from '@tmlmobilidade/go-utils-validation';
|
|
3
|
-
import { z } from 'zod';
|
|
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.
|
|
16
|
-
export const PasswordRequirementsSchema = z
|
|
17
|
-
.object({ password: z.string() })
|
|
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
|
-
});
|
|
27
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|