@timothyw/pat-common 1.0.118 → 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.
Files changed (112) hide show
  1. package/dist/types/agenda-types.d.ts +115 -0
  2. package/dist/types/agenda-types.js +37 -0
  3. package/dist/types/auth-types.d.ts +153 -0
  4. package/dist/types/auth-types.js +48 -0
  5. package/dist/types/habits-types.d.ts +315 -0
  6. package/dist/types/habits-types.js +70 -0
  7. package/dist/types/index.d.ts +11 -3
  8. package/dist/types/index.js +11 -6
  9. package/dist/types/lists-types.d.ts +162 -0
  10. package/dist/types/lists-types.js +50 -0
  11. package/dist/types/misc/index.d.ts +3 -0
  12. package/dist/types/misc/index.js +19 -0
  13. package/dist/types/misc/misc-types.d.ts +8 -0
  14. package/dist/types/misc/misc-types.js +9 -0
  15. package/dist/types/misc/socket-message-types.d.ts +17 -0
  16. package/dist/types/misc/socket-message-types.js +12 -0
  17. package/dist/types/misc/version-types.d.ts +26 -0
  18. package/dist/types/misc/version-types.js +13 -0
  19. package/dist/types/new/notifications-types.d.ts +7 -0
  20. package/dist/types/notifications-types.d.ts +570 -0
  21. package/dist/types/notifications-types.js +149 -0
  22. package/dist/types/people-types.d.ts +283 -0
  23. package/dist/types/people-types.js +58 -0
  24. package/dist/types/program-config-types.d.ts +105 -0
  25. package/dist/types/program-config-types.js +29 -0
  26. package/dist/types/thoughts-types.d.ts +56 -0
  27. package/dist/types/thoughts-types.js +18 -0
  28. package/dist/types/user-types.d.ts +283 -0
  29. package/dist/types/user-types.js +46 -0
  30. package/package.json +1 -1
  31. package/src/types/{new/agenda-types.ts → agenda-types.ts} +2 -2
  32. package/src/types/{new/auth-types.ts → auth-types.ts} +1 -1
  33. package/src/types/{new/habits-types.ts → habits-types.ts} +3 -3
  34. package/src/types/index.ts +12 -7
  35. package/src/types/{new/lists-types.ts → lists-types.ts} +2 -2
  36. package/src/types/misc/index.ts +3 -0
  37. package/src/types/{new/notifications-types.ts → notifications-types.ts} +64 -12
  38. package/src/types/{new/people-types.ts → people-types.ts} +2 -2
  39. package/src/types/{new/thoughts-types.ts → thoughts-types.ts} +2 -2
  40. package/src/types/{new/user-types.ts → user-types.ts} +3 -3
  41. package/src/types/new/index.ts +0 -10
  42. package/src/types/new/misc/index.ts +0 -1
  43. package/src/types/old/api/account/get-user-types.ts +0 -6
  44. package/src/types/old/api/account/index.ts +0 -2
  45. package/src/types/old/api/account/update-user-types.ts +0 -14
  46. package/src/types/old/api/auth/create-account-types.ts +0 -17
  47. package/src/types/old/api/auth/index.ts +0 -5
  48. package/src/types/old/api/auth/refresh-auth-types.ts +0 -14
  49. package/src/types/old/api/auth/resend-verification-types.ts +0 -3
  50. package/src/types/old/api/auth/sign-in-types.ts +0 -16
  51. package/src/types/old/api/auth/verify-email-types.ts +0 -3
  52. package/src/types/old/api/habits/create-habit-entry-types.ts +0 -15
  53. package/src/types/old/api/habits/create-habit-types.ts +0 -17
  54. package/src/types/old/api/habits/delete-habit-entry-types.ts +0 -6
  55. package/src/types/old/api/habits/delete-habit-types.ts +0 -3
  56. package/src/types/old/api/habits/get-habits-types.ts +0 -6
  57. package/src/types/old/api/habits/index.ts +0 -6
  58. package/src/types/old/api/habits/update-habit-types.ts +0 -17
  59. package/src/types/old/api/index.ts +0 -9
  60. package/src/types/old/api/items/complete-item-types.ts +0 -13
  61. package/src/types/old/api/items/create-item-types.ts +0 -18
  62. package/src/types/old/api/items/delete-item-types.ts +0 -3
  63. package/src/types/old/api/items/get-items-types.ts +0 -6
  64. package/src/types/old/api/items/index.ts +0 -5
  65. package/src/types/old/api/items/update-item-types.ts +0 -18
  66. package/src/types/old/api/lists/complete-list-item-types.ts +0 -13
  67. package/src/types/old/api/lists/create-list-item-types.ts +0 -16
  68. package/src/types/old/api/lists/create-list-types.ts +0 -14
  69. package/src/types/old/api/lists/get-list-item-types.ts +0 -6
  70. package/src/types/old/api/lists/get-lists-types.ts +0 -6
  71. package/src/types/old/api/lists/index.ts +0 -7
  72. package/src/types/old/api/lists/update-list-item-types.ts +0 -17
  73. package/src/types/old/api/lists/update-list-types.ts +0 -14
  74. package/src/types/old/api/misc/index.ts +0 -1
  75. package/src/types/old/api/misc/version-types.ts +0 -10
  76. package/src/types/old/api/notifications/create-notification-template-types.ts +0 -30
  77. package/src/types/old/api/notifications/delete-notification-template-types.ts +0 -8
  78. package/src/types/old/api/notifications/get-notification-templates-types.ts +0 -12
  79. package/src/types/old/api/notifications/index.ts +0 -6
  80. package/src/types/old/api/notifications/preview-notification-template-types.ts +0 -21
  81. package/src/types/old/api/notifications/sync-notification-template-types.ts +0 -14
  82. package/src/types/old/api/notifications/update-notification-template-types.ts +0 -30
  83. package/src/types/old/api/people/create-person-note-types.ts +0 -15
  84. package/src/types/old/api/people/create-person-types.ts +0 -19
  85. package/src/types/old/api/people/delete-person-notes-types.ts +0 -3
  86. package/src/types/old/api/people/delete-person-types.ts +0 -3
  87. package/src/types/old/api/people/get-people-types.ts +0 -6
  88. package/src/types/old/api/people/get-person-notes-types.ts +0 -6
  89. package/src/types/old/api/people/index.ts +0 -8
  90. package/src/types/old/api/people/update-person-note-types.ts +0 -13
  91. package/src/types/old/api/people/update-person-types.ts +0 -19
  92. package/src/types/old/api/thoughts/create-thought-types.ts +0 -13
  93. package/src/types/old/api/thoughts/delete-thought-types.ts +0 -3
  94. package/src/types/old/api/thoughts/get-thoughts-types.ts +0 -6
  95. package/src/types/old/api/thoughts/index.ts +0 -4
  96. package/src/types/old/api/thoughts/update-thought-types.ts +0 -13
  97. package/src/types/old/auth-tokens.ts +0 -13
  98. package/src/types/old/models/auth-data.ts +0 -21
  99. package/src/types/old/models/habit-data.ts +0 -62
  100. package/src/types/old/models/index.ts +0 -10
  101. package/src/types/old/models/item-data.ts +0 -16
  102. package/src/types/old/models/list-data.ts +0 -26
  103. package/src/types/old/models/notifiable.ts +0 -52
  104. package/src/types/old/models/notification-template-data.ts +0 -67
  105. package/src/types/old/models/person-data.ts +0 -35
  106. package/src/types/old/models/program-config.ts +0 -25
  107. package/src/types/old/models/thought-data.ts +0 -9
  108. package/src/types/old/models/user-data.ts +0 -47
  109. /package/src/types/{misc-types.ts → misc/misc-types.ts} +0 -0
  110. /package/src/types/{socket-message-types.ts → misc/socket-message-types.ts} +0 -0
  111. /package/src/types/{new/misc → misc}/version-types.ts +0 -0
  112. /package/src/types/{new/program-config-types.ts → program-config-types.ts} +0 -0
