@driveflux/api-functions 1.0.155 → 1.0.157

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 (48) hide show
  1. package/dist/auth/confirm.js +24 -24
  2. package/dist/auth/consent.js +22 -27
  3. package/dist/auth/emails.js +12 -13
  4. package/dist/auth/formatter.js +5 -5
  5. package/dist/auth/otp.js +66 -50
  6. package/dist/auth/register.js +48 -35
  7. package/dist/auth/tokens.js +58 -55
  8. package/dist/auth/verifications.js +53 -52
  9. package/dist/constants.js +0 -1
  10. package/dist/create-logger.js +1 -2
  11. package/dist/mailjet/calls/manage-contacts-in-list.js +5 -6
  12. package/dist/mailjet/calls/manage-subscription-status.js +4 -5
  13. package/dist/mailjet/calls/request-service.js +7 -6
  14. package/dist/mailjet/refresh-email-preferences.js +11 -12
  15. package/dist/mailjet/set-contact.js +11 -12
  16. package/dist/mailjet/types.js +1 -2
  17. package/dist/mailjet/utils/convert-to-array.js +8 -6
  18. package/dist/mailjet/utils/extract-email-preferences.js +14 -15
  19. package/dist/mailjet/utils/lists.js +7 -8
  20. package/dist/mailjet/utils/update-email-references.js +16 -15
  21. package/dist/notion/client.js +22 -19
  22. package/dist/notion/helpful.js +6 -9
  23. package/dist/notion/schemas/block.js +42 -48
  24. package/dist/notion/schemas/common.js +9 -14
  25. package/dist/notion/schemas/database.js +62 -60
  26. package/dist/notion/schemas/emoji.js +1 -2
  27. package/dist/notion/schemas/file.js +9 -9
  28. package/dist/notion/schemas/kb.js +5 -6
  29. package/dist/notion/schemas/page.js +72 -61
  30. package/dist/notion/schemas/parent.js +4 -5
  31. package/dist/notion/schemas/user.js +18 -19
  32. package/dist/reservation/agree.js +2 -3
  33. package/dist/reservation/checks.js +3 -4
  34. package/dist/reservation/display-vehicle.js +73 -83
  35. package/dist/reservation/ensure-user-billing-address.js +9 -11
  36. package/dist/reservation/fetch-or-create.js +49 -56
  37. package/dist/reservation/invoice.js +77 -88
  38. package/dist/reservation/payer.js +5 -6
  39. package/dist/reservation/payment-intent-sync.js +4 -6
  40. package/dist/reservation/reserve.js +3 -4
  41. package/dist/reservation/types.js +1 -2
  42. package/dist/reservation/vehicle.js +13 -16
  43. package/dist/slack.js +24 -29
  44. package/dist/validation.js +81 -85
  45. package/dist/vehicle/vehicle-pricing/constants.js +22 -19
  46. package/dist/vehicle/vehicle-pricing/index.js +28 -42
  47. package/dist/vehicle/vehicle-pricing/types.js +1 -2
  48. package/package.json +18 -18
@@ -6,18 +6,18 @@ export const userForEmailPreferencesQuery = {
6
6
  subscriptions: {
7
7
  select: {
8
8
  ended: true,
9
- active: true,
10
- },
11
- },
12
- },
9
+ active: true
10
+ }
11
+ }
12
+ }
13
13
  };
