@donotdev/functions 0.1.1 → 0.1.42

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 (348) hide show
  1. package/LICENSE.md +21 -242
  2. package/README.md +4 -4
  3. package/guidelines/FUNCTIONS.md +0 -0
  4. package/guidelines/VERCEL.md +27 -1
  5. package/lib/firebase/auth/getCustomClaims.d.ts +0 -0
  6. package/lib/firebase/auth/getUserAuthStatus.d.ts +0 -0
  7. package/lib/firebase/auth/index.d.ts +0 -0
  8. package/lib/firebase/auth/removeCustomClaims.d.ts +0 -0
  9. package/lib/firebase/auth/setCustomClaims.d.ts +0 -0
  10. package/lib/firebase/baseFunction.d.ts +0 -0
  11. package/lib/firebase/billing/cancelSubscription.d.ts +0 -0
  12. package/lib/firebase/billing/changePlan.d.ts +0 -0
  13. package/lib/firebase/billing/createCheckoutSession.d.ts +0 -0
  14. package/lib/firebase/billing/createCustomerPortal.d.ts +0 -0
  15. package/lib/firebase/billing/healthCheck.d.ts +0 -0
  16. package/lib/firebase/billing/index.d.ts +0 -0
  17. package/lib/firebase/billing/refreshSubscriptionStatus.d.ts +0 -0
  18. package/lib/firebase/billing/webhookHandler.d.ts +0 -0
  19. package/lib/firebase/config/constants.d.ts +0 -0
  20. package/lib/firebase/config/index.d.ts +0 -0
  21. package/lib/firebase/config/secrets.d.ts +0 -0
  22. package/lib/firebase/crud/aggregate.d.ts +0 -0
  23. package/lib/firebase/crud/bulk.d.ts +107 -0
  24. package/lib/firebase/crud/create.d.ts +1 -1
  25. package/lib/firebase/crud/delete.d.ts +0 -0
  26. package/lib/firebase/crud/get.d.ts +0 -0
  27. package/lib/firebase/crud/index.d.ts +1 -0
  28. package/lib/firebase/crud/list.d.ts +0 -0
  29. package/lib/firebase/crud/update.d.ts +0 -0
  30. package/lib/firebase/helpers/githubAccessHelper.d.ts +0 -0
  31. package/lib/firebase/helpers/githubTeamAccessHelper.d.ts +0 -0
  32. package/lib/firebase/helpers/index.d.ts +0 -0
  33. package/lib/firebase/index.d.ts +0 -0
  34. package/lib/firebase/index.js +3 -3
  35. package/lib/firebase/index.js.map +4 -4
  36. package/lib/firebase/oauth/disconnect.d.ts +0 -0
  37. package/lib/firebase/oauth/exchangeToken.d.ts +0 -0
  38. package/lib/firebase/oauth/getConnections.d.ts +0 -0
  39. package/lib/firebase/oauth/githubAccess.d.ts +0 -0
  40. package/lib/firebase/oauth/index.d.ts +0 -0
  41. package/lib/firebase/oauth/refreshToken.d.ts +0 -0
  42. package/lib/firebase/registerCrudFunctions.d.ts +0 -0
  43. package/lib/firebase/scheduled/checkExpiredSubscriptions.d.ts +0 -0
  44. package/lib/firebase/scheduled/index.d.ts +0 -0
  45. package/lib/shared/ai/classifyAIError.d.ts +0 -0
  46. package/lib/shared/ai/costTracker.d.ts +0 -0
  47. package/lib/shared/ai/createAIHandler.d.ts +39 -0
  48. package/lib/shared/ai/createAIRoute.d.ts +0 -0
  49. package/lib/shared/ai/index.d.ts +0 -0
  50. package/lib/shared/ai/providers/anthropic.d.ts +12 -0
  51. package/lib/shared/ai/providers/google.d.ts +10 -0
  52. package/lib/shared/ai/providers/index.d.ts +23 -0
  53. package/lib/shared/ai/providers/openai.d.ts +10 -0
  54. package/lib/shared/ai/resolveModelTier.d.ts +0 -0
  55. package/lib/shared/ai/utils/parseSSE.d.ts +22 -0
  56. package/lib/shared/billing/createCheckout.d.ts +0 -0
  57. package/lib/shared/billing/helpers/index.d.ts +0 -0
  58. package/lib/shared/billing/helpers/subscriptionManagement.d.ts +0 -0
  59. package/lib/shared/billing/helpers/updateUserSubscription.d.ts +0 -0
  60. package/lib/shared/billing/idempotency.d.ts +0 -0
  61. package/lib/shared/billing/index.d.ts +0 -0
  62. package/lib/shared/billing/webhookHandler.d.ts +0 -0
  63. package/lib/shared/crud/bulkCore.d.ts +211 -0
  64. package/lib/shared/crud/index.d.ts +13 -0
  65. package/lib/shared/email/createEmailRoute.d.ts +0 -0
  66. package/lib/shared/email/index.d.ts +0 -0
  67. package/lib/shared/email/provider.d.ts +0 -0
  68. package/lib/shared/email/resendProvider.d.ts +0 -0
  69. package/lib/shared/errorHandling.d.ts +0 -0
  70. package/lib/shared/firebase.d.ts +0 -0
  71. package/lib/shared/github.d.ts +0 -0
  72. package/lib/shared/index.d.ts +1 -0
  73. package/lib/shared/index.js +4 -4
  74. package/lib/shared/index.js.map +4 -4
  75. package/lib/shared/logger.d.ts +0 -0
  76. package/lib/shared/metadata.d.ts +6 -6
  77. package/lib/shared/oauth/exchangeToken.d.ts +0 -0
  78. package/lib/shared/oauth/grantAccess.d.ts +0 -0
  79. package/lib/shared/oauth/index.d.ts +0 -0
  80. package/lib/shared/schema.d.ts +0 -0
  81. package/lib/shared/utils/detectFirestore.d.ts +0 -0
  82. package/lib/shared/utils/external/date.d.ts +0 -0
  83. package/lib/shared/utils/external/index.d.ts +0 -0
  84. package/lib/shared/utils/external/references.d.ts +0 -0
  85. package/lib/shared/utils/external/subscription.d.ts +0 -0
  86. package/lib/shared/utils/firebaseHelpers.d.ts +0 -0
  87. package/lib/shared/utils/functionWrapper.d.ts +0 -0
  88. package/lib/shared/utils/index.d.ts +0 -0
  89. package/lib/shared/utils/internal/auth.d.ts +0 -0
  90. package/lib/shared/utils/internal/firebase.d.ts +0 -0
  91. package/lib/shared/utils/internal/idempotency.d.ts +0 -0
  92. package/lib/shared/utils/internal/index.d.ts +0 -0
  93. package/lib/shared/utils/internal/monitoring.d.ts +0 -0
  94. package/lib/shared/utils/internal/rateLimiter.d.ts +0 -0
  95. package/lib/shared/utils/internal/validation.d.ts +0 -0
  96. package/lib/shared/utils/schemaValidation.d.ts +0 -0
  97. package/lib/shared/utils/validation.d.ts +0 -0
  98. package/lib/shared/utils/vercelHelpers.d.ts +0 -0
  99. package/lib/shared/utils.d.ts +0 -0
  100. package/lib/shared/validation.d.ts +0 -0
  101. package/lib/supabase/ai/createAIFunction.d.ts +0 -0
  102. package/lib/supabase/auth/deleteAccount.d.ts +0 -0
  103. package/lib/supabase/auth/getCustomClaims.d.ts +0 -0
  104. package/lib/supabase/auth/getUserAuthStatus.d.ts +0 -0
  105. package/lib/supabase/auth/removeCustomClaims.d.ts +0 -0
  106. package/lib/supabase/auth/setCustomClaims.d.ts +0 -0
  107. package/lib/supabase/baseFunction.d.ts +0 -0
  108. package/lib/supabase/billing/cancelSubscription.d.ts +0 -0
  109. package/lib/supabase/billing/changePlan.d.ts +0 -0
  110. package/lib/supabase/billing/createCheckoutSession.d.ts +0 -0
  111. package/lib/supabase/billing/createCustomerPortal.d.ts +0 -0
  112. package/lib/supabase/billing/refreshSubscriptionStatus.d.ts +0 -0
  113. package/lib/supabase/crud/aggregate.d.ts +0 -0
  114. package/lib/supabase/crud/bulk.d.ts +63 -0
  115. package/lib/supabase/crud/create.d.ts +1 -1
  116. package/lib/supabase/crud/delete.d.ts +0 -0
  117. package/lib/supabase/crud/get.d.ts +0 -0
  118. package/lib/supabase/crud/index.d.ts +2 -0
  119. package/lib/supabase/crud/list.d.ts +0 -0
  120. package/lib/supabase/crud/update.d.ts +0 -0
  121. package/lib/supabase/edgeFunction.d.ts +0 -0
  122. package/lib/supabase/email/createEmailFunction.d.ts +0 -0
  123. package/lib/supabase/helpers/authProvider.d.ts +0 -0
  124. package/lib/supabase/index.d.ts +3 -3
  125. package/lib/supabase/index.js +3 -3
  126. package/lib/supabase/index.js.map +4 -4
  127. package/lib/supabase/oauth/disconnect.d.ts +0 -0
  128. package/lib/supabase/oauth/exchangeToken.d.ts +0 -0
  129. package/lib/supabase/oauth/getConnections.d.ts +0 -0
  130. package/lib/supabase/oauth/index.d.ts +0 -0
  131. package/lib/supabase/oauth/refreshToken.d.ts +0 -0
  132. package/lib/supabase/registerCrudFunctions.d.ts +0 -0
  133. package/lib/supabase/utils/idempotency.d.ts +0 -0
  134. package/lib/supabase/utils/monitoring.d.ts +0 -0
  135. package/lib/supabase/utils/rateLimiter.d.ts +0 -0
  136. package/lib/vercel/api/ai/chat.d.ts +0 -0
  137. package/lib/vercel/api/ai/index.d.ts +0 -0
  138. package/lib/vercel/api/auth/get-custom-claims.d.ts +0 -0
  139. package/lib/vercel/api/auth/get-user-auth-status.d.ts +0 -0
  140. package/lib/vercel/api/auth/index.d.ts +0 -0
  141. package/lib/vercel/api/auth/remove-custom-claims.d.ts +0 -0
  142. package/lib/vercel/api/auth/set-custom-claims.d.ts +0 -0
  143. package/lib/vercel/api/billing/cancel.d.ts +0 -0
  144. package/lib/vercel/api/billing/change-plan.d.ts +0 -0
  145. package/lib/vercel/api/billing/create-checkout-session.d.ts +0 -0
  146. package/lib/vercel/api/billing/customer-portal.d.ts +0 -0
  147. package/lib/vercel/api/billing/index.d.ts +0 -0
  148. package/lib/vercel/api/billing/refresh-subscription-status.d.ts +0 -0
  149. package/lib/vercel/api/billing/webhook-handler.d.ts +0 -0
  150. package/lib/vercel/api/config/constants.d.ts +0 -0
  151. package/lib/vercel/api/config/firebase-admin.d.ts +0 -0
  152. package/lib/vercel/api/config/index.d.ts +0 -0
  153. package/lib/vercel/api/crud/bulk.d.ts +31 -0
  154. package/lib/vercel/api/crud/create.d.ts +0 -0
  155. package/lib/vercel/api/crud/delete.d.ts +0 -0
  156. package/lib/vercel/api/crud/get.d.ts +0 -0
  157. package/lib/vercel/api/crud/index.d.ts +1 -0
  158. package/lib/vercel/api/crud/list.d.ts +0 -0
  159. package/lib/vercel/api/crud/update.d.ts +0 -0
  160. package/lib/vercel/api/index.d.ts +0 -0
  161. package/lib/vercel/api/index.js +3 -3
  162. package/lib/vercel/api/index.js.map +4 -4
  163. package/lib/vercel/api/oauth/check-github-access.d.ts +0 -0
  164. package/lib/vercel/api/oauth/exchange-token.d.ts +0 -0
  165. package/lib/vercel/api/oauth/grant-github-access.d.ts +0 -0
  166. package/lib/vercel/api/oauth/index.d.ts +0 -0
  167. package/lib/vercel/api/oauth/revoke-github-access.d.ts +0 -0
  168. package/lib/vercel/api/utils/cors.d.ts +0 -0
  169. package/lib/vercel/baseFunction.d.ts +0 -0
  170. package/package.json +6 -6
  171. package/src/firebase/auth/getCustomClaims.ts +0 -0
  172. package/src/firebase/auth/getUserAuthStatus.ts +0 -0
  173. package/src/firebase/auth/index.ts +0 -0
  174. package/src/firebase/auth/removeCustomClaims.ts +0 -0
  175. package/src/firebase/auth/setCustomClaims.ts +0 -0
  176. package/src/firebase/baseFunction.ts +0 -0
  177. package/src/firebase/billing/cancelSubscription.ts +0 -0
  178. package/src/firebase/billing/changePlan.ts +0 -0
  179. package/src/firebase/billing/createCheckoutSession.ts +5 -1
  180. package/src/firebase/billing/createCustomerPortal.ts +0 -0
  181. package/src/firebase/billing/healthCheck.ts +0 -0
  182. package/src/firebase/billing/index.d.ts +0 -0
  183. package/src/firebase/billing/index.ts +0 -0
  184. package/src/firebase/billing/refreshSubscriptionStatus.ts +0 -0
  185. package/src/firebase/billing/webhookHandler.ts +0 -0
  186. package/src/firebase/config/constants.ts +0 -0
  187. package/src/firebase/config/index.ts +0 -0
  188. package/src/firebase/config/secrets.ts +0 -0
  189. package/src/firebase/crud/__tests__/bulk.test.ts +322 -0
  190. package/src/firebase/crud/aggregate.ts +0 -0
  191. package/src/firebase/crud/bulk.ts +272 -0
  192. package/src/firebase/crud/create.ts +20 -33
  193. package/src/firebase/crud/delete.ts +0 -0
  194. package/src/firebase/crud/get.ts +0 -0
  195. package/src/firebase/crud/index.ts +1 -0
  196. package/src/firebase/crud/list.ts +0 -0
  197. package/src/firebase/crud/update.ts +0 -0
  198. package/src/firebase/helpers/githubAccessHelper.ts +0 -0
  199. package/src/firebase/helpers/githubTeamAccessHelper.ts +0 -0
  200. package/src/firebase/helpers/index.ts +0 -0
  201. package/src/firebase/index.d.ts +0 -0
  202. package/src/firebase/index.ts +0 -0
  203. package/src/firebase/oauth/disconnect.ts +0 -0
  204. package/src/firebase/oauth/exchangeToken.ts +0 -0
  205. package/src/firebase/oauth/getConnections.ts +0 -0
  206. package/src/firebase/oauth/githubAccess.ts +0 -0
  207. package/src/firebase/oauth/index.ts +0 -0
  208. package/src/firebase/oauth/refreshToken.ts +0 -0
  209. package/src/firebase/registerCrudFunctions.ts +13 -0
  210. package/src/firebase/scheduled/checkExpiredSubscriptions.ts +0 -0
  211. package/src/firebase/scheduled/index.ts +0 -0
  212. package/src/shared/__tests__/auth.test.ts +0 -0
  213. package/src/shared/__tests__/bulkCore.test.ts +487 -0
  214. package/src/shared/__tests__/errorHandling.test.ts +0 -0
  215. package/src/shared/__tests__/firebase.test.ts +9 -3
  216. package/src/shared/__tests__/idempotency.test.ts +0 -0
  217. package/src/shared/__tests__/internalValidation.test.ts +9 -3
  218. package/src/shared/__tests__/metadata.test.ts +10 -10
  219. package/src/shared/__tests__/rateLimiter.test.ts +0 -0
  220. package/src/shared/__tests__/schema.test.ts +0 -0
  221. package/src/shared/__tests__/schemaValidation.test.ts +0 -0
  222. package/src/shared/__tests__/subscription.test.ts +0 -0
  223. package/src/shared/__tests__/utils.test.ts +10 -4
  224. package/src/shared/__tests__/validation-env.test.ts +9 -3
  225. package/src/shared/__tests__/validation.test.ts +0 -0
  226. package/src/shared/ai/__tests__/costTracker.test.ts +25 -13
  227. package/src/shared/ai/classifyAIError.ts +26 -11
  228. package/src/shared/ai/costTracker.ts +0 -0
  229. package/src/shared/ai/createAIRoute.ts +11 -8
  230. package/src/shared/ai/index.ts +0 -0
  231. package/src/shared/ai/resolveModelTier.ts +5 -2
  232. package/src/shared/billing/__tests__/createCheckout.test.ts +0 -0
  233. package/src/shared/billing/__tests__/webhookHandler.test.ts +0 -0
  234. package/src/shared/billing/createCheckout.ts +24 -9
  235. package/src/shared/billing/helpers/index.ts +0 -0
  236. package/src/shared/billing/helpers/subscriptionManagement.ts +0 -0
  237. package/src/shared/billing/helpers/updateUserSubscription.ts +0 -0
  238. package/src/shared/billing/idempotency.ts +0 -0
  239. package/src/shared/billing/index.ts +0 -0
  240. package/src/shared/billing/webhookHandler.ts +0 -0
  241. package/src/shared/crud/bulkCore.ts +483 -0
  242. package/src/shared/crud/index.ts +23 -0
  243. package/src/shared/email/createEmailRoute.ts +0 -0
  244. package/src/shared/email/index.ts +0 -0
  245. package/src/shared/email/provider.ts +0 -0
  246. package/src/shared/email/resendProvider.ts +1 -1
  247. package/src/shared/errorHandling.ts +0 -0
  248. package/src/shared/firebase.ts +0 -0
  249. package/src/shared/github.ts +0 -0
  250. package/src/shared/index.d.ts +9 -0
  251. package/src/shared/index.ts +1 -0
  252. package/src/shared/logger.ts +0 -0
  253. package/src/shared/metadata.ts +6 -6
  254. package/src/shared/oauth/__tests__/exchangeToken.test.ts +0 -0
  255. package/src/shared/oauth/__tests__/grantAccess.test.ts +0 -0
  256. package/src/shared/oauth/exchangeToken.ts +0 -0
  257. package/src/shared/oauth/grantAccess.ts +0 -0
  258. package/src/shared/oauth/index.ts +0 -0
  259. package/src/shared/schema.ts +0 -0
  260. package/src/shared/utils/__tests__/functionWrapper.test.ts +0 -0
  261. package/src/shared/utils/detectFirestore.ts +0 -0
  262. package/src/shared/utils/external/date.ts +0 -0
  263. package/src/shared/utils/external/index.ts +0 -0
  264. package/src/shared/utils/external/references.ts +0 -0
  265. package/src/shared/utils/external/subscription.ts +0 -0
  266. package/src/shared/utils/firebaseHelpers.ts +0 -0
  267. package/src/shared/utils/functionWrapper.ts +0 -0
  268. package/src/shared/utils/index.ts +0 -0
  269. package/src/shared/utils/internal/auth.ts +0 -0
  270. package/src/shared/utils/internal/firebase.ts +0 -0
  271. package/src/shared/utils/internal/idempotency.ts +0 -0
  272. package/src/shared/utils/internal/index.ts +0 -0
  273. package/src/shared/utils/internal/monitoring.ts +0 -0
  274. package/src/shared/utils/internal/rateLimiter.ts +0 -0
  275. package/src/shared/utils/internal/validation.ts +0 -0
  276. package/src/shared/utils/schemaValidation.ts +0 -0
  277. package/src/shared/utils/validation.ts +0 -0
  278. package/src/shared/utils/vercelHelpers.ts +0 -0
  279. package/src/shared/utils.ts +0 -0
  280. package/src/shared/validation.ts +0 -0
  281. package/src/supabase/__tests__/bulk.test.ts +330 -0
  282. package/src/supabase/ai/createAIFunction.ts +17 -16
  283. package/src/supabase/auth/deleteAccount.ts +0 -0
  284. package/src/supabase/auth/getCustomClaims.ts +0 -0
  285. package/src/supabase/auth/getUserAuthStatus.ts +0 -0
  286. package/src/supabase/auth/removeCustomClaims.ts +0 -0
  287. package/src/supabase/auth/setCustomClaims.ts +1 -3
  288. package/src/supabase/baseFunction.ts +0 -0
  289. package/src/supabase/billing/cancelSubscription.ts +0 -0
  290. package/src/supabase/billing/changePlan.ts +1 -1
  291. package/src/supabase/billing/createCheckoutSession.ts +0 -0
  292. package/src/supabase/billing/createCustomerPortal.ts +0 -0
  293. package/src/supabase/billing/refreshSubscriptionStatus.ts +0 -0
  294. package/src/supabase/crud/aggregate.ts +0 -0
  295. package/src/supabase/crud/bulk.ts +244 -0
  296. package/src/supabase/crud/create.ts +15 -14
  297. package/src/supabase/crud/delete.ts +0 -0
  298. package/src/supabase/crud/get.ts +0 -0
  299. package/src/supabase/crud/index.ts +2 -0
  300. package/src/supabase/crud/list.ts +0 -0
  301. package/src/supabase/crud/update.ts +0 -0
  302. package/src/supabase/edgeFunction.ts +4 -3
  303. package/src/supabase/email/createEmailFunction.ts +9 -12
  304. package/src/supabase/helpers/authProvider.ts +0 -0
  305. package/src/supabase/index.ts +12 -3
  306. package/src/supabase/oauth/disconnect.ts +1 -2
  307. package/src/supabase/oauth/exchangeToken.ts +1 -3
  308. package/src/supabase/oauth/getConnections.ts +1 -4
  309. package/src/supabase/oauth/index.ts +0 -0
  310. package/src/supabase/oauth/refreshToken.ts +2 -7
  311. package/src/supabase/registerCrudFunctions.ts +38 -26
  312. package/src/supabase/utils/idempotency.ts +0 -0
  313. package/src/supabase/utils/monitoring.ts +0 -0
  314. package/src/supabase/utils/rateLimiter.ts +0 -0
  315. package/src/vercel/__tests__/bulk.test.ts +301 -0
  316. package/src/vercel/api/ai/chat.ts +0 -0
  317. package/src/vercel/api/ai/index.ts +2 -0
  318. package/src/vercel/api/auth/get-custom-claims.ts +0 -0
  319. package/src/vercel/api/auth/get-user-auth-status.ts +0 -0
  320. package/src/vercel/api/auth/index.ts +0 -0
  321. package/src/vercel/api/auth/remove-custom-claims.ts +0 -0
  322. package/src/vercel/api/auth/set-custom-claims.ts +0 -0
  323. package/src/vercel/api/billing/cancel.ts +0 -0
  324. package/src/vercel/api/billing/change-plan.ts +0 -0
  325. package/src/vercel/api/billing/create-checkout-session.ts +5 -1
  326. package/src/vercel/api/billing/customer-portal.ts +0 -0
  327. package/src/vercel/api/billing/index.ts +0 -0
  328. package/src/vercel/api/billing/refresh-subscription-status.ts +0 -0
  329. package/src/vercel/api/billing/webhook-handler.ts +0 -0
  330. package/src/vercel/api/config/constants.ts +0 -0
  331. package/src/vercel/api/config/firebase-admin.ts +0 -0
  332. package/src/vercel/api/config/index.ts +0 -0
  333. package/src/vercel/api/crud/bulk.ts +216 -0
  334. package/src/vercel/api/crud/create.ts +10 -9
  335. package/src/vercel/api/crud/delete.ts +0 -0
  336. package/src/vercel/api/crud/get.ts +0 -0
  337. package/src/vercel/api/crud/index.ts +1 -0
  338. package/src/vercel/api/crud/list.ts +0 -0
  339. package/src/vercel/api/crud/update.ts +0 -0
  340. package/src/vercel/api/index.d.ts +0 -0
  341. package/src/vercel/api/index.ts +0 -0
  342. package/src/vercel/api/oauth/check-github-access.ts +0 -0
  343. package/src/vercel/api/oauth/exchange-token.ts +4 -1
  344. package/src/vercel/api/oauth/grant-github-access.ts +0 -0
  345. package/src/vercel/api/oauth/index.ts +0 -0
  346. package/src/vercel/api/oauth/revoke-github-access.ts +0 -0
  347. package/src/vercel/api/utils/cors.ts +3 -1
  348. package/src/vercel/baseFunction.ts +0 -0
