@driveflux/api-functions 1.0.71 → 1.0.72

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 (67) hide show
  1. package/dist/auth/confirm.js +29 -24
  2. package/dist/auth/emails.js +13 -12
  3. package/dist/auth/formatter.js +5 -5
  4. package/dist/auth/otp.js +50 -66
  5. package/dist/auth/register.js +34 -42
  6. package/dist/auth/tokens.d.ts +3 -3
  7. package/dist/auth/tokens.js +55 -58
  8. package/dist/auth/verifications.js +52 -53
  9. package/dist/constants.js +1 -0
  10. package/dist/create-logger.js +2 -1
  11. package/dist/mailjet/calls/manage-contacts-in-list.js +6 -5
  12. package/dist/mailjet/calls/manage-subscription-status.js +5 -4
  13. package/dist/mailjet/calls/request-service.js +6 -7
  14. package/dist/mailjet/refresh-email-preferences.js +12 -11
  15. package/dist/mailjet/set-contact.js +12 -11
  16. package/dist/mailjet/types.js +2 -1
  17. package/dist/mailjet/utils/convert-to-array.js +6 -8
  18. package/dist/mailjet/utils/extract-email-preferences.js +15 -14
  19. package/dist/mailjet/utils/lists.js +8 -7
  20. package/dist/mailjet/utils/update-email-references.js +15 -16
  21. package/dist/notion/client.js +19 -22
  22. package/dist/notion/helpful.js +9 -6
  23. package/dist/notion/schemas/block.js +48 -42
  24. package/dist/notion/schemas/common.js +14 -9
  25. package/dist/notion/schemas/database.d.ts +3 -3
  26. package/dist/notion/schemas/database.js +60 -62
  27. package/dist/notion/schemas/emoji.js +2 -1
  28. package/dist/notion/schemas/file.d.ts +1 -1
  29. package/dist/notion/schemas/file.js +9 -9
  30. package/dist/notion/schemas/kb.d.ts +4 -4
  31. package/dist/notion/schemas/kb.js +6 -5
  32. package/dist/notion/schemas/page.d.ts +4 -4
  33. package/dist/notion/schemas/page.js +61 -72
  34. package/dist/notion/schemas/parent.js +5 -4
  35. package/dist/notion/schemas/user.js +19 -18
  36. package/dist/reservation/agree.d.ts +308 -1
  37. package/dist/reservation/agree.js +7 -6
  38. package/dist/reservation/checks.d.ts +1 -1
  39. package/dist/reservation/checks.js +4 -3
  40. package/dist/reservation/display-vehicle.d.ts +21 -16
  41. package/dist/reservation/display-vehicle.d.ts.map +1 -1
  42. package/dist/reservation/display-vehicle.js +74 -66
  43. package/dist/reservation/display-vehicle.js.map +1 -1
  44. package/dist/reservation/ensure-user-billing-address.js +11 -9
  45. package/dist/reservation/fetch-or-create.d.ts +2 -2
  46. package/dist/reservation/fetch-or-create.d.ts.map +1 -1
  47. package/dist/reservation/fetch-or-create.js +102 -83
  48. package/dist/reservation/fetch-or-create.js.map +1 -1
  49. package/dist/reservation/invoice.d.ts +3 -3
  50. package/dist/reservation/invoice.d.ts.map +1 -1
  51. package/dist/reservation/invoice.js +125 -76
  52. package/dist/reservation/invoice.js.map +1 -1
  53. package/dist/reservation/payer.js +6 -5
  54. package/dist/reservation/payment-intent-sync.js +6 -4
  55. package/dist/reservation/reserve.d.ts.map +1 -1
  56. package/dist/reservation/reserve.js +5 -3
  57. package/dist/reservation/reserve.js.map +1 -1
  58. package/dist/reservation/types.d.ts +1 -0
  59. package/dist/reservation/types.d.ts.map +1 -1
  60. package/dist/reservation/types.js +2 -1
  61. package/dist/reservation/vehicle.js +16 -13
  62. package/dist/slack.js +29 -24
  63. package/dist/validation.js +79 -77
  64. package/dist/vehicle/vehicle-pricing/constants.js +19 -22
  65. package/dist/vehicle/vehicle-pricing/index.js +42 -28
  66. package/dist/vehicle/vehicle-pricing/types.js +2 -1
  67. package/package.json +11 -10
