@timothyw/pat-common 1.0.95 → 1.0.97

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, UserData } from "../types";
1
+ import { HabitData, HabitEntryData, ItemData, Person, 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;
@@ -11,6 +11,8 @@ export declare class Serializer {
11
11
  static deserializeHabitData(data: Serialized<HabitData>): HabitData;
12
12
  static serializeHabitDataEntry(data: HabitEntryData): Serialized<HabitEntryData>;
13
13
  static deserializeHabitDataEntry(data: Serialized<HabitEntryData>): HabitEntryData;
14
+ static serializePerson(data: Person): Serialized<Person>;
15
+ static deserializePerson(data: Serialized<Person>): Person;
14
16
  static serializePersonData(data: PersonData): Serialized<PersonData>;
15
17
  static deserializePersonData(data: Serialized<PersonData>): PersonData;
16
18
  static serializePersonNoteData(data: PersonNoteData): Serialized<PersonNoteData>;
@@ -18,6 +20,8 @@ export declare class Serializer {
18
20
  static serializeTaskData(data: TaskData): Serialized<TaskData>;
19
21
  static deserializeTaskData(data: Serialized<TaskData>): TaskData;
20
22
  static serializeTaskListData(data: TaskData[]): Serialized<TaskData[]>;
23
+ static serializeThoughtData(data: ThoughtData): Serialized<ThoughtData>;
24
+ static deserializeThoughtData(data: Serialized<ThoughtData>): ThoughtData;
21
25
  static serializeUserData(data: UserData): Serialized<UserData>;
22
26
  static deserializeUserData(data: Serialized<UserData>): UserData;
23
27
  }
@@ -26,6 +26,12 @@ class Serializer {
26
26
  static deserializeHabitDataEntry(data) {
27
27
  return this.deserialize(data);
28
28
  }
29
+ static serializePerson(data) {
30
+ return this.serialize(data);
31
+ }
32
+ static deserializePerson(data) {
33
+ return this.deserialize(data);
34
+ }
29
35
  static serializePersonData(data) {
30
36
  return this.serialize(data);
31
37
  }
@@ -47,6 +53,12 @@ class Serializer {
47
53
  static serializeTaskListData(data) {
48
54
  return this.serialize(data);
49
55
  }
56
+ static serializeThoughtData(data) {
57
+ return this.serialize(data);
58
+ }
59
+ static deserializeThoughtData(data) {
60
+ return this.deserialize(data);
61
+ }
50
62
  static serializeUserData(data) {
51
63
  return this.serialize(data);
52
64
  }
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.95",
5
+ "version": "1.0.97",
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, UserData } from "../types";
1
+ import {
2
+ HabitData,
3
+ HabitEntryData,
4
+ ItemData, Person,
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
@@ -45,6 +54,14 @@ export class Serializer {
45
54
  return this.deserialize(data) as unknown as HabitEntryData;
46
55
  }
47
56
 
57
+ static serializePerson(data: Person): Serialized<Person> {
58
+ return this.serialize(data);
59
+ }
60
+
61
+ static deserializePerson(data: Serialized<Person>): Person {
62
+ return this.deserialize(data) as unknown as Person;
63
+ }
64
+
48
65
  static serializePersonData(data: PersonData): Serialized<PersonData> {
49
66
  return this.serialize(data);
50
67
  }
@@ -73,6 +90,14 @@ export class Serializer {
73
90
  return this.serialize(data);
74
91
  }
75
92
 
93
+ static serializeThoughtData(data: ThoughtData): Serialized<ThoughtData> {
94
+ return this.serialize(data);
95
+ }
96
+
97
+ static deserializeThoughtData(data: Serialized<ThoughtData>): ThoughtData {
98
+ return this.deserialize(data) as unknown as ThoughtData;
99
+ }
100
+
76
101
  static serializeUserData(data: UserData): Serialized<UserData> {
77
102
  return this.serialize(data);
78
103
  }