@@ -0,0 +1,283 @@
1
+ import { z } from 'zod';
2
+ import { Serialized } from '../utils';
3
+ import { ModuleType } from '../enums';
4
+ export declare const moduleSchema: z.ZodObject<{
5
+ type: z.ZodNativeEnum<typeof ModuleType>;
6
+ visible: z.ZodBoolean;
7
+ }, "strip", z.ZodTypeAny, {
8
+ type: ModuleType;
9
+ visible: boolean;
10
+ }, {
11
+ type: ModuleType;
12
+ visible: boolean;
13
+ }>;
14
+ export declare const deviceSchema: z.ZodObject<{
15
+ pushToken: z.ZodString;
16
+ }, "strip", z.ZodTypeAny, {
17
+ pushToken: string;
18
+ }, {
19
+ pushToken: string;
20
+ }>;
21
+ export declare const userSchema: z.ZodObject<{
22
+ _id: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
23
+ createdAt: z.ZodDate;
24
+ updatedAt: z.ZodDate;
25
+ sandbox: z.ZodObject<{
26
+ discordId: z.ZodOptional<z.ZodString>;
27
+ devices: z.ZodArray<z.ZodObject<{
28
+ pushToken: z.ZodString;
29
+ }, "strip", z.ZodTypeAny, {
30
+ pushToken: string;
31
+ }, {
32
+ pushToken: string;
33
+ }>, "many">;
34
+ }, "strip", z.ZodTypeAny, {
35
+ devices: {
36
+ pushToken: string;
37
+ }[];
38
+ discordId?: string | undefined;
39
+ }, {
40
+ devices: {
41
+ pushToken: string;
42
+ }[];
43
+ discordId?: string | undefined;
44
+ }>;
45
+ name: z.ZodString;
46
+ timezone: z.ZodEffects<z.ZodString, string, string>;
47
+ config: z.ZodObject<{
48
+ modules: z.ZodArray<z.ZodObject<{
49
+ type: z.ZodNativeEnum<typeof ModuleType>;
50
+ visible: z.ZodBoolean;
51
+ }, "strip", z.ZodTypeAny, {
52
+ type: ModuleType;
53
+ visible: boolean;
54
+ }, {
55
+ type: ModuleType;
56
+ visible: boolean;
57
+ }>, "many">;
58
+ agenda: z.ZodObject<{
59
+ itemCategories: z.ZodArray<z.ZodString, "many">;
60
+ itemTypes: z.ZodArray<z.ZodString, "many">;
61
+ }, "strip", z.ZodTypeAny, {
62
+ itemCategories: string[];
63
+ itemTypes: string[];
64
+ }, {
65
+ itemCategories: string[];
66
+ itemTypes: string[];
67
+ }>;
68
+ people: z.ZodObject<{
69
+ propertyKeys: z.ZodArray<z.ZodString, "many">;
70
+ }, "strip", z.ZodTypeAny, {
71
+ propertyKeys: string[];
72
+ }, {
73
+ propertyKeys: string[];
74
+ }>;
75
+ }, "strip", z.ZodTypeAny, {
76
+ agenda: {
77
+ itemCategories: string[];
78
+ itemTypes: string[];
79
+ };
80
+ people: {
81
+ propertyKeys: string[];
82
+ };
83
+ modules: {
84
+ type: ModuleType;
85
+ visible: boolean;
86
+ }[];
87
+ }, {
88
+ agenda: {
89
+ itemCategories: string[];
90
+ itemTypes: string[];
91
+ };
92
+ people: {
93
+ propertyKeys: string[];
94
+ };
95
+ modules: {
96
+ type: ModuleType;
97
+ visible: boolean;
98
+ }[];
99
+ }>;
100
+ }, "strip", z.ZodTypeAny, {
101
+ _id: string & {
102
+ readonly __brand: "UserId";
103
+ };
104
+ createdAt: Date;
105
+ updatedAt: Date;
106
+ name: string;
107
+ sandbox: {
108
+ devices: {
109
+ pushToken: string;
110
+ }[];
111
+ discordId?: string | undefined;
112
+ };
113
+ timezone: string;
114
+ config: {
115
+ agenda: {
116
+ itemCategories: string[];
117
+ itemTypes: string[];
118
+ };
119
+ people: {
120
+ propertyKeys: string[];
121
+ };
122
+ modules: {
123
+ type: ModuleType;
124
+ visible: boolean;
125
+ }[];
126
+ };
127
+ }, {
128
+ _id: string;
129
+ createdAt: Date;
130
+ updatedAt: Date;
131
+ name: string;
132
+ sandbox: {
133
+ devices: {
134
+ pushToken: string;
135
+ }[];
136
+ discordId?: string | undefined;
137
+ };
138
+ timezone: string;
139
+ config: {
140
+ agenda: {
141
+ itemCategories: string[];
142
+ itemTypes: string[];
143
+ };
144
+ people: {
145
+ propertyKeys: string[];
146
+ };
147
+ modules: {
148
+ type: ModuleType;
149
+ visible: boolean;
150
+ }[];
151
+ };
152
+ }>;
153
+ export declare const updateUserRequestSchema: z.ZodObject<{
154
+ name: z.ZodOptional<z.ZodString>;
155
+ sandbox: z.ZodOptional<z.ZodObject<{
156
+ discordId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
157
+ devices: z.ZodOptional<z.ZodArray<z.ZodObject<{
158
+ pushToken: z.ZodOptional<z.ZodString>;
159
+ }, "strip", z.ZodTypeAny, {
160
+ pushToken?: string | undefined;
161
+ }, {
162
+ pushToken?: string | undefined;
163
+ }>, "many">>;
164
+ }, "strip", z.ZodTypeAny, {
165
+ discordId?: string | undefined;
166
+ devices?: {
167
+ pushToken?: string | undefined;
168
+ }[] | undefined;
169
+ }, {
170
+ discordId?: string | undefined;
171
+ devices?: {
172
+ pushToken?: string | undefined;
173
+ }[] | undefined;
174
+ }>>;
175
+ timezone: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
176
+ config: z.ZodOptional<z.ZodObject<{
177
+ modules: z.ZodOptional<z.ZodArray<z.ZodObject<{
178
+ type: z.ZodOptional<z.ZodNativeEnum<typeof ModuleType>>;
179
+ visible: z.ZodOptional<z.ZodBoolean>;
180
+ }, "strip", z.ZodTypeAny, {
181
+ type?: ModuleType | undefined;
182
+ visible?: boolean | undefined;
183
+ }, {
184
+ type?: ModuleType | undefined;
185
+ visible?: boolean | undefined;
186
+ }>, "many">>;
187
+ agenda: z.ZodOptional<z.ZodObject<{
188
+ itemCategories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
189
+ itemTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
190
+ }, "strip", z.ZodTypeAny, {
191
+ itemCategories?: string[] | undefined;
192
+ itemTypes?: string[] | undefined;
193
+ }, {
194
+ itemCategories?: string[] | undefined;
195
+ itemTypes?: string[] | undefined;
196
+ }>>;
197
+ people: z.ZodOptional<z.ZodObject<{
198
+ propertyKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
199
+ }, "strip", z.ZodTypeAny, {
200
+ propertyKeys?: string[] | undefined;
201
+ }, {
202
+ propertyKeys?: string[] | undefined;
203
+ }>>;
204
+ }, "strip", z.ZodTypeAny, {
205
+ agenda?: {
206
+ itemCategories?: string[] | undefined;
207
+ itemTypes?: string[] | undefined;
208
+ } | undefined;
209
+ people?: {
210
+ propertyKeys?: string[] | undefined;
211
+ } | undefined;
212
+ modules?: {
213
+ type?: ModuleType | undefined;
214
+ visible?: boolean | undefined;
215
+ }[] | undefined;
216
+ }, {
217
+ agenda?: {
218
+ itemCategories?: string[] | undefined;
219
+ itemTypes?: string[] | undefined;
220
+ } | undefined;
221
+ people?: {
222
+ propertyKeys?: string[] | undefined;
223
+ } | undefined;
224
+ modules?: {
225
+ type?: ModuleType | undefined;
226
+ visible?: boolean | undefined;
227
+ }[] | undefined;
228
+ }>>;
229
+ }, "strict", z.ZodTypeAny, {
230
+ name?: string | undefined;
231
+ sandbox?: {
232
+ discordId?: string | undefined;
233
+ devices?: {
234
+ pushToken?: string | undefined;
235
+ }[] | undefined;
236
+ } | undefined;
237
+ timezone?: string | undefined;
238
+ config?: {
239
+ agenda?: {
240
+ itemCategories?: string[] | undefined;
241
+ itemTypes?: string[] | undefined;
242
+ } | undefined;
243
+ people?: {
244
+ propertyKeys?: string[] | undefined;
245
+ } | undefined;
246
+ modules?: {
247
+ type?: ModuleType | undefined;
248
+ visible?: boolean | undefined;
249
+ }[] | undefined;
250
+ } | undefined;
251
+ }, {
252
+ name?: string | undefined;
253
+ sandbox?: {
254
+ discordId?: string | undefined;
255
+ devices?: {
256
+ pushToken?: string | undefined;
257
+ }[] | undefined;
258
+ } | undefined;
259
+ timezone?: string | undefined;
260
+ config?: {
261
+ agenda?: {
262
+ itemCategories?: string[] | undefined;
263
+ itemTypes?: string[] | undefined;
264
+ } | undefined;
265
+ people?: {
266
+ propertyKeys?: string[] | undefined;
267
+ } | undefined;
268
+ modules?: {
269
+ type?: ModuleType | undefined;
270
+ visible?: boolean | undefined;
271
+ }[] | undefined;
272
+ } | undefined;
273
+ }>;
274
+ export type UserModuleData = z.infer<typeof moduleSchema>;
275
+ export type UserDeviceData = z.infer<typeof deviceSchema>;
276
+ export type UserData = z.infer<typeof userSchema>;
277
+ export type UpdateUserRequest = z.infer<typeof updateUserRequestSchema>;
278
+ export interface GetUserResponse {
279
+ user: Serialized<UserData>;
280
+ }
281
+ export interface UpdateUserResponse {
282
+ user: Serialized<UserData>;
283
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateUserRequestSchema = exports.userSchema = exports.deviceSchema = exports.moduleSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const id_types_1 = require("./id-types");
6
+ const enums_1 = require("../enums");
7
+ exports.moduleSchema = zod_1.z.object({
8
+ type: zod_1.z.nativeEnum(enums_1.ModuleType),
9
+ visible: zod_1.z.boolean()
10
+ });
11
+ exports.deviceSchema = zod_1.z.object({
12
+ pushToken: zod_1.z.string()
13
+ });
14
+ exports.userSchema = zod_1.z.object({
15
+ _id: id_types_1.userIdSchema,
16
+ createdAt: zod_1.z.date(),
17
+ updatedAt: zod_1.z.date(),
18
+ sandbox: zod_1.z.object({
19
+ discordId: zod_1.z.string().optional(),
20
+ devices: zod_1.z.array(exports.deviceSchema)
21
+ }),
22
+ name: zod_1.z.string().min(1),
23
+ timezone: zod_1.z.string().refine((tz) => {
24
+ try {
25
+ Intl.DateTimeFormat(undefined, { timeZone: tz });
26
+ return true;
27
+ }
28
+ catch (e) {
29
+ return false;
30
+ }
31
+ }),
32
+ config: zod_1.z.object({
33
+ modules: zod_1.z.array(exports.moduleSchema),
34
+ agenda: zod_1.z.object({
35
+ itemCategories: zod_1.z.array(zod_1.z.string()),
36
+ itemTypes: zod_1.z.array(zod_1.z.string())
37
+ }),
38
+ people: zod_1.z.object({
39
+ propertyKeys: zod_1.z.array(zod_1.z.string())
40
+ })
41
+ })
42
+ });
43
+ exports.updateUserRequestSchema = exports.userSchema
44
+ .omit({ _id: true, createdAt: true, updatedAt: true })
45
+ .deepPartial()
46
+ .strict();
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@timothyw/pat-common",
3
3
  "description": "",
4
4
  "author": "Timothy Washburn",
5
- "version": "1.0.118",
5
+ "version": "1.0.120",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { itemIdSchema, userIdSchema } from '../id-types';
3
- import { Serialized } from '../../utils';
2
+ import { itemIdSchema, userIdSchema } from './id-types';
3
+ import { Serialized } from '../utils';
4
4
 
5
5
  export const agendaItemSchema = z.object({
6
6
  _id: itemIdSchema,
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { authIdSchema, userIdSchema } from '../id-types';
2
+ import { authIdSchema, userIdSchema } from './id-types';
3
3
 
4
4
  export const authTokensSchema = z.object({
5
5
  accessToken: z.string(),
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { habitIdSchema, habitEntryIdSchema, userIdSchema } from '../id-types';
3
- import { dateOnlyStringSchema } from '../misc-types';
4
- import { Serialized } from '../../utils';
2
+ import { habitIdSchema, habitEntryIdSchema, userIdSchema } from './id-types';
3
+ import { dateOnlyStringSchema } from './misc/misc-types';
4
+ import { Serialized } from '../utils';
5
5
 
6
6
  export enum HabitFrequency {
7
7
  DAILY = 'daily',
@@ -1,7 +1,12 @@
1
- // export * from './api'
2
- // export * from './models'
3
- export * from './new'
4
- // export * from './auth-tokens'
5
- export * from './id-types'
6
- export * from './misc-types'
7
- export * from './socket-message-types'
1
+ export * from './misc';
2
+ export * from './agenda-types';
3
+ export * from './thoughts-types';
4
+ export * from './habits-types';
5
+ export * from './id-types';
6
+ export * from './people-types';
7
+ export * from './lists-types';
8
+ export * from './notifications-types';
9
+ export * from './auth-types';
10
+ export * from './user-types';
11
+ export * from './program-config-types';
12
+ export * from './misc';
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { listIdSchema, listItemIdSchema, userIdSchema } from '../id-types';
3
- import { Serialized } from '../../utils';
2
+ import { listIdSchema, listItemIdSchema, userIdSchema } from './id-types';
3
+ import { Serialized } from '../utils';
4
4
 
5
5
  export enum ListType {
6
6
  TASKS = 'tasks',
@@ -0,0 +1,3 @@
1
+ export * from './misc-types';
2
+ export * from './socket-message-types';
3
+ export * from './version-types';
@@ -1,16 +1,44 @@
1
1
  import { z } from 'zod';
2
- import { notificationTemplateIdSchema, notificationInstanceIdSchema, userIdSchema } from '../id-types';
3
- import { Serialized } from '../../utils';
2
+ import { notificationTemplateIdSchema, notificationInstanceIdSchema, userIdSchema } from './id-types';
3
+ import { Serialized } from '../utils';
4
+
5
+ export interface NotificationContext<T = any> {
6
+ entityId: string;
7
+ entityType: NotificationEntityType;
8
+ entityData: T;
9
+ userId: string;
10
+ variables: Record<string, any>;
11
+ }
12
+
13
+ export enum NotificationEntityType {
14
+ AGENDA = 'agenda',
15
+ TASKS = 'tasks',
16
+ HABITS = 'habits',
17
+ INBOX = 'inbox',
18
+ AGENDA_ITEM = 'agenda_item',
19
+ HABIT = 'habit',
20
+ AGENDA_DEFAULTS = 'agenda_defaults',
21
+ HABITS_DEFAULTS = 'habits_defaults',
22
+ INBOX_PANEL = 'inbox_panel'
23
+ }
4
24
 
5
- export const notificationEntityTypeSchema = z.enum([
6
- 'agenda', 'tasks', 'habits', 'inbox',
7
- 'agenda_item', 'habit',
8
- 'agenda_defaults', 'habits_defaults'
9
- ]);
25
+ export const notificationEntityTypeSchema = z.nativeEnum(NotificationEntityType);
10
26
 
11
- export const notificationStatusSchema = z.enum(['scheduled', 'sent', 'failed', 'cancelled']);
27
+ export enum NotificationStatus {
28
+ SCHEDULED = 'scheduled',
29
+ SENT = 'sent',
30
+ FAILED = 'failed',
31
+ CANCELLED = 'cancelled'
32
+ }
33
+
34
+ export enum NotificationTriggerType {
35
+ TIME_BASED = 'time_based',
36
+ EVENT_BASED = 'event_based',
37
+ RECURRING = 'recurring'
38
+ }
12
39
 
13
- export const notificationTriggerTypeSchema = z.enum(['time_based', 'event_based', 'recurring']);
40
+ export const notificationStatusSchema = z.nativeEnum(NotificationStatus);
41
+ export const notificationTriggerTypeSchema = z.nativeEnum(NotificationTriggerType);
14
42
 
15
43
  export const notificationTriggerSchema = z.object({
16
44
  type: notificationTriggerTypeSchema,
@@ -130,9 +158,17 @@ export const getNotificationInstancesRequestSchema = z.object({
130
158
  offset: z.number().optional()
131
159
  });
132
160
 
133
- export type NotificationEntityType = z.infer<typeof notificationEntityTypeSchema>;
134
- export type NotificationTriggerType = z.infer<typeof notificationTriggerTypeSchema>;
135
- export type NotificationStatus = z.infer<typeof notificationStatusSchema>;
161
+ export const entitySyncRequestSchema = z.object({
162
+ entityType: z.string(),
163
+ entityId: z.string(),
164
+ synced: z.boolean()
165
+ });
166
+
167
+ export const getEntitySyncRequestSchema = z.object({
168
+ entityType: z.string(),
169
+ entityId: z.string()
170
+ });
171
+
136
172
  export type NotificationTrigger = z.infer<typeof notificationTriggerSchema>;
137
173
  export type NotificationContent = z.infer<typeof notificationContentSchema>;
138
174
  export type NotificationTemplateData = z.infer<typeof notificationTemplateSchema>;
@@ -145,6 +181,8 @@ export type UpdateNotificationTemplateRequest = z.infer<typeof updateNotificatio
145
181
  export type SyncNotificationTemplateRequest = z.infer<typeof syncNotificationTemplateRequestSchema>;
146
182
  export type PreviewNotificationTemplateRequest = z.infer<typeof previewNotificationTemplateRequestSchema>;
147
183
  export type GetNotificationInstancesRequest = z.infer<typeof getNotificationInstancesRequestSchema>;
184
+ export type EntitySyncRequest = z.infer<typeof entitySyncRequestSchema>;
185
+ export type GetEntitySyncRequest = z.infer<typeof getEntitySyncRequestSchema>;
148
186
 
149
187
  export interface CreateNotificationTemplateResponse {
150
188
  template: Serialized<NotificationTemplateData>;
@@ -182,4 +220,18 @@ export interface GetNotificationInstancesResponse {
182
220
  instances?: Serialized<NotificationInstanceData>[];
183
221
  total?: number;
184
222
  error?: string;
223
+ }
224
+
225
+ export interface EntitySyncResponse {
226
+ success: boolean;
227
+ synced: boolean;
228
+ templates?: Serialized<NotificationTemplateData>[];
229
+ error?: string;
230
+ }
231
+
232
+ export interface GetEntitySyncResponse {
233
+ success: boolean;
234
+ synced: boolean;
235
+ hasParentTemplates: boolean;
236
+ error?: string;
185
237
  }
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { personIdSchema, personNoteIdSchema, userIdSchema } from '../id-types';
3
- import { Serialized } from '../../utils';
2
+ import { personIdSchema, personNoteIdSchema, userIdSchema } from './id-types';
3
+ import { Serialized } from '../utils';
4
4
 
5
5
  export const personPropertySchema = z.object({
6
6
  key: z.string(),
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { thoughtIdSchema, userIdSchema } from '../id-types';
3
- import { Serialized } from '../../utils';
2
+ import { thoughtIdSchema, userIdSchema } from './id-types';
3
+ import { Serialized } from '../utils';
4
4
 
5
5
  export const thoughtSchema = z.object({
6
6
  _id: thoughtIdSchema,
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { userIdSchema } from '../id-types';
3
- import { Serialized } from '../../utils';
4
- import { ModuleType } from '../../enums';
2
+ import { userIdSchema } from './id-types';
3
+ import { Serialized } from '../utils';
4
+ import { ModuleType } from '../enums';
5
5
 
6
6
  export const moduleSchema = z.object({
7
7
  type: z.nativeEnum(ModuleType),
@@ -1,10 +0,0 @@
1
- export * from './agenda-types';
2
- export * from './thoughts-types';
3
- export * from './habits-types';
4
- export * from './people-types';
5
- export * from './lists-types';
6
- export * from './notifications-types';
7
- export * from './auth-types';
8
- export * from './user-types';
9
- export * from './program-config-types';
10
- export * from './misc';
@@ -1 +0,0 @@
1
- export * from './version-types';
@@ -1,6 +0,0 @@
1
- import { UserData } from "../../models";
2
- import { Serialized } from "../../../../utils";
3
-
4
- export interface GetUserResponse {
5
- user: Serialized<UserData>;
6
- }
@@ -1,2 +0,0 @@
1
- export * from './get-user-types';
2
- export * from './update-user-types';
@@ -1,14 +0,0 @@
1
- import { z } from "zod";
2
- import { UserData, userDataSchema } from "../../models";
3
- import { Serialized } from "../../../../utils";
4
-
5
- export const updateUserRequestSchema = userDataSchema
6
- .omit({ _id: true, createdAt: true, updatedAt: true })
7
- .deepPartial()
8
- .strict();
9
-
10
- export type UpdateUserRequest = z.infer<typeof updateUserRequestSchema>;
11
-
12
- export interface UpdateUserResponse {
13
- user: Serialized<UserData>;
14
- }
@@ -1,17 +0,0 @@
1
- import { z } from "zod";
2
- import { UserId } from "../../../id-types";
3
-
4
- export const createAccountRequestSchema = z.object({
5
- name: z.string().trim().min(1),
6
- email: z.string().trim().email(),
7
- password: z.string().min(4),
8
- skipVerificationEmail: z.boolean().optional()
9
- });
10
-
11
- export type CreateAccountRequest = z.infer<typeof createAccountRequestSchema>;
12
-
13
- export interface CreateAccountResponse {
14
- id: UserId;
15
- name: string;
16
- email: string;
17
- }
@@ -1,5 +0,0 @@
1
- export * from './sign-in-types'
2
- export * from './refresh-auth-types'
3
- export * from './create-account-types'
4
- export * from './resend-verification-types'
5
- export * from './verify-email-types'
@@ -1,14 +0,0 @@
1
- import { z } from "zod";
2
- import { AuthTokens } from "../../auth-tokens";
3
- import { PublicAuthData } from "../../models";
4
-
5
- export const refreshAuthRequestSchema = z.object({
6
- refreshToken: z.string()
7
- });
8
-
9
- export type RefreshAuthRequest = z.infer<typeof refreshAuthRequestSchema>;
10
-
11
- export interface RefreshAuthResponse {
12
- tokenData: AuthTokens;
13
- authData: PublicAuthData;
14
- }
@@ -1,3 +0,0 @@
1
- export interface ResendVerificationResponse {
2
- sent: boolean;
3
- }
@@ -1,16 +0,0 @@
1
- import { z } from "zod";
2
- import { AuthTokens } from "../../auth-tokens";
3
- import { PublicAuthData, UserData } from "../../models";
4
-
5
- export const signInRequestSchema = z.object({
6
- email: z.string().email(),
7
- password: z.string()
8
- });
9
-
10
- export type SignInRequest = z.infer<typeof signInRequestSchema>;
11
-
12
- export interface SignInResponse {
13
- tokenData: AuthTokens;
14
- authData: PublicAuthData;
15
- user: UserData;
16
- }
@@ -1,3 +0,0 @@
1
- export interface VerifyEmailQuery {
2
- token?: string;
3
- }
@@ -1,15 +0,0 @@
1
- import { z } from "zod";
2
- import { Habit, HabitEntryStatus } from "../../models";
3
- import { dateOnlyStringSchema } from "../../../misc-types";
4
- import { Serialized } from "../../../../utils";
5
-
6
- export const createHabitEntryRequestSchema = z.object({
7
- date: dateOnlyStringSchema,
8
- status: z.nativeEnum(HabitEntryStatus)
9
- });
10
-
11
- export type CreateHabitEntryRequest = z.infer<typeof createHabitEntryRequestSchema>;
12
-
13
- export interface CreateHabitEntryResponse {
14
- habit: Serialized<Habit>;
15
- }