14
- export const extractUserEmailPreferences = async (idOrUserForEmailPreferences) => {
15
- const user = typeof idOrUserForEmailPreferences === 'string'
16
- ? await prisma.user.findUnique({
17
- where: { id: idOrUserForEmailPreferences },
18
- ...userForEmailPreferencesQuery,
19
- })
20
- : idOrUserForEmailPreferences;
14
+ export const extractUserEmailPreferences = async (idOrUserForEmailPreferences)=>{
15
+ const user = typeof idOrUserForEmailPreferences === 'string' ? await prisma.user.findUnique({
16
+ where: {
17
+ id: idOrUserForEmailPreferences
18
+ },
19
+ ...userForEmailPreferencesQuery
20
+ }) : idOrUserForEmailPreferences;
21
21
  if (!user?.emailPreferences?.generalMarketing) {
22
22
  return;
23
23
  }
@@ -26,13 +26,13 @@ export const extractUserEmailPreferences = async (idOrUserForEmailPreferences) =
26
26
  if (subscriptions.length > 0) {
27
27
  list = 'noActiveSubs';
28
28
  }
29
- for (let i = 0; i < subscriptions.length; i++) {
29
+ for(let i = 0; i < subscriptions.length; i++){
30
30
  if (subscriptions[i].ended) {
31
31
  list = 'expiredSub';
32
32
  break;
33
33
  }
34
34
  }
35
- for (let i = 0; i < subscriptions.length; i++) {
35
+ for(let i = 0; i < subscriptions.length; i++){
36
36
  if (subscriptions[i].active && !subscriptions[i].ended) {
37
37
  list = 'activeSub';
38
38
  break;
@@ -44,8 +44,7 @@ export const extractUserEmailPreferences = async (idOrUserForEmailPreferences) =
44
44
  signUpPaymentAdded: false,
45
45
  activeSub: false,
46
46
  expiredSub: false,
47
- [list]: true,
47
+ [list]: true
48
48
  };
49
49
  return newList;
50
50
  };
51
- //# sourceMappingURL=extract-email-preferences.js.map
@@ -7,13 +7,13 @@ export const listsNames = [
7
7
  'activeSub',
8
8
  'expiredSub',
9
9
  'activeSubBusiness',
10
- 'activeSubPersonal',
10
+ 'activeSubPersonal'
11
11
  ];
12
- export const getLists = async () => {
12
+ export const getLists = async ()=>{
13
13
  const listObject = await prisma.platformConfig.findFirst({
14
14
  where: {
15
- key: 'mailjetLists',
16
- },
15
+ key: 'mailjetLists'
16
+ }
17
17
  });
18
18
  if (listObject?.value) {
19
19
  const lists = JSON.parse(listObject.value);
@@ -21,14 +21,14 @@ export const getLists = async () => {
21
21
  }
22
22
  return {};
23
23
  };
24
- export const getListByRef = async (ref) => {
24
+ export const getListByRef = async (ref)=>{
25
25
  const lists = await getLists();
26
26
  let list;
27
- for (const [name, id] of Object.entries(lists)) {
27
+ for (const [name, id] of Object.entries(lists)){
28
28
  if (name === ref || id === ref) {
29
29
  list = {
30
30
  name: name,
31
- id,
31
+ id
32
32
  };
33
33
  break;
34
34
  }
@@ -38,4 +38,3 @@ export const getListByRef = async (ref) => {
38
38
  }
39
39
  return list;
40
40
  };
41
- //# sourceMappingURL=lists.js.map
@@ -1,31 +1,32 @@
1
1
  import { prisma } from '@driveflux/db';
2
- import { userForEmailPreferencesQuery, } from './extract-email-preferences.js';
3
- export const updateEmailPreferences = async (idOrUserForEmailPreferences, preferences) => {
4
- const user = typeof idOrUserForEmailPreferences === 'string'
5
- ? await prisma.user.findUnique({
6
- where: { id: idOrUserForEmailPreferences },
7
- ...userForEmailPreferencesQuery,
8
- })
9
- : idOrUserForEmailPreferences;
2
+ import { userForEmailPreferencesQuery } from './extract-email-preferences.js';
3
+ export const updateEmailPreferences = async (idOrUserForEmailPreferences, preferences)=>{
4
+ const user = typeof idOrUserForEmailPreferences === 'string' ? await prisma.user.findUnique({
5
+ where: {
6
+ id: idOrUserForEmailPreferences
7
+ },
8
+ ...userForEmailPreferencesQuery
9
+ }) : idOrUserForEmailPreferences;
10
10
  if (!user) {
11
11
  return null;
12
12
  }
13
13
  const merged = {
14
14
  ...user.emailPreferences,
15
- ...preferences,
15
+ ...preferences
16
16
  };
17
17
  const updated = await prisma.user.update({
18
- where: { id: user.id },
18
+ where: {
19
+ id: user.id
20
+ },
19
21
  data: {
20
22
  emailPreferences: {
21
23
  upsert: {
22
24
  set: merged,
23
- update: merged,
24
- },
25
- },
25
+ update: merged
26
+ }
27
+ }
26
28
  },
27
- ...userForEmailPreferencesQuery,
29
+ ...userForEmailPreferencesQuery
28
30
  });
29
31
  return updated;
30
32
  };
31
- //# sourceMappingURL=update-email-references.js.map
@@ -2,20 +2,23 @@ import { slackLater } from '@driveflux/api-functions/slack';
2
2
  import { config } from '@driveflux/config/backend';
3
3
  import { initSingleton } from '@driveflux/singleton';
4
4
  import { Client } from '@notionhq/client';
5
- export const getNotion = () => {
6
- return initSingleton('notionClient', () => new Client({
7
- auth: config.notion.secret,
8
- }));
5
+ export const getNotion = ()=>{
6
+ return initSingleton('notionClient', ()=>new Client({
7
+ auth: config.notion.secret
8
+ }));
9
9
  };
10
- export const announceFluxstersAnniversaries = async (property, constructMessage) => {
10
+ export const announceFluxstersAnniversaries = async (property, constructMessage)=>{
11
11
  if (!config.notion.fluxstersDatabaseId) {
12
- return { counts: -1, message: 'No fluxsters database id configured' };
12
+ return {
13
+ counts: -1,
14
+ message: 'No fluxsters database id configured'
15
+ };
13
16
  }
14
17
  const notion = getNotion();
15
18
  const { results } = await notion.dataSources.query({
16
- data_source_id: config.notion.fluxstersDatabaseId,
19
+ data_source_id: config.notion.fluxstersDatabaseId
17
20
  });
18
- const relevantPeople = results.filter((result) => {
21
+ const relevantPeople = results.filter((result)=>{
19
22
  const resultPropperty = result.properties[property];
20
23
  if (resultPropperty.type !== 'date' || !resultPropperty.date?.start) {
21
24
  return false;
@@ -25,15 +28,11 @@ export const announceFluxstersAnniversaries = async (property, constructMessage)
25
28
  }
26
29
  const date = new Date(resultPropperty.date.start);
27
30
  const todayDate = new Date();
28
- if (todayDate.getDate() === date.getDate() &&
29
- todayDate.getMonth() === date.getMonth()) {
31
+ if (todayDate.getDate() === date.getDate() && todayDate.getMonth() === date.getMonth()) {
30
32
  return true;
31
33
  }
32
34
  // leap year
33
- if (todayDate.getDate() === 28 &&
34
- date.getDate() === 29 &&
35
- todayDate.getMonth() === 1 &&
36
- date.getMonth() === 1) {
35
+ if (todayDate.getDate() === 28 && date.getDate() === 29 && todayDate.getMonth() === 1 && date.getMonth() === 1) {
37
36
  return true;
38
37
  }
39
38
  return false;
@@ -41,18 +40,23 @@ export const announceFluxstersAnniversaries = async (property, constructMessage)
41
40
  if (relevantPeople.length > 0) {
42
41
  const message = constructMessage(relevantPeople);
43
42
  slackLater(message, config.slack.mainFluxChannel);
44
- return { counts: relevantPeople.length, message };
43
+ return {
44
+ counts: relevantPeople.length,
45
+ message
46
+ };
45
47
  }
46
- return { counts: relevantPeople.length };
48
+ return {
49
+ counts: relevantPeople.length
50
+ };
47
51
  };
48
- export const getNameFrom = (person) => {
52
+ export const getNameFrom = (person)=>{
49
53
  const nameProperty = person.properties.Name;
50
54
  if (nameProperty.type !== 'title') {
51
55
  return '';
52
56
  }
53
57
  return nameProperty.title[0].plain_text;
54
58
  };
55
- export const calculateYears = (person, property) => {
59
+ export const calculateYears = (person, property)=>{
56
60
  const joinedDateProperty = person.properties[property];
57
61
  if (joinedDateProperty.type !== 'date' || !joinedDateProperty.date?.start) {
58
62
  return 0;
@@ -61,4 +65,3 @@ export const calculateYears = (person, property) => {
61
65
  const joinedDate = new Date(joinedDateProperty.date?.start);
62
66
  return today.getFullYear() - joinedDate.getFullYear();
63
67
  };
64
- //# sourceMappingURL=client.js.map
@@ -1,11 +1,11 @@
1
1
  import { getNotion } from '@driveflux/api-functions/notion';
2
2
  import { knowledgeBaseRetrievePageSchema } from './schemas/kb.js';
3
- export const processHelpful = async (options) => {
3
+ export const processHelpful = async (options)=>{
4
4
  const { pageId, isHelpful, hasSubmittedBefore } = options;
5
5
  // get original page
6
6
  const notion = getNotion();
7
7
  const page = await notion.pages.retrieve({
8
- page_id: pageId,
8
+ page_id: pageId
9
9
  });
10
10
  // validate page
11
11
  const kbPageValidation = knowledgeBaseRetrievePageSchema.safeParse(page);
@@ -18,15 +18,12 @@ export const processHelpful = async (options) => {
18
18
  page_id: pageId,
19
19
  properties: {
20
20
  Helpful: {
21
- number: (validatedPage.properties.Helpful.number || 0) +
22
- (hasSubmittedBefore && !isHelpful ? -1 : isHelpful ? 1 : 0),
21
+ number: (validatedPage.properties.Helpful.number || 0) + (hasSubmittedBefore && !isHelpful ? -1 : isHelpful ? 1 : 0)
23
22
  },
24
23
  Unhelpful: {
25
- number: (validatedPage.properties.Unhelpful.number || 0) +
26
- (hasSubmittedBefore && isHelpful ? -1 : !isHelpful ? 1 : 0),
27
- },
28
- },
24
+ number: (validatedPage.properties.Unhelpful.number || 0) + (hasSubmittedBefore && isHelpful ? -1 : !isHelpful ? 1 : 0)
25
+ }
26
+ }
29
27
  });
30
28
  return true;
31
29
  };
32
- //# sourceMappingURL=helpful.js.map
@@ -2,59 +2,54 @@ import { z } from 'zod';
2
2
  import { notionDateSchema } from './common.js';
3
3
  import { notionPartialUserSchema } from './user.js';
4
4
  export const notionRichTextSchema = z.object({
5
- type: z.enum(['text', 'mention', 'equation']),
6
- equation: z
7
- .object({
8
- expression: z.string(),
9
- })
10
- .optional(),
11
- mention: z
12
- .object({
5
+ type: z.enum([
6
+ 'text',
7
+ 'mention',
8
+ 'equation'
9
+ ]),
10
+ equation: z.object({
11
+ expression: z.string()
12
+ }).optional(),
13
+ mention: z.object({
13
14
  type: z.enum([
14
15
  'database',
15
16
  'date',
16
17
  'link_preview',
17
18
  'page',
18
19
  'template_mention',
19
- 'user',
20
+ 'user'
20
21
  ]),
21
- database: z
22
- .object({
23
- id: z.string(),
24
- })
25
- .optional(),
22
+ database: z.object({
23
+ id: z.string()
24
+ }).optional(),
26
25
  date: notionDateSchema.optional(),
27
- link_preview: z
28
- .object({
29
- url: z.string().url(),
30
- })
31
- .optional(),
32
- page: z
33
- .object({
34
- id: z.string(),
35
- })
36
- .optional(),
37
- template_mention: z
38
- .object({
39
- type: z.enum(['template_mention_date', 'template_mention_user']),
40
- template_mention_date: z.enum(['today', 'now']).optional(),
41
- template_mention_user: z.enum(['me']).optional(),
42
- })
43
- .optional(),
44
- user: notionPartialUserSchema.optional(),
45
- })
46
- .optional(),
47
- text: z
48
- .object({
26
+ link_preview: z.object({
27
+ url: z.string().url()
28
+ }).optional(),
29
+ page: z.object({
30
+ id: z.string()
31
+ }).optional(),
32
+ template_mention: z.object({
33
+ type: z.enum([
34
+ 'template_mention_date',
35
+ 'template_mention_user'
36
+ ]),
37
+ template_mention_date: z.enum([
38
+ 'today',
39
+ 'now'
40
+ ]).optional(),
41
+ template_mention_user: z.enum([
42
+ 'me'
43
+ ]).optional()
44
+ }).optional(),
45
+ user: notionPartialUserSchema.optional()
46
+ }).optional(),
47
+ text: z.object({
49
48
  content: z.string(),
50
- link: z
51
- .object({
52
- url: z.string().url(),
53
- })
54
- .nullable()
55
- .optional(),
56
- })
57
- .optional(),
49
+ link: z.object({
50
+ url: z.string().url()
51
+ }).nullable().optional()
52
+ }).optional(),
58
53
  annotations: z.object({
59
54
  bold: z.boolean(),
60
55
  italic: z.boolean(),
@@ -80,10 +75,9 @@ export const notionRichTextSchema = z.object({
80
75
  'red',
81
76
  'red_background',
82
77
  'yellow',
83
- 'yellow_background',
84
- ]),
78
+ 'yellow_background'
79
+ ])
85
80
  }),
86
81
  plain_text: z.string(),
87
- href: z.string().url().nullable().optional(),
82
+ href: z.string().url().nullable().optional()
88
83
  });
89
- //# sourceMappingURL=block.js.map
@@ -1,11 +1,7 @@
1
1
  import { z } from 'zod';
2
- export const notionDateOrTimeFormat = z
3
- .string()
4
- .regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z|\+\d{2}:\d{2}))?$/);
2
+ export const notionDateOrTimeFormat = z.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z|\+\d{2}:\d{2}))?$/);
5
3
  export const notionDateFormat = z.string().regex(/^\d{4}-\d{2}-\d{2}$/);
6
- export const notionTimeFormat = z
7
- .string()
8
- .regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/);
4
+ export const notionTimeFormat = z.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/);
9
5
  export const notionCommonColorEnum = z.enum([
10
6
  'blue',
11
7
  'brown',
@@ -16,16 +12,15 @@ export const notionCommonColorEnum = z.enum([
16
12
  'pink',
17
13
  'purple',
18
14
  'red',
19
- 'yellow',
15
+ 'yellow'
20
16
  ]);
21
17
  export const notionDateSchema = z.object({
22
18
  start: notionDateOrTimeFormat,
23
19
  end: notionDateOrTimeFormat.nullable().optional(),
24
- time_zone: z.string().nullable().optional(),
20
+ time_zone: z.string().nullable().optional()
25
21
  });
26
- export const commonPropertyValues = (type) => ({
27
- id: z.string(),
28
- type: z.literal(type),
29
- name: z.string().optional(),
30
- });
31
- //# sourceMappingURL=common.js.map
22
+ export const commonPropertyValues = (type)=>({
23
+ id: z.string(),
24
+ type: z.literal(type),
25
+ name: z.string().optional()
26
+ });
@@ -1,47 +1,47 @@
1
1
  import { z } from 'zod';
2
2
  import { notionRichTextSchema } from './block.js';
3
- import { commonPropertyValues, notionCommonColorEnum, notionTimeFormat, } from './common.js';
3
+ import { commonPropertyValues, notionCommonColorEnum, notionTimeFormat } from './common.js';
4
4
  import { notionEmojiSchema } from './emoji.js';
5
5
  import { notionFileSchema } from './file.js';
6
6
  import { notionWorkspaceParentSchema } from './parent.js';
7
7
  import { notionPartialUserSchema } from './user.js';
8
8
  export const notionDatabasePropertyCheckboxSchema = z.object({
9
9
  ...commonPropertyValues('checkbox'),
10
- checkbox: z.object({}),
10
+ checkbox: z.object({})
11
11
  });
12
12
  export const notionDatabasePropertyCreatedBySchema = z.object({
13
13
  ...commonPropertyValues('created_by'),
14
- created_by: z.object({}),
14
+ created_by: z.object({})
15
15
  });
16
16
  export const notionDatabasePropertyCreatedTimeSchema = z.object({
17
17
  ...commonPropertyValues('created_time'),
18
- created_time: z.object({}),
18
+ created_time: z.object({})
19
19
  });
20
20
  export const notionDatabasePropertyDateSchema = z.object({
21
21
  ...commonPropertyValues('date'),
22
- date: z.object({}),
22
+ date: z.object({})
23
23
  });
24
24
  export const notionDatabasePropertyEmailSchema = z.object({
25
25
  ...commonPropertyValues('email'),
26
- email: z.object({}),
26
+ email: z.object({})
27
27
  });
28
28
  export const notionDatabasePropertyFilesSchema = z.object({
29
29
  ...commonPropertyValues('files'),
30
- files: z.object({}),
30
+ files: z.object({})
31
31
  });
32
32
  export const notionDatabasePropertyFormulaSchema = z.object({
33
33
  ...commonPropertyValues('formula'),
34
34
  formula: z.object({
35
- expression: z.string(),
36
- }),
35
+ expression: z.string()
36
+ })
37
37
  });
38
38
  export const notionDatabasePropertyLastEditedBySchema = z.object({
39
39
  ...commonPropertyValues('last_edited_by'),
40
- last_edited_by: z.object({}).optional(),
40
+ last_edited_by: z.object({}).optional()
41
41
  });
42
42
  export const notionDatabasePropertyLastEditedTimeSchema = z.object({
43
43
  ...commonPropertyValues('last_edited_time'),
44
- last_edited_time: z.object({}),
44
+ last_edited_time: z.object({})
45
45
  });
46
46
  export const notionDatabasePropertyMultiSelectSchema = z.object({
47
47
  ...commonPropertyValues('multi_select'),
@@ -49,9 +49,9 @@ export const notionDatabasePropertyMultiSelectSchema = z.object({
49
49
  options: z.array(z.object({
50
50
  id: z.string(),
51
51
  name: z.string(),
52
- color: notionCommonColorEnum,
53
- })),
54
- }),
52
+ color: notionCommonColorEnum
53
+ }))
54
+ })
55
55
  });
56
56
  export const notionDatabasePropertyNumberSchema = z.object({
57
57
  ...commonPropertyValues('number'),
@@ -96,29 +96,29 @@ export const notionDatabasePropertyNumberSchema = z.object({
96
96
  'yen,',
97
97
  'yuan',
98
98
  'won',
99
- 'zloty',
100
- ]),
101
- }),
99
+ 'zloty'
100
+ ])
101
+ })
102
102
  });
