@donotdev/functions 0.0.19 → 0.1.0

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 (292) hide show
  1. package/LICENSE.md +3 -3
  2. package/lib/firebase/auth/getCustomClaims.d.ts +25 -0
  3. package/lib/firebase/auth/getUserAuthStatus.d.ts +29 -0
  4. package/lib/firebase/auth/index.d.ts +12 -0
  5. package/lib/firebase/auth/removeCustomClaims.d.ts +28 -0
  6. package/lib/firebase/auth/setCustomClaims.d.ts +34 -0
  7. package/lib/firebase/baseFunction.d.ts +26 -0
  8. package/lib/firebase/billing/cancelSubscription.d.ts +10 -0
  9. package/lib/firebase/billing/changePlan.d.ts +13 -0
  10. package/lib/firebase/billing/createCheckoutSession.d.ts +21 -0
  11. package/lib/firebase/billing/createCustomerPortal.d.ts +19 -0
  12. package/lib/firebase/billing/healthCheck.d.ts +5 -0
  13. package/lib/firebase/billing/index.d.ts +18 -0
  14. package/lib/firebase/billing/refreshSubscriptionStatus.d.ts +19 -0
  15. package/lib/firebase/billing/webhookHandler.d.ts +6 -0
  16. package/lib/firebase/config/constants.d.ts +89 -0
  17. package/lib/firebase/config/index.d.ts +9 -0
  18. package/lib/firebase/config/secrets.d.ts +15 -0
  19. package/lib/firebase/crud/aggregate.d.ts +98 -0
  20. package/lib/firebase/crud/create.d.ts +16 -0
  21. package/lib/firebase/crud/delete.d.ts +20 -0
  22. package/lib/firebase/crud/get.d.ts +24 -0
  23. package/lib/firebase/crud/index.d.ts +14 -0
  24. package/lib/firebase/crud/list.d.ts +25 -0
  25. package/lib/firebase/crud/update.d.ts +25 -0
  26. package/lib/firebase/helpers/githubAccessHelper.d.ts +30 -0
  27. package/lib/firebase/helpers/githubTeamAccessHelper.d.ts +36 -0
  28. package/lib/firebase/helpers/index.d.ts +10 -0
  29. package/lib/firebase/index.d.ts +17 -0
  30. package/lib/firebase/index.js +25 -9110
  31. package/lib/firebase/index.js.map +4 -4
  32. package/lib/firebase/oauth/disconnect.d.ts +12 -0
  33. package/lib/firebase/oauth/exchangeToken.d.ts +9 -0
  34. package/lib/firebase/oauth/getConnections.d.ts +11 -0
  35. package/lib/firebase/oauth/githubAccess.d.ts +83 -0
  36. package/lib/firebase/oauth/index.d.ts +13 -0
  37. package/lib/firebase/oauth/refreshToken.d.ts +9 -0
  38. package/lib/firebase/registerCrudFunctions.d.ts +32 -0
  39. package/lib/firebase/scheduled/checkExpiredSubscriptions.d.ts +14 -0
  40. package/lib/firebase/scheduled/index.d.ts +9 -0
  41. package/lib/shared/billing/createCheckout.d.ts +50 -0
  42. package/lib/shared/billing/helpers/index.d.ts +10 -0
  43. package/lib/shared/billing/helpers/subscriptionManagement.d.ts +34 -0
  44. package/lib/shared/billing/helpers/updateUserSubscription.d.ts +45 -0
  45. package/lib/shared/billing/idempotency.d.ts +22 -0
  46. package/lib/shared/billing/index.d.ts +11 -0
  47. package/lib/shared/billing/webhookHandler.d.ts +37 -0
  48. package/lib/shared/errorHandling.d.ts +14 -0
  49. package/lib/shared/firebase.d.ts +73 -0
  50. package/lib/shared/github.d.ts +128 -0
  51. package/lib/shared/index.d.ts +16 -0
  52. package/lib/shared/index.js +25 -6927
  53. package/lib/shared/index.js.map +4 -4
  54. package/lib/shared/logger.d.ts +133 -0
  55. package/lib/shared/metadata.d.ts +36 -0
  56. package/lib/shared/oauth/exchangeToken.d.ts +24 -0
  57. package/lib/shared/oauth/grantAccess.d.ts +30 -0
  58. package/lib/shared/oauth/index.d.ts +10 -0
  59. package/lib/shared/schema.d.ts +56 -0
  60. package/lib/shared/utils/detectFirestore.d.ts +31 -0
  61. package/lib/shared/utils/external/date.d.ts +36 -0
  62. package/lib/shared/utils/external/index.d.ts +11 -0
  63. package/lib/shared/utils/external/references.d.ts +12 -0
  64. package/lib/shared/utils/external/subscription.d.ts +41 -0
  65. package/lib/shared/utils/firebaseHelpers.d.ts +23 -0
  66. package/lib/shared/utils/functionWrapper.d.ts +36 -0
  67. package/lib/shared/utils/index.d.ts +14 -0
  68. package/lib/shared/utils/internal/auth.d.ts +57 -0
  69. package/lib/shared/utils/internal/firebase.d.ts +5 -0
  70. package/lib/shared/utils/internal/idempotency.d.ts +21 -0
  71. package/lib/shared/utils/internal/index.d.ts +14 -0
  72. package/lib/shared/utils/internal/monitoring.d.ts +80 -0
  73. package/lib/shared/utils/internal/rateLimiter.d.ts +82 -0
  74. package/lib/shared/utils/internal/validation.d.ts +43 -0
  75. package/lib/shared/utils/schemaValidation.d.ts +60 -0
  76. package/lib/shared/utils/validation.d.ts +98 -0
  77. package/lib/shared/utils/vercelHelpers.d.ts +18 -0
  78. package/lib/shared/utils.d.ts +234 -0
  79. package/lib/shared/validation.d.ts +16 -0
  80. package/lib/supabase/auth/deleteAccount.d.ts +16 -0
  81. package/lib/supabase/auth/getCustomClaims.d.ts +16 -0
  82. package/lib/supabase/auth/getUserAuthStatus.d.ts +18 -0
  83. package/lib/supabase/auth/removeCustomClaims.d.ts +16 -0
  84. package/lib/supabase/auth/setCustomClaims.d.ts +18 -0
  85. package/lib/supabase/baseFunction.d.ts +43 -0
  86. package/lib/supabase/billing/cancelSubscription.d.ts +9 -0
  87. package/lib/supabase/billing/changePlan.d.ts +11 -0
  88. package/lib/supabase/billing/createCheckoutSession.d.ts +11 -0
  89. package/lib/supabase/billing/createCustomerPortal.d.ts +9 -0
  90. package/lib/supabase/billing/refreshSubscriptionStatus.d.ts +9 -0
  91. package/lib/supabase/crud/aggregate.d.ts +27 -0
  92. package/lib/supabase/crud/create.d.ts +23 -0
  93. package/lib/supabase/crud/delete.d.ts +30 -0
  94. package/lib/supabase/crud/get.d.ts +23 -0
  95. package/lib/supabase/crud/index.d.ts +20 -0
  96. package/lib/supabase/crud/list.d.ts +33 -0
  97. package/lib/supabase/crud/update.d.ts +24 -0
  98. package/lib/supabase/helpers/authProvider.d.ts +22 -0
  99. package/lib/supabase/index.d.ts +30 -0
  100. package/lib/supabase/index.js +23 -0
  101. package/lib/supabase/index.js.map +7 -0
  102. package/lib/supabase/oauth/disconnect.d.ts +13 -0
  103. package/lib/supabase/oauth/exchangeToken.d.ts +13 -0
  104. package/lib/supabase/oauth/getConnections.d.ts +13 -0
  105. package/lib/supabase/oauth/index.d.ts +12 -0
  106. package/lib/supabase/oauth/refreshToken.d.ts +13 -0
  107. package/lib/supabase/registerCrudFunctions.d.ts +24 -0
  108. package/lib/supabase/utils/idempotency.d.ts +36 -0
  109. package/lib/supabase/utils/monitoring.d.ts +59 -0
  110. package/lib/supabase/utils/rateLimiter.d.ts +56 -0
  111. package/lib/vercel/api/auth/get-custom-claims.d.ts +2 -0
  112. package/lib/vercel/api/auth/get-user-auth-status.d.ts +2 -0
  113. package/lib/vercel/api/auth/index.d.ts +12 -0
  114. package/lib/vercel/api/auth/remove-custom-claims.d.ts +2 -0
  115. package/lib/vercel/api/auth/set-custom-claims.d.ts +10 -0
  116. package/lib/vercel/api/billing/cancel.d.ts +10 -0
  117. package/lib/vercel/api/billing/change-plan.d.ts +11 -0
  118. package/lib/vercel/api/billing/create-checkout-session.d.ts +13 -0
  119. package/lib/vercel/api/billing/customer-portal.d.ts +3 -0
  120. package/lib/vercel/api/billing/index.d.ts +14 -0
  121. package/lib/vercel/api/billing/refresh-subscription-status.d.ts +31 -0
  122. package/lib/vercel/api/billing/webhook-handler.d.ts +22 -0
  123. package/lib/vercel/api/config/constants.d.ts +103 -0
  124. package/lib/vercel/api/config/firebase-admin.d.ts +19 -0
  125. package/lib/vercel/api/config/index.d.ts +10 -0
  126. package/lib/vercel/api/crud/create.d.ts +2 -0
  127. package/lib/vercel/api/crud/delete.d.ts +2 -0
  128. package/lib/vercel/api/crud/get.d.ts +2 -0
  129. package/lib/vercel/api/crud/index.d.ts +13 -0
  130. package/lib/vercel/api/crud/list.d.ts +2 -0
  131. package/lib/vercel/api/crud/update.d.ts +2 -0
  132. package/lib/vercel/api/index.d.ts +13 -0
  133. package/lib/vercel/api/index.js +22 -4790
  134. package/lib/vercel/api/index.js.map +4 -4
  135. package/lib/vercel/api/oauth/check-github-access.d.ts +12 -0
  136. package/lib/vercel/api/oauth/exchange-token.d.ts +8 -0
  137. package/lib/vercel/api/oauth/grant-github-access.d.ts +12 -0
  138. package/lib/vercel/api/oauth/index.d.ts +12 -0
  139. package/lib/vercel/api/oauth/revoke-github-access.d.ts +11 -0
  140. package/lib/vercel/api/utils/cors.d.ts +49 -0
  141. package/lib/vercel/baseFunction.d.ts +25 -0
  142. package/package.json +4 -4
  143. package/src/firebase/auth/getCustomClaims.ts +3 -3
  144. package/src/firebase/auth/getUserAuthStatus.ts +3 -3
  145. package/src/firebase/auth/index.ts +1 -1
  146. package/src/firebase/auth/removeCustomClaims.ts +3 -3
  147. package/src/firebase/auth/setCustomClaims.ts +130 -84
  148. package/src/firebase/baseFunction.ts +2 -2
  149. package/src/firebase/billing/cancelSubscription.ts +3 -3
  150. package/src/firebase/billing/changePlan.ts +3 -3
  151. package/src/firebase/billing/createCheckoutSession.ts +1 -1
  152. package/src/firebase/billing/createCustomerPortal.ts +1 -1
  153. package/src/firebase/billing/healthCheck.ts +8 -24
  154. package/src/firebase/billing/index.d.ts +11 -11
  155. package/src/firebase/billing/index.ts +1 -1
  156. package/src/firebase/billing/refreshSubscriptionStatus.ts +3 -3
  157. package/src/firebase/billing/webhookHandler.ts +1 -2
  158. package/src/firebase/config/constants.ts +4 -4
  159. package/src/firebase/config/index.ts +1 -1
  160. package/src/firebase/config/secrets.ts +1 -1
  161. package/src/firebase/crud/aggregate.ts +2 -2
  162. package/src/firebase/crud/create.ts +19 -4
  163. package/src/firebase/crud/delete.ts +3 -3
  164. package/src/firebase/crud/get.ts +1 -1
  165. package/src/firebase/crud/index.ts +1 -1
  166. package/src/firebase/crud/list.ts +1 -1
  167. package/src/firebase/crud/update.ts +2 -2
  168. package/src/firebase/helpers/githubAccessHelper.ts +4 -4
  169. package/src/firebase/helpers/githubTeamAccessHelper.ts +3 -3
  170. package/src/firebase/helpers/index.ts +1 -1
  171. package/src/firebase/index.d.ts +9 -9
  172. package/src/firebase/index.ts +1 -1
  173. package/src/firebase/oauth/disconnect.ts +2 -2
  174. package/src/firebase/oauth/exchangeToken.ts +7 -7
  175. package/src/firebase/oauth/getConnections.ts +2 -2
  176. package/src/firebase/oauth/githubAccess.ts +10 -10
  177. package/src/firebase/oauth/index.ts +1 -1
  178. package/src/firebase/oauth/refreshToken.ts +2 -2
  179. package/src/firebase/registerCrudFunctions.ts +1 -1
  180. package/src/firebase/scheduled/checkExpiredSubscriptions.ts +1 -1
  181. package/src/firebase/scheduled/index.ts +1 -1
  182. package/src/shared/__tests__/auth.test.ts +46 -0
  183. package/src/shared/__tests__/errorHandling.test.ts +66 -1
  184. package/src/shared/__tests__/firebase.test.ts +293 -0
  185. package/src/shared/__tests__/internalValidation.test.ts +190 -0
  186. package/src/shared/__tests__/metadata.test.ts +66 -0
  187. package/src/shared/__tests__/schema.test.ts +219 -0
  188. package/src/shared/__tests__/schemaValidation.test.ts +72 -0
  189. package/src/shared/__tests__/subscription.test.ts +45 -0
  190. package/src/shared/__tests__/utils.test.ts +281 -0
  191. package/src/shared/__tests__/validation-env.test.ts +73 -0
  192. package/src/shared/billing/__tests__/createCheckout.test.ts +1 -1
  193. package/src/shared/billing/__tests__/webhookHandler.test.ts +1 -1
  194. package/src/shared/billing/createCheckout.ts +10 -5
  195. package/src/shared/billing/helpers/index.ts +1 -1
  196. package/src/shared/billing/helpers/subscriptionManagement.ts +4 -4
  197. package/src/shared/billing/helpers/updateUserSubscription.ts +4 -4
  198. package/src/shared/billing/idempotency.ts +4 -4
  199. package/src/shared/billing/index.ts +1 -1
  200. package/src/shared/billing/webhookHandler.ts +7 -7
  201. package/src/shared/errorHandling.ts +2 -2
  202. package/src/shared/firebase.ts +7 -7
  203. package/src/shared/github.ts +11 -11
  204. package/src/shared/index.d.ts +9 -9
  205. package/src/shared/index.ts +1 -1
  206. package/src/shared/logger.ts +8 -8
  207. package/src/shared/metadata.ts +3 -3
  208. package/src/shared/oauth/__tests__/exchangeToken.test.ts +1 -1
  209. package/src/shared/oauth/exchangeToken.ts +2 -2
  210. package/src/shared/oauth/grantAccess.ts +2 -2
  211. package/src/shared/oauth/index.ts +1 -1
  212. package/src/shared/schema.ts +4 -4
  213. package/src/shared/utils/__tests__/functionWrapper.test.ts +1 -1
  214. package/src/shared/utils/detectFirestore.ts +3 -3
  215. package/src/shared/utils/external/date.ts +5 -5
  216. package/src/shared/utils/external/index.ts +1 -1
  217. package/src/shared/utils/external/references.ts +2 -2
  218. package/src/shared/utils/external/subscription.ts +5 -5
  219. package/src/shared/utils/firebaseHelpers.ts +3 -3
  220. package/src/shared/utils/functionWrapper.ts +4 -4
  221. package/src/shared/utils/index.ts +1 -1
  222. package/src/shared/utils/internal/auth.ts +7 -7
  223. package/src/shared/utils/internal/firebase.ts +1 -1
  224. package/src/shared/utils/internal/idempotency.ts +3 -3
  225. package/src/shared/utils/internal/index.ts +1 -1
  226. package/src/shared/utils/internal/monitoring.ts +8 -8
  227. package/src/shared/utils/internal/rateLimiter.ts +6 -6
  228. package/src/shared/utils/internal/validation.ts +6 -6
  229. package/src/shared/utils/schemaValidation.ts +6 -6
  230. package/src/shared/utils/validation.ts +10 -10
  231. package/src/shared/utils/vercelHelpers.ts +3 -3
  232. package/src/shared/utils.ts +19 -19
  233. package/src/shared/validation.ts +2 -2
  234. package/src/supabase/auth/deleteAccount.ts +2 -2
  235. package/src/supabase/auth/getCustomClaims.ts +2 -2
  236. package/src/supabase/auth/getUserAuthStatus.ts +2 -2
  237. package/src/supabase/auth/removeCustomClaims.ts +2 -2
  238. package/src/supabase/auth/setCustomClaims.ts +2 -2
  239. package/src/supabase/baseFunction.ts +3 -3
  240. package/src/supabase/billing/cancelSubscription.ts +2 -2
  241. package/src/supabase/billing/changePlan.ts +2 -2
  242. package/src/supabase/billing/createCheckoutSession.ts +2 -2
  243. package/src/supabase/billing/createCustomerPortal.ts +2 -2
  244. package/src/supabase/billing/refreshSubscriptionStatus.ts +2 -2
  245. package/src/supabase/crud/aggregate.ts +11 -8
  246. package/src/supabase/crud/create.ts +2 -2
  247. package/src/supabase/crud/delete.ts +1 -1
  248. package/src/supabase/crud/get.ts +2 -2
  249. package/src/supabase/crud/index.ts +1 -1
  250. package/src/supabase/crud/list.ts +2 -2
  251. package/src/supabase/crud/update.ts +2 -2
  252. package/src/supabase/helpers/authProvider.ts +2 -2
  253. package/src/supabase/index.ts +10 -2
  254. package/src/supabase/oauth/disconnect.ts +104 -0
  255. package/src/supabase/oauth/exchangeToken.ts +152 -0
  256. package/src/supabase/oauth/getConnections.ts +85 -0
  257. package/src/supabase/oauth/index.ts +15 -0
  258. package/src/supabase/oauth/refreshToken.ts +131 -0
  259. package/src/supabase/registerCrudFunctions.ts +1 -1
  260. package/src/supabase/utils/idempotency.ts +1 -1
  261. package/src/supabase/utils/monitoring.ts +1 -1
  262. package/src/supabase/utils/rateLimiter.ts +1 -1
  263. package/src/vercel/api/auth/get-custom-claims.ts +1 -1
  264. package/src/vercel/api/auth/get-user-auth-status.ts +1 -1
  265. package/src/vercel/api/auth/index.ts +1 -1
  266. package/src/vercel/api/auth/remove-custom-claims.ts +1 -1
  267. package/src/vercel/api/auth/set-custom-claims.ts +69 -24
  268. package/src/vercel/api/billing/cancel.ts +3 -3
  269. package/src/vercel/api/billing/change-plan.ts +3 -3
  270. package/src/vercel/api/billing/create-checkout-session.ts +3 -3
  271. package/src/vercel/api/billing/customer-portal.ts +1 -1
  272. package/src/vercel/api/billing/index.ts +1 -1
  273. package/src/vercel/api/billing/refresh-subscription-status.ts +1 -1
  274. package/src/vercel/api/billing/webhook-handler.ts +3 -3
  275. package/src/vercel/api/config/constants.ts +9 -9
  276. package/src/vercel/api/config/firebase-admin.ts +3 -3
  277. package/src/vercel/api/config/index.ts +1 -1
  278. package/src/vercel/api/crud/create.ts +1 -1
  279. package/src/vercel/api/crud/delete.ts +1 -1
  280. package/src/vercel/api/crud/get.ts +1 -1
  281. package/src/vercel/api/crud/index.ts +1 -1
  282. package/src/vercel/api/crud/list.ts +1 -1
  283. package/src/vercel/api/crud/update.ts +1 -1
  284. package/src/vercel/api/index.d.ts +1 -1
  285. package/src/vercel/api/index.ts +1 -1
  286. package/src/vercel/api/oauth/check-github-access.ts +3 -3
  287. package/src/vercel/api/oauth/exchange-token.ts +1 -1
  288. package/src/vercel/api/oauth/grant-github-access.ts +3 -3
  289. package/src/vercel/api/oauth/index.ts +1 -1
  290. package/src/vercel/api/oauth/revoke-github-access.ts +1 -1
  291. package/src/vercel/api/utils/cors.ts +4 -4
  292. package/src/vercel/baseFunction.ts +2 -2
