@timothyw/pat-common 1.0.37 → 1.0.39

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,6 +1,17 @@
1
+ import { z } from "zod";
1
2
  import { HabitWithEntries } from "../../models/habit-data";
3
+ export declare const createHabitEntryRequestSchema: z.ZodObject<{
4
+ date: z.ZodDate;
5
+ status: z.ZodEnum<["completed", "excused", "missed"]>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ status: "completed" | "excused" | "missed";
8
+ date: Date;
9
+ }, {
10
+ status: "completed" | "excused" | "missed";
11
+ date: Date;
12
+ }>;
2
13
  export interface CreateHabitEntryRequest {
3
- date: string;
14
+ date: Date;
4
15
  status: 'completed' | 'excused' | 'missed';
5
16
  }
6
17
  export interface CreateHabitEntryResponse {
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createHabitEntryRequestSchema = void 0;
3
4
  const zod_1 = require("zod");
4
- const createHabitEntryRequestSchema = zod_1.z.object({
5
- date: zod_1.z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'date must be in YYYY-MM-DD format'),
5
+ exports.createHabitEntryRequestSchema = zod_1.z.object({
6
+ date: zod_1.z.date(),
6
7
  status: zod_1.z.enum(['completed', 'excused', 'missed'])
7
8
  });
@@ -1,4 +1,21 @@
1
+ import { z } from "zod";
1
2
  import { HabitWithEntries } from "../../models/habit-data";
3
+ export declare const createHabitRequestSchema: z.ZodObject<{
4
+ name: z.ZodString;
5
+ description: z.ZodOptional<z.ZodString>;
6
+ frequency: z.ZodLiteral<"daily">;
7
+ rolloverTime: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ name: string;
10
+ frequency: "daily";
11
+ rolloverTime: string;
12
+ description?: string | undefined;
13
+ }, {
14
+ name: string;
15
+ frequency: "daily";
16
+ rolloverTime: string;
17
+ description?: string | undefined;
18
+ }>;
2
19
  export interface CreateHabitRequest {
3
20
  name: string;
4
21
  description?: string;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createHabitRequestSchema = void 0;
3
4
  const zod_1 = require("zod");
4
- const createHabitRequestSchema = zod_1.z.object({
5
+ exports.createHabitRequestSchema = zod_1.z.object({
5
6
  name: zod_1.z.string().min(1, 'Name is required').trim(),
6
7
  description: zod_1.z.string().trim().optional(),
7
8
  frequency: zod_1.z.literal('daily'),
@@ -1,4 +1,21 @@
1
+ import { z } from "zod";
1
2
  import { HabitWithEntries } from "../../models/habit-data";
3
+ export declare const updateHabitRequestSchema: z.ZodObject<{
4
+ name: z.ZodOptional<z.ZodString>;
5
+ description: z.ZodOptional<z.ZodString>;
6
+ frequency: z.ZodOptional<z.ZodLiteral<"daily">>;
7
+ rolloverTime: z.ZodOptional<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ name?: string | undefined;
10
+ description?: string | undefined;
11
+ frequency?: "daily" | undefined;
12
+ rolloverTime?: string | undefined;
13
+ }, {
14
+ name?: string | undefined;
15
+ description?: string | undefined;
16
+ frequency?: "daily" | undefined;
17
+ rolloverTime?: string | undefined;
18
+ }>;
2
19
  export interface UpdateHabitRequest {
3
20
  name?: string;
4
21
  description?: string;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateHabitRequestSchema = void 0;
3
4
  const zod_1 = require("zod");
4
- const updateHabitRequestSchema = zod_1.z.object({
5
+ exports.updateHabitRequestSchema = zod_1.z.object({
5
6
  name: zod_1.z.string().min(1, 'Name is required').trim().optional(),
6
7
  description: zod_1.z.string().trim().optional(),
7
8
  frequency: zod_1.z.literal('daily').optional(),
@@ -1,8 +1,8 @@
1
1
  export interface HabitEntryData {
2
2
  _id: string;
3
3
  habitId: string;
4
- date: string;
5
- status: 'completed' | 'excused' | 'missed';
4
+ date: Date;
5
+ status: 'completed' | 'excused';
6
6
  createdAt: Date;
7
7
  updatedAt: Date;
8
8
  }
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.37",
5
+ "version": "1.0.39",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -1,13 +1,13 @@
1
1
  import { z } from "zod";
2
2
  import { HabitWithEntries } from "../../models/habit-data";
3
3
 
4
- const createHabitEntryRequestSchema = z.object({
5
- date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'date must be in YYYY-MM-DD format'),
4
+ export const createHabitEntryRequestSchema = z.object({
5
+ date: z.date(),
6
6
  status: z.enum(['completed', 'excused', 'missed'])
7
7
  });
8
8
 
9
9
  export interface CreateHabitEntryRequest {
10
- date: string;
10
+ date: Date;
11
11
  status: 'completed' | 'excused' | 'missed';
12
12
  }
13
13
 
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { HabitWithEntries } from "../../models/habit-data";
3
3
 
4
- const createHabitRequestSchema = z.object({
4
+ export const createHabitRequestSchema = z.object({
5
5
  name: z.string().min(1, 'Name is required').trim(),
6
6
  description: z.string().trim().optional(),
7
7
  frequency: z.literal('daily'),
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { HabitWithEntries } from "../../models/habit-data";
3
3
 
4
- const updateHabitRequestSchema = z.object({
4
+ export const updateHabitRequestSchema = z.object({
5
5
  name: z.string().min(1, 'Name is required').trim().optional(),
6
6
  description: z.string().trim().optional(),
7
7
  frequency: z.literal('daily').optional(),
@@ -1,10 +1,8 @@
1
- import { TaskId, TaskListId, UserId } from "../id-types";
2
-
3
1
  export interface HabitEntryData {
4
2
  _id: string;
5
3
  habitId: string;
6
- date: string;
7
- status: 'completed' | 'excused' | 'missed';
4
+ date: Date;
5
+ status: 'completed' | 'excused';
8
6
  createdAt: Date;
9
7
  updatedAt: Date;
10
8
  }