package/LICENSE.md CHANGED
@@ -1,242 +1,21 @@
1
- # DoNotDev Framework License Agreement
2
-
3
- **Version 1.0 – Effective Date: May 5, 2025**
4
-
5
- Copyright © 2025 Ambroise Park Consulting. All rights reserved.
6
-
7
- ---
8
-
9
- ## 1. DEFINITIONS
10
-
11
- **1.1 "Framework"** means the DoNotDev commercial software packages (excluding @donotdev/cli, @donotdev/components, @donotdev/expo, and @donotdev/templates, which are licensed under MIT), including all compiled JavaScript files, TypeScript definition files, and associated documentation.
12
-
13
- **1.2 "License Key"** means the unique alphanumeric key provided to you upon purchase, required to suppress watermarks and unlock full Framework functionality.
14
-
15
- **1.3 "Developer License"** means a license granted to an individual developer, permitting use of the Framework subject to the terms herein.
16
-
17
- **1.4 "Project Deployment License"** means a license required for each Client Project delivered by a Developer.
18
-
19
- **1.5 "Client Project"** means any software application or website built using the Framework and delivered to a third party who compensated you (directly or indirectly) for its development. This includes:
20
- - Code handoff (repository transfer, zip file delivery, etc.)
21
- - Hosted applications where the client has access to source code (repository access, cPanel, FTP, etc.)
22
- - Hosted applications operated on behalf of a paying client, regardless of code access
23
-
24
- **1.6 "Internal Use"** means software applications built using the Framework for your own use or your employer's internal use, including SaaS products you own and operate where end-users have no access to Framework code.
25
-
26
- ---
27
-
28
- ## 2. LICENSE GRANT
29
-
30
- **2.1 Developer License**
31
-
32
- Subject to payment of applicable fees and compliance with this Agreement, Ambroise Park Consulting grants you a non-exclusive, non-transferable, perpetual license to:
33
-
34
- (a) Install Framework packages from npm
35
- (b) Use the Framework to develop software applications
36
- (c) Deploy applications for Internal Use without additional fees
37
- (d) Incorporate the Framework into applications as compiled/minified code
38
-
39
- **2.2 Project Deployment License**
40
-
41
- For each Client Project, you must obtain a Project Deployment License prior to delivery. Each Project Deployment License grants you the right to deliver one Client Project containing the Framework.
42
-
43
- **2.3 Multi-Developer Projects**
44
-
45
- When multiple developers collaborate on a project:
46
- - Each developer must hold a Developer License with their own License Key
47
- - Only one Project Deployment License is required per Client Project (regardless of team size)
48
-
49
- ---
50
-
51
- ## 3. LICENSE KEY REQUIREMENT
52
-
53
- **3.1 License Key Activation**
54
-
55
- Upon purchasing a Developer License or Project Deployment License, you will receive a License Key. You must configure your applications with this key:
56
-
57
- ```javascript
58
- // Environment variable (recommended)
59
- DONOTDEV_LICENSE_KEY=your-license-key-here
60
-
61
- // Or in code
62
- globalThis.__DONOTDEV_LICENSE_KEY__ = 'your-license-key-here';
63
- ```
64
-
65
- **3.2 Watermark Enforcement**
66
-
67
- Applications running without a valid License Key will display a watermark:
68
- - "⚠️ Unlicensed DoNotDev Framework - Visit donotdev.com"
69
- - Console warnings in development mode
70
-
71
- **3.3 License Key Types**
72
-
73
- - **Developer License Key:** For Internal Use and development
74
- - **Project Deployment License Key:** For Client Project deployment (suppresses watermark in production)
75
-
76
- **3.4 Key Management**
77
-
78
- - Do not commit License Keys to public repositories
79
- - Use environment variables or secure secret management for production deployments
80
- - Each developer uses their own Developer License Key for development
81
- - Project Deployment Keys are provisioned per client project
82
-
83
- ---
84
-
85
- ## 4. PERMITTED USES
86
-
87
- You may:
88
-
89
- (a) Build unlimited applications for Internal Use with a Developer License
90
- (b) Develop SaaS products you own and operate (no Project Deployment License required if clients cannot access Framework code)
91
- (c) Create internal tools for your organization
92
- (d) Build applications that include the Framework as compiled dependencies
93
- (e) Open-source applications built on top of the Framework (provided end-users obtain their own licenses to suppress watermarks)
94
-
95
- ---
96
-
97
- ## 5. RESTRICTIONS
98
-
99
- You may not:
100
-
101
- (a) Redistribute Framework packages independently of your applications
102
- (b) Share, publish, or transfer your License Key to unlicensed parties
103
- (c) Decompile, reverse engineer, or attempt to extract source code from minified files
104
- (d) Remove or obscure copyright notices or watermarks from Framework code
105
- (e) Sublicense, resell, or transfer your Developer License to another individual
106
- (f) Deliver Client Projects without obtaining a Project Deployment License
107
- (g) Modify Framework code to bypass license validation or watermark enforcement
108
- (h) Create derivative frameworks intended for redistribution
109
- (i) Use a single Project Deployment License for multiple client projects
110
-
111
- ---
112
-
113
- ## 6. LICENSE TYPES & FEES
114
-
115
- **6.1 Developer License**
116
- - **Scope:** Per individual developer
117
- - **Term:** Perpetual (lifetime access)
118
- - **Fee:** Set forth in purchase agreement or donotdev.com pricing
119
- - **Entitlements:** Unlimited Internal Use projects; Client Projects require additional Project Deployment Licenses
120
- - **License Key:** One Developer License Key provided
121
-
122
- **6.2 Project Deployment License**
123
- - **Scope:** Per Client Project delivered
124
- - **Term:** Perpetual for the specific project
125
- - **Fee:** Set forth in purchase agreement or donotdev.com pricing
126
- - **Purchaser:** Typically purchased by the developer/agency; client payment arrangements are permitted
127
- - **License Key:** One Project Deployment Key provided per project
128
-
129
- **6.3 Volume Licensing**
130
-
131
- Organizations requiring multiple Developer Licenses may contact Ambroise Park Consulting for volume pricing and enterprise key management.
132
-
133
- ---
134
-
135
- ## 7. PAYMENT & VERIFICATION
136
-
137
- **7.1 Payment**
138
-
139
- All fees must be paid in full before License Key issuance. Payment terms and pricing are specified at donotdev.com or in separate purchase agreements.
140
-
141
- **7.2 Compliance Verification**
142
-
143
- Ambroise Park Consulting may request reasonable verification of Project Deployment License compliance. You agree to cooperate with such verification requests in good faith.
144
-
145
- **7.3 Enforcement**
146
-
147
- License compliance is primarily honor-based. Watermarks serve as technical reminders. Ambroise Park Consulting reserves the right to audit usage and pursue legal remedies for material breaches.
148
-
149
- ---
150
-
151
- ## 8. TERM & TERMINATION
152
-
153
- **8.1 Perpetual Term**
154
-
155
- Developer Licenses and Project Deployment Licenses are perpetual and do not expire, subject to Section 8.2.
156
-
157
- **8.2 Termination for Breach**
158
-
159
- Ambroise Park Consulting may terminate your license(s) and revoke your License Key(s) if you:
160
- - Breach any material term of this Agreement
161
- - Fail to pay applicable fees
162
- - Engage in unauthorized redistribution or License Key sharing
163
- - Attempt to bypass license validation mechanisms
164
-
165
- **8.3 Effect of Termination**
166
-
167
- Upon termination:
168
- - Your License Key(s) will be revoked and watermarks will reappear
169
- - Your right to use the Framework ceases
170
- - Previously deployed applications may continue to function but will display watermarks
171
- - You must cease distribution of any Client Projects in development
172
- - You must remove the Framework from any ongoing projects
173
-
174
- **8.4 Survival**
175
-
176
- Sections 5 (Restrictions), 9 (Warranty Disclaimer), 10 (Limitation of Liability), and 11 (General Provisions) survive termination.
177
-
178
- ---
179
-
180
- ## 9. WARRANTY DISCLAIMER
181
-
182
- THE FRAMEWORK IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
183
-
184
- Ambroise Park Consulting does not warrant that the Framework will be error-free, uninterrupted, or meet your specific requirements.
185
-
186
- ---
187
-
188
- ## 10. LIMITATION OF LIABILITY
189
-
190
- TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL AMBROISE PARK CONSULTING BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES (INCLUDING LOSS OF PROFITS, DATA, OR BUSINESS OPPORTUNITIES) ARISING OUT OF OR RELATED TO THIS AGREEMENT OR USE OF THE FRAMEWORK, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
191
-
192
- Ambroise Park Consulting's total cumulative liability under this Agreement shall not exceed the fees you paid for the specific license giving rise to the claim.
193
-
194
- ---
195
-
196
- ## 11. GENERAL PROVISIONS
197
-
198
- **11.1 Governing Law**
199
-
200
- This Agreement is governed by the laws of Quebec, Canada, without regard to conflict of law principles. Any disputes arising under this Agreement shall be resolved exclusively in the courts of Quebec, Canada.
201
-
202
- **11.2 Severability**
203
-
204
- If any provision of this Agreement is found unenforceable, the remaining provisions continue in full force and effect.
205
-
206
- **11.3 Assignment**
207
-
208
- You may not assign or transfer this Agreement or any licenses granted hereunder without prior written consent of Ambroise Park Consulting. Ambroise Park Consulting may assign this Agreement without restriction.
209
-
210
- **11.4 Entire Agreement**
211
-
212
- This Agreement, together with any applicable purchase agreements or order forms, constitutes the entire agreement between you and Ambroise Park Consulting regarding the Framework and supersedes all prior agreements and understandings.
213
-
214
- **11.5 Amendments**
215
-
216
- Ambroise Park Consulting may update this Agreement from time to time. Updates apply to licenses purchased after the effective date of the update. Existing licenses remain governed by the version in effect at the time of purchase unless you opt-in to updated terms.
217
-
218
- **11.6 Export Compliance**
219
-
220
- You agree to comply with all applicable export and import laws and regulations in your use of the Framework.
221
-
222
- **11.7 Force Majeure**
223
-
224
- Neither party is liable for failure to perform due to causes beyond reasonable control, including but not limited to acts of God, war, strikes, or third-party service outages.
225
-
226
- **11.8 No Support Obligation**
227
-
228
- Ambroise Park Consulting has no obligation to provide support, updates, or maintenance. Any support provided is at sole discretion and may be discontinued without notice.
229
-
230
- **11.9 Contact**
231
-
232
- Questions about licensing or compliance:
233
-
234
- **Email:** contact@donotdev.com
235
- **Website:** donotdev.com
236
-
237
- ---
238
-
239
- **END OF LICENSE AGREEMENT**
240
-
241
- **DoNotDev Framework License v1.0**
242
- Ambroise Park Consulting – 2025
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AMBROISE PARK Consulting
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -238,7 +238,7 @@ bun run build
238
238
  **Firebase Functions:**
