@timothyw/pat-common 1.0.36 → 1.0.38

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.
Files changed (28) hide show
  1. package/dist/types/api/habits/create-habit-entry-types.d.ts +19 -0
  2. package/dist/types/api/habits/create-habit-entry-types.js +8 -0
  3. package/dist/types/api/habits/create-habit-types.d.ts +27 -0
  4. package/dist/types/api/habits/create-habit-types.js +10 -0
  5. package/dist/types/api/habits/delete-habit-entry-types.d.ts +4 -0
  6. package/dist/types/api/habits/delete-habit-entry-types.js +2 -0
  7. package/dist/types/api/habits/delete-habit-types.d.ts +3 -0
  8. package/dist/types/api/habits/delete-habit-types.js +2 -0
  9. package/dist/types/api/habits/get-habits-types.d.ts +4 -0
  10. package/dist/types/api/habits/get-habits-types.js +2 -0
  11. package/dist/types/api/habits/index.d.ts +6 -0
  12. package/dist/types/api/habits/index.js +22 -0
  13. package/dist/types/api/habits/update-habit-types.d.ts +27 -0
  14. package/dist/types/api/habits/update-habit-types.js +10 -0
  15. package/dist/types/api/index.d.ts +1 -0
  16. package/dist/types/api/index.js +1 -0
  17. package/dist/types/models/habit-data.d.ts +36 -0
  18. package/dist/types/models/habit-data.js +2 -0
  19. package/package.json +1 -1
  20. package/src/types/api/habits/create-habit-entry-types.ts +16 -0
  21. package/src/types/api/habits/create-habit-types.ts +20 -0
  22. package/src/types/api/habits/delete-habit-entry-types.ts +5 -0
  23. package/src/types/api/habits/delete-habit-types.ts +3 -0
  24. package/src/types/api/habits/get-habits-types.ts +5 -0
  25. package/src/types/api/habits/index.ts +6 -0
  26. package/src/types/api/habits/update-habit-types.ts +20 -0
  27. package/src/types/api/index.ts +1 -0
  28. package/src/types/models/habit-data.ts +41 -0