@@ -11,30 +11,34 @@ import { sendVerificationEmail } from './verifications.js';
11
11
  const Body = z.object({
12
12
  firstName: z.string(),
13
13
  lastName: z.string(),
14
- phoneNumber: z.string().transform((s)=>s.replace(/[\s-]/g, '')),
14
+ phoneNumber: z.string().transform((s) => s.replace(/[\s-]/g, '')),
15
15
  code: z.string().optional().nullable(),
16
- email: z.string().email().transform((s)=>s.toLowerCase().trim()),
17
- pageSource: z.string().optional().nullable()
16
+ email: z
17
+ .string()
18
+ .email()
19
+ .transform((s) => s.toLowerCase().trim()),
20
+ pageSource: z.string().optional().nullable(),
18
21
  });
19
- export const handleConfirmUser = async (b, user, xForwardedFor)=>{
22
+ export const handleConfirmUser = async (b, user, xForwardedFor) => {
20
23
  const { phoneNumber, email, code, pageSource, ...body } = Body.parse(b);
21
24
  let phoneNumberVerified = false;
22
25
  if (code) {
23
- const tokenResult = await verifyToken(code, {
24
- scope: 'verify-phone'
25
- });
26
+ const tokenResult = await verifyToken(code, { scope: 'verify-phone' });
26
27
  if (tokenResult.err) {
27
28
  return new Err(makeProblem(PROBLEM_CONFLICT, 'Invalid OTP token'));
28
29
  }
29
30
  await clearToken(tokenResult.val.id);
30
31
  phoneNumberVerified = true;
31
- } else {
32
+ }
33
+ else {
32
34
  phoneNumberVerified = user.phoneNumberVerified;
33
35
  }
34
- const method = isMetadata(user?.metadata) ? user?.metadata?.signupProvider : undefined;
36
+ const method = isMetadata(user?.metadata)
37
+ ? user?.metadata?.signupProvider
38
+ : undefined;
35
39
  const updatedUser = await prisma.user.update({
36
40
  where: {
37
- id: user.id
41
+ id: user.id,
38
42
  },
39
43
  data: {
40
44
  ...body,
@@ -43,41 +47,42 @@ export const handleConfirmUser = async (b, user, xForwardedFor)=>{
43
47
  preferredLocale: 'en',
44
48
  phoneNumberVerified,
45
49
  consented: true,
46
- groups: [
47
- 'member'
48
- ],
50
+ groups: ['member'],
49
51
  signupParams: {
50
52
  method,
51
- source: pageSource
53
+ source: pageSource,
52
54
  },
53
55
  consents: {
54
56
  create: {
55
57
  id: generateId('UserConsent'),
56
- ipAddress: Array.isArray(xForwardedFor) ? xForwardedFor?.[0] || '0.0.0.0' : xForwardedFor || '0.0.0.0',
58
+ ipAddress: Array.isArray(xForwardedFor)
59
+ ? xForwardedFor?.[0] || '0.0.0.0'
60
+ : xForwardedFor || '0.0.0.0',
57
61
  consentType: 'terms',
58
- email: email
59
- }
62
+ email: email,
63
+ },
60
64
  },
61
- registrationComplete: true
62
- }
65
+ registrationComplete: true,
66
+ },
63
67
  });
64
68
  const token = await prisma.token.create({
65
69
  data: {
66
70
  id: generateId('Token'),
67
71
  user: {
68
72
  connect: {
69
- id: updatedUser.id
70
- }
73
+ id: updatedUser.id,
74
+ },
71
75
  },
72
76
  expiresAt: addDays(new Date(), 365),
73
- scope: 'all'
74
- }
77
+ scope: 'all',
78
+ },
75
79
  });