239
239
 
240
240
  ```bash
241
- STRIPE_SECRET_KEY=sk_test_...
241
+ STRIPE_SECRET_KEY=<stripe_secret_key>
242
242
  STRIPE_WEBHOOK_SECRET=whsec_...
243
243
  STRIPE_API_VERSION=2025-08-27.basil # REQUIRED - No fallback
244
244
  ```
@@ -246,10 +246,10 @@ STRIPE_API_VERSION=2025-08-27.basil # REQUIRED - No fallback
246
246
  **Vercel Functions:**
247
247
 
248
248
  ```bash
249
- STRIPE_SECRET_KEY=sk_test_...
249
+ STRIPE_SECRET_KEY=<stripe_secret_key>
250
250
  STRIPE_WEBHOOK_SECRET=whsec_...
251
251
  STRIPE_API_VERSION=2025-08-27.basil # REQUIRED - No fallback
252
- FIREBASE_ADMIN_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n..."
252
+ FIREBASE_ADMIN_PRIVATE_KEY="<firebase_private_key>"
253
253
  FIREBASE_PROJECT_ID=your-project-id
254
254
  FIREBASE_CLIENT_EMAIL=firebase-adminsdk-...@your-project.iam.gserviceaccount.com
255
255
  ```
@@ -426,7 +426,7 @@ const tierMapping: Record<string, SubscriptionTier> = {
426
426
  1. **Set Environment Variables**:
427
427
 
428
428
  ```bash
429
- firebase functions:config:set stripe.secret_key="sk_test_..."
429
+ firebase functions:config:set stripe.secret_key="<stripe_secret_key>"
430
430
  firebase functions:config:set stripe.webhook_secret="whsec_..."
431
431
  ```
432
432
 
File without changes
@@ -80,7 +80,6 @@ In **Vercel Dashboard > Project > Settings > Environment Variables**, add your a
80
80
  - `VITE_SUPABASE_PUBLIC_KEY`
81
81
 
82
82
  **Common (all backends):**
83
- - `VITE_DONOTDEV_LICENSE_KEY`
84
83
  - `VITE_STRIPE_PUBLISHABLE_KEY` (if using billing)
85
84
 
86
85
  **Server-side (Vercel Functions only):**
@@ -153,6 +152,33 @@ export default createCheckoutSession(billingConfig);
153
152
 
154
153
  Available: auth (claims, status, delete account), billing (checkout, cancel, portal, change plan), OAuth (token exchange, access grants).
155
154
 
155
+ ### Bulk CRUD (`POST /api/crud/:collection/bulk`)
156
+
157
+ Transactional bulk endpoint for the `@donotdev/restcrud` adapter. One HTTP round-trip, one Firestore transaction, atomic across `inserts` / `updates` / `deletes`.
158
+
159
+ ```ts
160
+ // pages/api/crud/[collection]/bulk.ts
161
+ export { default } from '@donotdev/functions/vercel';
162
+ // or, if you only want the bulk handler:
163
+ // export { bulk as default } from '@donotdev/functions/vercel';
164
+ ```
165
+
166
+ Wire contract (shared with the adapter):
167
+
168
+ | | |
169
+ |---|---|
170
+ | **Method** | `POST` |
171
+ | **Request** | `BulkRequestSchema` — `{ inserts?, updates?, deletes? }` from `@donotdev/schemas` |
172
+ | **Response** | `BulkResponseSchema` — `{ insertedIds, updatedIds, deletedIds }`, each preserves input order |
173
+
174
+ Semantics (non-negotiable — see `BULK_CRUD_TODO.md`):
175
+
176
+ - **Atomic.** Server wraps every write in a single `db.runTransaction`. Any failure rolls back all ops.
177
+ - **Collision rejection.** Same id in `updates` + `deletes`, or `inserts` + `updates`, returns `400 BulkCollisionError` before any read or write.
178
+ - **Empty is no-op.** Body `{}` short-circuits to `{ insertedIds: [], updatedIds: [], deletedIds: [] }` without touching the DB.
179
+ - **Order preserved.** Output arrays mirror the input order of their bucket.
180
+ - **Single audit / rate-limit debit.** One `crud.bulk.${collection}` audit entry, one write rate-limit hit — not N.
181
+
156
182
  ### When to use Vercel Functions vs Firebase/Supabase functions
157
183
 
158
184
  - **Vercel Functions:** API routes, webhooks, third-party proxies - especially in Next.js apps
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,107 @@
1
+ import * as v from 'valibot';
2
+ import type { BulkRequest, BulkResponse, UserRole } from '@donotdev/core/server';
3
+ import type { CallableFunction, CallableRequest } from 'firebase-functions/v2/https';
4
+ /**
5
+ * Request type for the bulk endpoint. Identical to the wire schema; kept as a
6
+ * named alias for parity with `CreateEntityRequest`, `UpdateEntityRequest`, etc.
7
+ */
8
+ export type BulkEntityRequest = BulkRequest;
9
+ /**
10
+ * Per-operation access split. The three write access roles are passed
11
+ * individually so the factory can enforce them independently when a request
12
+ * mixes op kinds (e.g. only the delete bucket fails ACL).
13
+ */
14
+ interface BulkAccess {
15
+ /** Minimum role to insert into the collection. */
16
+ create: UserRole;
17
+ /** Minimum role to update existing rows. */
18
+ update: UserRole;
19
+ /** Minimum role to delete rows. */
20
+ delete: UserRole;
21
+ }
22
+ /**
23
+ * Build the business-logic function consumed by {@link createBaseFunction}.
24
+ *
25
+ * Exported for unit testing only — the public entry is {@link bulkEntity}
26
+ * which wraps this factory with auth, role, rate-limit, and schema
27
+ * validation at the transport boundary.
28
+ *
29
+ * The logic itself is a pure delegation to {@link executeBulk}; the only
30
+ * Firestore-specific code lives inside the `transact` closure which issues
31
+ * `tx.set / tx.update / tx.delete` on pre-minted `doc()` references.
32
+ *
33
+ * @internal
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * const logic = bulkEntityLogicFactory('cars', createSchema, updateSchema, {
38
+ * create: 'user', update: 'user', delete: 'admin',
39
+ * });
40
+ * await logic({ inserts: [{ name: 'a' }] }, { uid: 'u', userRole: 'user', request: req });
41
+ * ```
42
+ *
43
+ * @version 0.2.0
44
+ * @since 0.2.0
45
+ */
46
+ export declare function bulkEntityLogicFactory(collection: string, createSchema: v.BaseSchema<unknown, any, v.BaseIssue<unknown>>, draftCreateSchema: v.BaseSchema<unknown, any, v.BaseIssue<unknown>>, updateSchema: v.BaseSchema<unknown, any, v.BaseIssue<unknown>>, access: BulkAccess): (data: BulkEntityRequest, context: {
47
+ uid: string;
48
+ userRole: UserRole;
49
+ request: CallableRequest<any>;
50
+ }) => Promise<BulkResponse>;
51
+ /**
52
+ * Generic function to perform transactional bulk CRUD in any Firestore
53
+ * collection. Auto-registered as `bulk_${collection}` by
54
+ * {@link createCrudFunctions}.
55
+ *
56
+ * **Atomicity contract** — all inserts / updates / deletes succeed or none
57
+ * do. On any failure the entire Firestore transaction is rolled back and the
58
+ * error is surfaced to the caller via `DoNotDevError`.
59
+ *
60
+ * **One of everything** — one HTTP round-trip, one transaction, one audit
61
+ * entry (`crud.bulk.${collection}` with counts), one rate-limit hit (at
62
+ * `createBaseFunction` entry). Collisions and schema validation fail *before*
63
+ * the transaction is opened.
64
+ *
65
+ * @param collection - The Firestore collection name.
66
+ * @param createSchema - Valibot schema to validate each insert payload.
67
+ * @param updateSchema - Valibot schema to validate each update patch.
68
+ * @param access - Required roles split per op kind.
69
+ * @returns Firebase callable function returning a `BulkResponse`.
70
+ *
71
+ * @throws {BulkCollisionError} When the same id appears in `updates`+`deletes`
72
+ * or `inserts`+`updates`. No writes are attempted.
73
+ * @throws {DoNotDevError} `permission-denied` when the caller lacks the
74
+ * per-op role (e.g. includes deletes but has no delete access).
75
+ * @throws {DoNotDevError} `invalid-argument` when any insert fails
76
+ * `createSchema` or any update patch fails `updateSchema`. Transaction is
77
+ * not opened.
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * // Usually wired automatically by createCrudFunctions:
82
+ * import { createCrudFunctions } from '@donotdev/functions/firebase';
83
+ * import * as entities from 'entities';
84
+ *
85
+ * export const crud = createCrudFunctions(entities);
86
+ * // → crud.bulk_cars, crud.bulk_orders, etc.
87
+ *
88
+ * // Manual wiring:
89
+ * import { bulkEntity } from '@donotdev/functions/firebase';
90
+ * import { createSchemas } from '@donotdev/core/server';
91
+ * import { carEntity } from './entities/car';
92
+ *
93
+ * const schemas = createSchemas(carEntity);
94
+ * export const bulk_cars = bulkEntity(
95
+ * carEntity.collection,
96
+ * schemas.create,
97
+ * schemas.update,
98
+ * carEntity.access,
99
+ * );
100
+ * ```
101
+ *
102
+ * @version 0.2.0
103
+ * @since 0.2.0
104
+ * @author AMBROISE PARK Consulting
105
+ */
106
+ export declare const bulkEntity: (collection: string, createSchema: v.BaseSchema<unknown, any, v.BaseIssue<unknown>>, draftCreateSchema: v.BaseSchema<unknown, any, v.BaseIssue<unknown>>, updateSchema: v.BaseSchema<unknown, any, v.BaseIssue<unknown>>, access: BulkAccess) => CallableFunction<BulkEntityRequest, Promise<BulkResponse>>;
107
+ export {};
@@ -13,4 +13,4 @@ export type CreateEntityRequest = {
13
13
  * @param customSchema - Optional custom request schema
14
14
  * @returns Firebase callable function
15
15
  */
16
- export declare const createEntity: (collection: string, documentSchema: v.BaseSchema<unknown, any, v.BaseIssue<unknown>>, requiredRole: UserRole, customSchema?: v.BaseSchema<unknown, any, v.BaseIssue<unknown>>) => CallableFunction<CreateEntityRequest, Promise<any>>;
16
+ export declare const createEntity: (collection: string, createDocumentSchema: v.BaseSchema<unknown, any, v.BaseIssue<unknown>>, draftDocumentSchema: v.BaseSchema<unknown, any, v.BaseIssue<unknown>>, requiredRole: UserRole, customSchema?: v.BaseSchema<unknown, any, v.BaseIssue<unknown>>) => CallableFunction<CreateEntityRequest, Promise<any>>;
File without changes
File without changes
@@ -7,6 +7,7 @@
7
7
  * @author AMBROISE PARK Consulting
8
8
  */
9
9
  export * from './aggregate.js';
10
+ export * from './bulk.js';
10
11
  export * from './create.js';
11
12
  export * from './delete.js';
12
13
  export * from './get.js';
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes