@timothyw/pat-common 1.0.119 → 1.0.120
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/types/agenda-types.d.ts +115 -0
- package/dist/types/agenda-types.js +37 -0
- package/dist/types/auth-types.d.ts +153 -0
- package/dist/types/auth-types.js +48 -0
- package/dist/types/habits-types.d.ts +315 -0
- package/dist/types/habits-types.js +70 -0
- package/dist/types/index.d.ts +11 -3
- package/dist/types/index.js +11 -6
- package/dist/types/lists-types.d.ts +162 -0
- package/dist/types/lists-types.js +50 -0
- package/dist/types/misc/index.d.ts +3 -0
- package/dist/types/misc/index.js +19 -0
- package/dist/types/misc/misc-types.d.ts +8 -0
- package/dist/types/misc/misc-types.js +9 -0
- package/dist/types/misc/socket-message-types.d.ts +17 -0
- package/dist/types/misc/socket-message-types.js +12 -0
- package/dist/types/misc/version-types.d.ts +26 -0
- package/dist/types/misc/version-types.js +13 -0
- package/dist/types/notifications-types.d.ts +570 -0
- package/dist/types/notifications-types.js +149 -0
- package/dist/types/people-types.d.ts +283 -0
- package/dist/types/people-types.js +58 -0
- package/dist/types/program-config-types.d.ts +105 -0
- package/dist/types/program-config-types.js +29 -0
- package/dist/types/thoughts-types.d.ts +56 -0
- package/dist/types/thoughts-types.js +18 -0
- package/dist/types/user-types.d.ts +283 -0
- package/dist/types/user-types.js +46 -0
- package/package.json +1 -1
- package/src/types/{new/agenda-types.ts → agenda-types.ts} +2 -2
- package/src/types/{new/auth-types.ts → auth-types.ts} +1 -1
- package/src/types/{new/habits-types.ts → habits-types.ts} +3 -3
- package/src/types/index.ts +12 -7
- package/src/types/{new/lists-types.ts → lists-types.ts} +2 -2
- package/src/types/misc/index.ts +3 -0
- package/src/types/{new/notifications-types.ts → notifications-types.ts} +56 -12
- package/src/types/{new/people-types.ts → people-types.ts} +2 -2
- package/src/types/{new/thoughts-types.ts → thoughts-types.ts} +2 -2
- package/src/types/{new/user-types.ts → user-types.ts} +3 -3
- package/src/types/new/index.ts +0 -10
- package/src/types/new/misc/index.ts +0 -1
- package/src/types/old/api/account/get-user-types.ts +0 -6
- package/src/types/old/api/account/index.ts +0 -2
- package/src/types/old/api/account/update-user-types.ts +0 -14
- package/src/types/old/api/auth/create-account-types.ts +0 -17
- package/src/types/old/api/auth/index.ts +0 -5
- package/src/types/old/api/auth/refresh-auth-types.ts +0 -14
- package/src/types/old/api/auth/resend-verification-types.ts +0 -3
- package/src/types/old/api/auth/sign-in-types.ts +0 -16
- package/src/types/old/api/auth/verify-email-types.ts +0 -3
- package/src/types/old/api/habits/create-habit-entry-types.ts +0 -15
- package/src/types/old/api/habits/create-habit-types.ts +0 -17
- package/src/types/old/api/habits/delete-habit-entry-types.ts +0 -6
- package/src/types/old/api/habits/delete-habit-types.ts +0 -3
- package/src/types/old/api/habits/get-habits-types.ts +0 -6
- package/src/types/old/api/habits/index.ts +0 -6
- package/src/types/old/api/habits/update-habit-types.ts +0 -17
- package/src/types/old/api/index.ts +0 -9
- package/src/types/old/api/items/complete-item-types.ts +0 -13
- package/src/types/old/api/items/create-item-types.ts +0 -18
- package/src/types/old/api/items/delete-item-types.ts +0 -3
- package/src/types/old/api/items/get-items-types.ts +0 -6
- package/src/types/old/api/items/index.ts +0 -5
- package/src/types/old/api/items/update-item-types.ts +0 -18
- package/src/types/old/api/lists/complete-list-item-types.ts +0 -13
- package/src/types/old/api/lists/create-list-item-types.ts +0 -16
- package/src/types/old/api/lists/create-list-types.ts +0 -14
- package/src/types/old/api/lists/get-list-item-types.ts +0 -6
- package/src/types/old/api/lists/get-lists-types.ts +0 -6
- package/src/types/old/api/lists/index.ts +0 -7
- package/src/types/old/api/lists/update-list-item-types.ts +0 -17
- package/src/types/old/api/lists/update-list-types.ts +0 -14
- package/src/types/old/api/misc/index.ts +0 -1
- package/src/types/old/api/misc/version-types.ts +0 -10
- package/src/types/old/api/notifications/create-notification-template-types.ts +0 -30
- package/src/types/old/api/notifications/delete-notification-template-types.ts +0 -8
- package/src/types/old/api/notifications/get-notification-templates-types.ts +0 -12
- package/src/types/old/api/notifications/index.ts +0 -6
- package/src/types/old/api/notifications/preview-notification-template-types.ts +0 -21
- package/src/types/old/api/notifications/sync-notification-template-types.ts +0 -14
- package/src/types/old/api/notifications/update-notification-template-types.ts +0 -30
- package/src/types/old/api/people/create-person-note-types.ts +0 -15
- package/src/types/old/api/people/create-person-types.ts +0 -19
- package/src/types/old/api/people/delete-person-notes-types.ts +0 -3
- package/src/types/old/api/people/delete-person-types.ts +0 -3
- package/src/types/old/api/people/get-people-types.ts +0 -6
- package/src/types/old/api/people/get-person-notes-types.ts +0 -6
- package/src/types/old/api/people/index.ts +0 -8
- package/src/types/old/api/people/update-person-note-types.ts +0 -13
- package/src/types/old/api/people/update-person-types.ts +0 -19
- package/src/types/old/api/thoughts/create-thought-types.ts +0 -13
- package/src/types/old/api/thoughts/delete-thought-types.ts +0 -3
- package/src/types/old/api/thoughts/get-thoughts-types.ts +0 -6
- package/src/types/old/api/thoughts/index.ts +0 -4
- package/src/types/old/api/thoughts/update-thought-types.ts +0 -13
- package/src/types/old/auth-tokens.ts +0 -13
- package/src/types/old/models/auth-data.ts +0 -21
- package/src/types/old/models/habit-data.ts +0 -62
- package/src/types/old/models/index.ts +0 -10
- package/src/types/old/models/item-data.ts +0 -16
- package/src/types/old/models/list-data.ts +0 -26
- package/src/types/old/models/notifiable.ts +0 -52
- package/src/types/old/models/notification-template-data.ts +0 -67
- package/src/types/old/models/person-data.ts +0 -35
- package/src/types/old/models/program-config.ts +0 -25
- package/src/types/old/models/thought-data.ts +0 -9
- package/src/types/old/models/user-data.ts +0 -47
- /package/src/types/{misc-types.ts → misc/misc-types.ts} +0 -0
- /package/src/types/{socket-message-types.ts → misc/socket-message-types.ts} +0 -0
- /package/src/types/{new/misc → misc}/version-types.ts +0 -0
- /package/src/types/{new/program-config-types.ts → program-config-types.ts} +0 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Serialized } from '../utils';
|
|
3
|
+
export declare const agendaItemSchema: z.ZodObject<{
|
|
4
|
+
_id: z.ZodEffects<z.ZodString, import("./id-types").ItemId, string>;
|
|
5
|
+
userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
|
|
6
|
+
createdAt: z.ZodDate;
|
|
7
|
+
updatedAt: z.ZodDate;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
dueDate: z.ZodOptional<z.ZodDate>;
|
|
10
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
11
|
+
completed: z.ZodBoolean;
|
|
12
|
+
urgent: z.ZodBoolean;
|
|
13
|
+
category: z.ZodOptional<z.ZodString>;
|
|
14
|
+
type: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
_id: string & {
|
|
17
|
+
readonly __brand: "ItemId";
|
|
18
|
+
};
|
|
19
|
+
createdAt: Date;
|
|
20
|
+
updatedAt: Date;
|
|
21
|
+
userId: string & {
|
|
22
|
+
readonly __brand: "UserId";
|
|
23
|
+
};
|
|
24
|
+
name: string;
|
|
25
|
+
completed: boolean;
|
|
26
|
+
urgent: boolean;
|
|
27
|
+
type?: string | undefined;
|
|
28
|
+
notes?: string | undefined;
|
|
29
|
+
dueDate?: Date | undefined;
|
|
30
|
+
category?: string | undefined;
|
|
31
|
+
}, {
|
|
32
|
+
_id: string;
|
|
33
|
+
createdAt: Date;
|
|
34
|
+
updatedAt: Date;
|
|
35
|
+
userId: string;
|
|
36
|
+
name: string;
|
|
37
|
+
completed: boolean;
|
|
38
|
+
urgent: boolean;
|
|
39
|
+
type?: string | undefined;
|
|
40
|
+
notes?: string | undefined;
|
|
41
|
+
dueDate?: Date | undefined;
|
|
42
|
+
category?: string | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
export declare const createAgendaItemRequestSchema: z.ZodObject<{
|
|
45
|
+
name: z.ZodString;
|
|
46
|
+
dueDate: z.ZodOptional<z.ZodString>;
|
|
47
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
48
|
+
urgent: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
49
|
+
category: z.ZodOptional<z.ZodString>;
|
|
50
|
+
type: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
name: string;
|
|
53
|
+
urgent: boolean;
|
|
54
|
+
type?: string | undefined;
|
|
55
|
+
notes?: string | undefined;
|
|
56
|
+
dueDate?: string | undefined;
|
|
57
|
+
category?: string | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
name: string;
|
|
60
|
+
type?: string | undefined;
|
|
61
|
+
notes?: string | undefined;
|
|
62
|
+
dueDate?: string | undefined;
|
|
63
|
+
urgent?: boolean | undefined;
|
|
64
|
+
category?: string | undefined;
|
|
65
|
+
}>;
|
|
66
|
+
export declare const updateAgendaItemRequestSchema: z.ZodObject<{
|
|
67
|
+
name: z.ZodOptional<z.ZodString>;
|
|
68
|
+
dueDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
69
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
70
|
+
urgent: z.ZodOptional<z.ZodBoolean>;
|
|
71
|
+
category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
type?: string | null | undefined;
|
|
75
|
+
name?: string | undefined;
|
|
76
|
+
notes?: string | null | undefined;
|
|
77
|
+
dueDate?: string | null | undefined;
|
|
78
|
+
urgent?: boolean | undefined;
|
|
79
|
+
category?: string | null | undefined;
|
|
80
|
+
}, {
|
|
81
|
+
type?: string | null | undefined;
|
|
82
|
+
name?: string | undefined;
|
|
83
|
+
notes?: string | null | undefined;
|
|
84
|
+
dueDate?: string | null | undefined;
|
|
85
|
+
urgent?: boolean | undefined;
|
|
86
|
+
category?: string | null | undefined;
|
|
87
|
+
}>;
|
|
88
|
+
export declare const completeAgendaItemRequestSchema: z.ZodObject<{
|
|
89
|
+
completed: z.ZodBoolean;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
completed: boolean;
|
|
92
|
+
}, {
|
|
93
|
+
completed: boolean;
|
|
94
|
+
}>;
|
|
95
|
+
export type AgendaItemData = z.infer<typeof agendaItemSchema>;
|
|
96
|
+
export type CreateAgendaItemRequest = z.infer<typeof createAgendaItemRequestSchema>;
|
|
97
|
+
export type UpdateAgendaItemRequest = z.infer<typeof updateAgendaItemRequestSchema>;
|
|
98
|
+
export type CompleteAgendaItemRequest = z.infer<typeof completeAgendaItemRequestSchema>;
|
|
99
|
+
export interface CreateAgendaItemResponse {
|
|
100
|
+
agendaItem: Serialized<AgendaItemData>;
|
|
101
|
+
}
|
|
102
|
+
export interface GetAgendaItemsResponse {
|
|
103
|
+
agendaItems: Serialized<AgendaItemData>[];
|
|
104
|
+
}
|
|
105
|
+
export interface GetAgendaItemResponse {
|
|
106
|
+
agendaItem: Serialized<AgendaItemData>;
|
|
107
|
+
}
|
|
108
|
+
export interface UpdateAgendaItemResponse {
|
|
109
|
+
agendaItem: Serialized<AgendaItemData>;
|
|
110
|
+
}
|
|
111
|
+
export interface CompleteAgendaItemResponse {
|
|
112
|
+
agendaItem: Serialized<AgendaItemData>;
|
|
113
|
+
}
|
|
114
|
+
export interface DeleteAgendaItemResponse {
|
|
115
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.completeAgendaItemRequestSchema = exports.updateAgendaItemRequestSchema = exports.createAgendaItemRequestSchema = exports.agendaItemSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const id_types_1 = require("./id-types");
|
|
6
|
+
exports.agendaItemSchema = zod_1.z.object({
|
|
7
|
+
_id: id_types_1.itemIdSchema,
|
|
8
|
+
userId: id_types_1.userIdSchema,
|
|
9
|
+
createdAt: zod_1.z.date(),
|
|
10
|
+
updatedAt: zod_1.z.date(),
|
|
11
|
+
name: zod_1.z.string().min(1),
|
|
12
|
+
dueDate: zod_1.z.date().optional(),
|
|
13
|
+
notes: zod_1.z.string().optional(),
|
|
14
|
+
completed: zod_1.z.boolean(),
|
|
15
|
+
urgent: zod_1.z.boolean(),
|
|
16
|
+
category: zod_1.z.string().optional(),
|
|
17
|
+
type: zod_1.z.string().optional()
|
|
18
|
+
});
|
|
19
|
+
exports.createAgendaItemRequestSchema = zod_1.z.object({
|
|
20
|
+
name: zod_1.z.string().min(1),
|
|
21
|
+
dueDate: zod_1.z.string().optional(),
|
|
22
|
+
notes: zod_1.z.string().optional(),
|
|
23
|
+
urgent: zod_1.z.boolean().optional().default(false),
|
|
24
|
+
category: zod_1.z.string().optional(),
|
|
25
|
+
type: zod_1.z.string().optional()
|
|
26
|
+
});
|
|
27
|
+
exports.updateAgendaItemRequestSchema = zod_1.z.object({
|
|
28
|
+
name: zod_1.z.string().min(1).optional(),
|
|
29
|
+
dueDate: zod_1.z.string().nullish(),
|
|
30
|
+
notes: zod_1.z.string().nullish(),
|
|
31
|
+
urgent: zod_1.z.boolean().optional(),
|
|
32
|
+
category: zod_1.z.string().nullish(),
|
|
33
|
+
type: zod_1.z.string().nullish()
|
|
34
|
+
});
|
|
35
|
+
exports.completeAgendaItemRequestSchema = zod_1.z.object({
|
|
36
|
+
completed: zod_1.z.boolean()
|
|
37
|
+
});
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const authTokensSchema: z.ZodObject<{
|
|
3
|
+
accessToken: z.ZodString;
|
|
4
|
+
refreshToken: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
accessToken: string;
|
|
7
|
+
refreshToken: string;
|
|
8
|
+
}, {
|
|
9
|
+
accessToken: string;
|
|
10
|
+
refreshToken: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const tokenPayloadSchema: z.ZodObject<{
|
|
13
|
+
authId: z.ZodString;
|
|
14
|
+
userId: z.ZodString;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
userId: string;
|
|
17
|
+
authId: string;
|
|
18
|
+
}, {
|
|
19
|
+
userId: string;
|
|
20
|
+
authId: string;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const refreshTokenPayloadSchema: z.ZodObject<{
|
|
23
|
+
authId: z.ZodString;
|
|
24
|
+
userId: z.ZodString;
|
|
25
|
+
} & {
|
|
26
|
+
tokenId: z.ZodString;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
userId: string;
|
|
29
|
+
authId: string;
|
|
30
|
+
tokenId: string;
|
|
31
|
+
}, {
|
|
32
|
+
userId: string;
|
|
33
|
+
authId: string;
|
|
34
|
+
tokenId: string;
|
|
35
|
+
}>;
|
|
36
|
+
export declare const authDataSchema: z.ZodObject<{
|
|
37
|
+
_id: z.ZodEffects<z.ZodString, import("./id-types").AuthId, string>;
|
|
38
|
+
createdAt: z.ZodDate;
|
|
39
|
+
updatedAt: z.ZodDate;
|
|
40
|
+
userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
|
|
41
|
+
email: z.ZodString;
|
|
42
|
+
passwordHash: z.ZodString;
|
|
43
|
+
emailVerified: z.ZodBoolean;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
_id: string & {
|
|
46
|
+
readonly __brand: "AuthId";
|
|
47
|
+
};
|
|
48
|
+
createdAt: Date;
|
|
49
|
+
updatedAt: Date;
|
|
50
|
+
userId: string & {
|
|
51
|
+
readonly __brand: "UserId";
|
|
52
|
+
};
|
|
53
|
+
email: string;
|
|
54
|
+
passwordHash: string;
|
|
55
|
+
emailVerified: boolean;
|
|
56
|
+
}, {
|
|
57
|
+
_id: string;
|
|
58
|
+
createdAt: Date;
|
|
59
|
+
updatedAt: Date;
|
|
60
|
+
userId: string;
|
|
61
|
+
email: string;
|
|
62
|
+
passwordHash: string;
|
|
63
|
+
emailVerified: boolean;
|
|
64
|
+
}>;
|
|
65
|
+
export declare const publicAuthDataSchema: z.ZodObject<{
|
|
66
|
+
email: z.ZodString;
|
|
67
|
+
emailVerified: z.ZodBoolean;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
email: string;
|
|
70
|
+
emailVerified: boolean;
|
|
71
|
+
}, {
|
|
72
|
+
email: string;
|
|
73
|
+
emailVerified: boolean;
|
|
74
|
+
}>;
|
|
75
|
+
export declare const createAccountRequestSchema: z.ZodObject<{
|
|
76
|
+
name: z.ZodString;
|
|
77
|
+
email: z.ZodString;
|
|
78
|
+
password: z.ZodString;
|
|
79
|
+
skipVerificationEmail: z.ZodOptional<z.ZodBoolean>;
|
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
email: string;
|
|
82
|
+
name: string;
|
|
83
|
+
password: string;
|
|
84
|
+
skipVerificationEmail?: boolean | undefined;
|
|
85
|
+
}, {
|
|
86
|
+
email: string;
|
|
87
|
+
name: string;
|
|
88
|
+
password: string;
|
|
89
|
+
skipVerificationEmail?: boolean | undefined;
|
|
90
|
+
}>;
|
|
91
|
+
export declare const signInRequestSchema: z.ZodObject<{
|
|
92
|
+
email: z.ZodString;
|
|
93
|
+
password: z.ZodString;
|
|
94
|
+
}, "strip", z.ZodTypeAny, {
|
|
95
|
+
email: string;
|
|
96
|
+
password: string;
|
|
97
|
+
}, {
|
|
98
|
+
email: string;
|
|
99
|
+
password: string;
|
|
100
|
+
}>;
|
|
101
|
+
export declare const refreshAuthRequestSchema: z.ZodObject<{
|
|
102
|
+
refreshToken: z.ZodString;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
refreshToken: string;
|
|
105
|
+
}, {
|
|
106
|
+
refreshToken: string;
|
|
107
|
+
}>;
|
|
108
|
+
export declare const resendVerificationRequestSchema: z.ZodObject<{
|
|
109
|
+
email: z.ZodString;
|
|
110
|
+
}, "strip", z.ZodTypeAny, {
|
|
111
|
+
email: string;
|
|
112
|
+
}, {
|
|
113
|
+
email: string;
|
|
114
|
+
}>;
|
|
115
|
+
export declare const verifyEmailQuerySchema: z.ZodObject<{
|
|
116
|
+
token: z.ZodOptional<z.ZodString>;
|
|
117
|
+
}, "strip", z.ZodTypeAny, {
|
|
118
|
+
token?: string | undefined;
|
|
119
|
+
}, {
|
|
120
|
+
token?: string | undefined;
|
|
121
|
+
}>;
|
|
122
|
+
export type AuthTokens = z.infer<typeof authTokensSchema>;
|
|
123
|
+
export type TokenPayload = z.infer<typeof tokenPayloadSchema>;
|
|
124
|
+
export type RefreshTokenPayload = z.infer<typeof refreshTokenPayloadSchema>;
|
|
125
|
+
export type AuthData = z.infer<typeof authDataSchema>;
|
|
126
|
+
export type PublicAuthData = z.infer<typeof publicAuthDataSchema> & {
|
|
127
|
+
readonly __brand: unique symbol;
|
|
128
|
+
};
|
|
129
|
+
export type CreateAccountRequest = z.infer<typeof createAccountRequestSchema>;
|
|
130
|
+
export type SignInRequest = z.infer<typeof signInRequestSchema>;
|
|
131
|
+
export type RefreshAuthRequest = z.infer<typeof refreshAuthRequestSchema>;
|
|
132
|
+
export type ResendVerificationRequest = z.infer<typeof resendVerificationRequestSchema>;
|
|
133
|
+
export type VerifyEmailQuery = z.infer<typeof verifyEmailQuerySchema>;
|
|
134
|
+
export interface CreateAccountResponse {
|
|
135
|
+
id: string;
|
|
136
|
+
name: string;
|
|
137
|
+
email: string;
|
|
138
|
+
}
|
|
139
|
+
export interface SignInResponse {
|
|
140
|
+
tokenData: AuthTokens;
|
|
141
|
+
authData: PublicAuthData;
|
|
142
|
+
user: any;
|
|
143
|
+
}
|
|
144
|
+
export interface RefreshAuthResponse {
|
|
145
|
+
tokenData: AuthTokens;
|
|
146
|
+
authData: PublicAuthData;
|
|
147
|
+
}
|
|
148
|
+
export interface ResendVerificationResponse {
|
|
149
|
+
sent: boolean;
|
|
150
|
+
}
|
|
151
|
+
export interface VerifyEmailResponse {
|
|
152
|
+
verified: boolean;
|
|
153
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyEmailQuerySchema = exports.resendVerificationRequestSchema = exports.refreshAuthRequestSchema = exports.signInRequestSchema = exports.createAccountRequestSchema = exports.publicAuthDataSchema = exports.authDataSchema = exports.refreshTokenPayloadSchema = exports.tokenPayloadSchema = exports.authTokensSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const id_types_1 = require("./id-types");
|
|
6
|
+
exports.authTokensSchema = zod_1.z.object({
|
|
7
|
+
accessToken: zod_1.z.string(),
|
|
8
|
+
refreshToken: zod_1.z.string()
|
|
9
|
+
});
|
|
10
|
+
exports.tokenPayloadSchema = zod_1.z.object({
|
|
11
|
+
authId: zod_1.z.string(),
|
|
12
|
+
userId: zod_1.z.string()
|
|
13
|
+
});
|
|
14
|
+
exports.refreshTokenPayloadSchema = exports.tokenPayloadSchema.extend({
|
|
15
|
+
tokenId: zod_1.z.string()
|
|
16
|
+
});
|
|
17
|
+
exports.authDataSchema = zod_1.z.object({
|
|
18
|
+
_id: id_types_1.authIdSchema,
|
|
19
|
+
createdAt: zod_1.z.date(),
|
|
20
|
+
updatedAt: zod_1.z.date(),
|
|
21
|
+
userId: id_types_1.userIdSchema,
|
|
22
|
+
email: zod_1.z.string(),
|
|
23
|
+
passwordHash: zod_1.z.string(),
|
|
24
|
+
emailVerified: zod_1.z.boolean()
|
|
25
|
+
});
|
|
26
|
+
exports.publicAuthDataSchema = zod_1.z.object({
|
|
27
|
+
email: zod_1.z.string(),
|
|
28
|
+
emailVerified: zod_1.z.boolean()
|
|
29
|
+
});
|
|
30
|
+
exports.createAccountRequestSchema = zod_1.z.object({
|
|
31
|
+
name: zod_1.z.string().trim().min(1),
|
|
32
|
+
email: zod_1.z.string().trim().email(),
|
|
33
|
+
password: zod_1.z.string().min(4),
|
|
34
|
+
skipVerificationEmail: zod_1.z.boolean().optional()
|
|
35
|
+
});
|
|
36
|
+
exports.signInRequestSchema = zod_1.z.object({
|
|
37
|
+
email: zod_1.z.string().email(),
|
|
38
|
+
password: zod_1.z.string()
|
|
39
|
+
});
|
|
40
|
+
exports.refreshAuthRequestSchema = zod_1.z.object({
|
|
41
|
+
refreshToken: zod_1.z.string()
|
|
42
|
+
});
|
|
43
|
+
exports.resendVerificationRequestSchema = zod_1.z.object({
|
|
44
|
+
email: zod_1.z.string().email()
|
|
45
|
+
});
|
|
46
|
+
exports.verifyEmailQuerySchema = zod_1.z.object({
|
|
47
|
+
token: zod_1.z.string().optional()
|
|
48
|
+
});
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Serialized } from '../utils';
|
|
3
|
+
export declare enum HabitFrequency {
|
|
4
|
+
DAILY = "daily",
|
|
5
|
+
WEEKLY = "weekly",
|
|
6
|
+
EVERY_N_DAYS = "every_n_days",
|
|
7
|
+
WEEKDAYS_ONLY = "weekdays_only",
|
|
8
|
+
CUSTOM = "custom"
|
|
9
|
+
}
|
|
10
|
+
export declare enum HabitEntryStatus {
|
|
11
|
+
COMPLETED = "completed",
|
|
12
|
+
EXCUSED = "excused",
|
|
13
|
+
MISSED = "missed"
|
|
14
|
+
}
|
|
15
|
+
export declare const habitEntrySchema: z.ZodObject<{
|
|
16
|
+
_id: z.ZodEffects<z.ZodString, import("./id-types").HabitEntryId, string>;
|
|
17
|
+
habitId: z.ZodEffects<z.ZodString, import("./id-types").HabitId, string>;
|
|
18
|
+
userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
|
|
19
|
+
date: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("./misc/misc-types").DateOnlyString, string>;
|
|
20
|
+
status: z.ZodNativeEnum<typeof HabitEntryStatus>;
|
|
21
|
+
createdAt: z.ZodDate;
|
|
22
|
+
updatedAt: z.ZodDate;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
status: HabitEntryStatus;
|
|
25
|
+
_id: string & {
|
|
26
|
+
readonly __brand: "HabitEntryId";
|
|
27
|
+
};
|
|
28
|
+
createdAt: Date;
|
|
29
|
+
updatedAt: Date;
|
|
30
|
+
userId: string & {
|
|
31
|
+
readonly __brand: "UserId";
|
|
32
|
+
};
|
|
33
|
+
date: string & {
|
|
34
|
+
readonly __brand: "DateOnlyString";
|
|
35
|
+
};
|
|
36
|
+
habitId: string & {
|
|
37
|
+
readonly __brand: "HabitId";
|
|
38
|
+
};
|
|
39
|
+
}, {
|
|
40
|
+
status: HabitEntryStatus;
|
|
41
|
+
_id: string;
|
|
42
|
+
createdAt: Date;
|
|
43
|
+
updatedAt: Date;
|
|
44
|
+
userId: string;
|
|
45
|
+
date: string;
|
|
46
|
+
habitId: string;
|
|
47
|
+
}>;
|
|
48
|
+
export declare const habitDataSchema: z.ZodObject<{
|
|
49
|
+
_id: z.ZodEffects<z.ZodString, import("./id-types").HabitId, string>;
|
|
50
|
+
userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
|
|
51
|
+
name: z.ZodString;
|
|
52
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
+
frequency: z.ZodNativeEnum<typeof HabitFrequency>;
|
|
55
|
+
rolloverTime: z.ZodString;
|
|
56
|
+
firstDay: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("./misc/misc-types").DateOnlyString, string>;
|
|
57
|
+
createdAt: z.ZodDate;
|
|
58
|
+
updatedAt: z.ZodDate;
|
|
59
|
+
}, "strip", z.ZodTypeAny, {
|
|
60
|
+
_id: string & {
|
|
61
|
+
readonly __brand: "HabitId";
|
|
62
|
+
};
|
|
63
|
+
createdAt: Date;
|
|
64
|
+
updatedAt: Date;
|
|
65
|
+
userId: string & {
|
|
66
|
+
readonly __brand: "UserId";
|
|
67
|
+
};
|
|
68
|
+
name: string;
|
|
69
|
+
frequency: HabitFrequency;
|
|
70
|
+
rolloverTime: string;
|
|
71
|
+
firstDay: string & {
|
|
72
|
+
readonly __brand: "DateOnlyString";
|
|
73
|
+
};
|
|
74
|
+
description?: string | null | undefined;
|
|
75
|
+
notes?: string | null | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
_id: string;
|
|
78
|
+
createdAt: Date;
|
|
79
|
+
updatedAt: Date;
|
|
80
|
+
userId: string;
|
|
81
|
+
name: string;
|
|
82
|
+
frequency: HabitFrequency;
|
|
83
|
+
rolloverTime: string;
|
|
84
|
+
firstDay: string;
|
|
85
|
+
description?: string | null | undefined;
|
|
86
|
+
notes?: string | null | undefined;
|
|
87
|
+
}>;
|
|
88
|
+
export declare const habitStatsSchema: z.ZodObject<{
|
|
89
|
+
totalDays: z.ZodNumber;
|
|
90
|
+
completedDays: z.ZodNumber;
|
|
91
|
+
excusedDays: z.ZodNumber;
|
|
92
|
+
missedDays: z.ZodNumber;
|
|
93
|
+
completionRate: z.ZodNumber;
|
|
94
|
+
}, "strip", z.ZodTypeAny, {
|
|
95
|
+
totalDays: number;
|
|
96
|
+
completedDays: number;
|
|
97
|
+
excusedDays: number;
|
|
98
|
+
missedDays: number;
|
|
99
|
+
completionRate: number;
|
|
100
|
+
}, {
|
|
101
|
+
totalDays: number;
|
|
102
|
+
completedDays: number;
|
|
103
|
+
excusedDays: number;
|
|
104
|
+
missedDays: number;
|
|
105
|
+
completionRate: number;
|
|
106
|
+
}>;
|
|
107
|
+
export declare const habitSchema: z.ZodObject<{
|
|
108
|
+
_id: z.ZodEffects<z.ZodString, import("./id-types").HabitId, string>;
|
|
109
|
+
userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
|
|
110
|
+
name: z.ZodString;
|
|
111
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
112
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
113
|
+
frequency: z.ZodNativeEnum<typeof HabitFrequency>;
|
|
114
|
+
rolloverTime: z.ZodString;
|
|
115
|
+
firstDay: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("./misc/misc-types").DateOnlyString, string>;
|
|
116
|
+
createdAt: z.ZodDate;
|
|
117
|
+
updatedAt: z.ZodDate;
|
|
118
|
+
} & {
|
|
119
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
120
|
+
_id: z.ZodEffects<z.ZodString, import("./id-types").HabitEntryId, string>;
|
|
121
|
+
habitId: z.ZodEffects<z.ZodString, import("./id-types").HabitId, string>;
|
|
122
|
+
userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
|
|
123
|
+
date: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("./misc/misc-types").DateOnlyString, string>;
|
|
124
|
+
status: z.ZodNativeEnum<typeof HabitEntryStatus>;
|
|
125
|
+
createdAt: z.ZodDate;
|
|
126
|
+
updatedAt: z.ZodDate;
|
|
127
|
+
}, "strip", z.ZodTypeAny, {
|
|
128
|
+
status: HabitEntryStatus;
|
|
129
|
+
_id: string & {
|
|
130
|
+
readonly __brand: "HabitEntryId";
|
|
131
|
+
};
|
|
132
|
+
createdAt: Date;
|
|
133
|
+
updatedAt: Date;
|
|
134
|
+
userId: string & {
|
|
135
|
+
readonly __brand: "UserId";
|
|
136
|
+
};
|
|
137
|
+
date: string & {
|
|
138
|
+
readonly __brand: "DateOnlyString";
|
|
139
|
+
};
|
|
140
|
+
habitId: string & {
|
|
141
|
+
readonly __brand: "HabitId";
|
|
142
|
+
};
|
|
143
|
+
}, {
|
|
144
|
+
status: HabitEntryStatus;
|
|
145
|
+
_id: string;
|
|
146
|
+
createdAt: Date;
|
|
147
|
+
updatedAt: Date;
|
|
148
|
+
userId: string;
|
|
149
|
+
date: string;
|
|
150
|
+
habitId: string;
|
|
151
|
+
}>, "many">;
|
|
152
|
+
stats: z.ZodObject<{
|
|
153
|
+
totalDays: z.ZodNumber;
|
|
154
|
+
completedDays: z.ZodNumber;
|
|
155
|
+
excusedDays: z.ZodNumber;
|
|
156
|
+
missedDays: z.ZodNumber;
|
|
157
|
+
completionRate: z.ZodNumber;
|
|
158
|
+
}, "strip", z.ZodTypeAny, {
|
|
159
|
+
totalDays: number;
|
|
160
|
+
completedDays: number;
|
|
161
|
+
excusedDays: number;
|
|
162
|
+
missedDays: number;
|
|
163
|
+
completionRate: number;
|
|
164
|
+
}, {
|
|
165
|
+
totalDays: number;
|
|
166
|
+
completedDays: number;
|
|
167
|
+
excusedDays: number;
|
|
168
|
+
missedDays: number;
|
|
169
|
+
completionRate: number;
|
|
170
|
+
}>;
|
|
171
|
+
}, "strip", z.ZodTypeAny, {
|
|
172
|
+
entries: {
|
|
173
|
+
status: HabitEntryStatus;
|
|
174
|
+
_id: string & {
|
|
175
|
+
readonly __brand: "HabitEntryId";
|
|
176
|
+
};
|
|
177
|
+
createdAt: Date;
|
|
178
|
+
updatedAt: Date;
|
|
179
|
+
userId: string & {
|
|
180
|
+
readonly __brand: "UserId";
|
|
181
|
+
};
|
|
182
|
+
date: string & {
|
|
183
|
+
readonly __brand: "DateOnlyString";
|
|
184
|
+
};
|
|
185
|
+
habitId: string & {
|
|
186
|
+
readonly __brand: "HabitId";
|
|
187
|
+
};
|
|
188
|
+
}[];
|
|
189
|
+
_id: string & {
|
|
190
|
+
readonly __brand: "HabitId";
|
|
191
|
+
};
|
|
192
|
+
createdAt: Date;
|
|
193
|
+
updatedAt: Date;
|
|
194
|
+
userId: string & {
|
|
195
|
+
readonly __brand: "UserId";
|
|
196
|
+
};
|
|
197
|
+
name: string;
|
|
198
|
+
frequency: HabitFrequency;
|
|
199
|
+
rolloverTime: string;
|
|
200
|
+
firstDay: string & {
|
|
201
|
+
readonly __brand: "DateOnlyString";
|
|
202
|
+
};
|
|
203
|
+
stats: {
|
|
204
|
+
totalDays: number;
|
|
205
|
+
completedDays: number;
|
|
206
|
+
excusedDays: number;
|
|
207
|
+
missedDays: number;
|
|
208
|
+
completionRate: number;
|
|
209
|
+
};
|
|
210
|
+
description?: string | null | undefined;
|
|
211
|
+
notes?: string | null | undefined;
|
|
212
|
+
}, {
|
|
213
|
+
entries: {
|
|
214
|
+
status: HabitEntryStatus;
|
|
215
|
+
_id: string;
|
|
216
|
+
createdAt: Date;
|
|
217
|
+
updatedAt: Date;
|
|
218
|
+
userId: string;
|
|
219
|
+
date: string;
|
|
220
|
+
habitId: string;
|
|
221
|
+
}[];
|
|
222
|
+
_id: string;
|
|
223
|
+
createdAt: Date;
|
|
224
|
+
updatedAt: Date;
|
|
225
|
+
userId: string;
|
|
226
|
+
name: string;
|
|
227
|
+
frequency: HabitFrequency;
|
|
228
|
+
rolloverTime: string;
|
|
229
|
+
firstDay: string;
|
|
230
|
+
stats: {
|
|
231
|
+
totalDays: number;
|
|
232
|
+
completedDays: number;
|
|
233
|
+
excusedDays: number;
|
|
234
|
+
missedDays: number;
|
|
235
|
+
completionRate: number;
|
|
236
|
+
};
|
|
237
|
+
description?: string | null | undefined;
|
|
238
|
+
notes?: string | null | undefined;
|
|
239
|
+
}>;
|
|
240
|
+
export declare const createHabitRequestSchema: z.ZodObject<{
|
|
241
|
+
name: z.ZodString;
|
|
242
|
+
description: z.ZodOptional<z.ZodString>;
|
|
243
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
244
|
+
frequency: z.ZodNativeEnum<typeof HabitFrequency>;
|
|
245
|
+
rolloverTime: z.ZodString;
|
|
246
|
+
}, "strip", z.ZodTypeAny, {
|
|
247
|
+
name: string;
|
|
248
|
+
frequency: HabitFrequency;
|
|
249
|
+
rolloverTime: string;
|
|
250
|
+
description?: string | undefined;
|
|
251
|
+
notes?: string | undefined;
|
|
252
|
+
}, {
|
|
253
|
+
name: string;
|
|
254
|
+
frequency: HabitFrequency;
|
|
255
|
+
rolloverTime: string;
|
|
256
|
+
description?: string | undefined;
|
|
257
|
+
notes?: string | undefined;
|
|
258
|
+
}>;
|
|
259
|
+
export declare const updateHabitRequestSchema: z.ZodObject<{
|
|
260
|
+
name: z.ZodOptional<z.ZodString>;
|
|
261
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
262
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
263
|
+
frequency: z.ZodOptional<z.ZodNativeEnum<typeof HabitFrequency>>;
|
|
264
|
+
rolloverTime: z.ZodOptional<z.ZodString>;
|
|
265
|
+
}, "strip", z.ZodTypeAny, {
|
|
266
|
+
name?: string | undefined;
|
|
267
|
+
description?: string | null | undefined;
|
|
268
|
+
notes?: string | null | undefined;
|
|
269
|
+
frequency?: HabitFrequency | undefined;
|
|
270
|
+
rolloverTime?: string | undefined;
|
|
271
|
+
}, {
|
|
272
|
+
name?: string | undefined;
|
|
273
|
+
description?: string | null | undefined;
|
|
274
|
+
notes?: string | null | undefined;
|
|
275
|
+
frequency?: HabitFrequency | undefined;
|
|
276
|
+
rolloverTime?: string | undefined;
|
|
277
|
+
}>;
|
|
278
|
+
export declare const createHabitEntryRequestSchema: z.ZodObject<{
|
|
279
|
+
date: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("./misc/misc-types").DateOnlyString, string>;
|
|
280
|
+
status: z.ZodNativeEnum<typeof HabitEntryStatus>;
|
|
281
|
+
}, "strip", z.ZodTypeAny, {
|
|
282
|
+
status: HabitEntryStatus;
|
|
283
|
+
date: string & {
|
|
284
|
+
readonly __brand: "DateOnlyString";
|
|
285
|
+
};
|
|
286
|
+
}, {
|
|
287
|
+
status: HabitEntryStatus;
|
|
288
|
+
date: string;
|
|
289
|
+
}>;
|
|
290
|
+
export type HabitEntryData = z.infer<typeof habitEntrySchema>;
|
|
291
|
+
export type HabitData = z.infer<typeof habitDataSchema>;
|
|
292
|
+
export type HabitStats = z.infer<typeof habitStatsSchema>;
|
|
293
|
+
export type Habit = z.infer<typeof habitSchema>;
|
|
294
|
+
export type CreateHabitRequest = z.infer<typeof createHabitRequestSchema>;
|
|
295
|
+
export type UpdateHabitRequest = z.infer<typeof updateHabitRequestSchema>;
|
|
296
|
+
export type CreateHabitEntryRequest = z.infer<typeof createHabitEntryRequestSchema>;
|
|
297
|
+
export interface CreateHabitResponse {
|
|
298
|
+
habit: Serialized<Habit>;
|
|
299
|
+
}
|
|
300
|
+
export interface GetHabitsResponse {
|
|
301
|
+
habits: Serialized<Habit>[];
|
|
302
|
+
}
|
|
303
|
+
export interface GetHabitResponse {
|
|
304
|
+
habit: Serialized<Habit>;
|
|
305
|
+
}
|
|
306
|
+
export interface UpdateHabitResponse {
|
|
307
|
+
habit: Serialized<Habit>;
|
|
308
|
+
}
|
|
309
|
+
export interface DeleteHabitResponse {
|
|
310
|
+
}
|
|
311
|
+
export interface CreateHabitEntryResponse {
|
|
312
|
+
habit: Serialized<Habit>;
|
|
313
|
+
}
|
|
314
|
+
export interface DeleteHabitEntryResponse {
|
|
315
|
+
}
|