103
103
  export const notionDatabasePropertyPeopleSchema = z.object({
104
104
  ...commonPropertyValues('people'),
105
- people: z.object({}),
105
+ people: z.object({})
106
106
  });
107
107
  export const notionDatabasePropertyPhoneNumberSchema = z.object({
108
108
  ...commonPropertyValues('phone_number'),
109
- phone_number: z.object({}),
109
+ phone_number: z.object({})
110
110
  });
111
111
  export const notionDatabasePropertyRelationSchema = z.object({
112
112
  ...commonPropertyValues('relation'),
113
113
  relation: z.object({
114
114
  database_id: z.string(),
115
115
  synced_property_name: z.string().optional(),
116
- synced_property_id: z.string().optional(),
117
- }),
116
+ synced_property_id: z.string().optional()
117
+ })
118
118
  });
119
119
  export const notionDatabasePropertyRichTextSchema = z.object({
120
120
  ...commonPropertyValues('rich_text'),
121
- rich_text: z.object({}),
121
+ rich_text: z.object({})
122
122
  });
123
123
  export const notionDatabasePropertyRollupSchema = z.object({
124
124
  ...commonPropertyValues('rollup'),
@@ -151,10 +151,16 @@ export const notionDatabasePropertyRollupSchema = z.object({
151
151
  'show_unique',
152
152
  'sum',
153
153
  'unchecked',
154
- 'unique',
154
+ 'unique'
155
155
  ]),
156
- type: z.enum(['array', 'date', 'incomplete', 'number', 'unsupported']),
157
- }),
156
+ type: z.enum([
157
+ 'array',
158
+ 'date',
159
+ 'incomplete',
160
+ 'number',
161
+ 'unsupported'
162
+ ])
163
+ })
158
164
  });
