@driveflux/api-functions 0.0.7-next.19 → 0.0.7-next.2

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 (90) hide show
  1. package/dist/auth/confirm.js +325 -66
  2. package/dist/auth/emails.js +210 -42
  3. package/dist/auth/formatter.js +9 -9
  4. package/dist/auth/otp.js +374 -120
  5. package/dist/auth/register.js +383 -95
  6. package/dist/auth/register.js.map +1 -1
  7. package/dist/auth/tokens.d.ts +3 -3
  8. package/dist/auth/tokens.js +426 -114
  9. package/dist/auth/verifications.js +581 -176
  10. package/dist/constants.js +4 -4
  11. package/dist/mailjet/calls/manage-contacts-in-list.d.ts +2 -2
  12. package/dist/mailjet/calls/manage-contacts-in-list.d.ts.map +1 -1
  13. package/dist/mailjet/calls/manage-contacts-in-list.js +167 -22
  14. package/dist/mailjet/calls/manage-contacts-in-list.js.map +1 -1
  15. package/dist/mailjet/calls/manage-subscription-status.d.ts +2 -2
  16. package/dist/mailjet/calls/manage-subscription-status.d.ts.map +1 -1
  17. package/dist/mailjet/calls/manage-subscription-status.js +154 -13
  18. package/dist/mailjet/calls/manage-subscription-status.js.map +1 -1
  19. package/dist/mailjet/calls/request-service.js +182 -18
  20. package/dist/mailjet/refresh-email-preferences.js +221 -21
  21. package/dist/mailjet/set-contact.d.ts +2 -2
  22. package/dist/mailjet/set-contact.d.ts.map +1 -1
  23. package/dist/mailjet/set-contact.js +213 -21
  24. package/dist/mailjet/set-contact.js.map +1 -1
  25. package/dist/mailjet/types.d.ts +2 -2
  26. package/dist/mailjet/types.d.ts.map +1 -1
  27. package/dist/mailjet/utils/convert-to-array.d.ts +1 -1
  28. package/dist/mailjet/utils/convert-to-array.d.ts.map +1 -1
  29. package/dist/mailjet/utils/convert-to-array.js +56 -9
  30. package/dist/mailjet/utils/extract-email-preferences.d.ts +1 -1
  31. package/dist/mailjet/utils/extract-email-preferences.d.ts.map +1 -1
  32. package/dist/mailjet/utils/extract-email-preferences.js +214 -37
  33. package/dist/mailjet/utils/lists.js +248 -28
  34. package/dist/mailjet/utils/update-email-references.d.ts +2 -2
  35. package/dist/mailjet/utils/update-email-references.d.ts.map +1 -1
  36. package/dist/mailjet/utils/update-email-references.js +207 -27
  37. package/dist/mailjet/utils/update-email-references.js.map +1 -1
  38. package/dist/notion/client.js +196 -50
  39. package/dist/notion/helpful.js +169 -25
  40. package/dist/notion/schemas/block.js +1 -1
  41. package/dist/notion/schemas/common.js +9 -7
  42. package/dist/notion/schemas/database.d.ts +1 -1
  43. package/dist/notion/schemas/database.js +100 -68
  44. package/dist/notion/schemas/emoji.js +1 -1
  45. package/dist/notion/schemas/file.js +1 -1
  46. package/dist/notion/schemas/kb.js +3 -3
  47. package/dist/notion/schemas/page.d.ts +1 -1
  48. package/dist/notion/schemas/page.js +103 -69
  49. package/dist/notion/schemas/parent.js +4 -4
  50. package/dist/notion/schemas/user.js +2 -2
  51. package/dist/reservation/agree.d.ts +1 -1
  52. package/dist/reservation/agree.d.ts.map +1 -1
  53. package/dist/reservation/agree.js +157 -17
  54. package/dist/reservation/checks.d.ts +1 -1
  55. package/dist/reservation/checks.d.ts.map +1 -1
  56. package/dist/reservation/checks.js +177 -21
  57. package/dist/reservation/display-vehicle.d.ts +1 -1
  58. package/dist/reservation/display-vehicle.js +500 -122
  59. package/dist/reservation/display-vehicle.js.map +1 -1
  60. package/dist/reservation/fetch-or-create.d.ts +2 -2
  61. package/dist/reservation/fetch-or-create.d.ts.map +1 -1
  62. package/dist/reservation/fetch-or-create.js +478 -188
  63. package/dist/reservation/fetch-or-create.js.map +1 -1
  64. package/dist/reservation/invoice.d.ts +3 -3
  65. package/dist/reservation/invoice.d.ts.map +1 -1
  66. package/dist/reservation/invoice.js +492 -182
  67. package/dist/reservation/invoice.js.map +1 -1
  68. package/dist/reservation/payer.d.ts +1 -1
  69. package/dist/reservation/payer.d.ts.map +1 -1
  70. package/dist/reservation/payer.js +175 -25
  71. package/dist/reservation/reserve.d.ts +1 -1
  72. package/dist/reservation/reserve.d.ts.map +1 -1
  73. package/dist/reservation/reserve.js +196 -35
  74. package/dist/reservation/reserve.js.map +1 -1
  75. package/dist/reservation/types.d.ts +0 -1
  76. package/dist/reservation/types.d.ts.map +1 -1
  77. package/dist/reservation/vehicle.d.ts +1 -1
  78. package/dist/reservation/vehicle.d.ts.map +1 -1
  79. package/dist/reservation/vehicle.js +188 -23
  80. package/dist/reservation/vehicle.js.map +1 -1
  81. package/dist/slack.js +268 -57
  82. package/dist/validation.js +98 -38
  83. package/dist/vehicle/vehicle-pricing/constants.d.ts +1 -1
  84. package/dist/vehicle/vehicle-pricing/constants.d.ts.map +1 -1
  85. package/dist/vehicle/vehicle-pricing/constants.js +16 -16
  86. package/dist/vehicle/vehicle-pricing/index.d.ts +1 -1
  87. package/dist/vehicle/vehicle-pricing/index.d.ts.map +1 -1
  88. package/dist/vehicle/vehicle-pricing/index.js +259 -87
  89. package/dist/vehicle/vehicle-pricing/index.js.map +1 -1
  90. package/package.json +21 -21
