sidekick-server-2 0.1.1

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 (218) hide show
  1. package/README.md +223 -0
  2. package/dist/ai/index.d.ts +2 -0
  3. package/dist/ai/index.d.ts.map +1 -0
  4. package/dist/ai/index.js +2 -0
  5. package/dist/ai/index.js.map +1 -0
  6. package/dist/ai/perplexity-ai.d.ts +3 -0
  7. package/dist/ai/perplexity-ai.d.ts.map +1 -0
  8. package/dist/ai/perplexity-ai.js +28 -0
  9. package/dist/ai/perplexity-ai.js.map +1 -0
  10. package/dist/app-config.d.ts +13 -0
  11. package/dist/app-config.d.ts.map +1 -0
  12. package/dist/app-config.js +33 -0
  13. package/dist/app-config.js.map +1 -0
  14. package/dist/cors-config.d.ts +9 -0
  15. package/dist/cors-config.d.ts.map +1 -0
  16. package/dist/cors-config.js +24 -0
  17. package/dist/cors-config.js.map +1 -0
  18. package/dist/db-connection.d.ts +13 -0
  19. package/dist/db-connection.d.ts.map +1 -0
  20. package/dist/db-connection.js +22 -0
  21. package/dist/db-connection.js.map +1 -0
  22. package/dist/error-handler.d.ts +3 -0
  23. package/dist/error-handler.d.ts.map +1 -0
  24. package/dist/error-handler.js +15 -0
  25. package/dist/error-handler.js.map +1 -0
  26. package/dist/index.d.ts +19 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +87 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/local-cache.d.ts +14 -0
  31. package/dist/local-cache.d.ts.map +1 -0
  32. package/dist/local-cache.js +44 -0
  33. package/dist/local-cache.js.map +1 -0
  34. package/dist/r2-buckets/get-signed-url.d.ts +2 -0
  35. package/dist/r2-buckets/get-signed-url.d.ts.map +1 -0
  36. package/dist/r2-buckets/get-signed-url.js +22 -0
  37. package/dist/r2-buckets/get-signed-url.js.map +1 -0
  38. package/dist/r2-buckets/index.d.ts +3 -0
  39. package/dist/r2-buckets/index.d.ts.map +1 -0
  40. package/dist/r2-buckets/index.js +3 -0
  41. package/dist/r2-buckets/index.js.map +1 -0
  42. package/dist/r2-buckets/r2-client.d.ts +3 -0
  43. package/dist/r2-buckets/r2-client.d.ts.map +1 -0
  44. package/dist/r2-buckets/r2-client.js +18 -0
  45. package/dist/r2-buckets/r2-client.js.map +1 -0
  46. package/dist/r2-buckets/upload-r2.d.ts +11 -0
  47. package/dist/r2-buckets/upload-r2.d.ts.map +1 -0
  48. package/dist/r2-buckets/upload-r2.js +49 -0
  49. package/dist/r2-buckets/upload-r2.js.map +1 -0
  50. package/dist/routes/authentication/check-session.d.ts +4 -0
  51. package/dist/routes/authentication/check-session.d.ts.map +1 -0
  52. package/dist/routes/authentication/check-session.js +79 -0
  53. package/dist/routes/authentication/check-session.js.map +1 -0
  54. package/dist/routes/authentication/login-router.d.ts +3 -0
  55. package/dist/routes/authentication/login-router.d.ts.map +1 -0
  56. package/dist/routes/authentication/login-router.js +83 -0
  57. package/dist/routes/authentication/login-router.js.map +1 -0
  58. package/dist/routes/authentication/reset-password.d.ts +3 -0
  59. package/dist/routes/authentication/reset-password.d.ts.map +1 -0
  60. package/dist/routes/authentication/reset-password.js +92 -0
  61. package/dist/routes/authentication/reset-password.js.map +1 -0
  62. package/dist/routes/authentication/send-otp-router.d.ts +3 -0
  63. package/dist/routes/authentication/send-otp-router.d.ts.map +1 -0
  64. package/dist/routes/authentication/send-otp-router.js +89 -0
  65. package/dist/routes/authentication/send-otp-router.js.map +1 -0
  66. package/dist/routes/authentication/user-profile.d.ts +3 -0
  67. package/dist/routes/authentication/user-profile.d.ts.map +1 -0
  68. package/dist/routes/authentication/user-profile.js +44 -0
  69. package/dist/routes/authentication/user-profile.js.map +1 -0
  70. package/dist/routes/authentication/user-registration-router.d.ts +3 -0
  71. package/dist/routes/authentication/user-registration-router.d.ts.map +1 -0
  72. package/dist/routes/authentication/user-registration-router.js +120 -0
  73. package/dist/routes/authentication/user-registration-router.js.map +1 -0
  74. package/dist/routes/authentication/validator.d.ts +14 -0
  75. package/dist/routes/authentication/validator.d.ts.map +1 -0
  76. package/dist/routes/authentication/validator.js +69 -0
  77. package/dist/routes/authentication/validator.js.map +1 -0
  78. package/dist/routes/countries/countries-router.d.ts +3 -0
  79. package/dist/routes/countries/countries-router.d.ts.map +1 -0
  80. package/dist/routes/countries/countries-router.js +23 -0
  81. package/dist/routes/countries/countries-router.js.map +1 -0
  82. package/dist/routes/feature-flags/feature-flags.d.ts +5 -0
  83. package/dist/routes/feature-flags/feature-flags.d.ts.map +1 -0
  84. package/dist/routes/feature-flags/feature-flags.js +28 -0
  85. package/dist/routes/feature-flags/feature-flags.js.map +1 -0
  86. package/dist/routes/index.d.ts +9 -0
  87. package/dist/routes/index.d.ts.map +1 -0
  88. package/dist/routes/index.js +92 -0
  89. package/dist/routes/index.js.map +1 -0
  90. package/dist/routes/link-metadata.d.ts +3 -0
  91. package/dist/routes/link-metadata.d.ts.map +1 -0
  92. package/dist/routes/link-metadata.js +34 -0
  93. package/dist/routes/link-metadata.js.map +1 -0
  94. package/dist/routes/orgs/index.d.ts +2 -0
  95. package/dist/routes/orgs/index.d.ts.map +1 -0
  96. package/dist/routes/orgs/index.js +2 -0
  97. package/dist/routes/orgs/index.js.map +1 -0
  98. package/dist/routes/orgs/invitation.d.ts +3 -0
  99. package/dist/routes/orgs/invitation.d.ts.map +1 -0
  100. package/dist/routes/orgs/invitation.js +103 -0
  101. package/dist/routes/orgs/invitation.js.map +1 -0
  102. package/dist/routes/orgs/org-delete.d.ts +3 -0
  103. package/dist/routes/orgs/org-delete.d.ts.map +1 -0
  104. package/dist/routes/orgs/org-delete.js +53 -0
  105. package/dist/routes/orgs/org-delete.js.map +1 -0
  106. package/dist/routes/orgs/org-get.d.ts +3 -0
  107. package/dist/routes/orgs/org-get.d.ts.map +1 -0
  108. package/dist/routes/orgs/org-get.js +45 -0
  109. package/dist/routes/orgs/org-get.js.map +1 -0
  110. package/dist/routes/orgs/org-members.d.ts +12 -0
  111. package/dist/routes/orgs/org-members.d.ts.map +1 -0
  112. package/dist/routes/orgs/org-members.js +560 -0
  113. package/dist/routes/orgs/org-members.js.map +1 -0
  114. package/dist/routes/orgs/org-post.d.ts +3 -0
  115. package/dist/routes/orgs/org-post.d.ts.map +1 -0
  116. package/dist/routes/orgs/org-post.js +89 -0
  117. package/dist/routes/orgs/org-post.js.map +1 -0
  118. package/dist/routes/orgs/org-put.d.ts +3 -0
  119. package/dist/routes/orgs/org-put.d.ts.map +1 -0
  120. package/dist/routes/orgs/org-put.js +87 -0
  121. package/dist/routes/orgs/org-put.js.map +1 -0
  122. package/dist/routes/orgs/org-registration-router.d.ts +3 -0
  123. package/dist/routes/orgs/org-registration-router.d.ts.map +1 -0
  124. package/dist/routes/orgs/org-registration-router.js +12 -0
  125. package/dist/routes/orgs/org-registration-router.js.map +1 -0
  126. package/dist/routes/orgs/org-utils.d.ts +14 -0
  127. package/dist/routes/orgs/org-utils.d.ts.map +1 -0
  128. package/dist/routes/orgs/org-utils.js +234 -0
  129. package/dist/routes/orgs/org-utils.js.map +1 -0
  130. package/dist/routes/orgs/premium-org-utils.d.ts +3 -0
  131. package/dist/routes/orgs/premium-org-utils.d.ts.map +1 -0
  132. package/dist/routes/orgs/premium-org-utils.js +61 -0
  133. package/dist/routes/orgs/premium-org-utils.js.map +1 -0
  134. package/dist/routes/paid-plans/billingsdk-config.d.ts +36 -0
  135. package/dist/routes/paid-plans/billingsdk-config.d.ts.map +1 -0
  136. package/dist/routes/paid-plans/billingsdk-config.js +2 -0
  137. package/dist/routes/paid-plans/billingsdk-config.js.map +1 -0
  138. package/dist/routes/paid-plans/get-subscription-config.d.ts +3 -0
  139. package/dist/routes/paid-plans/get-subscription-config.d.ts.map +1 -0
  140. package/dist/routes/paid-plans/get-subscription-config.js +25 -0
  141. package/dist/routes/paid-plans/get-subscription-config.js.map +1 -0
  142. package/dist/routes/paid-plans/payment-gateway.d.ts +3 -0
  143. package/dist/routes/paid-plans/payment-gateway.d.ts.map +1 -0
  144. package/dist/routes/paid-plans/payment-gateway.js +324 -0
  145. package/dist/routes/paid-plans/payment-gateway.js.map +1 -0
  146. package/dist/routes/paid-plans/purchased-plans.d.ts +8 -0
  147. package/dist/routes/paid-plans/purchased-plans.d.ts.map +1 -0
  148. package/dist/routes/paid-plans/purchased-plans.js +191 -0
  149. package/dist/routes/paid-plans/purchased-plans.js.map +1 -0
  150. package/dist/routes/paid-plans/subscription-utils.d.ts +25 -0
  151. package/dist/routes/paid-plans/subscription-utils.d.ts.map +1 -0
  152. package/dist/routes/paid-plans/subscription-utils.js +156 -0
  153. package/dist/routes/paid-plans/subscription-utils.js.map +1 -0
  154. package/dist/s3-buckets/get-signed-url.d.ts +2 -0
  155. package/dist/s3-buckets/get-signed-url.d.ts.map +1 -0
  156. package/dist/s3-buckets/get-signed-url.js +22 -0
  157. package/dist/s3-buckets/get-signed-url.js.map +1 -0
  158. package/dist/s3-buckets/index.d.ts +3 -0
  159. package/dist/s3-buckets/index.d.ts.map +1 -0
  160. package/dist/s3-buckets/index.js +3 -0
  161. package/dist/s3-buckets/index.js.map +1 -0
  162. package/dist/s3-buckets/s3-client.d.ts +3 -0
  163. package/dist/s3-buckets/s3-client.d.ts.map +1 -0
  164. package/dist/s3-buckets/s3-client.js +17 -0
  165. package/dist/s3-buckets/s3-client.js.map +1 -0
  166. package/dist/s3-buckets/upload-s3.d.ts +11 -0
  167. package/dist/s3-buckets/upload-s3.d.ts.map +1 -0
  168. package/dist/s3-buckets/upload-s3.js +51 -0
  169. package/dist/s3-buckets/upload-s3.js.map +1 -0
  170. package/dist/secret.d.ts +4 -0
  171. package/dist/secret.d.ts.map +1 -0
  172. package/dist/secret.js +11 -0
  173. package/dist/secret.js.map +1 -0
  174. package/dist/socket-config.d.ts +4 -0
  175. package/dist/socket-config.d.ts.map +1 -0
  176. package/dist/socket-config.js +23 -0
  177. package/dist/socket-config.js.map +1 -0
  178. package/dist/types.d.ts +141 -0
  179. package/dist/types.d.ts.map +1 -0
  180. package/dist/types.js +2 -0
  181. package/dist/types.js.map +1 -0
  182. package/dist/utils/common-utils.d.ts +61 -0
  183. package/dist/utils/common-utils.d.ts.map +1 -0
  184. package/dist/utils/common-utils.js +99 -0
  185. package/dist/utils/common-utils.js.map +1 -0
  186. package/dist/utils/email-helper.d.ts +6 -0
  187. package/dist/utils/email-helper.d.ts.map +1 -0
  188. package/dist/utils/email-helper.js +33 -0
  189. package/dist/utils/email-helper.js.map +1 -0
  190. package/dist/utils/enums.d.ts +17 -0
  191. package/dist/utils/enums.d.ts.map +1 -0
  192. package/dist/utils/enums.js +27 -0
  193. package/dist/utils/enums.js.map +1 -0
  194. package/dist/utils/error-logger.d.ts +4 -0
  195. package/dist/utils/error-logger.d.ts.map +1 -0
  196. package/dist/utils/error-logger.js +30 -0
  197. package/dist/utils/error-logger.js.map +1 -0
  198. package/dist/utils/index.d.ts +9 -0
  199. package/dist/utils/index.d.ts.map +1 -0
  200. package/dist/utils/index.js +9 -0
  201. package/dist/utils/index.js.map +1 -0
  202. package/dist/utils/otp-helper.d.ts +5 -0
  203. package/dist/utils/otp-helper.d.ts.map +1 -0
  204. package/dist/utils/otp-helper.js +89 -0
  205. package/dist/utils/otp-helper.js.map +1 -0
  206. package/dist/utils/response-utils.d.ts +8 -0
  207. package/dist/utils/response-utils.d.ts.map +1 -0
  208. package/dist/utils/response-utils.js +37 -0
  209. package/dist/utils/response-utils.js.map +1 -0
  210. package/dist/utils/sql-helper.d.ts +27 -0
  211. package/dist/utils/sql-helper.d.ts.map +1 -0
  212. package/dist/utils/sql-helper.js +97 -0
  213. package/dist/utils/sql-helper.js.map +1 -0
  214. package/dist/utils/type.d.ts +81 -0
  215. package/dist/utils/type.d.ts.map +1 -0
  216. package/dist/utils/type.js +2 -0
  217. package/dist/utils/type.js.map +1 -0
  218. package/package.json +70 -0
