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

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