@timothyw/pat-common 1.0.59 → 1.0.61
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 +7 -3
- package/dist/types/api/habits/update-habit-types.js +2 -1
- package/dist/types/api/items/update-item-types.d.ts +3 -3
- package/dist/types/api/items/update-item-types.js +1 -1
- package/dist/types/api/tasks/update-task-types.d.ts +3 -3
- package/dist/types/api/tasks/update-task-types.js +1 -1
- package/dist/types/id-types.d.ts +11 -3
- package/dist/types/id-types.js +4 -2
- package/dist/types/models/habit-data.d.ts +4 -3
- package/package.json +1 -1
- package/src/types/api/habits/update-habit-types.ts +3 -1
- package/src/types/api/items/update-item-types.ts +1 -1
- package/src/types/api/tasks/update-task-types.ts +1 -1
- package/src/types/id-types.ts +8 -2
- package/src/types/models/habit-data.ts +4 -3
|
@@ -2,23 +2,27 @@ import { z } from "zod";
|
|
|
2
2
|
import { Habit } from "../../models";
|
|
3
3
|
export declare const updateHabitRequestSchema: z.ZodObject<{
|
|
4
4
|
name: z.ZodOptional<z.ZodString>;
|
|
5
|
-
description: z.ZodOptional<z.ZodString
|
|
5
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
6
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
6
7
|
frequency: z.ZodOptional<z.ZodLiteral<"daily">>;
|
|
7
8
|
rolloverTime: z.ZodOptional<z.ZodString>;
|
|
8
9
|
}, "strip", z.ZodTypeAny, {
|
|
9
10
|
name?: string | undefined;
|
|
10
|
-
description?: string | undefined;
|
|
11
|
+
description?: string | null | undefined;
|
|
12
|
+
notes?: string | null | undefined;
|
|
11
13
|
frequency?: "daily" | undefined;
|
|
12
14
|
rolloverTime?: string | undefined;
|
|
13
15
|
}, {
|
|
14
16
|
name?: string | undefined;
|
|
15
|
-
description?: string | undefined;
|
|
17
|
+
description?: string | null | undefined;
|
|
18
|
+
notes?: string | null | undefined;
|
|
16
19
|
frequency?: "daily" | undefined;
|
|
17
20
|
rolloverTime?: string | undefined;
|
|
18
21
|
}>;
|
|
19
22
|
export interface UpdateHabitRequest {
|
|
20
23
|
name?: string;
|
|
21
24
|
description?: string;
|
|
25
|
+
notes?: string;
|
|
22
26
|
frequency?: 'daily';
|
|
23
27
|
rolloverTime?: string;
|
|
24
28
|
}
|
|
@@ -4,7 +4,8 @@ exports.updateHabitRequestSchema = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.updateHabitRequestSchema = zod_1.z.object({
|
|
6
6
|
name: zod_1.z.string().min(1, 'Name is required').trim().optional(),
|
|
7
|
-
description: zod_1.z.string().trim().
|
|
7
|
+
description: zod_1.z.string().trim().nullish(),
|
|
8
|
+
notes: zod_1.z.string().trim().nullish(),
|
|
8
9
|
frequency: zod_1.z.literal('daily').optional(),
|
|
9
10
|
rolloverTime: zod_1.z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/, 'rolloverTime must be in HH:MM format').optional()
|
|
10
11
|
});
|
|
@@ -2,21 +2,21 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const updateItemRequestSchema: z.ZodObject<{
|
|
3
3
|
name: z.ZodOptional<z.ZodString>;
|
|
4
4
|
dueDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5
|
-
notes: z.ZodOptional<z.ZodString
|
|
5
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
6
6
|
urgent: z.ZodOptional<z.ZodBoolean>;
|
|
7
7
|
category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
8
|
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
10
|
type?: string | null | undefined;
|
|
11
11
|
name?: string | undefined;
|
|
12
|
-
notes?: string | undefined;
|
|
12
|
+
notes?: string | null | undefined;
|
|
13
13
|
dueDate?: string | null | undefined;
|
|
14
14
|
urgent?: boolean | undefined;
|
|
15
15
|
category?: string | null | undefined;
|
|
16
16
|
}, {
|
|
17
17
|
type?: string | null | undefined;
|
|
18
18
|
name?: string | undefined;
|
|
19
|
-
notes?: string | undefined;
|
|
19
|
+
notes?: string | null | undefined;
|
|
20
20
|
dueDate?: string | null | undefined;
|
|
21
21
|
urgent?: boolean | undefined;
|
|
22
22
|
category?: string | null | undefined;
|
|
@@ -5,7 +5,7 @@ const zod_1 = require("zod");
|
|
|
5
5
|
exports.updateItemRequestSchema = zod_1.z.object({
|
|
6
6
|
name: zod_1.z.string().min(1).optional(),
|
|
7
7
|
dueDate: zod_1.z.string().nullish(),
|
|
8
|
-
notes: zod_1.z.string().
|
|
8
|
+
notes: zod_1.z.string().nullish(),
|
|
9
9
|
urgent: zod_1.z.boolean().optional(),
|
|
10
10
|
category: zod_1.z.string().nullish(),
|
|
11
11
|
type: zod_1.z.string().nullish()
|
|
@@ -2,18 +2,18 @@ import { z } from 'zod';
|
|
|
2
2
|
import { TaskId, TaskListId } from '../../id-types';
|
|
3
3
|
export declare const updateTaskRequestSchema: z.ZodObject<{
|
|
4
4
|
name: z.ZodOptional<z.ZodString>;
|
|
5
|
-
notes: z.ZodOptional<z.ZodString
|
|
5
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
6
6
|
completed: z.ZodOptional<z.ZodBoolean>;
|
|
7
7
|
taskListId: z.ZodOptional<z.ZodEffects<z.ZodString, TaskListId, string>>;
|
|
8
8
|
}, "strip", z.ZodTypeAny, {
|
|
9
9
|
completed?: boolean | undefined;
|
|
10
10
|
name?: string | undefined;
|
|
11
|
-
notes?: string | undefined;
|
|
11
|
+
notes?: string | null | undefined;
|
|
12
12
|
taskListId?: TaskListId | undefined;
|
|
13
13
|
}, {
|
|
14
14
|
completed?: boolean | undefined;
|
|
15
15
|
name?: string | undefined;
|
|
16
|
-
notes?: string | undefined;
|
|
16
|
+
notes?: string | null | undefined;
|
|
17
17
|
taskListId?: string | undefined;
|
|
18
18
|
}>;
|
|
19
19
|
export type UpdateTaskRequest = z.infer<typeof updateTaskRequestSchema>;
|
|
@@ -5,7 +5,7 @@ const zod_1 = require("zod");
|
|
|
5
5
|
const id_types_1 = require("../../id-types");
|
|
6
6
|
exports.updateTaskRequestSchema = zod_1.z.object({
|
|
7
7
|
name: zod_1.z.string().min(1).optional(),
|
|
8
|
-
notes: zod_1.z.string().
|
|
8
|
+
notes: zod_1.z.string().nullish(),
|
|
9
9
|
completed: zod_1.z.boolean().optional(),
|
|
10
10
|
taskListId: id_types_1.taskListIdSchema.optional()
|
|
11
11
|
});
|
package/dist/types/id-types.d.ts
CHANGED
|
@@ -19,11 +19,19 @@ export declare const thoughtIdSchema: z.ZodEffects<z.ZodString, ThoughtId, strin
|
|
|
19
19
|
export type ThoughtId = string & {
|
|
20
20
|
readonly __brand: "ThoughtId";
|
|
21
21
|
};
|
|
22
|
+
export declare const taskListIdSchema: z.ZodEffects<z.ZodString, TaskListId, string>;
|
|
23
|
+
export type TaskListId = string & {
|
|
24
|
+
readonly __brand: "TaskListId";
|
|
25
|
+
};
|
|
22
26
|
export declare const taskIdSchema: z.ZodEffects<z.ZodString, TaskId, string>;
|
|
23
27
|
export type TaskId = string & {
|
|
24
28
|
readonly __brand: "TaskId";
|
|
25
29
|
};
|
|
26
|
-
export declare const
|
|
27
|
-
export type
|
|
28
|
-
readonly __brand: "
|
|
30
|
+
export declare const habitIdSchema: z.ZodEffects<z.ZodString, TaskListId, string>;
|
|
31
|
+
export type HabitId = string & {
|
|
32
|
+
readonly __brand: "HabitId";
|
|
33
|
+
};
|
|
34
|
+
export declare const habitEntryIdSchema: z.ZodEffects<z.ZodString, TaskListId, string>;
|
|
35
|
+
export type HabitEntryId = string & {
|
|
36
|
+
readonly __brand: "HabitEntryId";
|
|
29
37
|
};
|
package/dist/types/id-types.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.habitEntryIdSchema = exports.habitIdSchema = exports.taskIdSchema = exports.taskListIdSchema = exports.thoughtIdSchema = 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
9
|
exports.thoughtIdSchema = zod_1.z.string().transform((val) => val);
|
|
10
|
-
exports.taskIdSchema = zod_1.z.string().transform((val) => val);
|
|
11
10
|
exports.taskListIdSchema = zod_1.z.string().transform((val) => val);
|
|
11
|
+
exports.taskIdSchema = zod_1.z.string().transform((val) => val);
|
|
12
|
+
exports.habitIdSchema = zod_1.z.string().transform((val) => val);
|
|
13
|
+
exports.habitEntryIdSchema = zod_1.z.string().transform((val) => val);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DateOnlyString } from "../misc-types";
|
|
2
|
+
import { HabitEntryId, HabitId, UserId } from "../id-types";
|
|
2
3
|
export declare enum HabitFrequency {
|
|
3
4
|
DAILY = "daily",
|
|
4
5
|
WEEKLY = "weekly",
|
|
@@ -11,7 +12,7 @@ export declare enum HabitEntryStatus {
|
|
|
11
12
|
EXCUSED = "excused"
|
|
12
13
|
}
|
|
13
14
|
export interface HabitEntryData {
|
|
14
|
-
_id:
|
|
15
|
+
_id: HabitEntryId;
|
|
15
16
|
habitId: string;
|
|
16
17
|
date: DateOnlyString;
|
|
17
18
|
status: HabitEntryStatus;
|
|
@@ -19,8 +20,8 @@ export interface HabitEntryData {
|
|
|
19
20
|
updatedAt: Date;
|
|
20
21
|
}
|
|
21
22
|
export interface HabitData {
|
|
22
|
-
_id:
|
|
23
|
-
userId:
|
|
23
|
+
_id: HabitId;
|
|
24
|
+
userId: UserId;
|
|
24
25
|
name: string;
|
|
25
26
|
description?: string;
|
|
26
27
|
notes?: string;
|
package/package.json
CHANGED
|
@@ -3,7 +3,8 @@ import { Habit } from "../../models";
|
|
|
3
3
|
|
|
4
4
|
export const updateHabitRequestSchema = z.object({
|
|
5
5
|
name: z.string().min(1, 'Name is required').trim().optional(),
|
|
6
|
-
description: z.string().trim().
|
|
6
|
+
description: z.string().trim().nullish(),
|
|
7
|
+
notes: z.string().trim().nullish(),
|
|
7
8
|
frequency: z.literal('daily').optional(),
|
|
8
9
|
rolloverTime: z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/, 'rolloverTime must be in HH:MM format').optional()
|
|
9
10
|
});
|
|
@@ -11,6 +12,7 @@ export const updateHabitRequestSchema = z.object({
|
|
|
11
12
|
export interface UpdateHabitRequest {
|
|
12
13
|
name?: string;
|
|
13
14
|
description?: string;
|
|
15
|
+
notes?: string;
|
|
14
16
|
frequency?: 'daily';
|
|
15
17
|
rolloverTime?: string;
|
|
16
18
|
}
|
|
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
export const updateItemRequestSchema = z.object({
|
|
4
4
|
name: z.string().min(1).optional(),
|
|
5
5
|
dueDate: z.string().nullish(),
|
|
6
|
-
notes: z.string().
|
|
6
|
+
notes: z.string().nullish(),
|
|
7
7
|
urgent: z.boolean().optional(),
|
|
8
8
|
category: z.string().nullish(),
|
|
9
9
|
type: z.string().nullish()
|
|
@@ -3,7 +3,7 @@ import { TaskId, TaskListId, taskListIdSchema } from '../../id-types';
|
|
|
3
3
|
|
|
4
4
|
export const updateTaskRequestSchema = z.object({
|
|
5
5
|
name: z.string().min(1).optional(),
|
|
6
|
-
notes: z.string().
|
|
6
|
+
notes: z.string().nullish(),
|
|
7
7
|
completed: z.boolean().optional(),
|
|
8
8
|
taskListId: taskListIdSchema.optional()
|
|
9
9
|
});
|
package/src/types/id-types.ts
CHANGED
|
@@ -15,8 +15,14 @@ export type PersonId = string & { readonly __brand: "PersonId" };
|
|
|
15
15
|
export const thoughtIdSchema = z.string().transform((val): ThoughtId => val as ThoughtId);
|
|
16
16
|
export type ThoughtId = string & { readonly __brand: "ThoughtId" };
|
|
17
17
|
|
|
18
|
+
export const taskListIdSchema = z.string().transform((val): TaskListId => val as TaskListId);
|
|
19
|
+
export type TaskListId = string & { readonly __brand: "TaskListId" };
|
|
20
|
+
|
|
18
21
|
export const taskIdSchema = z.string().transform((val): TaskId => val as TaskId);
|
|
19
22
|
export type TaskId = string & { readonly __brand: "TaskId" };
|
|
20
23
|
|
|
21
|
-
export const
|
|
22
|
-
export type
|
|
24
|
+
export const habitIdSchema = z.string().transform((val): TaskListId => val as TaskListId);
|
|
25
|
+
export type HabitId = string & { readonly __brand: "HabitId" };
|
|
26
|
+
|
|
27
|
+
export const habitEntryIdSchema = z.string().transform((val): TaskListId => val as TaskListId);
|
|
28
|
+
export type HabitEntryId = string & { readonly __brand: "HabitEntryId" };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DateOnlyString, ToDateString } from "../misc-types";
|
|
2
2
|
import { toDateString } from "../../utils";
|
|
3
|
+
import { HabitEntryId, HabitId, UserId } from "../id-types";
|
|
3
4
|
|
|
4
5
|
export enum HabitFrequency {
|
|
5
6
|
DAILY = 'daily',
|
|
@@ -15,7 +16,7 @@ export enum HabitEntryStatus {
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export interface HabitEntryData {
|
|
18
|
-
_id:
|
|
19
|
+
_id: HabitEntryId;
|
|
19
20
|
habitId: string;
|
|
20
21
|
date: DateOnlyString;
|
|
21
22
|
status: HabitEntryStatus;
|
|
@@ -24,8 +25,8 @@ export interface HabitEntryData {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export interface HabitData {
|
|
27
|
-
_id:
|
|
28
|
-
userId:
|
|
28
|
+
_id: HabitId;
|
|
29
|
+
userId: UserId;
|
|
29
30
|
name: string;
|
|
30
31
|
description?: string;
|
|
31
32
|
notes?: string;
|