76
80
  // We don't want this to be a task. It should be instant
77
81
  await sendVerificationEmail(updatedUser.id);
78
82
  await refreshEmailPreferences(updatedUser.id);
79
83
  return new Ok({
80
84
  token,
81
- user: updatedUser
85
+ user: updatedUser,
82
86
  });
83
87
  };
88
+ //# sourceMappingURL=confirm.js.map
@@ -4,11 +4,11 @@ import { emailChangedEmail } from '@driveflux/email-templates/flux/email-changed
4
4
  import { passwordChangedEmail } from '@driveflux/email-templates/flux/password-changed';
5
5
  import { makeProblem, PROBLEM_NOT_FOUND } from '@driveflux/problem';
6
6
  import { Err } from '@driveflux/result';
7
- export const sendEmailChangedEmail = async (userId)=>{
7
+ export const sendEmailChangedEmail = async (userId) => {
8
8
  const user = await prisma.user.findUnique({
9
9
  where: {
10
- id: userId
11
- }
10
+ id: userId,
11
+ },
12
12
  });
13
13
  if (!user) {
14
14
  return new Err(makeProblem(PROBLEM_NOT_FOUND, `The user ${userId} was not found`));
@@ -17,20 +17,20 @@ export const sendEmailChangedEmail = async (userId)=>{
17
17
  subject: 'Email change confirmation',
18
18
  to: {
19
19
  name: user.firstName || '',
20
- address: user.email
20
+ address: user.email,
21
21
  },
22
22
  html: emailChangedEmail({
23
23
  user: user.firstName || '',
24
24
  title: 'Email change confirmation',
25
- newEmail: user.email
26
- })
25
+ newEmail: user.email,
26
+ }),
27
27
  });
28
28
  };
29
- export const sendPasswordChangedEmail = async (userId)=>{
29
+ export const sendPasswordChangedEmail = async (userId) => {
30
30
  const user = await prisma.user.findUnique({
31
31
  where: {
32
- id: userId
33
- }
32
+ id: userId,
33
+ },
34
34
  });
35
35
  if (!user) {
36
36
  return new Err(makeProblem(PROBLEM_NOT_FOUND, `The user ${userId} was not found`));
@@ -40,11 +40,12 @@ export const sendPasswordChangedEmail = async (userId)=>{
40
40
  subject: title,
41
41
  to: {
42
42
  name: user.firstName || '',
43
- address: user.email
43
+ address: user.email,
44
44
  },
45
45
  html: passwordChangedEmail({
46
46
  user: user.firstName || '',
47
- title: title
48
- })
47
+ title: title,
48
+ }),
49
49
  });
50
50
  };
51
+ //# sourceMappingURL=emails.js.map
@@ -221,9 +221,9 @@ const knownCountryCodes = [
221
221
  '246',
222
222
  '269',
223
223
  '692',
224
- '383'
224
+ '383',
225
225
  ];
