@timothyw/pat-common 1.0.119 → 1.0.120
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/agenda-types.d.ts +115 -0
- package/dist/types/agenda-types.js +37 -0
- package/dist/types/auth-types.d.ts +153 -0
- package/dist/types/auth-types.js +48 -0
- package/dist/types/habits-types.d.ts +315 -0
- package/dist/types/habits-types.js +70 -0
- package/dist/types/index.d.ts +11 -3
- package/dist/types/index.js +11 -6
- package/dist/types/lists-types.d.ts +162 -0
- package/dist/types/lists-types.js +50 -0
- package/dist/types/misc/index.d.ts +3 -0
- package/dist/types/misc/index.js +19 -0
- package/dist/types/misc/misc-types.d.ts +8 -0
- package/dist/types/misc/misc-types.js +9 -0
- package/dist/types/misc/socket-message-types.d.ts +17 -0
- package/dist/types/misc/socket-message-types.js +12 -0
- package/dist/types/misc/version-types.d.ts +26 -0
- package/dist/types/misc/version-types.js +13 -0
- package/dist/types/notifications-types.d.ts +570 -0
- package/dist/types/notifications-types.js +149 -0
- package/dist/types/people-types.d.ts +283 -0
- package/dist/types/people-types.js +58 -0
- package/dist/types/program-config-types.d.ts +105 -0
- package/dist/types/program-config-types.js +29 -0
- package/dist/types/thoughts-types.d.ts +56 -0
- package/dist/types/thoughts-types.js +18 -0
- package/dist/types/user-types.d.ts +283 -0
- package/dist/types/user-types.js +46 -0
- package/package.json +1 -1
- package/src/types/{new/agenda-types.ts → agenda-types.ts} +2 -2
- package/src/types/{new/auth-types.ts → auth-types.ts} +1 -1
- package/src/types/{new/habits-types.ts → habits-types.ts} +3 -3
- package/src/types/index.ts +12 -7
- package/src/types/{new/lists-types.ts → lists-types.ts} +2 -2
- package/src/types/misc/index.ts +3 -0
- package/src/types/{new/notifications-types.ts → notifications-types.ts} +56 -12
- package/src/types/{new/people-types.ts → people-types.ts} +2 -2
- package/src/types/{new/thoughts-types.ts → thoughts-types.ts} +2 -2
- package/src/types/{new/user-types.ts → user-types.ts} +3 -3
- package/src/types/new/index.ts +0 -10
- package/src/types/new/misc/index.ts +0 -1
- package/src/types/old/api/account/get-user-types.ts +0 -6
- package/src/types/old/api/account/index.ts +0 -2
- package/src/types/old/api/account/update-user-types.ts +0 -14
- package/src/types/old/api/auth/create-account-types.ts +0 -17
- package/src/types/old/api/auth/index.ts +0 -5
- package/src/types/old/api/auth/refresh-auth-types.ts +0 -14
- package/src/types/old/api/auth/resend-verification-types.ts +0 -3
- package/src/types/old/api/auth/sign-in-types.ts +0 -16
- package/src/types/old/api/auth/verify-email-types.ts +0 -3
- package/src/types/old/api/habits/create-habit-entry-types.ts +0 -15
- package/src/types/old/api/habits/create-habit-types.ts +0 -17
- package/src/types/old/api/habits/delete-habit-entry-types.ts +0 -6
- package/src/types/old/api/habits/delete-habit-types.ts +0 -3
- package/src/types/old/api/habits/get-habits-types.ts +0 -6
- package/src/types/old/api/habits/index.ts +0 -6
- package/src/types/old/api/habits/update-habit-types.ts +0 -17
- package/src/types/old/api/index.ts +0 -9
- package/src/types/old/api/items/complete-item-types.ts +0 -13
- package/src/types/old/api/items/create-item-types.ts +0 -18
- package/src/types/old/api/items/delete-item-types.ts +0 -3
- package/src/types/old/api/items/get-items-types.ts +0 -6
- package/src/types/old/api/items/index.ts +0 -5
- package/src/types/old/api/items/update-item-types.ts +0 -18
- package/src/types/old/api/lists/complete-list-item-types.ts +0 -13
- package/src/types/old/api/lists/create-list-item-types.ts +0 -16
- package/src/types/old/api/lists/create-list-types.ts +0 -14
- package/src/types/old/api/lists/get-list-item-types.ts +0 -6
- package/src/types/old/api/lists/get-lists-types.ts +0 -6
- package/src/types/old/api/lists/index.ts +0 -7
- package/src/types/old/api/lists/update-list-item-types.ts +0 -17
- package/src/types/old/api/lists/update-list-types.ts +0 -14
- package/src/types/old/api/misc/index.ts +0 -1
- package/src/types/old/api/misc/version-types.ts +0 -10
- package/src/types/old/api/notifications/create-notification-template-types.ts +0 -30
- package/src/types/old/api/notifications/delete-notification-template-types.ts +0 -8
- package/src/types/old/api/notifications/get-notification-templates-types.ts +0 -12
- package/src/types/old/api/notifications/index.ts +0 -6
- package/src/types/old/api/notifications/preview-notification-template-types.ts +0 -21
- package/src/types/old/api/notifications/sync-notification-template-types.ts +0 -14
- package/src/types/old/api/notifications/update-notification-template-types.ts +0 -30
- package/src/types/old/api/people/create-person-note-types.ts +0 -15
- package/src/types/old/api/people/create-person-types.ts +0 -19
- package/src/types/old/api/people/delete-person-notes-types.ts +0 -3
- package/src/types/old/api/people/delete-person-types.ts +0 -3
- package/src/types/old/api/people/get-people-types.ts +0 -6
- package/src/types/old/api/people/get-person-notes-types.ts +0 -6
- package/src/types/old/api/people/index.ts +0 -8
- package/src/types/old/api/people/update-person-note-types.ts +0 -13
- package/src/types/old/api/people/update-person-types.ts +0 -19
- package/src/types/old/api/thoughts/create-thought-types.ts +0 -13
- package/src/types/old/api/thoughts/delete-thought-types.ts +0 -3
- package/src/types/old/api/thoughts/get-thoughts-types.ts +0 -6
- package/src/types/old/api/thoughts/index.ts +0 -4
- package/src/types/old/api/thoughts/update-thought-types.ts +0 -13
- package/src/types/old/auth-tokens.ts +0 -13
- package/src/types/old/models/auth-data.ts +0 -21
- package/src/types/old/models/habit-data.ts +0 -62
- package/src/types/old/models/index.ts +0 -10
- package/src/types/old/models/item-data.ts +0 -16
- package/src/types/old/models/list-data.ts +0 -26
- package/src/types/old/models/notifiable.ts +0 -52
- package/src/types/old/models/notification-template-data.ts +0 -67
- package/src/types/old/models/person-data.ts +0 -35
- package/src/types/old/models/program-config.ts +0 -25
- package/src/types/old/models/thought-data.ts +0 -9
- package/src/types/old/models/user-data.ts +0 -47
- /package/src/types/{misc-types.ts → misc/misc-types.ts} +0 -0
- /package/src/types/{socket-message-types.ts → misc/socket-message-types.ts} +0 -0
- /package/src/types/{new/misc → misc}/version-types.ts +0 -0
- /package/src/types/{new/program-config-types.ts → program-config-types.ts} +0 -0
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { DateOnlyString } from "../../misc-types";
|
|
2
|
-
import { HabitEntryId, HabitId, UserId } from "../../id-types";
|
|
3
|
-
|
|
4
|
-
export enum HabitFrequency {
|
|
5
|
-
DAILY = 'daily',
|
|
6
|
-
WEEKLY = 'weekly',
|
|
7
|
-
EVERY_N_DAYS = 'every_n_days',
|
|
8
|
-
WEEKDAYS_ONLY = 'weekdays_only',
|
|
9
|
-
CUSTOM = 'custom'
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export enum HabitEntryStatus {
|
|
13
|
-
COMPLETED = 'completed',
|
|
14
|
-
EXCUSED = 'excused',
|
|
15
|
-
MISSED = 'missed'
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface HabitEntryData {
|
|
19
|
-
_id: HabitEntryId;
|
|
20
|
-
habitId: HabitId;
|
|
21
|
-
userId: UserId;
|
|
22
|
-
date: DateOnlyString;
|
|
23
|
-
status: HabitEntryStatus;
|
|
24
|
-
createdAt: Date;
|
|
25
|
-
updatedAt: Date;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface HabitData {
|
|
29
|
-
_id: HabitId;
|
|
30
|
-
userId: UserId;
|
|
31
|
-
name: string;
|
|
32
|
-
description?: string | null;
|
|
33
|
-
notes?: string | null;
|
|
34
|
-
frequency: HabitFrequency;
|
|
35
|
-
rolloverTime: string;
|
|
36
|
-
firstDay: DateOnlyString;
|
|
37
|
-
createdAt: Date;
|
|
38
|
-
updatedAt: Date;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface HabitStats {
|
|
42
|
-
totalDays: number;
|
|
43
|
-
completedDays: number;
|
|
44
|
-
excusedDays: number;
|
|
45
|
-
missedDays: number;
|
|
46
|
-
completionRate: number;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export type HabitEntry = HabitEntryData;
|
|
50
|
-
|
|
51
|
-
export type Habit = HabitData & {
|
|
52
|
-
entries: HabitEntry[];
|
|
53
|
-
stats: HabitStats;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export const toHabit = (data: HabitData, entries: HabitEntryData[], stats: HabitStats): Habit => {
|
|
57
|
-
return {
|
|
58
|
-
...data,
|
|
59
|
-
entries,
|
|
60
|
-
stats
|
|
61
|
-
};
|
|
62
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './auth-data';
|
|
2
|
-
export * from './habit-data';
|
|
3
|
-
export * from './item-data';
|
|
4
|
-
export * from './notification-template-data';
|
|
5
|
-
export * from './notifiable';
|
|
6
|
-
export * from './person-data';
|
|
7
|
-
export * from './program-config';
|
|
8
|
-
export * from './list-data';
|
|
9
|
-
export * from './thought-data';
|
|
10
|
-
export * from './user-data';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ItemId, UserId } from "../../id-types";
|
|
2
|
-
|
|
3
|
-
export interface ItemData {
|
|
4
|
-
_id: ItemId;
|
|
5
|
-
userId: UserId;
|
|
6
|
-
createdAt: Date;
|
|
7
|
-
updatedAt: Date;
|
|
8
|
-
|
|
9
|
-
name: string;
|
|
10
|
-
dueDate?: Date;
|
|
11
|
-
notes?: string;
|
|
12
|
-
completed: boolean;
|
|
13
|
-
urgent: boolean;
|
|
14
|
-
category?: string;
|
|
15
|
-
type?: string;
|
|
16
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
listId: 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
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { NotificationTemplateData, NotificationEntityType } from "./notification-template-data";
|
|
2
|
-
|
|
3
|
-
export interface NotificationContext<T = any> {
|
|
4
|
-
entityId: string;
|
|
5
|
-
entityType: NotificationEntityType;
|
|
6
|
-
entityData: T;
|
|
7
|
-
userId: string;
|
|
8
|
-
// Additional context for template variable replacement
|
|
9
|
-
variables: Record<string, any>;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface INotifiable<T = any> {
|
|
13
|
-
/**
|
|
14
|
-
* Get the ID of this notifiable entity
|
|
15
|
-
*/
|
|
16
|
-
getId(): string;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Get the entity type for notification purposes
|
|
20
|
-
*/
|
|
21
|
-
getNotificationEntityType(): NotificationEntityType;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Get context data for notification template variables
|
|
25
|
-
*/
|
|
26
|
-
getNotificationContext(): NotificationContext<T>;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Get inherited notification templates from parent entities
|
|
30
|
-
*/
|
|
31
|
-
getInheritedNotificationTemplates(): Promise<NotificationTemplateData[]>;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Get custom notification templates specific to this entity
|
|
35
|
-
*/
|
|
36
|
-
getCustomNotificationTemplates(): Promise<NotificationTemplateData[]>;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Get all effective notification templates (inherited + custom)
|
|
40
|
-
*/
|
|
41
|
-
getAllNotificationTemplates(): Promise<NotificationTemplateData[]>;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Register notification triggers when entity is created/updated
|
|
45
|
-
*/
|
|
46
|
-
registerNotificationTriggers(): Promise<void>;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Remove notification triggers when entity is deleted
|
|
50
|
-
*/
|
|
51
|
-
removeNotificationTriggers(): Promise<void>;
|
|
52
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { NotificationTemplateId, UserId } from "../../id-types";
|
|
3
|
-
|
|
4
|
-
export const notificationEntityTypeSchema = z.enum([
|
|
5
|
-
// Individual entity types (notifications FOR the entity itself)
|
|
6
|
-
'agenda', 'tasks', 'habits', 'inbox',
|
|
7
|
-
'agenda_item', 'habit',
|
|
8
|
-
|
|
9
|
-
// Parent template types (default templates for children)
|
|
10
|
-
'agenda_defaults', 'habits_defaults'
|
|
11
|
-
]);
|
|
12
|
-
export type NotificationEntityType = z.infer<typeof notificationEntityTypeSchema>;
|
|
13
|
-
|
|
14
|
-
export const notificationTriggerTypeSchema = z.enum(['time_based', 'event_based', 'recurring']);
|
|
15
|
-
export type NotificationTriggerType = z.infer<typeof notificationTriggerTypeSchema>;
|
|
16
|
-
|
|
17
|
-
export const notificationTriggerSchema = z.object({
|
|
18
|
-
type: notificationTriggerTypeSchema,
|
|
19
|
-
conditions: z.record(z.any()), // flexible conditions object
|
|
20
|
-
timing: z.record(z.any()) // timing configuration like "5 minutes before due"
|
|
21
|
-
});
|
|
22
|
-
export type NotificationTrigger = z.infer<typeof notificationTriggerSchema>;
|
|
23
|
-
|
|
24
|
-
export const notificationContentSchema = z.object({
|
|
25
|
-
title: z.string(),
|
|
26
|
-
body: z.string(),
|
|
27
|
-
// Support for template variables like {{entity.name}}
|
|
28
|
-
variables: z.record(z.string()).optional()
|
|
29
|
-
});
|
|
30
|
-
export type NotificationContent = z.infer<typeof notificationContentSchema>;
|
|
31
|
-
|
|
32
|
-
export const notificationTemplateDataSchema = z.object({
|
|
33
|
-
_id: z.string().transform((val): NotificationTemplateId => val as NotificationTemplateId),
|
|
34
|
-
userId: z.string().transform((val): UserId => val as UserId),
|
|
35
|
-
entityType: notificationEntityTypeSchema,
|
|
36
|
-
entityId: z.string().optional(), // null/undefined for panel-level templates
|
|
37
|
-
name: z.string(),
|
|
38
|
-
description: z.string().optional(),
|
|
39
|
-
trigger: notificationTriggerSchema,
|
|
40
|
-
content: notificationContentSchema,
|
|
41
|
-
active: z.boolean().default(true),
|
|
42
|
-
inheritedFrom: z.string().transform((val): NotificationTemplateId => val as NotificationTemplateId).optional(),
|
|
43
|
-
customized: z.boolean().default(false), // true if user modified inherited template
|
|
44
|
-
createdAt: z.date(),
|
|
45
|
-
updatedAt: z.date()
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
export type NotificationTemplateData = z.infer<typeof notificationTemplateDataSchema>;
|
|
49
|
-
|
|
50
|
-
// Helper type for creating new templates (without _id, dates)
|
|
51
|
-
export const createNotificationTemplateSchema = notificationTemplateDataSchema.omit({
|
|
52
|
-
_id: true,
|
|
53
|
-
createdAt: true,
|
|
54
|
-
updatedAt: true
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
export type CreateNotificationTemplateData = z.infer<typeof createNotificationTemplateSchema>;
|
|
58
|
-
|
|
59
|
-
// Entity sync state for inheritance
|
|
60
|
-
export const entitySyncStateSchema = z.object({
|
|
61
|
-
userId: z.string().transform((val): UserId => val as UserId),
|
|
62
|
-
entityType: notificationEntityTypeSchema,
|
|
63
|
-
entityId: z.string(),
|
|
64
|
-
synced: z.boolean().default(true), // true = inheriting from parent, false = has custom templates
|
|
65
|
-
updatedAt: z.date()
|
|
66
|
-
});
|
|
67
|
-
export type EntitySyncState = z.infer<typeof entitySyncStateSchema>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { PersonId, PersonNoteId, UserId } from "../../id-types";
|
|
2
|
-
|
|
3
|
-
export interface PersonProperty {
|
|
4
|
-
key: string;
|
|
5
|
-
value: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface PersonNoteData {
|
|
9
|
-
_id: PersonNoteId;
|
|
10
|
-
personId: PersonId;
|
|
11
|
-
userId: UserId;
|
|
12
|
-
content: string;
|
|
13
|
-
createdAt: Date;
|
|
14
|
-
updatedAt: Date;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface PersonData {
|
|
18
|
-
_id: PersonId;
|
|
19
|
-
userId: UserId;
|
|
20
|
-
createdAt: Date;
|
|
21
|
-
updatedAt: Date;
|
|
22
|
-
name: string;
|
|
23
|
-
properties: PersonProperty[];
|
|
24
|
-
noteIds: PersonNoteId[];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface Person {
|
|
28
|
-
_id: PersonId;
|
|
29
|
-
userId: UserId;
|
|
30
|
-
createdAt: Date;
|
|
31
|
-
updatedAt: Date;
|
|
32
|
-
name: string;
|
|
33
|
-
properties: PersonProperty[];
|
|
34
|
-
notes: PersonNoteData[];
|
|
35
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface ProgramConfigData {
|
|
2
|
-
_requiredBuildVersions: {
|
|
3
|
-
iOS: number;
|
|
4
|
-
android: number;
|
|
5
|
-
}
|
|
6
|
-
dev: {
|
|
7
|
-
authorizedEmails: string[]
|
|
8
|
-
};
|
|
9
|
-
discord: {
|
|
10
|
-
token: string;
|
|
11
|
-
clientId: string;
|
|
12
|
-
guildId: string;
|
|
13
|
-
logChannelId?: string;
|
|
14
|
-
};
|
|
15
|
-
mailjet: {
|
|
16
|
-
apiKey: string;
|
|
17
|
-
secretKey: string;
|
|
18
|
-
};
|
|
19
|
-
expo: {
|
|
20
|
-
token: string;
|
|
21
|
-
},
|
|
22
|
-
redisUrl: string;
|
|
23
|
-
updatedAt: Date;
|
|
24
|
-
createdAt: Date;
|
|
25
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { userIdSchema } from "../../id-types";
|
|
3
|
-
import { ModuleType } from "../../../enums";
|
|
4
|
-
|
|
5
|
-
const moduleSchema = z.object({
|
|
6
|
-
type: z.nativeEnum(ModuleType),
|
|
7
|
-
visible: z.boolean()
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
const deviceSchema = z.object({
|
|
11
|
-
pushToken: z.string()
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export const userDataSchema = z.object({
|
|
15
|
-
_id: userIdSchema,
|
|
16
|
-
createdAt: z.date(),
|
|
17
|
-
updatedAt: z.date(),
|
|
18
|
-
|
|
19
|
-
sandbox: z.object({
|
|
20
|
-
discordId: z.string().optional(),
|
|
21
|
-
devices: z.array(deviceSchema)
|
|
22
|
-
}),
|
|
23
|
-
|
|
24
|
-
name: z.string().min(1),
|
|
25
|
-
timezone: z.string().refine((tz: string) => {
|
|
26
|
-
try {
|
|
27
|
-
Intl.DateTimeFormat(undefined, { timeZone: tz });
|
|
28
|
-
return true;
|
|
29
|
-
} catch (e) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
}, { message: "Invalid timezone" }),
|
|
33
|
-
|
|
34
|
-
config: z.object({
|
|
35
|
-
modules: z.array(moduleSchema),
|
|
36
|
-
agenda: z.object({
|
|
37
|
-
itemCategories: z.array(z.string()),
|
|
38
|
-
itemTypes: z.array(z.string())
|
|
39
|
-
}),
|
|
40
|
-
people: z.object({
|
|
41
|
-
propertyKeys: z.array(z.string())
|
|
42
|
-
}),
|
|
43
|
-
})
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
export type Module = z.infer<typeof moduleSchema>;
|
|
47
|
-
export type UserData = z.infer<typeof userDataSchema>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|