159
165
  export const notionDatabasePropertySelectSchema = z.object({
160
166
  ...commonPropertyValues('select'),
@@ -162,9 +168,9 @@ export const notionDatabasePropertySelectSchema = z.object({
162
168
  options: z.array(z.object({
163
169
  id: z.string(),
164
170
  name: z.string(),
165
- color: notionCommonColorEnum,
166
- })),
167
- }),
171
+ color: notionCommonColorEnum
172
+ }))
173
+ })
168
174
  });
169
175
  export const notionDatabasePropertyStatusSchema = z.object({
170
176
  ...commonPropertyValues('status'),
@@ -172,51 +178,47 @@ export const notionDatabasePropertyStatusSchema = z.object({
172
178
  options: z.array(z.object({
173
179
  id: z.string(),
174
180
  name: z.string(),
175
- color: notionCommonColorEnum,
181
+ color: notionCommonColorEnum
176
182
  })),
177
- group: z
178
- .array(z.object({
183
+ group: z.array(z.object({
179
184
  id: z.string(),
180
185
  name: z.string(),
181
186
  color: notionCommonColorEnum,
182
- option_ids: z.array(z.string()),
183
- }))
184
- .nullable()
185
- .optional(),
186
- }),
187
+ option_ids: z.array(z.string())
188
+ })).nullable().optional()
189
+ })
187
190
  });
188
191
  export const notionDatabasePropertyTitleSchema = z.object({
189
192
  ...commonPropertyValues('title'),
190
- title: z.object({}),
193
+ title: z.object({})
191
194
  });
192
195
  export const notionDatabasePropertyUrlSchema = z.object({
193
196
  ...commonPropertyValues('url'),
194
- url: z.object({}),
197
+ url: z.object({})
195
198
  });
196
199
  export const notionDatabasePropertyUniqueIdSchema = z.object({
197
200
  ...commonPropertyValues('unique_id'),
198
- unique_id: z.object({}),
201
+ unique_id: z.object({})
199
202
  });
200
203
  export const notionDatabasePropertyVerificationSchema = z.object({
201
204
  ...commonPropertyValues('verification'),
202
- verification: z.object({}),
203
- });
204
- export const notionDatabaseSchema = (properties) => z.object({
205
- object: z.literal('database'),
206
- id: z.string(),
207
- created_time: notionTimeFormat,
208
- created_by: notionPartialUserSchema,
209
- last_edited_time: notionTimeFormat,
210
- last_edited_by: notionPartialUserSchema,
211
- title: z.array(notionRichTextSchema),
212
- description: z.array(notionRichTextSchema),
213
- icon: notionFileSchema.or(notionEmojiSchema),
214
- cover: notionFileSchema.nullable(),
215
- properties,
216
- parent: notionWorkspaceParentSchema,
217
- url: z.string().url(),
218
- archived: z.boolean(),
219
- is_inline: z.boolean(),
220
- public_url: z.string().nullable(),
221
- });
222
- //# sourceMappingURL=database.js.map
205
+ verification: z.object({})
206
+ });
207
+ export const notionDatabaseSchema = (properties)=>z.object({
208
+ object: z.literal('database'),
209
+ id: z.string(),
210
+ created_time: notionTimeFormat,
211
+ created_by: notionPartialUserSchema,
212
+ last_edited_time: notionTimeFormat,
213
+ last_edited_by: notionPartialUserSchema,
214
+ title: z.array(notionRichTextSchema),
215
+ description: z.array(notionRichTextSchema),
216
+ icon: notionFileSchema.or(notionEmojiSchema),
217
+ cover: notionFileSchema.nullable(),
218
+ properties,
219
+ parent: notionWorkspaceParentSchema,
220
+ url: z.string().url(),
221
+ archived: z.boolean(),
222
+ is_inline: z.boolean(),
223
+ public_url: z.string().nullable()
224
+ });
@@ -1,6 +1,5 @@
1
1
  import { z } from 'zod';
2
2
  export const notionEmojiSchema = z.object({
3
3
  type: z.literal('emoji'),
4
- emoji: z.string().emoji(),
4
+ emoji: z.string().emoji()
5
5
  });
6
- //# sourceMappingURL=emoji.js.map
@@ -1,18 +1,18 @@
1
1
  import { z } from 'zod';
2
2
  import { notionTimeFormat } from './common.js';
3
3
  export const notionFileSchema = z.object({
4
- type: z.enum(['file', 'external']),
4
+ type: z.enum([
5
+ 'file',
6
+ 'external'
7
+ ]),
5
8
  name: z.string().optional(),
6
9
  // type file
7
- file: z
8
- .object({
10
+ file: z.object({
9
11
  url: z.string().url(),
10
- expiry_time: notionTimeFormat,
11
- })
12
- .optional(),
12
+ expiry_time: notionTimeFormat
13
+ }).optional(),
13
14
  // type external
14
15
  external: z.object({
15
- url: z.string().url(),
16
- }),
16
+ url: z.string().url()
17
+ })
17
18
  });
18
- //# sourceMappingURL=file.js.map