226
- export const cleanupPhoneNumber = (phoneNumber)=>{
226
+ export const cleanupPhoneNumber = (phoneNumber) => {
227
227
  // Remove all characters except numbers and +
228
228
  const cleaned = phoneNumber.replace(/[^\d+]/g, '');
229
229
  // If it doesn't start with +, add it
@@ -232,9 +232,8 @@ export const cleanupPhoneNumber = (phoneNumber)=>{
232
232
  let countryCode = '';
233
233
  let remainingNumber = '';
234
234
  // Try to find the country code by checking the longest matches first
235
- for(let i = 4; i >= 1; i--){
236
- const potentialCode = withPlus.substring(1, 1 + i) // Skip the + and take i digits
237
- ;
235
+ for (let i = 4; i >= 1; i--) {
236
+ const potentialCode = withPlus.substring(1, 1 + i); // Skip the + and take i digits
238
237
  if (knownCountryCodes.includes(potentialCode)) {
239
238
  countryCode = potentialCode;
240
239
  remainingNumber = withPlus.substring(1 + i); // Everything after the country code
@@ -247,3 +246,4 @@ export const cleanupPhoneNumber = (phoneNumber)=>{
247
246
  }
248
247
  return withPlus;
249
248
  };
249
+ //# sourceMappingURL=formatter.js.map
package/dist/auth/otp.js CHANGED
@@ -2,7 +2,7 @@ import { ROLES } from '@driveflux/auth/authorization/constants';
2
2
  import { config } from '@driveflux/config/backend';
3
3
  import { prisma } from '@driveflux/db';
4
4
  import { generateId } from '@driveflux/db/id';
5
- import { makeProblem, PROBLEM_CONFLICT, PROBLEM_INVALID_DATA } from '@driveflux/problem';
5
+ import { makeProblem, PROBLEM_CONFLICT, PROBLEM_INVALID_DATA, } from '@driveflux/problem';
6
6
  import { Err, Ok } from '@driveflux/result';
7
7
  import { addDays } from 'date-fns/addDays';
8
8
  import { z } from 'zod';
@@ -13,46 +13,43 @@ const SendVerificationSMSBody = z.object({
13
13
  phoneNumber: z.string(),
14
14
  checkDuplication: z.boolean().optional().nullable(),
15
15
  includeUser: z.boolean().optional().nullable(),
16
- userId: z.string().optional().nullable()
16
+ userId: z.string().optional().nullable(),
17
17
  });
18
- const VerifyOtpBody = z.object({
19
- scope: z.enum([
20
- 'verify-email',
21
- 'verify-phone'
22
- ]),
23
- email: z.email().optional().transform((email)=>email?.toLowerCase().trim()),
18
+ const VerifyOtpBody = z
19
+ .object({
20
+ scope: z.enum(['verify-email', 'verify-phone']),
21
+ email: z
22
+ .email()
23
+ .optional()
24
+ .transform((email) => email?.toLowerCase().trim()),
24
25
  phoneNumber: z.string().optional(),
25
- code: z.string()
26
- }).refine((d)=>{
26
+ code: z.string(),
27
+ })
28
+ .refine((d) => {
27
29
  if (d.scope === 'verify-email' && !d.email) {
28
30
  return false;
29
31
  }
30
32
  return true;
31
33
  }, {
32
- path: [
33
- 'email'
34
- ],
35
- message: 'Email is required'
36
- }).refine((d)=>{
34
+ path: ['email'],
35
+ message: 'Email is required',
36
+ })
37
+ .refine((d) => {
37
38
  if (d.scope === 'verify-phone' && !d.phoneNumber) {
38
39
  return false;
39
40
  }
40
41
  return true;
41
42
  }, {
42
- path: [
43
- 'phoneNumber'
44
- ],
45
- message: 'Phone number is required'
43
+ path: ['phoneNumber'],
44
+ message: 'Phone number is required',
46
45
  });
47
46
  const INVALID_TOKEN_PROBLEM = makeProblem(PROBLEM_INVALID_DATA, 'Unable to verify token. It could have been expired.');
48
47
  const VerifyOtpOnlyBody = z.object({
49
48
  phoneNumber: z.string().optional(),
50
- code: z.string()
49
+ code: z.string(),
51
50
  });
52
- export const handleVerifyOTPOnly = async ({ phoneNumber, code })=>{
53
- const tokenResult = await verifyToken(code, {
54
- scope: 'verify-phone'
55
- });
51
+ export const handleVerifyOTPOnly = async ({ phoneNumber, code, }) => {
52
+ const tokenResult = await verifyToken(code, { scope: 'verify-phone' });
56
53
  if (tokenResult.err) {
57
54
  console.log('Error verifying token', tokenResult.val);
58
55
  return new Err(INVALID_TOKEN_PROBLEM);
@@ -62,21 +59,13 @@ export const handleVerifyOTPOnly = async ({ phoneNumber, code })=>{
62
59
  // await clearToken(tokenResult.val.id)
63
60
  return new Ok({
64
61
  phoneNumber,
65
- phoneNumberVerified: true
62
+ phoneNumberVerified: true,
66
63
  });
67
64
  };
68
- export const handleVerifyOTP = async (b)=>{
69
- const { scope, email, phoneNumber: preFormattedPhoneNumber, code } = VerifyOtpBody.parse(b);
65
+ export const handleVerifyOTP = async (b) => {
66
+ const { scope, email, phoneNumber: preFormattedPhoneNumber, code, } = VerifyOtpBody.parse(b);
70
67
  const phoneNumber = `+${preFormattedPhoneNumber?.replace(/[^0-9]/g, '')}`;
71
- const tokenResult = await verifyToken(code, {
72
- scope,
73
- metadata: {
74
- email,
75
- phoneNumber
76
- }
77
- }, {
78
- includeUser: true
79
- });
68
+ const tokenResult = await verifyToken(code, { scope, metadata: { email, phoneNumber } }, { includeUser: true });
80
69
  if (tokenResult.err) {
81
70
  return new Err(INVALID_TOKEN_PROBLEM);
82
71
  }
@@ -84,25 +73,25 @@ export const handleVerifyOTP = async (b)=>{
84
73
  return new Err(INVALID_TOKEN_PROBLEM);
85
74
  }
86
75
  const previousUser = tokenResult.val.user;
87
- const userUpdate = scope === 'verify-email' ? {
88
- emailVerified: true,
89
- email
90
- } : {
91
- phoneNumberVerified: true,
92
- phoneNumber
93
- };
76
+ const userUpdate = scope === 'verify-email'
77
+ ? {
78
+ emailVerified: true,
79
+ email,
80
+ }
81
+ : {
82
+ phoneNumberVerified: true,
83
+ phoneNumber,
84
+ };
94
85
  userUpdate.temporary = false;
95
86
  userUpdate.temporaryEmail = null;
96
87
  const userGroups = new Set(tokenResult.val.user?.groups);
97
88
  userGroups.add(ROLES.MEMBER);
98
- userUpdate.groups = [
99
- ...userGroups
100
- ];
89
+ userUpdate.groups = [...userGroups];
101
90
  const user = await prisma.user.update({
102
91
  where: {
103
- id: tokenResult.val.user.id
92
+ id: tokenResult.val.user.id,
104
93
  },
105
- data: userUpdate
94
+ data: userUpdate,
106
95
  });
107
96
  // delete the previous token
108
97
  await clearToken(tokenResult.val.id);
@@ -112,12 +101,12 @@ export const handleVerifyOTP = async (b)=>{
112
101
  id: generateId('Token'),
113
102
  user: {
114
103
  connect: {
115
- id: user?.id
116
- }
104
+ id: user?.id,
105
+ },
117
106
  },
118
107
  expiresAt: addDays(new Date(), 365),
119
- scope: 'all'
120
- }
108
+ scope: 'all',
109
+ },
121
110
  });
122
111
  if (previousUser.email !== user.email) {
123
112
  await sendEmailChangedEmail(user.id);
@@ -125,25 +114,21 @@ export const handleVerifyOTP = async (b)=>{
125
114
  return new Ok({
126
115
  accessToken: token.id,
127
116
  expiresAt: token.expiresAt,
128
- user: user
117
+ user: user,
129
118
  });
130
119
  };
131
- export const handleSendVerificationSMS = async (b)=>{
120
+ export const handleSendVerificationSMS = async (b) => {
132
121
  const { phoneNumber, checkDuplication, userId } = SendVerificationSMSBody.parse(b);
133
122
  const formattedPhoneNumber = `+${phoneNumber.replace(/[^0-9]/g, '')}`;
134
123
  if (checkDuplication) {
135
124
  const user = await prisma.user.findFirst({
136
125
  where: {
137
126
  OR: [
138
- {
139
- phoneNumber: formattedPhoneNumber
140
- },
141
- {
142
- phoneNumber: phoneNumber
143
- }
127
+ { phoneNumber: formattedPhoneNumber },
128
+ { phoneNumber: phoneNumber },
144
129
  ],
145
- phoneNumberVerified: true
146
- }
130
+ phoneNumberVerified: true,
131
+ },
147
132
  });
148
133
  if (user) {
149
134
  return new Err(makeProblem(PROBLEM_CONFLICT, 'This phone number is already registered'));
@@ -156,7 +141,7 @@ export const handleSendVerificationSMS = async (b)=>{
156
141
  }
157
142
  return new Ok({
158
143
  success: true,
159
- code: code.value
144
+ code: code.value,
160
145
  });
161
146
  }
162
147
  // Send the sms verification
@@ -164,7 +149,6 @@ export const handleSendVerificationSMS = async (b)=>{
164
149
  if (verificationResult.err) {
165
150
  return verificationResult;
166
151
  }
167
- return new Ok({
168
- success: true
169
- });
152
+ return new Ok({ success: true });
170
153
  };
154
+ //# sourceMappingURL=otp.js.map
@@ -18,37 +18,32 @@ import { sendVerificationEmail } from './verifications.js';
18
18
  const Body = z.object({
19
19
  firstName: z.string(),
20
20
  lastName: z.string(),
21
- phoneNumber: z.string().transform((s)=>s.replace(/[\s-]/g, '')),
22
- authMethod: z.enum([
23
- 'mobile',
24
- 'email',
25
- 'facebook',
26
- 'google',
27
- 'apple'
28
- ]),
21
+ phoneNumber: z.string().transform((s) => s.replace(/[\s-]/g, '')),
22
+ authMethod: z.enum(['mobile', 'email', 'facebook', 'google', 'apple']),
29
23
  code: z.string().optional().nullable(),
30
24
  keepCode: z.boolean().optional().default(false),
31
- email: z.string().email().transform((s)=>s.toLowerCase().trim()),
32
- dateOfBirth: dateValidation.refine((d)=>{
25
+ email: z
26
+ .string()
27
+ .email()
28
+ .transform((s) => s.toLowerCase().trim()),
29
+ dateOfBirth: dateValidation
30
+ .refine((d) => {
33
31
  return isAfter(d, subYears(new Date(), 25));
34
32
  }, {
35
- path: [
36
- 'dateOfBirth'
37
- ],
38
- message: 'You must be at least 25 years old to signup for the service.'
39
- }).optional(),
33
+ path: ['dateOfBirth'],
34
+ message: 'You must be at least 25 years old to signup for the service.',
35
+ })
36
+ .optional(),
40
37
  password: z.string().min(6).optional(),
41
38
  noMarketing: z.boolean().optional(),
42
39
  pageSource: z.string().optional().nullable(),
43
- skipPassword: z.boolean().optional().nullable()
40
+ skipPassword: z.boolean().optional().nullable(),
44
41
  });
45
- export const handleRegister = async (b, xForwardedFor)=>{
42
+ export const handleRegister = async (b, xForwardedFor) => {
46
43
  const { noMarketing, password, authMethod, phoneNumber, code, keepCode, pageSource, skipPassword, ...body } = Body.parse(b);
47
44
  let phoneNumberVerified = false;
48
45
  if (code) {
49
- const tokenResult = await verifyToken(code, {
50
- scope: 'verify-phone'
51
- });
46
+ const tokenResult = await verifyToken(code, { scope: 'verify-phone' });
52
47
  if (tokenResult.err) {
53
48
  return new Err(makeProblem(PROBLEM_CONFLICT, 'Invalid OTP token'));
54
49
  }
@@ -62,9 +57,7 @@ export const handleRegister = async (b, xForwardedFor)=>{
62
57
  }
63
58
  // Check if the user exists
64
59
  const foundUser = await prisma.user.findFirst({
65
- where: {
66
- email: body.email
67
- }
60
+ where: { email: body.email },
68
61
  });
69
62
  if (foundUser) {
70
63
  return new Err(makeProblem(PROBLEM_CONFLICT, 'A user with this email address already exists. Did you mean to login?'));
@@ -82,20 +75,20 @@ export const handleRegister = async (b, xForwardedFor)=>{
82
75
  preferredLocale: 'en',
83
76
  phoneNumberVerified,
84
77
  consented: true,
85
- groups: [
86
- 'member'
87
- ],
78
+ groups: ['member'],
88
79
  consents: {
89
80
  create: {
90
81
  id: generateId('UserConsent'),
91
- ipAddress: Array.isArray(xForwardedFor) ? xForwardedFor?.[0] || '0.0.0.0' : xForwardedFor || '0.0.0.0',
82
+ ipAddress: Array.isArray(xForwardedFor)
83
+ ? xForwardedFor?.[0] || '0.0.0.0'
84
+ : xForwardedFor || '0.0.0.0',
92
85
  consentType: 'terms',
93
- email: body.email
94
- }
86
+ email: body.email,
87
+ },
95
88
  },
96
89
  signupParams: {
97
90
  method: authMethod,
98
- source: pageSource
91
+ source: pageSource,
99
92
  },
100
93
  registrationComplete: true,
101
94
  accounts: {
@@ -104,33 +97,32 @@ export const handleRegister = async (b, xForwardedFor)=>{
104
97
  object: 'account',
105
98
  type: 'default',
106
99
  provider: 'credentials',
107
- providerAccountId: id
108
- }
109
- }
110
- }
100
+ providerAccountId: id,
101
+ },
102
+ },
103
+ },
111
104
  });
112
105
  const token = await prisma.token.create({
113
106
  data: {
114
107
  id: generateId('Token'),
115
108
  user: {
116
109
  connect: {
117
- id: user.id
118
- }
110
+ id: user.id,
111
+ },
119
112
  },
120
113
  expiresAt: addDays(new Date(), 365),
121
- scope: 'all'
122
- }
114
+ scope: 'all',
115
+ },
123
116
  });
124
117
  // We don't want this to be a task. It should be instant
125
118
  await sendVerificationEmail(user.id);
126
119
  if (!noMarketing) {
127
- await setContactInList(user.id, {
128
- generalMarketing: true
129
- });
120
+ await setContactInList(user.id, { generalMarketing: true });
130
121
  }
131
122
  await refreshEmailPreferences(user.id);
132
123
  return new Ok({
133
124
  token,
134
- user
125
+ user,
135
126
  });
136
127
  };
128
+ //# sourceMappingURL=register.js.map
@@ -13,8 +13,8 @@ export declare const createToken: (userId: string | null, type: "email" | "phone
13
13
  metadata: PrismaJson.AnyMetadata | null;
14
14
  createdAt: Date;
15
15
  updatedAt: Date;
16
- userId: string | null;
17
16
  value: string | null;
17
+ userId: string | null;
18
18
  client: string | null;
19
19
  identifier: string | null;
20
20
  expiresAt: Date | null;
@@ -29,8 +29,8 @@ export declare const createEmailToken: (userId: string, email: string) => Promis
29
29
  metadata: PrismaJson.AnyMetadata | null;
30
30
  createdAt: Date;
31
31
  updatedAt: Date;
32
- userId: string | null;
33
32
  value: string | null;
33
+ userId: string | null;
34
34
  client: string | null;
35
35
  identifier: string | null;
36
36
  expiresAt: Date | null;
@@ -45,8 +45,8 @@ export declare const createSMSToken: (userId: string | null, phoneNumber: string
45
45
  metadata: PrismaJson.AnyMetadata | null;
46
46
  createdAt: Date;
47
47
  updatedAt: Date;
48
- userId: string | null;
49
48
  value: string | null;
49
+ userId: string | null;
50
50
  client: string | null;
51
51
  identifier: string | null;
52
52
  expiresAt: Date | null;