@driveflux/api-functions 0.0.7-next.7 → 0.0.7-next.9
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/auth/confirm.js +29 -24
- package/dist/auth/emails.js +13 -12
- package/dist/auth/formatter.js +5 -5
- package/dist/auth/otp.js +50 -66
- package/dist/auth/register.js +34 -42
- package/dist/auth/tokens.js +55 -58
- package/dist/auth/verifications.js +52 -53
- package/dist/constants.js +1 -0
- package/dist/mailjet/calls/manage-contacts-in-list.js +6 -5
- package/dist/mailjet/calls/manage-subscription-status.js +5 -4
- package/dist/mailjet/calls/request-service.js +6 -7
- package/dist/mailjet/refresh-email-preferences.js +12 -11
- package/dist/mailjet/set-contact.js +12 -11
- package/dist/mailjet/types.js +2 -1
- package/dist/mailjet/utils/convert-to-array.js +6 -8
- package/dist/mailjet/utils/extract-email-preferences.js +15 -14
- package/dist/mailjet/utils/lists.js +8 -7
- package/dist/mailjet/utils/update-email-references.js +15 -16
- package/dist/notion/client.js +19 -22
- package/dist/notion/helpful.js +9 -6
- package/dist/notion/schemas/block.js +48 -42
- package/dist/notion/schemas/common.js +14 -9
- package/dist/notion/schemas/database.js +60 -62
- package/dist/notion/schemas/emoji.js +2 -1
- package/dist/notion/schemas/file.js +9 -9
- package/dist/notion/schemas/kb.js +6 -5
- package/dist/notion/schemas/page.js +61 -72
- package/dist/notion/schemas/parent.js +5 -4
- package/dist/notion/schemas/user.js +19 -18
- package/dist/reservation/agree.js +7 -6
- package/dist/reservation/checks.js +4 -3
- package/dist/reservation/display-vehicle.d.ts +35 -35
- package/dist/reservation/fetch-or-create.d.ts +1 -1
- package/dist/reservation/fetch-or-create.d.ts.map +1 -1
- package/dist/reservation/fetch-or-create.js +62 -48
- package/dist/reservation/fetch-or-create.js.map +1 -1
- package/dist/reservation/invoice.d.ts +2 -2
- package/dist/reservation/invoice.d.ts.map +1 -1
- package/dist/reservation/invoice.js +76 -64
- package/dist/reservation/invoice.js.map +1 -1
- package/dist/reservation/payer.js +6 -5
- package/dist/reservation/reserve.js +4 -3
- package/dist/reservation/types.d.ts +1 -0
- package/dist/reservation/types.d.ts.map +1 -1
- package/dist/reservation/types.js +2 -1
- package/dist/reservation/vehicle.js +16 -13
- package/dist/slack.js +29 -24
- package/dist/validation.js +71 -69
- package/dist/vehicle/vehicle-pricing/constants.js +19 -22
- package/dist/vehicle/vehicle-pricing/index.js +42 -28
- package/dist/vehicle/vehicle-pricing/types.js +2 -1
- package/package.json +9 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { notionDatabasePropertyCheckboxSchema, notionDatabasePropertyCreatedBySchema, notionDatabasePropertyCreatedTimeSchema, notionDatabasePropertyDateSchema, notionDatabasePropertyFormulaSchema, notionDatabasePropertyLastEditedBySchema, notionDatabasePropertyLastEditedTimeSchema, notionDatabasePropertyMultiSelectSchema, notionDatabasePropertyNumberSchema, notionDatabasePropertyRelationSchema, notionDatabasePropertySelectSchema, notionDatabasePropertyStatusSchema, notionDatabasePropertyTitleSchema, notionDatabasePropertyUniqueIdSchema, notionDatabaseSchema } from './database.js';
|
|
3
|
-
import { notionPagePropertyCheckboxSchema, notionPagePropertyCreatedBySchema, notionPagePropertyCreatedTimeSchema, notionPagePropertyDateSchema, notionPagePropertyFormulaSchema, notionPagePropertyLastEditedBySchema, notionPagePropertyLastEditedTimeSchema, notionPagePropertyMultiSelectSchema, notionPagePropertyNumberSchema, notionPagePropertyRelationSchema, notionPagePropertyRichTextSchema, notionPagePropertySelectSchema, notionPagePropertyStatusSchema, notionPagePropertyTitleSchema, notionPagePropertyUniqueIdSchema, notionPageSchema, notionPagesSchema } from './page.js';
|
|
2
|
+
import { notionDatabasePropertyCheckboxSchema, notionDatabasePropertyCreatedBySchema, notionDatabasePropertyCreatedTimeSchema, notionDatabasePropertyDateSchema, notionDatabasePropertyFormulaSchema, notionDatabasePropertyLastEditedBySchema, notionDatabasePropertyLastEditedTimeSchema, notionDatabasePropertyMultiSelectSchema, notionDatabasePropertyNumberSchema, notionDatabasePropertyRelationSchema, notionDatabasePropertySelectSchema, notionDatabasePropertyStatusSchema, notionDatabasePropertyTitleSchema, notionDatabasePropertyUniqueIdSchema, notionDatabaseSchema, } from './database.js';
|
|
3
|
+
import { notionPagePropertyCheckboxSchema, notionPagePropertyCreatedBySchema, notionPagePropertyCreatedTimeSchema, notionPagePropertyDateSchema, notionPagePropertyFormulaSchema, notionPagePropertyLastEditedBySchema, notionPagePropertyLastEditedTimeSchema, notionPagePropertyMultiSelectSchema, notionPagePropertyNumberSchema, notionPagePropertyRelationSchema, notionPagePropertyRichTextSchema, notionPagePropertySelectSchema, notionPagePropertyStatusSchema, notionPagePropertyTitleSchema, notionPagePropertyUniqueIdSchema, notionPageSchema, notionPagesSchema, } from './page.js';
|
|
4
4
|
export const knowledgeBaseRetrieveDatabaseSchema = notionDatabaseSchema(z.object({
|
|
5
5
|
Title: notionDatabasePropertyTitleSchema,
|
|
6
6
|
Status: notionDatabasePropertyStatusSchema,
|
|
@@ -22,7 +22,7 @@ export const knowledgeBaseRetrieveDatabaseSchema = notionDatabaseSchema(z.object
|
|
|
22
22
|
'Section Slug': notionDatabasePropertyFormulaSchema,
|
|
23
23
|
'Topic Slug': notionDatabasePropertyFormulaSchema,
|
|
24
24
|
Helpful: notionDatabasePropertyNumberSchema,
|
|
25
|
-
Unhelpful: notionDatabasePropertyNumberSchema
|
|
25
|
+
Unhelpful: notionDatabasePropertyNumberSchema,
|
|
26
26
|
}));
|
|
27
27
|
export const knowledgeBaseRetrievePageSchema = notionPageSchema(z.object({
|
|
28
28
|
Title: notionPagePropertyTitleSchema,
|
|
@@ -46,7 +46,7 @@ export const knowledgeBaseRetrievePageSchema = notionPageSchema(z.object({
|
|
|
46
46
|
'Section Slug': notionPagePropertyFormulaSchema,
|
|
47
47
|
'Topic Slug': notionPagePropertyFormulaSchema,
|
|
48
48
|
Helpful: notionPagePropertyNumberSchema,
|
|
49
|
-
Unhelpful: notionPagePropertyNumberSchema
|
|
49
|
+
Unhelpful: notionPagePropertyNumberSchema,
|
|
50
50
|
}));
|
|
51
51
|
export const knowledgeBaseQueryDatabaseSchema = notionPagesSchema(z.object({
|
|
52
52
|
Title: notionPagePropertyTitleSchema,
|
|
@@ -69,5 +69,6 @@ export const knowledgeBaseQueryDatabaseSchema = notionPagesSchema(z.object({
|
|
|
69
69
|
'Section Slug': notionPagePropertyFormulaSchema,
|
|
70
70
|
'Topic Slug': notionPagePropertyFormulaSchema,
|
|
71
71
|
Helpful: notionPagePropertyNumberSchema,
|
|
72
|
-
Unhelpful: notionPagePropertyNumberSchema
|
|
72
|
+
Unhelpful: notionPagePropertyNumberSchema,
|
|
73
73
|
}));
|
|
74
|
+
//# sourceMappingURL=kb.js.map
|
|
@@ -1,83 +1,78 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { notionRichTextSchema } from './block.js';
|
|
3
|
-
import { commonPropertyValues, notionCommonColorEnum, notionDateFormat, notionDateSchema, notionTimeFormat } from './common.js';
|
|
3
|
+
import { commonPropertyValues, notionCommonColorEnum, notionDateFormat, notionDateSchema, notionTimeFormat, } from './common.js';
|
|
4
4
|
import { notionEmojiSchema } from './emoji.js';
|
|
5
5
|
import { notionFileSchema } from './file.js';
|
|
6
6
|
import { notionDatabaseParentSchema } from './parent.js';
|
|
7
7
|
import { notionPartialUserSchema, notionUserSchema } from './user.js';
|
|
8
8
|
export const notionPagePropertyCheckboxSchema = z.object({
|
|
9
9
|
...commonPropertyValues('checkbox'),
|
|
10
|
-
checkbox: z.boolean()
|
|
10
|
+
checkbox: z.boolean(),
|
|
11
11
|
});
|
|
12
12
|
export const notionPagePropertyCreatedBySchema = z.object({
|
|
13
13
|
...commonPropertyValues('created_by'),
|
|
14
|
-
created_by: notionUserSchema
|
|
14
|
+
created_by: notionUserSchema,
|
|
15
15
|
});
|
|
16
16
|
export const notionPagePropertyCreatedTimeSchema = z.object({
|
|
17
17
|
...commonPropertyValues('created_time'),
|
|
18
|
-
created_time: notionTimeFormat
|
|
18
|
+
created_time: notionTimeFormat,
|
|
19
19
|
});
|
|
20
20
|
export const notionPagePropertyDateSchema = z.object({
|
|
21
21
|
...commonPropertyValues('date'),
|
|
22
|
-
date: notionDateSchema.nullable()
|
|
22
|
+
date: notionDateSchema.nullable(),
|
|
23
23
|
});
|
|
24
24
|
export const notionPagePropertyEmailSchema = z.object({
|
|
25
25
|
...commonPropertyValues('email'),
|
|
26
|
-
email: z.string()
|
|
26
|
+
email: z.string(),
|
|
27
27
|
});
|
|
28
28
|
export const notionPagePropertyFilesSchema = z.object({
|
|
29
29
|
...commonPropertyValues('files'),
|
|
30
|
-
files: z.array(notionFileSchema)
|
|
30
|
+
files: z.array(notionFileSchema),
|
|
31
31
|
});
|
|
32
32
|
export const notionPagePropertyFormulaSchema = z.object({
|
|
33
33
|
...commonPropertyValues('formula'),
|
|
34
34
|
formula: z.object({
|
|
35
|
-
type: z.enum([
|
|
36
|
-
'boolean',
|
|
37
|
-
'date',
|
|
38
|
-
'number',
|
|
39
|
-
'string'
|
|
40
|
-
]),
|
|
35
|
+
type: z.enum(['boolean', 'date', 'number', 'string']),
|
|
41
36
|
boolean: z.boolean().optional(),
|
|
42
37
|
date: notionDateFormat.optional(),
|
|
43
38
|
number: z.number().optional(),
|
|
44
|
-
string: z.string().optional()
|
|
45
|
-
})
|
|
39
|
+
string: z.string().optional(),
|
|
40
|
+
}),
|
|
46
41
|
});
|
|
47
42
|
export const notionPagePropertyLastEditedBySchema = z.object({
|
|
48
43
|
...commonPropertyValues('last_edited_by'),
|
|
49
|
-
last_edited_by: notionUserSchema
|
|
44
|
+
last_edited_by: notionUserSchema,
|
|
50
45
|
});
|
|
51
46
|
export const notionPagePropertyLastEditedTimeSchema = z.object({
|
|
52
47
|
...commonPropertyValues('last_edited_time'),
|
|
53
|
-
last_edited_time: notionTimeFormat
|
|
48
|
+
last_edited_time: notionTimeFormat,
|
|
54
49
|
});
|
|
55
50
|
export const notionPagePropertyMultiSelectSchema = z.object({
|
|
56
51
|
...commonPropertyValues('multi_select'),
|
|
57
52
|
multi_select: z.array(z.object({
|
|
58
53
|
id: z.string(),
|
|
59
54
|
name: z.string(),
|
|
60
|
-
color: notionCommonColorEnum
|
|
61
|
-
}))
|
|
55
|
+
color: notionCommonColorEnum,
|
|
56
|
+
})),
|
|
62
57
|
});
|
|
63
58
|
export const notionPagePropertyNumberSchema = z.object({
|
|
64
59
|
...commonPropertyValues('number'),
|
|
65
|
-
number: z.number().nullable()
|
|
60
|
+
number: z.number().nullable(),
|
|
66
61
|
});
|
|
67
62
|
export const notionPagePropertyPeopleSchema = z.object({
|
|
68
63
|
...commonPropertyValues('people'),
|
|
69
|
-
people: z.array(notionUserSchema)
|
|
64
|
+
people: z.array(notionUserSchema),
|
|
70
65
|
});
|
|
71
66
|
export const notionPagePropertyPhoneNumberSchema = z.object({
|
|
72
67
|
...commonPropertyValues('phone_number'),
|
|
73
|
-
phone_number: z.string()
|
|
68
|
+
phone_number: z.string(),
|
|
74
69
|
});
|
|
75
70
|
export const notionPagePropertyRelationSchema = z.object({
|
|
76
71
|
...commonPropertyValues('relation'),
|
|
77
72
|
relation: z.array(z.object({
|
|
78
|
-
id: z.string()
|
|
73
|
+
id: z.string(),
|
|
79
74
|
})),
|
|
80
|
-
has_more: z.boolean()
|
|
75
|
+
has_more: z.boolean(),
|
|
81
76
|
});
|
|
82
77
|
export const notionPagePropertyRollupSchema = z.object({
|
|
83
78
|
...commonPropertyValues('rollup'),
|
|
@@ -111,82 +106,76 @@ export const notionPagePropertyRollupSchema = z.object({
|
|
|
111
106
|
'show_unique',
|
|
112
107
|
'sum',
|
|
113
108
|
'unchecked',
|
|
114
|
-
'unique'
|
|
109
|
+
'unique',
|
|
115
110
|
]),
|
|
116
|
-
type: z.enum([
|
|
117
|
-
|
|
118
|
-
'date',
|
|
119
|
-
'incomplete',
|
|
120
|
-
'number',
|
|
121
|
-
'unsupported'
|
|
122
|
-
])
|
|
123
|
-
})
|
|
111
|
+
type: z.enum(['array', 'date', 'incomplete', 'number', 'unsupported']),
|
|
112
|
+
}),
|
|
124
113
|
});
|
|
125
114
|
export const notionPagePropertyRichTextSchema = z.object({
|
|
126
115
|
...commonPropertyValues('rich_text'),
|
|
127
|
-
rich_text: z.array(notionRichTextSchema)
|
|
116
|
+
rich_text: z.array(notionRichTextSchema),
|
|
128
117
|
});
|
|
129
118
|
export const notionPagePropertySelectSchema = z.object({
|
|
130
119
|
...commonPropertyValues('select'),
|
|
131
|
-
select: z
|
|
120
|
+
select: z
|
|
121
|
+
.object({
|
|
132
122
|
id: z.string(),
|
|
133
123
|
name: z.string(),
|
|
134
|
-
color: notionCommonColorEnum
|
|
135
|
-
})
|
|
124
|
+
color: notionCommonColorEnum,
|
|
125
|
+
})
|
|
126
|
+
.nullable(),
|
|
136
127
|
});
|
|
137
128
|
export const notionPagePropertyStatusSchema = z.object({
|
|
138
129
|
...commonPropertyValues('status'),
|
|
139
130
|
status: z.object({
|
|
140
131
|
id: z.string(),
|
|
141
132
|
name: z.string(),
|
|
142
|
-
color: notionCommonColorEnum
|
|
143
|
-
})
|
|
133
|
+
color: notionCommonColorEnum,
|
|
134
|
+
}),
|
|
144
135
|
});
|
|
145
136
|
export const notionPagePropertyTitleSchema = z.object({
|
|
146
137
|
...commonPropertyValues('title'),
|
|
147
|
-
title: z.array(notionRichTextSchema)
|
|
138
|
+
title: z.array(notionRichTextSchema),
|
|
148
139
|
});
|
|
149
140
|
export const notionPagePropertyUrlSchema = z.object({
|
|
150
141
|
...commonPropertyValues('url'),
|
|
151
|
-
url: z.string().url().nullable()
|
|
142
|
+
url: z.string().url().nullable(),
|
|
152
143
|
});
|
|
153
144
|
export const notionPagePropertyUniqueIdSchema = z.object({
|
|
154
145
|
...commonPropertyValues('unique_id'),
|
|
155
146
|
unique_id: z.object({
|
|
156
147
|
number: z.number(),
|
|
157
|
-
prefix: z.string().nullable().optional()
|
|
158
|
-
})
|
|
148
|
+
prefix: z.string().nullable().optional(),
|
|
149
|
+
}),
|
|
159
150
|
});
|
|
160
151
|
export const notionPagePropertyVerificationSchema = z.object({
|
|
161
152
|
...commonPropertyValues('verification'),
|
|
162
153
|
verification: z.object({
|
|
163
|
-
state: z.enum([
|
|
164
|
-
'verified',
|
|
165
|
-
'unverified'
|
|
166
|
-
]),
|
|
154
|
+
state: z.enum(['verified', 'unverified']),
|
|
167
155
|
verified_by: notionUserSchema.nullable(),
|
|
168
|
-
date: notionDateSchema
|
|
169
|
-
})
|
|
170
|
-
});
|
|
171
|
-
export const notionPageSchema = (properties)=>z.object({
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
export const notionPagesSchema = (properties)=>z.object({
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
156
|
+
date: notionDateSchema,
|
|
157
|
+
}),
|
|
158
|
+
});
|
|
159
|
+
export const notionPageSchema = (properties) => z.object({
|
|
160
|
+
object: z.literal('page'),
|
|
161
|
+
id: z.string(),
|
|
162
|
+
created_time: notionTimeFormat,
|
|
163
|
+
created_by: notionPartialUserSchema,
|
|
164
|
+
last_edited_time: notionTimeFormat,
|
|
165
|
+
last_edited_by: notionPartialUserSchema,
|
|
166
|
+
archived: z.boolean(),
|
|
167
|
+
icon: notionFileSchema.or(notionEmojiSchema).nullable(),
|
|
168
|
+
properties,
|
|
169
|
+
parent: notionDatabaseParentSchema,
|
|
170
|
+
url: z.string().url(),
|
|
171
|
+
public_url: z.string().nullable(),
|
|
172
|
+
});
|
|
173
|
+
export const notionPagesSchema = (properties) => z.object({
|
|
174
|
+
has_more: z.boolean(),
|
|
175
|
+
next_cursor: z.string().nullable(),
|
|
176
|
+
object: z.literal('list'),
|
|
177
|
+
page_or_database: z.object({}),
|
|
178
|
+
type: z.literal('page_or_database'),
|
|
179
|
+
results: z.array(notionPageSchema(properties)),
|
|
180
|
+
});
|
|
181
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export const notionDatabaseParentSchema = z.object({
|
|
3
3
|
type: z.literal('database_id'),
|
|
4
|
-
database_id: z.string()
|
|
4
|
+
database_id: z.string(),
|
|
5
5
|
});
|
|
6
6
|
export const notionPageParentSchema = z.object({
|
|
7
7
|
type: z.literal('page_id'),
|
|
8
|
-
page_id: z.string()
|
|
8
|
+
page_id: z.string(),
|
|
9
9
|
});
|
|
10
10
|
export const notionWorkspaceParentSchema = z.object({
|
|
11
11
|
type: z.literal('workspace'),
|
|
12
|
-
workspace: z.literal(true)
|
|
12
|
+
workspace: z.literal(true),
|
|
13
13
|
});
|
|
14
14
|
export const notionBlockParentSchema = z.object({
|
|
15
15
|
type: z.literal('block_id'),
|
|
16
|
-
block_id: z.string()
|
|
16
|
+
block_id: z.string(),
|
|
17
17
|
});
|
|
18
|
+
//# sourceMappingURL=parent.js.map
|
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export const notionPartialUserSchema = z.object({
|
|
3
3
|
object: z.literal('user'),
|
|
4
|
-
user: z.string().optional()
|
|
4
|
+
user: z.string().optional(),
|
|
5
5
|
});
|
|
6
6
|
export const notionUserSchema = z.object({
|
|
7
7
|
object: z.literal('user'),
|
|
8
8
|
id: z.string(),
|
|
9
|
-
type: z.enum([
|
|
10
|
-
'person',
|
|
11
|
-
'bot'
|
|
12
|
-
]).optional(),
|
|
9
|
+
type: z.enum(['person', 'bot']).optional(),
|
|
13
10
|
name: z.string().optional(),
|
|
14
11
|
avatar_url: z.string().nullable().optional(),
|
|
15
12
|
// type person
|
|
16
|
-
person: z
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
person: z
|
|
14
|
+
.object({
|
|
15
|
+
email: z.string().email(),
|
|
16
|
+
})
|
|
17
|
+
.optional(),
|
|
19
18
|
// type bot
|
|
20
|
-
bot: z
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
workspace_name: z.string().optional()
|
|
29
|
-
})
|
|
19
|
+
bot: z
|
|
20
|
+
.object({
|
|
21
|
+
owner: z
|
|
22
|
+
.object({
|
|
23
|
+
type: z.enum(['workspace', 'user']),
|
|
24
|
+
workspace: z.boolean(),
|
|
25
|
+
})
|
|
26
|
+
.optional(),
|
|
27
|
+
workspace_name: z.string().optional(),
|
|
28
|
+
})
|
|
29
|
+
.optional(),
|
|
30
30
|
});
|
|
31
|
+
//# sourceMappingURL=user.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { prisma } from '@driveflux/db';
|
|
2
2
|
import { generateId } from '@driveflux/db/id';
|
|
3
|
-
export const handleAgreeToTerms = async ({ agreedToTerms, subscribingUser, ipAddress })=>{
|
|
3
|
+
export const handleAgreeToTerms = async ({ agreedToTerms, subscribingUser, ipAddress, }) => {
|
|
4
4
|
if (agreedToTerms && !subscribingUser.consented) {
|
|
5
5
|
subscribingUser = await prisma.user.update({
|
|
6
6
|
where: {
|
|
7
|
-
id: subscribingUser.id
|
|
7
|
+
id: subscribingUser.id,
|
|
8
8
|
},
|
|
9
9
|
data: {
|
|
10
10
|
consented: true,
|
|
@@ -13,10 +13,11 @@ export const handleAgreeToTerms = async ({ agreedToTerms, subscribingUser, ipAdd
|
|
|
13
13
|
id: generateId('UserConsent'),
|
|
14
14
|
ipAddress,
|
|
15
15
|
consentType: 'terms',
|
|
16
|
-
email: subscribingUser.email
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
16
|
+
email: subscribingUser.email,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
+
//# sourceMappingURL=agree.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ForbiddenError, subject } from '@casl/ability';
|
|
2
2
|
import { buildOrDefineAbility } from '@driveflux/auth/authorization';
|
|
3
|
-
import { makeProblem, PROBLEM_CONDITION_FAILED, PROBLEM_RESOURCE_BUSY } from '@driveflux/problem';
|
|
3
|
+
import { makeProblem, PROBLEM_CONDITION_FAILED, PROBLEM_RESOURCE_BUSY, } from '@driveflux/problem';
|
|
4
4
|
import { Err, Ok } from '@driveflux/result';
|
|
5
|
-
export const checkIfUserCanReserve = async ({ requestUser, subscribingUser })=>{
|
|
5
|
+
export const checkIfUserCanReserve = async ({ requestUser, subscribingUser, }) => {
|
|
6
6
|
// Check if the user can reserve
|
|
7
7
|
const requestUserAbility = await buildOrDefineAbility(requestUser);
|
|
8
8
|
// Check if user can reserve
|
|
9
9
|
ForbiddenError.from(requestUserAbility).throwUnlessCan('reserveVehicle', subject('User', subscribingUser));
|
|
10
10
|
return requestUserAbility;
|
|
11
11
|
};
|
|
12
|
-
export const checkIfVehicleIsAvailableForReservation = async (vehicle, plan, allowDelisted)=>{
|
|
12
|
+
export const checkIfVehicleIsAvailableForReservation = async (vehicle, plan, allowDelisted) => {
|
|
13
13
|
if (!vehicle.pricing) {
|
|
14
14
|
return new Err(makeProblem(PROBLEM_RESOURCE_BUSY, 'This vehicle is not available for reservation'));
|
|
15
15
|
}
|
|
@@ -25,3 +25,4 @@ export const checkIfVehicleIsAvailableForReservation = async (vehicle, plan, all
|
|
|
25
25
|
}
|
|
26
26
|
return new Ok(vehicle);
|
|
27
27
|
};
|
|
28
|
+
//# sourceMappingURL=checks.js.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { type DisplayVehicle, type MileagePackage, type PlanType, type UltraTier, type Vehicle, type VehicleType } from '@driveflux/db';
|
|
2
2
|
export declare const fetchDisplayVehicle: (displayVehicle: DisplayVehicle | string) => Promise<{
|
|
3
3
|
object: import("@driveflux/db").DisplayVehicleObject;
|
|
4
|
-
id: string;
|
|
5
4
|
type: VehicleType;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
brandSlug: string;
|
|
5
|
+
id: string;
|
|
6
|
+
createdAt: Date;
|
|
7
|
+
updatedAt: Date;
|
|
10
8
|
make: string;
|
|
11
9
|
vehicleModel: string;
|
|
12
10
|
variant: string;
|
|
13
11
|
year: number;
|
|
12
|
+
brandSlug: string;
|
|
13
|
+
brandId: string;
|
|
14
|
+
defaultHostId: string;
|
|
15
|
+
vehicleSlug: string;
|
|
14
16
|
saveValue: number | null;
|
|
15
|
-
createdAt: Date;
|
|
16
|
-
updatedAt: Date;
|
|
17
17
|
details: ({
|
|
18
18
|
features: string[];
|
|
19
19
|
range: number | null;
|
|
@@ -191,26 +191,26 @@ export declare const fetchDisplayVehicle: (displayVehicle: DisplayVehicle | stri
|
|
|
191
191
|
export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVehicle | string, selectedColor?: string) => Promise<({
|
|
192
192
|
host: {
|
|
193
193
|
object: import("@driveflux/db").HostObject;
|
|
194
|
-
|
|
195
|
-
id: string;
|
|
194
|
+
phoneNumber: string | null;
|
|
196
195
|
type: import("@driveflux/db").HostType | null;
|
|
196
|
+
id: string;
|
|
197
|
+
metadata: PrismaJson.AnyMetadata | null;
|
|
198
|
+
name: string;
|
|
197
199
|
createdAt: Date;
|
|
198
200
|
updatedAt: Date;
|
|
199
|
-
registrationNumber: string | null;
|
|
200
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
201
|
-
active: boolean;
|
|
202
|
-
commencementDate: Date | null;
|
|
203
201
|
email: string | null;
|
|
204
|
-
|
|
202
|
+
race: import("@driveflux/db").Race | null;
|
|
205
203
|
emergencyContactName: string | null;
|
|
206
204
|
emergencyPhoneNumber: string | null;
|
|
205
|
+
active: boolean;
|
|
206
|
+
commencementDate: Date | null;
|
|
207
|
+
registrationNumber: string | null;
|
|
207
208
|
stripeAccountId: string | null;
|
|
208
209
|
isStripeConnected: boolean;
|
|
209
210
|
serviceCenterIds: string[];
|
|
210
211
|
enablePrepayments: boolean;
|
|
211
212
|
prepaymentRatio: number | null;
|
|
212
213
|
accountManagerId: string | null;
|
|
213
|
-
race: import("@driveflux/db").Race | null;
|
|
214
214
|
isInternal: boolean | null;
|
|
215
215
|
address: ({
|
|
216
216
|
name: string | null;
|
|
@@ -262,20 +262,24 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
262
262
|
};
|
|
263
263
|
} & {
|
|
264
264
|
object: import("@driveflux/db").VehicleObject;
|
|
265
|
-
id: string;
|
|
266
265
|
type: VehicleType;
|
|
266
|
+
id: string;
|
|
267
|
+
metadata: PrismaJson.AnyMetadata | null;
|
|
268
|
+
createdAt: Date;
|
|
269
|
+
updatedAt: Date;
|
|
270
|
+
status: import("@driveflux/db").VehicleStatus;
|
|
271
|
+
temporary: boolean;
|
|
272
|
+
registrationNumber: string | null;
|
|
273
|
+
hostId: string;
|
|
267
274
|
make: string;
|
|
268
275
|
vehicleModel: string;
|
|
269
276
|
variant: string;
|
|
270
277
|
year: number;
|
|
271
|
-
createdAt: Date;
|
|
272
|
-
updatedAt: Date;
|
|
273
278
|
featured: boolean;
|
|
274
279
|
searchRankScore: number;
|
|
275
280
|
compositeSearchScore: number;
|
|
276
281
|
registrationDate: Date | null;
|
|
277
282
|
mileage: number | null;
|
|
278
|
-
registrationNumber: string | null;
|
|
279
283
|
vin: string | null;
|
|
280
284
|
engineNumber: string | null;
|
|
281
285
|
availability: import("@driveflux/db").VehicleAvailablity | null;
|
|
@@ -286,11 +290,12 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
286
290
|
basePricePlan24: number;
|
|
287
291
|
basePricePlan36: number;
|
|
288
292
|
basePricePlan60: number;
|
|
289
|
-
status: import("@driveflux/db").VehicleStatus;
|
|
290
293
|
listedAt: Date | null;
|
|
291
294
|
delistedAt: Date | null;
|
|
292
295
|
imagesNotActual: boolean;
|
|
293
296
|
imagesNotActualMessage: string | null;
|
|
297
|
+
allowedServiceCenterIds: string[];
|
|
298
|
+
displayVehicleId: string | null;
|
|
294
299
|
isHostConfirmed: boolean | null;
|
|
295
300
|
niceName: string;
|
|
296
301
|
niceNameShort: string;
|
|
@@ -301,12 +306,7 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
301
306
|
featureOnLandingPage: boolean;
|
|
302
307
|
lastMileageRecordedAt: Date | null;
|
|
303
308
|
locationAvailability: string[];
|
|
304
|
-
temporary: boolean;
|
|
305
309
|
hotDeal: boolean | null;
|
|
306
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
307
|
-
hostId: string;
|
|
308
|
-
allowedServiceCenterIds: string[];
|
|
309
|
-
displayVehicleId: string | null;
|
|
310
310
|
activeSubscriptionId: string | null;
|
|
311
311
|
addresses: {
|
|
312
312
|
return: {
|
|
@@ -689,20 +689,24 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
689
689
|
}) | undefined>;
|
|
690
690
|
export declare const transfromVehicleDisplayToVehicle: (displayVehicle: DisplayVehicle | string, selectedColor: string) => Promise<({
|
|
691
691
|
object: import("@driveflux/db").VehicleObject;
|
|
692
|
-
id: string;
|
|
693
692
|
type: VehicleType;
|
|
693
|
+
id: string;
|
|
694
|
+
metadata: PrismaJson.AnyMetadata | null;
|
|
695
|
+
createdAt: Date;
|
|
696
|
+
updatedAt: Date;
|
|
697
|
+
status: import("@driveflux/db").VehicleStatus;
|
|
698
|
+
temporary: boolean;
|
|
699
|
+
registrationNumber: string | null;
|
|
700
|
+
hostId: string;
|
|
694
701
|
make: string;
|
|
695
702
|
vehicleModel: string;
|
|
696
703
|
variant: string;
|
|
697
704
|
year: number;
|
|
698
|
-
createdAt: Date;
|
|
699
|
-
updatedAt: Date;
|
|
700
705
|
featured: boolean;
|
|
701
706
|
searchRankScore: number;
|
|
702
707
|
compositeSearchScore: number;
|
|
703
708
|
registrationDate: Date | null;
|
|
704
709
|
mileage: number | null;
|
|
705
|
-
registrationNumber: string | null;
|
|
706
710
|
vin: string | null;
|
|
707
711
|
engineNumber: string | null;
|
|
708
712
|
availability: import("@driveflux/db").VehicleAvailablity | null;
|
|
@@ -713,11 +717,12 @@ export declare const transfromVehicleDisplayToVehicle: (displayVehicle: DisplayV
|
|
|
713
717
|
basePricePlan24: number;
|
|
714
718
|
basePricePlan36: number;
|
|
715
719
|
basePricePlan60: number;
|
|
716
|
-
status: import("@driveflux/db").VehicleStatus;
|
|
717
720
|
listedAt: Date | null;
|
|
718
721
|
delistedAt: Date | null;
|
|
719
722
|
imagesNotActual: boolean;
|
|
720
723
|
imagesNotActualMessage: string | null;
|
|
724
|
+
allowedServiceCenterIds: string[];
|
|
725
|
+
displayVehicleId: string | null;
|
|
721
726
|
isHostConfirmed: boolean | null;
|
|
722
727
|
niceName: string;
|
|
723
728
|
niceNameShort: string;
|
|
@@ -728,12 +733,7 @@ export declare const transfromVehicleDisplayToVehicle: (displayVehicle: DisplayV
|
|
|
728
733
|
featureOnLandingPage: boolean;
|
|
729
734
|
lastMileageRecordedAt: Date | null;
|
|
730
735
|
locationAvailability: string[];
|
|
731
|
-
temporary: boolean;
|
|
732
736
|
hotDeal: boolean | null;
|
|
733
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
734
|
-
hostId: string;
|
|
735
|
-
allowedServiceCenterIds: string[];
|
|
736
|
-
displayVehicleId: string | null;
|
|
737
737
|
activeSubscriptionId: string | null;
|
|
738
738
|
addresses: {
|
|
739
739
|
return: {
|
|
@@ -4,7 +4,7 @@ import type { ReserveVehicleParams } from './types.js';
|
|
|
4
4
|
type FetchOrCreateReservationParams = {
|
|
5
5
|
vehicle: Pick<Vehicle, 'id' | 'make' | 'vehicleModel' | 'variant' | 'year' | 'type'>;
|
|
6
6
|
payer: User | Business;
|
|
7
|
-
body: Pick<ReserveVehicleParams, 'subscribingUser' | 'plan' | 'mileagePackage' | 'couponCode' | 'referralCode' | 'asBusiness' | 'source' | 'paymentIntentId' | 'analytics' | 'deliveryAddresses' | 'deliveryDate' | 'requestUser' | 'ipAddress' | 'freeReservation' | 'freeReservationReason'>;
|
|
7
|
+
body: Pick<ReserveVehicleParams, 'subscribingUser' | 'plan' | 'mileagePackage' | 'couponCode' | 'referralCode' | 'asBusiness' | 'source' | 'paymentIntentId' | 'analytics' | 'deliveryAddresses' | 'deliveryDate' | 'requestUser' | 'ipAddress' | 'freeReservation' | 'freeReservationReason' | 'invoiceId'>;
|
|
8
8
|
};
|
|
9
9
|
export declare const fetchOrCreateReservation: ({ vehicle, payer, body, }: FetchOrCreateReservationParams) => PromisedResult<SubscriptionReservation>;
|
|
10
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-or-create.d.ts","sourceRoot":"","sources":["../../src/reservation/fetch-or-create.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,QAAQ,EAGb,KAAK,uBAAuB,EAC5B,KAAK,IAAI,EACT,KAAK,OAAO,EACZ,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAM,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAM3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEtD,KAAK,8BAA8B,GAAG;IACrC,OAAO,EAAE,IAAI,CACZ,OAAO,EACP,IAAI,GAAG,MAAM,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAC5D,CAAA;IACD,KAAK,EAAE,IAAI,GAAG,QAAQ,CAAA;IACtB,IAAI,EAAE,IAAI,CACT,oBAAoB,EAClB,iBAAiB,GACjB,MAAM,GACN,gBAAgB,GAChB,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,QAAQ,GACR,iBAAiB,GACjB,WAAW,GACX,mBAAmB,GACnB,cAAc,GACd,aAAa,GACb,WAAW,GACX,iBAAiB,GACjB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"fetch-or-create.d.ts","sourceRoot":"","sources":["../../src/reservation/fetch-or-create.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,QAAQ,EAGb,KAAK,uBAAuB,EAC5B,KAAK,IAAI,EACT,KAAK,OAAO,EACZ,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAM,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAM3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEtD,KAAK,8BAA8B,GAAG;IACrC,OAAO,EAAE,IAAI,CACZ,OAAO,EACP,IAAI,GAAG,MAAM,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAC5D,CAAA;IACD,KAAK,EAAE,IAAI,GAAG,QAAQ,CAAA;IACtB,IAAI,EAAE,IAAI,CACT,oBAAoB,EAClB,iBAAiB,GACjB,MAAM,GACN,gBAAgB,GAChB,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,QAAQ,GACR,iBAAiB,GACjB,WAAW,GACX,mBAAmB,GACnB,cAAc,GACd,aAAa,GACb,WAAW,GACX,iBAAiB,GACjB,uBAAuB,GACvB,WAAW,CACb,CAAA;CACD,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAU,2BAI5C,8BAA8B,KAAG,cAAc,CAAC,uBAAuB,CAwKzE,CAAA"}
|