@donotdev/functions 0.1.0 → 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.
- package/LICENSE.md +21 -242
- package/README.md +4 -4
- package/guidelines/FUNCTIONS.md +9 -0
- package/guidelines/VERCEL.md +286 -0
- package/lib/firebase/auth/getCustomClaims.d.ts +0 -0
- package/lib/firebase/auth/getUserAuthStatus.d.ts +0 -0
- package/lib/firebase/auth/index.d.ts +0 -0
- package/lib/firebase/auth/removeCustomClaims.d.ts +0 -0
- package/lib/firebase/auth/setCustomClaims.d.ts +0 -0
- package/lib/firebase/baseFunction.d.ts +0 -0
- package/lib/firebase/billing/cancelSubscription.d.ts +0 -0
- package/lib/firebase/billing/changePlan.d.ts +0 -0
- package/lib/firebase/billing/createCheckoutSession.d.ts +10 -13
- package/lib/firebase/billing/createCustomerPortal.d.ts +0 -0
- package/lib/firebase/billing/healthCheck.d.ts +0 -0
- package/lib/firebase/billing/index.d.ts +0 -0
- package/lib/firebase/billing/refreshSubscriptionStatus.d.ts +0 -0
- package/lib/firebase/billing/webhookHandler.d.ts +0 -0
- package/lib/firebase/config/constants.d.ts +0 -0
- package/lib/firebase/config/index.d.ts +0 -0
- package/lib/firebase/config/secrets.d.ts +0 -0
- package/lib/firebase/crud/aggregate.d.ts +0 -0
- package/lib/firebase/crud/bulk.d.ts +107 -0
- package/lib/firebase/crud/create.d.ts +1 -1
- package/lib/firebase/crud/delete.d.ts +0 -0
- package/lib/firebase/crud/get.d.ts +0 -0
- package/lib/firebase/crud/index.d.ts +1 -0
- package/lib/firebase/crud/list.d.ts +0 -0
- package/lib/firebase/crud/update.d.ts +0 -0
- package/lib/firebase/helpers/githubAccessHelper.d.ts +0 -0
- package/lib/firebase/helpers/githubTeamAccessHelper.d.ts +0 -0
- package/lib/firebase/helpers/index.d.ts +0 -0
- package/lib/firebase/index.d.ts +0 -0
- package/lib/firebase/index.js +3 -3
- package/lib/firebase/index.js.map +4 -4
- package/lib/firebase/oauth/disconnect.d.ts +0 -0
- package/lib/firebase/oauth/exchangeToken.d.ts +0 -0
- package/lib/firebase/oauth/getConnections.d.ts +0 -0
- package/lib/firebase/oauth/githubAccess.d.ts +0 -0
- package/lib/firebase/oauth/index.d.ts +0 -0
- package/lib/firebase/oauth/refreshToken.d.ts +0 -0
- package/lib/firebase/registerCrudFunctions.d.ts +0 -0
- package/lib/firebase/scheduled/checkExpiredSubscriptions.d.ts +0 -0
- package/lib/firebase/scheduled/index.d.ts +0 -0
- package/lib/shared/ai/classifyAIError.d.ts +35 -0
- package/lib/shared/ai/costTracker.d.ts +20 -0
- package/lib/shared/ai/createAIHandler.d.ts +39 -0
- package/lib/shared/ai/createAIRoute.d.ts +20 -0
- package/lib/shared/ai/index.d.ts +6 -0
- package/lib/shared/ai/providers/anthropic.d.ts +12 -0
- package/lib/shared/ai/providers/google.d.ts +10 -0
- package/lib/shared/ai/providers/index.d.ts +23 -0
- package/lib/shared/ai/providers/openai.d.ts +10 -0
- package/lib/shared/ai/resolveModelTier.d.ts +14 -0
- package/lib/shared/ai/utils/parseSSE.d.ts +22 -0
- package/lib/shared/billing/createCheckout.d.ts +8 -2
- package/lib/shared/billing/helpers/index.d.ts +0 -0
- package/lib/shared/billing/helpers/subscriptionManagement.d.ts +0 -0
- package/lib/shared/billing/helpers/updateUserSubscription.d.ts +0 -0
- package/lib/shared/billing/idempotency.d.ts +0 -0
- package/lib/shared/billing/index.d.ts +0 -0
- package/lib/shared/billing/webhookHandler.d.ts +0 -0
- package/lib/shared/crud/bulkCore.d.ts +211 -0
- package/lib/shared/crud/index.d.ts +13 -0
- package/lib/shared/email/createEmailRoute.d.ts +30 -0
- package/lib/shared/email/index.d.ts +3 -0
- package/lib/shared/email/provider.d.ts +30 -0
- package/lib/shared/email/resendProvider.d.ts +22 -0
- package/lib/shared/errorHandling.d.ts +0 -0
- package/lib/shared/firebase.d.ts +0 -0
- package/lib/shared/github.d.ts +5 -0
- package/lib/shared/index.d.ts +3 -0
- package/lib/shared/index.js +4 -3
- package/lib/shared/index.js.map +4 -4
- package/lib/shared/logger.d.ts +2 -0
- package/lib/shared/metadata.d.ts +6 -6
- package/lib/shared/oauth/exchangeToken.d.ts +1 -0
- package/lib/shared/oauth/grantAccess.d.ts +1 -0
- package/lib/shared/oauth/index.d.ts +0 -0
- package/lib/shared/schema.d.ts +0 -0
- package/lib/shared/utils/detectFirestore.d.ts +0 -0
- package/lib/shared/utils/external/date.d.ts +0 -0
- package/lib/shared/utils/external/index.d.ts +0 -0
- package/lib/shared/utils/external/references.d.ts +0 -0
- package/lib/shared/utils/external/subscription.d.ts +0 -0
- package/lib/shared/utils/firebaseHelpers.d.ts +0 -0
- package/lib/shared/utils/functionWrapper.d.ts +0 -0
- package/lib/shared/utils/index.d.ts +0 -0
- package/lib/shared/utils/internal/auth.d.ts +0 -0
- package/lib/shared/utils/internal/firebase.d.ts +0 -0
- package/lib/shared/utils/internal/idempotency.d.ts +1 -0
- package/lib/shared/utils/internal/index.d.ts +0 -0
- package/lib/shared/utils/internal/monitoring.d.ts +0 -0
- package/lib/shared/utils/internal/rateLimiter.d.ts +0 -0
- package/lib/shared/utils/internal/validation.d.ts +0 -0
- package/lib/shared/utils/schemaValidation.d.ts +0 -0
- package/lib/shared/utils/validation.d.ts +0 -0
- package/lib/shared/utils/vercelHelpers.d.ts +0 -0
- package/lib/shared/utils.d.ts +0 -0
- package/lib/shared/validation.d.ts +0 -0
- package/lib/supabase/ai/createAIFunction.d.ts +30 -0
- package/lib/supabase/auth/deleteAccount.d.ts +0 -0
- package/lib/supabase/auth/getCustomClaims.d.ts +0 -0
- package/lib/supabase/auth/getUserAuthStatus.d.ts +0 -0
- package/lib/supabase/auth/removeCustomClaims.d.ts +1 -1
- package/lib/supabase/auth/setCustomClaims.d.ts +12 -4
- package/lib/supabase/baseFunction.d.ts +0 -0
- package/lib/supabase/billing/cancelSubscription.d.ts +0 -0
- package/lib/supabase/billing/changePlan.d.ts +1 -1
- package/lib/supabase/billing/createCheckoutSession.d.ts +0 -0
- package/lib/supabase/billing/createCustomerPortal.d.ts +0 -0
- package/lib/supabase/billing/refreshSubscriptionStatus.d.ts +0 -0
- package/lib/supabase/crud/aggregate.d.ts +1 -0
- package/lib/supabase/crud/bulk.d.ts +63 -0
- package/lib/supabase/crud/create.d.ts +2 -1
- package/lib/supabase/crud/delete.d.ts +1 -0
- package/lib/supabase/crud/get.d.ts +1 -0
- package/lib/supabase/crud/index.d.ts +2 -0
- package/lib/supabase/crud/list.d.ts +1 -0
- package/lib/supabase/crud/update.d.ts +1 -0
- package/lib/supabase/edgeFunction.d.ts +56 -0
- package/lib/supabase/email/createEmailFunction.d.ts +31 -0
- package/lib/supabase/helpers/authProvider.d.ts +0 -0
- package/lib/supabase/index.d.ts +8 -0
- package/lib/supabase/index.js +3 -2
- package/lib/supabase/index.js.map +4 -4
- package/lib/supabase/oauth/disconnect.d.ts +0 -0
- package/lib/supabase/oauth/exchangeToken.d.ts +0 -0
- package/lib/supabase/oauth/getConnections.d.ts +0 -0
- package/lib/supabase/oauth/index.d.ts +0 -0
- package/lib/supabase/oauth/refreshToken.d.ts +0 -0
- package/lib/supabase/registerCrudFunctions.d.ts +0 -0
- package/lib/supabase/utils/idempotency.d.ts +0 -0
- package/lib/supabase/utils/monitoring.d.ts +0 -0
- package/lib/supabase/utils/rateLimiter.d.ts +0 -0
- package/lib/vercel/api/ai/chat.d.ts +29 -0
- package/lib/vercel/api/ai/index.d.ts +1 -0
- package/lib/vercel/api/auth/get-custom-claims.d.ts +0 -0
- package/lib/vercel/api/auth/get-user-auth-status.d.ts +0 -0
- package/lib/vercel/api/auth/index.d.ts +0 -0
- package/lib/vercel/api/auth/remove-custom-claims.d.ts +0 -0
- package/lib/vercel/api/auth/set-custom-claims.d.ts +0 -0
- package/lib/vercel/api/billing/cancel.d.ts +0 -0
- package/lib/vercel/api/billing/change-plan.d.ts +0 -0
- package/lib/vercel/api/billing/create-checkout-session.d.ts +0 -0
- package/lib/vercel/api/billing/customer-portal.d.ts +0 -0
- package/lib/vercel/api/billing/index.d.ts +0 -0
- package/lib/vercel/api/billing/refresh-subscription-status.d.ts +0 -0
- package/lib/vercel/api/billing/webhook-handler.d.ts +0 -0
- package/lib/vercel/api/config/constants.d.ts +0 -0
- package/lib/vercel/api/config/firebase-admin.d.ts +0 -0
- package/lib/vercel/api/config/index.d.ts +0 -0
- package/lib/vercel/api/crud/bulk.d.ts +31 -0
- package/lib/vercel/api/crud/create.d.ts +0 -0
- package/lib/vercel/api/crud/delete.d.ts +0 -0
- package/lib/vercel/api/crud/get.d.ts +0 -0
- package/lib/vercel/api/crud/index.d.ts +1 -0
- package/lib/vercel/api/crud/list.d.ts +0 -0
- package/lib/vercel/api/crud/update.d.ts +0 -0
- package/lib/vercel/api/index.d.ts +1 -0
- package/lib/vercel/api/index.js +3 -2
- package/lib/vercel/api/index.js.map +4 -4
- package/lib/vercel/api/oauth/check-github-access.d.ts +0 -0
- package/lib/vercel/api/oauth/exchange-token.d.ts +0 -0
- package/lib/vercel/api/oauth/grant-github-access.d.ts +0 -0
- package/lib/vercel/api/oauth/index.d.ts +0 -0
- package/lib/vercel/api/oauth/revoke-github-access.d.ts +0 -0
- package/lib/vercel/api/utils/cors.d.ts +0 -0
- package/lib/vercel/baseFunction.d.ts +0 -0
- package/package.json +40 -7
- package/src/firebase/auth/getCustomClaims.ts +0 -0
- package/src/firebase/auth/getUserAuthStatus.ts +0 -0
- package/src/firebase/auth/index.ts +0 -0
- package/src/firebase/auth/removeCustomClaims.ts +0 -0
- package/src/firebase/auth/setCustomClaims.ts +0 -0
- package/src/firebase/baseFunction.ts +0 -0
- package/src/firebase/billing/cancelSubscription.ts +0 -0
- package/src/firebase/billing/changePlan.ts +0 -0
- package/src/firebase/billing/createCheckoutSession.ts +82 -186
- package/src/firebase/billing/createCustomerPortal.ts +0 -0
- package/src/firebase/billing/healthCheck.ts +0 -0
- package/src/firebase/billing/index.d.ts +0 -0
- package/src/firebase/billing/index.ts +0 -0
- package/src/firebase/billing/refreshSubscriptionStatus.ts +0 -0
- package/src/firebase/billing/webhookHandler.ts +0 -0
- package/src/firebase/config/constants.ts +0 -0
- package/src/firebase/config/index.ts +0 -0
- package/src/firebase/config/secrets.ts +0 -0
- package/src/firebase/crud/__tests__/bulk.test.ts +322 -0
- package/src/firebase/crud/aggregate.ts +0 -0
- package/src/firebase/crud/bulk.ts +272 -0
- package/src/firebase/crud/create.ts +20 -33
- package/src/firebase/crud/delete.ts +0 -0
- package/src/firebase/crud/get.ts +0 -0
- package/src/firebase/crud/index.ts +1 -0
- package/src/firebase/crud/list.ts +0 -0
- package/src/firebase/crud/update.ts +0 -0
- package/src/firebase/helpers/githubAccessHelper.ts +0 -0
- package/src/firebase/helpers/githubTeamAccessHelper.ts +0 -0
- package/src/firebase/helpers/index.ts +0 -0
- package/src/firebase/index.d.ts +0 -0
- package/src/firebase/index.ts +0 -0
- package/src/firebase/oauth/disconnect.ts +0 -0
- package/src/firebase/oauth/exchangeToken.ts +4 -4
- package/src/firebase/oauth/getConnections.ts +0 -0
- package/src/firebase/oauth/githubAccess.ts +0 -0
- package/src/firebase/oauth/index.ts +0 -0
- package/src/firebase/oauth/refreshToken.ts +4 -4
- package/src/firebase/registerCrudFunctions.ts +13 -0
- package/src/firebase/scheduled/checkExpiredSubscriptions.ts +0 -0
- package/src/firebase/scheduled/index.ts +0 -0
- package/src/shared/__tests__/auth.test.ts +0 -0
- package/src/shared/__tests__/bulkCore.test.ts +487 -0
- package/src/shared/__tests__/errorHandling.test.ts +0 -0
- package/src/shared/__tests__/firebase.test.ts +9 -3
- package/src/shared/__tests__/idempotency.test.ts +0 -0
- package/src/shared/__tests__/internalValidation.test.ts +9 -3
- package/src/shared/__tests__/metadata.test.ts +10 -10
- package/src/shared/__tests__/rateLimiter.test.ts +0 -0
- package/src/shared/__tests__/schema.test.ts +0 -0
- package/src/shared/__tests__/schemaValidation.test.ts +0 -0
- package/src/shared/__tests__/subscription.test.ts +0 -0
- package/src/shared/__tests__/utils.test.ts +10 -4
- package/src/shared/__tests__/validation-env.test.ts +9 -3
- package/src/shared/__tests__/validation.test.ts +0 -0
- package/src/shared/ai/__tests__/costTracker.test.ts +133 -0
- package/src/shared/ai/classifyAIError.ts +178 -0
- package/src/shared/ai/costTracker.ts +51 -0
- package/src/shared/ai/createAIRoute.ts +400 -0
- package/src/shared/ai/index.ts +8 -0
- package/src/shared/ai/resolveModelTier.ts +61 -0
- package/src/shared/billing/__tests__/createCheckout.test.ts +0 -0
- package/src/shared/billing/__tests__/webhookHandler.test.ts +0 -0
- package/src/shared/billing/createCheckout.ts +168 -8
- package/src/shared/billing/helpers/index.ts +0 -0
- package/src/shared/billing/helpers/subscriptionManagement.ts +9 -0
- package/src/shared/billing/helpers/updateUserSubscription.ts +0 -0
- package/src/shared/billing/idempotency.ts +5 -0
- package/src/shared/billing/index.ts +0 -0
- package/src/shared/billing/webhookHandler.ts +0 -0
- package/src/shared/crud/bulkCore.ts +483 -0
- package/src/shared/crud/index.ts +23 -0
- package/src/shared/email/createEmailRoute.ts +81 -0
- package/src/shared/email/index.ts +5 -0
- package/src/shared/email/provider.ts +31 -0
- package/src/shared/email/resendProvider.ts +56 -0
- package/src/shared/errorHandling.ts +10 -4
- package/src/shared/firebase.ts +0 -0
- package/src/shared/github.ts +38 -0
- package/src/shared/index.d.ts +9 -0
- package/src/shared/index.ts +3 -0
- package/src/shared/logger.ts +2 -0
- package/src/shared/metadata.ts +6 -6
- package/src/shared/oauth/__tests__/exchangeToken.test.ts +0 -0
- package/src/shared/oauth/__tests__/grantAccess.test.ts +0 -0
- package/src/shared/oauth/exchangeToken.ts +1 -0
- package/src/shared/oauth/grantAccess.ts +1 -0
- package/src/shared/oauth/index.ts +0 -0
- package/src/shared/schema.ts +0 -0
- package/src/shared/utils/__tests__/functionWrapper.test.ts +0 -0
- package/src/shared/utils/detectFirestore.ts +0 -0
- package/src/shared/utils/external/date.ts +0 -0
- package/src/shared/utils/external/index.ts +0 -0
- package/src/shared/utils/external/references.ts +0 -0
- package/src/shared/utils/external/subscription.ts +0 -0
- package/src/shared/utils/firebaseHelpers.ts +0 -0
- package/src/shared/utils/functionWrapper.ts +0 -0
- package/src/shared/utils/index.ts +0 -0
- package/src/shared/utils/internal/auth.ts +0 -0
- package/src/shared/utils/internal/firebase.ts +0 -0
- package/src/shared/utils/internal/idempotency.ts +1 -0
- package/src/shared/utils/internal/index.ts +0 -0
- package/src/shared/utils/internal/monitoring.ts +0 -0
- package/src/shared/utils/internal/rateLimiter.ts +6 -3
- package/src/shared/utils/internal/validation.ts +0 -0
- package/src/shared/utils/schemaValidation.ts +0 -0
- package/src/shared/utils/validation.ts +0 -0
- package/src/shared/utils/vercelHelpers.ts +0 -0
- package/src/shared/utils.ts +0 -0
- package/src/shared/validation.ts +1 -1
- package/src/supabase/__tests__/bulk.test.ts +330 -0
- package/src/supabase/ai/createAIFunction.ts +76 -0
- package/src/supabase/auth/deleteAccount.ts +0 -0
- package/src/supabase/auth/getCustomClaims.ts +0 -0
- package/src/supabase/auth/getUserAuthStatus.ts +0 -0
- package/src/supabase/auth/removeCustomClaims.ts +38 -2
- package/src/supabase/auth/setCustomClaims.ts +64 -5
- package/src/supabase/baseFunction.ts +26 -2
- package/src/supabase/billing/cancelSubscription.ts +0 -0
- package/src/supabase/billing/changePlan.ts +6 -1
- package/src/supabase/billing/createCheckoutSession.ts +16 -2
- package/src/supabase/billing/createCustomerPortal.ts +0 -0
- package/src/supabase/billing/refreshSubscriptionStatus.ts +0 -0
- package/src/supabase/crud/aggregate.ts +1 -0
- package/src/supabase/crud/bulk.ts +244 -0
- package/src/supabase/crud/create.ts +16 -14
- package/src/supabase/crud/delete.ts +1 -0
- package/src/supabase/crud/get.ts +1 -0
- package/src/supabase/crud/index.ts +2 -0
- package/src/supabase/crud/list.ts +1 -0
- package/src/supabase/crud/update.ts +1 -0
- package/src/supabase/edgeFunction.ts +196 -0
- package/src/supabase/email/createEmailFunction.ts +72 -0
- package/src/supabase/helpers/authProvider.ts +0 -0
- package/src/supabase/index.ts +21 -0
- package/src/supabase/oauth/disconnect.ts +1 -2
- package/src/supabase/oauth/exchangeToken.ts +39 -10
- package/src/supabase/oauth/getConnections.ts +1 -4
- package/src/supabase/oauth/index.ts +0 -0
- package/src/supabase/oauth/refreshToken.ts +6 -12
- package/src/supabase/registerCrudFunctions.ts +20 -20
- package/src/supabase/utils/idempotency.ts +6 -2
- package/src/supabase/utils/monitoring.ts +0 -0
- package/src/supabase/utils/rateLimiter.ts +0 -0
- package/src/vercel/__tests__/bulk.test.ts +301 -0
- package/src/vercel/api/ai/chat.ts +77 -0
- package/src/vercel/api/ai/index.ts +3 -0
- package/src/vercel/api/auth/get-custom-claims.ts +0 -0
- package/src/vercel/api/auth/get-user-auth-status.ts +0 -0
- package/src/vercel/api/auth/index.ts +0 -0
- package/src/vercel/api/auth/remove-custom-claims.ts +0 -0
- package/src/vercel/api/auth/set-custom-claims.ts +0 -0
- package/src/vercel/api/billing/cancel.ts +0 -0
- package/src/vercel/api/billing/change-plan.ts +0 -0
- package/src/vercel/api/billing/create-checkout-session.ts +31 -4
- package/src/vercel/api/billing/customer-portal.ts +0 -0
- package/src/vercel/api/billing/index.ts +0 -0
- package/src/vercel/api/billing/refresh-subscription-status.ts +0 -0
- package/src/vercel/api/billing/webhook-handler.ts +8 -1
- package/src/vercel/api/config/constants.ts +0 -0
- package/src/vercel/api/config/firebase-admin.ts +0 -0
- package/src/vercel/api/config/index.ts +0 -0
- package/src/vercel/api/crud/bulk.ts +216 -0
- package/src/vercel/api/crud/create.ts +10 -9
- package/src/vercel/api/crud/delete.ts +0 -0
- package/src/vercel/api/crud/get.ts +0 -0
- package/src/vercel/api/crud/index.ts +1 -0
- package/src/vercel/api/crud/list.ts +0 -0
- package/src/vercel/api/crud/update.ts +0 -0
- package/src/vercel/api/index.d.ts +0 -0
- package/src/vercel/api/index.ts +1 -0
- package/src/vercel/api/oauth/check-github-access.ts +0 -0
- package/src/vercel/api/oauth/exchange-token.ts +27 -1
- package/src/vercel/api/oauth/grant-github-access.ts +0 -0
- package/src/vercel/api/oauth/index.ts +0 -0
- package/src/vercel/api/oauth/revoke-github-access.ts +0 -0
- package/src/vercel/api/utils/cors.ts +8 -0
- package/src/vercel/baseFunction.ts +0 -0
package/LICENSE.md
CHANGED
|
@@ -1,242 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
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
|
|
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="
|
|
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="
|
|
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
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Functions
|
|
2
|
+
|
|
3
|
+
**This guide has been merged into provider-specific guides.**
|
|
4
|
+
|
|
5
|
+
- **Firebase Cloud Functions** - See the Firebase guideline, Cloud Functions section
|
|
6
|
+
- **Supabase Edge Functions** - See the Supabase guideline, Edge Functions section
|
|
7
|
+
- **Vercel Functions** - See the Vercel guideline, Vercel Functions section
|
|
8
|
+
|
|
9
|
+
Each provider guide covers function setup, CRUD registration, custom functions, import rules, and deployment for that stack.
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# Vercel (Hosting & Functions)
|
|
2
|
+
|
|
3
|
+
**Deploy your frontend (and optionally serverless functions) to Vercel. Works with any backend (Firebase, Supabase, or both).**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Architecture
|
|
8
|
+
|
|
9
|
+
Vercel serves your built Vite or Next.js app on a global CDN. It can also run **Vercel Functions** (serverless API routes).
|
|
10
|
+
|
|
11
|
+
**Vercel as hosting only** (backend elsewhere):
|
|
12
|
+
- **Firebase** - Cloud Functions + Firestore + Auth + Storage
|
|
13
|
+
- **Supabase** - Edge Functions + PostgreSQL + Auth + Storage
|
|
14
|
+
|
|
15
|
+
**Vercel as hosting + functions** (alongside a backend):
|
|
16
|
+
- Vercel Functions handle API routes (`/api/*`)
|
|
17
|
+
- Combine with Firebase/Supabase for auth + database
|
|
18
|
+
|
|
19
|
+
The framework scaffolds `vercel.json` with CSP headers, rewrites, and caching rules.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Step 1: Create Vercel Project
|
|
24
|
+
|
|
25
|
+
1. Create a [Vercel](https://vercel.com) account
|
|
26
|
+
2. Import your Git repo from the Vercel Dashboard
|
|
27
|
+
3. Set the **Root Directory** to `apps/<your-app>` (or leave blank if monorepo auto-detected)
|
|
28
|
+
4. Set **Framework Preset** to Vite (or Next.js if using Next)
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Step 2: Add Credentials
|
|
33
|
+
|
|
34
|
+
**Secret (shared across apps):** add to `.dndev.secrets` at project root:
|
|
35
|
+
|
|
36
|
+
```env
|
|
37
|
+
VERCEL_TOKEN=your_vercel_token
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Per-app (public):** add to `apps/<your-app>/.env`:
|
|
41
|
+
|
|
42
|
+
```env
|
|
43
|
+
VERCEL_PROJECT_ID=your_project_id
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Team/Pro accounts only** - add to `apps/<your-app>/.env`:
|
|
47
|
+
|
|
48
|
+
```env
|
|
49
|
+
VERCEL_ORG_ID=your_team_id
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
> **Hobby/free accounts: Do NOT set `VERCEL_ORG_ID`.** Setting it on a hobby account causes 403 Forbidden errors. If you're unsure, run `dndev setup` - it detects your account type automatically.
|
|
53
|
+
|
|
54
|
+
**Where to find them:**
|
|
55
|
+
|
|
56
|
+
| Variable | Where | File | Required? |
|
|
57
|
+
|----------|-------|------|-----------|
|
|
58
|
+
| `VERCEL_TOKEN` | [vercel.com/account/tokens](https://vercel.com/account/tokens) - scope to your team | `.dndev.secrets` | Always |
|
|
59
|
+
| `VERCEL_PROJECT_ID` | Vercel Dashboard > Your Project > Settings > General > **Project ID** | `apps/<app>/.env` | Always |
|
|
60
|
+
| `VERCEL_ORG_ID` | Vercel Dashboard > Settings > General > **Team ID** | `apps/<app>/.env` | Team/Pro only |
|
|
61
|
+
|
|
62
|
+
That's it. No `vercel login`, no `vercel link`, no interactive prompts. Run `dndev setup` to validate everything.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Step 3: Set App Environment Variables
|
|
67
|
+
|
|
68
|
+
In **Vercel Dashboard > Project > Settings > Environment Variables**, add your app's env vars:
|
|
69
|
+
|
|
70
|
+
**If using Firebase:**
|
|
71
|
+
- `VITE_FIREBASE_API_KEY`
|
|
72
|
+
- `VITE_FIREBASE_PROJECT_ID`
|
|
73
|
+
- `VITE_FIREBASE_AUTH_DOMAIN`
|
|
74
|
+
- `VITE_FIREBASE_STORAGE_BUCKET`
|
|
75
|
+
- `VITE_FIREBASE_MESSAGING_SENDER_ID`
|
|
76
|
+
- `VITE_FIREBASE_APP_ID`
|
|
77
|
+
|
|
78
|
+
**If using Supabase:**
|
|
79
|
+
- `VITE_SUPABASE_URL`
|
|
80
|
+
- `VITE_SUPABASE_PUBLIC_KEY`
|
|
81
|
+
|
|
82
|
+
**Common (all backends):**
|
|
83
|
+
- `VITE_STRIPE_PUBLISHABLE_KEY` (if using billing)
|
|
84
|
+
|
|
85
|
+
**Server-side (Vercel Functions only):**
|
|
86
|
+
- `STRIPE_SECRET_KEY` (if using billing)
|
|
87
|
+
- `SUPABASE_SERVICE_ROLE_KEY` (if using Supabase)
|
|
88
|
+
|
|
89
|
+
For Next.js apps, replace the `VITE_` prefix with `NEXT_PUBLIC_` (same var names, different prefix).
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Step 4: Deploy
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
dndev deploy
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
That's it. The CLI reads your credentials from `.dndev.secrets` and `.env` and deploys to production.
|
|
100
|
+
|
|
101
|
+
**Option B - Git push (auto-deploy)**
|
|
102
|
+
|
|
103
|
+
If your repo is connected to Vercel, pushing to your branch auto-deploys:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
git push origin main
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Vercel Functions (Optional)
|
|
112
|
+
|
|
113
|
+
The framework provides helpers for Vercel Functions via `@donotdev/functions/vercel`. Place your API routes in `pages/api/` (Next.js) or `api/` (Vite).
|
|
114
|
+
|
|
115
|
+
### Custom Functions
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
// pages/api/product-details.ts
|
|
119
|
+
import * as v from 'valibot';
|
|
120
|
+
import { createVercelBaseFunction } from '@donotdev/functions/vercel';
|
|
121
|
+
|
|
122
|
+
const schema = v.object({ productId: v.string() });
|
|
123
|
+
|
|
124
|
+
export default createVercelBaseFunction(
|
|
125
|
+
'POST',
|
|
126
|
+
schema,
|
|
127
|
+
'get_product_details',
|
|
128
|
+
async (req, res, data, { uid }) => {
|
|
129
|
+
// data is validated, uid is the authenticated user
|
|
130
|
+
const product = await getProduct(data.productId);
|
|
131
|
+
return res.status(200).json(product);
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Auth, rate limiting, schema validation, and metrics - all included by default.
|
|
137
|
+
|
|
138
|
+
### Pre-built Endpoints
|
|
139
|
+
|
|
140
|
+
The framework ships ready-made API handlers:
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
// pages/api/auth/claims.ts
|
|
144
|
+
import { setCustomClaims } from '@donotdev/functions/vercel';
|
|
145
|
+
export default setCustomClaims;
|
|
146
|
+
|
|
147
|
+
// pages/api/billing/checkout.ts
|
|
148
|
+
import { createCheckoutSession } from '@donotdev/functions/vercel';
|
|
149
|
+
import { billingConfig } from '../../../config/billing';
|
|
150
|
+
export default createCheckoutSession(billingConfig);
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Available: auth (claims, status, delete account), billing (checkout, cancel, portal, change plan), OAuth (token exchange, access grants).
|
|
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
|
+
|
|
182
|
+
### When to use Vercel Functions vs Firebase/Supabase functions
|
|
183
|
+
|
|
184
|
+
- **Vercel Functions:** API routes, webhooks, third-party proxies - especially in Next.js apps
|
|
185
|
+
- **Firebase Cloud Functions:** Firestore triggers, heavy backend logic tied to Firebase
|
|
186
|
+
- **Supabase Edge Functions:** Database triggers, logic tied to Supabase
|
|
187
|
+
|
|
188
|
+
**Server secrets** for Vercel Functions go in Vercel Dashboard > Environment Variables (not `VITE_*` or `NEXT_PUBLIC_*` prefixed - those are exposed to the browser).
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Environment Variables
|
|
193
|
+
|
|
194
|
+
| File | What Goes Here | Loaded By |
|
|
195
|
+
|------|---------------|-----------|
|
|
196
|
+
| `.dndev.secrets` | `VERCEL_TOKEN` (gitignored) | `dndev deploy` |
|
|
197
|
+
| `apps/<app>/.env` | Public keys + `VERCEL_ORG_ID`, `VERCEL_PROJECT_ID` | Vite/Next.js + `dndev deploy` |
|
|
198
|
+
| `apps/<app>/.env.production` | Production overrides | Vite/Next.js (build --mode production) |
|
|
199
|
+
| Vercel Dashboard | All production env vars (client + server) | Vercel runtime |
|
|
200
|
+
|
|
201
|
+
**Client vars** (browser-safe): `VITE_*` or `NEXT_PUBLIC_*` prefix.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Local Development
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
dndev dev
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
The app runs locally, talking to your backend (Firebase or Supabase) directly.
|
|
212
|
+
|
|
213
|
+
For local function emulation:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
dndev emu start
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Auth Redirect URLs (Supabase)
|
|
222
|
+
|
|
223
|
+
After deploying, configure Supabase so OAuth (Google, GitHub, etc.) redirects back to your Vercel URL instead of `localhost`.
|
|
224
|
+
|
|
225
|
+
**Supabase Dashboard > Authentication > URL Configuration:**
|
|
226
|
+
|
|
227
|
+
| Setting | Value |
|
|
228
|
+
|---------|-------|
|
|
229
|
+
| **Site URL** | Your production URL (e.g., `https://myapp.vercel.app`) |
|
|
230
|
+
| **Redirect URLs** | Add all deployment URLs where auth should work |
|
|
231
|
+
|
|
232
|
+
**Redirect URLs to add:**
|
|
233
|
+
|
|
234
|
+
- `http://localhost:5173` - local Vite dev
|
|
235
|
+
- `http://localhost:3000` - local Next.js dev
|
|
236
|
+
- `https://myapp.vercel.app` - production
|
|
237
|
+
- `https://*-yourteam.vercel.app` - Vercel preview deploys (wildcard)
|
|
238
|
+
- `https://mycustomdomain.com` - custom domain (if applicable)
|
|
239
|
+
|
|
240
|
+
> **Site URL is the fallback.** If the `redirectTo` sent by your app doesn't match any entry in Redirect URLs, Supabase falls back to Site URL. If Site URL is `localhost:3000`, your deployed app will redirect to localhost after OAuth. **Always set Site URL to production.**
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Custom Domain
|
|
245
|
+
|
|
246
|
+
1. Vercel Dashboard > Settings > Domains
|
|
247
|
+
2. Add your domain
|
|
248
|
+
3. Update DNS records as instructed by Vercel
|
|
249
|
+
4. If using Firebase Auth: update your `FIREBASE_AUTH_DOMAIN` env var to your custom domain
|
|
250
|
+
5. If using Supabase Auth: add your custom domain to **Supabase Dashboard > Authentication > Redirect URLs** and update **Site URL**
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Troubleshooting
|
|
255
|
+
|
|
256
|
+
**"Missing Vercel credentials"**
|
|
257
|
+
- Check `VERCEL_TOKEN` is in `.dndev.secrets` at project root
|
|
258
|
+
- Check `VERCEL_PROJECT_ID` is in `apps/<app>/.env`
|
|
259
|
+
- Run `dndev setup` to validate
|
|
260
|
+
|
|
261
|
+
**"403 Forbidden" / "token does not have access"**
|
|
262
|
+
- Hobby/free account? Remove `VERCEL_ORG_ID` from `apps/<app>/.env` - hobby accounts don't use team IDs
|
|
263
|
+
- Team account? Ensure the token is scoped to the correct team at https://vercel.com/account/tokens
|
|
264
|
+
|
|
265
|
+
**"401 Unauthorized" / "token is invalid or expired"**
|
|
266
|
+
- Generate a new token at https://vercel.com/account/tokens and update `.dndev.secrets`
|
|
267
|
+
|
|
268
|
+
**"404 project not found"**
|
|
269
|
+
- Check `VERCEL_PROJECT_ID` matches the Project ID in Vercel Dashboard > Project > Settings > General
|
|
270
|
+
|
|
271
|
+
**"Build fails on Vercel"**
|
|
272
|
+
- Check Root Directory is set to your app directory
|
|
273
|
+
- Ensure `package.json` has correct `build` script
|
|
274
|
+
- Check all `VITE_*` env vars are set in Vercel Dashboard
|
|
275
|
+
|
|
276
|
+
**"CORS error"**
|
|
277
|
+
- Vercel handles CORS for same-origin requests automatically
|
|
278
|
+
- For cross-origin: CSP headers in `vercel.json` are pre-configured for your backend
|
|
279
|
+
|
|
280
|
+
**".env values not loading"**
|
|
281
|
+
- Vercel only reads env vars from its Dashboard, not from `.env` files
|
|
282
|
+
- Make sure all required vars are set in Vercel Dashboard > Environment Variables
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
**Token in `.dndev.secrets` + IDs in `.env` > `dndev deploy` > done.**
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Create checkout session Firebase function
|
|
3
|
+
* @description Firebase callable function for creating Stripe checkout sessions.
|
|
4
|
+
* Delegates to shared createCheckoutAlgorithm (SSOT).
|
|
5
|
+
*
|
|
6
|
+
* @version 0.2.0
|
|
7
|
+
* @since 0.0.1
|
|
8
|
+
* @author AMBROISE PARK Consulting
|
|
9
|
+
*/
|
|
1
10
|
import type { CreateCheckoutSessionRequest, StripeBackConfig } from '@donotdev/core/server';
|
|
2
11
|
import type { CallableFunction } from 'firebase-functions/v2/https';
|
|
3
12
|
/**
|
|
4
13
|
* Create Firebase function for checkout session creation
|
|
5
|
-
*
|
|
6
|
-
* @param billingConfig - Billing configuration with product definitions
|
|
7
|
-
* @returns Firebase function for checkout session creation
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* const createCheckout = createCheckoutSession(billingConfig);
|
|
11
|
-
* const result = await createCheckout({
|
|
12
|
-
* priceId: 'price_xxx',
|
|
13
|
-
* userId: 'user123',
|
|
14
|
-
* metadata: { billingConfigKey: 'early_bird' }
|
|
15
|
-
* });
|
|
16
|
-
* window.location.href = result.data.sessionUrl;
|
|
17
14
|
*/
|
|
18
15
|
export declare function createCheckoutSession(billingConfig: StripeBackConfig): CallableFunction<CreateCheckoutSessionRequest, Promise<{
|
|
19
16
|
sessionId: string;
|
|
20
|
-
sessionUrl: string;
|
|
17
|
+
sessionUrl: string | null;
|
|
21
18
|
}>>;
|
|
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
|