@timothyw/pat-common 1.0.17 → 1.0.19

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.
@@ -3,5 +3,6 @@ export declare enum PanelType {
3
3
  TASKS = "tasks",
4
4
  INBOX = "inbox",
5
5
  PEOPLE = "people",
6
- SETTINGS = "settings"
6
+ SETTINGS = "settings",
7
+ DEV = "dev"
7
8
  }
@@ -8,4 +8,5 @@ var PanelType;
8
8
  PanelType["INBOX"] = "inbox";
9
9
  PanelType["PEOPLE"] = "people";
10
10
  PanelType["SETTINGS"] = "settings";
11
+ PanelType["DEV"] = "dev";
11
12
  })(PanelType || (exports.PanelType = PanelType = {}));
@@ -1,4 +1,4 @@
1
- import { UserConfig } from "../../models";
1
+ import { UserData } from "../../models";
2
2
  export interface GetUserConfigResponse {
3
- user: UserConfig;
3
+ user: UserData;
4
4
  }
@@ -1,20 +1,16 @@
1
1
  import { z } from "zod";
2
- import { UserConfig } from "../../models";
2
+ import { UserData } from "../../models";
3
3
  export declare const updateUserConfigRequestSchema: z.ZodObject<{
4
- name: z.ZodOptional<z.ZodString>;
5
- timezone: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
6
- discordID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
7
- itemListTracking: z.ZodOptional<z.ZodOptional<z.ZodObject<{
8
- channelId: z.ZodOptional<z.ZodString>;
9
- messageId: z.ZodOptional<z.ZodString>;
4
+ sandbox: z.ZodOptional<z.ZodOptional<z.ZodObject<{
5
+ discordId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
10
6
  }, "strip", z.ZodTypeAny, {
11
- channelId?: string | undefined;
12
- messageId?: string | undefined;
7
+ discordId?: string | undefined;
13
8
  }, {
14
- channelId?: string | undefined;
15
- messageId?: string | undefined;
9
+ discordId?: string | undefined;
16
10
  }>>>;
17
- iosApp: z.ZodOptional<z.ZodObject<{
11
+ name: z.ZodOptional<z.ZodString>;
12
+ timezone: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
13
+ config: z.ZodOptional<z.ZodObject<{
18
14
  panels: z.ZodOptional<z.ZodArray<z.ZodObject<{
19
15
  type: z.ZodOptional<z.ZodNativeEnum<typeof import("../../..").PanelType>>;
20
16
  visible: z.ZodOptional<z.ZodBoolean>;
@@ -25,62 +21,88 @@ export declare const updateUserConfigRequestSchema: z.ZodObject<{
25
21
  type?: import("../../..").PanelType | undefined;
26
22
  visible?: boolean | undefined;
27
23
  }>, "many">>;
28
- itemCategories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
29
- itemTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
30
- propertyKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
24
+ agenda: z.ZodOptional<z.ZodObject<{
25
+ itemCategories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
26
+ itemTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ itemCategories?: string[] | undefined;
29
+ itemTypes?: string[] | undefined;
30
+ }, {
31
+ itemCategories?: string[] | undefined;
32
+ itemTypes?: string[] | undefined;
33
+ }>>;
34
+ people: z.ZodOptional<z.ZodObject<{
35
+ propertyKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ propertyKeys?: string[] | undefined;
38
+ }, {
39
+ propertyKeys?: string[] | undefined;
40
+ }>>;
31
41
  }, "strip", z.ZodTypeAny, {
42
+ agenda?: {
43
+ itemCategories?: string[] | undefined;
44
+ itemTypes?: string[] | undefined;
45
+ } | undefined;
46
+ people?: {
47
+ propertyKeys?: string[] | undefined;
48
+ } | undefined;
32
49
  panels?: {
33
50
  type?: import("../../..").PanelType | undefined;
34
51
  visible?: boolean | undefined;
35
52
  }[] | undefined;
36
- itemCategories?: string[] | undefined;
37
- itemTypes?: string[] | undefined;
38
- propertyKeys?: string[] | undefined;
39
53
  }, {
54
+ agenda?: {
55
+ itemCategories?: string[] | undefined;
56
+ itemTypes?: string[] | undefined;
57
+ } | undefined;
58
+ people?: {
59
+ propertyKeys?: string[] | undefined;
60
+ } | undefined;
40
61
  panels?: {
41
62
  type?: import("../../..").PanelType | undefined;
42
63
  visible?: boolean | undefined;
43
64
  }[] | undefined;
44
- itemCategories?: string[] | undefined;
45
- itemTypes?: string[] | undefined;
46
- propertyKeys?: string[] | undefined;
47
65
  }>>;
48
66
  }, "strict", z.ZodTypeAny, {
67
+ sandbox?: {
68
+ discordId?: string | undefined;
69
+ } | undefined;
49
70
  name?: string | undefined;
50
71
  timezone?: string | undefined;
51
- discordID?: string | undefined;
52
- itemListTracking?: {
53
- channelId?: string | undefined;
54
- messageId?: string | undefined;
55
- } | undefined;
56
- iosApp?: {
72
+ config?: {
73
+ agenda?: {
74
+ itemCategories?: string[] | undefined;
75
+ itemTypes?: string[] | undefined;
76
+ } | undefined;
77
+ people?: {
78
+ propertyKeys?: string[] | undefined;
79
+ } | undefined;
57
80
  panels?: {
58
81
  type?: import("../../..").PanelType | undefined;
59
82
  visible?: boolean | undefined;
60
83
  }[] | undefined;
61
- itemCategories?: string[] | undefined;
62
- itemTypes?: string[] | undefined;
63
- propertyKeys?: string[] | undefined;
64
84
  } | undefined;
65
85
  }, {
86
+ sandbox?: {
87
+ discordId?: string | undefined;
88
+ } | undefined;
66
89
  name?: string | undefined;
67
90
  timezone?: string | undefined;
68
- discordID?: string | undefined;
69
- itemListTracking?: {
70
- channelId?: string | undefined;
71
- messageId?: string | undefined;
72
- } | undefined;
73
- iosApp?: {
91
+ config?: {
92
+ agenda?: {
93
+ itemCategories?: string[] | undefined;
94
+ itemTypes?: string[] | undefined;
95
+ } | undefined;
96
+ people?: {
97
+ propertyKeys?: string[] | undefined;
98
+ } | undefined;
74
99
  panels?: {
75
100
  type?: import("../../..").PanelType | undefined;
76
101
  visible?: boolean | undefined;
77
102
  }[] | undefined;
78
- itemCategories?: string[] | undefined;
79
- itemTypes?: string[] | undefined;
80
- propertyKeys?: string[] | undefined;
81
103
  } | undefined;
82
104
  }>;
83
105
  export type UpdateUserConfigRequest = z.infer<typeof updateUserConfigRequestSchema>;
84
106
  export interface UpdateUserConfigResponse {
85
- user: UserConfig;
107
+ user: UserData;
86
108
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateUserConfigRequestSchema = void 0;
4
4
  const models_1 = require("../../models");
5
- exports.updateUserConfigRequestSchema = models_1.userConfigSchema
5
+ exports.updateUserConfigRequestSchema = models_1.userDataSchema
6
6
  .omit({ _id: true, createdAt: true, updatedAt: true })
7
7
  .deepPartial()
8
8
  .strict();
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { AuthTokens } from "../../auth-tokens";
3
- import { PublicAuthData, UserConfig } from "../../models";
3
+ import { PublicAuthData, UserData } from "../../models";
4
4
  export declare const loginRequestSchema: z.ZodObject<{
5
5
  email: z.ZodString;
6
6
  password: z.ZodString;
@@ -15,5 +15,5 @@ export type LoginRequest = z.infer<typeof loginRequestSchema>;
15
15
  export interface LoginResponse {
16
16
  tokenData: AuthTokens;
17
17
  authData: PublicAuthData;
18
- user: UserConfig;
18
+ user: UserData;
19
19
  }
@@ -3,4 +3,4 @@ export * from './item-data';
3
3
  export * from './person-data';
4
4
  export * from './program-config';
5
5
  export * from './thought-data';
6
- export * from './user-config';
6
+ export * from './user-data';
@@ -19,4 +19,4 @@ __exportStar(require("./item-data"), exports);
19
19
  __exportStar(require("./person-data"), exports);
20
20
  __exportStar(require("./program-config"), exports);
21
21
  __exportStar(require("./thought-data"), exports);
22
- __exportStar(require("./user-config"), exports);
22
+ __exportStar(require("./user-data"), exports);
@@ -1,4 +1,4 @@
1
- export interface ProgramConfigData extends Document {
1
+ export interface ProgramConfigData {
2
2
  dev: {
3
3
  authorizedEmails: string[];
4
4
  };
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { PanelType } from "../../enums/panel-type";
2
+ import { PanelType } from "../../enums";
3
3
  declare const panelSchema: z.ZodObject<{
4
4
  type: z.ZodNativeEnum<typeof PanelType>;
5
5
  visible: z.ZodBoolean;
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.userConfigSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const id_types_1 = require("../id-types");
6
- const panel_type_1 = require("../../enums/panel-type");
6
+ const enums_1 = require("../../enums");
7
7
  const panelSchema = zod_1.z.object({
8
- type: zod_1.z.nativeEnum(panel_type_1.PanelType),
8
+ type: zod_1.z.nativeEnum(enums_1.PanelType),
9
9
  visible: zod_1.z.boolean()
10
10
  });
11
11
  exports.userConfigSchema = zod_1.z.object({
@@ -0,0 +1,128 @@
1
+ import { z } from "zod";
2
+ import { PanelType } from "../../enums";
3
+ declare const panelSchema: z.ZodObject<{
4
+ type: z.ZodNativeEnum<typeof PanelType>;
5
+ visible: z.ZodBoolean;
6
+ }, "strip", z.ZodTypeAny, {
7
+ type: PanelType;
8
+ visible: boolean;
9
+ }, {
10
+ type: PanelType;
11
+ visible: boolean;
12
+ }>;
13
+ export declare const userDataSchema: z.ZodObject<{
14
+ _id: z.ZodEffects<z.ZodString, import("../id-types").UserId, string>;
15
+ createdAt: z.ZodDate;
16
+ updatedAt: z.ZodDate;
17
+ sandbox: z.ZodOptional<z.ZodObject<{
18
+ discordId: z.ZodOptional<z.ZodString>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ discordId?: string | undefined;
21
+ }, {
22
+ discordId?: string | undefined;
23
+ }>>;
24
+ name: z.ZodString;
25
+ timezone: z.ZodEffects<z.ZodString, string, string>;
26
+ config: z.ZodObject<{
27
+ panels: z.ZodArray<z.ZodObject<{
28
+ type: z.ZodNativeEnum<typeof PanelType>;
29
+ visible: z.ZodBoolean;
30
+ }, "strip", z.ZodTypeAny, {
31
+ type: PanelType;
32
+ visible: boolean;
33
+ }, {
34
+ type: PanelType;
35
+ visible: boolean;
36
+ }>, "many">;
37
+ agenda: z.ZodObject<{
38
+ itemCategories: z.ZodArray<z.ZodString, "many">;
39
+ itemTypes: z.ZodArray<z.ZodString, "many">;
40
+ }, "strip", z.ZodTypeAny, {
41
+ itemCategories: string[];
42
+ itemTypes: string[];
43
+ }, {
44
+ itemCategories: string[];
45
+ itemTypes: string[];
46
+ }>;
47
+ people: z.ZodObject<{
48
+ propertyKeys: z.ZodArray<z.ZodString, "many">;
49
+ }, "strip", z.ZodTypeAny, {
50
+ propertyKeys: string[];
51
+ }, {
52
+ propertyKeys: string[];
53
+ }>;
54
+ }, "strip", z.ZodTypeAny, {
55
+ agenda: {
56
+ itemCategories: string[];
57
+ itemTypes: string[];
58
+ };
59
+ people: {
60
+ propertyKeys: string[];
61
+ };
62
+ panels: {
63
+ type: PanelType;
64
+ visible: boolean;
65
+ }[];
66
+ }, {
67
+ agenda: {
68
+ itemCategories: string[];
69
+ itemTypes: string[];
70
+ };
71
+ people: {
72
+ propertyKeys: string[];
73
+ };
74
+ panels: {
75
+ type: PanelType;
76
+ visible: boolean;
77
+ }[];
78
+ }>;
79
+ }, "strip", z.ZodTypeAny, {
80
+ _id: string & {
81
+ readonly __brand: "UserId";
82
+ };
83
+ createdAt: Date;
84
+ updatedAt: Date;
85
+ name: string;
86
+ timezone: string;
87
+ config: {
88
+ agenda: {
89
+ itemCategories: string[];
90
+ itemTypes: string[];
91
+ };
92
+ people: {
93
+ propertyKeys: string[];
94
+ };
95
+ panels: {
96
+ type: PanelType;
97
+ visible: boolean;
98
+ }[];
99
+ };
100
+ sandbox?: {
101
+ discordId?: string | undefined;
102
+ } | undefined;
103
+ }, {
104
+ _id: string;
105
+ createdAt: Date;
106
+ updatedAt: Date;
107
+ name: string;
108
+ timezone: string;
109
+ config: {
110
+ agenda: {
111
+ itemCategories: string[];
112
+ itemTypes: string[];
113
+ };
114
+ people: {
115
+ propertyKeys: string[];
116
+ };
117
+ panels: {
118
+ type: PanelType;
119
+ visible: boolean;
120
+ }[];
121
+ };
122
+ sandbox?: {
123
+ discordId?: string | undefined;
124
+ } | undefined;
125
+ }>;
126
+ export type Panel = z.infer<typeof panelSchema>;
127
+ export type UserData = z.infer<typeof userDataSchema>;
128
+ export {};
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.userDataSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const id_types_1 = require("../id-types");
6
+ const enums_1 = require("../../enums");
7
+ const panelSchema = zod_1.z.object({
8
+ type: zod_1.z.nativeEnum(enums_1.PanelType),
9
+ visible: zod_1.z.boolean()
10
+ });
11
+ exports.userDataSchema = zod_1.z.object({
12
+ _id: id_types_1.userIdSchema,
13
+ createdAt: zod_1.z.date(),
14
+ updatedAt: zod_1.z.date(),
15
+ sandbox: zod_1.z.object({
16
+ discordId: zod_1.z.string().optional()
17
+ }).optional(),
18
+ name: zod_1.z.string().min(1),
19
+ timezone: zod_1.z.string().refine((tz) => {
20
+ try {
21
+ Intl.DateTimeFormat(undefined, { timeZone: tz });
22
+ return true;
23
+ }
24
+ catch (e) {
25
+ return false;
26
+ }
27
+ }, { message: "Invalid timezone" }),
28
+ config: zod_1.z.object({
29
+ panels: zod_1.z.array(panelSchema),
30
+ agenda: zod_1.z.object({
31
+ itemCategories: zod_1.z.array(zod_1.z.string()),
32
+ itemTypes: zod_1.z.array(zod_1.z.string())
33
+ }),
34
+ people: zod_1.z.object({
35
+ propertyKeys: zod_1.z.array(zod_1.z.string())
36
+ }),
37
+ })
38
+ });
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.17",
5
+ "version": "1.0.19",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -3,5 +3,6 @@ export enum PanelType {
3
3
  TASKS = 'tasks',
4
4
  INBOX = 'inbox',
5
5
  PEOPLE = 'people',
6
- SETTINGS = 'settings'
6
+ SETTINGS = 'settings',
7
+ DEV = 'dev'
7
8
  }
@@ -1,5 +1,5 @@
1
- import { UserConfig } from "../../models";
1
+ import { UserData } from "../../models";
2
2
 
3
3
  export interface GetUserConfigResponse {
4
- user: UserConfig;
4
+ user: UserData;
5
5
  }
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
- import { UserConfig, userConfigSchema } from "../../models";
2
+ import { UserData, userDataSchema } from "../../models";
3
3
 
4
- export const updateUserConfigRequestSchema = userConfigSchema
4
+ export const updateUserConfigRequestSchema = userDataSchema
5
5
  .omit({ _id: true, createdAt: true, updatedAt: true })
6
6
  .deepPartial()
7
7
  .strict();
@@ -9,5 +9,5 @@ export const updateUserConfigRequestSchema = userConfigSchema
9
9
  export type UpdateUserConfigRequest = z.infer<typeof updateUserConfigRequestSchema>;
10
10
 
11
11
  export interface UpdateUserConfigResponse {
12
- user: UserConfig
12
+ user: UserData
13
13
  }
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { AuthTokens } from "../../auth-tokens";
3
- import { PublicAuthData, UserConfig } from "../../models";
3
+ import { PublicAuthData, UserData } from "../../models";
4
4
 
5
5
  export const loginRequestSchema = z.object({
6
6
  email: z.string().email(),
@@ -12,5 +12,5 @@ export type LoginRequest = z.infer<typeof loginRequestSchema>;
12
12
  export interface LoginResponse {
13
13
  tokenData: AuthTokens;
14
14
  authData: PublicAuthData;
15
- user: UserConfig;
15
+ user: UserData;
16
16
  }
@@ -3,4 +3,4 @@ export * from './item-data';
3
3
  export * from './person-data';
4
4
  export * from './program-config';
5
5
  export * from './thought-data';
6
- export * from './user-config';
6
+ export * from './user-data';
@@ -3,7 +3,6 @@ import { ItemId, UserId } from "../id-types";
3
3
  export interface ItemData {
4
4
  _id: ItemId;
5
5
  userId: UserId;
6
-
7
6
  createdAt: Date;
8
7
  updatedAt: Date;
9
8
 
@@ -1,4 +1,4 @@
1
- export interface ProgramConfigData extends Document {
1
+ export interface ProgramConfigData {
2
2
  dev: {
3
3
  authorizedEmails: string[]
4
4
  };
@@ -1,16 +1,21 @@
1
1
  import { z } from "zod";
2
2
  import { userIdSchema } from "../id-types";
3
- import { PanelType } from "../../enums/panel-type";
3
+ import { PanelType } from "../../enums";
4
4
 
5
5
  const panelSchema = z.object({
6
6
  type: z.nativeEnum(PanelType),
7
7
  visible: z.boolean()
8
8
  });
9
9
 
10
- export const userConfigSchema = z.object({
10
+ export const userDataSchema = z.object({
11
11
  _id: userIdSchema,
12
12
  createdAt: z.date(),
13
13
  updatedAt: z.date(),
14
+
15
+ sandbox: z.object({
16
+ discordId: z.string().optional()
17
+ }).optional(),
18
+
14
19
  name: z.string().min(1),
15
20
  timezone: z.string().refine((tz: string) => {
16
21
  try {
@@ -20,18 +25,18 @@ export const userConfigSchema = z.object({
20
25
  return false;
21
26
  }
22
27
  }, { message: "Invalid timezone" }),
23
- discordID: z.string().optional(),
24
- itemListTracking: z.object({
25
- channelId: z.string(),
26
- messageId: z.string()
27
- }).optional(),
28
- iosApp: z.object({
28
+
29
+ config: z.object({
29
30
  panels: z.array(panelSchema),
30
- itemCategories: z.array(z.string()),
31
- itemTypes: z.array(z.string()),
32
- propertyKeys: z.array(z.string())
31
+ agenda: z.object({
32
+ itemCategories: z.array(z.string()),
33
+ itemTypes: z.array(z.string())
34
+ }),
35
+ people: z.object({
36
+ propertyKeys: z.array(z.string())
37
+ }),
33
38
  })
34
39
  });
35
40
 
36
41
  export type Panel = z.infer<typeof panelSchema>;
37
- export type UserConfig = z.infer<typeof userConfigSchema>;
42
+ export type UserData = z.infer<typeof userDataSchema>;