@timothyw/pat-common 1.0.92 → 1.0.94

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 (67) hide show
  1. package/dist/types/api/account/get-user-types.d.ts +2 -1
  2. package/dist/types/api/account/update-user-types.d.ts +5 -4
  3. package/dist/types/api/habits/create-habit-entry-types.d.ts +3 -3
  4. package/dist/types/api/habits/create-habit-types.d.ts +3 -2
  5. package/dist/types/api/habits/create-habit-types.js +2 -2
  6. package/dist/types/api/habits/delete-habit-entry-types.d.ts +3 -2
  7. package/dist/types/api/habits/get-habits-types.d.ts +3 -2
  8. package/dist/types/api/habits/update-habit-types.d.ts +2 -1
  9. package/dist/types/api/items/complete-item-types.d.ts +2 -1
  10. package/dist/types/api/items/create-item-types.d.ts +4 -3
  11. package/dist/types/api/items/get-items-types.d.ts +2 -1
  12. package/dist/types/api/items/update-item-types.d.ts +4 -3
  13. package/dist/types/api/people/create-person-note-types.d.ts +2 -1
  14. package/dist/types/api/people/create-person-types.d.ts +8 -8
  15. package/dist/types/api/people/get-people-types.d.ts +2 -1
  16. package/dist/types/api/people/get-person-notes-types.d.ts +2 -1
  17. package/dist/types/api/people/update-person-note-types.d.ts +2 -1
  18. package/dist/types/api/people/update-person-types.d.ts +8 -8
  19. package/dist/types/api/tasks/complete-task-types.d.ts +3 -10
  20. package/dist/types/api/tasks/create-task-list-types.d.ts +3 -7
  21. package/dist/types/api/tasks/create-task-types.d.ts +4 -11
  22. package/dist/types/api/tasks/get-task-lists-types.d.ts +3 -7
  23. package/dist/types/api/tasks/get-tasks-types.d.ts +3 -10
  24. package/dist/types/api/tasks/update-task-list-types.d.ts +3 -7
  25. package/dist/types/api/tasks/update-task-types.d.ts +5 -12
  26. package/dist/types/api/thoughts/create-thought-types.d.ts +3 -4
  27. package/dist/types/api/thoughts/get-thoughts-types.d.ts +3 -4
  28. package/dist/types/api/thoughts/update-thought-types.d.ts +3 -4
  29. package/dist/types/models/item-data.d.ts +0 -7
  30. package/dist/types/models/item-data.js +0 -58
  31. package/dist/types/models/user-data.d.ts +2 -2
  32. package/dist/utils/index.d.ts +1 -0
  33. package/dist/utils/index.js +1 -0
  34. package/dist/utils/serializing-utils.d.ts +21 -0
  35. package/dist/utils/serializing-utils.js +93 -0
  36. package/package.json +1 -1
  37. package/src/types/api/account/get-user-types.ts +2 -1
  38. package/src/types/api/account/update-user-types.ts +2 -1
  39. package/src/types/api/habits/create-habit-entry-types.ts +3 -3
  40. package/src/types/api/habits/create-habit-types.ts +3 -3
  41. package/src/types/api/habits/delete-habit-entry-types.ts +3 -2
  42. package/src/types/api/habits/get-habits-types.ts +3 -2
  43. package/src/types/api/habits/update-habit-types.ts +2 -1
  44. package/src/types/api/items/complete-item-types.ts +2 -1
  45. package/src/types/api/items/create-item-types.ts +2 -1
  46. package/src/types/api/items/get-items-types.ts +2 -1
  47. package/src/types/api/items/update-item-types.ts +2 -1
  48. package/src/types/api/people/create-person-note-types.ts +3 -2
  49. package/src/types/api/people/create-person-types.ts +4 -3
  50. package/src/types/api/people/get-people-types.ts +3 -3
  51. package/src/types/api/people/get-person-notes-types.ts +3 -3
  52. package/src/types/api/people/update-person-note-types.ts +3 -3
  53. package/src/types/api/people/update-person-types.ts +4 -3
  54. package/src/types/api/tasks/complete-task-types.ts +3 -10
  55. package/src/types/api/tasks/create-task-list-types.ts +3 -7
  56. package/src/types/api/tasks/create-task-types.ts +4 -10
  57. package/src/types/api/tasks/get-task-lists-types.ts +3 -7
  58. package/src/types/api/tasks/get-tasks-types.ts +3 -10
  59. package/src/types/api/tasks/update-task-list-types.ts +3 -7
  60. package/src/types/api/tasks/update-task-types.ts +4 -10
  61. package/src/types/api/thoughts/create-thought-types.ts +3 -4
  62. package/src/types/api/thoughts/get-thoughts-types.ts +4 -4
  63. package/src/types/api/thoughts/update-thought-types.ts +3 -4
  64. package/src/types/id-types.ts +0 -1
  65. package/src/types/models/item-data.ts +0 -81
  66. package/src/utils/index.ts +2 -1
  67. package/src/utils/serializing-utils.ts +128 -0
@@ -95,13 +95,13 @@ export declare const userDataSchema: z.ZodObject<{
95
95
  };
96
96
  createdAt: Date;
97
97
  updatedAt: Date;
98
- name: string;
99
98
  sandbox: {
100
99
  devices: {
101
100
  pushToken: string;
102
101
  }[];
103
102
  discordId?: string | undefined;
104
103
  };
104
+ name: string;
105
105
  timezone: string;
106
106
  config: {
107
107
  agenda: {
@@ -120,13 +120,13 @@ export declare const userDataSchema: z.ZodObject<{
120
120
  _id: string;
121
121
  createdAt: Date;
122
122
  updatedAt: Date;
123
- name: string;
124
123
  sandbox: {
125
124
  devices: {
126
125
  pushToken: string;
127
126
  }[];
128
127
  discordId?: string | undefined;
129
128
  };
129
+ name: string;
130
130
  timezone: string;
131
131
  config: {
132
132
  agenda: {
@@ -1 +1,2 @@
1
1
  export * from './date-utils';
2
+ export * from './serializing-utils';
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./date-utils"), exports);
18
+ __exportStar(require("./serializing-utils"), exports);
@@ -0,0 +1,21 @@
1
+ import { HabitData, HabitEntryData, ItemData, PersonData, PersonNoteData, TaskData } from "../types";
2
+ export type Serialized<T> = T extends Date ? string : T extends Date | undefined ? string | undefined : T extends Date | null ? string | null : T extends (infer U)[] ? Serialized<U>[] : T extends object ? {
3
+ [K in keyof T]: Serialized<T[K]>;
4
+ } : T;
5
+ export declare class Serializer {
6
+ static serialize<T>(obj: T): Serialized<T>;
7
+ static deserialize<T>(obj: Serialized<T>): T;
8
+ static serializeItemData(data: ItemData): Serialized<ItemData>;
9
+ static deserializeItemData(data: Serialized<ItemData>): ItemData;
10
+ static serializeHabitData(data: HabitData): Serialized<HabitData>;
11
+ static deserializeHabitData(data: Serialized<HabitData>): HabitData;
12
+ static serializeHabitDataEntry(data: HabitEntryData): Serialized<HabitEntryData>;
13
+ static deserializeHabitDataEntry(data: Serialized<HabitEntryData>): HabitEntryData;
14
+ static serializePersonData(data: PersonData): Serialized<PersonData>;
15
+ static deserializePersonData(data: Serialized<PersonData>): PersonData;
16
+ static serializePersonNoteData(data: PersonNoteData): Serialized<PersonNoteData>;
17
+ static deserializePersonNoteData(data: Serialized<PersonNoteData>): PersonNoteData;
18
+ static serializeTaskData(data: TaskData): Serialized<TaskData>;
19
+ static deserializeTaskData(data: Serialized<TaskData>): TaskData;
20
+ static serializeTaskListData(data: TaskData[]): Serialized<TaskData[]>;
21
+ }
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Serializer = void 0;
4
+ class Serializer {
5
+ static serialize(obj) {
6
+ return serializeRecursive(obj);
7
+ }
8
+ static deserialize(obj) {
9
+ return deserializeRecursive(obj);
10
+ }
11
+ static serializeItemData(data) {
12
+ return this.serialize(data);
13
+ }
14
+ static deserializeItemData(data) {
15
+ return this.deserialize(data);
16
+ }
17
+ static serializeHabitData(data) {
18
+ return this.serialize(data);
19
+ }
20
+ static deserializeHabitData(data) {
21
+ return this.deserialize(data);
22
+ }
23
+ static serializeHabitDataEntry(data) {
24
+ return this.serialize(data);
25
+ }
26
+ static deserializeHabitDataEntry(data) {
27
+ return this.deserialize(data);
28
+ }
29
+ static serializePersonData(data) {
30
+ return this.serialize(data);
31
+ }
32
+ static deserializePersonData(data) {
33
+ return this.deserialize(data);
34
+ }
35
+ static serializePersonNoteData(data) {
36
+ return this.serialize(data);
37
+ }
38
+ static deserializePersonNoteData(data) {
39
+ return this.deserialize(data);
40
+ }
41
+ static serializeTaskData(data) {
42
+ return this.serialize(data);
43
+ }
44
+ static deserializeTaskData(data) {
45
+ return this.deserialize(data);
46
+ }
47
+ static serializeTaskListData(data) {
48
+ return this.serialize(data);
49
+ }
50
+ }
51
+ exports.Serializer = Serializer;
52
+ function serializeRecursive(obj) {
53
+ if (obj === null || obj === undefined) {
54
+ return obj;
55
+ }
56
+ if (obj instanceof Date) {
57
+ return obj.toISOString();
58
+ }
59
+ if (Array.isArray(obj)) {
60
+ return obj.map(item => serializeRecursive(item));
61
+ }
62
+ if (typeof obj === 'object') {
63
+ const result = {};
64
+ for (const [key, value] of Object.entries(obj)) {
65
+ result[key] = serializeRecursive(value);
66
+ }
67
+ return result;
68
+ }
69
+ return obj;
70
+ }
71
+ function deserializeRecursive(obj) {
72
+ if (obj === null || obj === undefined) {
73
+ return obj;
74
+ }
75
+ if (typeof obj === 'string' && isISODateString(obj)) {
76
+ return new Date(obj);
77
+ }
78
+ if (Array.isArray(obj)) {
79
+ return obj.map(item => deserializeRecursive(item));
80
+ }
81
+ if (typeof obj === 'object') {
82
+ const result = {};
83
+ for (const [key, value] of Object.entries(obj)) {
84
+ result[key] = deserializeRecursive(value);
85
+ }
86
+ return result;
87
+ }
88
+ return obj;
89
+ }
90
+ function isISODateString(value) {
91
+ const isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/;
92
+ return isoRegex.test(value) && !isNaN(Date.parse(value));
93
+ }
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.92",
5
+ "version": "1.0.94",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -1,5 +1,6 @@
1
1
  import { UserData } from "../../models";
2
+ import { Serialized } from "../../../utils";
2
3
 
3
4
  export interface GetUserResponse {
4
- user: UserData;
5
+ user: Serialized<UserData>;
5
6
  }
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { UserData, userDataSchema } from "../../models";
3
+ import { Serialized } from "../../../utils";
3
4
 
4
5
  export const updateUserRequestSchema = userDataSchema
5
6
  .omit({ _id: true, createdAt: true, updatedAt: true })
@@ -9,5 +10,5 @@ export const updateUserRequestSchema = userDataSchema
9
10
  export type UpdateUserRequest = z.infer<typeof updateUserRequestSchema>;
10
11
 
11
12
  export interface UpdateUserResponse {
12
- user: UserData
13
+ user: Serialized<UserData>;
13
14
  }
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { Habit, HabitEntryStatus } from "../../models";
3
- import { DateOnlyString, dateOnlyStringSchema } from "../../misc-types";
4
- import { createHabitRequestSchema } from "./create-habit-types";
3
+ import { dateOnlyStringSchema } from "../../misc-types";
4
+ import { Serialized } from "../../../utils";
5
5
 
6
6
  export const createHabitEntryRequestSchema = z.object({
7
7
  date: dateOnlyStringSchema,
@@ -11,5 +11,5 @@ export const createHabitEntryRequestSchema = z.object({
11
11
  export type CreateHabitEntryRequest = z.infer<typeof createHabitEntryRequestSchema>;
12
12
 
13
13
  export interface CreateHabitEntryResponse {
14
- habit: Habit;
14
+ habit: Serialized<Habit>;
15
15
  }
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { Habit, HabitFrequency } from "../../models/habit-data";
3
- import { createAccountRequestSchema } from "../auth";
2
+ import { Habit, HabitFrequency } from "../../models";
3
+ import { Serialized } from "../../../utils";
4
4
 
5
5
  export const createHabitRequestSchema = z.object({
6
6
  name: z.string().min(1, 'Name is required').trim(),
@@ -13,5 +13,5 @@ export const createHabitRequestSchema = z.object({
13
13
  export type CreateHabitRequest = z.infer<typeof createHabitRequestSchema>;
14
14
 
15
15
  export interface CreateHabitResponse {
16
- habit: Habit;
16
+ habit: Serialized<Habit>;
17
17
  }
@@ -1,5 +1,6 @@
1
- import { Habit } from "../../models/habit-data";
1
+ import { Habit } from "../../models";
2
+ import { Serialized } from "../../../utils";
2
3
 
3
4
  export interface DeleteHabitEntryResponse {
4
- habit: Habit;
5
+ habit: Serialized<Habit>;
5
6
  }
@@ -1,5 +1,6 @@
1
- import { Habit } from "../../models/habit-data";
1
+ import { Habit } from "../../models";
2
+ import { Serialized } from "../../../utils";
2
3
 
3
4
  export interface GetHabitsResponse {
4
- habits: Habit[];
5
+ habits: Serialized<Habit>[];
5
6
  }
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { Habit, HabitFrequency } from "../../models";
3
+ import { Serialized } from "../../../utils";
3
4
 
4
5
  export const updateHabitRequestSchema = z.object({
5
6
  name: z.string().min(1, 'Name is required').trim().optional(),
@@ -12,5 +13,5 @@ export const updateHabitRequestSchema = z.object({
12
13
  export type UpdateHabitRequest = z.infer<typeof updateHabitRequestSchema>;
13
14
 
14
15
  export interface UpdateHabitResponse {
15
- habit: Habit;
16
+ habit: Serialized<Habit>;
16
17
  }
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { ItemData, Serialized } from "../../models";
2
+ import { ItemData } from "../../models";
3
+ import { Serialized } from "../../../utils";
3
4
 
4
5
  export const completeItemRequestSchema = z.object({
5
6
  completed: z.boolean()
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { ItemData, Serialized } from "../../models";
2
+ import { ItemData } from "../../models";
3
+ import { Serialized } from "../../../utils";
3
4
 
4
5
  export const createItemRequestSchema = z.object({
5
6
  name: z.string().min(1),
@@ -1,4 +1,5 @@
1
- import { ItemData, Serialized } from "../../models";
1
+ import { ItemData } from "../../models";
2
+ import { Serialized } from "../../../utils";
2
3
 
3
4
  export interface GetItemsResponse {
4
5
  items: Serialized<ItemData>[];
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { ItemData, Serialized } from "../../models";
2
+ import { ItemData } from "../../models";
3
+ import { Serialized } from "../../../utils";
3
4
 
4
5
  export const updateItemRequestSchema = z.object({
5
6
  name: z.string().min(1).optional(),
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { personIdSchema, PersonNoteId, personNoteIdSchema } from "../../id-types";
2
+ import { personIdSchema } from "../../id-types";
3
3
  import { PersonNoteData } from "../../models";
4
+ import { Serialized } from "../../../utils";
4
5
 
5
6
  export const createPersonNoteRequestSchema = z.object({
6
7
  personId: personIdSchema,
@@ -10,5 +11,5 @@ export const createPersonNoteRequestSchema = z.object({
10
11
  export type CreatePersonNoteRequest = z.infer<typeof createPersonNoteRequestSchema>;
11
12
 
12
13
  export interface CreatePersonNoteResponse {
13
- personNote: PersonNoteData;
14
+ personNote: Serialized<PersonNoteData>;
14
15
  }
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { PersonNoteId, personNoteIdSchema } from "../../id-types";
3
- import { Person, PersonNoteData } from "../../models";
2
+ import { personNoteIdSchema } from "../../id-types";
3
+ import { Person } from "../../models";
4
+ import { Serialized } from "../../../utils";
4
5
 
5
6
  export const createPersonRequestSchema = z.object({
6
7
  name: z.string().min(1),
@@ -14,5 +15,5 @@ export const createPersonRequestSchema = z.object({
14
15
  export type CreatePersonRequest = z.infer<typeof createPersonRequestSchema>;
15
16
 
16
17
  export interface CreatePersonResponse {
17
- person: Person;
18
+ person: Serialized<Person>;
18
19
  }
@@ -1,6 +1,6 @@
1
- import { PersonNoteId } from "../../id-types";
2
- import { Person, PersonData, PersonNoteData } from "../../models";
1
+ import { Person } from "../../models";
2
+ import { Serialized } from "../../../utils";
3
3
 
4
4
  export interface GetPeopleResponse {
5
- people: Array<Person>;
5
+ people: Serialized<Person>[];
6
6
  }
@@ -1,6 +1,6 @@
1
- import { PersonNoteId } from "../../id-types";
2
- import { Person, PersonData, PersonNoteData } from "../../models";
1
+ import { PersonNoteData } from "../../models";
2
+ import { Serialized } from "../../../utils";
3
3
 
4
4
  export interface GetPersonNotesResponse {
5
- personNotes: Array<PersonNoteData>;
5
+ personNotes: Serialized<PersonNoteData>[];
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { personIdSchema, PersonNoteId, personNoteIdSchema } from "../../id-types";
3
- import { Person, PersonNoteData } from "../../models";
2
+ import { PersonNoteData } from "../../models";
3
+ import { Serialized } from "../../../utils";
4
4
 
5
5
  export const updatePersonNoteRequestSchema = z.object({
6
6
  content: z.string().min(1)
@@ -9,5 +9,5 @@ export const updatePersonNoteRequestSchema = z.object({
9
9
  export type UpdatePersonNoteRequest = z.infer<typeof updatePersonNoteRequestSchema>;
10
10
 
11
11
  export interface UpdatePersonNoteResponse {
12
- personNote: PersonNoteData;
12
+ personNote: Serialized<PersonNoteData>;
13
13
  }
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { personIdSchema, PersonNoteId, personNoteIdSchema } from "../../id-types";
3
- import { Person, PersonNoteData } from "../../models";
2
+ import { personNoteIdSchema } from "../../id-types";
3
+ import { Person } from "../../models";
4
+ import { Serialized } from "../../../utils";
4
5
 
5
6
  export const updatePersonRequestSchema = z.object({
6
7
  name: z.string().min(1).optional(),
@@ -14,5 +15,5 @@ export const updatePersonRequestSchema = z.object({
14
15
  export type UpdatePersonRequest = z.infer<typeof updatePersonRequestSchema>;
15
16
 
16
17
  export interface UpdatePersonResponse {
17
- person: Person;
18
+ person: Serialized<Person>;
18
19
  }
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { TaskId } from "../../id-types";
2
+ import { Serialized } from "../../../utils";
3
+ import { TaskData } from "../../models";
3
4
 
4
5
  export const completeTaskRequestSchema = z.object({
5
6
  completed: z.boolean()
@@ -8,13 +9,5 @@ export const completeTaskRequestSchema = z.object({
8
9
  export type CompleteTaskRequest = z.infer<typeof completeTaskRequestSchema>;
9
10
 
10
11
  export interface CompleteTaskResponse {
11
- task: {
12
- id: TaskId;
13
- name: string;
14
- notes?: string;
15
- completed: boolean;
16
- taskListId: string;
17
- createdAt: string;
18
- updatedAt: string;
19
- };
12
+ task: Serialized<TaskData>;
20
13
  }
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { TaskListId } from "../../id-types";
2
+ import { Serialized } from "../../../utils";
3
+ import { TaskListData } from "../../models";
3
4
 
4
5
  export const createTaskListRequestSchema = z.object({
5
6
  name: z.string().min(1)
@@ -8,10 +9,5 @@ export const createTaskListRequestSchema = z.object({
8
9
  export type CreateTaskListRequest = z.infer<typeof createTaskListRequestSchema>;
9
10
 
10
11
  export interface CreateTaskListResponse {
11
- taskList: {
12
- id: TaskListId;
13
- name: string;
14
- createdAt: string;
15
- updatedAt: string;
16
- };
12
+ taskList: Serialized<TaskListData>;
17
13
  }
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { TaskId, TaskListId, taskListIdSchema } from '../../id-types';
2
+ import { taskListIdSchema } from '../../id-types';
3
+ import { Serialized } from "../../../utils";
4
+ import { TaskData } from "../../models";
3
5
 
4
6
  export const createTaskRequestSchema = z.object({
5
7
  name: z.string().min(1),
@@ -10,13 +12,5 @@ export const createTaskRequestSchema = z.object({
10
12
  export type CreateTaskRequest = z.infer<typeof createTaskRequestSchema>;
11
13
 
12
14
  export interface CreateTaskResponse {
13
- task: {
14
- id: TaskId;
15
- name: string;
16
- notes?: string;
17
- completed: boolean;
18
- taskListId: TaskListId;
19
- createdAt: string;
20
- updatedAt: string;
21
- };
15
+ task: Serialized<TaskData>;
22
16
  }
@@ -1,10 +1,6 @@
1
- import { TaskListId } from "../../id-types";
1
+ import { Serialized } from "../../../utils";
2
+ import { TaskListData } from "../../models";
2
3
 
3
4
  export interface GetTaskListsResponse {
4
- taskLists: Array<{
5
- id: TaskListId;
6
- name: string;
7
- createdAt: string;
8
- updatedAt: string;
9
- }>;
5
+ taskLists: Serialized<TaskListData>[];
10
6
  }
@@ -1,13 +1,6 @@
1
- import { TaskId, TaskListId } from "../../id-types";
1
+ import { Serialized } from "../../../utils";
2
+ import { TaskData } from "../../models";
2
3
 
3
4
  export interface GetTasksResponse {
4
- tasks: Array<{
5
- id: TaskId;
6
- name: string;
7
- notes?: string;
8
- completed: boolean;
9
- taskListId: TaskListId;
10
- createdAt: string;
11
- updatedAt: string;
12
- }>;
5
+ tasks: Serialized<TaskData>;
13
6
  }
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { TaskListId } from "../../id-types";
2
+ import { Serialized } from "../../../utils";
3
+ import { TaskListData } from "../../models";
3
4
 
4
5
  export const updateTaskListRequestSchema = z.object({
5
6
  name: z.string().min(1).optional()
@@ -8,10 +9,5 @@ export const updateTaskListRequestSchema = z.object({
8
9
  export type UpdateTaskListRequest = z.infer<typeof updateTaskListRequestSchema>;
9
10
 
10
11
  export interface UpdateTaskListResponse {
11
- taskList: {
12
- id: TaskListId;
13
- name: string;
14
- createdAt: string;
15
- updatedAt: string;
16
- };
12
+ taskList: Serialized<TaskListData>;
17
13
  }
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { TaskId, TaskListId, taskListIdSchema } from '../../id-types';
2
+ import { taskListIdSchema } from '../../id-types';
3
+ import { Serialized } from "../../../utils";
4
+ import { TaskData } from "../../models";
3
5
 
4
6
  export const updateTaskRequestSchema = z.object({
5
7
  name: z.string().min(1).optional(),
@@ -11,13 +13,5 @@ export const updateTaskRequestSchema = z.object({
11
13
  export type UpdateTaskRequest = z.infer<typeof updateTaskRequestSchema>;
12
14
 
13
15
  export interface UpdateTaskResponse {
14
- task: {
15
- id: TaskId;
16
- name: string;
17
- notes?: string;
18
- completed: boolean;
19
- taskListId: TaskListId;
20
- createdAt: string;
21
- updatedAt: string;
22
- };
16
+ task: Serialized<TaskData>;
23
17
  }
@@ -1,4 +1,6 @@
1
1
  import { z } from 'zod';
2
+ import { Serialized } from "../../../utils";
3
+ import { ThoughtData } from "../../models";
2
4
 
3
5
  export const createThoughtRequestSchema = z.object({
4
6
  content: z.string().min(1)
@@ -7,8 +9,5 @@ export const createThoughtRequestSchema = z.object({
7
9
  export type CreateThoughtRequest = z.infer<typeof createThoughtRequestSchema>;
8
10
 
9
11
  export interface CreateThoughtResponse {
10
- thought: {
11
- id: string;
12
- content: string;
13
- };
12
+ thought: Serialized<ThoughtData>;
14
13
  }
@@ -1,6 +1,6 @@
1
+ import { Serialized } from "../../../utils";
2
+ import { ThoughtData } from "../../models";
3
+
1
4
  export interface GetThoughtsResponse {
2
- thoughts: Array<{
3
- id: string;
4
- content: string;
5
- }>;
5
+ thoughts: Serialized<ThoughtData>[];
6
6
  }
@@ -1,4 +1,6 @@
1
1
  import { z } from 'zod';
2
+ import { Serialized } from "../../../utils";
3
+ import { ThoughtData } from "../../models";
2
4
 
3
5
  export const updateThoughtRequestSchema = z.object({
4
6
  content: z.string().min(1)
@@ -7,8 +9,5 @@ export const updateThoughtRequestSchema = z.object({
7
9
  export type UpdateThoughtRequest = z.infer<typeof updateThoughtRequestSchema>;
8
10
 
9
11
  export interface UpdateThoughtResponse {
10
- thought: {
11
- id: string;
12
- content: string;
13
- };
12
+ thought: Serialized<ThoughtData>;
14
13
  }
@@ -1,5 +1,4 @@
1
1
  import { z } from "zod";
2
- import { PersonNoteData } from "./models";
3
2
 
4
3
  export const userIdSchema = z.string().transform((val): UserId => val as UserId);
5
4
  export type UserId = string & { readonly __brand: "UserId" };