@timothyw/pat-common 1.0.3 → 1.0.5
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/index.d.ts +1 -0
- package/dist/index.js +17 -0
- package/dist/types/api/account/get-user-config-types.d.ts +4 -0
- package/dist/types/api/account/get-user-config-types.js +2 -0
- package/dist/types/api/account/index.d.ts +2 -0
- package/dist/types/api/account/index.js +18 -0
- package/dist/types/api/account/update-user-config-types.d.ts +87 -0
- package/dist/types/api/account/update-user-config-types.js +35 -0
- package/dist/types/api/auth/index.d.ts +5 -0
- package/dist/types/api/auth/index.js +21 -0
- package/dist/types/api/auth/login-types.d.ts +19 -0
- package/dist/types/api/auth/login-types.js +8 -0
- package/dist/types/api/auth/refresh-auth-types.d.ts +15 -0
- package/dist/types/api/auth/refresh-auth-types.js +7 -0
- package/dist/types/api/auth/register-types.d.ts +23 -0
- package/dist/types/api/auth/register-types.js +10 -0
- package/dist/types/api/auth/resend-verification-types.d.ts +3 -0
- package/dist/types/api/auth/resend-verification-types.js +2 -0
- package/dist/types/api/auth/verify-email-types.d.ts +3 -0
- package/dist/types/api/auth/verify-email-types.js +2 -0
- package/dist/types/api/index.d.ts +5 -0
- package/dist/types/api/index.js +21 -0
- package/dist/types/api/items/complete-item-types.d.ts +18 -0
- package/dist/types/api/items/complete-item-types.js +7 -0
- package/dist/types/api/items/create-item-types.d.ts +36 -0
- package/dist/types/api/items/create-item-types.js +12 -0
- package/dist/types/api/items/delete-item-types.d.ts +3 -0
- package/dist/types/api/items/delete-item-types.js +2 -0
- package/dist/types/api/items/get-items-types.d.ts +4 -0
- package/dist/types/api/items/get-items-types.js +2 -0
- package/dist/types/api/items/index.d.ts +5 -0
- package/dist/types/api/items/index.js +21 -0
- package/dist/types/api/items/update-item-types.d.ts +36 -0
- package/dist/types/api/items/update-item-types.js +12 -0
- package/dist/types/api/people/create-person-types.d.ts +55 -0
- package/dist/types/api/people/create-person-types.js +14 -0
- package/dist/types/api/people/delete-person-types.d.ts +3 -0
- package/dist/types/api/people/delete-person-types.js +2 -0
- package/dist/types/api/people/get-people-types.d.ts +15 -0
- package/dist/types/api/people/get-people-types.js +2 -0
- package/dist/types/api/people/index.d.ts +4 -0
- package/dist/types/api/people/index.js +20 -0
- package/dist/types/api/people/update-person-types.d.ts +55 -0
- package/dist/types/api/people/update-person-types.js +14 -0
- package/dist/types/api/thoguhts/create-thought-types.d.ts +15 -0
- package/dist/types/api/thoguhts/create-thought-types.js +7 -0
- package/dist/types/api/thoguhts/delete-thought-types.d.ts +3 -0
- package/dist/types/api/thoguhts/delete-thought-types.js +2 -0
- package/dist/types/api/thoguhts/get-thoughts-types.d.ts +6 -0
- package/dist/types/api/thoguhts/get-thoughts-types.js +2 -0
- package/dist/types/api/thoguhts/index.d.ts +4 -0
- package/dist/types/api/thoguhts/index.js +20 -0
- package/dist/types/api/thoguhts/update-thought-types.d.ts +15 -0
- package/dist/types/api/thoguhts/update-thought-types.js +7 -0
- package/dist/types/auth-tokens.d.ts +11 -0
- package/dist/types/auth-tokens.js +2 -0
- package/dist/types/id-types.d.ts +15 -0
- package/dist/types/id-types.js +2 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +21 -0
- package/dist/types/models/auth-data.d.ts +14 -0
- package/dist/types/models/auth-data.js +9 -0
- package/dist/types/models/index.d.ts +6 -0
- package/dist/types/models/index.js +22 -0
- package/dist/types/models/item-data.d.ts +14 -0
- package/dist/types/models/item-data.js +2 -0
- package/dist/types/models/person-data.d.ts +19 -0
- package/dist/types/models/person-data.js +2 -0
- package/dist/types/models/program-config.d.ts +17 -0
- package/dist/types/models/program-config.js +2 -0
- package/dist/types/models/thought-data.d.ts +8 -0
- package/dist/types/models/thought-data.js +2 -0
- package/dist/types/models/user-config.d.ts +24 -0
- package/dist/types/models/user-config.js +2 -0
- package/dist/types/panels.d.ts +2 -0
- package/dist/types/panels.js +4 -0
- package/package.json +9 -3
- package/src/types/api/account/get-user-config-types.ts +5 -0
- package/src/types/api/account/index.ts +2 -0
- package/src/types/api/account/update-user-config-types.ts +40 -0
- package/src/types/api/auth/index.ts +5 -0
- package/src/types/api/auth/login-types.ts +16 -0
- package/src/types/api/auth/refresh-auth-types.ts +14 -0
- package/src/types/api/auth/register-types.ts +16 -0
- package/src/types/api/auth/resend-verification-types.ts +3 -0
- package/src/types/api/auth/verify-email-types.ts +3 -0
- package/src/types/api/index.ts +5 -0
- package/src/types/api/items/complete-item-types.ts +17 -0
- package/src/types/api/items/create-item-types.ts +25 -0
- package/src/types/api/items/delete-item-types.ts +3 -0
- package/src/types/api/items/get-items-types.ts +5 -0
- package/src/types/api/items/index.ts +5 -0
- package/src/types/api/items/update-item-types.ts +25 -0
- package/src/types/api/people/create-person-types.ts +30 -0
- package/src/types/api/people/delete-person-types.ts +3 -0
- package/src/types/api/people/get-people-types.ts +15 -0
- package/src/types/api/people/index.ts +4 -0
- package/src/types/api/people/update-person-types.ts +30 -0
- package/src/types/api/thoguhts/create-thought-types.ts +14 -0
- package/src/types/api/thoguhts/delete-thought-types.ts +3 -0
- package/src/types/api/thoguhts/get-thoughts-types.ts +6 -0
- package/src/types/api/thoguhts/index.ts +4 -0
- package/src/types/api/thoguhts/update-thought-types.ts +14 -0
- package/src/types/id-types.ts +6 -0
- package/src/types/index.ts +5 -1
- package/src/types/models/auth-data.ts +21 -0
- package/src/types/models/index.ts +6 -0
- package/src/types/models/item-data.ts +17 -0
- package/src/types/models/person-data.ts +22 -0
- package/src/types/models/program-config.ts +17 -0
- package/src/types/models/thought-data.ts +9 -0
- package/src/types/models/user-config.ts +27 -0
- package/src/types/panels.ts +3 -0
- package/tsconfig.json +2 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const updateItemRequestSchema = z.object({
|
|
4
|
+
name: z.string().min(1).optional(),
|
|
5
|
+
dueDate: z.string().nullish(),
|
|
6
|
+
notes: z.string().optional(),
|
|
7
|
+
urgent: z.boolean().optional(),
|
|
8
|
+
category: z.string().nullish(),
|
|
9
|
+
type: z.string().nullish()
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type UpdateItemRequest = z.infer<typeof updateItemRequestSchema>;
|
|
13
|
+
|
|
14
|
+
export interface UpdateItemResponse {
|
|
15
|
+
item: {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
dueDate?: string;
|
|
19
|
+
notes?: string;
|
|
20
|
+
completed: boolean;
|
|
21
|
+
urgent: boolean;
|
|
22
|
+
category?: string;
|
|
23
|
+
type?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const createPersonRequestSchema = z.object({
|
|
4
|
+
name: z.string().min(1),
|
|
5
|
+
properties: z.array(z.object({
|
|
6
|
+
key: z.string().min(1),
|
|
7
|
+
value: z.string().min(1)
|
|
8
|
+
})).optional(),
|
|
9
|
+
notes: z.array(z.object({
|
|
10
|
+
content: z.string().min(1)
|
|
11
|
+
})).optional()
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type CreatePersonRequest = z.infer<typeof createPersonRequestSchema>;
|
|
15
|
+
|
|
16
|
+
export interface CreatePersonResponse {
|
|
17
|
+
person: {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
properties: Array<{
|
|
21
|
+
key: string;
|
|
22
|
+
value: string;
|
|
23
|
+
}>;
|
|
24
|
+
notes: Array<{
|
|
25
|
+
content: string;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
updatedAt: string;
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const updatePersonRequestSchema = z.object({
|
|
4
|
+
name: z.string().min(1).optional(),
|
|
5
|
+
properties: z.array(z.object({
|
|
6
|
+
key: z.string().min(1),
|
|
7
|
+
value: z.string().min(1)
|
|
8
|
+
})).optional(),
|
|
9
|
+
notes: z.array(z.object({
|
|
10
|
+
content: z.string().min(1)
|
|
11
|
+
})).optional()
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type UpdatePersonRequest = z.infer<typeof updatePersonRequestSchema>;
|
|
15
|
+
|
|
16
|
+
export interface UpdatePersonResponse {
|
|
17
|
+
person: {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
properties: Array<{
|
|
21
|
+
key: string;
|
|
22
|
+
value: string;
|
|
23
|
+
}>;
|
|
24
|
+
notes: Array<{
|
|
25
|
+
content: string;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
updatedAt: string;
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const createThoughtRequestSchema = z.object({
|
|
4
|
+
content: z.string().min(1)
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
export type CreateThoughtRequest = z.infer<typeof createThoughtRequestSchema>;
|
|
8
|
+
|
|
9
|
+
export interface CreateThoughtResponse {
|
|
10
|
+
thought: {
|
|
11
|
+
id: string;
|
|
12
|
+
content: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const updateThoughtRequestSchema = z.object({
|
|
4
|
+
content: z.string().min(1)
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
export type UpdateThoughtRequest = z.infer<typeof updateThoughtRequestSchema>;
|
|
8
|
+
|
|
9
|
+
export interface UpdateThoughtResponse {
|
|
10
|
+
thought: {
|
|
11
|
+
id: string;
|
|
12
|
+
content: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type UserId = string & { readonly __brand: unique symbol };
|
|
2
|
+
export type AuthId = string & { readonly __brand: unique symbol };
|
|
3
|
+
|
|
4
|
+
export type ItemId = string & { readonly __brand: unique symbol };
|
|
5
|
+
export type PersonId = string & { readonly __brand: unique symbol };
|
|
6
|
+
export type ThoughtId = string & { readonly __brand: unique symbol };
|
package/src/types/index.ts
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AuthId, UserId } from "../id-types";
|
|
2
|
+
|
|
3
|
+
export interface AuthData {
|
|
4
|
+
_id: AuthId;
|
|
5
|
+
createdAt: Date;
|
|
6
|
+
updatedAt: Date;
|
|
7
|
+
|
|
8
|
+
userId: UserId;
|
|
9
|
+
email: string;
|
|
10
|
+
passwordHash: string;
|
|
11
|
+
emailVerified: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type PublicAuthData = Pick<AuthData, 'email' | 'emailVerified'> & { readonly __brand: unique symbol };
|
|
15
|
+
|
|
16
|
+
export function toPublicAuthData(data: AuthData): PublicAuthData {
|
|
17
|
+
return {
|
|
18
|
+
email: data.email,
|
|
19
|
+
emailVerified: data.emailVerified
|
|
20
|
+
} as PublicAuthData;
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ItemId, UserId } from "../id-types";
|
|
2
|
+
|
|
3
|
+
export interface ItemData {
|
|
4
|
+
_id: ItemId;
|
|
5
|
+
userId: UserId;
|
|
6
|
+
|
|
7
|
+
createdAt: Date;
|
|
8
|
+
updatedAt: Date;
|
|
9
|
+
|
|
10
|
+
name: string;
|
|
11
|
+
dueDate?: Date | null;
|
|
12
|
+
notes?: string;
|
|
13
|
+
completed: boolean;
|
|
14
|
+
urgent: boolean;
|
|
15
|
+
category?: string | null;
|
|
16
|
+
type?: string | null;
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PersonId, UserId } from "../id-types";
|
|
2
|
+
|
|
3
|
+
export interface PersonProperty {
|
|
4
|
+
key: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface PersonNote {
|
|
9
|
+
content: string;
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
updatedAt: Date;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface PersonData {
|
|
15
|
+
_id: PersonId;
|
|
16
|
+
userId: UserId;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt: Date;
|
|
19
|
+
name: string;
|
|
20
|
+
properties: PersonProperty[];
|
|
21
|
+
notes: PersonNote[];
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ProgramConfigData extends Document {
|
|
2
|
+
dev: {
|
|
3
|
+
authorizedEmails: string[]
|
|
4
|
+
};
|
|
5
|
+
discord: {
|
|
6
|
+
token: string;
|
|
7
|
+
clientId: string;
|
|
8
|
+
guildId: string;
|
|
9
|
+
logChannelId?: string;
|
|
10
|
+
};
|
|
11
|
+
mailjet: {
|
|
12
|
+
apiKey: string;
|
|
13
|
+
secretKey: string;
|
|
14
|
+
};
|
|
15
|
+
updatedAt: Date;
|
|
16
|
+
createdAt: Date;
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PanelType } from "../panels";
|
|
2
|
+
import { UserId } from "../id-types";
|
|
3
|
+
|
|
4
|
+
export interface Panel {
|
|
5
|
+
type: PanelType;
|
|
6
|
+
visible: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface UserConfig {
|
|
10
|
+
_id: UserId;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
updatedAt: Date;
|
|
13
|
+
|
|
14
|
+
name: string;
|
|
15
|
+
timezone: string;
|
|
16
|
+
discordID?: string;
|
|
17
|
+
itemListTracking?: {
|
|
18
|
+
channelId: string;
|
|
19
|
+
messageId: string;
|
|
20
|
+
};
|
|
21
|
+
iosApp: {
|
|
22
|
+
panels: Panel[];
|
|
23
|
+
itemCategories: string[];
|
|
24
|
+
itemTypes: string[];
|
|
25
|
+
propertyKeys?: string[];
|
|
26
|
+
};
|
|
27
|
+
}
|