@@ -4,7 +4,7 @@
4
4
  * @fileoverview Idempotency utilities for functions
5
5
  * @description Provides idempotency checking and storage for function calls
6
6
  *
7
- * @version 0.0.1
7
+ * @version 0.1.0
8
8
  * @since 0.0.1
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
@@ -22,7 +22,7 @@ export interface IdempotencyResult<T = any> {
22
22
  /**
23
23
  * Check if an operation has already been processed (idempotency check)
24
24
  *
25
- * @version 0.0.1
25
+ * @version 0.1.0
26
26
  * @since 0.0.1
27
27
  * @author AMBROISE PARK Consulting
28
28
  */
@@ -65,7 +65,7 @@ export async function checkIdempotency<T = any>(
65
65
  /**
66
66
  * Store the result of an operation for idempotency
67
67
  *
68
- * @version 0.0.1
68
+ * @version 0.1.0
69
69
  * @since 0.0.1
70
70
  * @author AMBROISE PARK Consulting
71
71
  */
@@ -4,7 +4,7 @@
4
4
  * @fileoverview Internal utilities barrel exports
5
5
  * @description Centralized exports for internal utility functions
6
6
  *
7
- * @version 0.0.1
7
+ * @version 0.1.0
8
8
  * @since 0.0.1
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
@@ -4,7 +4,7 @@
4
4
  * @fileoverview Monitoring and alerting utilities for functions
5
5
  * @description Provides metrics collection and alerting for payment operations
6
6
  *
7
- * @version 0.0.1
7
+ * @version 0.1.0
8
8
  * @since 0.0.1
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
@@ -16,7 +16,7 @@ import { getFirebaseAdminFirestore } from '@donotdev/firebase/server';
16
16
  /**
17
17
  * Payment metrics data structure
18
18
  *
19
- * @version 0.0.1
19
+ * @version 0.1.0
20
20
  * @since 0.0.1
21
21
  * @author AMBROISE PARK Consulting
22
22
  */
@@ -33,7 +33,7 @@ export interface PaymentMetrics {
33
33
  /**
34
34
  * Alert threshold configuration
35
35
  *
36
- * @version 0.0.1
36
+ * @version 0.1.0
37
37
  * @since 0.0.1
38
38
  * @author AMBROISE PARK Consulting
39
39
  */
@@ -46,7 +46,7 @@ export interface AlertThresholds {
46
46
  /**
47
47
  * Record payment metrics for monitoring
48
48
  *
49
- * @version 0.0.1
49
+ * @version 0.1.0
50
50
  * @since 0.0.1
51
51
  * @author AMBROISE PARK Consulting
52
52
  */
@@ -78,7 +78,7 @@ export async function recordPaymentMetrics(
78
78
  /**
79
79
  * Check payment failure rate and trigger alerts if needed
80
80
  *
81
- * @version 0.0.1
81
+ * @version 0.1.0
82
82
  * @since 0.0.1
83
83
  * @author AMBROISE PARK Consulting
84
84
  */
@@ -127,7 +127,7 @@ export async function checkPaymentFailureRate(
127
127
  /**
128
128
  * Check daily payment volume and trigger alerts if needed
129
129
  *
130
- * @version 0.0.1
130
+ * @version 0.1.0
131
131
  * @since 0.0.1
132
132
  * @author AMBROISE PARK Consulting
133
133
  */
@@ -249,7 +249,7 @@ async function triggerHighVolumeAlert(
249
249
  /**
250
250
  * Get payment metrics summary for a time period
251
251
  *
252
- * @version 0.0.1
252
+ * @version 0.1.0
253
253
  * @since 0.0.1
254
254
  * @author AMBROISE PARK Consulting
255
255
  */
@@ -317,7 +317,7 @@ export async function getPaymentMetricsSummary(
317
317
  /**
318
318
  * Clean up old metrics and alerts (call periodically)
319
319
  *
320
- * @version 0.0.1
320
+ * @version 0.1.0
321
321
  * @since 0.0.1
322
322
  * @author AMBROISE PARK Consulting
323
323
  */
@@ -4,7 +4,7 @@
4
4
  * @fileoverview Server-side rate limiting utilities
5
5
  * @description Rate limiting implementation for Firebase Functions and Vercel
6
6
  *
7
- * @version 0.0.1
7
+ * @version 0.1.0
8
8
  * @since 0.0.1
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
@@ -32,7 +32,7 @@ const rateLimitStore = new Map<string, RateLimitEntry>();
32
32
  * Check rate limit for a given key using in-memory storage
33
33
  * For production, this should be replaced with Redis or Firestore
34
34
  *
35
- * @version 0.0.1
35
+ * @version 0.1.0
36
36
  * @since 0.0.1
37
37
  * @author AMBROISE PARK Consulting
38
38
  */
@@ -113,7 +113,7 @@ export async function checkRateLimit(
113
113
  * For stricter rate limiting (e.g. payment endpoints), consumers can use
114
114
  * Redis-backed rate limiters or API gateway-level throttling.
115
115
  *
116
- * @version 0.0.1
116
+ * @version 0.1.0
117
117
  * @since 0.0.1
118
118
  * @author AMBROISE PARK Consulting
119
119
  */
@@ -238,7 +238,7 @@ export async function checkRateLimitWithFirestore(
238
238
  /**
239
239
  * Reset rate limit for a given key
240
240
  *
241
- * @version 0.0.1
241
+ * @version 0.1.0
242
242
  * @since 0.0.1
243
243
  * @author AMBROISE PARK Consulting
244
244
  */
@@ -250,7 +250,7 @@ export function resetRateLimit(key: string): void {
250
250
  /**
251
251
  * Reset rate limit in Firestore
252
252
  *
253
- * @version 0.0.1
253
+ * @version 0.1.0
254
254
  * @since 0.0.1
255
255
  * @author AMBROISE PARK Consulting
256
256
  */
@@ -272,7 +272,7 @@ export async function resetRateLimitInFirestore(key: string): Promise<void> {
272
272
  /**
273
273
  * Get rate limit status without consuming an attempt
274
274
  *
275
- * @version 0.0.1
275
+ * @version 0.1.0
276
276
  * @since 0.0.1
277
277
  * @author AMBROISE PARK Consulting
278
278
  */
@@ -4,7 +4,7 @@
4
4
  * @fileoverview Validation utility functions
5
5
  * @description Functions for validating environment and data
6
6
  *
7
- * @version 0.0.2
7
+ * @version 0.1.0
8
8
  * @since 0.0.1
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
@@ -16,7 +16,7 @@ import { DoNotDevError } from '@donotdev/core/server';
16
16
  /**
17
17
  * Validates environment variables required for Stripe
18
18
  *
19
- * @version 0.0.1
19
+ * @version 0.1.0
20
20
  * @since 0.0.1
21
21
  * @author AMBROISE PARK Consulting
22
22
  */
@@ -34,7 +34,7 @@ export function validateStripeEnvironment(): void {
34
34
  /**
35
35
  * Safely parses JSON with error handling
36
36
  *
37
- * @version 0.0.1
37
+ * @version 0.1.0
38
38
  * @since 0.0.1
39
39
  * @author AMBROISE PARK Consulting
40
40
  */
@@ -57,7 +57,7 @@ export function safeJsonParse<T = any>(json: string): T | null {
57
57
  * @param name - Collection name to validate
58
58
  * @throws Error if the name is unsafe
59
59
  *
60
- * @version 0.0.1
60
+ * @version 0.1.0
61
61
  * @since 0.0.1
62
62
  * @author AMBROISE PARK Consulting
63
63
  */
@@ -78,7 +78,7 @@ export function validateCollectionName(name: string): void {
78
78
  * W1: Previous stub ignored the schema parameter entirely. Now performs
79
79
  * actual schema validation when a schema is provided.
80
80
  *
81
- * @version 0.0.2
81
+ * @version 0.1.0
82
82
  * @since 0.0.1
83
83
  * @author AMBROISE PARK Consulting
84
84
  */
@@ -102,7 +102,7 @@ export function validateDocument(data: any, schema?: any): void {
102
102
  const messages = result.issues
103
103
  .map(
104
104
  (issue) =>
105
- `${issue.path?.map((p) => (p as any).key).join('.') || 'root'}: ${issue.message}`
105
+ `${issue.path?.map((p: { key: string }) => p.key).join('.') || 'root'}: ${issue.message}`
106
106
  )
107
107
  .join('; ');
108
108
  throw new DoNotDevError(
@@ -4,7 +4,7 @@
4
4
  * @fileoverview DRY utilities for schema validation across all functions
5
5
  * @description Provides reusable patterns for Firebase and Vercel functions
6
6
  *
7
- * @version 0.0.1
7
+ * @version 0.1.0
8
8
  * @since 0.0.1
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
@@ -17,7 +17,7 @@ import type { NextApiRequest, NextApiResponse } from 'next';
17
17
  /**
18
18
  * Validates request data using a schema with custom override support
19
19
  *
20
- * @version 0.0.1
20
+ * @version 0.1.0
21
21
  * @since 0.0.1
22
22
  * @author AMBROISE PARK Consulting
23
23
  */
@@ -45,7 +45,7 @@ export function validateRequestData<T>(
45
45
  /**
46
46
  * Firebase function wrapper that adds schema validation
47
47
  *
48
- * @version 0.0.1
48
+ * @version 0.1.0
49
49
  * @since 0.0.1
50
50
  * @author AMBROISE PARK Consulting
51
51
  */
@@ -77,7 +77,7 @@ export function withSchemaValidation<TRequest, TResponse>(
77
77
  /**
78
78
  * Vercel function wrapper that adds schema validation
79
79
  *
80
- * @version 0.0.1
80
+ * @version 0.1.0
81
81
  * @since 0.0.1
82
82
  * @author AMBROISE PARK Consulting
83
83
  */
@@ -113,7 +113,7 @@ export function withVercelSchemaValidation<TRequest, TResponse>(
113
113
  /**
114
114
  * Creates both standard and custom schema versions of a Firebase function
115
115
  *
116
- * @version 0.0.1
116
+ * @version 0.1.0
117
117
  * @since 0.0.1
118
118
  * @author AMBROISE PARK Consulting
119
119
  */
@@ -141,7 +141,7 @@ export function createFirebaseFunction<TRequest, TResponse>(
141
141
  /**
142
142
  * Creates a Vercel function with schema validation
143
143
  *
144
- * @version 0.0.1
144
+ * @version 0.1.0
145
145
  * @since 0.0.1
146
146
  * @author AMBROISE PARK Consulting
147
147
  */
@@ -4,7 +4,7 @@
4
4
  * @fileoverview Enhanced validation utilities
5
5
  * @description Comprehensive validation functions for Stripe operations
6
6
  *
7
- * @version 0.0.1
7
+ * @version 0.1.0
8
8
  * @since 0.0.1
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
@@ -50,7 +50,7 @@ export const StripeValidationSchemas = {
50
50
  /**
51
51
  * Validation result interface
52
52
  *
53
- * @version 0.0.1
53
+ * @version 0.1.0
54
54
  * @since 0.0.1
55
55
  * @author AMBROISE PARK Consulting
56
56
  */
@@ -63,7 +63,7 @@ export interface ValidationResult {
63
63
  /**
64
64
  * Validate webhook event
65
65
  *
66
- * @version 0.0.1
66
+ * @version 0.1.0
67
67
  * @since 0.0.1
68
68
  * @author AMBROISE PARK Consulting
69
69
  */
@@ -104,7 +104,7 @@ export function validateWebhookEvent(data: any): ValidationResult {
104
104
  /**
105
105
  * Validate purchase request
106
106
  *
107
- * @version 0.0.1
107
+ * @version 0.1.0
108
108
  * @since 0.0.1
109
109
  * @author AMBROISE PARK Consulting
110
110
  */
@@ -148,7 +148,7 @@ export function validatePurchaseRequest(data: any): ValidationResult {
148
148
  /**
149
149
  * Validate GitHub username format
150
150
  *
151
- * @version 0.0.1
151
+ * @version 0.1.0
152
152
  * @since 0.0.1
153
153
  * @author AMBROISE PARK Consulting
154
154
  */
@@ -161,7 +161,7 @@ export function validateGitHubUsername(username: string): boolean {
161
161
  /**
162
162
  * Validate email format
163
163
  *
164
- * @version 0.0.1
164
+ * @version 0.1.0
165
165
  * @since 0.0.1
166
166
  * @author AMBROISE PARK Consulting
167
167
  */
@@ -173,7 +173,7 @@ export function validateEmail(email: string): boolean {
173
173
  /**
174
174
  * Validate price ID format (Stripe price IDs start with 'price_')
175
175
  *
176
- * @version 0.0.1
176
+ * @version 0.1.0
177
177
  * @since 0.0.1
178
178
  * @author AMBROISE PARK Consulting
179
179
  */
@@ -184,7 +184,7 @@ export function validateStripePriceId(priceId: string): boolean {
184
184
  /**
185
185
  * Validate session ID format (Stripe session IDs start with 'cs_')
186
186
  *
187
- * @version 0.0.1
187
+ * @version 0.1.0
188
188
  * @since 0.0.1
189
189
  * @author AMBROISE PARK Consulting
190
190
  */
@@ -195,7 +195,7 @@ export function validateStripeSessionId(sessionId: string): boolean {
195
195
  /**
196
196
  * Validate URL format
197
197
  *
198
- * @version 0.0.1
198
+ * @version 0.1.0
199
199
  * @since 0.0.1
200
200
  * @author AMBROISE PARK Consulting
201
201
  */
@@ -218,7 +218,7 @@ export function validateUrl(url: string, name: string = 'URL'): string {
218
218
  /**
219
219
  * Validate and sanitize metadata object
220
220
  *
221
- * @version 0.0.1
221
+ * @version 0.1.0
222
222
  * @since 0.0.1
223
223
  * @author AMBROISE PARK Consulting
224
224
  */
@@ -4,7 +4,7 @@
4
4
  * @fileoverview DRY helpers for Vercel API functions with schema validation
5
5
  * @description Provides reusable patterns for Vercel API routes
6
6
  *
7
- * @version 0.0.1
7
+ * @version 0.1.0
8
8
  * @since 0.0.1
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
@@ -20,7 +20,7 @@ import type * as v from 'valibot';
20
20
  /**
21
21
  * Creates a Vercel API handler with schema validation
22
22
  *
23
- * @version 0.0.1
23
+ * @version 0.1.0
24
24
  * @since 0.0.1
25
25
  * @author AMBROISE PARK Consulting
26
26
  */
@@ -38,7 +38,7 @@ export function createVercelHandler<TRequest, TResponse>(
38
38
  /**
39
39
  * Creates a Vercel API handler with method validation and schema validation
40
40
  *
41
- * @version 0.0.1
41
+ * @version 0.1.0
42
42
  * @since 0.0.1
43
43
  * @author AMBROISE PARK Consulting
44
44
  */
@@ -4,7 +4,7 @@
4
4
  * @fileoverview Shared utilities for Firebase and Vercel functions
5
5
  * @description Common utilities that can be used by both Firebase and Vercel function implementations
6
6
  *
7
- * @version 0.0.1
7
+ * @version 0.1.0
8
8
  * @since 0.0.1
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
@@ -32,7 +32,7 @@ export { DoNotDevError };
32
32
  * Get Firestore instance using @donotdev/firebase/server
33
33
  * Provider handles initialization and caching
34
34
  *
35
- * @version 0.0.1
35
+ * @version 0.1.0
36
36
  * @since 0.0.1
37
37
  * @author AMBROISE PARK Consulting
38
38
  */
@@ -44,7 +44,7 @@ export function getFirestore() {
44
44
  * Get Auth instance using @donotdev/firebase/server
45
45
  * Provider handles initialization and caching
46
46
  *
47
- * @version 0.0.1
47
+ * @version 0.1.0
48
48
  * @since 0.0.1
49
49
  * @author AMBROISE PARK Consulting
50
50
  */
@@ -73,7 +73,7 @@ export function initStripe(apiKey: string) {
73
73
  /**
74
74
  * Get Stripe instance with lazy initialization
75
75
  *
76
- * @version 0.0.1
76
+ * @version 0.1.0
77
77
  * @since 0.0.1
78
78
  * @author AMBROISE PARK Consulting
79
79
  */
@@ -96,7 +96,7 @@ export function getStripe(): Stripe {
96
96
  /**
97
97
  * Lazy-initialized Stripe instance proxy
98
98
  *
99
- * @version 0.0.1
99
+ * @version 0.1.0
100
100
  * @since 0.0.1
101
101
  * @author AMBROISE PARK Consulting
102
102
  */
@@ -116,7 +116,7 @@ export const stripe = new Proxy({} as Stripe, {
116
116
  * @param auth - Firebase callable request auth context (object with `.uid`)
117
117
  * @returns The authenticated user's uid
118
118
  *
119
- * @version 0.0.3
119
+ * @version 0.1.0
120
120
  * @since 0.0.1
121
121
  * @author AMBROISE PARK Consulting
122
122
  */
@@ -140,7 +140,7 @@ export function assertAuthenticated(auth: any): string {
140
140
  * @param auth - Firebase auth context from callable function
141
141
  * @returns UserRole for visibility filtering
142
142
  *
143
- * @version 0.0.1
143
+ * @version 0.1.0
144
144
  * @since 0.0.1
145
145
  * @author AMBROISE PARK Consulting
146
146
  */
@@ -162,7 +162,7 @@ export function getUserRole(auth: any): UserRole {
162
162
  /**
163
163
  * Validates that required Stripe environment variables are set
164
164
  *
165
- * @version 0.0.1
165
+ * @version 0.1.0
166
166
  * @since 0.0.1
167
167
  * @author AMBROISE PARK Consulting
168
168
  */
@@ -177,7 +177,7 @@ export function validateStripeEnvironment(): void {
177
177
  /**
178
178
  * Creates a standardized success response
179
179
  *
180
- * @version 0.0.1
180
+ * @version 0.1.0
181
181
  * @since 0.0.1
182
182
  * @author AMBROISE PARK Consulting
183
183
  */
@@ -191,7 +191,7 @@ export function createSuccessResponse<T>(data: T): { success: true; data: T } {
191
191
  /**
192
192
  * Creates a standardized error response
193
193
  *
194
- * @version 0.0.1
194
+ * @version 0.1.0
195
195
  * @since 0.0.1
196
196
  * @author AMBROISE PARK Consulting
197
197
  */
@@ -251,7 +251,7 @@ export function createErrorResponse(error: unknown): {
251
251
  * (which requires an authProvider) instead.
252
252
  *
253
253
  * @deprecated Import `updateUserSubscription` from `@donotdev/functions/shared/billing/helpers/updateUserSubscription`.
254
- * @version 0.0.2
254
+ * @version 0.1.0
255
255
  * @since 0.0.1
256
256
  * @author AMBROISE PARK Consulting
257
257
  */
@@ -271,7 +271,7 @@ export async function updateUserSubscription(
271
271
  * C10: This was a silent no-op stub. Now throws to surface the missing implementation.
272
272
  *
273
273
  * @deprecated Import from `@donotdev/functions/shared/billing/helpers` or implement directly using Firebase Admin SDK / Stripe API.
274
- * @version 0.0.2
274
+ * @version 0.1.0
275
275
  * @since 0.0.1
276
276
  * @author AMBROISE PARK Consulting
277
277
  */
@@ -288,7 +288,7 @@ export async function getUserSubscription(_firebaseUid: string): Promise<any> {
288
288
  * C10: This was a silent no-op stub. Now throws to surface the missing implementation.
289
289
  *
290
290
  * @deprecated Import `cancelUserSubscription` from `@donotdev/functions/shared/billing/helpers/subscriptionManagement`.
291
- * @version 0.0.2
291
+ * @version 0.1.0
292
292
  * @since 0.0.1
293
293
  * @author AMBROISE PARK Consulting
294
294
  */
@@ -308,7 +308,7 @@ export async function cancelUserSubscription(
308
308
  * C10: This was a silent no-op stub. Now throws to surface the missing implementation.
309
309
  *
310
310
  * @deprecated Handle via Stripe webhook events. Use `processWebhook` from `@donotdev/functions/shared/billing/webhookHandler`.
311
- * @version 0.0.2
311
+ * @version 0.1.0
312
312
  * @since 0.0.1
313
313
  * @author AMBROISE PARK Consulting
314
314
  */
@@ -329,7 +329,7 @@ export async function handleSubscriptionCancellation(
329
329
  * @deprecated Import `assertAdmin` from `@donotdev/functions/shared/utils/internal/auth` instead.
330
330
  * This is a thin wrapper that delegates to the canonical provider-agnostic version.
331
331
  *
332
- * @version 0.0.3
332
+ * @version 0.1.0
333
333
  * @since 0.0.1
334
334
  * @author AMBROISE PARK Consulting
335
335
  */
@@ -340,7 +340,7 @@ export async function assertAdmin(uid: string): Promise<string> {
340
340
  /**
341
341
  * Validates document data
342
342
  *
343
- * @version 0.0.1
343
+ * @version 0.1.0
344
344
  * @since 0.0.1
345
345
  * @author AMBROISE PARK Consulting
346
346
  */
@@ -387,7 +387,7 @@ export function validateDocument(data: any, schema?: any): void {
387
387
  * @param name - Collection name to validate
388
388
  * @throws Error if the name is unsafe
389
389
  *
390
- * @version 0.0.1
390
+ * @version 0.1.0
391
391
  * @since 0.0.1
392
392
  * @author AMBROISE PARK Consulting
393
393
  */
@@ -405,7 +405,7 @@ export function validateCollectionName(name: string): void {
405
405
  /**
406
406
  * Verifies Firebase auth token
407
407
  *
408
- * @version 0.0.1
408
+ * @version 0.1.0
409
409
  * @since 0.0.1
410
410
  * @author AMBROISE PARK Consulting
411
411
  */
@@ -425,7 +425,7 @@ export async function verifyFirebaseAuthToken(token: string): Promise<string> {
425
425
  /**
426
426
  * Finds references to a document
427
427
  *
428
- * @version 0.0.1
428
+ * @version 0.1.0
429
429
  * @since 0.0.1
430
430
  * @author AMBROISE PARK Consulting
431
431
  */
@@ -4,7 +4,7 @@
4
4
  * @fileoverview Environment validation utilities
5
5
  * @description Validate required environment variables on module load
6
6
  *
7
- * @version 0.0.1
7
+ * @version 0.1.0
8
8
  * @since 0.0.1
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
@@ -12,7 +12,7 @@
12
12
  /**
13
13
  * Validates required environment variables
14
14
  *
15
- * @version 0.0.1
15
+ * @version 0.1.0
16
16
  * @since 0.0.1
17
17
  * @author AMBROISE PARK Consulting
18
18
  */
@@ -4,7 +4,7 @@
4
4
  * @fileoverview Delete Account Supabase Edge Function
5
5
  * @description Deletes the authenticated user's account via Supabase Admin.
6
6
  *
7
- * @version 0.0.1
7
+ * @version 0.1.0
8
8
  * @since 0.5.0
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
@@ -35,7 +35,7 @@ const deleteAccountSchema = v.object({});
35
35
  * Deno.serve(createDeleteAccount());
36
36
  * ```
37
37
  *
38
- * @version 0.0.1
38
+ * @version 0.1.0
39
39
  * @since 0.5.0
40
40
  */
41
41
  export function createDeleteAccount() {
@@ -4,7 +4,7 @@
4
4
  * @fileoverview Get Custom Claims Supabase Edge Function
5
5
  * @description Returns the authenticated user's app_metadata (custom claims).
6
6
  *
7
- * @version 0.0.1
7
+ * @version 0.1.0
8
8
  * @since 0.6.0
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
@@ -35,7 +35,7 @@ const getCustomClaimsSchema = v.object({});
35
35
  * Deno.serve(createGetCustomClaims());
36
36
  * ```
37
37
  *
38
- * @version 0.0.1
38
+ * @version 0.1.0
39
39
  * @since 0.6.0
40
40
  */
41
41
  export function createGetCustomClaims() {
@@ -4,7 +4,7 @@
4
4
  * @fileoverview Get User Auth Status Supabase Edge Function
5
5
  * @description Returns the authenticated user's profile and custom claims.
6
6
  *
7
- * @version 0.0.1
7
+ * @version 0.1.0
8
8
  * @since 0.6.0
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
@@ -37,7 +37,7 @@ const getUserAuthStatusSchema = v.object({});
37
37
  * Deno.serve(createGetUserAuthStatus());
38
38
  * ```
39
39
  *
40
- * @version 0.0.1
40
+ * @version 0.1.0
41
41
  * @since 0.6.0
42
42
  */
43
43
  export function createGetUserAuthStatus() {
@@ -4,7 +4,7 @@
4
4
  * @fileoverview Remove Custom Claims Supabase Edge Function
5
5
  * @description Removes specific keys from the user's app_metadata.
6
6
  *
7
- * @version 0.0.1
7
+ * @version 0.1.0
8
8
  * @since 0.6.0
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
@@ -40,7 +40,7 @@ const removeCustomClaimsSchema = v.object({
40
40
  * Deno.serve(createRemoveCustomClaims());
41
41
  * ```
42
42
  *
43
- * @version 0.0.1
43
+ * @version 0.1.0
44
44
  * @since 0.6.0
45
45
  */
46
46
  export function createRemoveCustomClaims() {
@@ -4,7 +4,7 @@
4
4
  * @fileoverview Set Custom Claims Supabase Edge Function
5
5
  * @description Merges custom claims into the user's app_metadata.
6
6
  *
7
- * @version 0.0.1
7
+ * @version 0.1.0
8
8
  * @since 0.6.0
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
@@ -40,7 +40,7 @@ const setCustomClaimsSchema = v.object({
40
40
  * Deno.serve(createSetCustomClaims());
41
41
  * ```
42
42
  *
43
- * @version 0.0.1
43
+ * @version 0.1.0
44
44
  * @since 0.6.0
45
45
  */
46
46
  export function createSetCustomClaims() {
@@ -5,7 +5,7 @@
5
5
  * @description Handles auth verification, request validation, and error responses
6
6
  * for Supabase Edge Functions. Mirrors the Firebase/Vercel base function pattern.
7
7
  *
8
- * @version 0.0.1
8
+ * @version 0.1.0
9
9
  * @since 0.5.0
10
10
  * @author AMBROISE PARK Consulting
11
11
  */
@@ -32,7 +32,7 @@ import type { SupabaseClient } from '@supabase/supabase-js';
32
32
  /**
33
33
  * Context passed to Supabase Edge Function business logic
34
34
  *
35
- * @version 0.0.1
35
+ * @version 0.1.0
36
36
  * @since 0.5.0
37
37
  */
38
38
  export interface SupabaseHandlerContext {
@@ -70,7 +70,7 @@ export interface SupabaseHandlerContext {
70
70
  * }, 'admin');
71
71
  * ```
72
72
  *
73
- * @version 0.0.1
73
+ * @version 0.1.0
74
74
  * @since 0.5.0
75
75
  */
76
76
  export function createSupabaseHandler<TReq, TRes>(