@@ -0,0 +1,22 @@
1
+ import { GetObjectCommand } from '@aws-sdk/client-s3';
2
+ import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
3
+ import { getSingletonCacheInstance } from '../local-cache.js';
4
+ import { getSecretValue } from '../secret.js';
5
+ import { getR2Client } from './r2-client.js';
6
+ const urlLocalCache = await getSingletonCacheInstance('r2-signed-get-urls', 20);
7
+ export async function getR2SignedFileUrl(key) {
8
+ const cachedUrl = await urlLocalCache.get(key);
9
+ if (cachedUrl) {
10
+ return cachedUrl;
11
+ }
12
+ const command = new GetObjectCommand({
13
+ Bucket: getSecretValue('r2Bucket'),
14
+ Key: key,
15
+ });
16
+ const signedUrl = await getSignedUrl(getR2Client(), command, {
17
+ expiresIn: 300,
18
+ });
19
+ await urlLocalCache.set(key, signedUrl, 300000);
20
+ return signedUrl;
21
+ }
22
+ //# sourceMappingURL=get-signed-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-signed-url.js","sourceRoot":"","sources":["../../src/r2-buckets/get-signed-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,aAAa,GAAG,MAAM,yBAAyB,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;AAEhF,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,GAAW;IAClD,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/C,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC;QACnC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAE;QACnC,GAAG,EAAE,GAAG;KACT,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE;QAC3D,SAAS,EAAE,GAAG;KACf,CAAC,CAAC;IAEH,MAAM,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAChD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { uploadToR2, getR2SignedUploadUrl } from './upload-r2.js';
2
+ export { getR2SignedFileUrl } from './get-signed-url.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/r2-buckets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { uploadToR2, getR2SignedUploadUrl } from './upload-r2.js';
2
+ export { getR2SignedFileUrl } from './get-signed-url.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/r2-buckets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { S3Client } from '@aws-sdk/client-s3';
2
+ export declare const getR2Client: () => S3Client;
3
+ //# sourceMappingURL=r2-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"r2-client.d.ts","sourceRoot":"","sources":["../../src/r2-buckets/r2-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAK9C,eAAO,MAAM,WAAW,QAAO,QAe9B,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { S3Client } from '@aws-sdk/client-s3';
2
+ import { getSecretValue } from '../secret.js';
3
+ let r2Client;
4
+ export const getR2Client = () => {
5
+ if (r2Client) {
6
+ return r2Client;
7
+ }
8
+ r2Client = new S3Client({
9
+ region: 'auto',
10
+ endpoint: `https://${getSecretValue('r2AccountId')}.r2.cloudflarestorage.com`,
11
+ credentials: {
12
+ accessKeyId: getSecretValue('r2AccessKey'),
13
+ secretAccessKey: getSecretValue('r2SecretKey'),
14
+ },
15
+ });
16
+ return r2Client;
17
+ };
18
+ //# sourceMappingURL=r2-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"r2-client.js","sourceRoot":"","sources":["../../src/r2-buckets/r2-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,IAAI,QAAkB,CAAC;AAEvB,MAAM,CAAC,MAAM,WAAW,GAAG,GAAa,EAAE;IACxC,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,QAAQ,GAAG,IAAI,QAAQ,CAAC;QACtB,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,WAAW,cAAc,CAAC,aAAa,CAAC,2BAA2B;QAC7E,WAAW,EAAE;YACX,WAAW,EAAE,cAAc,CAAC,aAAa,CAAE;YAC3C,eAAe,EAAE,cAAc,CAAC,aAAa,CAAE;SAChD;KACF,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare function uploadToR2(key: string, fileBuffer: Buffer): Promise<import("@aws-sdk/client-s3").PutObjectCommandOutput>;
2
+ interface ISignedUploadUrlParams {
3
+ key: string;
4
+ contentType: string;
5
+ contentLength: number;
6
+ allowedTypes?: string[];
7
+ maxSizeMb?: number;
8
+ }
9
+ export declare function getR2SignedUploadUrl({ key, contentType, contentLength, allowedTypes, maxSizeMb, }: ISignedUploadUrlParams): Promise<string>;
10
+ export {};
11
+ //# sourceMappingURL=upload-r2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-r2.d.ts","sourceRoot":"","sources":["../../src/r2-buckets/upload-r2.ts"],"names":[],"mappings":"AAMA,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gEAyB/D;AAKD,UAAU,sBAAsB;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,oBAAoB,CAAC,EACzC,GAAG,EACH,WAAW,EACX,aAAa,EACb,YAA4B,EAC5B,SAAuB,GACxB,EAAE,sBAAsB,mBAkBxB"}
@@ -0,0 +1,49 @@
1
+ import { PutObjectCommand, S3ServiceException } from '@aws-sdk/client-s3';
2
+ import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
3
+ import { getSecretValue } from '../secret.js';
4
+ import logger from '../utils/error-logger.js';
5
+ import { getR2Client } from './r2-client.js';
6
+ export async function uploadToR2(key, fileBuffer) {
7
+ const bucketName = getSecretValue('r2Bucket');
8
+ const command = new PutObjectCommand({
9
+ Bucket: bucketName,
10
+ Key: key,
11
+ Body: fileBuffer,
12
+ });
13
+ try {
14
+ return await getR2Client().send(command);
15
+ }
16
+ catch (caught) {
17
+ if (caught instanceof S3ServiceException && caught.name === 'EntityTooLarge') {
18
+ logger.error(`Error from R2 while uploading object to ${bucketName}. \
19
+ The object was too large. To upload objects larger than 5GB, use the R2 console (160GB max) \
20
+ or the multipart upload API (5TB max).`);
21
+ }
22
+ else if (caught instanceof S3ServiceException) {
23
+ logger.error(`R2 upload error: ${caught.name}: ${caught.message}`);
24
+ }
25
+ else {
26
+ logger.error(`R2 unknown upload error: ${caught}`);
27
+ }
28
+ throw caught;
29
+ }
30
+ }
31
+ const ALLOWED_TYPES = ['image/jpeg', 'image/png', 'image/webp'];
32
+ const MAX_SIZE_MB = 5;
33
+ export async function getR2SignedUploadUrl({ key, contentType, contentLength, allowedTypes = ALLOWED_TYPES, maxSizeMb = MAX_SIZE_MB, }) {
34
+ if (!allowedTypes.includes(contentType)) {
35
+ throw new Error('Invalid image type');
36
+ }
37
+ if (contentLength > maxSizeMb * 1024 * 1024) {
38
+ throw new Error('File too large');
39
+ }
40
+ const command = new PutObjectCommand({
41
+ Bucket: getSecretValue('r2Bucket'),
42
+ Key: key,
43
+ ContentType: contentType,
44
+ });
45
+ return getSignedUrl(getR2Client(), command, {
46
+ expiresIn: 300, // 5 minutes
47
+ });
48
+ }
49
+ //# sourceMappingURL=upload-r2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-r2.js","sourceRoot":"","sources":["../../src/r2-buckets/upload-r2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,UAAkB;IAC9D,MAAM,UAAU,GAAG,cAAc,CAAC,UAAU,CAAE,CAAC;IAE/C,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC;QACnC,MAAM,EAAE,UAAU;QAClB,GAAG,EAAE,GAAG;QACR,IAAI,EAAE,UAAU;KACjB,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,OAAO,MAAM,WAAW,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,IAAI,MAAM,YAA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ter: import("express-serve-static-core").Router;
2
+ export declare const invalidateSessionCacheForUser: (userId: number) => Promise<void>;
3
+ export default checkSessionRouter;
4
+ //# sourceMappingURL=check-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-session.d.ts","sourceRoot":"","sources":["../../../src/routes/authentication/check-session.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,kBAAkB,4CAAmB,CAAC;AAE5C,eAAO,MAAM,6BAA6B,GAAU,QAAQ,MAAM,kBAKjE,CAAC;AAyEF,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,79 @@
1
+ import express from 'express';
2
+ import { getSingletonCacheInstance } from '../../local-cache.js';
3
+ import { isValidId } from '../../utils/common-utils.js';
4
+ import logger from '../../utils/error-logger.js';
5
+ import { getErrorResponseObj, getResponseObj, sendSuccessResponse, throwErrorInResponseIfErrorIsNotCustom } from '../../utils/response-utils.js';
6
+ import { executeSql, initializeConnection } from '../../utils/sql-helper.js';
7
+ const localSessionCache = await getSingletonCacheInstance('active-users-cache', 100);
8
+ // Map to track in-flight database queries for users
9
+ const loadingExecuteFor = new Map();
10
+ const checkSessionRouter = express.Router();
11
+ export const invalidateSessionCacheForUser = async (userId) => {
12
+ const cacheKey = `user_${userId}`;
13
+ await localSessionCache.del(cacheKey);
14
+ // Also clear any in-flight requests for this user
15
+ loadingExecuteFor.delete(userId);
16
+ };
17
+ /**
18
+ * Fetches user from database and caches the result.
19
+ */
20
+ const fetchAndCacheUser = async (userId, connection) => {
21
+ try {
22
+ const userSql = `SELECT user_email, user_mobile_no, user_fname, user_lname, user_id FROM auth_users_tbl WHERE user_id = ${userId} AND user_is_active = 1;`;
23
+ const userResult = await executeSql(userSql, connection);
24
+ const user = userResult[0] || null;
25
+ await localSessionCache.set(`user_${userId}`, user);
26
+ return user;
27
+ }
28
+ finally {
29
+ // Clean up the promise from the map once completed
30
+ loadingExecuteFor.delete(userId);
31
+ }
32
+ };
33
+ /**
34
+ * Fetches user session data with caching and deduplication.
35
+ * Prevents duplicate database calls for the same user when concurrent requests arrive.
36
+ */
37
+ const getSessionUser = async (userId, connection) => {
38
+ // Check cache first
39
+ const cachedUser = await localSessionCache.get(`user_${userId}`);
40
+ if (cachedUser !== undefined) {
41
+ return cachedUser;
42
+ }
43
+ // Check if there's already a query in progress for this user
44
+ let userPromise = loadingExecuteFor.get(userId);
45
+ if (!userPromise) {
46
+ // No query in progress, create a new one
47
+ userPromise = fetchAndCacheUser(userId, connection);
48
+ loadingExecuteFor.set(userId, userPromise);
49
+ }
50
+ // Wait for the query to complete (either new or existing)
51
+ return await userPromise;
52
+ };
53
+ checkSessionRouter.get('/', async (request, response) => {
54
+ await initializeConnection(async (connection) => {
55
+ try {
56
+ const userId = request.user.id;
57
+ if (!isValidId(userId)) {
58
+ throw getErrorResponseObj({
59
+ errorMsg: 'It seems like you are not logged in',
60
+ });
61
+ }
62
+ const sessionUser = await getSessionUser(userId, connection);
63
+ sendSuccessResponse(response, getResponseObj({
64
+ title: 'Auth success',
65
+ sessionInfo: request.user,
66
+ user: sessionUser,
67
+ }));
68
+ }
69
+ catch (error) {
70
+ logger.error('Error in checkSession command', error);
71
+ throwErrorInResponseIfErrorIsNotCustom(response, error, {
72
+ errorMsg: 'An error occurred while checking the session.',
73
+ solution: 'Please try again later or contact support if the issue persists.',
74
+ });
75
+ }
76
+ });
77
+ });
78
+ export default checkSessionRouter;
79
+ //# sourceMappingURL=check-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-session.js","sourceRoot":"","sources":["../../../src/routes/authentication/check-session.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,SAAS,CAAC;AAErD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,6BAA6B,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,mBAAmB,EAAE,sCAAsC,EAAE,M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AC7E,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const loginRouter: import("express-serve-static-core").Router;
2
+ export default loginRouter;
3
+ //# sourceMappingURL=login-router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login-router.d.ts","sourceRoot":"","sources":["../../../src/routes/authentication/login-router.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,WAAW,4CAAmB,CAAC;AAoGrC,eAAe,WAAW,CAAC"}
@@ -0,0 +1,83 @@
1
+ import express from 'express';
2
+ import { getSecretValue } from '../../secret.js';
3
+ import { verifyPassword, generateToken } from '../../utils/common-utils.js';
4
+ import { getErrorResponseObj, getResponseObj, sendErrorResponse, sendSuccessResponse } from '../../utils/response-utils.js';
5
+ import { initializeConnection, selectRecords } from '../../utils/sql-helper.js';
6
+ const loginRouter = express.Router();
7
+ const verifyCaptchaToken = async (turnstileToken, ip) => {
8
+ if (!turnstileToken) {
9
+ throw 'INVALID_TOKEN';
10
+ }
11
+ const response = await fetch('https://challenges.cloudflare.com/turnstile/v0/siteverify', {
12
+ method: 'POST',
13
+ headers: { 'Content-Type': 'application/json' },
14
+ body: JSON.stringify({
15
+ secret: getSecretValue('cloudFlareApiKey'),
16
+ response: turnstileToken,
17
+ remoteip: ip, // optional
18
+ }),
19
+ });
20
+ const data = await response.json();
21
+ if (data.success !== true) {
22
+ throw 'INVALID_TOKEN';
23
+ }
24
+ };
25
+ loginRouter.post('/', async (request, response) => {
26
+ /**
27
+ * Request JSON:
28
+ * { username, password, turnstileToken }
29
+ */
30
+ const ip = request.ip;
31
+ await initializeConnection(async (connection) => {
32
+ try {
33
+ const { username: user_email, password, turnstileToken } = request.body || {};
34
+ await verifyCaptchaToken(turnstileToken, ip);
35
+ const records = await selectRecords('auth_users_tbl', ['user_id', 'user_email', 'user_password_hash'], { user_email }, connection);
36
+ const record = records[0];
37
+ if (!record) {
38
+ //here means, there is no user with his email
39
+ throw 'NOT_FOUND';
40
+ }
41
+ if ((await verifyPassword(password, record.user_password_hash)) === false) {
42
+ throw 'INCORRECT_PASSWORD';
43
+ }
44
+ const api = generateToken({ email: user_email, id: record.user_id });
45
+ sendSuccessResponse(response, getResponseObj({
46
+ message: 'Logged in successfully',
47
+ api,
48
+ }));
49
+ }
50
+ catch (error) {
51
+ let responseError = getErrorResponseObj({
52
+ errorMsg: 'An error occurred while logging in.',
53
+ solution: 'Please try again later or contact support if the issue persists.',
54
+ }, error || {});
55
+ if (error === 'NOT_FOUND') {
56
+ responseError = getErrorResponseObj({
57
+ errorMsg: 'No account found with this email address.',
58
+ solution: 'Please check your email for any typos, try a different email, or sign up for a new account.',
59
+ });
60
+ }
61
+ else if (error === 'INCORRECT_PASSWORD') {
62
+ responseError = getErrorResponseObj({
63
+ errorMsg: 'Incorrect password. Please try again.',
64
+ solution: 'Ensure your password is correct. If you forgot your password, use the "Forgot Password" option to reset it.',
65
+ });
66
+ }
67
+ else if (error === 'INVALID_TOKEN') {
68
+ responseError = getErrorResponseObj({
69
+ errorMsg: 'Invalid CAPTCHA token.',
70
+ solution: 'Please complete the CAPTCHA challenge and try again.',
71
+ });
72
+ }
73
+ sendErrorResponse(response, responseError);
74
+ }
75
+ });
76
+ });
77
+ loginRouter.get('/logout', async (request, response) => {
78
+ sendSuccessResponse(response, getResponseObj({
79
+ message: 'Logged out successfully',
80
+ }));
81
+ });
82
+ export default loginRouter;
83
+ //# sourceMappingURL=login-router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login-router.js","sourceRoot":"","sources":["../../../src/routes/authentication/login-router.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,SAAS,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,mBAAmB,E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AClC,QAAQ,EAAE,wBAAwB;oBAClC,QAAQ,EAAE,sDAAsD;iBACjE,CAAC,CAAC;YACL,CAAC;YAED,iBAAiB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,WAAW,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,OAAgB,EAAE,QAAkB,EAAE,EAAE;IACxE,mBAAmB,CACjB,QAAQ,EACR,cAAc,CAAC;QACb,OAAO,EAAE,yBAAyB;KACnC,CAAC,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const resetPasswordRouter: import("express-serve-static-core").Router;
2
+ export default resetPasswordRouter;
3
+ //# sourceMappingURL=reset-password.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reset-password.d.ts","sourceRoot":"","sources":["../../../src/routes/authentication/reset-password.ts"],"names":[],"mappings":"AASA,QAAA,MAAM,mBAAmB,4CAAmB,CAAC;AAqG7C,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,92 @@
1
+ import express from 'express';
2
+ import { getRequestFromRoute, hashPassword, isCustomError } from '../../utils/common-utils.js';
3
+ import { cachedOTPs, validateOTP } from '../../utils/otp-helper.js';
4
+ import { getErrorResponseObj, getResponseObj, sendErrorResponse, sendSuccessResponse } from '../../utils/response-utils.js';
5
+ import { initializeConnection, updateRecords } from '../../utils/sql-helper.js';
6
+ import { validatePassword } from './validator.js';
7
+ const resetPasswordRouter = express.Router();
8
+ const updateUser = async (requestObj, connection) => {
9
+ const requiredFields = [
10
+ // 'user_mobile_no',
11
+ 'user_email',
12
+ 'user_password',
13
+ // 'user_fname',
14
+ // 'user_lname',
15
+ // 'user_is_active',
16
+ ];
17
+ const reqBody = getRequestFromRoute(requestObj, requiredFields);
18
+ try {
19
+ if (!reqBody.user_password) {
20
+ throw 'EMPTY_PASSWORD';
21
+ }
22
+ else {
23
+ const passwordValidation = validatePassword(reqBody.user_password);
24
+ if (passwordValidation !== true) {
25
+ throw passwordValidation;
26
+ }
27
+ }
28
+ delete reqBody.user_is_active;
29
+ const email = reqBody.user_email;
30
+ delete reqBody.user_email;
31
+ reqBody.user_password_hash = await hashPassword(reqBody.user_password || '');
32
+ delete reqBody.user_password;
33
+ const result = await updateRecords('auth_users_tbl', reqBody, { user_email: email }, connection);
34
+ // Here means success
35
+ return result;
36
+ }
37
+ catch (error) {
38
+ let responseError = {
39
+ errorMsg: 'An error occurred while resetting the password.',
40
+ solution: 'Please try again later or contact support if the issue persists.',
41
+ };
42
+ if (error === 'EMPTY_PASSWORD') {
43
+ responseError = {
44
+ errorMsg: 'Password cannot be empty.',
45
+ solution: 'Enter password and try again.',
46
+ };
47
+ }
48
+ else if (error.errorMsg) {
49
+ responseError = error;
50
+ }
51
+ throw getErrorResponseObj(responseError, error);
52
+ }
53
+ };
54
+ resetPasswordRouter.put('/', async (request, response) => {
55
+ /**
56
+ * Request JSON can contain:
57
+ * {
58
+ * user_email:
59
+ * user_password:
60
+ * otp:
61
+ * }
62
+ */
63
+ const reqBody = request.body;
64
+ if (validateOTP(reqBody.user_email, reqBody.otp) === false) {
65
+ const responseError = getErrorResponseObj({
66
+ errorMsg: 'Invalid OTP.',
67
+ solution: 'Enter correct OTP and try again.',
68
+ });
69
+ sendErrorResponse(response, responseError);
70
+ return;
71
+ }
72
+ await initializeConnection(async (connection) => {
73
+ try {
74
+ await updateUser(reqBody, connection);
75
+ sendSuccessResponse(response, getResponseObj({
76
+ message: 'Password has been updated successfully.',
77
+ }));
78
+ delete cachedOTPs[reqBody.user_email];
79
+ }
80
+ catch (error) {
81
+ const responseError = isCustomError(error)
82
+ ? error
83
+ : getErrorResponseObj({
84
+ errorMsg: `An error occurred while password reset.`,
85
+ solution: 'Please try again later or contact support if the issue persists.',
86
+ });
87
+ sendErrorResponse(response, responseError);
88
+ }
89
+ });
90
+ });
91
+ export default resetPasswordRouter;
92
+ //# sourceMappingURL=reset-password.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reset-password.js","sourceRoot":"","sources":["../../../src/routes/authentication/reset-password.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,SAAS,CAAC;AAErD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC5H,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAEhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAE7C,MAAM,UAAU,GAAG,KAAK,EAAE,UAA+B,EAAE,UAAe,EAAE,EAAE;IAC5E,MAAM,cAAc,GAAkB;QACpC,oBAAoB;QACpB,YAAY;QACZ,eAAe;QACf,gBAAgB;QAChB,gBAAgB;QAChB,oBAAoB;KACrB,CAAC;IAEF,MAAM,OAAO,GAAG,mBAAmB,CAAC,UAAU,EAAE,cAAc,CAAgB,CAAC;IAE/E,IAAI,CAAC;QACH,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;YAC3B,MAAM,gBAAgB,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YACnE,IAAI,kBAAkB,KAAK,IAAI,EAAE,CAAC;gBAChC,MAAM,kBAAkB,CAAC;YAC3B,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC,cAAc,CAAC;QAE9B,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC;QACjC,OAAO,OAAO,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KAAK,EAAE,UAAU,EAAE,EAAE;QAC9C,IAAI,CAAC;YACH,MAAM,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;YAEtC,mBAAmB,CACjB,QAAQ,EACR,cAAc,CAAC;gBACb,OAAO,EAAE,yCAAyC;aACnD,CAAC,CACH,CAAC;YAEF,OAAO,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACxC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,aAAa,GAAG,aAAa,CAAC,KAAK,CAAC;gBACxC,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,mBAAmB,CAAC;oBAClB,QAAQ,EAAE,yCAAyC;oBACnD,QAAQ,EAAE,kEAAkE;iBAC7E,CAAC,CAAC;YAEP,iBAAiB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const sendOTPRouterRouter: import("express-serve-static-core").Router;
2
+ export default sendOTPRouterRouter;
3
+ //# sourceMappingURL=send-otp-router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-otp-router.d.ts","sourceRoot":"","sources":["../../../src/routes/authentication/send-otp-router.ts"],"names":[],"mappings":"AASA,QAAA,MAAM,mBAAmB,4CAAmB,CAAC;AAoG7C,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,89 @@
1
+ import express from 'express';
2
+ import { appInfo } from '../../app-config.js';
3
+ import { generateOTP, isCustomError, isEmailValid } from '../../utils/common-utils.js';
4
+ import sendEmail from '../../utils/email-helper.js';
5
+ import { cachedOTPs, otpTemplate } from '../../utils/otp-helper.js';
6
+ import { getErrorResponseObj, sendErrorResponse, getResponseObj, sendSuccessResponse } from '../../utils/response-utils.js';
7
+ import { initializeConnection, selectRecords } from '../../utils/sql-helper.js';
8
+ const sendOTPRouterRouter = express.Router();
9
+ const getUserById = async (email) => {
10
+ let records = [];
11
+ try {
12
+ await initializeConnection(async (connection) => {
13
+ //checking if user already registered
14
+ records = await selectRecords('auth_users_tbl', ['user_id', 'user_email'], { user_email: email }, connection);
15
+ });
16
+ }
17
+ catch (error) {
18
+ throw getErrorResponseObj({
19
+ errorMsg: 'Error while fetching user details by email.',
20
+ solution: 'Please try again later or contact support if the issue persists.',
21
+ }, error);
22
+ }
23
+ return records;
24
+ };
25
+ sendOTPRouterRouter.post('/:path', async (request, response) => {
26
+ /**
27
+ * Request JSON can contain:
28
+ * {
29
+ * email:
30
+ * }
31
+ */
32
+ const { email } = request.body;
33
+ const { path } = request.params;
34
+ if (isEmailValid(email) === false) {
35
+ sendErrorResponse(response, getErrorResponseObj({
36
+ errorMsg: 'Email is invalid.',
37
+ solution: 'Please recheck you email and try again.',
38
+ }));
39
+ }
40
+ try {
41
+ const records = await getUserById(email);
42
+ let subject = '';
43
+ if (path === 'new-registration') {
44
+ if (records && records.length > 0) {
45
+ throw getErrorResponseObj({
46
+ errorMsg: 'User already exists.',
47
+ solution: 'Please use a different email or contact support if you believe this is an error.',
48
+ });
49
+ }
50
+ subject = 'OTP for Email Verification';
51
+ }
52
+ else if (path === 'forgot-password') {
53
+ if (records && records.length === 0) {
54
+ throw getErrorResponseObj({
55
+ errorMsg: "You don't have an account",
56
+ solution: 'Please register to create an account',
57
+ });
58
+ }
59
+ subject = 'OTP for Reset Password';
60
+ }
61
+ else {
62
+ throw getErrorResponseObj({
63
+ errorMsg: 'Invalid path parameter.',
64
+ });
65
+ }
66
+ const otp = generateOTP();
67
+ cachedOTPs[email] = otp;
68
+ await sendEmail({
69
+ email,
70
+ subject: `${appInfo.appName} - ${subject}`,
71
+ html: otpTemplate(otp),
72
+ });
73
+ sendSuccessResponse(response, getResponseObj({
74
+ message: 'OTP has been sent successfully.',
75
+ email,
76
+ }));
77
+ }
78
+ catch (error) {
79
+ const responseError = isCustomError(error)
80
+ ? error
81
+ : getErrorResponseObj({
82
+ errorMsg: 'An error occurred while sending an OTP.',
83
+ solution: 'Please try again later or contact support if the issue persists.',
84
+ }, error || {});
85
+ sendErrorResponse(response, responseError);
86
+ }
87
+ });
88
+ export default sendOTPRouterRouter;
89
+ //# sourceMappingURL=send-otp-router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-otp-router.js","sourceRoot":"","sources":["../../../src/routes/authentication/send-otp-router.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,SAAS,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC5H,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAEhF,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAE7C,MAAM,WAAW,GAAG,KAAK,EAAE,KAAa,EAAE,EAAE;IAC1C,IAAI,OAAO,GAAQ,EAAE,CAAC;IACtB,IAAI,CAAC;QACH,MAAM,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;YAC9C,qCAAqC;YACrC,OAAO,GAAG,MAAM,aAAa,CAAC,gBAAgB,EAAE,CAAC,SAAS,EAAE,YAAY,CAAC,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,UAAU,CAAC,CAAC;QAChH,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,mBAAmB,CACvB;YACE,QAAQ,EAAE,6CAA6C;YACvD,QAAQ,EAAE,kEAAkE;SAC7E,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,CAAC;QACL,CAAC;QAED,MAAM,GAAG,GAAG,WAAW,EAAE,CAAC;QAC1B,UAAU,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC;QAExB,MAAM,SAAS,CAAC;YACd,KAAK;YACL,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,MAAM,OAAO,EAAE;YAC1C,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC;SACvB,CAAC,CAAC;QAEH,mBAAmB,CACjB,QAAQ,EACR,cAAc,CAAC;YACb,OAAO,EAAE,iCAAiC;YAC1C,KAAK;SACN,CAAC,CACH,CAAC;IACJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,aAAa,GAAG,aAAa,CAAC,KAAK,CAAC;YACxC,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,mBAAmB,CACjB;gBACE,QAAQ,EAAE,yCAAyC;gBACnD,QAAQ,EAAE,kEAAkE;aAC7E,EACD,KAAK,IAAI,EAAE,CACZ,CAAC;QACN,iBAAiB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const userProfileRouter: import("express-serve-static-core").Router;
2
+ export default userProfileRouter;
3
+ //# sourceMappingURL=user-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-profile.d.ts","sourceRoot":"","sources":["../../../src/routes/authentication/user-profile.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,iBAAiB,4CAAmB,CAAC;AA0C3C,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,44 @@
1
+ import express from 'express';
2
+ import { isValidId } from '../../utils/common-utils.js';
3
+ import logger from '../../utils/error-logger.js';
4
+ import { getErrorResponseObj, getResponseObj, sendSuccessResponse, throwErrorInResponseIfErrorIsNotCustom } from '../../utils/response-utils.js';
5
+ import { initializeConnection, updateRecords } from '../../utils/sql-helper.js';
6
+ import { invalidateSessionCacheForUser } from './check-session.js';
7
+ const userProfileRouter = express.Router();
8
+ userProfileRouter.put('/:id', async (request, response) => {
9
+ initializeConnection(async (connection) => {
10
+ try {
11
+ const { user_mobile_no, user_fname, user_lname } = request.body;
12
+ const loggedInUserId = request.user.id;
13
+ if (isValidId(loggedInUserId) === false) {
14
+ throw getErrorResponseObj({
15
+ errorMsg: 'Invalid user ID.',
16
+ solution: 'Please provide a valid user ID and try again.',
17
+ });
18
+ }
19
+ const user_id = request.params.id;
20
+ if (Number(user_id) !== Number(loggedInUserId)) {
21
+ throw getErrorResponseObj({
22
+ errorMsg: 'You are not authorized to update this user profile.',
23
+ solution: 'Please provide a valid user ID and try again.',
24
+ });
25
+ }
26
+ const reqBody = { user_mobile_no, user_fname, user_lname };
27
+ const result = await updateRecords('auth_users_tbl', reqBody, { user_id: loggedInUserId }, connection);
28
+ const success = result.affectedRows > 0;
29
+ if (success) {
30
+ invalidateSessionCacheForUser(loggedInUserId);
31
+ }
32
+ sendSuccessResponse(response, getResponseObj({ success }));
33
+ }
34
+ catch (error) {
35
+ logger.error('Error while saving user profile:', error);
36
+ throwErrorInResponseIfErrorIsNotCustom(response, error, {
37
+ errorMsg: 'An error occurred while saving user profile.',
38
+ solution: 'Please try again later or contact support if the issue persists.',
39
+ });
40
+ }
41
+ });
42
+ });
43
+ export default userProfileRouter;
44
+ //# sourceMappingURL=user-profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-profile.js","sourceRoot":"","sources":["../../../src/routes/authentication/user-profile.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,6BAA6B,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,mBAAmB,EAAE,sCAAsC,EAAE,MAAM,+BAA+B,CAAC;AACjJ,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,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,EAAE,cAAc,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;QAC7D,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;YAExD,sCAAsC,CAAC,QAAQ,EAAE,KAAK,EAAE;gBACtD,QAAQ,EAAE,8CAA8C;gBACxD,QAAQ,EAAE,kEAAkE;aAC7E,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const userRegistrationRouter: import("express-serve-static-core").Router;
2
+ export default userRegistrationRouter;
3
+ //# sourceMappingURL=user-registration-router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-registration-router.d.ts","sourceRoot":"","sources":["../../../src/routes/authentication/user-registration-router.ts"],"names":[],"mappings":"AAiBA,QAAA,MAAM,sBAAsB,4CAAmB,CAAC;AA2IhD,eAAe,sBAAsB,CAAC"}