@timothyw/pat-common 1.0.62 → 1.0.64
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.
- package/dist/types/api/habits/update-habit-types.d.ts +5 -11
- package/dist/types/api/habits/update-habit-types.js +2 -1
- package/dist/types/api/items/update-item-types.d.ts +2 -2
- package/dist/types/api/items/update-item-types.js +1 -1
- package/dist/types/api/people/update-person-types.d.ts +5 -18
- package/dist/types/api/people/update-person-types.js +2 -3
- package/dist/types/id-types.d.ts +4 -0
- package/dist/types/id-types.js +2 -1
- package/dist/types/models/person-data.d.ts +3 -3
- package/package.json +1 -1
- package/src/types/api/habits/update-habit-types.ts +3 -9
- package/src/types/api/items/update-item-types.ts +1 -1
- package/src/types/api/people/update-person-types.ts +3 -8
- package/src/types/id-types.ts +4 -0
- package/src/types/models/person-data.ts +3 -3
|
@@ -1,31 +1,25 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { Habit } from "../../models";
|
|
2
|
+
import { Habit, HabitFrequency } from "../../models";
|
|
3
3
|
export declare const updateHabitRequestSchema: z.ZodObject<{
|
|
4
4
|
name: z.ZodOptional<z.ZodString>;
|
|
5
5
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
6
6
|
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
7
|
-
frequency: z.ZodOptional<z.
|
|
7
|
+
frequency: z.ZodOptional<z.ZodNativeEnum<typeof HabitFrequency>>;
|
|
8
8
|
rolloverTime: z.ZodOptional<z.ZodString>;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
10
|
name?: string | undefined;
|
|
11
11
|
description?: string | null | undefined;
|
|
12
12
|
notes?: string | null | undefined;
|
|
13
|
-
frequency?:
|
|
13
|
+
frequency?: HabitFrequency | undefined;
|
|
14
14
|
rolloverTime?: string | undefined;
|
|
15
15
|
}, {
|
|
16
16
|
name?: string | undefined;
|
|
17
17
|
description?: string | null | undefined;
|
|
18
18
|
notes?: string | null | undefined;
|
|
19
|
-
frequency?:
|
|
19
|
+
frequency?: HabitFrequency | undefined;
|
|
20
20
|
rolloverTime?: string | undefined;
|
|
21
21
|
}>;
|
|
22
|
-
export
|
|
23
|
-
name?: string;
|
|
24
|
-
description?: string;
|
|
25
|
-
notes?: string;
|
|
26
|
-
frequency?: 'daily';
|
|
27
|
-
rolloverTime?: string;
|
|
28
|
-
}
|
|
22
|
+
export type UpdateHabitRequest = z.infer<typeof updateHabitRequestSchema>;
|
|
29
23
|
export interface UpdateHabitResponse {
|
|
30
24
|
habit: Habit;
|
|
31
25
|
}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateHabitRequestSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
5
6
|
exports.updateHabitRequestSchema = zod_1.z.object({
|
|
6
7
|
name: zod_1.z.string().min(1, 'Name is required').trim().optional(),
|
|
7
8
|
description: zod_1.z.string().trim().nullish(),
|
|
8
9
|
notes: zod_1.z.string().trim().nullish(),
|
|
9
|
-
frequency: zod_1.z.
|
|
10
|
+
frequency: zod_1.z.nativeEnum(models_1.HabitFrequency).optional(),
|
|
10
11
|
rolloverTime: zod_1.z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/, 'rolloverTime must be in HH:MM format').optional()
|
|
11
12
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const updateItemRequestSchema: z.ZodObject<{
|
|
3
3
|
name: z.ZodOptional<z.ZodString>;
|
|
4
|
-
dueDate: z.ZodOptional<z.ZodNullable<z.ZodString
|
|
4
|
+
dueDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>>;
|
|
5
5
|
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
6
6
|
urgent: z.ZodOptional<z.ZodBoolean>;
|
|
7
7
|
category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -10,7 +10,7 @@ export declare const updateItemRequestSchema: z.ZodObject<{
|
|
|
10
10
|
type?: string | null | undefined;
|
|
11
11
|
name?: string | undefined;
|
|
12
12
|
notes?: string | null | undefined;
|
|
13
|
-
dueDate?:
|
|
13
|
+
dueDate?: Date | null | undefined;
|
|
14
14
|
urgent?: boolean | undefined;
|
|
15
15
|
category?: string | null | undefined;
|
|
16
16
|
}, {
|
|
@@ -4,7 +4,7 @@ exports.updateItemRequestSchema = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.updateItemRequestSchema = zod_1.z.object({
|
|
6
6
|
name: zod_1.z.string().min(1).optional(),
|
|
7
|
-
dueDate: zod_1.z.string().nullish(),
|
|
7
|
+
dueDate: zod_1.z.string().transform(val => new Date(val)).nullish(),
|
|
8
8
|
notes: zod_1.z.string().nullish(),
|
|
9
9
|
urgent: zod_1.z.boolean().optional(),
|
|
10
10
|
category: zod_1.z.string().nullish(),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { PersonNoteId } from "../../id-types";
|
|
2
3
|
export declare const updatePersonRequestSchema: z.ZodObject<{
|
|
3
4
|
name: z.ZodOptional<z.ZodString>;
|
|
4
5
|
properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -11,27 +12,17 @@ export declare const updatePersonRequestSchema: z.ZodObject<{
|
|
|
11
12
|
value: string;
|
|
12
13
|
key: string;
|
|
13
14
|
}>, "many">>;
|
|
14
|
-
notes: z.ZodOptional<z.ZodArray<z.
|
|
15
|
-
content: z.ZodString;
|
|
16
|
-
}, "strip", z.ZodTypeAny, {
|
|
17
|
-
content: string;
|
|
18
|
-
}, {
|
|
19
|
-
content: string;
|
|
20
|
-
}>, "many">>;
|
|
15
|
+
notes: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, PersonNoteId, string>, "many">>;
|
|
21
16
|
}, "strip", z.ZodTypeAny, {
|
|
22
17
|
name?: string | undefined;
|
|
23
|
-
notes?:
|
|
24
|
-
content: string;
|
|
25
|
-
}[] | undefined;
|
|
18
|
+
notes?: PersonNoteId[] | undefined;
|
|
26
19
|
properties?: {
|
|
27
20
|
value: string;
|
|
28
21
|
key: string;
|
|
29
22
|
}[] | undefined;
|
|
30
23
|
}, {
|
|
31
24
|
name?: string | undefined;
|
|
32
|
-
notes?:
|
|
33
|
-
content: string;
|
|
34
|
-
}[] | undefined;
|
|
25
|
+
notes?: string[] | undefined;
|
|
35
26
|
properties?: {
|
|
36
27
|
value: string;
|
|
37
28
|
key: string;
|
|
@@ -46,10 +37,6 @@ export interface UpdatePersonResponse {
|
|
|
46
37
|
key: string;
|
|
47
38
|
value: string;
|
|
48
39
|
}>;
|
|
49
|
-
notes: Array<
|
|
50
|
-
content: string;
|
|
51
|
-
createdAt: string;
|
|
52
|
-
updatedAt: string;
|
|
53
|
-
}>;
|
|
40
|
+
notes: Array<PersonNoteId>;
|
|
54
41
|
};
|
|
55
42
|
}
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updatePersonRequestSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const id_types_1 = require("../../id-types");
|
|
5
6
|
exports.updatePersonRequestSchema = zod_1.z.object({
|
|
6
7
|
name: zod_1.z.string().min(1).optional(),
|
|
7
8
|
properties: zod_1.z.array(zod_1.z.object({
|
|
8
9
|
key: zod_1.z.string().min(1),
|
|
9
10
|
value: zod_1.z.string().min(1)
|
|
10
11
|
})).optional(),
|
|
11
|
-
notes: zod_1.z.array(
|
|
12
|
-
content: zod_1.z.string().min(1)
|
|
13
|
-
})).optional()
|
|
12
|
+
notes: zod_1.z.array(id_types_1.personNoteIdSchema).optional()
|
|
14
13
|
});
|
package/dist/types/id-types.d.ts
CHANGED
|
@@ -15,6 +15,10 @@ export declare const personIdSchema: z.ZodEffects<z.ZodString, PersonId, string>
|
|
|
15
15
|
export type PersonId = string & {
|
|
16
16
|
readonly __brand: "PersonId";
|
|
17
17
|
};
|
|
18
|
+
export declare const personNoteIdSchema: z.ZodEffects<z.ZodString, PersonNoteId, string>;
|
|
19
|
+
export type PersonNoteId = string & {
|
|
20
|
+
readonly __brand: "PersonNoteId";
|
|
21
|
+
};
|
|
18
22
|
export declare const thoughtIdSchema: z.ZodEffects<z.ZodString, ThoughtId, string>;
|
|
19
23
|
export type ThoughtId = string & {
|
|
20
24
|
readonly __brand: "ThoughtId";
|
package/dist/types/id-types.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.habitEntryIdSchema = exports.habitIdSchema = exports.taskIdSchema = exports.taskListIdSchema = exports.thoughtIdSchema = exports.personIdSchema = exports.itemIdSchema = exports.authIdSchema = exports.userIdSchema = void 0;
|
|
3
|
+
exports.habitEntryIdSchema = exports.habitIdSchema = exports.taskIdSchema = exports.taskListIdSchema = exports.thoughtIdSchema = exports.personNoteIdSchema = exports.personIdSchema = exports.itemIdSchema = exports.authIdSchema = exports.userIdSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.userIdSchema = zod_1.z.string().transform((val) => val);
|
|
6
6
|
exports.authIdSchema = zod_1.z.string().transform((val) => val);
|
|
7
7
|
exports.itemIdSchema = zod_1.z.string().transform((val) => val);
|
|
8
8
|
exports.personIdSchema = zod_1.z.string().transform((val) => val);
|
|
9
|
+
exports.personNoteIdSchema = zod_1.z.string().transform((val) => val);
|
|
9
10
|
exports.thoughtIdSchema = zod_1.z.string().transform((val) => val);
|
|
10
11
|
exports.taskListIdSchema = zod_1.z.string().transform((val) => val);
|
|
11
12
|
exports.taskIdSchema = zod_1.z.string().transform((val) => val);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { PersonId, UserId } from "../id-types";
|
|
1
|
+
import { PersonId, PersonNoteId, UserId } from "../id-types";
|
|
2
2
|
export interface PersonProperty {
|
|
3
3
|
key: string;
|
|
4
4
|
value: string;
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
6
|
+
export interface PersonNoteData {
|
|
7
7
|
content: string;
|
|
8
8
|
createdAt: Date;
|
|
9
9
|
updatedAt: Date;
|
|
@@ -15,5 +15,5 @@ export interface PersonData {
|
|
|
15
15
|
updatedAt: Date;
|
|
16
16
|
name: string;
|
|
17
17
|
properties: PersonProperty[];
|
|
18
|
-
notes:
|
|
18
|
+
notes: PersonNoteId[];
|
|
19
19
|
}
|
package/package.json
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { Habit } from "../../models";
|
|
2
|
+
import { Habit, HabitFrequency } from "../../models";
|
|
3
3
|
|
|
4
4
|
export const updateHabitRequestSchema = z.object({
|
|
5
5
|
name: z.string().min(1, 'Name is required').trim().optional(),
|
|
6
6
|
description: z.string().trim().nullish(),
|
|
7
7
|
notes: z.string().trim().nullish(),
|
|
8
|
-
frequency: z.
|
|
8
|
+
frequency: z.nativeEnum(HabitFrequency).optional(),
|
|
9
9
|
rolloverTime: z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/, 'rolloverTime must be in HH:MM format').optional()
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
export
|
|
13
|
-
name?: string;
|
|
14
|
-
description?: string;
|
|
15
|
-
notes?: string;
|
|
16
|
-
frequency?: 'daily';
|
|
17
|
-
rolloverTime?: string;
|
|
18
|
-
}
|
|
12
|
+
export type UpdateHabitRequest = z.infer<typeof updateHabitRequestSchema>;
|
|
19
13
|
|
|
20
14
|
export interface UpdateHabitResponse {
|
|
21
15
|
habit: Habit;
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
|
|
3
3
|
export const updateItemRequestSchema = z.object({
|
|
4
4
|
name: z.string().min(1).optional(),
|
|
5
|
-
dueDate: z.string().nullish(),
|
|
5
|
+
dueDate: z.string().transform(val => new Date(val)).nullish(),
|
|
6
6
|
notes: z.string().nullish(),
|
|
7
7
|
urgent: z.boolean().optional(),
|
|
8
8
|
category: z.string().nullish(),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { personIdSchema, PersonNoteId, personNoteIdSchema } from "../../id-types";
|
|
2
3
|
|
|
3
4
|
export const updatePersonRequestSchema = z.object({
|
|
4
5
|
name: z.string().min(1).optional(),
|
|
@@ -6,9 +7,7 @@ export const updatePersonRequestSchema = z.object({
|
|
|
6
7
|
key: z.string().min(1),
|
|
7
8
|
value: z.string().min(1)
|
|
8
9
|
})).optional(),
|
|
9
|
-
notes: z.array(
|
|
10
|
-
content: z.string().min(1)
|
|
11
|
-
})).optional()
|
|
10
|
+
notes: z.array(personNoteIdSchema).optional()
|
|
12
11
|
});
|
|
13
12
|
|
|
14
13
|
export type UpdatePersonRequest = z.infer<typeof updatePersonRequestSchema>;
|
|
@@ -21,10 +20,6 @@ export interface UpdatePersonResponse {
|
|
|
21
20
|
key: string;
|
|
22
21
|
value: string;
|
|
23
22
|
}>;
|
|
24
|
-
notes: Array<
|
|
25
|
-
content: string;
|
|
26
|
-
createdAt: string;
|
|
27
|
-
updatedAt: string;
|
|
28
|
-
}>;
|
|
23
|
+
notes: Array<PersonNoteId>;
|
|
29
24
|
};
|
|
30
25
|
}
|
package/src/types/id-types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { PersonNoteData } from "./models";
|
|
2
3
|
|
|
3
4
|
export const userIdSchema = z.string().transform((val): UserId => val as UserId);
|
|
4
5
|
export type UserId = string & { readonly __brand: "UserId" };
|
|
@@ -12,6 +13,9 @@ export type ItemId = string & { readonly __brand: "ItemId" };
|
|
|
12
13
|
export const personIdSchema = z.string().transform((val): PersonId => val as PersonId);
|
|
13
14
|
export type PersonId = string & { readonly __brand: "PersonId" };
|
|
14
15
|
|
|
16
|
+
export const personNoteIdSchema = z.string().transform((val): PersonNoteId => val as PersonNoteId);
|
|
17
|
+
export type PersonNoteId = string & { readonly __brand: "PersonNoteId" };
|
|
18
|
+
|
|
15
19
|
export const thoughtIdSchema = z.string().transform((val): ThoughtId => val as ThoughtId);
|
|
16
20
|
export type ThoughtId = string & { readonly __brand: "ThoughtId" };
|
|
17
21
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { PersonId, UserId } from "../id-types";
|
|
1
|
+
import { PersonId, PersonNoteId, UserId } from "../id-types";
|
|
2
2
|
|
|
3
3
|
export interface PersonProperty {
|
|
4
4
|
key: string;
|
|
5
5
|
value: string;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export interface
|
|
8
|
+
export interface PersonNoteData {
|
|
9
9
|
content: string;
|
|
10
10
|
createdAt: Date;
|
|
11
11
|
updatedAt: Date;
|
|
@@ -18,5 +18,5 @@ export interface PersonData {
|
|
|
18
18
|
updatedAt: Date;
|
|
19
19
|
name: string;
|
|
20
20
|
properties: PersonProperty[];
|
|
21
|
-
notes:
|
|
21
|
+
notes: PersonNoteId[];
|
|
22
22
|
}
|