@donotdev/functions 0.0.19 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +3 -3
- package/lib/firebase/auth/getCustomClaims.d.ts +25 -0
- package/lib/firebase/auth/getUserAuthStatus.d.ts +29 -0
- package/lib/firebase/auth/index.d.ts +12 -0
- package/lib/firebase/auth/removeCustomClaims.d.ts +28 -0
- package/lib/firebase/auth/setCustomClaims.d.ts +34 -0
- package/lib/firebase/baseFunction.d.ts +26 -0
- package/lib/firebase/billing/cancelSubscription.d.ts +10 -0
- package/lib/firebase/billing/changePlan.d.ts +13 -0
- package/lib/firebase/billing/createCheckoutSession.d.ts +21 -0
- package/lib/firebase/billing/createCustomerPortal.d.ts +19 -0
- package/lib/firebase/billing/healthCheck.d.ts +5 -0
- package/lib/firebase/billing/index.d.ts +18 -0
- package/lib/firebase/billing/refreshSubscriptionStatus.d.ts +19 -0
- package/lib/firebase/billing/webhookHandler.d.ts +6 -0
- package/lib/firebase/config/constants.d.ts +89 -0
- package/lib/firebase/config/index.d.ts +9 -0
- package/lib/firebase/config/secrets.d.ts +15 -0
- package/lib/firebase/crud/aggregate.d.ts +98 -0
- package/lib/firebase/crud/create.d.ts +16 -0
- package/lib/firebase/crud/delete.d.ts +20 -0
- package/lib/firebase/crud/get.d.ts +24 -0
- package/lib/firebase/crud/index.d.ts +14 -0
- package/lib/firebase/crud/list.d.ts +25 -0
- package/lib/firebase/crud/update.d.ts +25 -0
- package/lib/firebase/helpers/githubAccessHelper.d.ts +30 -0
- package/lib/firebase/helpers/githubTeamAccessHelper.d.ts +36 -0
- package/lib/firebase/helpers/index.d.ts +10 -0
- package/lib/firebase/index.d.ts +17 -0
- package/lib/firebase/index.js +25 -9110
- package/lib/firebase/index.js.map +4 -4
- package/lib/firebase/oauth/disconnect.d.ts +12 -0
- package/lib/firebase/oauth/exchangeToken.d.ts +9 -0
- package/lib/firebase/oauth/getConnections.d.ts +11 -0
- package/lib/firebase/oauth/githubAccess.d.ts +83 -0
- package/lib/firebase/oauth/index.d.ts +13 -0
- package/lib/firebase/oauth/refreshToken.d.ts +9 -0
- package/lib/firebase/registerCrudFunctions.d.ts +32 -0
- package/lib/firebase/scheduled/checkExpiredSubscriptions.d.ts +14 -0
- package/lib/firebase/scheduled/index.d.ts +9 -0
- package/lib/shared/billing/createCheckout.d.ts +50 -0
- package/lib/shared/billing/helpers/index.d.ts +10 -0
- package/lib/shared/billing/helpers/subscriptionManagement.d.ts +34 -0
- package/lib/shared/billing/helpers/updateUserSubscription.d.ts +45 -0
- package/lib/shared/billing/idempotency.d.ts +22 -0
- package/lib/shared/billing/index.d.ts +11 -0
- package/lib/shared/billing/webhookHandler.d.ts +37 -0
- package/lib/shared/errorHandling.d.ts +14 -0
- package/lib/shared/firebase.d.ts +73 -0
- package/lib/shared/github.d.ts +128 -0
- package/lib/shared/index.d.ts +16 -0
- package/lib/shared/index.js +25 -6927
- package/lib/shared/index.js.map +4 -4
- package/lib/shared/logger.d.ts +133 -0
- package/lib/shared/metadata.d.ts +36 -0
- package/lib/shared/oauth/exchangeToken.d.ts +24 -0
- package/lib/shared/oauth/grantAccess.d.ts +30 -0
- package/lib/shared/oauth/index.d.ts +10 -0
- package/lib/shared/schema.d.ts +56 -0
- package/lib/shared/utils/detectFirestore.d.ts +31 -0
- package/lib/shared/utils/external/date.d.ts +36 -0
- package/lib/shared/utils/external/index.d.ts +11 -0
- package/lib/shared/utils/external/references.d.ts +12 -0
- package/lib/shared/utils/external/subscription.d.ts +41 -0
- package/lib/shared/utils/firebaseHelpers.d.ts +23 -0
- package/lib/shared/utils/functionWrapper.d.ts +36 -0
- package/lib/shared/utils/index.d.ts +14 -0
- package/lib/shared/utils/internal/auth.d.ts +57 -0
- package/lib/shared/utils/internal/firebase.d.ts +5 -0
- package/lib/shared/utils/internal/idempotency.d.ts +21 -0
- package/lib/shared/utils/internal/index.d.ts +14 -0
- package/lib/shared/utils/internal/monitoring.d.ts +80 -0
- package/lib/shared/utils/internal/rateLimiter.d.ts +82 -0
- package/lib/shared/utils/internal/validation.d.ts +43 -0
- package/lib/shared/utils/schemaValidation.d.ts +60 -0
- package/lib/shared/utils/validation.d.ts +98 -0
- package/lib/shared/utils/vercelHelpers.d.ts +18 -0
- package/lib/shared/utils.d.ts +234 -0
- package/lib/shared/validation.d.ts +16 -0
- package/lib/supabase/auth/deleteAccount.d.ts +16 -0
- package/lib/supabase/auth/getCustomClaims.d.ts +16 -0
- package/lib/supabase/auth/getUserAuthStatus.d.ts +18 -0
- package/lib/supabase/auth/removeCustomClaims.d.ts +16 -0
- package/lib/supabase/auth/setCustomClaims.d.ts +18 -0
- package/lib/supabase/baseFunction.d.ts +43 -0
- package/lib/supabase/billing/cancelSubscription.d.ts +9 -0
- package/lib/supabase/billing/changePlan.d.ts +11 -0
- package/lib/supabase/billing/createCheckoutSession.d.ts +11 -0
- package/lib/supabase/billing/createCustomerPortal.d.ts +9 -0
- package/lib/supabase/billing/refreshSubscriptionStatus.d.ts +9 -0
- package/lib/supabase/crud/aggregate.d.ts +27 -0
- package/lib/supabase/crud/create.d.ts +23 -0
- package/lib/supabase/crud/delete.d.ts +30 -0
- package/lib/supabase/crud/get.d.ts +23 -0
- package/lib/supabase/crud/index.d.ts +20 -0
- package/lib/supabase/crud/list.d.ts +33 -0
- package/lib/supabase/crud/update.d.ts +24 -0
- package/lib/supabase/helpers/authProvider.d.ts +22 -0
- package/lib/supabase/index.d.ts +30 -0
- package/lib/supabase/index.js +23 -0
- package/lib/supabase/index.js.map +7 -0
- package/lib/supabase/oauth/disconnect.d.ts +13 -0
- package/lib/supabase/oauth/exchangeToken.d.ts +13 -0
- package/lib/supabase/oauth/getConnections.d.ts +13 -0
- package/lib/supabase/oauth/index.d.ts +12 -0
- package/lib/supabase/oauth/refreshToken.d.ts +13 -0
- package/lib/supabase/registerCrudFunctions.d.ts +24 -0
- package/lib/supabase/utils/idempotency.d.ts +36 -0
- package/lib/supabase/utils/monitoring.d.ts +59 -0
- package/lib/supabase/utils/rateLimiter.d.ts +56 -0
- package/lib/vercel/api/auth/get-custom-claims.d.ts +2 -0
- package/lib/vercel/api/auth/get-user-auth-status.d.ts +2 -0
- package/lib/vercel/api/auth/index.d.ts +12 -0
- package/lib/vercel/api/auth/remove-custom-claims.d.ts +2 -0
- package/lib/vercel/api/auth/set-custom-claims.d.ts +10 -0
- package/lib/vercel/api/billing/cancel.d.ts +10 -0
- package/lib/vercel/api/billing/change-plan.d.ts +11 -0
- package/lib/vercel/api/billing/create-checkout-session.d.ts +13 -0
- package/lib/vercel/api/billing/customer-portal.d.ts +3 -0
- package/lib/vercel/api/billing/index.d.ts +14 -0
- package/lib/vercel/api/billing/refresh-subscription-status.d.ts +31 -0
- package/lib/vercel/api/billing/webhook-handler.d.ts +22 -0
- package/lib/vercel/api/config/constants.d.ts +103 -0
- package/lib/vercel/api/config/firebase-admin.d.ts +19 -0
- package/lib/vercel/api/config/index.d.ts +10 -0
- package/lib/vercel/api/crud/create.d.ts +2 -0
- package/lib/vercel/api/crud/delete.d.ts +2 -0
- package/lib/vercel/api/crud/get.d.ts +2 -0
- package/lib/vercel/api/crud/index.d.ts +13 -0
- package/lib/vercel/api/crud/list.d.ts +2 -0
- package/lib/vercel/api/crud/update.d.ts +2 -0
- package/lib/vercel/api/index.d.ts +13 -0
- package/lib/vercel/api/index.js +22 -4790
- package/lib/vercel/api/index.js.map +4 -4
- package/lib/vercel/api/oauth/check-github-access.d.ts +12 -0
- package/lib/vercel/api/oauth/exchange-token.d.ts +8 -0
- package/lib/vercel/api/oauth/grant-github-access.d.ts +12 -0
- package/lib/vercel/api/oauth/index.d.ts +12 -0
- package/lib/vercel/api/oauth/revoke-github-access.d.ts +11 -0
- package/lib/vercel/api/utils/cors.d.ts +49 -0
- package/lib/vercel/baseFunction.d.ts +25 -0
- package/package.json +4 -4
- package/src/firebase/auth/getCustomClaims.ts +3 -3
- package/src/firebase/auth/getUserAuthStatus.ts +3 -3
- package/src/firebase/auth/index.ts +1 -1
- package/src/firebase/auth/removeCustomClaims.ts +3 -3
- package/src/firebase/auth/setCustomClaims.ts +130 -84
- package/src/firebase/baseFunction.ts +2 -2
- package/src/firebase/billing/cancelSubscription.ts +3 -3
- package/src/firebase/billing/changePlan.ts +3 -3
- package/src/firebase/billing/createCheckoutSession.ts +1 -1
- package/src/firebase/billing/createCustomerPortal.ts +1 -1
- package/src/firebase/billing/healthCheck.ts +8 -24
- package/src/firebase/billing/index.d.ts +11 -11
- package/src/firebase/billing/index.ts +1 -1
- package/src/firebase/billing/refreshSubscriptionStatus.ts +3 -3
- package/src/firebase/billing/webhookHandler.ts +1 -2
- package/src/firebase/config/constants.ts +4 -4
- package/src/firebase/config/index.ts +1 -1
- package/src/firebase/config/secrets.ts +1 -1
- package/src/firebase/crud/aggregate.ts +2 -2
- package/src/firebase/crud/create.ts +19 -4
- package/src/firebase/crud/delete.ts +3 -3
- package/src/firebase/crud/get.ts +1 -1
- package/src/firebase/crud/index.ts +1 -1
- package/src/firebase/crud/list.ts +1 -1
- package/src/firebase/crud/update.ts +2 -2
- package/src/firebase/helpers/githubAccessHelper.ts +4 -4
- package/src/firebase/helpers/githubTeamAccessHelper.ts +3 -3
- package/src/firebase/helpers/index.ts +1 -1
- package/src/firebase/index.d.ts +9 -9
- package/src/firebase/index.ts +1 -1
- package/src/firebase/oauth/disconnect.ts +2 -2
- package/src/firebase/oauth/exchangeToken.ts +7 -7
- package/src/firebase/oauth/getConnections.ts +2 -2
- package/src/firebase/oauth/githubAccess.ts +10 -10
- package/src/firebase/oauth/index.ts +1 -1
- package/src/firebase/oauth/refreshToken.ts +2 -2
- package/src/firebase/registerCrudFunctions.ts +1 -1
- package/src/firebase/scheduled/checkExpiredSubscriptions.ts +1 -1
- package/src/firebase/scheduled/index.ts +1 -1
- package/src/shared/__tests__/auth.test.ts +46 -0
- package/src/shared/__tests__/errorHandling.test.ts +66 -1
- package/src/shared/__tests__/firebase.test.ts +293 -0
- package/src/shared/__tests__/internalValidation.test.ts +190 -0
- package/src/shared/__tests__/metadata.test.ts +66 -0
- package/src/shared/__tests__/schema.test.ts +219 -0
- package/src/shared/__tests__/schemaValidation.test.ts +72 -0
- package/src/shared/__tests__/subscription.test.ts +45 -0
- package/src/shared/__tests__/utils.test.ts +281 -0
- package/src/shared/__tests__/validation-env.test.ts +73 -0
- package/src/shared/billing/__tests__/createCheckout.test.ts +1 -1
- package/src/shared/billing/__tests__/webhookHandler.test.ts +1 -1
- package/src/shared/billing/createCheckout.ts +10 -5
- package/src/shared/billing/helpers/index.ts +1 -1
- package/src/shared/billing/helpers/subscriptionManagement.ts +4 -4
- package/src/shared/billing/helpers/updateUserSubscription.ts +4 -4
- package/src/shared/billing/idempotency.ts +4 -4
- package/src/shared/billing/index.ts +1 -1
- package/src/shared/billing/webhookHandler.ts +7 -7
- package/src/shared/errorHandling.ts +2 -2
- package/src/shared/firebase.ts +7 -7
- package/src/shared/github.ts +11 -11
- package/src/shared/index.d.ts +9 -9
- package/src/shared/index.ts +1 -1
- package/src/shared/logger.ts +8 -8
- package/src/shared/metadata.ts +3 -3
- package/src/shared/oauth/__tests__/exchangeToken.test.ts +1 -1
- package/src/shared/oauth/exchangeToken.ts +2 -2
- package/src/shared/oauth/grantAccess.ts +2 -2
- package/src/shared/oauth/index.ts +1 -1
- package/src/shared/schema.ts +4 -4
- package/src/shared/utils/__tests__/functionWrapper.test.ts +1 -1
- package/src/shared/utils/detectFirestore.ts +3 -3
- package/src/shared/utils/external/date.ts +5 -5
- package/src/shared/utils/external/index.ts +1 -1
- package/src/shared/utils/external/references.ts +2 -2
- package/src/shared/utils/external/subscription.ts +5 -5
- package/src/shared/utils/firebaseHelpers.ts +3 -3
- package/src/shared/utils/functionWrapper.ts +4 -4
- package/src/shared/utils/index.ts +1 -1
- package/src/shared/utils/internal/auth.ts +7 -7
- package/src/shared/utils/internal/firebase.ts +1 -1
- package/src/shared/utils/internal/idempotency.ts +3 -3
- package/src/shared/utils/internal/index.ts +1 -1
- package/src/shared/utils/internal/monitoring.ts +8 -8
- package/src/shared/utils/internal/rateLimiter.ts +6 -6
- package/src/shared/utils/internal/validation.ts +6 -6
- package/src/shared/utils/schemaValidation.ts +6 -6
- package/src/shared/utils/validation.ts +10 -10
- package/src/shared/utils/vercelHelpers.ts +3 -3
- package/src/shared/utils.ts +19 -19
- package/src/shared/validation.ts +2 -2
- package/src/supabase/auth/deleteAccount.ts +2 -2
- package/src/supabase/auth/getCustomClaims.ts +2 -2
- package/src/supabase/auth/getUserAuthStatus.ts +2 -2
- package/src/supabase/auth/removeCustomClaims.ts +2 -2
- package/src/supabase/auth/setCustomClaims.ts +2 -2
- package/src/supabase/baseFunction.ts +3 -3
- package/src/supabase/billing/cancelSubscription.ts +2 -2
- package/src/supabase/billing/changePlan.ts +2 -2
- package/src/supabase/billing/createCheckoutSession.ts +2 -2
- package/src/supabase/billing/createCustomerPortal.ts +2 -2
- package/src/supabase/billing/refreshSubscriptionStatus.ts +2 -2
- package/src/supabase/crud/aggregate.ts +11 -8
- package/src/supabase/crud/create.ts +2 -2
- package/src/supabase/crud/delete.ts +1 -1
- package/src/supabase/crud/get.ts +2 -2
- package/src/supabase/crud/index.ts +1 -1
- package/src/supabase/crud/list.ts +2 -2
- package/src/supabase/crud/update.ts +2 -2
- package/src/supabase/helpers/authProvider.ts +2 -2
- package/src/supabase/index.ts +10 -2
- package/src/supabase/oauth/disconnect.ts +104 -0
- package/src/supabase/oauth/exchangeToken.ts +152 -0
- package/src/supabase/oauth/getConnections.ts +85 -0
- package/src/supabase/oauth/index.ts +15 -0
- package/src/supabase/oauth/refreshToken.ts +131 -0
- package/src/supabase/registerCrudFunctions.ts +1 -1
- package/src/supabase/utils/idempotency.ts +1 -1
- package/src/supabase/utils/monitoring.ts +1 -1
- package/src/supabase/utils/rateLimiter.ts +1 -1
- package/src/vercel/api/auth/get-custom-claims.ts +1 -1
- package/src/vercel/api/auth/get-user-auth-status.ts +1 -1
- package/src/vercel/api/auth/index.ts +1 -1
- package/src/vercel/api/auth/remove-custom-claims.ts +1 -1
- package/src/vercel/api/auth/set-custom-claims.ts +69 -24
- package/src/vercel/api/billing/cancel.ts +3 -3
- package/src/vercel/api/billing/change-plan.ts +3 -3
- package/src/vercel/api/billing/create-checkout-session.ts +3 -3
- package/src/vercel/api/billing/customer-portal.ts +1 -1
- package/src/vercel/api/billing/index.ts +1 -1
- package/src/vercel/api/billing/refresh-subscription-status.ts +1 -1
- package/src/vercel/api/billing/webhook-handler.ts +3 -3
- package/src/vercel/api/config/constants.ts +9 -9
- package/src/vercel/api/config/firebase-admin.ts +3 -3
- package/src/vercel/api/config/index.ts +1 -1
- package/src/vercel/api/crud/create.ts +1 -1
- package/src/vercel/api/crud/delete.ts +1 -1
- package/src/vercel/api/crud/get.ts +1 -1
- package/src/vercel/api/crud/index.ts +1 -1
- package/src/vercel/api/crud/list.ts +1 -1
- package/src/vercel/api/crud/update.ts +1 -1
- package/src/vercel/api/index.d.ts +1 -1
- package/src/vercel/api/index.ts +1 -1
- package/src/vercel/api/oauth/check-github-access.ts +3 -3
- package/src/vercel/api/oauth/exchange-token.ts +1 -1
- package/src/vercel/api/oauth/grant-github-access.ts +3 -3
- package/src/vercel/api/oauth/index.ts +1 -1
- package/src/vercel/api/oauth/revoke-github-access.ts +1 -1
- package/src/vercel/api/utils/cors.ts +4 -4
- package/src/vercel/baseFunction.ts +2 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OAuthPartnerId, OAuthPurpose } from '@donotdev/core/server';
|
|
2
|
+
/**
|
|
3
|
+
* Disconnect a provider
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
9
|
+
export declare const disconnect: import("firebase-functions/https").CallableFunction<{
|
|
10
|
+
provider: OAuthPartnerId;
|
|
11
|
+
purpose: OAuthPurpose;
|
|
12
|
+
}, any, unknown>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ExchangeTokenRequest } from '@donotdev/core/server';
|
|
2
|
+
/**
|
|
3
|
+
* Exchange OAuth authorization code for access token
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
9
|
+
export declare const exchangeToken: import("firebase-functions/https").CallableFunction<ExchangeTokenRequest, any, unknown>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { OAuthPurpose } from '@donotdev/core/server';
|
|
2
|
+
/**
|
|
3
|
+
* Get a user's OAuth connections
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
9
|
+
export declare const getConnections: import("firebase-functions/https").CallableFunction<{
|
|
10
|
+
purpose?: OAuthPurpose;
|
|
11
|
+
}, any, unknown>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { type GrantGitHubAccessRequest, type RevokeGitHubAccessRequest, type CheckGitHubAccessRequest } from '@donotdev/core/server';
|
|
3
|
+
import type { CallableRequest } from 'firebase-functions/v2/https';
|
|
4
|
+
import type { CallableFunction } from 'firebase-functions/v2/https';
|
|
5
|
+
/**
|
|
6
|
+
* Grant GitHub repository access to a user
|
|
7
|
+
*
|
|
8
|
+
* @version 0.1.0
|
|
9
|
+
* @since 0.0.1
|
|
10
|
+
* @author AMBROISE PARK Consulting
|
|
11
|
+
*/
|
|
12
|
+
export declare const grantGitHubAccess: CallableFunction<GrantGitHubAccessRequest, Promise<any>>;
|
|
13
|
+
/**
|
|
14
|
+
* Grant GitHub repository access with custom validation schema
|
|
15
|
+
*
|
|
16
|
+
* @version 0.1.0
|
|
17
|
+
* @since 0.0.1
|
|
18
|
+
* @author AMBROISE PARK Consulting
|
|
19
|
+
*/
|
|
20
|
+
export declare function grantGitHubAccessWithSchema(request: CallableRequest<GrantGitHubAccessRequest>, customSchema: v.BaseSchema<unknown, GrantGitHubAccessRequest, v.BaseIssue<unknown>>): Promise<{
|
|
21
|
+
success: boolean;
|
|
22
|
+
userId: string;
|
|
23
|
+
githubUsername: string;
|
|
24
|
+
repoConfig: {
|
|
25
|
+
owner: string;
|
|
26
|
+
repo: string;
|
|
27
|
+
};
|
|
28
|
+
permission: string;
|
|
29
|
+
message: string;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Revoke GitHub repository access from a user
|
|
33
|
+
*
|
|
34
|
+
* @version 0.1.0
|
|
35
|
+
* @since 0.0.1
|
|
36
|
+
* @author AMBROISE PARK Consulting
|
|
37
|
+
*/
|
|
38
|
+
export declare const revokeGitHubAccess: CallableFunction<RevokeGitHubAccessRequest, Promise<any>>;
|
|
39
|
+
/**
|
|
40
|
+
* Revoke GitHub repository access with custom validation schema
|
|
41
|
+
*
|
|
42
|
+
* @version 0.1.0
|
|
43
|
+
* @since 0.0.1
|
|
44
|
+
* @author AMBROISE PARK Consulting
|
|
45
|
+
*/
|
|
46
|
+
export declare function revokeGitHubAccessWithSchema(request: CallableRequest<RevokeGitHubAccessRequest>, customSchema: v.BaseSchema<unknown, RevokeGitHubAccessRequest, v.BaseIssue<unknown>>): Promise<{
|
|
47
|
+
success: boolean;
|
|
48
|
+
userId: string;
|
|
49
|
+
githubUsername: string;
|
|
50
|
+
repoConfig: {
|
|
51
|
+
owner: string;
|
|
52
|
+
repo: string;
|
|
53
|
+
};
|
|
54
|
+
message: string;
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Check GitHub repository access for a user
|
|
58
|
+
*
|
|
59
|
+
* @version 0.1.0
|
|
60
|
+
* @since 0.0.1
|
|
61
|
+
* @author AMBROISE PARK Consulting
|
|
62
|
+
*/
|
|
63
|
+
export declare const checkGitHubAccess: CallableFunction<CheckGitHubAccessRequest, Promise<any>>;
|
|
64
|
+
/**
|
|
65
|
+
* Check GitHub repository access with custom validation schema
|
|
66
|
+
*
|
|
67
|
+
* @version 0.1.0
|
|
68
|
+
* @since 0.0.1
|
|
69
|
+
* @author AMBROISE PARK Consulting
|
|
70
|
+
*/
|
|
71
|
+
export declare function checkGitHubAccessWithSchema(request: CallableRequest<CheckGitHubAccessRequest>, customSchema: v.BaseSchema<unknown, CheckGitHubAccessRequest, v.BaseIssue<unknown>>): Promise<{
|
|
72
|
+
success: boolean;
|
|
73
|
+
userId: string;
|
|
74
|
+
githubUsername: string;
|
|
75
|
+
repoConfig: {
|
|
76
|
+
owner: string;
|
|
77
|
+
repo: string;
|
|
78
|
+
};
|
|
79
|
+
hasAccess: boolean;
|
|
80
|
+
customClaimsAccess: boolean;
|
|
81
|
+
accessDetails: any;
|
|
82
|
+
message: string;
|
|
83
|
+
}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Firebase OAuth functions barrel exports
|
|
3
|
+
* @description Centralized exports for Firebase OAuth functions
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
9
|
+
export * from './disconnect.js';
|
|
10
|
+
export * from './exchangeToken.js';
|
|
11
|
+
export * from './getConnections.js';
|
|
12
|
+
export * from './githubAccess.js';
|
|
13
|
+
export * from './refreshToken.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type OAuthRefreshRequest } from '@donotdev/core/server';
|
|
2
|
+
/**
|
|
3
|
+
* Refresh an OAuth token
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
9
|
+
export declare const refreshToken: import("firebase-functions/https").CallableFunction<OAuthRefreshRequest, any, unknown>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Entity } from '@donotdev/core/server';
|
|
2
|
+
import type { HttpsFunction } from 'firebase-functions/v2/https';
|
|
3
|
+
interface RegisterOptions {
|
|
4
|
+
prefix?: string;
|
|
5
|
+
}
|
|
6
|
+
/** CRUD functions object returned by createCrudFunctions */
|
|
7
|
+
export type CrudFunctions = Record<string, HttpsFunction>;
|
|
8
|
+
/**
|
|
9
|
+
* Create CRUD functions for all entities (ESM-friendly)
|
|
10
|
+
* Returns an object of functions that can be spread/exported
|
|
11
|
+
*
|
|
12
|
+
* @param entities - Object of { key: Entity } (from `import * as entities from 'entities'`)
|
|
13
|
+
* @param options - Optional configuration
|
|
14
|
+
* @returns Object of CRUD functions keyed by name
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // ESM pattern - use with build-time export generation
|
|
19
|
+
* import * as entities from 'entities';
|
|
20
|
+
* import { createCrudFunctions } from '@donotdev/functions/firebase';
|
|
21
|
+
*
|
|
22
|
+
* export const crud = createCrudFunctions(entities);
|
|
23
|
+
* // Build process generates: export const { create_cars, ... } = crud;
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function createCrudFunctions(entities: Record<string, Entity | unknown>, options?: RegisterOptions): CrudFunctions;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use createCrudFunctions() for ESM. This mutates target which doesn't work in ESM.
|
|
29
|
+
* Auto-register CRUD functions for all entities (CJS pattern)
|
|
30
|
+
*/
|
|
31
|
+
export declare function registerCrudFunctions(entities: Record<string, Entity | unknown>, target?: Record<string, any>, options?: RegisterOptions): CrudFunctions;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scheduled function that runs daily to check for expired subscriptions
|
|
3
|
+
* and update custom claims with expired status.
|
|
4
|
+
*
|
|
5
|
+
* **Architecture decision — opt-in scheduled function:**
|
|
6
|
+
* This function is not automatically deployed. Consumer apps opt in by
|
|
7
|
+
* exporting it from their functions entry point (e.g. `index.ts`). If not
|
|
8
|
+
* exported, Firebase never schedules it.
|
|
9
|
+
*
|
|
10
|
+
* The `users` collection path defaults to `'users'` but is configurable via
|
|
11
|
+
* the `USERS_COLLECTION_PATH` environment variable, allowing consumers to
|
|
12
|
+
* use their own collection structure (e.g. `'app_users'`, `'tenants/{id}/users'`).
|
|
13
|
+
*/
|
|
14
|
+
export declare const checkExpiredSubscriptions: import("firebase-functions/scheduler").ScheduleFunction;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Firebase scheduled functions barrel exports
|
|
3
|
+
* @description Centralized exports for Firebase scheduled functions
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
9
|
+
export * from './checkExpiredSubscriptions.js';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Create Checkout Session Algorithm
|
|
3
|
+
* @description Platform-agnostic algorithm for creating Stripe checkout sessions
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
9
|
+
import type { CreateCheckoutSessionRequest, CreateCheckoutSessionResponse, StripeBackConfig } from '@donotdev/core/server';
|
|
10
|
+
/**
|
|
11
|
+
* Provider interface for Stripe checkout operations
|
|
12
|
+
*
|
|
13
|
+
* @version 0.1.0
|
|
14
|
+
* @since 0.0.1
|
|
15
|
+
* @author AMBROISE PARK Consulting
|
|
16
|
+
*/
|
|
17
|
+
export interface StripeCheckoutProvider {
|
|
18
|
+
createCheckoutSession(params: {
|
|
19
|
+
priceId: string;
|
|
20
|
+
customerEmail?: string;
|
|
21
|
+
metadata: Record<string, string>;
|
|
22
|
+
allowPromotionCodes: boolean;
|
|
23
|
+
successUrl: string;
|
|
24
|
+
cancelUrl: string;
|
|
25
|
+
mode?: 'payment' | 'subscription';
|
|
26
|
+
}): Promise<{
|
|
27
|
+
id: string;
|
|
28
|
+
url: string | null;
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Provider interface for authentication operations
|
|
33
|
+
*
|
|
34
|
+
* @version 0.1.0
|
|
35
|
+
* @since 0.0.1
|
|
36
|
+
* @author AMBROISE PARK Consulting
|
|
37
|
+
*/
|
|
38
|
+
export interface AuthCheckoutProvider {
|
|
39
|
+
getUser(userId: string): Promise<{
|
|
40
|
+
customClaims?: Record<string, any>;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Create checkout session algorithm
|
|
45
|
+
*
|
|
46
|
+
* @version 0.1.0
|
|
47
|
+
* @since 0.0.1
|
|
48
|
+
* @author AMBROISE PARK Consulting
|
|
49
|
+
*/
|
|
50
|
+
export declare function createCheckoutAlgorithm(request: CreateCheckoutSessionRequest, stripeProvider: StripeCheckoutProvider, authProvider: AuthCheckoutProvider, billingConfig: StripeBackConfig): Promise<CreateCheckoutSessionResponse>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Billing helpers barrel exports
|
|
3
|
+
* @description Centralized exports for billing helper functions
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
9
|
+
export { updateUserSubscription } from './updateUserSubscription.js';
|
|
10
|
+
export type { SubscriptionData } from './updateUserSubscription.js';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type AuthProvider } from './updateUserSubscription.js';
|
|
2
|
+
/**
|
|
3
|
+
* Cancel user subscription at period end
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
9
|
+
export declare function cancelUserSubscription(userId: string, authProvider: AuthProvider): Promise<{
|
|
10
|
+
success: boolean;
|
|
11
|
+
endsAt: string;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Change user subscription plan
|
|
15
|
+
*
|
|
16
|
+
* @version 0.1.0
|
|
17
|
+
* @since 0.0.1
|
|
18
|
+
* @author AMBROISE PARK Consulting
|
|
19
|
+
*/
|
|
20
|
+
export declare function changeUserPlan(userId: string, newPriceId: string, billingConfigKey: string, billingConfig: Record<string, any>, authProvider: AuthProvider): Promise<{
|
|
21
|
+
success: boolean;
|
|
22
|
+
newTier: string;
|
|
23
|
+
newPrice: number;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Create Stripe Customer Portal session
|
|
27
|
+
*
|
|
28
|
+
* @version 0.1.0
|
|
29
|
+
* @since 0.0.1
|
|
30
|
+
* @author AMBROISE PARK Consulting
|
|
31
|
+
*/
|
|
32
|
+
export declare function createCustomerPortalSession(userId: string, authProvider: AuthProvider, returnUrl?: string): Promise<{
|
|
33
|
+
url: string;
|
|
34
|
+
}>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview User subscription update utilities
|
|
3
|
+
* @description Functions for updating user subscription data
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Subscription data structure
|
|
11
|
+
*
|
|
12
|
+
* @version 0.1.0
|
|
13
|
+
* @since 0.0.1
|
|
14
|
+
* @author AMBROISE PARK Consulting
|
|
15
|
+
*/
|
|
16
|
+
export interface SubscriptionData {
|
|
17
|
+
tier: string;
|
|
18
|
+
status: 'active' | 'canceled' | 'past_due' | 'trialing' | 'incomplete';
|
|
19
|
+
subscriptionEnd: string | null;
|
|
20
|
+
cancelAtPeriodEnd?: boolean;
|
|
21
|
+
subscriptionId?: string | null;
|
|
22
|
+
customerId?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Platform-agnostic auth provider interface
|
|
26
|
+
*
|
|
27
|
+
* @version 0.1.0
|
|
28
|
+
* @since 0.0.1
|
|
29
|
+
* @author AMBROISE PARK Consulting
|
|
30
|
+
*/
|
|
31
|
+
export interface AuthProvider {
|
|
32
|
+
getUser(userId: string): Promise<{
|
|
33
|
+
customClaims?: Record<string, unknown>;
|
|
34
|
+
}>;
|
|
35
|
+
setCustomUserClaims(userId: string, claims: Record<string, unknown>): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Platform-agnostic subscription update using dependency injection
|
|
39
|
+
* Works on Firebase Functions, Vercel, AWS Lambda, etc.
|
|
40
|
+
*
|
|
41
|
+
* @version 0.1.0
|
|
42
|
+
* @since 0.0.1
|
|
43
|
+
* @author AMBROISE PARK Consulting
|
|
44
|
+
*/
|
|
45
|
+
export declare function updateUserSubscription(userId: string, subscriptionData: SubscriptionData, authProvider: AuthProvider): Promise<void>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Idempotency store interface
|
|
3
|
+
*
|
|
4
|
+
* @version 0.1.0
|
|
5
|
+
* @since 0.0.1
|
|
6
|
+
* @author AMBROISE PARK Consulting
|
|
7
|
+
*/
|
|
8
|
+
export interface IdempotencyStore {
|
|
9
|
+
isProcessed(eventId: string): Promise<boolean>;
|
|
10
|
+
markProcessed(eventId: string): Promise<void>;
|
|
11
|
+
/** Atomic check-and-reserve: returns true if already processed, false if reserved for processing */
|
|
12
|
+
checkAndReserve(eventId: string): Promise<boolean>;
|
|
13
|
+
}
|
|
14
|
+
export declare function createIdempotencyStore(): IdempotencyStore;
|
|
15
|
+
/**
|
|
16
|
+
* Reset cached store (for testing only)
|
|
17
|
+
*
|
|
18
|
+
* @version 0.1.0
|
|
19
|
+
* @since 0.0.1
|
|
20
|
+
* @author AMBROISE PARK Consulting
|
|
21
|
+
*/
|
|
22
|
+
export declare function resetIdempotencyStore(): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Billing utilities barrel exports
|
|
3
|
+
* @description Centralized exports for billing-related functions
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
9
|
+
export * from './createCheckout.js';
|
|
10
|
+
export * from './helpers/index.js';
|
|
11
|
+
export * from './webhookHandler.js';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { SubscriptionData, AuthProvider } from './helpers/updateUserSubscription.js';
|
|
2
|
+
import type Stripe from 'stripe';
|
|
3
|
+
/**
|
|
4
|
+
* Platform-agnostic auth provider interface for webhook handlers
|
|
5
|
+
*/
|
|
6
|
+
export interface WebhookAuthProvider {
|
|
7
|
+
getUser(userId: string): Promise<{
|
|
8
|
+
customClaims?: Record<string, unknown>;
|
|
9
|
+
}>;
|
|
10
|
+
setCustomUserClaims(userId: string, claims: Record<string, unknown>): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Subscription update function type
|
|
14
|
+
*/
|
|
15
|
+
export type UpdateSubscriptionFn = (userId: string, data: SubscriptionData, authProvider: AuthProvider) => Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Process webhook with automatic idempotency detection
|
|
18
|
+
*
|
|
19
|
+
* @param rawBody - Raw request body
|
|
20
|
+
* @param signature - Stripe signature
|
|
21
|
+
* @param webhookSecret - Stripe webhook secret
|
|
22
|
+
* @param stripe - Stripe instance
|
|
23
|
+
* @param billingConfig - Billing configuration
|
|
24
|
+
* @param updateSubscription - Function to update user subscription
|
|
25
|
+
*
|
|
26
|
+
* @version 0.1.0
|
|
27
|
+
* @since 0.0.1
|
|
28
|
+
* @author AMBROISE PARK Consulting
|
|
29
|
+
*/
|
|
30
|
+
export declare function processWebhook(rawBody: string | Buffer, signature: string, webhookSecret: string, stripe: Stripe, billingConfig: unknown, updateSubscription: UpdateSubscriptionFn, authProvider: WebhookAuthProvider | null): Promise<{
|
|
31
|
+
success: boolean;
|
|
32
|
+
message: string;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Calculate subscription end date with proper edge case handling
|
|
36
|
+
* Fixes issues like Jan 31 + 1 month = March 3 (should be Feb 28/29)
|
|
37
|
+
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DoNotDevError } from '@donotdev/core/server';
|
|
2
|
+
export { DoNotDevError };
|
|
3
|
+
/**
|
|
4
|
+
* Classify and throw a DoNotDevError from any unknown error.
|
|
5
|
+
* Pure classification — no platform imports, no env detection.
|
|
6
|
+
*
|
|
7
|
+
* @param error - The error to handle
|
|
8
|
+
* @throws DoNotDevError always
|
|
9
|
+
*
|
|
10
|
+
* @version 0.1.0
|
|
11
|
+
* @since 0.0.1
|
|
12
|
+
* @author AMBROISE PARK Consulting
|
|
13
|
+
*/
|
|
14
|
+
export declare function handleError(error: unknown): never;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Firebase data transformation utilities for functions
|
|
3
|
+
* @description Server-safe functions for converting data between Firebase and application formats
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
9
|
+
import type { FirestoreTimestamp } from '@donotdev/core/server';
|
|
10
|
+
/**
|
|
11
|
+
* Create a server-safe version of the Timestamp creation
|
|
12
|
+
* @param date - The Date object to convert
|
|
13
|
+
* @returns A representation of the timestamp
|
|
14
|
+
*
|
|
15
|
+
* @version 0.1.0
|
|
16
|
+
* @since 0.0.1
|
|
17
|
+
* @author AMBROISE PARK Consulting
|
|
18
|
+
*/
|
|
19
|
+
export declare function createTimestamp(date: Date): FirestoreTimestamp;
|
|
20
|
+
/**
|
|
21
|
+
* Converts a Date or ISO string to a Firestore Timestamp.
|
|
22
|
+
* @param date - The date to convert (string or Date)
|
|
23
|
+
* @returns The Firestore Timestamp
|
|
24
|
+
* @throws Error if the date is invalid
|
|
25
|
+
*
|
|
26
|
+
* @version 0.1.0
|
|
27
|
+
* @since 0.0.1
|
|
28
|
+
* @author AMBROISE PARK Consulting
|
|
29
|
+
*/
|
|
30
|
+
export declare function toTimestamp(date: string | Date): FirestoreTimestamp;
|
|
31
|
+
/**
|
|
32
|
+
* Converts a Firestore Timestamp to an ISO string.
|
|
33
|
+
* @param timestamp - The Firestore Timestamp
|
|
34
|
+
* @returns The ISO string representation
|
|
35
|
+
*
|
|
36
|
+
* @version 0.1.0
|
|
37
|
+
* @since 0.0.1
|
|
38
|
+
* @author AMBROISE PARK Consulting
|
|
39
|
+
*/
|
|
40
|
+
export declare function toISOString(timestamp: FirestoreTimestamp): string;
|
|
41
|
+
/**
|
|
42
|
+
* Checks if a value is a Firestore Timestamp.
|
|
43
|
+
* @param value - The value to check
|
|
44
|
+
* @returns True if the value is a Timestamp
|
|
45
|
+
*
|
|
46
|
+
* @version 0.1.0
|
|
47
|
+
* @since 0.0.1
|
|
48
|
+
* @author AMBROISE PARK Consulting
|
|
49
|
+
*/
|
|
50
|
+
export declare function isTimestamp(value: any): value is FirestoreTimestamp;
|
|
51
|
+
/**
|
|
52
|
+
* Recursively transforms Firestore data to application format by converting Timestamps to ISO strings.
|
|
53
|
+
* @param data - The data to transform
|
|
54
|
+
* @param includeDocumentIds - Whether to include document IDs
|
|
55
|
+
* @returns The transformed data
|
|
56
|
+
*
|
|
57
|
+
* @version 0.1.0
|
|
58
|
+
* @since 0.0.1
|
|
59
|
+
* @author AMBROISE PARK Consulting
|
|
60
|
+
*/
|
|
61
|
+
export declare function transformFirestoreData<T = any>(data: T, includeDocumentIds?: boolean): T;
|
|
62
|
+
/**
|
|
63
|
+
* Recursively prepares data for Firestore by converting Date objects to ISO strings.
|
|
64
|
+
* ISO strings are kept as-is (no conversion needed).
|
|
65
|
+
* @param data - The data to prepare
|
|
66
|
+
* @param removeFields - Optional array of field names to remove
|
|
67
|
+
* @returns The prepared data
|
|
68
|
+
*
|
|
69
|
+
* @version 0.1.0
|
|
70
|
+
* @since 0.0.1
|
|
71
|
+
* @author AMBROISE PARK Consulting
|
|
72
|
+
*/
|
|
73
|
+
export declare function prepareForFirestore<T = any>(data: T, removeFields?: string[]): T;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview GitHub API Service for functions
|
|
3
|
+
* @description Server-safe GitHub API utilities for repository management
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
9
|
+
export interface GitHubApiConfig {
|
|
10
|
+
accessToken: string;
|
|
11
|
+
baseUrl?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface GitHubUser {
|
|
14
|
+
id: number;
|
|
15
|
+
login: string;
|
|
16
|
+
email: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
avatar_url: string;
|
|
19
|
+
}
|
|
20
|
+
export interface GitHubRepository {
|
|
21
|
+
id: number;
|
|
22
|
+
name: string;
|
|
23
|
+
full_name: string;
|
|
24
|
+
private: boolean;
|
|
25
|
+
owner: {
|
|
26
|
+
login: string;
|
|
27
|
+
id: number;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface AddCollaboratorRequest {
|
|
31
|
+
owner: string;
|
|
32
|
+
repo: string;
|
|
33
|
+
username: string;
|
|
34
|
+
permission?: 'pull' | 'triage' | 'push' | 'maintain' | 'admin';
|
|
35
|
+
}
|
|
36
|
+
export interface GitHubApiError {
|
|
37
|
+
message: string;
|
|
38
|
+
documentation_url?: string;
|
|
39
|
+
status?: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* GitHub API Service for server-side operations
|
|
43
|
+
*
|
|
44
|
+
* @version 0.1.0
|
|
45
|
+
* @since 0.0.1
|
|
46
|
+
* @author AMBROISE PARK Consulting
|
|
47
|
+
*/
|
|
48
|
+
export declare class GitHubApiService {
|
|
49
|
+
private config;
|
|
50
|
+
constructor(config: GitHubApiConfig);
|
|
51
|
+
/**
|
|
52
|
+
* Get the current authenticated user
|
|
53
|
+
*
|
|
54
|
+
* @version 0.1.0
|
|
55
|
+
* @since 0.0.1
|
|
56
|
+
* @author AMBROISE PARK Consulting
|
|
57
|
+
*/
|
|
58
|
+
getCurrentUser(): Promise<GitHubUser>;
|
|
59
|
+
/**
|
|
60
|
+
* Get user repositories
|
|
61
|
+
*
|
|
62
|
+
* @version 0.1.0
|
|
63
|
+
* @since 0.0.1
|
|
64
|
+
* @author AMBROISE PARK Consulting
|
|
65
|
+
*/
|
|
66
|
+
getUserRepositories(username?: string): Promise<GitHubRepository[]>;
|
|
67
|
+
/**
|
|
68
|
+
* Add a collaborator to a repository
|
|
69
|
+
*
|
|
70
|
+
* @version 0.1.0
|
|
71
|
+
* @since 0.0.1
|
|
72
|
+
* @author AMBROISE PARK Consulting
|
|
73
|
+
*/
|
|
74
|
+
addCollaborator(request: AddCollaboratorRequest): Promise<boolean>;
|
|
75
|
+
/**
|
|
76
|
+
* Check if a user is a collaborator on a repository
|
|
77
|
+
* Uses GitHub's direct API endpoint for efficiency
|
|
78
|
+
*
|
|
79
|
+
* @version 0.1.0
|
|
80
|
+
* @since 0.0.1
|
|
81
|
+
* @author AMBROISE PARK Consulting
|
|
82
|
+
*/
|
|
83
|
+
isCollaborator(owner: string, repo: string, username: string): Promise<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* Remove a collaborator from a repository
|
|
86
|
+
*
|
|
87
|
+
* @version 0.1.0
|
|
88
|
+
* @since 0.0.1
|
|
89
|
+
* @author AMBROISE PARK Consulting
|
|
90
|
+
*/
|
|
91
|
+
removeCollaborator(owner: string, repo: string, username: string): Promise<boolean>;
|
|
92
|
+
/**
|
|
93
|
+
* Add a user to an organization team
|
|
94
|
+
*
|
|
95
|
+
* @version 0.1.0
|
|
96
|
+
* @since 0.0.1
|
|
97
|
+
* @author AMBROISE PARK Consulting
|
|
98
|
+
*/
|
|
99
|
+
addTeamMember(org: string, teamSlug: string, username: string, role?: 'member' | 'maintainer'): Promise<boolean>;
|
|
100
|
+
/**
|
|
101
|
+
* Remove a user from an organization team
|
|
102
|
+
*
|
|
103
|
+
* @version 0.1.0
|
|
104
|
+
* @since 0.0.1
|
|
105
|
+
* @author AMBROISE PARK Consulting
|
|
106
|
+
*/
|
|
107
|
+
removeTeamMember(org: string, teamSlug: string, username: string): Promise<boolean>;
|
|
108
|
+
/**
|
|
109
|
+
* Check if a user is a member of an organization team
|
|
110
|
+
*
|
|
111
|
+
* @version 0.1.0
|
|
112
|
+
* @since 0.0.1
|
|
113
|
+
* @author AMBROISE PARK Consulting
|
|
114
|
+
*/
|
|
115
|
+
isTeamMember(org: string, teamSlug: string, username: string): Promise<boolean>;
|
|
116
|
+
/**
|
|
117
|
+
* Make an authenticated request to the GitHub API
|
|
118
|
+
*
|
|
119
|
+
* @version 0.1.0
|
|
120
|
+
* @since 0.0.1
|
|
121
|
+
* @author AMBROISE PARK Consulting
|
|
122
|
+
*/
|
|
123
|
+
private request;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Create a GitHub API service instance
|
|
127
|
+
*/
|
|
128
|
+
export declare function createGitHubApiService(accessToken: string): GitHubApiService;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared utilities barrel exports
|
|
3
|
+
* @description Centralized exports for shared function utilities
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1.0
|
|
6
|
+
* @since 0.0.1
|
|
7
|
+
* @author AMBROISE PARK Consulting
|
|
8
|
+
*/
|
|
9
|
+
export * from './errorHandling.js';
|
|
10
|
+
export * from './github.js';
|
|
11
|
+
export * from './metadata.js';
|
|
12
|
+
export * from './schema.js';
|
|
13
|
+
export * from './utils/index.js';
|
|
14
|
+
export * from './billing/index.js';
|
|
15
|
+
export * from './oauth/index.js';
|
|
16
|
+
export { createTimestamp, toTimestamp, isTimestamp, transformFirestoreData, prepareForFirestore, } from './firebase.js';
|