@timothyw/pat-common 1.0.113 → 1.0.116

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 (246) hide show
  1. package/dist/types/id-types.d.ts +2 -2
  2. package/dist/types/index.d.ts +1 -3
  3. package/dist/types/index.js +4 -3
  4. package/dist/types/new/agenda-types.d.ts +116 -0
  5. package/dist/types/new/agenda-types.js +37 -0
  6. package/dist/types/new/auth-types.d.ts +153 -0
  7. package/dist/types/new/auth-types.js +48 -0
  8. package/dist/types/new/habits-types.d.ts +317 -0
  9. package/dist/types/new/habits-types.js +70 -0
  10. package/dist/types/new/index.d.ts +10 -0
  11. package/dist/types/new/index.js +26 -0
  12. package/dist/types/new/lists-types.d.ts +164 -0
  13. package/dist/types/new/lists-types.js +50 -0
  14. package/dist/types/new/misc/index.d.ts +1 -0
  15. package/dist/types/new/misc/index.js +17 -0
  16. package/dist/types/new/misc/version-types.d.ts +26 -0
  17. package/dist/types/new/misc/version-types.js +13 -0
  18. package/dist/types/new/notifications-types.d.ts +407 -0
  19. package/dist/types/new/notifications-types.js +91 -0
  20. package/dist/types/new/people-types.d.ts +285 -0
  21. package/dist/types/new/people-types.js +58 -0
  22. package/dist/types/new/program-config-types.d.ts +105 -0
  23. package/dist/types/new/program-config-types.js +29 -0
  24. package/dist/types/new/thoughts-types.d.ts +57 -0
  25. package/dist/types/new/thoughts-types.js +18 -0
  26. package/dist/types/new/user-types.d.ts +283 -0
  27. package/dist/types/new/user-types.js +46 -0
  28. package/dist/types/old/api/account/get-user-types.d.ts +5 -0
  29. package/dist/types/old/api/account/get-user-types.js +2 -0
  30. package/dist/types/old/api/account/index.d.ts +2 -0
  31. package/dist/types/old/api/account/index.js +18 -0
  32. package/dist/types/old/api/account/update-user-types.d.ts +128 -0
  33. package/dist/types/old/api/account/update-user-types.js +8 -0
  34. package/dist/types/old/api/auth/create-account-types.d.ts +24 -0
  35. package/dist/types/old/api/auth/create-account-types.js +10 -0
  36. package/dist/types/old/api/auth/index.d.ts +5 -0
  37. package/dist/types/old/api/auth/index.js +21 -0
  38. package/dist/types/old/api/auth/refresh-auth-types.d.ts +15 -0
  39. package/dist/types/old/api/auth/refresh-auth-types.js +7 -0
  40. package/dist/types/old/api/auth/resend-verification-types.d.ts +3 -0
  41. package/dist/types/old/api/auth/resend-verification-types.js +2 -0
  42. package/dist/types/old/api/auth/sign-in-types.d.ts +19 -0
  43. package/dist/types/old/api/auth/sign-in-types.js +8 -0
  44. package/dist/types/old/api/auth/verify-email-types.d.ts +3 -0
  45. package/dist/types/old/api/auth/verify-email-types.js +2 -0
  46. package/dist/types/old/api/habits/create-habit-entry-types.d.ts +19 -0
  47. package/dist/types/old/api/habits/create-habit-entry-types.js +10 -0
  48. package/dist/types/old/api/habits/create-habit-types.d.ts +26 -0
  49. package/dist/types/old/api/habits/create-habit-types.js +12 -0
  50. package/dist/types/old/api/habits/delete-habit-entry-types.d.ts +5 -0
  51. package/dist/types/old/api/habits/delete-habit-entry-types.js +2 -0
  52. package/dist/types/old/api/habits/delete-habit-types.d.ts +3 -0
  53. package/dist/types/old/api/habits/delete-habit-types.js +2 -0
  54. package/dist/types/old/api/habits/get-habits-types.d.ts +5 -0
  55. package/dist/types/old/api/habits/get-habits-types.js +2 -0
  56. package/dist/types/old/api/habits/index.d.ts +6 -0
  57. package/dist/types/old/api/habits/index.js +22 -0
  58. package/dist/types/old/api/habits/update-habit-types.d.ts +26 -0
  59. package/dist/types/old/api/habits/update-habit-types.js +12 -0
  60. package/dist/types/old/api/index.d.ts +9 -0
  61. package/dist/types/old/api/index.js +25 -0
  62. package/dist/types/old/api/items/complete-item-types.d.ts +14 -0
  63. package/dist/types/old/api/items/complete-item-types.js +7 -0
  64. package/dist/types/old/api/items/create-item-types.d.ts +29 -0
  65. package/dist/types/old/api/items/create-item-types.js +12 -0
  66. package/dist/types/old/api/items/delete-item-types.d.ts +3 -0
  67. package/dist/types/old/api/items/delete-item-types.js +2 -0
  68. package/dist/types/old/api/items/get-items-types.d.ts +5 -0
  69. package/dist/types/old/api/items/get-items-types.js +2 -0
  70. package/dist/types/old/api/items/index.d.ts +5 -0
  71. package/dist/types/old/api/items/index.js +21 -0
  72. package/dist/types/old/api/items/update-item-types.d.ts +29 -0
  73. package/dist/types/old/api/items/update-item-types.js +12 -0
  74. package/dist/types/old/api/lists/complete-list-item-types.d.ts +14 -0
  75. package/dist/types/old/api/lists/complete-list-item-types.js +7 -0
  76. package/dist/types/old/api/lists/create-list-item-types.d.ts +22 -0
  77. package/dist/types/old/api/lists/create-list-item-types.js +10 -0
  78. package/dist/types/old/api/lists/create-list-types.d.ts +17 -0
  79. package/dist/types/old/api/lists/create-list-types.js +9 -0
  80. package/dist/types/old/api/lists/get-list-item-types.d.ts +5 -0
  81. package/dist/types/old/api/lists/get-list-item-types.js +2 -0
  82. package/dist/types/old/api/lists/get-lists-types.d.ts +5 -0
  83. package/dist/types/old/api/lists/get-lists-types.js +2 -0
  84. package/dist/types/old/api/lists/index.d.ts +7 -0
  85. package/dist/types/old/api/lists/index.js +23 -0
  86. package/dist/types/old/api/lists/update-list-item-types.d.ts +23 -0
  87. package/dist/types/old/api/lists/update-list-item-types.js +11 -0
  88. package/dist/types/old/api/lists/update-list-types.d.ts +17 -0
  89. package/dist/types/old/api/lists/update-list-types.js +9 -0
  90. package/dist/types/old/api/misc/index.d.ts +1 -0
  91. package/dist/types/old/api/misc/index.js +17 -0
  92. package/dist/types/old/api/misc/version-types.d.ts +9 -0
  93. package/dist/types/old/api/misc/version-types.js +2 -0
  94. package/dist/types/old/api/notifications/create-notification-template-types.d.ts +78 -0
  95. package/dist/types/old/api/notifications/create-notification-template-types.js +25 -0
  96. package/dist/types/old/api/notifications/delete-notification-template-types.d.ts +5 -0
  97. package/dist/types/old/api/notifications/delete-notification-template-types.js +6 -0
  98. package/dist/types/old/api/notifications/get-notification-templates-types.d.ts +8 -0
  99. package/dist/types/old/api/notifications/get-notification-templates-types.js +6 -0
  100. package/dist/types/old/api/notifications/index.d.ts +6 -0
  101. package/dist/types/old/api/notifications/index.js +22 -0
  102. package/dist/types/old/api/notifications/preview-notification-template-types.d.ts +29 -0
  103. package/dist/types/old/api/notifications/preview-notification-template-types.js +12 -0
  104. package/dist/types/old/api/notifications/sync-notification-template-types.d.ts +14 -0
  105. package/dist/types/old/api/notifications/sync-notification-template-types.js +8 -0
  106. package/dist/types/old/api/notifications/update-notification-template-types.d.ts +69 -0
  107. package/dist/types/old/api/notifications/update-notification-template-types.js +22 -0
  108. package/dist/types/old/api/people/create-person-note-types.d.ts +19 -0
  109. package/dist/types/old/api/people/create-person-note-types.js +9 -0
  110. package/dist/types/old/api/people/create-person-types.d.ts +35 -0
  111. package/dist/types/old/api/people/create-person-types.js +13 -0
  112. package/dist/types/old/api/people/delete-person-notes-types.d.ts +3 -0
  113. package/dist/types/old/api/people/delete-person-notes-types.js +2 -0
  114. package/dist/types/old/api/people/delete-person-types.d.ts +3 -0
  115. package/dist/types/old/api/people/delete-person-types.js +2 -0
  116. package/dist/types/old/api/people/get-people-types.d.ts +5 -0
  117. package/dist/types/old/api/people/get-people-types.js +2 -0
  118. package/dist/types/old/api/people/get-person-notes-types.d.ts +5 -0
  119. package/dist/types/old/api/people/get-person-notes-types.js +2 -0
  120. package/dist/types/old/api/people/index.d.ts +8 -0
  121. package/dist/types/old/api/people/index.js +24 -0
  122. package/dist/types/old/api/people/update-person-note-types.d.ts +14 -0
  123. package/dist/types/old/api/people/update-person-note-types.js +7 -0
  124. package/dist/types/old/api/people/update-person-types.d.ts +35 -0
  125. package/dist/types/old/api/people/update-person-types.js +13 -0
  126. package/dist/types/old/api/thoughts/create-thought-types.d.ts +14 -0
  127. package/dist/types/old/api/thoughts/create-thought-types.js +7 -0
  128. package/dist/types/old/api/thoughts/delete-thought-types.d.ts +3 -0
  129. package/dist/types/old/api/thoughts/delete-thought-types.js +2 -0
  130. package/dist/types/old/api/thoughts/get-thoughts-types.d.ts +5 -0
  131. package/dist/types/old/api/thoughts/get-thoughts-types.js +2 -0
  132. package/dist/types/old/api/thoughts/index.d.ts +4 -0
  133. package/dist/types/old/api/thoughts/index.js +20 -0
  134. package/dist/types/old/api/thoughts/update-thought-types.d.ts +14 -0
  135. package/dist/types/old/api/thoughts/update-thought-types.js +7 -0
  136. package/dist/types/old/auth-tokens.d.ts +11 -0
  137. package/dist/types/old/auth-tokens.js +2 -0
  138. package/dist/types/old/models/auth-data.d.ts +14 -0
  139. package/dist/types/old/models/auth-data.js +9 -0
  140. package/dist/types/old/models/habit-data.d.ts +48 -0
  141. package/dist/types/old/models/habit-data.js +25 -0
  142. package/dist/types/old/models/index.d.ts +10 -0
  143. package/dist/types/old/models/index.js +26 -0
  144. package/dist/types/old/models/item-data.d.ts +14 -0
  145. package/dist/types/old/models/item-data.js +2 -0
  146. package/dist/types/old/models/list-data.d.ts +23 -0
  147. package/dist/types/old/models/list-data.js +8 -0
  148. package/dist/types/old/models/notifiable.d.ts +42 -0
  149. package/dist/types/old/models/notifiable.js +2 -0
  150. package/dist/types/old/models/notification-template-data.d.ts +224 -0
  151. package/dist/types/old/models/notification-template-data.js +52 -0
  152. package/dist/types/old/models/person-data.d.ts +31 -0
  153. package/dist/types/old/models/person-data.js +2 -0
  154. package/dist/types/old/models/program-config.d.ts +25 -0
  155. package/dist/types/old/models/program-config.js +2 -0
  156. package/dist/types/old/models/thought-data.d.ts +8 -0
  157. package/dist/types/old/models/thought-data.js +2 -0
  158. package/dist/types/old/models/user-data.d.ts +147 -0
  159. package/dist/types/old/models/user-data.js +42 -0
  160. package/dist/utils/index.d.ts +1 -0
  161. package/dist/utils/index.js +1 -0
  162. package/dist/utils/type-helpers.d.ts +4 -0
  163. package/dist/utils/type-helpers.js +19 -0
  164. package/package.json +1 -1
  165. package/src/types/id-types.ts +2 -2
  166. package/src/types/index.ts +4 -3
  167. package/src/types/new/agenda-types.ts +69 -0
  168. package/src/types/new/auth-types.ts +92 -0
  169. package/src/types/new/habits-types.ts +112 -0
  170. package/src/types/new/index.ts +10 -0
  171. package/src/types/new/lists-types.ts +108 -0
  172. package/src/types/new/misc/index.ts +1 -0
  173. package/src/types/new/misc/version-types.ts +15 -0
  174. package/src/types/new/notifications-types.ts +144 -0
  175. package/src/types/new/people-types.ts +110 -0
  176. package/src/types/new/program-config-types.ts +29 -0
  177. package/src/types/new/thoughts-types.ts +44 -0
  178. package/src/types/new/user-types.ts +61 -0
  179. package/src/types/{api → old/api}/account/get-user-types.ts +1 -1
  180. package/src/types/{api → old/api}/account/update-user-types.ts +1 -1
  181. package/src/types/{api → old/api}/auth/create-account-types.ts +1 -1
  182. package/src/types/{api → old/api}/habits/create-habit-entry-types.ts +2 -2
  183. package/src/types/{api → old/api}/habits/create-habit-types.ts +1 -1
  184. package/src/types/{api → old/api}/habits/delete-habit-entry-types.ts +1 -1
  185. package/src/types/{api → old/api}/habits/get-habits-types.ts +1 -1
  186. package/src/types/{api → old/api}/habits/update-habit-types.ts +1 -1
  187. package/src/types/{api → old/api}/items/complete-item-types.ts +1 -1
  188. package/src/types/{api → old/api}/items/create-item-types.ts +1 -1
  189. package/src/types/{api → old/api}/items/get-items-types.ts +1 -1
  190. package/src/types/{api → old/api}/items/update-item-types.ts +1 -1
  191. package/src/types/{api → old/api}/lists/complete-list-item-types.ts +1 -1
  192. package/src/types/{api → old/api}/lists/create-list-item-types.ts +2 -2
  193. package/src/types/{api → old/api}/lists/create-list-types.ts +1 -1
  194. package/src/types/{api → old/api}/lists/get-list-item-types.ts +1 -1
  195. package/src/types/{api → old/api}/lists/get-lists-types.ts +1 -1
  196. package/src/types/{api → old/api}/lists/update-list-item-types.ts +2 -2
  197. package/src/types/{api → old/api}/lists/update-list-types.ts +1 -1
  198. package/src/types/{api → old/api}/notifications/create-notification-template-types.ts +1 -1
  199. package/src/types/{api → old/api}/notifications/get-notification-templates-types.ts +1 -1
  200. package/src/types/{api → old/api}/notifications/sync-notification-template-types.ts +1 -1
  201. package/src/types/{api → old/api}/notifications/update-notification-template-types.ts +1 -1
  202. package/src/types/{api → old/api}/people/create-person-note-types.ts +2 -2
  203. package/src/types/{api → old/api}/people/create-person-types.ts +2 -2
  204. package/src/types/{api → old/api}/people/get-people-types.ts +1 -1
  205. package/src/types/{api → old/api}/people/get-person-notes-types.ts +1 -1
  206. package/src/types/{api → old/api}/people/update-person-note-types.ts +1 -1
  207. package/src/types/{api → old/api}/people/update-person-types.ts +2 -2
  208. package/src/types/{api → old/api}/thoughts/create-thought-types.ts +1 -1
  209. package/src/types/{api → old/api}/thoughts/get-thoughts-types.ts +1 -1
  210. package/src/types/{api → old/api}/thoughts/update-thought-types.ts +1 -1
  211. package/src/types/{models → old/models}/auth-data.ts +1 -1
  212. package/src/types/{models → old/models}/habit-data.ts +2 -2
  213. package/src/types/{models → old/models}/item-data.ts +1 -1
  214. package/src/types/{models → old/models}/list-data.ts +1 -1
  215. package/src/types/{models → old/models}/notification-template-data.ts +1 -1
  216. package/src/types/{models → old/models}/person-data.ts +1 -1
  217. package/src/types/{models → old/models}/thought-data.ts +1 -1
  218. package/src/types/{models → old/models}/user-data.ts +2 -2
  219. package/src/utils/index.ts +2 -1
  220. package/src/utils/type-helpers.ts +19 -0
  221. /package/src/types/{api → old/api}/account/index.ts +0 -0
  222. /package/src/types/{api → old/api}/auth/index.ts +0 -0
  223. /package/src/types/{api → old/api}/auth/refresh-auth-types.ts +0 -0
  224. /package/src/types/{api → old/api}/auth/resend-verification-types.ts +0 -0
  225. /package/src/types/{api → old/api}/auth/sign-in-types.ts +0 -0
  226. /package/src/types/{api → old/api}/auth/verify-email-types.ts +0 -0
  227. /package/src/types/{api → old/api}/habits/delete-habit-types.ts +0 -0
  228. /package/src/types/{api → old/api}/habits/index.ts +0 -0
  229. /package/src/types/{api → old/api}/index.ts +0 -0
  230. /package/src/types/{api → old/api}/items/delete-item-types.ts +0 -0
  231. /package/src/types/{api → old/api}/items/index.ts +0 -0
  232. /package/src/types/{api → old/api}/lists/index.ts +0 -0
  233. /package/src/types/{api → old/api}/misc/index.ts +0 -0
  234. /package/src/types/{api → old/api}/misc/version-types.ts +0 -0
  235. /package/src/types/{api → old/api}/notifications/delete-notification-template-types.ts +0 -0
  236. /package/src/types/{api → old/api}/notifications/index.ts +0 -0
  237. /package/src/types/{api → old/api}/notifications/preview-notification-template-types.ts +0 -0
  238. /package/src/types/{api → old/api}/people/delete-person-notes-types.ts +0 -0
  239. /package/src/types/{api → old/api}/people/delete-person-types.ts +0 -0
  240. /package/src/types/{api → old/api}/people/index.ts +0 -0
  241. /package/src/types/{api → old/api}/thoughts/delete-thought-types.ts +0 -0
  242. /package/src/types/{api → old/api}/thoughts/index.ts +0 -0
  243. /package/src/types/{auth-tokens.ts → old/auth-tokens.ts} +0 -0
  244. /package/src/types/{models → old/models}/index.ts +0 -0
  245. /package/src/types/{models → old/models}/notifiable.ts +0 -0
  246. /package/src/types/{models → old/models}/program-config.ts +0 -0
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { Serialized } from "../../../../utils";
3
+ import { ThoughtData } from "../../models";
4
+ export declare const updateThoughtRequestSchema: z.ZodObject<{
5
+ content: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ content: string;
8
+ }, {
9
+ content: string;
10
+ }>;
11
+ export type UpdateThoughtRequest = z.infer<typeof updateThoughtRequestSchema>;
12
+ export interface UpdateThoughtResponse {
13
+ thought: Serialized<ThoughtData>;
14
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateThoughtRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.updateThoughtRequestSchema = zod_1.z.object({
6
+ content: zod_1.z.string().min(1)
7
+ });
@@ -0,0 +1,11 @@
1
+ export interface AuthTokens {
2
+ accessToken: string;
3
+ refreshToken: string;
4
+ }
5
+ export interface TokenPayload {
6
+ authId: string;
7
+ userId: string;
8
+ }
9
+ export interface RefreshTokenPayload extends TokenPayload {
10
+ tokenId: string;
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ import { AuthId, UserId } from "../../id-types";
2
+ export interface AuthData {
3
+ _id: AuthId;
4
+ createdAt: Date;
5
+ updatedAt: Date;
6
+ userId: UserId;
7
+ email: string;
8
+ passwordHash: string;
9
+ emailVerified: boolean;
10
+ }
11
+ export type PublicAuthData = Pick<AuthData, 'email' | 'emailVerified'> & {
12
+ readonly __brand: unique symbol;
13
+ };
14
+ export declare function toPublicAuthData(data: AuthData): PublicAuthData;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toPublicAuthData = toPublicAuthData;
4
+ function toPublicAuthData(data) {
5
+ return {
6
+ email: data.email,
7
+ emailVerified: data.emailVerified
8
+ };
9
+ }
@@ -0,0 +1,48 @@
1
+ import { DateOnlyString } from "../../misc-types";
2
+ import { HabitEntryId, HabitId, UserId } from "../../id-types";
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 interface HabitEntryData {
16
+ _id: HabitEntryId;
17
+ habitId: HabitId;
18
+ userId: UserId;
19
+ date: DateOnlyString;
20
+ status: HabitEntryStatus;
21
+ createdAt: Date;
22
+ updatedAt: Date;
23
+ }
24
+ export interface HabitData {
25
+ _id: HabitId;
26
+ userId: UserId;
27
+ name: string;
28
+ description?: string | null;
29
+ notes?: string | null;
30
+ frequency: HabitFrequency;
31
+ rolloverTime: string;
32
+ firstDay: DateOnlyString;
33
+ createdAt: Date;
34
+ updatedAt: Date;
35
+ }
36
+ export interface HabitStats {
37
+ totalDays: number;
38
+ completedDays: number;
39
+ excusedDays: number;
40
+ missedDays: number;
41
+ completionRate: number;
42
+ }
43
+ export type HabitEntry = HabitEntryData;
44
+ export type Habit = HabitData & {
45
+ entries: HabitEntry[];
46
+ stats: HabitStats;
47
+ };
48
+ export declare const toHabit: (data: HabitData, entries: HabitEntryData[], stats: HabitStats) => Habit;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toHabit = exports.HabitEntryStatus = exports.HabitFrequency = void 0;
4
+ var HabitFrequency;
5
+ (function (HabitFrequency) {
6
+ HabitFrequency["DAILY"] = "daily";
7
+ HabitFrequency["WEEKLY"] = "weekly";
8
+ HabitFrequency["EVERY_N_DAYS"] = "every_n_days";
9
+ HabitFrequency["WEEKDAYS_ONLY"] = "weekdays_only";
10
+ HabitFrequency["CUSTOM"] = "custom";
11
+ })(HabitFrequency || (exports.HabitFrequency = HabitFrequency = {}));
12
+ var HabitEntryStatus;
13
+ (function (HabitEntryStatus) {
14
+ HabitEntryStatus["COMPLETED"] = "completed";
15
+ HabitEntryStatus["EXCUSED"] = "excused";
16
+ HabitEntryStatus["MISSED"] = "missed";
17
+ })(HabitEntryStatus || (exports.HabitEntryStatus = HabitEntryStatus = {}));
18
+ const toHabit = (data, entries, stats) => {
19
+ return {
20
+ ...data,
21
+ entries,
22
+ stats
23
+ };
24
+ };
25
+ exports.toHabit = toHabit;
@@ -0,0 +1,10 @@
1
+ export * from './auth-data';
2
+ export * from './habit-data';
3
+ export * from './item-data';
4
+ export * from './notification-template-data';
5
+ export * from './notifiable';
6
+ export * from './person-data';
7
+ export * from './program-config';
8
+ export * from './list-data';
9
+ export * from './thought-data';
10
+ export * from './user-data';
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./auth-data"), exports);
18
+ __exportStar(require("./habit-data"), exports);
19
+ __exportStar(require("./item-data"), exports);
20
+ __exportStar(require("./notification-template-data"), exports);
21
+ __exportStar(require("./notifiable"), exports);
22
+ __exportStar(require("./person-data"), exports);
23
+ __exportStar(require("./program-config"), exports);
24
+ __exportStar(require("./list-data"), exports);
25
+ __exportStar(require("./thought-data"), exports);
26
+ __exportStar(require("./user-data"), exports);
@@ -0,0 +1,14 @@
1
+ import { ItemId, UserId } from "../../id-types";
2
+ export interface ItemData {
3
+ _id: ItemId;
4
+ userId: UserId;
5
+ createdAt: Date;
6
+ updatedAt: Date;
7
+ name: string;
8
+ dueDate?: Date;
9
+ notes?: string;
10
+ completed: boolean;
11
+ urgent: boolean;
12
+ category?: string;
13
+ type?: string;
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,23 @@
1
+ import { ListItemId, ListId, UserId } from "../../id-types";
2
+ export declare enum ListType {
3
+ TASKS = "tasks",
4
+ NOTES = "notes"
5
+ }
6
+ export interface ListItemData {
7
+ _id: ListItemId;
8
+ userId: UserId;
9
+ createdAt: Date;
10
+ updatedAt: Date;
11
+ name: string;
12
+ notes?: string;
13
+ completed: boolean;
14
+ listId: ListId;
15
+ }
16
+ export interface ListData {
17
+ _id: ListId;
18
+ userId: UserId;
19
+ createdAt: Date;
20
+ updatedAt: Date;
21
+ name: string;
22
+ type: ListType;
23
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ListType = void 0;
4
+ var ListType;
5
+ (function (ListType) {
6
+ ListType["TASKS"] = "tasks";
7
+ ListType["NOTES"] = "notes";
8
+ })(ListType || (exports.ListType = ListType = {}));
@@ -0,0 +1,42 @@
1
+ import { NotificationTemplateData, NotificationEntityType } from "./notification-template-data";
2
+ export interface NotificationContext<T = any> {
3
+ entityId: string;
4
+ entityType: NotificationEntityType;
5
+ entityData: T;
6
+ userId: string;
7
+ variables: Record<string, any>;
8
+ }
9
+ export interface INotifiable<T = any> {
10
+ /**
11
+ * Get the ID of this notifiable entity
12
+ */
13
+ getId(): string;
14
+ /**
15
+ * Get the entity type for notification purposes
16
+ */
17
+ getNotificationEntityType(): NotificationEntityType;
18
+ /**
19
+ * Get context data for notification template variables
20
+ */
21
+ getNotificationContext(): NotificationContext<T>;
22
+ /**
23
+ * Get inherited notification templates from parent entities
24
+ */
25
+ getInheritedNotificationTemplates(): Promise<NotificationTemplateData[]>;
26
+ /**
27
+ * Get custom notification templates specific to this entity
28
+ */
29
+ getCustomNotificationTemplates(): Promise<NotificationTemplateData[]>;
30
+ /**
31
+ * Get all effective notification templates (inherited + custom)
32
+ */
33
+ getAllNotificationTemplates(): Promise<NotificationTemplateData[]>;
34
+ /**
35
+ * Register notification triggers when entity is created/updated
36
+ */
37
+ registerNotificationTriggers(): Promise<void>;
38
+ /**
39
+ * Remove notification triggers when entity is deleted
40
+ */
41
+ removeNotificationTriggers(): Promise<void>;
42
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,224 @@
1
+ import { z } from "zod";
2
+ import { NotificationTemplateId, UserId } from "../../id-types";
3
+ export declare const notificationEntityTypeSchema: z.ZodEnum<["agenda", "tasks", "habits", "inbox", "agenda_item", "habit", "agenda_defaults", "habits_defaults"]>;
4
+ export type NotificationEntityType = z.infer<typeof notificationEntityTypeSchema>;
5
+ export declare const notificationTriggerTypeSchema: z.ZodEnum<["time_based", "event_based", "recurring"]>;
6
+ export type NotificationTriggerType = z.infer<typeof notificationTriggerTypeSchema>;
7
+ export declare const notificationTriggerSchema: z.ZodObject<{
8
+ type: z.ZodEnum<["time_based", "event_based", "recurring"]>;
9
+ conditions: z.ZodRecord<z.ZodString, z.ZodAny>;
10
+ timing: z.ZodRecord<z.ZodString, z.ZodAny>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ type: "time_based" | "event_based" | "recurring";
13
+ conditions: Record<string, any>;
14
+ timing: Record<string, any>;
15
+ }, {
16
+ type: "time_based" | "event_based" | "recurring";
17
+ conditions: Record<string, any>;
18
+ timing: Record<string, any>;
19
+ }>;
20
+ export type NotificationTrigger = z.infer<typeof notificationTriggerSchema>;
21
+ export declare const notificationContentSchema: z.ZodObject<{
22
+ title: z.ZodString;
23
+ body: z.ZodString;
24
+ variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ title: string;
27
+ body: string;
28
+ variables?: Record<string, string> | undefined;
29
+ }, {
30
+ title: string;
31
+ body: string;
32
+ variables?: Record<string, string> | undefined;
33
+ }>;
34
+ export type NotificationContent = z.infer<typeof notificationContentSchema>;
35
+ export declare const notificationTemplateDataSchema: z.ZodObject<{
36
+ _id: z.ZodEffects<z.ZodString, NotificationTemplateId, string>;
37
+ userId: z.ZodEffects<z.ZodString, UserId, string>;
38
+ entityType: z.ZodEnum<["agenda", "tasks", "habits", "inbox", "agenda_item", "habit", "agenda_defaults", "habits_defaults"]>;
39
+ entityId: z.ZodOptional<z.ZodString>;
40
+ name: z.ZodString;
41
+ description: z.ZodOptional<z.ZodString>;
42
+ trigger: z.ZodObject<{
43
+ type: z.ZodEnum<["time_based", "event_based", "recurring"]>;
44
+ conditions: z.ZodRecord<z.ZodString, z.ZodAny>;
45
+ timing: z.ZodRecord<z.ZodString, z.ZodAny>;
46
+ }, "strip", z.ZodTypeAny, {
47
+ type: "time_based" | "event_based" | "recurring";
48
+ conditions: Record<string, any>;
49
+ timing: Record<string, any>;
50
+ }, {
51
+ type: "time_based" | "event_based" | "recurring";
52
+ conditions: Record<string, any>;
53
+ timing: Record<string, any>;
54
+ }>;
55
+ content: z.ZodObject<{
56
+ title: z.ZodString;
57
+ body: z.ZodString;
58
+ variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
59
+ }, "strip", z.ZodTypeAny, {
60
+ title: string;
61
+ body: string;
62
+ variables?: Record<string, string> | undefined;
63
+ }, {
64
+ title: string;
65
+ body: string;
66
+ variables?: Record<string, string> | undefined;
67
+ }>;
68
+ active: z.ZodDefault<z.ZodBoolean>;
69
+ inheritedFrom: z.ZodOptional<z.ZodEffects<z.ZodString, NotificationTemplateId, string>>;
70
+ customized: z.ZodDefault<z.ZodBoolean>;
71
+ createdAt: z.ZodDate;
72
+ updatedAt: z.ZodDate;
73
+ }, "strip", z.ZodTypeAny, {
74
+ _id: string & {
75
+ readonly __brand: "NotificationTemplateId";
76
+ };
77
+ createdAt: Date;
78
+ updatedAt: Date;
79
+ userId: string & {
80
+ readonly __brand: "UserId";
81
+ };
82
+ name: string;
83
+ content: {
84
+ title: string;
85
+ body: string;
86
+ variables?: Record<string, string> | undefined;
87
+ };
88
+ entityType: "agenda" | "inbox" | "habits" | "tasks" | "agenda_item" | "habit" | "agenda_defaults" | "habits_defaults";
89
+ trigger: {
90
+ type: "time_based" | "event_based" | "recurring";
91
+ conditions: Record<string, any>;
92
+ timing: Record<string, any>;
93
+ };
94
+ active: boolean;
95
+ customized: boolean;
96
+ description?: string | undefined;
97
+ entityId?: string | undefined;
98
+ inheritedFrom?: NotificationTemplateId | undefined;
99
+ }, {
100
+ _id: string;
101
+ createdAt: Date;
102
+ updatedAt: Date;
103
+ userId: string;
104
+ name: string;
105
+ content: {
106
+ title: string;
107
+ body: string;
108
+ variables?: Record<string, string> | undefined;
109
+ };
110
+ entityType: "agenda" | "inbox" | "habits" | "tasks" | "agenda_item" | "habit" | "agenda_defaults" | "habits_defaults";
111
+ trigger: {
112
+ type: "time_based" | "event_based" | "recurring";
113
+ conditions: Record<string, any>;
114
+ timing: Record<string, any>;
115
+ };
116
+ description?: string | undefined;
117
+ entityId?: string | undefined;
118
+ active?: boolean | undefined;
119
+ inheritedFrom?: string | undefined;
120
+ customized?: boolean | undefined;
121
+ }>;
122
+ export type NotificationTemplateData = z.infer<typeof notificationTemplateDataSchema>;
123
+ export declare const createNotificationTemplateSchema: z.ZodObject<Omit<{
124
+ _id: z.ZodEffects<z.ZodString, NotificationTemplateId, string>;
125
+ userId: z.ZodEffects<z.ZodString, UserId, string>;
126
+ entityType: z.ZodEnum<["agenda", "tasks", "habits", "inbox", "agenda_item", "habit", "agenda_defaults", "habits_defaults"]>;
127
+ entityId: z.ZodOptional<z.ZodString>;
128
+ name: z.ZodString;
129
+ description: z.ZodOptional<z.ZodString>;
130
+ trigger: z.ZodObject<{
131
+ type: z.ZodEnum<["time_based", "event_based", "recurring"]>;
132
+ conditions: z.ZodRecord<z.ZodString, z.ZodAny>;
133
+ timing: z.ZodRecord<z.ZodString, z.ZodAny>;
134
+ }, "strip", z.ZodTypeAny, {
135
+ type: "time_based" | "event_based" | "recurring";
136
+ conditions: Record<string, any>;
137
+ timing: Record<string, any>;
138
+ }, {
139
+ type: "time_based" | "event_based" | "recurring";
140
+ conditions: Record<string, any>;
141
+ timing: Record<string, any>;
142
+ }>;
143
+ content: z.ZodObject<{
144
+ title: z.ZodString;
145
+ body: z.ZodString;
146
+ variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
147
+ }, "strip", z.ZodTypeAny, {
148
+ title: string;
149
+ body: string;
150
+ variables?: Record<string, string> | undefined;
151
+ }, {
152
+ title: string;
153
+ body: string;
154
+ variables?: Record<string, string> | undefined;
155
+ }>;
156
+ active: z.ZodDefault<z.ZodBoolean>;
157
+ inheritedFrom: z.ZodOptional<z.ZodEffects<z.ZodString, NotificationTemplateId, string>>;
158
+ customized: z.ZodDefault<z.ZodBoolean>;
159
+ createdAt: z.ZodDate;
160
+ updatedAt: z.ZodDate;
161
+ }, "_id" | "createdAt" | "updatedAt">, "strip", z.ZodTypeAny, {
162
+ userId: string & {
163
+ readonly __brand: "UserId";
164
+ };
165
+ name: string;
166
+ content: {
167
+ title: string;
168
+ body: string;
169
+ variables?: Record<string, string> | undefined;
170
+ };
171
+ entityType: "agenda" | "inbox" | "habits" | "tasks" | "agenda_item" | "habit" | "agenda_defaults" | "habits_defaults";
172
+ trigger: {
173
+ type: "time_based" | "event_based" | "recurring";
174
+ conditions: Record<string, any>;
175
+ timing: Record<string, any>;
176
+ };
177
+ active: boolean;
178
+ customized: boolean;
179
+ description?: string | undefined;
180
+ entityId?: string | undefined;
181
+ inheritedFrom?: NotificationTemplateId | undefined;
182
+ }, {
183
+ userId: string;
184
+ name: string;
185
+ content: {
186
+ title: string;
187
+ body: string;
188
+ variables?: Record<string, string> | undefined;
189
+ };
190
+ entityType: "agenda" | "inbox" | "habits" | "tasks" | "agenda_item" | "habit" | "agenda_defaults" | "habits_defaults";
191
+ trigger: {
192
+ type: "time_based" | "event_based" | "recurring";
193
+ conditions: Record<string, any>;
194
+ timing: Record<string, any>;
195
+ };
196
+ description?: string | undefined;
197
+ entityId?: string | undefined;
198
+ active?: boolean | undefined;
199
+ inheritedFrom?: string | undefined;
200
+ customized?: boolean | undefined;
201
+ }>;
202
+ export type CreateNotificationTemplateData = z.infer<typeof createNotificationTemplateSchema>;
203
+ export declare const entitySyncStateSchema: z.ZodObject<{
204
+ userId: z.ZodEffects<z.ZodString, UserId, string>;
205
+ entityType: z.ZodEnum<["agenda", "tasks", "habits", "inbox", "agenda_item", "habit", "agenda_defaults", "habits_defaults"]>;
206
+ entityId: z.ZodString;
207
+ synced: z.ZodDefault<z.ZodBoolean>;
208
+ updatedAt: z.ZodDate;
209
+ }, "strip", z.ZodTypeAny, {
210
+ updatedAt: Date;
211
+ userId: string & {
212
+ readonly __brand: "UserId";
213
+ };
214
+ entityType: "agenda" | "inbox" | "habits" | "tasks" | "agenda_item" | "habit" | "agenda_defaults" | "habits_defaults";
215
+ entityId: string;
216
+ synced: boolean;
217
+ }, {
218
+ updatedAt: Date;
219
+ userId: string;
220
+ entityType: "agenda" | "inbox" | "habits" | "tasks" | "agenda_item" | "habit" | "agenda_defaults" | "habits_defaults";
221
+ entityId: string;
222
+ synced?: boolean | undefined;
223
+ }>;
224
+ export type EntitySyncState = z.infer<typeof entitySyncStateSchema>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.entitySyncStateSchema = exports.createNotificationTemplateSchema = exports.notificationTemplateDataSchema = exports.notificationContentSchema = exports.notificationTriggerSchema = exports.notificationTriggerTypeSchema = exports.notificationEntityTypeSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.notificationEntityTypeSchema = zod_1.z.enum([
6
+ // Individual entity types (notifications FOR the entity itself)
7
+ 'agenda', 'tasks', 'habits', 'inbox',
8
+ 'agenda_item', 'habit',
9
+ // Parent template types (default templates for children)
10
+ 'agenda_defaults', 'habits_defaults'
11
+ ]);
12
+ exports.notificationTriggerTypeSchema = zod_1.z.enum(['time_based', 'event_based', 'recurring']);
13
+ exports.notificationTriggerSchema = zod_1.z.object({
14
+ type: exports.notificationTriggerTypeSchema,
15
+ conditions: zod_1.z.record(zod_1.z.any()), // flexible conditions object
16
+ timing: zod_1.z.record(zod_1.z.any()) // timing configuration like "5 minutes before due"
17
+ });
18
+ exports.notificationContentSchema = zod_1.z.object({
19
+ title: zod_1.z.string(),
20
+ body: zod_1.z.string(),
21
+ // Support for template variables like {{entity.name}}
22
+ variables: zod_1.z.record(zod_1.z.string()).optional()
23
+ });
24
+ exports.notificationTemplateDataSchema = zod_1.z.object({
25
+ _id: zod_1.z.string().transform((val) => val),
26
+ userId: zod_1.z.string().transform((val) => val),
27
+ entityType: exports.notificationEntityTypeSchema,
28
+ entityId: zod_1.z.string().optional(), // null/undefined for panel-level templates
29
+ name: zod_1.z.string(),
30
+ description: zod_1.z.string().optional(),
31
+ trigger: exports.notificationTriggerSchema,
32
+ content: exports.notificationContentSchema,
33
+ active: zod_1.z.boolean().default(true),
34
+ inheritedFrom: zod_1.z.string().transform((val) => val).optional(),
35
+ customized: zod_1.z.boolean().default(false), // true if user modified inherited template
36
+ createdAt: zod_1.z.date(),
37
+ updatedAt: zod_1.z.date()
38
+ });
39
+ // Helper type for creating new templates (without _id, dates)
40
+ exports.createNotificationTemplateSchema = exports.notificationTemplateDataSchema.omit({
41
+ _id: true,
42
+ createdAt: true,
43
+ updatedAt: true
44
+ });
45
+ // Entity sync state for inheritance
46
+ exports.entitySyncStateSchema = zod_1.z.object({
47
+ userId: zod_1.z.string().transform((val) => val),
48
+ entityType: exports.notificationEntityTypeSchema,
49
+ entityId: zod_1.z.string(),
50
+ synced: zod_1.z.boolean().default(true), // true = inheriting from parent, false = has custom templates
51
+ updatedAt: zod_1.z.date()
52
+ });
@@ -0,0 +1,31 @@
1
+ import { PersonId, PersonNoteId, UserId } from "../../id-types";
2
+ export interface PersonProperty {
3
+ key: string;
4
+ value: string;
5
+ }
6
+ export interface PersonNoteData {
7
+ _id: PersonNoteId;
8
+ personId: PersonId;
9
+ userId: UserId;
10
+ content: string;
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ }
14
+ export interface PersonData {
15
+ _id: PersonId;
16
+ userId: UserId;
17
+ createdAt: Date;
18
+ updatedAt: Date;
19
+ name: string;
20
+ properties: PersonProperty[];
21
+ noteIds: PersonNoteId[];
22
+ }
23
+ export interface Person {
24
+ _id: PersonId;
25
+ userId: UserId;
26
+ createdAt: Date;
27
+ updatedAt: Date;
28
+ name: string;
29
+ properties: PersonProperty[];
30
+ notes: PersonNoteData[];
31
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,25 @@
1
+ export interface ProgramConfigData {
2
+ _requiredBuildVersions: {
3
+ iOS: number;
4
+ android: number;
5
+ };
6
+ dev: {
7
+ authorizedEmails: string[];
8
+ };
9
+ discord: {
10
+ token: string;
11
+ clientId: string;
12
+ guildId: string;
13
+ logChannelId?: string;
14
+ };
15
+ mailjet: {
16
+ apiKey: string;
17
+ secretKey: string;
18
+ };
19
+ expo: {
20
+ token: string;
21
+ };
22
+ redisUrl: string;
23
+ updatedAt: Date;
24
+ createdAt: Date;
25
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { ThoughtId, UserId } from "../../id-types";
2
+ export interface ThoughtData {
3
+ _id: ThoughtId;
4
+ userId: UserId;
5
+ createdAt: Date;
6
+ updatedAt: Date;
7
+ content: string;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });