@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
@@ -1,4 +1,5 @@
1
1
  import { UserData } from "../../models";
2
+ import { Serialized } from "../../../utils";
2
3
  export interface GetUserResponse {
3
- user: UserData;
4
+ user: Serialized<UserData>;
4
5
  }
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { UserData } from "../../models";
3
+ import { Serialized } from "../../../utils";
3
4
  export declare const updateUserRequestSchema: z.ZodObject<{
4
- name: z.ZodOptional<z.ZodString>;
5
5
  sandbox: z.ZodOptional<z.ZodObject<{
6
6
  discordId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
7
7
  devices: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -22,6 +22,7 @@ export declare const updateUserRequestSchema: z.ZodObject<{
22
22
  pushToken?: string | undefined;
23
23
  }[] | undefined;
24
24
  }>>;
25
+ name: z.ZodOptional<z.ZodString>;
25
26
  timezone: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
26
27
  config: z.ZodOptional<z.ZodObject<{
27
28
  modules: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -77,13 +78,13 @@ export declare const updateUserRequestSchema: z.ZodObject<{
77
78
  }[] | undefined;
78
79
  }>>;
79
80
  }, "strict", z.ZodTypeAny, {
80
- name?: string | undefined;
81
81
  sandbox?: {
82
82
  discordId?: string | undefined;
83
83
  devices?: {
84
84
  pushToken?: string | undefined;
85
85
  }[] | undefined;
86
86
  } | undefined;
87
+ name?: string | undefined;
87
88
  timezone?: string | undefined;
88
89
  config?: {
89
90
  agenda?: {
@@ -99,13 +100,13 @@ export declare const updateUserRequestSchema: z.ZodObject<{
99
100
  }[] | undefined;
100
101
  } | undefined;
101
102
  }, {
102
- name?: string | undefined;
103
103
  sandbox?: {
104
104
  discordId?: string | undefined;
105
105
  devices?: {
106
106
  pushToken?: string | undefined;
107
107
  }[] | undefined;
108
108
  } | undefined;
109
+ name?: string | undefined;
109
110
  timezone?: string | undefined;
110
111
  config?: {
111
112
  agenda?: {
@@ -123,5 +124,5 @@ export declare const updateUserRequestSchema: z.ZodObject<{
123
124
  }>;
124
125
  export type UpdateUserRequest = z.infer<typeof updateUserRequestSchema>;
125
126
  export interface UpdateUserResponse {
126
- user: UserData;
127
+ user: Serialized<UserData>;
127
128
  }
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  import { Habit, HabitEntryStatus } from "../../models";
3
- import { DateOnlyString } from "../../misc-types";
3
+ import { Serialized } from "../../../utils";
4
4
  export declare const createHabitEntryRequestSchema: z.ZodObject<{
5
- date: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, DateOnlyString, string>;
5
+ date: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("../../misc-types").DateOnlyString, string>;
6
6
  status: z.ZodNativeEnum<typeof HabitEntryStatus>;
7
7
  }, "strip", z.ZodTypeAny, {
8
8
  status: HabitEntryStatus;
@@ -15,5 +15,5 @@ export declare const createHabitEntryRequestSchema: z.ZodObject<{
15
15
  }>;
16
16
  export type CreateHabitEntryRequest = z.infer<typeof createHabitEntryRequestSchema>;
17
17
  export interface CreateHabitEntryResponse {
18
- habit: Habit;
18
+ habit: Serialized<Habit>;
19
19
  }
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
- import { Habit, HabitFrequency } from "../../models/habit-data";
2
+ import { Habit, HabitFrequency } from "../../models";
3
+ import { Serialized } from "../../../utils";
3
4
  export declare const createHabitRequestSchema: z.ZodObject<{
4
5
  name: z.ZodString;
5
6
  description: z.ZodOptional<z.ZodString>;
@@ -21,5 +22,5 @@ export declare const createHabitRequestSchema: z.ZodObject<{
21
22
  }>;
22
23
  export type CreateHabitRequest = z.infer<typeof createHabitRequestSchema>;
23
24
  export interface CreateHabitResponse {
24
- habit: Habit;
25
+ habit: Serialized<Habit>;
25
26
  }
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createHabitRequestSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- const habit_data_1 = require("../../models/habit-data");
5
+ const models_1 = require("../../models");
6
6
  exports.createHabitRequestSchema = zod_1.z.object({
7
7
  name: zod_1.z.string().min(1, 'Name is required').trim(),
8
8
  description: zod_1.z.string().trim().optional(),
9
9
  notes: zod_1.z.string().trim().optional(),
10
- frequency: zod_1.z.nativeEnum(habit_data_1.HabitFrequency),
10
+ frequency: zod_1.z.nativeEnum(models_1.HabitFrequency),
11
11
  rolloverTime: zod_1.z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/, 'rolloverTime must be in HH:MM format')
12
12
  });
@@ -1,4 +1,5 @@
1
- import { Habit } from "../../models/habit-data";
1
+ import { Habit } from "../../models";
2
+ import { Serialized } from "../../../utils";
2
3
  export interface DeleteHabitEntryResponse {
3
- habit: Habit;
4
+ habit: Serialized<Habit>;
4
5
  }
@@ -1,4 +1,5 @@
1
- import { Habit } from "../../models/habit-data";
1
+ import { Habit } from "../../models";
2
+ import { Serialized } from "../../../utils";
2
3
  export interface GetHabitsResponse {
3
- habits: Habit[];
4
+ habits: Serialized<Habit>[];
4
5
  }
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { Habit, HabitFrequency } from "../../models";
3
+ import { Serialized } from "../../../utils";
3
4
  export declare const updateHabitRequestSchema: z.ZodObject<{
4
5
  name: z.ZodOptional<z.ZodString>;
5
6
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -21,5 +22,5 @@ export declare const updateHabitRequestSchema: z.ZodObject<{
21
22
  }>;
22
23
  export type UpdateHabitRequest = z.infer<typeof updateHabitRequestSchema>;
23
24
  export interface UpdateHabitResponse {
24
- habit: Habit;
25
+ habit: Serialized<Habit>;
25
26
  }
@@ -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
  export declare const completeItemRequestSchema: z.ZodObject<{
4
5
  completed: z.ZodBoolean;
5
6
  }, "strip", z.ZodTypeAny, {
@@ -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
  export declare const createItemRequestSchema: z.ZodObject<{
4
5
  name: z.ZodString;
5
6
  dueDate: z.ZodOptional<z.ZodString>;
@@ -10,17 +11,17 @@ export declare const createItemRequestSchema: z.ZodObject<{
10
11
  }, "strip", z.ZodTypeAny, {
11
12
  name: string;
12
13
  urgent: boolean;
14
+ type?: string | undefined;
13
15
  dueDate?: string | undefined;
14
16
  notes?: string | undefined;
15
17
  category?: string | undefined;
16
- type?: string | undefined;
17
18
  }, {
18
19
  name: string;
20
+ type?: string | undefined;
19
21
  dueDate?: string | undefined;
20
22
  notes?: string | undefined;
21
23
  urgent?: boolean | undefined;
22
24
  category?: string | undefined;
23
- type?: string | undefined;
24
25
  }>;
25
26
  export type CreateItemRequest = z.infer<typeof createItemRequestSchema>;
26
27
  export interface CreateItemResponse {
@@ -1,4 +1,5 @@
1
- import { ItemData, Serialized } from "../../models";
1
+ import { ItemData } from "../../models";
2
+ import { Serialized } from "../../../utils";
2
3
  export interface GetItemsResponse {
3
4
  items: Serialized<ItemData>[];
4
5
  }
@@ -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
  export declare const updateItemRequestSchema: z.ZodObject<{
4
5
  name: z.ZodOptional<z.ZodString>;
5
6
  dueDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -8,19 +9,19 @@ export declare const updateItemRequestSchema: z.ZodObject<{
8
9
  category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9
10
  type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
10
11
  }, "strip", z.ZodTypeAny, {
12
+ type?: string | null | undefined;
11
13
  name?: string | undefined;
12
14
  dueDate?: string | null | undefined;
13
15
  notes?: string | null | undefined;
14
16
  urgent?: boolean | undefined;
15
17
  category?: string | null | undefined;
16
- type?: string | null | undefined;
17
18
  }, {
19
+ type?: string | null | undefined;
18
20
  name?: string | undefined;
19
21
  dueDate?: string | null | undefined;
20
22
  notes?: string | null | undefined;
21
23
  urgent?: boolean | undefined;
22
24
  category?: string | null | undefined;
23
- type?: string | null | undefined;
24
25
  }>;
25
26
  export type UpdateItemRequest = z.infer<typeof updateItemRequestSchema>;
26
27
  export interface UpdateItemResponse {
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { PersonNoteData } from "../../models";
3
+ import { Serialized } from "../../../utils";
3
4
  export declare const createPersonNoteRequestSchema: z.ZodObject<{
4
5
  personId: z.ZodEffects<z.ZodString, import("../../id-types").PersonId, string>;
5
6
  content: z.ZodString;
@@ -14,5 +15,5 @@ export declare const createPersonNoteRequestSchema: z.ZodObject<{
14
15
  }>;
15
16
  export type CreatePersonNoteRequest = z.infer<typeof createPersonNoteRequestSchema>;
16
17
  export interface CreatePersonNoteResponse {
17
- personNote: PersonNoteData;
18
+ personNote: Serialized<PersonNoteData>;
18
19
  }
@@ -1,35 +1,35 @@
1
1
  import { z } from 'zod';
2
- import { PersonNoteId } from "../../id-types";
3
2
  import { Person } from "../../models";
3
+ import { Serialized } from "../../../utils";
4
4
  export declare const createPersonRequestSchema: z.ZodObject<{
5
5
  name: z.ZodString;
6
6
  properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
7
7
  key: z.ZodString;
8
8
  value: z.ZodString;
9
9
  }, "strip", z.ZodTypeAny, {
10
- key: string;
11
10
  value: string;
12
- }, {
13
11
  key: string;
12
+ }, {
14
13
  value: string;
14
+ key: string;
15
15
  }>, "many">>;
16
- notes: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, PersonNoteId, string>, "many">>;
16
+ notes: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, import("../../id-types").PersonNoteId, string>, "many">>;
17
17
  }, "strip", z.ZodTypeAny, {
18
18
  name: string;
19
- notes?: PersonNoteId[] | undefined;
19
+ notes?: import("../../id-types").PersonNoteId[] | undefined;
20
20
  properties?: {
21
- key: string;
22
21
  value: string;
22
+ key: string;
23
23
  }[] | undefined;
24
24
  }, {
25
25
  name: string;
26
26
  notes?: string[] | undefined;
27
27
  properties?: {
28
- key: string;
29
28
  value: string;
29
+ key: string;
30
30
  }[] | undefined;
31
31
  }>;
32
32
  export type CreatePersonRequest = z.infer<typeof createPersonRequestSchema>;
33
33
  export interface CreatePersonResponse {
34
- person: Person;
34
+ person: Serialized<Person>;
35
35
  }
@@ -1,4 +1,5 @@
1
1
  import { Person } from "../../models";
2
+ import { Serialized } from "../../../utils";
2
3
  export interface GetPeopleResponse {
3
- people: Array<Person>;
4
+ people: Serialized<Person>[];
4
5
  }
@@ -1,4 +1,5 @@
1
1
  import { PersonNoteData } from "../../models";
2
+ import { Serialized } from "../../../utils";
2
3
  export interface GetPersonNotesResponse {
3
- personNotes: Array<PersonNoteData>;
4
+ personNotes: Serialized<PersonNoteData>[];
4
5
  }
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { PersonNoteData } from "../../models";
3
+ import { Serialized } from "../../../utils";
3
4
  export declare const updatePersonNoteRequestSchema: z.ZodObject<{
4
5
  content: z.ZodString;
5
6
  }, "strip", z.ZodTypeAny, {
@@ -9,5 +10,5 @@ export declare const updatePersonNoteRequestSchema: z.ZodObject<{
9
10
  }>;
10
11
  export type UpdatePersonNoteRequest = z.infer<typeof updatePersonNoteRequestSchema>;
11
12
  export interface UpdatePersonNoteResponse {
12
- personNote: PersonNoteData;
13
+ personNote: Serialized<PersonNoteData>;
13
14
  }
@@ -1,35 +1,35 @@
1
1
  import { z } from 'zod';
2
- import { PersonNoteId } from "../../id-types";
3
2
  import { Person } from "../../models";
3
+ import { Serialized } from "../../../utils";
4
4
  export declare const updatePersonRequestSchema: z.ZodObject<{
5
5
  name: z.ZodOptional<z.ZodString>;
6
6
  properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
7
7
  key: z.ZodString;
8
8
  value: z.ZodString;
9
9
  }, "strip", z.ZodTypeAny, {
10
- key: string;
11
10
  value: string;
12
- }, {
13
11
  key: string;
12
+ }, {
14
13
  value: string;
14
+ key: string;
15
15
  }>, "many">>;
16
- noteIds: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, PersonNoteId, string>, "many">>;
16
+ noteIds: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, import("../../id-types").PersonNoteId, string>, "many">>;
17
17
  }, "strip", z.ZodTypeAny, {
18
18
  name?: string | undefined;
19
19
  properties?: {
20
- key: string;
21
20
  value: string;
21
+ key: string;
22
22
  }[] | undefined;
23
- noteIds?: PersonNoteId[] | undefined;
23
+ noteIds?: import("../../id-types").PersonNoteId[] | undefined;
24
24
  }, {
25
25
  name?: string | undefined;
26
26
  properties?: {
27
- key: string;
28
27
  value: string;
28
+ key: string;
29
29
  }[] | undefined;
30
30
  noteIds?: string[] | undefined;
31
31
  }>;
32
32
  export type UpdatePersonRequest = z.infer<typeof updatePersonRequestSchema>;
33
33
  export interface UpdatePersonResponse {
34
- person: Person;
34
+ person: Serialized<Person>;
35
35
  }
@@ -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
  export declare const completeTaskRequestSchema: z.ZodObject<{
4
5
  completed: z.ZodBoolean;
5
6
  }, "strip", z.ZodTypeAny, {
@@ -9,13 +10,5 @@ export declare const completeTaskRequestSchema: z.ZodObject<{
9
10
  }>;
10
11
  export type CompleteTaskRequest = z.infer<typeof completeTaskRequestSchema>;
11
12
  export interface CompleteTaskResponse {
12
- task: {
13
- id: TaskId;
14
- name: string;
15
- notes?: string;
16
- completed: boolean;
17
- taskListId: string;
18
- createdAt: string;
19
- updatedAt: string;
20
- };
13
+ task: Serialized<TaskData>;
21
14
  }
@@ -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
  export declare const createTaskListRequestSchema: z.ZodObject<{
4
5
  name: z.ZodString;
5
6
  }, "strip", z.ZodTypeAny, {
@@ -9,10 +10,5 @@ export declare const createTaskListRequestSchema: z.ZodObject<{
9
10
  }>;
10
11
  export type CreateTaskListRequest = z.infer<typeof createTaskListRequestSchema>;
11
12
  export interface CreateTaskListResponse {
12
- taskList: {
13
- id: TaskListId;
14
- name: string;
15
- createdAt: string;
16
- updatedAt: string;
17
- };
13
+ taskList: Serialized<TaskListData>;
18
14
  }
@@ -1,9 +1,10 @@
1
1
  import { z } from 'zod';
2
- import { TaskId, TaskListId } from '../../id-types';
2
+ import { Serialized } from "../../../utils";
3
+ import { TaskData } from "../../models";
3
4
  export declare const createTaskRequestSchema: z.ZodObject<{
4
5
  name: z.ZodString;
5
6
  notes: z.ZodOptional<z.ZodString>;
6
- taskListId: z.ZodEffects<z.ZodString, TaskListId, string>;
7
+ taskListId: z.ZodEffects<z.ZodString, import("../../id-types").TaskListId, string>;
7
8
  }, "strip", z.ZodTypeAny, {
8
9
  name: string;
9
10
  taskListId: string & {
@@ -17,13 +18,5 @@ export declare const createTaskRequestSchema: z.ZodObject<{
17
18
  }>;
18
19
  export type CreateTaskRequest = z.infer<typeof createTaskRequestSchema>;
19
20
  export interface CreateTaskResponse {
20
- task: {
21
- id: TaskId;
22
- name: string;
23
- notes?: string;
24
- completed: boolean;
25
- taskListId: TaskListId;
26
- createdAt: string;
27
- updatedAt: string;
28
- };
21
+ task: Serialized<TaskData>;
29
22
  }
@@ -1,9 +1,5 @@
1
- import { TaskListId } from "../../id-types";
1
+ import { Serialized } from "../../../utils";
2
+ import { TaskListData } from "../../models";
2
3
  export interface GetTaskListsResponse {
3
- taskLists: Array<{
4
- id: TaskListId;
5
- name: string;
6
- createdAt: string;
7
- updatedAt: string;
8
- }>;
4
+ taskLists: Serialized<TaskListData>[];
9
5
  }
@@ -1,12 +1,5 @@
1
- import { TaskId, TaskListId } from "../../id-types";
1
+ import { Serialized } from "../../../utils";
2
+ import { TaskData } from "../../models";
2
3
  export interface GetTasksResponse {
3
- tasks: Array<{
4
- id: TaskId;
5
- name: string;
6
- notes?: string;
7
- completed: boolean;
8
- taskListId: TaskListId;
9
- createdAt: string;
10
- updatedAt: string;
11
- }>;
4
+ tasks: Serialized<TaskData>;
12
5
  }
@@ -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
  export declare const updateTaskListRequestSchema: z.ZodObject<{
4
5
  name: z.ZodOptional<z.ZodString>;
5
6
  }, "strip", z.ZodTypeAny, {
@@ -9,10 +10,5 @@ export declare const updateTaskListRequestSchema: z.ZodObject<{
9
10
  }>;
10
11
  export type UpdateTaskListRequest = z.infer<typeof updateTaskListRequestSchema>;
11
12
  export interface UpdateTaskListResponse {
12
- taskList: {
13
- id: TaskListId;
14
- name: string;
15
- createdAt: string;
16
- updatedAt: string;
17
- };
13
+ taskList: Serialized<TaskListData>;
18
14
  }
@@ -1,15 +1,16 @@
1
1
  import { z } from 'zod';
2
- import { TaskId, TaskListId } from '../../id-types';
2
+ import { Serialized } from "../../../utils";
3
+ import { TaskData } from "../../models";
3
4
  export declare const updateTaskRequestSchema: z.ZodObject<{
4
5
  name: z.ZodOptional<z.ZodString>;
5
6
  notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6
7
  completed: z.ZodOptional<z.ZodBoolean>;
7
- taskListId: z.ZodOptional<z.ZodEffects<z.ZodString, TaskListId, string>>;
8
+ taskListId: z.ZodOptional<z.ZodEffects<z.ZodString, import("../../id-types").TaskListId, string>>;
8
9
  }, "strip", z.ZodTypeAny, {
9
10
  completed?: boolean | undefined;
10
11
  name?: string | undefined;
11
12
  notes?: string | null | undefined;
12
- taskListId?: TaskListId | undefined;
13
+ taskListId?: import("../../id-types").TaskListId | undefined;
13
14
  }, {
14
15
  completed?: boolean | undefined;
15
16
  name?: string | undefined;
@@ -18,13 +19,5 @@ export declare const updateTaskRequestSchema: z.ZodObject<{
18
19
  }>;
19
20
  export type UpdateTaskRequest = z.infer<typeof updateTaskRequestSchema>;
20
21
  export interface UpdateTaskResponse {
21
- task: {
22
- id: TaskId;
23
- name: string;
24
- notes?: string;
25
- completed: boolean;
26
- taskListId: TaskListId;
27
- createdAt: string;
28
- updatedAt: string;
29
- };
22
+ task: Serialized<TaskData>;
30
23
  }
@@ -1,4 +1,6 @@
1
1
  import { z } from 'zod';
2
+ import { Serialized } from "../../../utils";
3
+ import { ThoughtData } from "../../models";
2
4
  export declare const createThoughtRequestSchema: z.ZodObject<{
3
5
  content: z.ZodString;
4
6
  }, "strip", z.ZodTypeAny, {
@@ -8,8 +10,5 @@ export declare const createThoughtRequestSchema: z.ZodObject<{
8
10
  }>;
9
11
  export type CreateThoughtRequest = z.infer<typeof createThoughtRequestSchema>;
10
12
  export interface CreateThoughtResponse {
11
- thought: {
12
- id: string;
13
- content: string;
14
- };
13
+ thought: Serialized<ThoughtData>;
15
14
  }
@@ -1,6 +1,5 @@
1
+ import { Serialized } from "../../../utils";
2
+ import { ThoughtData } from "../../models";
1
3
  export interface GetThoughtsResponse {
2
- thoughts: Array<{
3
- id: string;
4
- content: string;
5
- }>;
4
+ thoughts: Serialized<ThoughtData>[];
6
5
  }
@@ -1,4 +1,6 @@
1
1
  import { z } from 'zod';
2
+ import { Serialized } from "../../../utils";
3
+ import { ThoughtData } from "../../models";
2
4
  export declare const updateThoughtRequestSchema: z.ZodObject<{
3
5
  content: z.ZodString;
4
6
  }, "strip", z.ZodTypeAny, {
@@ -8,8 +10,5 @@ export declare const updateThoughtRequestSchema: z.ZodObject<{
8
10
  }>;
9
11
  export type UpdateThoughtRequest = z.infer<typeof updateThoughtRequestSchema>;
10
12
  export interface UpdateThoughtResponse {
11
- thought: {
12
- id: string;
13
- content: string;
14
- };
13
+ thought: Serialized<ThoughtData>;
15
14
  }
@@ -12,10 +12,3 @@ export interface ItemData {
12
12
  category?: string;
13
13
  type?: string;
14
14
  }
15
- 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 ? {
16
- [K in keyof T]: Serialized<T[K]>;
17
- } : T;
18
- export declare function serialize<T>(obj: T): Serialized<T>;
19
- export declare function deserialize<T>(obj: Serialized<T>): T;
20
- export declare function serializeItemData(item: ItemData): Serialized<ItemData>;
21
- export declare function deserializeItemData(apiData: Serialized<ItemData>): ItemData;
@@ -1,60 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serialize = serialize;
4
- exports.deserialize = deserialize;
5
- exports.serializeItemData = serializeItemData;
6
- exports.deserializeItemData = deserializeItemData;
7
- function serialize(obj) {
8
- return serializeRecursive(obj);
9
- }
10
- function deserialize(obj) {
11
- return deserializeRecursive(obj);
12
- }
13
- function serializeRecursive(obj) {
14
- if (obj === null || obj === undefined) {
15
- return obj;
16
- }
17
- if (obj instanceof Date) {
18
- return obj.toISOString();
19
- }
20
- if (Array.isArray(obj)) {
21
- return obj.map(item => serializeRecursive(item));
22
- }
23
- if (typeof obj === 'object') {
24
- const result = {};
25
- for (const [key, value] of Object.entries(obj)) {
26
- result[key] = serializeRecursive(value);
27
- }
28
- return result;
29
- }
30
- return obj;
31
- }
32
- function deserializeRecursive(obj) {
33
- if (obj === null || obj === undefined) {
34
- return obj;
35
- }
36
- if (typeof obj === 'string' && isISODateString(obj)) {
37
- return new Date(obj);
38
- }
39
- if (Array.isArray(obj)) {
40
- return obj.map(item => deserializeRecursive(item));
41
- }
42
- if (typeof obj === 'object') {
43
- const result = {};
44
- for (const [key, value] of Object.entries(obj)) {
45
- result[key] = deserializeRecursive(value);
46
- }
47
- return result;
48
- }
49
- return obj;
50
- }
51
- function isISODateString(value) {
52
- const isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/;
53
- return isoRegex.test(value) && !isNaN(Date.parse(value));
54
- }
55
- function serializeItemData(item) {
56
- return serialize(item);
57
- }
58
- function deserializeItemData(apiData) {
59
- return deserialize(apiData);
60
- }