@@ -0,0 +1,19 @@
1
+ import { z } from "zod";
2
+ import { HabitWithEntries } from "../../models/habit-data";
3
+ export declare const createHabitEntryRequestSchema: z.ZodObject<{
4
+ date: z.ZodString;
5
+ status: z.ZodEnum<["completed", "excused", "missed"]>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ status: "completed" | "excused" | "missed";
8
+ date: string;
9
+ }, {
10
+ status: "completed" | "excused" | "missed";
11
+ date: string;
12
+ }>;
13
+ export interface CreateHabitEntryRequest {
14
+ date: string;
15
+ status: 'completed' | 'excused' | 'missed';
16
+ }
17
+ export interface CreateHabitEntryResponse {
18
+ habit: HabitWithEntries;
19
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createHabitEntryRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.createHabitEntryRequestSchema = zod_1.z.object({
6
+ date: zod_1.z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'date must be in YYYY-MM-DD format'),
7
+ status: zod_1.z.enum(['completed', 'excused', 'missed'])
8
+ });
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
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
+ }>;
19
+ export interface CreateHabitRequest {
20
+ name: string;
21
+ description?: string;
22
+ frequency: 'daily';
23
+ rolloverTime: string;
24
+ }
25
+ export interface CreateHabitResponse {
26
+ habit: HabitWithEntries;
27
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createHabitRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.createHabitRequestSchema = zod_1.z.object({
6
+ name: zod_1.z.string().min(1, 'Name is required').trim(),
7
+ description: zod_1.z.string().trim().optional(),
8
+ frequency: zod_1.z.literal('daily'),
9
+ rolloverTime: zod_1.z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/, 'rolloverTime must be in HH:MM format')
10
+ });
@@ -0,0 +1,4 @@
1
+ import { HabitWithEntries } from "../../models/habit-data";
2
+ export interface DeleteHabitEntryResponse {
3
+ habit: HabitWithEntries;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface DeleteHabitResponse {
2
+ success: boolean;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import { HabitWithEntries } from "../../models/habit-data";
2
+ export interface GetHabitsResponse {
3
+ habits: HabitWithEntries[];
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export * from './create-habit-entry-types';
2
+ export * from './create-habit-types';
3
+ export * from './delete-habit-entry-types';
4
+ export * from './delete-habit-types';
5
+ export * from './get-habits-types';
6
+ export * from './update-habit-types';
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./create-habit-entry-types"), exports);
18
+ __exportStar(require("./create-habit-types"), exports);
19
+ __exportStar(require("./delete-habit-entry-types"), exports);
20
+ __exportStar(require("./delete-habit-types"), exports);
21
+ __exportStar(require("./get-habits-types"), exports);
22
+ __exportStar(require("./update-habit-types"), exports);
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
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
+ }>;
19
+ export interface UpdateHabitRequest {
20
+ name?: string;
21
+ description?: string;
22
+ frequency?: 'daily';
23
+ rolloverTime?: string;
24
+ }
25
+ export interface UpdateHabitResponse {
26
+ habit: HabitWithEntries;
27
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateHabitRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.updateHabitRequestSchema = zod_1.z.object({
6
+ name: zod_1.z.string().min(1, 'Name is required').trim().optional(),
7
+ description: zod_1.z.string().trim().optional(),
8
+ frequency: zod_1.z.literal('daily').optional(),
9
+ 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
+ });
@@ -1,5 +1,6 @@
1
1
  export * from './account';
2
2
  export * from './auth';
3
+ export * from './habits';
3
4
  export * from './items';
4
5
  export * from './people';
5
6
  export * from './tasks';
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./account"), exports);
18
18
  __exportStar(require("./auth"), exports);
19
+ __exportStar(require("./habits"), exports);
19
20
  __exportStar(require("./items"), exports);
20
21
  __exportStar(require("./people"), exports);
21
22
  __exportStar(require("./tasks"), exports);
@@ -0,0 +1,36 @@
1
+ export interface HabitEntryData {
2
+ _id: string;
3
+ habitId: string;
4
+ date: string;
5
+ status: 'completed' | 'excused' | 'missed';
6
+ createdAt: Date;
7
+ updatedAt: Date;
8
+ }
9
+ export interface HabitData {
10
+ _id: string;
11
+ userId: string;
12
+ name: string;
13
+ description?: string;
14
+ frequency: 'daily';
15
+ rolloverTime: string;
16
+ createdAt: Date;
17
+ updatedAt: Date;
18
+ }
19
+ export interface HabitStats {
20
+ totalDays: number;
21
+ completedDays: number;
22
+ excusedDays: number;
23
+ missedDays: number;
24
+ completionRate: number;
25
+ }
26
+ export interface HabitWithEntries {
27
+ id: string;
28
+ name: string;
29
+ description?: string;
30
+ frequency: 'daily';
31
+ rolloverTime: string;
32
+ createdAt: Date;
33
+ updatedAt: Date;
34
+ entries: HabitEntryData[];
35
+ stats: HabitStats;
36
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
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.36",
5
+ "version": "1.0.38",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ import { HabitWithEntries } from "../../models/habit-data";
3
+
4
+ export const createHabitEntryRequestSchema = z.object({
5
+ date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'date must be in YYYY-MM-DD format'),
6
+ status: z.enum(['completed', 'excused', 'missed'])
7
+ });
8
+
9
+ export interface CreateHabitEntryRequest {
10
+ date: string;
11
+ status: 'completed' | 'excused' | 'missed';
12
+ }
13
+
14
+ export interface CreateHabitEntryResponse {
15
+ habit: HabitWithEntries;
16
+ }
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ import { HabitWithEntries } from "../../models/habit-data";
3
+
4
+ export const createHabitRequestSchema = z.object({
5
+ name: z.string().min(1, 'Name is required').trim(),
6
+ description: z.string().trim().optional(),
7
+ frequency: z.literal('daily'),
8
+ rolloverTime: z.string().regex(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/, 'rolloverTime must be in HH:MM format')
9
+ });
10
+
11
+ export interface CreateHabitRequest {
12
+ name: string;
13
+ description?: string;
14
+ frequency: 'daily';
15
+ rolloverTime: string;
16
+ }
17
+
18
+ export interface CreateHabitResponse {
19
+ habit: HabitWithEntries;
20
+ }
@@ -0,0 +1,5 @@
1
+ import { HabitWithEntries } from "../../models/habit-data";
2
+
3
+ export interface DeleteHabitEntryResponse {
4
+ habit: HabitWithEntries;
5
+ }
@@ -0,0 +1,3 @@
1
+ export interface DeleteHabitResponse {
2
+ success: boolean;
3
+ }
@@ -0,0 +1,5 @@
1
+ import { HabitWithEntries } from "../../models/habit-data";
2
+
3
+ export interface GetHabitsResponse {
4
+ habits: HabitWithEntries[];
5
+ }
@@ -0,0 +1,6 @@
1
+ export * from './create-habit-entry-types';
2
+ export * from './create-habit-types';
3
+ export * from './delete-habit-entry-types';
4
+ export * from './delete-habit-types';
5
+ export * from './get-habits-types';
6
+ export * from './update-habit-types';
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ import { HabitWithEntries } from "../../models/habit-data";
3
+
4
+ export const updateHabitRequestSchema = z.object({
5
+ name: z.string().min(1, 'Name is required').trim().optional(),
6
+ description: z.string().trim().optional(),
7
+ frequency: z.literal('daily').optional(),
8
+ 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
+ export interface UpdateHabitRequest {
12
+ name?: string;
13
+ description?: string;
14
+ frequency?: 'daily';
15
+ rolloverTime?: string;
16
+ }
17
+
18
+ export interface UpdateHabitResponse {
19
+ habit: HabitWithEntries;
20
+ }
@@ -1,5 +1,6 @@
1
1
  export * from './account'
2
2
  export * from './auth'
3
+ export * from './habits'
3
4
  export * from './items'
4
5
  export * from './people'
5
6
  export * from './tasks'
@@ -0,0 +1,41 @@
1
+ import { TaskId, TaskListId, UserId } from "../id-types";
2
+
3
+ export interface HabitEntryData {
4
+ _id: string;
5
+ habitId: string;
6
+ date: string;
7
+ status: 'completed' | 'excused' | 'missed';
8
+ createdAt: Date;
9
+ updatedAt: Date;
10
+ }
11
+
12
+ export interface HabitData {
13
+ _id: string;
14
+ userId: string;
15
+ name: string;
16
+ description?: string;
17
+ frequency: 'daily';
18
+ rolloverTime: string;
19
+ createdAt: Date;
20
+ updatedAt: Date;
21
+ }
22
+
23
+ export interface HabitStats {
24
+ totalDays: number;
25
+ completedDays: number;
26
+ excusedDays: number;
27
+ missedDays: number;
28
+ completionRate: number;
29
+ }
30
+
31
+ export interface HabitWithEntries {
32
+ id: string;
33
+ name: string;
34
+ description?: string;
35
+ frequency: 'daily';
36
+ rolloverTime: string;
37
+ createdAt: Date;
38
+ updatedAt: Date;
39
+ entries: HabitEntryData[];
40
+ stats: HabitStats;
41
+ }