@donotdev/functions 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chunks/{chunk-IFOYVSPU.js → chunk-3F4BWKQD.js} +2 -2
- package/lib/chunks/{chunk-JTAGPPPL.js → chunk-5IPULSUX.js} +2 -2
- package/lib/chunks/chunk-6USHTJED.js +22 -0
- package/lib/chunks/chunk-6USHTJED.js.map +7 -0
- package/lib/chunks/{chunk-RM7DV6IQ.js → chunk-CXBSROEW.js} +2 -2
- package/lib/chunks/{chunk-5DTPEM64.js → chunk-GYTCWMXV.js} +1 -1
- package/lib/chunks/{chunk-5DTPEM64.js.map → chunk-GYTCWMXV.js.map} +1 -1
- package/lib/chunks/chunk-LCDLG4VG.js +151 -0
- package/lib/chunks/{chunk-UH4L3EF3.js.map → chunk-LCDLG4VG.js.map} +4 -4
- package/lib/chunks/{chunk-4U7QQWYG.js → chunk-MQANUSY3.js} +2 -2
- package/lib/chunks/chunk-OFQVO3FD.js +22 -0
- package/lib/chunks/chunk-OFQVO3FD.js.map +7 -0
- package/lib/chunks/chunk-PWAGW4R6.js +22 -0
- package/lib/chunks/chunk-PWAGW4R6.js.map +7 -0
- package/lib/chunks/{chunk-QJAU2MWV.js → chunk-US2VOP4S.js} +2 -2
- package/lib/chunks/{chunk-QJAU2MWV.js.map → chunk-US2VOP4S.js.map} +3 -3
- package/lib/chunks/chunk-YTKDNZNW.js +22 -0
- package/lib/chunks/chunk-YTKDNZNW.js.map +7 -0
- package/lib/chunks/{monitoring-AGCSU3FI.js → monitoring-E7JBYBHQ.js} +2 -2
- package/lib/chunks/{rateLimiter-6KO7AIZP.js → rateLimiter-SQISLOP5.js} +2 -2
- package/lib/chunks/{server-32A5RH4C.js → server-IQ5JNJOM.js} +2 -2
- 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 +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/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 +0 -0
- package/lib/firebase/index.js +1 -1
- package/lib/firebase/index.js.map +2 -2
- 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 +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/createCheckout.d.ts +0 -0
- 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 +1 -12
- 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 +0 -0
- 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 -43
- 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/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/refreshSubscriptionStatus.ts +1 -1
- package/src/firebase/billing/webhookHandler.ts +2 -2
- 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 -1
- package/src/shared/billing/__tests__/webhookHandler.test.ts +1 -38
- package/src/shared/billing/firestoreIdempotency.ts +189 -0
- package/src/shared/billing/helpers/subscriptionManagement.ts +1 -1
- package/src/shared/billing/idempotency.ts +5 -172
- 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/validation.ts +0 -18
- package/src/shared/utils.ts +0 -77
- 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-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-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.map +0 -7
- 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-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.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-7LT32OWE.js.map → chunk-3F4BWKQD.js.map} +0 -0
- /package/lib/chunks/{chunk-4TVLH2W2.js.map → chunk-5IPULSUX.js.map} +0 -0
- /package/lib/chunks/{chunk-BUP7SXPV.js.map → chunk-CXBSROEW.js.map} +0 -0
- /package/lib/chunks/{chunk-4U7QQWYG.js.map → chunk-MQANUSY3.js.map} +0 -0
- /package/lib/chunks/{chunk-FSLGZD7A.js.map → monitoring-E7JBYBHQ.js.map} +0 -0
- /package/lib/chunks/{monitoring-AGCSU3FI.js.map → rateLimiter-SQISLOP5.js.map} +0 -0
- /package/lib/chunks/{monitoring-PVQMFL34.js.map → server-IQ5JNJOM.js.map} +0 -0
|
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
|
package/lib/shared/ai/index.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { LegacyIdempotencyStore } 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(): LegacyIdempotencyStore;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { LegacyIdempotencyStore } from './idempotencyContract.js';
|
|
2
2
|
export { RESERVATION_LEASE_MS, ReservationLostError, WEBHOOK_EVENT_RETENTION_MS, } from './idempotencyContract.js';
|
|
3
3
|
export type { IdempotencyStore, LegacyIdempotencyStore, 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
|
*
|
|
@@ -9,18 +10,6 @@ export type { IdempotencyStore, LegacyIdempotencyStore, ReservationResult, } fro
|
|
|
9
10
|
* @author AMBROISE PARK Consulting
|
|
10
11
|
*/
|
|
11
12
|
export declare function createInMemoryIdempotencyStore(): LegacyIdempotencyStore;
|
|
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
13
|
/**
|
|
25
14
|
* 0.1.x store auto-detection: Firestore when configured, else in-memory.
|
|
26
15
|
*
|
|
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 O,E as P,F as Q,G as aa,H as ba,I as ca,J as
|
|
21
|
+
import{A as E,B as F,C as G,D as O,E as P,F as Q,G as aa,H as ba,I as ca,J as Da,K as Ea,L as Fa,M as Ga,N as Ha,O as Ia,P as Ja,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-US2VOP4S.js";import{c as va,d as ya,e as za,f as Aa}from"../chunks/chunk-YTKDNZNW.js";import{a as e,b as f,c as da,d as Ba,e as Ca}from"../chunks/chunk-MQANUSY3.js";import{B as ua,C as wa,D as xa,a as b,b as H,c as I,d as J,e as K,f as L,g as M,h as N,i as ea,j as fa,k as ga,l as ha,m as ia,p as ja,q as ka,r as la,s as ma,t as na,u as oa,v as pa,w as qa,x as ra,y as sa,z as ta}from"../chunks/chunk-LCDLG4VG.js";import"../chunks/chunk-CXBSROEW.js";import{L as a}from"../chunks/chunk-GYTCWMXV.js";import{a as R,b as S,c as T,d as U,e as V}from"../chunks/chunk-5IPULSUX.js";import{a as W,b as X,c as Y,d as Z,e as _,f as $}from"../chunks/chunk-3F4BWKQD.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,ja as MIN_ORDER_API_VERSION,ka as ORDER_ID_METADATA_KEY,la as PRODUCT_ID_METADATA_KEY,sa as RESERVATION_LEASE_MS,ra as ReservationLostError,j as StripeValidationSchemas,wa as WEBHOOK_EVENTS_SQL,ta as WEBHOOK_EVENT_RETENTION_MS,K as assertAdmin,J as assertAuthenticated,ea as calculateCost,C as calculateSubscriptionEndDate,F as cancelUserSubscription,P as checkIdempotency,S as checkPaymentFailureRate,T as checkPaymentVolume,W as checkRateLimit,X as checkRateLimitWithFirestore,ha as classifyAIError,V as cleanupOldMetrics,pa as createCheckoutAlgorithm,x as createFirebaseCallable,v as createFirebaseFunction,y as createFirebaseFunctionExports,va as createFirestoreIdempotencyStore,d as createGitHubApiService,za as createIdempotencyStore,ya as createInMemoryIdempotencyStore,e as createMetadata,Ca as createResendProvider,xa as createSupabaseIdempotencyStore,Fa as createTimestamp,A as createVercelApiHandler,w as createVercelFunction,z as createVercelHandler,Da as exchangeTokenAlgorithm,da as executeBulk,i as filterVisibleFields,D as findReferences,U as getPaymentMetricsSummary,_ as getRateLimitStatus,E as getTierFromPriceId,G as getUserSubscription,h as getVisibleFields,Ea as grantAccessAlgorithm,fa as handleAIRequest,Ba as handleEmailRequest,b as handleError,oa as handleOrderSessionEvent,O as initializeFirebaseAdmin,g as isFieldVisible,Ha as isTimestamp,na as listPaidLineItems,ia as mapClassifiedToHTTP,I as parseAuthBackend,Ja as prepareForFirestore,ua as processWebhook,R as recordPaymentMetrics,Aa as resetIdempotencyStore,Y as resetRateLimit,Z as resetRateLimitInFirestore,ga as resolveModelForTier,aa as safeJsonParse,Q as storeIdempotencyResult,ma as toCheckoutSessionSnapshot,B as toISOString,Ga as toTimestamp,Ia as transformFirestoreData,f as updateMetadata,qa as updateUserSubscription,ba as validateCollectionName,ca 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,N as verifyFirebaseAuthToken,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
|
|
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
|
package/lib/shared/utils.d.ts
CHANGED
|
@@ -1,41 +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
4
|
/**
|
|
40
5
|
* Assert that a user is authenticated from a Firebase callable auth context.
|
|
41
6
|
*
|
|
@@ -68,14 +33,6 @@ export declare function assertAuthenticated(auth: any): string;
|
|
|
68
33
|
* @author AMBROISE PARK Consulting
|
|
69
34
|
*/
|
|
70
35
|
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
36
|
/**
|
|
80
37
|
* Creates a standardized success response
|
|
81
38
|
*
|
|
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';
|