@timothyw/pat-common 1.0.96 → 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, ThoughtData, 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>;
@@ -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
  }
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.96",
5
+ "version": "1.0.97",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  HabitData,
3
3
  HabitEntryData,
4
- ItemData,
4
+ ItemData, Person,
5
5
  PersonData,
6
6
  PersonNoteData,
7
7
  TaskData,
@@ -54,6 +54,14 @@ export class Serializer {
54
54
  return this.deserialize(data) as unknown as HabitEntryData;
55
55
  }
56
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
+
57
65
  static serializePersonData(data: PersonData): Serialized<PersonData> {
58
66
  return this.serialize(data);
59
67
  }