@@ -1,3 +1,55 @@
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
55
  import { commonPropertyValues, notionCommonColorEnum, notionDateFormat, notionDateSchema, notionTimeFormat } from './common.js';
@@ -5,32 +57,25 @@ 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 const notionPagePropertyCheckboxSchema = z.object({
9
- ...commonPropertyValues('checkbox'),
60
+ export var notionPagePropertyCheckboxSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('checkbox')), {
10
61
  checkbox: z.boolean()
11
- });
12
- export const notionPagePropertyCreatedBySchema = z.object({
13
- ...commonPropertyValues('created_by'),
62
+ }));
63
+ export var notionPagePropertyCreatedBySchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('created_by')), {
14
64
  created_by: notionUserSchema
15
- });
16
- export const notionPagePropertyCreatedTimeSchema = z.object({
17
- ...commonPropertyValues('created_time'),
65
+ }));
66
+ export var notionPagePropertyCreatedTimeSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('created_time')), {
18
67
  created_time: notionTimeFormat
19
- });
20
- export const notionPagePropertyDateSchema = z.object({
21
- ...commonPropertyValues('date'),
68
+ }));
69
+ export var notionPagePropertyDateSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('date')), {
22
70
  date: notionDateSchema.nullable()
23
- });
24
- export const notionPagePropertyEmailSchema = z.object({
25
- ...commonPropertyValues('email'),
71
+ }));
72
+ export var notionPagePropertyEmailSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('email')), {
26
73
  email: z.string()
27
- });
28
- export const notionPagePropertyFilesSchema = z.object({
29
- ...commonPropertyValues('files'),
74
+ }));
75
+ export var notionPagePropertyFilesSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('files')), {
30
76
  files: z.array(notionFileSchema)
31
- });
32
- export const notionPagePropertyFormulaSchema = z.object({
33
- ...commonPropertyValues('formula'),
77
+ }));
78
+ export var notionPagePropertyFormulaSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('formula')), {
34
79
  formula: z.object({
35
80
  type: z.enum([
36
81
  'boolean',
@@ -43,44 +88,36 @@ export const notionPagePropertyFormulaSchema = z.object({
43
88
  number: z.number().optional(),
44
89
  string: z.string().optional()
45
90
  })
46
- });
47
- export const notionPagePropertyLastEditedBySchema = z.object({
48
- ...commonPropertyValues('last_edited_by'),
91
+ }));
92
+ export var notionPagePropertyLastEditedBySchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('last_edited_by')), {
49
93
  last_edited_by: notionUserSchema
50
- });
51
- export const notionPagePropertyLastEditedTimeSchema = z.object({
52
- ...commonPropertyValues('last_edited_time'),
94
+ }));
95
+ export var notionPagePropertyLastEditedTimeSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('last_edited_time')), {
53
96
  last_edited_time: notionTimeFormat
54
- });
55
- export const notionPagePropertyMultiSelectSchema = z.object({
56
- ...commonPropertyValues('multi_select'),
97
+ }));
98
+ export var notionPagePropertyMultiSelectSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('multi_select')), {
57
99
  multi_select: z.array(z.object({
58
100
  id: z.string(),
59
101
  name: z.string(),
60
102
  color: notionCommonColorEnum
61
103
  }))
62
- });
63
- export const notionPagePropertyNumberSchema = z.object({
64
- ...commonPropertyValues('number'),
104
+ }));
105
+ export var notionPagePropertyNumberSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('number')), {
65
106
  number: z.number().nullable()
66
- });
67
- export const notionPagePropertyPeopleSchema = z.object({
68
- ...commonPropertyValues('people'),
107
+ }));
108
+ export var notionPagePropertyPeopleSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('people')), {
69
109
  people: z.array(notionUserSchema)
70
- });
71
- export const notionPagePropertyPhoneNumberSchema = z.object({
72
- ...commonPropertyValues('phone_number'),
110
+ }));
111
+ export var notionPagePropertyPhoneNumberSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('phone_number')), {
73
112
  phone_number: z.string()
74
- });
75
- export const notionPagePropertyRelationSchema = z.object({
76
- ...commonPropertyValues('relation'),
113
+ }));
114
+ export var notionPagePropertyRelationSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('relation')), {
77
115
  relation: z.array(z.object({
78
116
  id: z.string()
79
117
  })),
80
118
  has_more: z.boolean()
81
- });
82
- export const notionPagePropertyRollupSchema = z.object({
83
- ...commonPropertyValues('rollup'),
119
+ }));
120
+ export var notionPagePropertyRollupSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('rollup')), {
84
121
  rollup: z.object({
85
122
  array: z.array(z.any()).optional(),
86
123
  date: notionDateFormat.optional(),
@@ -121,44 +158,37 @@ export const notionPagePropertyRollupSchema = z.object({
121
158
  'unsupported'
122
159
  ])
123
160
  })
124
- });
125
- export const notionPagePropertyRichTextSchema = z.object({
126
- ...commonPropertyValues('rich_text'),
161
+ }));
162
+ export var notionPagePropertyRichTextSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('rich_text')), {
127
163
  rich_text: z.array(notionRichTextSchema)
128
- });
129
- export const notionPagePropertySelectSchema = z.object({
130
- ...commonPropertyValues('select'),
164
+ }));
165
+ export var notionPagePropertySelectSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('select')), {
131
166
  select: z.object({
132
167
  id: z.string(),
133
168
  name: z.string(),
134
169
  color: notionCommonColorEnum
135
170
  }).nullable()
136
- });
137
- export const notionPagePropertyStatusSchema = z.object({
138
- ...commonPropertyValues('status'),
171
+ }));
172
+ export var notionPagePropertyStatusSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('status')), {
139
173
  status: z.object({
140
174
  id: z.string(),
141
175
  name: z.string(),
142
176
  color: notionCommonColorEnum
143
177
  })
144
- });
145
- export const notionPagePropertyTitleSchema = z.object({
146
- ...commonPropertyValues('title'),
178
+ }));
179
+ export var notionPagePropertyTitleSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('title')), {
147
180
  title: z.array(notionRichTextSchema)
148
- });
149
- export const notionPagePropertyUrlSchema = z.object({
150
- ...commonPropertyValues('url'),
181
+ }));
182
+ export var notionPagePropertyUrlSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('url')), {
151
183
  url: z.string().url().nullable()
152
- });
153
- export const notionPagePropertyUniqueIdSchema = z.object({
154
- ...commonPropertyValues('unique_id'),
184
+ }));
185
+ export var notionPagePropertyUniqueIdSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('unique_id')), {
155
186
  unique_id: z.object({
156
187
  number: z.number(),
157
188
  prefix: z.string().nullable().optional()
158
189
  })
159
- });
160
- export const notionPagePropertyVerificationSchema = z.object({
161
- ...commonPropertyValues('verification'),
190
+ }));
191
+ export var notionPagePropertyVerificationSchema = z.object(_object_spread_props(_object_spread({}, commonPropertyValues('verification')), {
162
192
  verification: z.object({
163
193
  state: z.enum([
164
194
  'verified',
@@ -167,8 +197,9 @@ export const notionPagePropertyVerificationSchema = z.object({
167
197
  verified_by: notionUserSchema.nullable(),
168
198
  date: notionDateSchema
169
199
  })
170
- });
171
- export const notionPageSchema = (properties)=>z.object({
200
+ }));
201
+ export var notionPageSchema = function(properties) {
202
+ return z.object({
172
203
  object: z.literal('page'),
173
204
  id: z.string(),
174
205
  created_time: notionTimeFormat,
@@ -177,12 +208,14 @@ export const notionPageSchema = (properties)=>z.object({
177
208
  last_edited_by: notionPartialUserSchema,
178
209
  archived: z.boolean(),
179
210
  icon: notionFileSchema.or(notionEmojiSchema).nullable(),
180
- properties,
211
+ properties: properties,
181
212
  parent: notionDatabaseParentSchema,
182
213
  url: z.string().url(),
183
214
  public_url: z.string().nullable()
184
215
  });
185
- export const notionPagesSchema = (properties)=>z.object({
216
+ };
217
+ export var notionPagesSchema = function(properties) {
218
+ return z.object({
186
219
  has_more: z.boolean(),
187
220
  next_cursor: z.string().nullable(),
188
221
  object: z.literal('list'),
@@ -190,3 +223,4 @@ export const notionPagesSchema = (properties)=>z.object({
190
223
  type: z.literal('page_or_database'),
191
224
  results: z.array(notionPageSchema(properties))
192
225
  });
226
+ };
@@ -1,17 +1,17 @@
1
1
  import { z } from 'zod';
2
- export const notionDatabaseParentSchema = z.object({
2
+ export var notionDatabaseParentSchema = z.object({
3
3
  type: z.literal('database_id'),
4
4
  database_id: z.string()
5
5
  });
6
- export const notionPageParentSchema = z.object({
6
+ export var notionPageParentSchema = z.object({
7
7
  type: z.literal('page_id'),
8
8
  page_id: z.string()
9
9
  });
10
- export const notionWorkspaceParentSchema = z.object({
10
+ export var notionWorkspaceParentSchema = z.object({
11
11
  type: z.literal('workspace'),
12
12
  workspace: z.literal(true)
13
13
  });
14
- export const notionBlockParentSchema = z.object({
14
+ export var notionBlockParentSchema = z.object({
15
15
  type: z.literal('block_id'),
16
16
  block_id: z.string()
17
17
  });
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
- export const notionPartialUserSchema = z.object({
2
+ export var notionPartialUserSchema = z.object({
3
3
  object: z.literal('user'),
4
4
  user: z.string().optional()
5
5
  });
6
- export const notionUserSchema = z.object({
6
+ export var notionUserSchema = z.object({
7
7
  object: z.literal('user'),
8
8
  id: z.string(),
9
9
  type: z.enum([
@@ -1,3 +1,3 @@
1
- import type { ReserveVehicleParams } from './types.js';
1
+ import type { ReserveVehicleParams } from './types';
2
2
  export declare const handleAgreeToTerms: ({ agreedToTerms, subscribingUser, ipAddress, }: Pick<ReserveVehicleParams, "agreedToTerms" | "subscribingUser" | "ipAddress">) => Promise<void>;
3
3
  //# sourceMappingURL=agree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agree.d.ts","sourceRoot":"","sources":["../../src/reservation/agree.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEtD,eAAO,MAAM,kBAAkB,GAAU,gDAItC,IAAI,CACN,oBAAoB,EACpB,eAAe,GAAG,iBAAiB,GAAG,WAAW,CACjD,kBAmBA,CAAA"}
1
+ {"version":3,"file":"agree.d.ts","sourceRoot":"","sources":["../../src/reservation/agree.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEnD,eAAO,MAAM,kBAAkB,GAAU,gDAItC,IAAI,CACN,oBAAoB,EACpB,eAAe,GAAG,iBAAiB,GAAG,WAAW,CACjD,kBAmBA,CAAA"}
@@ -1,22 +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 const handleAgreeToTerms = async ({ agreedToTerms, subscribingUser, ipAddress })=>{
4
- if (agreedToTerms && !subscribingUser.consented) {
5
- subscribingUser = await prisma.user.update({
6
- where: {
7
- id: subscribingUser.id
8
- },
9
- data: {
10
- consented: true,
11
- consents: {
12
- create: {
13
- id: generateId('UserConsent'),
14
- ipAddress,
15
- consentType: 'terms',
16
- email: subscribingUser.email
17
- }
18
- }
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
+ ];
19
159
  }
20
160
  });
21
- }
161
+ })();
22
162
  };
@@ -1,6 +1,6 @@
1
1
  import type { Host, PlanType, Vehicle } from '@driveflux/db';
2
2
  import { type PromisedResult } from '@driveflux/result';
3
- import type { ReserveVehicleParams } from './types.js';
3
+ import type { ReserveVehicleParams } from './types';
4
4
  export declare const checkIfUserCanReserve: ({ requestUser, subscribingUser, }: Pick<ReserveVehicleParams, "requestUser" | "subscribingUser">) => Promise<import("@driveflux/auth/authorization/types").AppAbility>;
5
5
  export declare const checkIfVehicleIsAvailableForReservation: (vehicle: Vehicle & {
6
6
  host: Pick<Host, "id"> | null;
@@ -1 +1 @@
1
- {"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../src/reservation/checks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAQ,OAAO,EAAE,MAAM,eAAe,CAAA;AAMlE,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEtD,eAAO,MAAM,qBAAqB,GAAU,mCAGzC,IAAI,CAAC,oBAAoB,EAAE,aAAa,GAAG,iBAAiB,CAAC,sEAU/D,CAAA;AAED,eAAO,MAAM,uCAAuC,GACnD,SAAS,OAAO,GAAG;IAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,CAAA;CAAE,EACpD,MAAM,QAAQ,EACd,gBAAgB,OAAO,KACrB,cAAc,CAAC,OAAO,CAuCxB,CAAA"}
1
+ {"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../src/reservation/checks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAQ,OAAO,EAAE,MAAM,eAAe,CAAA;AAMlE,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEnD,eAAO,MAAM,qBAAqB,GAAU,mCAGzC,IAAI,CAAC,oBAAoB,EAAE,aAAa,GAAG,iBAAiB,CAAC,sEAU/D,CAAA;AAED,eAAO,MAAM,uCAAuC,GACnD,SAAS,OAAO,GAAG;IAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,CAAA;CAAE,EACpD,MAAM,QAAQ,EACd,gBAAgB,OAAO,KACrB,cAAc,CAAC,OAAO,CAuCxB,CAAA"}