@donotdev/functions 0.2.0 → 0.2.2
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/README.md +1 -1
- package/lib/chunks/{chunk-JTAGPPPL.js → chunk-2A4FPYNB.js} +2 -2
- package/lib/chunks/chunk-2IFFIUFV.js +23 -0
- package/lib/chunks/{chunk-RM7DV6IQ.js.map → chunk-2IFFIUFV.js.map} +3 -3
- package/lib/chunks/chunk-FQSQGOBN.js +22 -0
- package/lib/chunks/chunk-FQSQGOBN.js.map +7 -0
- package/lib/chunks/chunk-G4FO76EA.js +22 -0
- package/lib/chunks/{chunk-5DTPEM64.js.map → chunk-G4FO76EA.js.map} +3 -3
- package/lib/chunks/{chunk-QJAU2MWV.js → chunk-LSM5Y2E5.js} +2 -2
- package/lib/chunks/{chunk-QJAU2MWV.js.map → chunk-LSM5Y2E5.js.map} +3 -3
- package/lib/chunks/{chunk-4U7QQWYG.js → chunk-M4JV2JCF.js} +2 -2
- package/lib/chunks/chunk-OZX5ZG44.js +22 -0
- package/lib/chunks/chunk-OZX5ZG44.js.map +7 -0
- package/lib/chunks/{chunk-IFOYVSPU.js → chunk-PJCJ5H2O.js} +2 -2
- package/lib/chunks/chunk-PWAGW4R6.js +22 -0
- package/lib/chunks/chunk-PWAGW4R6.js.map +7 -0
- package/lib/chunks/chunk-UYI56E6Q.js +151 -0
- package/lib/chunks/chunk-UYI56E6Q.js.map +7 -0
- package/lib/chunks/chunk-ZVHC2CAV.js +22 -0
- package/lib/chunks/chunk-ZVHC2CAV.js.map +7 -0
- package/lib/chunks/{monitoring-AGCSU3FI.js → monitoring-UIDJS2KA.js} +2 -2
- package/lib/chunks/{rateLimiter-6KO7AIZP.js → rateLimiter-WNWHI3B4.js} +2 -2
- package/lib/chunks/server-RYGEBS2B.js +22 -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 +0 -0
- 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 +2 -2
- 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/create.d.ts +0 -0
- 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 +0 -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 +1 -1
- package/lib/firebase/index.js +1 -1
- 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 -5
- 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 +0 -0
- package/lib/shared/ai/costTracker.d.ts +0 -0
- package/lib/shared/ai/createAIRoute.d.ts +0 -0
- package/lib/shared/ai/index.d.ts +0 -0
- package/lib/shared/ai/resolveModelTier.d.ts +0 -0
- package/lib/shared/billing/checkoutPrice.d.ts +3 -6
- package/lib/shared/billing/createCheckout.d.ts +3 -3
- package/lib/shared/billing/firestoreIdempotency.d.ts +13 -0
- 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 +4 -35
- package/lib/shared/billing/idempotencyContract.d.ts +0 -20
- package/lib/shared/billing/index.d.ts +0 -0
- package/lib/shared/billing/stripeClient.d.ts +45 -0
- package/lib/shared/billing/webhookHandler.d.ts +5 -4
- package/lib/shared/email/createEmailRoute.d.ts +0 -0
- package/lib/shared/email/index.d.ts +0 -0
- package/lib/shared/email/provider.d.ts +0 -0
- package/lib/shared/email/resendProvider.d.ts +0 -0
- package/lib/shared/errorHandling.d.ts +0 -0
- package/lib/shared/firebase.d.ts +0 -0
- package/lib/shared/github.d.ts +0 -0
- package/lib/shared/index.d.ts +0 -0
- package/lib/shared/index.js +1 -1
- package/lib/shared/index.js.map +0 -0
- package/lib/shared/logger.d.ts +0 -0
- package/lib/shared/metadata.d.ts +0 -0
- package/lib/shared/oauth/exchangeToken.d.ts +0 -0
- package/lib/shared/oauth/grantAccess.d.ts +0 -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 +1 -5
- package/lib/shared/utils/internal/firebase.d.ts +0 -0
- package/lib/shared/utils/internal/idempotency.d.ts +0 -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 -8
- 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 -126
- package/lib/shared/validation.d.ts +0 -0
- package/lib/supabase/ai/createAIFunction.d.ts +0 -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 +0 -0
- package/lib/supabase/auth/setCustomClaims.d.ts +0 -0
- package/lib/supabase/baseFunction.d.ts +0 -0
- package/lib/supabase/billing/cancelSubscription.d.ts +0 -0
- package/lib/supabase/billing/changePlan.d.ts +0 -0
- 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 +0 -0
- package/lib/supabase/crud/create.d.ts +0 -0
- package/lib/supabase/crud/delete.d.ts +0 -0
- package/lib/supabase/crud/get.d.ts +0 -0
- package/lib/supabase/crud/index.d.ts +0 -0
- package/lib/supabase/crud/list.d.ts +0 -8
- package/lib/supabase/crud/update.d.ts +0 -0
- package/lib/supabase/edgeFunction.d.ts +0 -0
- package/lib/supabase/email/createEmailFunction.d.ts +0 -0
- package/lib/supabase/helpers/authProvider.d.ts +0 -0
- package/lib/supabase/index.d.ts +3 -2
- package/lib/supabase/index.js +1 -1
- package/lib/supabase/index.js.map +3 -3
- 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 +0 -0
- package/lib/vercel/api/ai/index.d.ts +0 -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/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 +0 -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 +0 -0
- package/lib/vercel/api/index.js +1 -1
- package/lib/vercel/api/index.js.map +2 -2
- 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 +2 -2
- package/src/firebase/baseFunction.ts +3 -2
- package/src/firebase/billing/cancelSubscription.ts +1 -1
- package/src/firebase/billing/changePlan.ts +1 -5
- package/src/firebase/billing/createCheckoutSession.ts +1 -5
- package/src/firebase/billing/createCustomerPortal.ts +1 -1
- package/src/firebase/billing/healthCheck.ts +1 -1
- package/src/firebase/billing/index.d.ts +0 -12
- package/src/firebase/billing/index.ts +0 -3
- package/src/firebase/billing/refreshSubscriptionStatus.ts +1 -1
- package/src/firebase/billing/webhookHandler.ts +2 -2
- package/src/firebase/index.ts +0 -1
- package/src/firebase/oauth/disconnect.ts +2 -2
- package/src/firebase/oauth/exchangeToken.ts +2 -2
- package/src/firebase/oauth/getConnections.ts +2 -2
- package/src/firebase/oauth/githubAccess.ts +4 -4
- package/src/firebase/oauth/refreshToken.ts +2 -2
- package/src/firebase/registerCrudFunctions.ts +0 -19
- package/src/shared/__tests__/idempotency.test.ts +0 -32
- package/src/shared/__tests__/internalValidation.test.ts +1 -40
- package/src/shared/__tests__/logger.test.ts +31 -0
- package/src/shared/__tests__/utils.test.ts +1 -26
- package/src/shared/billing/__tests__/createCheckout.compat.test.ts +4 -110
- package/src/shared/billing/__tests__/webhookHandler.test.ts +1 -38
- package/src/shared/billing/checkoutPrice.ts +7 -42
- package/src/shared/billing/createCheckout.ts +3 -19
- package/src/shared/billing/firestoreIdempotency.ts +170 -0
- package/src/shared/billing/helpers/subscriptionManagement.ts +1 -1
- package/src/shared/billing/idempotency.ts +8 -225
- package/src/shared/billing/idempotencyContract.ts +0 -21
- package/src/shared/billing/stripeClient.ts +91 -0
- package/src/shared/billing/webhookHandler.ts +5 -5
- package/src/shared/logger.ts +4 -6
- package/src/shared/utils/internal/auth.ts +1 -6
- package/src/shared/utils/internal/validation.ts +0 -18
- package/src/shared/utils.ts +0 -208
- package/src/supabase/billing/cancelSubscription.ts +1 -1
- package/src/supabase/billing/changePlan.ts +1 -1
- package/src/supabase/billing/createCheckoutSession.ts +1 -5
- package/src/supabase/billing/createCustomerPortal.ts +1 -1
- package/src/supabase/billing/refreshSubscriptionStatus.ts +1 -5
- package/src/supabase/billing/stripeWebhook.ts +2 -2
- package/src/supabase/crud/list.ts +2 -0
- package/src/supabase/index.ts +3 -3
- package/src/vercel/api/billing/change-plan.ts +1 -1
- package/src/vercel/api/billing/create-checkout-session.ts +1 -5
- package/src/vercel/api/billing/customer-portal.ts +1 -1
- package/src/vercel/api/billing/refresh-subscription-status.ts +1 -1
- package/src/vercel/api/billing/webhook-handler.ts +1 -1
- package/lib/chunks/chunk-2JL3GDTO.js +0 -151
- package/lib/chunks/chunk-2JL3GDTO.js.map +0 -7
- package/lib/chunks/chunk-4TVLH2W2.js +0 -22
- package/lib/chunks/chunk-5DTPEM64.js +0 -22
- package/lib/chunks/chunk-6CQXHNVL.js +0 -22
- package/lib/chunks/chunk-6CQXHNVL.js.map +0 -7
- package/lib/chunks/chunk-6DSCPZC6.js +0 -22
- package/lib/chunks/chunk-6DSCPZC6.js.map +0 -7
- package/lib/chunks/chunk-7E6TGWHU.js +0 -22
- package/lib/chunks/chunk-7E6TGWHU.js.map +0 -7
- package/lib/chunks/chunk-7LT32OWE.js +0 -22
- package/lib/chunks/chunk-7VH2GJXT.js +0 -151
- package/lib/chunks/chunk-7VH2GJXT.js.map +0 -7
- package/lib/chunks/chunk-API5A4BV.js +0 -22
- package/lib/chunks/chunk-API5A4BV.js.map +0 -7
- package/lib/chunks/chunk-BUP7SXPV.js +0 -23
- package/lib/chunks/chunk-BUP7SXPV.js.map +0 -7
- package/lib/chunks/chunk-BXKRI3JJ.js +0 -22
- package/lib/chunks/chunk-BXKRI3JJ.js.map +0 -7
- package/lib/chunks/chunk-FSLGZD7A.js +0 -21
- package/lib/chunks/chunk-GVLSPWDD.js +0 -151
- package/lib/chunks/chunk-GVLSPWDD.js.map +0 -7
- package/lib/chunks/chunk-GXQVWEFT.js +0 -22
- package/lib/chunks/chunk-GXQVWEFT.js.map +0 -7
- package/lib/chunks/chunk-HB7EGXVI.js +0 -22
- package/lib/chunks/chunk-HB7EGXVI.js.map +0 -7
- package/lib/chunks/chunk-HM7XCMWW.js +0 -22
- package/lib/chunks/chunk-HM7XCMWW.js.map +0 -7
- package/lib/chunks/chunk-I7IOIL6U.js +0 -151
- package/lib/chunks/chunk-I7IOIL6U.js.map +0 -7
- package/lib/chunks/chunk-IFOYVSPU.js.map +0 -7
- package/lib/chunks/chunk-JTAGPPPL.js.map +0 -7
- package/lib/chunks/chunk-MZ232FUE.js +0 -22
- package/lib/chunks/chunk-MZ232FUE.js.map +0 -7
- package/lib/chunks/chunk-NE5ZTUUZ.js +0 -22
- package/lib/chunks/chunk-NE5ZTUUZ.js.map +0 -7
- package/lib/chunks/chunk-NP2AN2TV.js +0 -22
- package/lib/chunks/chunk-NP2AN2TV.js.map +0 -7
- package/lib/chunks/chunk-RM7DV6IQ.js +0 -23
- package/lib/chunks/chunk-RQZGIZHD.js +0 -151
- package/lib/chunks/chunk-RQZGIZHD.js.map +0 -7
- package/lib/chunks/chunk-TBEDQLOB.js +0 -23
- package/lib/chunks/chunk-TBEDQLOB.js.map +0 -7
- package/lib/chunks/chunk-TMHBP3HB.js +0 -22
- package/lib/chunks/chunk-TMHBP3HB.js.map +0 -7
- package/lib/chunks/chunk-UH4L3EF3.js +0 -151
- package/lib/chunks/chunk-UH4L3EF3.js.map +0 -7
- package/lib/chunks/chunk-UJBIU6TL.js +0 -22
- package/lib/chunks/chunk-UJBIU6TL.js.map +0 -7
- package/lib/chunks/chunk-VKEYW3NT.js +0 -22
- package/lib/chunks/chunk-VKEYW3NT.js.map +0 -7
- package/lib/chunks/chunk-XGXBMXJ6.js +0 -22
- package/lib/chunks/chunk-XGXBMXJ6.js.map +0 -7
- package/lib/chunks/chunk-Y44NEQQG.js +0 -22
- package/lib/chunks/chunk-Y44NEQQG.js.map +0 -7
- package/lib/chunks/chunk-ZVU3KPXI.js +0 -22
- package/lib/chunks/chunk-ZVU3KPXI.js.map +0 -7
- package/lib/chunks/monitoring-PVQMFL34.js +0 -22
- package/lib/chunks/monitoring-V7FZXTTW.js +0 -22
- package/lib/chunks/monitoring-V7FZXTTW.js.map +0 -7
- package/lib/chunks/rateLimiter-6KO7AIZP.js.map +0 -7
- package/lib/chunks/rateLimiter-OXVBFW5C.js +0 -22
- package/lib/chunks/rateLimiter-OXVBFW5C.js.map +0 -7
- package/lib/chunks/rateLimiter-U45OMTWR.js +0 -22
- package/lib/chunks/rateLimiter-U45OMTWR.js.map +0 -7
- package/lib/chunks/server-32A5RH4C.js +0 -22
- package/lib/chunks/server-32A5RH4C.js.map +0 -7
- package/lib/chunks/server-7HDAP5DL.js +0 -22
- package/lib/chunks/server-7HDAP5DL.js.map +0 -7
- package/lib/chunks/server-S2IMFOY7.js +0 -22
- package/lib/chunks/server-S2IMFOY7.js.map +0 -7
- package/lib/shared/ai/createAIHandler.d.ts +0 -39
- package/lib/shared/ai/providers/anthropic.d.ts +0 -12
- package/lib/shared/ai/providers/google.d.ts +0 -10
- package/lib/shared/ai/providers/index.d.ts +0 -23
- package/lib/shared/ai/providers/openai.d.ts +0 -10
- package/lib/shared/ai/utils/parseSSE.d.ts +0 -22
- /package/lib/chunks/{chunk-4TVLH2W2.js.map → chunk-2A4FPYNB.js.map} +0 -0
- /package/lib/chunks/{chunk-4U7QQWYG.js.map → chunk-M4JV2JCF.js.map} +0 -0
- /package/lib/chunks/{chunk-7LT32OWE.js.map → chunk-PJCJ5H2O.js.map} +0 -0
- /package/lib/chunks/{chunk-FSLGZD7A.js.map → monitoring-UIDJS2KA.js.map} +0 -0
- /package/lib/chunks/{monitoring-AGCSU3FI.js.map → rateLimiter-WNWHI3B4.js.map} +0 -0
- /package/lib/chunks/{monitoring-PVQMFL34.js.map → server-RYGEBS2B.js.map} +0 -0
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -32,9 +32,4 @@ export type CrudFunctions = Record<string, HttpsFunction>;
|
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
34
|
export declare function createCrudFunctions(entities: Record<string, Entity | unknown>, options?: RegisterOptions): CrudFunctions;
|
|
35
|
-
/**
|
|
36
|
-
* @deprecated Use createCrudFunctions() for ESM. This mutates target which doesn't work in ESM.
|
|
37
|
-
* Auto-register CRUD functions for all entities (CJS pattern)
|
|
38
|
-
*/
|
|
39
|
-
export declare function registerCrudFunctions(entities: Record<string, Entity | unknown>, target?: Record<string, any>, options?: RegisterOptions): CrudFunctions;
|
|
40
35
|
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/shared/ai/index.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -11,16 +11,13 @@ import type Stripe from 'stripe';
|
|
|
11
11
|
import type { CheckoutMode, CheckoutSessionParams, CreateCheckoutSessionRequest, StripePaymentBackItem, StripeSubscriptionBackItem } from '@donotdev/core/server';
|
|
12
12
|
/** Price resolved for a single-price item (0.1.x rules). */
|
|
13
13
|
export interface PricePlan {
|
|
14
|
-
/**
|
|
15
|
-
priceId
|
|
16
|
-
/** 0.1.x dynamic pricing (client unitAmount + productName) */
|
|
17
|
-
dynamic: boolean;
|
|
14
|
+
/** Price charged */
|
|
15
|
+
priceId: string;
|
|
18
16
|
mode: CheckoutMode;
|
|
19
17
|
}
|
|
20
18
|
/**
|
|
21
19
|
* 0.1.x pricing for StripePayment/StripeSubscription: a request priceId (must
|
|
22
|
-
* match the config priceId when set), else
|
|
23
|
-
* `maxUnitAmount`, else the back-config priceId.
|
|
20
|
+
* match the config priceId when set), else the back-config priceId.
|
|
24
21
|
*/
|
|
25
22
|
export declare function resolvePricePlan(item: StripePaymentBackItem | StripeSubscriptionBackItem, request: CreateCheckoutSessionRequest): PricePlan;
|
|
26
23
|
/** 0.1.x params → Stripe params (what the 0.1.x Firebase/Supabase providers sent). */
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @fileoverview Create Checkout Session Algorithm
|
|
3
3
|
* @description Platform-agnostic algorithm for creating Stripe checkout sessions.
|
|
4
4
|
* StripePayment/StripeSubscription items keep the 0.1.x behaviour (request or
|
|
5
|
-
* back-config priceId
|
|
5
|
+
* back-config priceId). StripeOrder items are priced on
|
|
6
6
|
* the server (`resolveLineItems`) and need a {@link StripeSessionProvider}.
|
|
7
7
|
*
|
|
8
8
|
* @version 0.2.0
|
|
@@ -64,8 +64,8 @@ export interface AuthCheckoutProvider {
|
|
|
64
64
|
* Create checkout session algorithm
|
|
65
65
|
*
|
|
66
66
|
* 1. Resolve the billing config item and verify the user
|
|
67
|
-
* 2. Single-price items: 0.1.x pricing (request/back-config priceId
|
|
68
|
-
* 3. `beforeCheckout` hook (block/allow
|
|
67
|
+
* 2. Single-price items: 0.1.x pricing (request/back-config priceId)
|
|
68
|
+
* 3. `beforeCheckout` hook (block/allow)
|
|
69
69
|
* 4. StripeOrder: reject inclusive manual Tax Rates, `resolveLineItems` prices every line
|
|
70
70
|
* and may set per-order session options (`ResolvedOrder.session`: tax rates,
|
|
71
71
|
* payment methods, expiry, invoice footer)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IdempotencyStore } from './idempotencyContract.js';
|
|
2
|
+
/**
|
|
3
|
+
* Firestore-backed store (transactions). Collection: `webhook_idempotency`.
|
|
4
|
+
*
|
|
5
|
+
* `expiresAt` is a Firestore Timestamp {@link WEBHOOK_EVENT_RETENTION_MS} after
|
|
6
|
+
* the last write: enable a TTL policy on `webhook_idempotency.expiresAt` so
|
|
7
|
+
* Firestore deletes old documents.
|
|
8
|
+
*
|
|
9
|
+
* @version 0.2.0
|
|
10
|
+
* @since 0.2.0
|
|
11
|
+
* @author AMBROISE PARK Consulting
|
|
12
|
+
*/
|
|
13
|
+
export declare function createFirestoreIdempotencyStore(): IdempotencyStore;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IdempotencyStore } from './idempotencyContract.js';
|
|
2
2
|
export { RESERVATION_LEASE_MS, ReservationLostError, WEBHOOK_EVENT_RETENTION_MS, } from './idempotencyContract.js';
|
|
3
|
-
export type { IdempotencyStore,
|
|
3
|
+
export type { IdempotencyStore, ReservationResult, } from './idempotencyContract.js';
|
|
4
|
+
export { createFirestoreIdempotencyStore } from './firestoreIdempotency.js';
|
|
4
5
|
/**
|
|
5
6
|
* In-memory store. Single process only: for tests, never for a deployed webhook.
|
|
6
7
|
*
|
|
@@ -8,37 +9,5 @@ export type { IdempotencyStore, LegacyIdempotencyStore, ReservationResult, } fro
|
|
|
8
9
|
* @since 0.2.0
|
|
9
10
|
* @author AMBROISE PARK Consulting
|
|
10
11
|
*/
|
|
11
|
-
export declare function createInMemoryIdempotencyStore():
|
|
12
|
-
/**
|
|
13
|
-
* Firestore-backed store (transactions). Collection: `webhook_idempotency`.
|
|
14
|
-
*
|
|
15
|
-
* `expiresAt` is a Firestore Timestamp {@link WEBHOOK_EVENT_RETENTION_MS} after
|
|
16
|
-
* the last write: enable a TTL policy on `webhook_idempotency.expiresAt` so
|
|
17
|
-
* Firestore deletes old documents.
|
|
18
|
-
*
|
|
19
|
-
* @version 0.2.0
|
|
20
|
-
* @since 0.2.0
|
|
21
|
-
* @author AMBROISE PARK Consulting
|
|
22
|
-
*/
|
|
23
|
-
export declare function createFirestoreIdempotencyStore(): LegacyIdempotencyStore;
|
|
24
|
-
/**
|
|
25
|
-
* 0.1.x store auto-detection: Firestore when configured, else in-memory.
|
|
26
|
-
*
|
|
27
|
-
* @deprecated In-memory is not durable across instances. Pass an explicit store:
|
|
28
|
-
* {@link createFirestoreIdempotencyStore} or `createSupabaseIdempotencyStore`.
|
|
29
|
-
* Framework webhook entry points already do.
|
|
30
|
-
* @version 0.2.0
|
|
31
|
-
* @since 0.0.1
|
|
32
|
-
* @author AMBROISE PARK Consulting
|
|
33
|
-
*/
|
|
34
|
-
export declare function createIdempotencyStore(): LegacyIdempotencyStore;
|
|
35
|
-
/**
|
|
36
|
-
* Reset the store cached by {@link createIdempotencyStore} (tests).
|
|
37
|
-
*
|
|
38
|
-
* @deprecated See {@link createIdempotencyStore}.
|
|
39
|
-
* @version 0.1.0
|
|
40
|
-
* @since 0.0.1
|
|
41
|
-
* @author AMBROISE PARK Consulting
|
|
42
|
-
*/
|
|
43
|
-
export declare function resetIdempotencyStore(): void;
|
|
12
|
+
export declare function createInMemoryIdempotencyStore(): IdempotencyStore;
|
|
44
13
|
export { WEBHOOK_EVENTS_SQL, createSupabaseIdempotencyStore, } from './supabaseIdempotency.js';
|
|
@@ -48,26 +48,6 @@ export interface IdempotencyStore {
|
|
|
48
48
|
*/
|
|
49
49
|
release(eventId: string, ownerToken: string): Promise<boolean>;
|
|
50
50
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Store with the 0.1.x accessors.
|
|
53
|
-
*
|
|
54
|
-
* @deprecated Use {@link IdempotencyStore}: `reserve` returns three states and
|
|
55
|
-
* an owner token; `checkAndReserve` and `isProcessed` do not.
|
|
56
|
-
* @version 0.2.0
|
|
57
|
-
* @since 0.2.0
|
|
58
|
-
* @author AMBROISE PARK Consulting
|
|
59
|
-
*/
|
|
60
|
-
export interface LegacyIdempotencyStore extends IdempotencyStore {
|
|
61
|
-
/** 0.1.x: `true` when the event must be skipped (processed or live lease). */
|
|
62
|
-
checkAndReserve(eventId: string): Promise<boolean>;
|
|
63
|
-
/** Whether the event was processed (non-atomic read). */
|
|
64
|
-
isProcessed(eventId: string): Promise<boolean>;
|
|
65
|
-
/**
|
|
66
|
-
* Mark processed. Without `ownerToken` (0.1.x call) the write is unconditional.
|
|
67
|
-
* @throws {ReservationLostError} When `ownerToken` is given and no longer owns the event
|
|
68
|
-
*/
|
|
69
|
-
markProcessed(eventId: string, ownerToken?: string): Promise<void>;
|
|
70
|
-
}
|
|
71
51
|
/**
|
|
72
52
|
* Thrown by `markProcessed` when the caller no longer owns the reservation:
|
|
73
53
|
* its lease expired and another delivery retook the event, or the row is gone.
|
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Stripe client for billing functions
|
|
3
|
+
* @description Lazily initialized Stripe SDK instance shared by the Firebase,
|
|
4
|
+
* Vercel and Supabase billing handlers. Kept apart from `shared/utils.ts` so
|
|
5
|
+
* code that does not bill (CRUD, auth) never loads the Stripe SDK.
|
|
6
|
+
*
|
|
7
|
+
* @version 0.2.1
|
|
8
|
+
* @since 0.0.1
|
|
9
|
+
* @author AMBROISE PARK Consulting
|
|
10
|
+
*/
|
|
11
|
+
import Stripe from 'stripe';
|
|
12
|
+
/**
|
|
13
|
+
* Initialize Stripe explicitly (e.g. with a secret from defineSecret).
|
|
14
|
+
* API version: `STRIPE_API_VERSION`, else {@link STRIPE_API_VERSION_PIN}.
|
|
15
|
+
* @param apiKey - Stripe secret key
|
|
16
|
+
*
|
|
17
|
+
* @version 0.2.0
|
|
18
|
+
* @since 0.0.1
|
|
19
|
+
* @author AMBROISE PARK Consulting
|
|
20
|
+
*/
|
|
21
|
+
export declare function initStripe(apiKey: string): Stripe;
|
|
22
|
+
/**
|
|
23
|
+
* Get Stripe instance with lazy initialization
|
|
24
|
+
*
|
|
25
|
+
* @version 0.1.0
|
|
26
|
+
* @since 0.0.1
|
|
27
|
+
* @author AMBROISE PARK Consulting
|
|
28
|
+
*/
|
|
29
|
+
export declare function getStripe(): Stripe;
|
|
30
|
+
/**
|
|
31
|
+
* Lazy-initialized Stripe instance proxy
|
|
32
|
+
*
|
|
33
|
+
* @version 0.1.0
|
|
34
|
+
* @since 0.0.1
|
|
35
|
+
* @author AMBROISE PARK Consulting
|
|
36
|
+
*/
|
|
37
|
+
export declare const stripe: Stripe;
|
|
38
|
+
/**
|
|
39
|
+
* Validates that required Stripe environment variables are set
|
|
40
|
+
*
|
|
41
|
+
* @version 0.1.0
|
|
42
|
+
* @since 0.0.1
|
|
43
|
+
* @author AMBROISE PARK Consulting
|
|
44
|
+
*/
|
|
45
|
+
export declare function validateStripeEnvironment(): void;
|
|
@@ -31,15 +31,16 @@ import type { IdempotencyStore } from './idempotencyContract.js';
|
|
|
31
31
|
* @param billingConfig - Billing configuration
|
|
32
32
|
* @param updateSubscription - Function to update user subscription
|
|
33
33
|
* @param authProvider - Auth provider for subscription claims (null: subscription events fail)
|
|
34
|
-
* @param idempotencyStore - Durable store matching the backend
|
|
35
|
-
*
|
|
34
|
+
* @param idempotencyStore - Durable store matching the backend
|
|
35
|
+
* (`createFirestoreIdempotencyStore` / `createSupabaseIdempotencyStore`). Required:
|
|
36
|
+
* shared logic never picks a backend.
|
|
36
37
|
* @throws Any failure: the caller must answer non-2xx so Stripe retries
|
|
37
38
|
*
|
|
38
|
-
* @version 0.2.
|
|
39
|
+
* @version 0.2.1
|
|
39
40
|
* @since 0.0.1
|
|
40
41
|
* @author AMBROISE PARK Consulting
|
|
41
42
|
*/
|
|
42
|
-
export declare function processWebhook(rawBody: string | Buffer, signature: string, webhookSecret: string, stripe: Stripe, billingConfig: StripeBackConfig, updateSubscription: UpdateSubscriptionFn, authProvider: BillingAuthProvider | null, idempotencyStore
|
|
43
|
+
export declare function processWebhook(rawBody: string | Buffer, signature: string, webhookSecret: string, stripe: Stripe, billingConfig: StripeBackConfig, updateSubscription: UpdateSubscriptionFn, authProvider: BillingAuthProvider | null, idempotencyStore: IdempotencyStore): Promise<{
|
|
43
44
|
success: boolean;
|
|
44
45
|
message: string;
|
|
45
46
|
}>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/shared/firebase.d.ts
CHANGED
|
File without changes
|
package/lib/shared/github.d.ts
CHANGED
|
File without changes
|
package/lib/shared/index.d.ts
CHANGED
|
File without changes
|
package/lib/shared/index.js
CHANGED
|
@@ -18,5 +18,5 @@ if (typeof globalThis !== 'undefined') {
|
|
|
18
18
|
globalThis.global = globalThis;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
import{A as E,B as F,C as G,D as
|
|
21
|
+
import{A as E,B as F,C as G,D as N,E as O,F as P,G as $,H as aa,I as ba,J as Aa,K as Ba,L as Ca,M as Da,N as Ea,O as Fa,P as Ga,a as c,b as d,c as g,d as h,e as i,f as j,g as k,h as l,i as m,j as n,k as o,l as p,m as q,n as r,o as s,p as t,q as u,r as v,s as w,t as x,u as y,v as z,w as A,x as B,y as C,z as D}from"../chunks/chunk-LSM5Y2E5.js";import{a as H,b as I,c as J,d as K,e as L,f as M,g as ua,h as xa}from"../chunks/chunk-OZX5ZG44.js";import{a as e,b as f,c as ca,d as ya,e as za}from"../chunks/chunk-M4JV2JCF.js";import{a as b,b as da,c as ea,d as fa,e as ga,f as ha,i as ia,j as ja,k as ka,l as la,m as ma,n as na,o as oa,p as pa,q as qa,r as ra,s as sa,u as ta,v as va,w as wa}from"../chunks/chunk-UYI56E6Q.js";import"../chunks/chunk-2IFFIUFV.js";import{L as a}from"../chunks/chunk-G4FO76EA.js";import{a as Q,b as R,c as S,d as T,e as U}from"../chunks/chunk-2A4FPYNB.js";import{a as V,b as W,c as X,d as Y,e as Z,f as _}from"../chunks/chunk-PJCJ5H2O.js";import"../chunks/chunk-PWAGW4R6.js";import"../chunks/chunk-AYY7UXNI.js";export{H as AuthBackendSchema,_ as DEFAULT_RATE_LIMITS,a as DoNotDevError,c as GitHubApiService,ia as MIN_ORDER_API_VERSION,ja as ORDER_ID_METADATA_KEY,ka as PRODUCT_ID_METADATA_KEY,ra as RESERVATION_LEASE_MS,qa as ReservationLostError,j as StripeValidationSchemas,va as WEBHOOK_EVENTS_SQL,sa as WEBHOOK_EVENT_RETENTION_MS,K as assertAdmin,J as assertAuthenticated,da as calculateCost,C as calculateSubscriptionEndDate,F as cancelUserSubscription,O as checkIdempotency,R as checkPaymentFailureRate,S as checkPaymentVolume,V as checkRateLimit,W as checkRateLimitWithFirestore,ga as classifyAIError,U as cleanupOldMetrics,oa as createCheckoutAlgorithm,x as createFirebaseCallable,v as createFirebaseFunction,y as createFirebaseFunctionExports,ua as createFirestoreIdempotencyStore,d as createGitHubApiService,xa as createInMemoryIdempotencyStore,e as createMetadata,za as createResendProvider,wa as createSupabaseIdempotencyStore,Ca as createTimestamp,A as createVercelApiHandler,w as createVercelFunction,z as createVercelHandler,Aa as exchangeTokenAlgorithm,ca as executeBulk,i as filterVisibleFields,D as findReferences,T as getPaymentMetricsSummary,Z as getRateLimitStatus,E as getTierFromPriceId,G as getUserSubscription,h as getVisibleFields,Ba as grantAccessAlgorithm,ea as handleAIRequest,ya as handleEmailRequest,b as handleError,na as handleOrderSessionEvent,N as initializeFirebaseAdmin,g as isFieldVisible,Ea as isTimestamp,ma as listPaidLineItems,ha as mapClassifiedToHTTP,I as parseAuthBackend,Ga as prepareForFirestore,ta as processWebhook,Q as recordPaymentMetrics,X as resetRateLimit,Y as resetRateLimitInFirestore,fa as resolveModelForTier,$ as safeJsonParse,P as storeIdempotencyResult,la as toCheckoutSessionSnapshot,B as toISOString,Da as toTimestamp,Fa as transformFirestoreData,f as updateMetadata,pa as updateUserSubscription,aa as validateCollectionName,ba as validateDocument,n as validateEmail,m as validateGitHubUsername,r as validateMetadata,l as validatePurchaseRequest,s as validateRequestData,o as validateStripePriceId,p as validateStripeSessionId,q as validateUrl,k as validateWebhookEvent,M as verifyAuthToken,L as verifyToken,t as withSchemaValidation,u as withVercelSchemaValidation};
|
|
22
22
|
//# sourceMappingURL=index.js.map
|
package/lib/shared/index.js.map
CHANGED
|
File without changes
|
package/lib/shared/logger.d.ts
CHANGED
|
File without changes
|
package/lib/shared/metadata.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/shared/schema.d.ts
CHANGED
|
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
|
|
@@ -45,7 +45,7 @@ export declare function parseAuthBackend(backend: unknown): AuthProvider;
|
|
|
45
45
|
* @since 0.0.1
|
|
46
46
|
* @author AMBROISE PARK Consulting
|
|
47
47
|
*/
|
|
48
|
-
export declare function assertAuthenticated(uid: string): string;
|
|
48
|
+
export declare function assertAuthenticated(uid: string | undefined): string;
|
|
49
49
|
/**
|
|
50
50
|
* Validates that user has admin privileges.
|
|
51
51
|
* Uses IServerAuthAdapter when configured, falls back to Firebase Admin SDK.
|
|
@@ -88,7 +88,3 @@ export declare function verifyToken(token: string, provider?: AuthProvider): Pro
|
|
|
88
88
|
* @author AMBROISE PARK Consulting
|
|
89
89
|
*/
|
|
90
90
|
export declare function verifyAuthToken(req: NextApiRequest, provider?: AuthProvider): Promise<string>;
|
|
91
|
-
/**
|
|
92
|
-
* @deprecated Use verifyAuthToken instead. Kept for backwards compatibility.
|
|
93
|
-
*/
|
|
94
|
-
export declare const verifyFirebaseAuthToken: typeof verifyAuthToken;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/shared/utils.d.ts
CHANGED
|
@@ -1,56 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Shared utilities for Firebase and Vercel functions
|
|
3
|
-
* @description Common utilities that can be used by both Firebase and Vercel function implementations
|
|
4
|
-
*
|
|
5
|
-
* @version 0.1.0
|
|
6
|
-
* @since 0.0.1
|
|
7
|
-
* @author AMBROISE PARK Consulting
|
|
8
|
-
*/
|
|
9
|
-
import Stripe from 'stripe';
|
|
10
1
|
import { DoNotDevError } from '@donotdev/core/server';
|
|
11
2
|
import type { UserRole } from '@donotdev/core/server';
|
|
12
3
|
export { DoNotDevError };
|
|
13
|
-
/**
|
|
14
|
-
* Initialize Stripe explicitly (e.g. with a secret from defineSecret).
|
|
15
|
-
* API version: `STRIPE_API_VERSION`, else {@link STRIPE_API_VERSION_PIN}.
|
|
16
|
-
* @param apiKey - Stripe secret key
|
|
17
|
-
*
|
|
18
|
-
* @version 0.2.0
|
|
19
|
-
* @since 0.0.1
|
|
20
|
-
* @author AMBROISE PARK Consulting
|
|
21
|
-
*/
|
|
22
|
-
export declare function initStripe(apiKey: string): Stripe;
|
|
23
|
-
/**
|
|
24
|
-
* Get Stripe instance with lazy initialization
|
|
25
|
-
*
|
|
26
|
-
* @version 0.1.0
|
|
27
|
-
* @since 0.0.1
|
|
28
|
-
* @author AMBROISE PARK Consulting
|
|
29
|
-
*/
|
|
30
|
-
export declare function getStripe(): Stripe;
|
|
31
|
-
/**
|
|
32
|
-
* Lazy-initialized Stripe instance proxy
|
|
33
|
-
*
|
|
34
|
-
* @version 0.1.0
|
|
35
|
-
* @since 0.0.1
|
|
36
|
-
* @author AMBROISE PARK Consulting
|
|
37
|
-
*/
|
|
38
|
-
export declare const stripe: Stripe;
|
|
39
|
-
/**
|
|
40
|
-
* Assert that a user is authenticated from a Firebase callable auth context.
|
|
41
|
-
*
|
|
42
|
-
* @deprecated Import `assertAuthenticated` from `@donotdev/functions/shared/utils/internal/auth` instead.
|
|
43
|
-
* This wrapper extracts uid from a Firebase callable auth context and delegates
|
|
44
|
-
* to the canonical version.
|
|
45
|
-
*
|
|
46
|
-
* @param auth - Firebase callable request auth context (object with `.uid`)
|
|
47
|
-
* @returns The authenticated user's uid
|
|
48
|
-
*
|
|
49
|
-
* @version 0.1.0
|
|
50
|
-
* @since 0.0.1
|
|
51
|
-
* @author AMBROISE PARK Consulting
|
|
52
|
-
*/
|
|
53
|
-
export declare function assertAuthenticated(auth: any): string;
|
|
54
4
|
/**
|
|
55
5
|
* Get user role from Firebase auth context
|
|
56
6
|
*
|
|
@@ -68,14 +18,6 @@ export declare function assertAuthenticated(auth: any): string;
|
|
|
68
18
|
* @author AMBROISE PARK Consulting
|
|
69
19
|
*/
|
|
70
20
|
export declare function getUserRole(auth: any): UserRole;
|
|
71
|
-
/**
|
|
72
|
-
* Validates that required Stripe environment variables are set
|
|
73
|
-
*
|
|
74
|
-
* @version 0.1.0
|
|
75
|
-
* @since 0.0.1
|
|
76
|
-
* @author AMBROISE PARK Consulting
|
|
77
|
-
*/
|
|
78
|
-
export declare function validateStripeEnvironment(): void;
|
|
79
21
|
/**
|
|
80
22
|
* Creates a standardized success response
|
|
81
23
|
*
|
|
@@ -102,74 +44,6 @@ export declare function createErrorResponse(error: unknown): {
|
|
|
102
44
|
details?: any;
|
|
103
45
|
};
|
|
104
46
|
};
|
|
105
|
-
/**
|
|
106
|
-
* Updates user subscription in Firebase.
|
|
107
|
-
*
|
|
108
|
-
* **Architecture decision — throwing stubs for billing functions:**
|
|
109
|
-
* These subscription functions (`updateUserSubscription`, `getUserSubscription`,
|
|
110
|
-
* `cancelUserSubscription`, `handleSubscriptionCancellation`) are intentional
|
|
111
|
-
* placeholder implementations. They exist so the framework compiles and
|
|
112
|
-
* type-checks out of the box, but throw at runtime to surface missing
|
|
113
|
-
* integration early. Consumer apps replace them with their billing provider
|
|
114
|
-
* integration (Stripe, Paddle, LemonSqueezy, etc.) via the documented
|
|
115
|
-
* `shared/billing/helpers/` modules.
|
|
116
|
-
*
|
|
117
|
-
* C10: This was a silent no-op stub. It now throws to surface the missing
|
|
118
|
-
* implementation at startup rather than silently dropping webhook events.
|
|
119
|
-
* Use `updateUserSubscription` from `shared/billing/helpers/updateUserSubscription.ts`
|
|
120
|
-
* (which requires an authProvider) instead.
|
|
121
|
-
*
|
|
122
|
-
* @deprecated Import `updateUserSubscription` from `@donotdev/functions/shared/billing/helpers/updateUserSubscription`.
|
|
123
|
-
* @version 0.1.0
|
|
124
|
-
* @since 0.0.1
|
|
125
|
-
* @author AMBROISE PARK Consulting
|
|
126
|
-
*/
|
|
127
|
-
export declare function updateUserSubscription(_firebaseUid: string, _subscription: any): Promise<void>;
|
|
128
|
-
/**
|
|
129
|
-
* Gets user subscription from Firebase.
|
|
130
|
-
*
|
|
131
|
-
* C10: This was a silent no-op stub. Now throws to surface the missing implementation.
|
|
132
|
-
*
|
|
133
|
-
* @deprecated Import from `@donotdev/functions/shared/billing/helpers` or implement directly using Firebase Admin SDK / Stripe API.
|
|
134
|
-
* @version 0.1.0
|
|
135
|
-
* @since 0.0.1
|
|
136
|
-
* @author AMBROISE PARK Consulting
|
|
137
|
-
*/
|
|
138
|
-
export declare function getUserSubscription(_firebaseUid: string): Promise<any>;
|
|
139
|
-
/**
|
|
140
|
-
* Cancels user subscription.
|
|
141
|
-
*
|
|
142
|
-
* C10: This was a silent no-op stub. Now throws to surface the missing implementation.
|
|
143
|
-
*
|
|
144
|
-
* @deprecated Import `cancelUserSubscription` from `@donotdev/functions/shared/billing/helpers/subscriptionManagement`.
|
|
145
|
-
* @version 0.1.0
|
|
146
|
-
* @since 0.0.1
|
|
147
|
-
* @author AMBROISE PARK Consulting
|
|
148
|
-
*/
|
|
149
|
-
export declare function cancelUserSubscription(_firebaseUid: string, _subscription: any): Promise<void>;
|
|
150
|
-
/**
|
|
151
|
-
* Handles subscription cancellation.
|
|
152
|
-
*
|
|
153
|
-
* C10: This was a silent no-op stub. Now throws to surface the missing implementation.
|
|
154
|
-
*
|
|
155
|
-
* @deprecated Handle via Stripe webhook events. Use `processWebhook` from `@donotdev/functions/shared/billing/webhookHandler`.
|
|
156
|
-
* @version 0.1.0
|
|
157
|
-
* @since 0.0.1
|
|
158
|
-
* @author AMBROISE PARK Consulting
|
|
159
|
-
*/
|
|
160
|
-
export declare function handleSubscriptionCancellation(_firebaseUid: string, _subscription: any): Promise<void>;
|
|
161
|
-
/**
|
|
162
|
-
* Asserts that a user has admin privileges
|
|
163
|
-
* Uses role hierarchy: super > admin > user > guest
|
|
164
|
-
*
|
|
165
|
-
* @deprecated Import `assertAdmin` from `@donotdev/functions/shared/utils/internal/auth` instead.
|
|
166
|
-
* This is a thin wrapper that delegates to the canonical provider-agnostic version.
|
|
167
|
-
*
|
|
168
|
-
* @version 0.1.0
|
|
169
|
-
* @since 0.0.1
|
|
170
|
-
* @author AMBROISE PARK Consulting
|
|
171
|
-
*/
|
|
172
|
-
export declare function assertAdmin(uid: string): Promise<string>;
|
|
173
47
|
/**
|
|
174
48
|
* Validates document data
|
|
175
49
|
*
|
|
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
|
|
File without changes
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Generic handler to list entities from Supabase with pagination, filtering, and sorting.
|
|
3
|
-
* @description Provides a reusable implementation for listing documents from PostgreSQL with advanced query capabilities.
|
|
4
|
-
*
|
|
5
|
-
* @version 0.1.0
|
|
6
|
-
* @since 0.5.0
|
|
7
|
-
* @author AMBROISE PARK Consulting
|
|
8
|
-
*/
|
|
9
1
|
import * as v from 'valibot';
|
|
10
2
|
import type { EntityOwnershipConfig, UserRole } from '@donotdev/core/server';
|
|
11
3
|
/** Request payload for listing entities with filtering, sorting, and pagination. */
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/supabase/index.d.ts
CHANGED
|
@@ -19,8 +19,9 @@ export { createRemoveCustomClaims } from './auth/removeCustomClaims.js';
|
|
|
19
19
|
export { createGetUserAuthStatus } from './auth/getUserAuthStatus.js';
|
|
20
20
|
export { createCheckoutSession } from './billing/createCheckoutSession.js';
|
|
21
21
|
export { createStripeWebhook } from './billing/stripeWebhook.js';
|
|
22
|
-
export { createSupabaseIdempotencyStore,
|
|
23
|
-
export
|
|
22
|
+
export { createSupabaseIdempotencyStore, WEBHOOK_EVENTS_SQL, } from '../shared/billing/supabaseIdempotency.js';
|
|
23
|
+
export { ReservationLostError } from '../shared/billing/idempotencyContract.js';
|
|
24
|
+
export type { IdempotencyStore, ReservationResult, } from '../shared/billing/idempotencyContract.js';
|
|
24
25
|
export { createCheckoutAlgorithm } from '../shared/billing/createCheckout.js';
|
|
25
26
|
export type { StripeSessionProvider } from '../shared/billing/createCheckout.js';
|
|
26
27
|
export { STRIPE_API_VERSION_PIN } from '../shared/billing/apiVersion.js';
|