@timothyw/pat-common 1.0.94 → 1.0.96

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.
@@ -1,4 +1,4 @@
1
- import { HabitData, HabitEntryData, ItemData, PersonData, PersonNoteData, TaskData } from "../types";
1
+ import { HabitData, HabitEntryData, ItemData, PersonData, PersonNoteData, TaskData, ThoughtData, UserData } from "../types";
2
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
3
  [K in keyof T]: Serialized<T[K]>;
4
4
  } : T;
@@ -18,4 +18,8 @@ export declare class Serializer {
18
18
  static serializeTaskData(data: TaskData): Serialized<TaskData>;
19
19
  static deserializeTaskData(data: Serialized<TaskData>): TaskData;
20
20
  static serializeTaskListData(data: TaskData[]): Serialized<TaskData[]>;
21
+ static serializeThoughtData(data: ThoughtData): Serialized<ThoughtData>;
22
+ static deserializeThoughtData(data: Serialized<ThoughtData>): ThoughtData;
23
+ static serializeUserData(data: UserData): Serialized<UserData>;
24
+ static deserializeUserData(data: Serialized<UserData>): UserData;
21
25
  }
@@ -47,6 +47,18 @@ class Serializer {
47
47
  static serializeTaskListData(data) {
48
48
  return this.serialize(data);
49
49
  }
50
+ static serializeThoughtData(data) {
51
+ return this.serialize(data);
52
+ }
53
+ static deserializeThoughtData(data) {
54
+ return this.deserialize(data);
55
+ }
56
+ static serializeUserData(data) {
57
+ return this.serialize(data);
58
+ }
59
+ static deserializeUserData(data) {
60
+ return this.deserialize(data);
61
+ }
50
62
  }
51
63
  exports.Serializer = Serializer;
52
64
  function serializeRecursive(obj) {
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.94",
5
+ "version": "1.0.96",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -1,4 +1,13 @@
1
- import { HabitData, HabitEntryData, ItemData, PersonData, PersonNoteData, TaskData } from "../types";
1
+ import {
2
+ HabitData,
3
+ HabitEntryData,
4
+ ItemData,
5
+ PersonData,
6
+ PersonNoteData,
7
+ TaskData,
8
+ ThoughtData,
9
+ UserData
10
+ } from "../types";
2
11
 
3
12
  export type Serialized<T> = T extends Date
4
13
  ? string
@@ -72,6 +81,22 @@ export class Serializer {
72
81
  static serializeTaskListData(data: TaskData[]): Serialized<TaskData[]> {
73
82
  return this.serialize(data);
74
83
  }
84
+
85
+ static serializeThoughtData(data: ThoughtData): Serialized<ThoughtData> {
86
+ return this.serialize(data);
87
+ }
88
+
89
+ static deserializeThoughtData(data: Serialized<ThoughtData>): ThoughtData {
90
+ return this.deserialize(data) as unknown as ThoughtData;
91
+ }
92
+
93
+ static serializeUserData(data: UserData): Serialized<UserData> {
94
+ return this.serialize(data);
95
+ }
96
+
97
+ static deserializeUserData(data: Serialized<UserData>): UserData {
98
+ return this.deserialize(data) as unknown as UserData;
99
+ }
75
100
  }
76
101
 
77
102
  function serializeRecursive(obj: any): any {