@driveflux/api-functions 0.0.4 → 0.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/auth/confirm.js +327 -73
- package/dist/auth/emails.js +210 -43
- package/dist/auth/formatter.js +11 -11
- package/dist/auth/otp.js +392 -122
- package/dist/auth/register.js +396 -100
- package/dist/auth/tokens.js +430 -115
- package/dist/auth/verifications.js +512 -154
- package/dist/constants.js +4 -5
- package/dist/mailjet/calls/manage-contacts-in-list.js +166 -22
- package/dist/mailjet/calls/manage-subscription-status.js +153 -13
- package/dist/mailjet/calls/request-service.js +183 -18
- package/dist/mailjet/refresh-email-preferences.d.ts +10 -10
- package/dist/mailjet/refresh-email-preferences.d.ts.map +1 -1
- package/dist/mailjet/refresh-email-preferences.js +226 -27
- package/dist/mailjet/refresh-email-preferences.js.map +1 -1
- package/dist/mailjet/set-contact.d.ts +10 -10
- package/dist/mailjet/set-contact.d.ts.map +1 -1
- package/dist/mailjet/set-contact.js +215 -24
- package/dist/mailjet/set-contact.js.map +1 -1
- package/dist/mailjet/types.js +1 -2
- package/dist/mailjet/utils/convert-to-array.js +58 -9
- package/dist/mailjet/utils/extract-email-preferences.d.ts +8 -8
- package/dist/mailjet/utils/extract-email-preferences.d.ts.map +1 -1
- package/dist/mailjet/utils/extract-email-preferences.js +218 -42
- package/dist/mailjet/utils/extract-email-preferences.js.map +1 -1
- package/dist/mailjet/utils/lists.js +249 -30
- package/dist/mailjet/utils/update-email-references.js +208 -27
- package/dist/notion/client.js +197 -48
- package/dist/notion/helpful.js +170 -29
- package/dist/notion/schemas/block.js +43 -49
- package/dist/notion/schemas/common.js +14 -17
- package/dist/notion/schemas/database.js +159 -125
- package/dist/notion/schemas/emoji.js +2 -3
- package/dist/notion/schemas/file.js +10 -10
- package/dist/notion/schemas/kb.js +8 -9
- package/dist/notion/schemas/page.js +171 -126
- package/dist/notion/schemas/parent.js +8 -9
- package/dist/notion/schemas/user.js +20 -21
- package/dist/reservation/agree.js +158 -19
- package/dist/reservation/checks.js +178 -23
- package/dist/reservation/display-vehicle.js +514 -142
- package/dist/reservation/fetch-or-create.js +482 -197
- package/dist/reservation/invoice.js +496 -198
- package/dist/reservation/payer.js +177 -28
- package/dist/reservation/reserve.js +191 -31
- package/dist/reservation/types.js +1 -2
- package/dist/reservation/vehicle.js +186 -24
- package/dist/slack.js +273 -67
- package/dist/validation.d.ts +19 -13
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +144 -63
- package/dist/validation.js.map +1 -1
- package/dist/vehicle/vehicle-pricing/constants.js +36 -33
- package/dist/vehicle/vehicle-pricing/index.js +257 -99
- package/dist/vehicle/vehicle-pricing/types.js +1 -2
- package/package.json +9 -9
|
@@ -1,81 +1,123 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function ownKeys(object, enumerableOnly) {
|
|
30
|
+
var keys = Object.keys(object);
|
|
31
|
+
if (Object.getOwnPropertySymbols) {
|
|
32
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
+
if (enumerableOnly) {
|
|
34
|
+
symbols = symbols.filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
keys.push.apply(keys, symbols);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
function _object_spread_props(target, source) {
|
|
43
|
+
source = source != null ? source : {};
|
|
44
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
+
} else {
|
|
47
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
1
53
|
import { z } from 'zod';
|
|
2
54
|
import { notionRichTextSchema } from './block.js';
|
|
3
|
-
import { commonPropertyValues, notionCommonColorEnum, notionDateFormat, notionDateSchema, notionTimeFormat
|
|
55
|
+
import { commonPropertyValues, notionCommonColorEnum, notionDateFormat, notionDateSchema, notionTimeFormat } from './common.js';
|
|
4
56
|
import { notionEmojiSchema } from './emoji.js';
|
|
5
57
|
import { notionFileSchema } from './file.js';
|
|
6
58
|
import { notionDatabaseParentSchema } from './parent.js';
|
|
7
59
|
import { notionPartialUserSchema, notionUserSchema } from './user.js';
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
28
|
-
export const notionPagePropertyFilesSchema = z.object({
|
|
29
|
-
...commonPropertyValues('files'),
|
|
30
|
-
files: z.array(notionFileSchema),
|
|
31
|
-
});
|
|
32
|
-
export const notionPagePropertyFormulaSchema = z.object({
|
|
33
|
-
...commonPropertyValues('formula'),
|
|
60
|
+
export var notionPagePropertyCheckboxSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('checkbox')), {
|
|
61
|
+
checkbox: z.boolean()
|
|
62
|
+
}));
|
|
63
|
+
export var notionPagePropertyCreatedBySchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('created_by')), {
|
|
64
|
+
created_by: notionUserSchema
|
|
65
|
+
}));
|
|
66
|
+
export var notionPagePropertyCreatedTimeSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('created_time')), {
|
|
67
|
+
created_time: notionTimeFormat
|
|
68
|
+
}));
|
|
69
|
+
export var notionPagePropertyDateSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('date')), {
|
|
70
|
+
date: notionDateSchema.nullable()
|
|
71
|
+
}));
|
|
72
|
+
export var notionPagePropertyEmailSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('email')), {
|
|
73
|
+
email: z.string()
|
|
74
|
+
}));
|
|
75
|
+
export var notionPagePropertyFilesSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('files')), {
|
|
76
|
+
files: z.array(notionFileSchema)
|
|
77
|
+
}));
|
|
78
|
+
export var notionPagePropertyFormulaSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('formula')), {
|
|
34
79
|
formula: z.object({
|
|
35
|
-
type: z.enum([
|
|
80
|
+
type: z.enum([
|
|
81
|
+
'boolean',
|
|
82
|
+
'date',
|
|
83
|
+
'number',
|
|
84
|
+
'string'
|
|
85
|
+
]),
|
|
36
86
|
boolean: z.boolean().optional(),
|
|
37
87
|
date: notionDateFormat.optional(),
|
|
38
88
|
number: z.number().optional(),
|
|
39
|
-
string: z.string().optional()
|
|
40
|
-
})
|
|
41
|
-
});
|
|
42
|
-
export
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
export const notionPagePropertyMultiSelectSchema = z.object({
|
|
51
|
-
...commonPropertyValues('multi_select'),
|
|
89
|
+
string: z.string().optional()
|
|
90
|
+
})
|
|
91
|
+
}));
|
|
92
|
+
export var notionPagePropertyLastEditedBySchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('last_edited_by')), {
|
|
93
|
+
last_edited_by: notionUserSchema
|
|
94
|
+
}));
|
|
95
|
+
export var notionPagePropertyLastEditedTimeSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('last_edited_time')), {
|
|
96
|
+
last_edited_time: notionTimeFormat
|
|
97
|
+
}));
|
|
98
|
+
export var notionPagePropertyMultiSelectSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('multi_select')), {
|
|
52
99
|
multi_select: z.array(z.object({
|
|
53
100
|
id: z.string(),
|
|
54
101
|
name: z.string(),
|
|
55
|
-
color: notionCommonColorEnum
|
|
56
|
-
}))
|
|
57
|
-
});
|
|
58
|
-
export
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
phone_number: z.string(),
|
|
69
|
-
});
|
|
70
|
-
export const notionPagePropertyRelationSchema = z.object({
|
|
71
|
-
...commonPropertyValues('relation'),
|
|
102
|
+
color: notionCommonColorEnum
|
|
103
|
+
}))
|
|
104
|
+
}));
|
|
105
|
+
export var notionPagePropertyNumberSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('number')), {
|
|
106
|
+
number: z.number().nullable()
|
|
107
|
+
}));
|
|
108
|
+
export var notionPagePropertyPeopleSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('people')), {
|
|
109
|
+
people: z.array(notionUserSchema)
|
|
110
|
+
}));
|
|
111
|
+
export var notionPagePropertyPhoneNumberSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('phone_number')), {
|
|
112
|
+
phone_number: z.string()
|
|
113
|
+
}));
|
|
114
|
+
export var notionPagePropertyRelationSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('relation')), {
|
|
72
115
|
relation: z.array(z.object({
|
|
73
|
-
id: z.string()
|
|
116
|
+
id: z.string()
|
|
74
117
|
})),
|
|
75
|
-
has_more: z.boolean()
|
|
76
|
-
});
|
|
77
|
-
export
|
|
78
|
-
...commonPropertyValues('rollup'),
|
|
118
|
+
has_more: z.boolean()
|
|
119
|
+
}));
|
|
120
|
+
export var notionPagePropertyRollupSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('rollup')), {
|
|
79
121
|
rollup: z.object({
|
|
80
122
|
array: z.array(z.any()).optional(),
|
|
81
123
|
date: notionDateFormat.optional(),
|
|
@@ -106,76 +148,79 @@ export const notionPagePropertyRollupSchema = z.object({
|
|
|
106
148
|
'show_unique',
|
|
107
149
|
'sum',
|
|
108
150
|
'unchecked',
|
|
109
|
-
'unique'
|
|
151
|
+
'unique'
|
|
110
152
|
]),
|
|
111
|
-
type: z.enum([
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
153
|
+
type: z.enum([
|
|
154
|
+
'array',
|
|
155
|
+
'date',
|
|
156
|
+
'incomplete',
|
|
157
|
+
'number',
|
|
158
|
+
'unsupported'
|
|
159
|
+
])
|
|
160
|
+
})
|
|
161
|
+
}));
|
|
162
|
+
export var notionPagePropertyRichTextSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('rich_text')), {
|
|
163
|
+
rich_text: z.array(notionRichTextSchema)
|
|
164
|
+
}));
|
|
165
|
+
export var notionPagePropertySelectSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('select')), {
|
|
166
|
+
select: z.object({
|
|
122
167
|
id: z.string(),
|
|
123
168
|
name: z.string(),
|
|
124
|
-
color: notionCommonColorEnum
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
})
|
|
128
|
-
export const notionPagePropertyStatusSchema = z.object({
|
|
129
|
-
...commonPropertyValues('status'),
|
|
169
|
+
color: notionCommonColorEnum
|
|
170
|
+
}).nullable()
|
|
171
|
+
}));
|
|
172
|
+
export var notionPagePropertyStatusSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('status')), {
|
|
130
173
|
status: z.object({
|
|
131
174
|
id: z.string(),
|
|
132
175
|
name: z.string(),
|
|
133
|
-
color: notionCommonColorEnum
|
|
134
|
-
})
|
|
135
|
-
});
|
|
136
|
-
export
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
});
|
|
144
|
-
export const notionPagePropertyUniqueIdSchema = z.object({
|
|
145
|
-
...commonPropertyValues('unique_id'),
|
|
176
|
+
color: notionCommonColorEnum
|
|
177
|
+
})
|
|
178
|
+
}));
|
|
179
|
+
export var notionPagePropertyTitleSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('title')), {
|
|
180
|
+
title: z.array(notionRichTextSchema)
|
|
181
|
+
}));
|
|
182
|
+
export var notionPagePropertyUrlSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('url')), {
|
|
183
|
+
url: z.string().url().nullable()
|
|
184
|
+
}));
|
|
185
|
+
export var notionPagePropertyUniqueIdSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('unique_id')), {
|
|
146
186
|
unique_id: z.object({
|
|
147
187
|
number: z.number(),
|
|
148
|
-
prefix: z.string().nullable().optional()
|
|
149
|
-
})
|
|
150
|
-
});
|
|
151
|
-
export
|
|
152
|
-
...commonPropertyValues('verification'),
|
|
188
|
+
prefix: z.string().nullable().optional()
|
|
189
|
+
})
|
|
190
|
+
}));
|
|
191
|
+
export var notionPagePropertyVerificationSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('verification')), {
|
|
153
192
|
verification: z.object({
|
|
154
|
-
state: z.enum([
|
|
193
|
+
state: z.enum([
|
|
194
|
+
'verified',
|
|
195
|
+
'unverified'
|
|
196
|
+
]),
|
|
155
197
|
verified_by: notionUserSchema.nullable(),
|
|
156
|
-
date: notionDateSchema
|
|
157
|
-
})
|
|
158
|
-
});
|
|
159
|
-
export
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
})
|
|
181
|
-
|
|
198
|
+
date: notionDateSchema
|
|
199
|
+
})
|
|
200
|
+
}));
|
|
201
|
+
export var notionPageSchema = function(properties) {
|
|
202
|
+
return z.object({
|
|
203
|
+
object: z.literal('page'),
|
|
204
|
+
id: z.string(),
|
|
205
|
+
created_time: notionTimeFormat,
|
|
206
|
+
created_by: notionPartialUserSchema,
|
|
207
|
+
last_edited_time: notionTimeFormat,
|
|
208
|
+
last_edited_by: notionPartialUserSchema,
|
|
209
|
+
archived: z.boolean(),
|
|
210
|
+
icon: notionFileSchema.or(notionEmojiSchema).nullable(),
|
|
211
|
+
properties: properties,
|
|
212
|
+
parent: notionDatabaseParentSchema,
|
|
213
|
+
url: z.string().url(),
|
|
214
|
+
public_url: z.string().nullable()
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
export var notionPagesSchema = function(properties) {
|
|
218
|
+
return z.object({
|
|
219
|
+
has_more: z.boolean(),
|
|
220
|
+
next_cursor: z.string().nullable(),
|
|
221
|
+
object: z.literal('list'),
|
|
222
|
+
page_or_database: z.object({}),
|
|
223
|
+
type: z.literal('page_or_database'),
|
|
224
|
+
results: z.array(notionPageSchema(properties))
|
|
225
|
+
});
|
|
226
|
+
};
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export
|
|
2
|
+
export var notionDatabaseParentSchema = z.object({
|
|
3
3
|
type: z.literal('database_id'),
|
|
4
|
-
database_id: z.string()
|
|
4
|
+
database_id: z.string()
|
|
5
5
|
});
|
|
6
|
-
export
|
|
6
|
+
export var notionPageParentSchema = z.object({
|
|
7
7
|
type: z.literal('page_id'),
|
|
8
|
-
page_id: z.string()
|
|
8
|
+
page_id: z.string()
|
|
9
9
|
});
|
|
10
|
-
export
|
|
10
|
+
export var notionWorkspaceParentSchema = z.object({
|
|
11
11
|
type: z.literal('workspace'),
|
|
12
|
-
workspace: z.literal(true)
|
|
12
|
+
workspace: z.literal(true)
|
|
13
13
|
});
|
|
14
|
-
export
|
|
14
|
+
export var 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,31 +1,30 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export
|
|
2
|
+
export var notionPartialUserSchema = z.object({
|
|
3
3
|
object: z.literal('user'),
|
|
4
|
-
user: z.string().optional()
|
|
4
|
+
user: z.string().optional()
|
|
5
5
|
});
|
|
6
|
-
export
|
|
6
|
+
export var notionUserSchema = z.object({
|
|
7
7
|
object: z.literal('user'),
|
|
8
8
|
id: z.string(),
|
|
9
|
-
type: z.enum([
|
|
9
|
+
type: z.enum([
|
|
10
|
+
'person',
|
|
11
|
+
'bot'
|
|
12
|
+
]).optional(),
|
|
10
13
|
name: z.string().optional(),
|
|
11
14
|
avatar_url: z.string().nullable().optional(),
|
|
12
15
|
// type person
|
|
13
|
-
person: z
|
|
14
|
-
.
|
|
15
|
-
|
|
16
|
-
})
|
|
17
|
-
.optional(),
|
|
16
|
+
person: z.object({
|
|
17
|
+
email: z.string().email()
|
|
18
|
+
}).optional(),
|
|
18
19
|
// type bot
|
|
19
|
-
bot: z
|
|
20
|
-
.object({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
workspace_name: z.string().optional()
|
|
28
|
-
})
|
|
29
|
-
.optional(),
|
|
20
|
+
bot: z.object({
|
|
21
|
+
owner: z.object({
|
|
22
|
+
type: z.enum([
|
|
23
|
+
'workspace',
|
|
24
|
+
'user'
|
|
25
|
+
]),
|
|
26
|
+
workspace: z.boolean()
|
|
27
|
+
}).optional(),
|
|
28
|
+
workspace_name: z.string().optional()
|
|
29
|
+
}).optional()
|
|
30
30
|
});
|
|
31
|
-
//# sourceMappingURL=user.js.map
|
|
@@ -1,23 +1,162 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
+
try {
|
|
3
|
+
var info = gen[key](arg);
|
|
4
|
+
var value = info.value;
|
|
5
|
+
} catch (error) {
|
|
6
|
+
reject(error);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (info.done) {
|
|
10
|
+
resolve(value);
|
|
11
|
+
} else {
|
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _async_to_generator(fn) {
|
|
16
|
+
return function() {
|
|
17
|
+
var self = this, args = arguments;
|
|
18
|
+
return new Promise(function(resolve, reject) {
|
|
19
|
+
var gen = fn.apply(self, args);
|
|
20
|
+
function _next(value) {
|
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
+
}
|
|
23
|
+
function _throw(err) {
|
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
+
}
|
|
26
|
+
_next(undefined);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function _ts_generator(thisArg, body) {
|
|
31
|
+
var f, y, t, _ = {
|
|
32
|
+
label: 0,
|
|
33
|
+
sent: function() {
|
|
34
|
+
if (t[0] & 1) throw t[1];
|
|
35
|
+
return t[1];
|
|
36
|
+
},
|
|
37
|
+
trys: [],
|
|
38
|
+
ops: []
|
|
39
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
40
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
41
|
+
return this;
|
|
42
|
+
}), g;
|
|
43
|
+
function verb(n) {
|
|
44
|
+
return function(v) {
|
|
45
|
+
return step([
|
|
46
|
+
n,
|
|
47
|
+
v
|
|
48
|
+
]);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function step(op) {
|
|
52
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
53
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
54
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
55
|
+
if (y = 0, t) op = [
|
|
56
|
+
op[0] & 2,
|
|
57
|
+
t.value
|
|
58
|
+
];
|
|
59
|
+
switch(op[0]){
|
|
60
|
+
case 0:
|
|
61
|
+
case 1:
|
|
62
|
+
t = op;
|
|
63
|
+
break;
|
|
64
|
+
case 4:
|
|
65
|
+
_.label++;
|
|
66
|
+
return {
|
|
67
|
+
value: op[1],
|
|
68
|
+
done: false
|
|
69
|
+
};
|
|
70
|
+
case 5:
|
|
71
|
+
_.label++;
|
|
72
|
+
y = op[1];
|
|
73
|
+
op = [
|
|
74
|
+
0
|
|
75
|
+
];
|
|
76
|
+
continue;
|
|
77
|
+
case 7:
|
|
78
|
+
op = _.ops.pop();
|
|
79
|
+
_.trys.pop();
|
|
80
|
+
continue;
|
|
81
|
+
default:
|
|
82
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
83
|
+
_ = 0;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
87
|
+
_.label = op[1];
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
91
|
+
_.label = t[1];
|
|
92
|
+
t = op;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
if (t && _.label < t[2]) {
|
|
96
|
+
_.label = t[2];
|
|
97
|
+
_.ops.push(op);
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
if (t[2]) _.ops.pop();
|
|
101
|
+
_.trys.pop();
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
op = body.call(thisArg, _);
|
|
105
|
+
} catch (e) {
|
|
106
|
+
op = [
|
|
107
|
+
6,
|
|
108
|
+
e
|
|
109
|
+
];
|
|
110
|
+
y = 0;
|
|
111
|
+
} finally{
|
|
112
|
+
f = t = 0;
|
|
113
|
+
}
|
|
114
|
+
if (op[0] & 5) throw op[1];
|
|
115
|
+
return {
|
|
116
|
+
value: op[0] ? op[1] : void 0,
|
|
117
|
+
done: true
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
1
121
|
import { prisma } from '@driveflux/db';
|
|
2
122
|
import { generateId } from '@driveflux/db/id';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
123
|
+
export var handleAgreeToTerms = function(param) {
|
|
124
|
+
var agreedToTerms = param.agreedToTerms, subscribingUser = param.subscribingUser, ipAddress = param.ipAddress;
|
|
125
|
+
return _async_to_generator(function() {
|
|
126
|
+
return _ts_generator(this, function(_state) {
|
|
127
|
+
switch(_state.label){
|
|
128
|
+
case 0:
|
|
129
|
+
if (!(agreedToTerms && !subscribingUser.consented)) return [
|
|
130
|
+
3,
|
|
131
|
+
2
|
|
132
|
+
];
|
|
133
|
+
return [
|
|
134
|
+
4,
|
|
135
|
+
prisma.user.update({
|
|
136
|
+
where: {
|
|
137
|
+
id: subscribingUser.id
|
|
138
|
+
},
|
|
139
|
+
data: {
|
|
140
|
+
consented: true,
|
|
141
|
+
consents: {
|
|
142
|
+
create: {
|
|
143
|
+
id: generateId('UserConsent'),
|
|
144
|
+
ipAddress: ipAddress,
|
|
145
|
+
consentType: 'terms',
|
|
146
|
+
email: subscribingUser.email
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
];
|
|
152
|
+
case 1:
|
|
153
|
+
subscribingUser = _state.sent();
|
|
154
|
+
_state.label = 2;
|
|
155
|
+
case 2:
|
|
156
|
+
return [
|
|
157
|
+
2
|
|
158
|
+
];
|
|
159
|
+
}
|
|
20
160
|
});
|
|
21
|
-
}
|
|
161
|
+
})();
|
|
22
162
|
};
|
|
23
|
-
//# sourceMappingURL=agree.js.map
|