@timothyw/pat-common 1.0.105 → 1.0.107
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/index.d.ts +1 -1
- package/dist/types/api/index.js +1 -1
- package/dist/types/api/items/create-item-types.d.ts +2 -2
- package/dist/types/api/items/update-item-types.d.ts +2 -2
- package/dist/types/api/lists/complete-list-item-types.d.ts +14 -0
- package/dist/types/api/lists/complete-list-item-types.js +7 -0
- package/dist/types/api/lists/create-list-item-types.d.ts +22 -0
- package/dist/types/api/lists/create-list-item-types.js +10 -0
- package/dist/types/api/lists/create-list-types.d.ts +17 -0
- package/dist/types/api/lists/create-list-types.js +9 -0
- package/dist/types/api/lists/get-list-item-types.d.ts +5 -0
- package/dist/types/api/lists/get-list-item-types.js +2 -0
- package/dist/types/api/lists/get-lists-types.d.ts +5 -0
- package/dist/types/api/lists/get-lists-types.js +2 -0
- package/dist/types/api/lists/index.d.ts +7 -0
- package/dist/types/api/lists/index.js +23 -0
- package/dist/types/api/lists/update-list-item-types.d.ts +23 -0
- package/dist/types/api/lists/update-list-item-types.js +11 -0
- package/dist/types/api/lists/update-list-types.d.ts +17 -0
- package/dist/types/api/lists/update-list-types.js +9 -0
- package/dist/types/api/tasks/create-task-list-types.d.ts +4 -1
- package/dist/types/api/tasks/create-task-list-types.js +3 -1
- package/dist/types/api/tasks/update-task-list-types.d.ts +4 -1
- package/dist/types/api/tasks/update-task-list-types.js +3 -1
- package/dist/types/id-types.d.ts +8 -8
- package/dist/types/id-types.js +3 -3
- package/dist/types/models/index.d.ts +1 -1
- package/dist/types/models/index.js +1 -1
- package/dist/types/models/list-data.d.ts +23 -0
- package/dist/types/models/list-data.js +8 -0
- package/dist/types/models/task-data.d.ts +5 -0
- package/dist/types/models/task-data.js +6 -0
- package/dist/utils/serializing-utils.d.ts +5 -5
- package/package.json +3 -3
- package/src/types/api/index.ts +1 -1
- package/src/types/api/lists/complete-list-item-types.ts +13 -0
- package/src/types/api/lists/create-list-item-types.ts +16 -0
- package/src/types/api/lists/create-list-types.ts +14 -0
- package/src/types/api/lists/get-list-item-types.ts +6 -0
- package/src/types/api/lists/get-lists-types.ts +6 -0
- package/src/types/api/lists/index.ts +7 -0
- package/src/types/api/lists/update-list-item-types.ts +17 -0
- package/src/types/api/lists/update-list-types.ts +14 -0
- package/src/types/id-types.ts +6 -6
- package/src/types/models/index.ts +1 -1
- package/src/types/models/list-data.ts +26 -0
- package/src/utils/serializing-utils.ts +7 -7
- package/src/types/api/tasks/complete-task-types.ts +0 -13
- package/src/types/api/tasks/create-task-list-types.ts +0 -13
- package/src/types/api/tasks/create-task-types.ts +0 -16
- package/src/types/api/tasks/get-task-lists-types.ts +0 -6
- package/src/types/api/tasks/get-tasks-types.ts +0 -6
- package/src/types/api/tasks/index.ts +0 -7
- package/src/types/api/tasks/update-task-list-types.ts +0 -13
- package/src/types/api/tasks/update-task-types.ts +0 -17
- package/src/types/models/task-data.ts +0 -20
package/dist/types/api/index.js
CHANGED
|
@@ -21,5 +21,5 @@ __exportStar(require("./items"), exports);
|
|
|
21
21
|
__exportStar(require("./misc"), exports);
|
|
22
22
|
__exportStar(require("./notifications"), exports);
|
|
23
23
|
__exportStar(require("./people"), exports);
|
|
24
|
-
__exportStar(require("./
|
|
24
|
+
__exportStar(require("./lists"), exports);
|
|
25
25
|
__exportStar(require("./thoughts"), exports);
|
|
@@ -12,14 +12,14 @@ export declare const createItemRequestSchema: z.ZodObject<{
|
|
|
12
12
|
name: string;
|
|
13
13
|
urgent: boolean;
|
|
14
14
|
type?: string | undefined;
|
|
15
|
-
dueDate?: string | undefined;
|
|
16
15
|
notes?: string | undefined;
|
|
16
|
+
dueDate?: string | undefined;
|
|
17
17
|
category?: string | undefined;
|
|
18
18
|
}, {
|
|
19
19
|
name: string;
|
|
20
20
|
type?: string | undefined;
|
|
21
|
-
dueDate?: string | undefined;
|
|
22
21
|
notes?: string | undefined;
|
|
22
|
+
dueDate?: string | undefined;
|
|
23
23
|
urgent?: boolean | undefined;
|
|
24
24
|
category?: string | undefined;
|
|
25
25
|
}>;
|
|
@@ -11,15 +11,15 @@ export declare const updateItemRequestSchema: z.ZodObject<{
|
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
12
12
|
type?: string | null | undefined;
|
|
13
13
|
name?: string | undefined;
|
|
14
|
-
dueDate?: string | null | undefined;
|
|
15
14
|
notes?: string | null | undefined;
|
|
15
|
+
dueDate?: string | null | undefined;
|
|
16
16
|
urgent?: boolean | undefined;
|
|
17
17
|
category?: string | null | undefined;
|
|
18
18
|
}, {
|
|
19
19
|
type?: string | null | undefined;
|
|
20
20
|
name?: string | undefined;
|
|
21
|
-
dueDate?: string | null | undefined;
|
|
22
21
|
notes?: string | null | undefined;
|
|
22
|
+
dueDate?: string | null | undefined;
|
|
23
23
|
urgent?: boolean | undefined;
|
|
24
24
|
category?: string | null | undefined;
|
|
25
25
|
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Serialized } from "../../../utils";
|
|
3
|
+
import { ListItemData } from "../../models";
|
|
4
|
+
export declare const completeListItemRequestSchema: z.ZodObject<{
|
|
5
|
+
completed: z.ZodBoolean;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
completed: boolean;
|
|
8
|
+
}, {
|
|
9
|
+
completed: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
export type CompleteListItemRequest = z.infer<typeof completeListItemRequestSchema>;
|
|
12
|
+
export interface CompleteListItemResponse {
|
|
13
|
+
listItem: Serialized<ListItemData>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Serialized } from "../../../utils";
|
|
3
|
+
import { ListItemData } from "../../models";
|
|
4
|
+
export declare const createListItemRequestSchema: z.ZodObject<{
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
7
|
+
listId: z.ZodEffects<z.ZodString, import("../../id-types").ListId, string>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
name: string;
|
|
10
|
+
listId: string & {
|
|
11
|
+
readonly __brand: "ListId";
|
|
12
|
+
};
|
|
13
|
+
notes?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
name: string;
|
|
16
|
+
listId: string;
|
|
17
|
+
notes?: string | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
export type CreateListItemRequest = z.infer<typeof createListItemRequestSchema>;
|
|
20
|
+
export interface CreateListItemResponse {
|
|
21
|
+
listItem: Serialized<ListItemData>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createListItemRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const id_types_1 = require("../../id-types");
|
|
6
|
+
exports.createListItemRequestSchema = zod_1.z.object({
|
|
7
|
+
name: zod_1.z.string().min(1),
|
|
8
|
+
notes: zod_1.z.string().optional(),
|
|
9
|
+
listId: id_types_1.listIdSchema
|
|
10
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Serialized } from "../../../utils";
|
|
3
|
+
import { ListData, ListType } from "../../models";
|
|
4
|
+
export declare const createListRequestSchema: z.ZodObject<{
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
type: z.ZodNativeEnum<typeof ListType>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
type: ListType;
|
|
9
|
+
name: string;
|
|
10
|
+
}, {
|
|
11
|
+
type: ListType;
|
|
12
|
+
name: string;
|
|
13
|
+
}>;
|
|
14
|
+
export type CreateListRequest = z.infer<typeof createListRequestSchema>;
|
|
15
|
+
export interface CreateListResponse {
|
|
16
|
+
list: Serialized<ListData>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createListRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
exports.createListRequestSchema = zod_1.z.object({
|
|
7
|
+
name: zod_1.z.string().min(1),
|
|
8
|
+
type: zod_1.z.nativeEnum(models_1.ListType)
|
|
9
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './complete-list-item-types';
|
|
2
|
+
export * from './create-list-item-types';
|
|
3
|
+
export * from './get-list-item-types';
|
|
4
|
+
export * from './update-list-item-types';
|
|
5
|
+
export * from './create-list-types';
|
|
6
|
+
export * from './update-list-types';
|
|
7
|
+
export * from './get-lists-types';
|
|
@@ -0,0 +1,23 @@
|
|
|
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("./complete-list-item-types"), exports);
|
|
18
|
+
__exportStar(require("./create-list-item-types"), exports);
|
|
19
|
+
__exportStar(require("./get-list-item-types"), exports);
|
|
20
|
+
__exportStar(require("./update-list-item-types"), exports);
|
|
21
|
+
__exportStar(require("./create-list-types"), exports);
|
|
22
|
+
__exportStar(require("./update-list-types"), exports);
|
|
23
|
+
__exportStar(require("./get-lists-types"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Serialized } from "../../../utils";
|
|
3
|
+
import { ListItemData } from "../../models";
|
|
4
|
+
export declare const updateListItemRequestSchema: z.ZodObject<{
|
|
5
|
+
name: z.ZodOptional<z.ZodString>;
|
|
6
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
7
|
+
completed: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
+
listId: z.ZodOptional<z.ZodEffects<z.ZodString, import("../../id-types").ListId, string>>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
completed?: boolean | undefined;
|
|
11
|
+
name?: string | undefined;
|
|
12
|
+
notes?: string | null | undefined;
|
|
13
|
+
listId?: import("../../id-types").ListId | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
completed?: boolean | undefined;
|
|
16
|
+
name?: string | undefined;
|
|
17
|
+
notes?: string | null | undefined;
|
|
18
|
+
listId?: string | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
export type UpdateListItemRequest = z.infer<typeof updateListItemRequestSchema>;
|
|
21
|
+
export interface UpdateListItemResponse {
|
|
22
|
+
listItem: Serialized<ListItemData>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateListItemRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const id_types_1 = require("../../id-types");
|
|
6
|
+
exports.updateListItemRequestSchema = zod_1.z.object({
|
|
7
|
+
name: zod_1.z.string().min(1).optional(),
|
|
8
|
+
notes: zod_1.z.string().nullish(),
|
|
9
|
+
completed: zod_1.z.boolean().optional(),
|
|
10
|
+
listId: id_types_1.listIdSchema.optional()
|
|
11
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Serialized } from "../../../utils";
|
|
3
|
+
import { ListData, ListType } from "../../models";
|
|
4
|
+
export declare const updateListRequestSchema: z.ZodObject<{
|
|
5
|
+
name: z.ZodOptional<z.ZodString>;
|
|
6
|
+
type: z.ZodOptional<z.ZodNativeEnum<typeof ListType>>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
type?: ListType | undefined;
|
|
9
|
+
name?: string | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
type?: ListType | undefined;
|
|
12
|
+
name?: string | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
export type UpdateListRequest = z.infer<typeof updateListRequestSchema>;
|
|
15
|
+
export interface UpdateListResponse {
|
|
16
|
+
list: Serialized<ListData>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateListRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
exports.updateListRequestSchema = zod_1.z.object({
|
|
7
|
+
name: zod_1.z.string().min(1).optional(),
|
|
8
|
+
type: zod_1.z.nativeEnum(models_1.ListType).optional()
|
|
9
|
+
});
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Serialized } from "../../../utils";
|
|
3
|
-
import { TaskListData } from "../../models";
|
|
3
|
+
import { TaskListData, TaskListType } from "../../models";
|
|
4
4
|
export declare const createTaskListRequestSchema: z.ZodObject<{
|
|
5
5
|
name: z.ZodString;
|
|
6
|
+
type: z.ZodNativeEnum<typeof TaskListType>;
|
|
6
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
type: TaskListType;
|
|
7
9
|
name: string;
|
|
8
10
|
}, {
|
|
11
|
+
type: TaskListType;
|
|
9
12
|
name: string;
|
|
10
13
|
}>;
|
|
11
14
|
export type CreateTaskListRequest = z.infer<typeof createTaskListRequestSchema>;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createTaskListRequestSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
5
6
|
exports.createTaskListRequestSchema = zod_1.z.object({
|
|
6
|
-
name: zod_1.z.string().min(1)
|
|
7
|
+
name: zod_1.z.string().min(1),
|
|
8
|
+
type: zod_1.z.nativeEnum(models_1.TaskListType)
|
|
7
9
|
});
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Serialized } from "../../../utils";
|
|
3
|
-
import { TaskListData } from "../../models";
|
|
3
|
+
import { TaskListData, TaskListType } from "../../models";
|
|
4
4
|
export declare const updateTaskListRequestSchema: z.ZodObject<{
|
|
5
5
|
name: z.ZodOptional<z.ZodString>;
|
|
6
|
+
type: z.ZodOptional<z.ZodNativeEnum<typeof TaskListType>>;
|
|
6
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
type?: TaskListType | undefined;
|
|
7
9
|
name?: string | undefined;
|
|
8
10
|
}, {
|
|
11
|
+
type?: TaskListType | undefined;
|
|
9
12
|
name?: string | undefined;
|
|
10
13
|
}>;
|
|
11
14
|
export type UpdateTaskListRequest = z.infer<typeof updateTaskListRequestSchema>;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateTaskListRequestSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
5
6
|
exports.updateTaskListRequestSchema = zod_1.z.object({
|
|
6
|
-
name: zod_1.z.string().min(1).optional()
|
|
7
|
+
name: zod_1.z.string().min(1).optional(),
|
|
8
|
+
type: zod_1.z.nativeEnum(models_1.TaskListType).optional()
|
|
7
9
|
});
|
package/dist/types/id-types.d.ts
CHANGED
|
@@ -23,19 +23,19 @@ export declare const thoughtIdSchema: z.ZodEffects<z.ZodString, ThoughtId, strin
|
|
|
23
23
|
export type ThoughtId = string & {
|
|
24
24
|
readonly __brand: "ThoughtId";
|
|
25
25
|
};
|
|
26
|
-
export declare const
|
|
27
|
-
export type
|
|
28
|
-
readonly __brand: "
|
|
26
|
+
export declare const listIdSchema: z.ZodEffects<z.ZodString, ListId, string>;
|
|
27
|
+
export type ListId = string & {
|
|
28
|
+
readonly __brand: "ListId";
|
|
29
29
|
};
|
|
30
|
-
export declare const
|
|
31
|
-
export type
|
|
32
|
-
readonly __brand: "
|
|
30
|
+
export declare const listItemIdSchema: z.ZodEffects<z.ZodString, ListItemId, string>;
|
|
31
|
+
export type ListItemId = string & {
|
|
32
|
+
readonly __brand: "ListItemId";
|
|
33
33
|
};
|
|
34
|
-
export declare const habitIdSchema: z.ZodEffects<z.ZodString,
|
|
34
|
+
export declare const habitIdSchema: z.ZodEffects<z.ZodString, ListId, string>;
|
|
35
35
|
export type HabitId = string & {
|
|
36
36
|
readonly __brand: "HabitId";
|
|
37
37
|
};
|
|
38
|
-
export declare const habitEntryIdSchema: z.ZodEffects<z.ZodString,
|
|
38
|
+
export declare const habitEntryIdSchema: z.ZodEffects<z.ZodString, ListId, string>;
|
|
39
39
|
export type HabitEntryId = string & {
|
|
40
40
|
readonly __brand: "HabitEntryId";
|
|
41
41
|
};
|
package/dist/types/id-types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.notificationInstanceIdSchema = exports.notificationTemplateIdSchema = exports.habitEntryIdSchema = exports.habitIdSchema = exports.
|
|
3
|
+
exports.notificationInstanceIdSchema = exports.notificationTemplateIdSchema = exports.habitEntryIdSchema = exports.habitIdSchema = exports.listItemIdSchema = exports.listIdSchema = 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);
|
|
@@ -8,8 +8,8 @@ exports.itemIdSchema = zod_1.z.string().transform((val) => val);
|
|
|
8
8
|
exports.personIdSchema = zod_1.z.string().transform((val) => val);
|
|
9
9
|
exports.personNoteIdSchema = zod_1.z.string().transform((val) => val);
|
|
10
10
|
exports.thoughtIdSchema = zod_1.z.string().transform((val) => val);
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
11
|
+
exports.listIdSchema = zod_1.z.string().transform((val) => val);
|
|
12
|
+
exports.listItemIdSchema = zod_1.z.string().transform((val) => val);
|
|
13
13
|
exports.habitIdSchema = zod_1.z.string().transform((val) => val);
|
|
14
14
|
exports.habitEntryIdSchema = zod_1.z.string().transform((val) => val);
|
|
15
15
|
exports.notificationTemplateIdSchema = zod_1.z.string().transform((val) => val);
|
|
@@ -5,6 +5,6 @@ export * from './notification-template-data';
|
|
|
5
5
|
export * from './notifiable';
|
|
6
6
|
export * from './person-data';
|
|
7
7
|
export * from './program-config';
|
|
8
|
-
export * from './
|
|
8
|
+
export * from './list-data';
|
|
9
9
|
export * from './thought-data';
|
|
10
10
|
export * from './user-data';
|
|
@@ -21,6 +21,6 @@ __exportStar(require("./notification-template-data"), exports);
|
|
|
21
21
|
__exportStar(require("./notifiable"), exports);
|
|
22
22
|
__exportStar(require("./person-data"), exports);
|
|
23
23
|
__exportStar(require("./program-config"), exports);
|
|
24
|
-
__exportStar(require("./
|
|
24
|
+
__exportStar(require("./list-data"), exports);
|
|
25
25
|
__exportStar(require("./thought-data"), exports);
|
|
26
26
|
__exportStar(require("./user-data"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ListItemId, ListId, UserId } from "../id-types";
|
|
2
|
+
export declare enum ListType {
|
|
3
|
+
TASKS = "tasks",
|
|
4
|
+
NOTES = "notes"
|
|
5
|
+
}
|
|
6
|
+
export interface ListItemData {
|
|
7
|
+
_id: ListItemId;
|
|
8
|
+
userId: UserId;
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
updatedAt: Date;
|
|
11
|
+
name: string;
|
|
12
|
+
notes?: string;
|
|
13
|
+
completed: boolean;
|
|
14
|
+
taskListId: ListId;
|
|
15
|
+
}
|
|
16
|
+
export interface ListData {
|
|
17
|
+
_id: ListId;
|
|
18
|
+
userId: UserId;
|
|
19
|
+
createdAt: Date;
|
|
20
|
+
updatedAt: Date;
|
|
21
|
+
name: string;
|
|
22
|
+
type: ListType;
|
|
23
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { TaskId, TaskListId, UserId } from "../id-types";
|
|
2
|
+
export declare enum TaskListType {
|
|
3
|
+
TASKS = "tasks",
|
|
4
|
+
NOTES = "notes"
|
|
5
|
+
}
|
|
2
6
|
export interface TaskData {
|
|
3
7
|
_id: TaskId;
|
|
4
8
|
userId: UserId;
|
|
@@ -15,4 +19,5 @@ export interface TaskListData {
|
|
|
15
19
|
createdAt: Date;
|
|
16
20
|
updatedAt: Date;
|
|
17
21
|
name: string;
|
|
22
|
+
type: TaskListType;
|
|
18
23
|
}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TaskListType = void 0;
|
|
4
|
+
var TaskListType;
|
|
5
|
+
(function (TaskListType) {
|
|
6
|
+
TaskListType["TASKS"] = "tasks";
|
|
7
|
+
TaskListType["NOTES"] = "notes";
|
|
8
|
+
})(TaskListType || (exports.TaskListType = TaskListType = {}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Habit, HabitData, HabitEntry, HabitEntryData, ItemData, Person, PersonData, PersonNoteData, NotificationTemplateData,
|
|
1
|
+
import { Habit, HabitData, HabitEntry, HabitEntryData, ItemData, Person, PersonData, PersonNoteData, NotificationTemplateData, ListItemData, ListData, 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;
|
|
@@ -21,10 +21,10 @@ export declare class Serializer {
|
|
|
21
21
|
static deserializePersonData(data: Serialized<PersonData>): PersonData;
|
|
22
22
|
static serializePersonNoteData(data: PersonNoteData): Serialized<PersonNoteData>;
|
|
23
23
|
static deserializePersonNoteData(data: Serialized<PersonNoteData>): PersonNoteData;
|
|
24
|
-
static serializeTaskData(data:
|
|
25
|
-
static deserializeTaskData(data: Serialized<
|
|
26
|
-
static serializeTaskListData(data:
|
|
27
|
-
static deserializeTaskListData(data: Serialized<
|
|
24
|
+
static serializeTaskData(data: ListItemData): Serialized<ListItemData>;
|
|
25
|
+
static deserializeTaskData(data: Serialized<ListItemData>): ListItemData;
|
|
26
|
+
static serializeTaskListData(data: ListData): Serialized<ListData>;
|
|
27
|
+
static deserializeTaskListData(data: Serialized<ListData>): ListData;
|
|
28
28
|
static serializeThoughtData(data: ThoughtData): Serialized<ThoughtData>;
|
|
29
29
|
static deserializeThoughtData(data: Serialized<ThoughtData>): ThoughtData;
|
|
30
30
|
static serializeUserData(data: UserData): Serialized<UserData>;
|
package/package.json
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"name": "@timothyw/pat-common",
|
|
3
3
|
"description": "",
|
|
4
4
|
"author": "Timothy Washburn",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.107",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tsc",
|
|
10
10
|
"prepublishOnly": "npm run build",
|
|
11
|
-
"publish:patch": "npm version patch
|
|
12
|
-
"publish:minor": "npm version minor
|
|
11
|
+
"publish:patch": "npm version patch && npm publish",
|
|
12
|
+
"publish:minor": "npm version minor && npm publish"
|
|
13
13
|
},
|
|
14
14
|
"publishConfig": {
|
|
15
15
|
"access": "public"
|
package/src/types/api/index.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Serialized } from "../../../utils";
|
|
3
|
+
import { ListItemData } from "../../models";
|
|
4
|
+
|
|
5
|
+
export const completeListItemRequestSchema = z.object({
|
|
6
|
+
completed: z.boolean()
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type CompleteListItemRequest = z.infer<typeof completeListItemRequestSchema>;
|
|
10
|
+
|
|
11
|
+
export interface CompleteListItemResponse {
|
|
12
|
+
listItem: Serialized<ListItemData>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { listIdSchema } from '../../id-types';
|
|
3
|
+
import { Serialized } from "../../../utils";
|
|
4
|
+
import { ListItemData } from "../../models";
|
|
5
|
+
|
|
6
|
+
export const createListItemRequestSchema = z.object({
|
|
7
|
+
name: z.string().min(1),
|
|
8
|
+
notes: z.string().optional(),
|
|
9
|
+
listId: listIdSchema
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type CreateListItemRequest = z.infer<typeof createListItemRequestSchema>;
|
|
13
|
+
|
|
14
|
+
export interface CreateListItemResponse {
|
|
15
|
+
listItem: Serialized<ListItemData>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Serialized } from "../../../utils";
|
|
3
|
+
import { ListData, ListType } from "../../models";
|
|
4
|
+
|
|
5
|
+
export const createListRequestSchema = z.object({
|
|
6
|
+
name: z.string().min(1),
|
|
7
|
+
type: z.nativeEnum(ListType)
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type CreateListRequest = z.infer<typeof createListRequestSchema>;
|
|
11
|
+
|
|
12
|
+
export interface CreateListResponse {
|
|
13
|
+
list: Serialized<ListData>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './complete-list-item-types';
|
|
2
|
+
export * from './create-list-item-types';
|
|
3
|
+
export * from './get-list-item-types';
|
|
4
|
+
export * from './update-list-item-types';
|
|
5
|
+
export * from './create-list-types';
|
|
6
|
+
export * from './update-list-types';
|
|
7
|
+
export * from './get-lists-types';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { listIdSchema } from '../../id-types';
|
|
3
|
+
import { Serialized } from "../../../utils";
|
|
4
|
+
import { ListItemData } from "../../models";
|
|
5
|
+
|
|
6
|
+
export const updateListItemRequestSchema = z.object({
|
|
7
|
+
name: z.string().min(1).optional(),
|
|
8
|
+
notes: z.string().nullish(),
|
|
9
|
+
completed: z.boolean().optional(),
|
|
10
|
+
listId: listIdSchema.optional()
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type UpdateListItemRequest = z.infer<typeof updateListItemRequestSchema>;
|
|
14
|
+
|
|
15
|
+
export interface UpdateListItemResponse {
|
|
16
|
+
listItem: Serialized<ListItemData>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Serialized } from "../../../utils";
|
|
3
|
+
import { ListData, ListType } from "../../models";
|
|
4
|
+
|
|
5
|
+
export const updateListRequestSchema = z.object({
|
|
6
|
+
name: z.string().min(1).optional(),
|
|
7
|
+
type: z.nativeEnum(ListType).optional()
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type UpdateListRequest = z.infer<typeof updateListRequestSchema>;
|
|
11
|
+
|
|
12
|
+
export interface UpdateListResponse {
|
|
13
|
+
list: Serialized<ListData>;
|
|
14
|
+
}
|
package/src/types/id-types.ts
CHANGED
|
@@ -18,16 +18,16 @@ export type PersonNoteId = string & { readonly __brand: "PersonNoteId" };
|
|
|
18
18
|
export const thoughtIdSchema = z.string().transform((val): ThoughtId => val as ThoughtId);
|
|
19
19
|
export type ThoughtId = string & { readonly __brand: "ThoughtId" };
|
|
20
20
|
|
|
21
|
-
export const
|
|
22
|
-
export type
|
|
21
|
+
export const listIdSchema = z.string().transform((val): ListId => val as ListId);
|
|
22
|
+
export type ListId = string & { readonly __brand: "ListId" };
|
|
23
23
|
|
|
24
|
-
export const
|
|
25
|
-
export type
|
|
24
|
+
export const listItemIdSchema = z.string().transform((val): ListItemId => val as ListItemId);
|
|
25
|
+
export type ListItemId = string & { readonly __brand: "ListItemId" };
|
|
26
26
|
|
|
27
|
-
export const habitIdSchema = z.string().transform((val):
|
|
27
|
+
export const habitIdSchema = z.string().transform((val): ListId => val as ListId);
|
|
28
28
|
export type HabitId = string & { readonly __brand: "HabitId" };
|
|
29
29
|
|
|
30
|
-
export const habitEntryIdSchema = z.string().transform((val):
|
|
30
|
+
export const habitEntryIdSchema = z.string().transform((val): ListId => val as ListId);
|
|
31
31
|
export type HabitEntryId = string & { readonly __brand: "HabitEntryId" };
|
|
32
32
|
|
|
33
33
|
export const notificationTemplateIdSchema = z.string().transform((val): NotificationTemplateId => val as NotificationTemplateId);
|
|
@@ -5,6 +5,6 @@ export * from './notification-template-data';
|
|
|
5
5
|
export * from './notifiable';
|
|
6
6
|
export * from './person-data';
|
|
7
7
|
export * from './program-config';
|
|
8
|
-
export * from './
|
|
8
|
+
export * from './list-data';
|
|
9
9
|
export * from './thought-data';
|
|
10
10
|
export * from './user-data';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ListItemId, ListId, UserId } from "../id-types";
|
|
2
|
+
|
|
3
|
+
export enum ListType {
|
|
4
|
+
TASKS = 'tasks',
|
|
5
|
+
NOTES = 'notes'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ListItemData {
|
|
9
|
+
_id: ListItemId;
|
|
10
|
+
userId: UserId;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
updatedAt: Date;
|
|
13
|
+
name: string;
|
|
14
|
+
notes?: string;
|
|
15
|
+
completed: boolean;
|
|
16
|
+
taskListId: ListId;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ListData {
|
|
20
|
+
_id: ListId;
|
|
21
|
+
userId: UserId;
|
|
22
|
+
createdAt: Date;
|
|
23
|
+
updatedAt: Date;
|
|
24
|
+
name: string;
|
|
25
|
+
type: ListType;
|
|
26
|
+
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
PersonData,
|
|
7
7
|
PersonNoteData,
|
|
8
8
|
NotificationTemplateData,
|
|
9
|
-
|
|
9
|
+
ListItemData, ListData,
|
|
10
10
|
ThoughtData,
|
|
11
11
|
UserData
|
|
12
12
|
} from "../types";
|
|
@@ -96,20 +96,20 @@ export class Serializer {
|
|
|
96
96
|
return this.deserialize(data) as unknown as PersonNoteData;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
static serializeTaskData(data:
|
|
99
|
+
static serializeTaskData(data: ListItemData): Serialized<ListItemData> {
|
|
100
100
|
return this.serialize(data);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
static deserializeTaskData(data: Serialized<
|
|
104
|
-
return this.deserialize(data) as unknown as
|
|
103
|
+
static deserializeTaskData(data: Serialized<ListItemData>): ListItemData {
|
|
104
|
+
return this.deserialize(data) as unknown as ListItemData;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
static serializeTaskListData(data:
|
|
107
|
+
static serializeTaskListData(data: ListData): Serialized<ListData> {
|
|
108
108
|
return this.serialize(data);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
static deserializeTaskListData(data: Serialized<
|
|
112
|
-
return this.deserialize(data) as unknown as
|
|
111
|
+
static deserializeTaskListData(data: Serialized<ListData>): ListData {
|
|
112
|
+
return this.deserialize(data) as unknown as ListData;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
static serializeThoughtData(data: ThoughtData): Serialized<ThoughtData> {
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Serialized } from "../../../utils";
|
|
3
|
-
import { TaskData } from "../../models";
|
|
4
|
-
|
|
5
|
-
export const completeTaskRequestSchema = z.object({
|
|
6
|
-
completed: z.boolean()
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export type CompleteTaskRequest = z.infer<typeof completeTaskRequestSchema>;
|
|
10
|
-
|
|
11
|
-
export interface CompleteTaskResponse {
|
|
12
|
-
task: Serialized<TaskData>;
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Serialized } from "../../../utils";
|
|
3
|
-
import { TaskListData } from "../../models";
|
|
4
|
-
|
|
5
|
-
export const createTaskListRequestSchema = z.object({
|
|
6
|
-
name: z.string().min(1)
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export type CreateTaskListRequest = z.infer<typeof createTaskListRequestSchema>;
|
|
10
|
-
|
|
11
|
-
export interface CreateTaskListResponse {
|
|
12
|
-
taskList: Serialized<TaskListData>;
|
|
13
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { taskListIdSchema } from '../../id-types';
|
|
3
|
-
import { Serialized } from "../../../utils";
|
|
4
|
-
import { TaskData } from "../../models";
|
|
5
|
-
|
|
6
|
-
export const createTaskRequestSchema = z.object({
|
|
7
|
-
name: z.string().min(1),
|
|
8
|
-
notes: z.string().optional(),
|
|
9
|
-
taskListId: taskListIdSchema
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export type CreateTaskRequest = z.infer<typeof createTaskRequestSchema>;
|
|
13
|
-
|
|
14
|
-
export interface CreateTaskResponse {
|
|
15
|
-
task: Serialized<TaskData>;
|
|
16
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './complete-task-types';
|
|
2
|
-
export * from './create-task-types';
|
|
3
|
-
export * from './get-tasks-types';
|
|
4
|
-
export * from './update-task-types';
|
|
5
|
-
export * from './create-task-list-types';
|
|
6
|
-
export * from './update-task-list-types';
|
|
7
|
-
export * from './get-task-lists-types';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Serialized } from "../../../utils";
|
|
3
|
-
import { TaskListData } from "../../models";
|
|
4
|
-
|
|
5
|
-
export const updateTaskListRequestSchema = z.object({
|
|
6
|
-
name: z.string().min(1).optional()
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export type UpdateTaskListRequest = z.infer<typeof updateTaskListRequestSchema>;
|
|
10
|
-
|
|
11
|
-
export interface UpdateTaskListResponse {
|
|
12
|
-
taskList: Serialized<TaskListData>;
|
|
13
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { taskListIdSchema } from '../../id-types';
|
|
3
|
-
import { Serialized } from "../../../utils";
|
|
4
|
-
import { TaskData } from "../../models";
|
|
5
|
-
|
|
6
|
-
export const updateTaskRequestSchema = z.object({
|
|
7
|
-
name: z.string().min(1).optional(),
|
|
8
|
-
notes: z.string().nullish(),
|
|
9
|
-
completed: z.boolean().optional(),
|
|
10
|
-
taskListId: taskListIdSchema.optional()
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
export type UpdateTaskRequest = z.infer<typeof updateTaskRequestSchema>;
|
|
14
|
-
|
|
15
|
-
export interface UpdateTaskResponse {
|
|
16
|
-
task: Serialized<TaskData>;
|
|
17
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { TaskId, TaskListId, UserId } from "../id-types";
|
|
2
|
-
|
|
3
|
-
export interface TaskData {
|
|
4
|
-
_id: TaskId;
|
|
5
|
-
userId: UserId;
|
|
6
|
-
createdAt: Date;
|
|
7
|
-
updatedAt: Date;
|
|
8
|
-
name: string;
|
|
9
|
-
notes?: string;
|
|
10
|
-
completed: boolean;
|
|
11
|
-
taskListId: TaskListId;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface TaskListData {
|
|
15
|
-
_id: TaskListId;
|
|
16
|
-
userId: UserId;
|
|
17
|
-
createdAt: Date;
|
|
18
|
-
updatedAt: Date;
|
|
19
|
-
name: string;
|
|
20
|
-
}
|