@donotdev/functions 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/package.json +4 -4
  2. package/src/firebase/baseFunction.ts +1 -1
  3. package/src/firebase/billing/changePlan.ts +1 -1
  4. package/src/firebase/billing/refreshSubscriptionStatus.ts +1 -1
  5. package/src/firebase/crud/create.ts +1 -1
  6. package/src/firebase/crud/list.ts +2 -1
  7. package/src/firebase/crud/update.ts +1 -1
  8. package/src/shared/billing/__tests__/createCheckout.test.ts +7 -5
  9. package/src/shared/billing/__tests__/webhookHandler.test.ts +1 -0
  10. package/src/shared/billing/helpers/subscriptionManagement.ts +2 -2
  11. package/src/shared/billing/webhookHandler.ts +1 -2
  12. package/src/shared/errorHandling.ts +2 -1
  13. package/src/shared/oauth/__tests__/exchangeToken.test.ts +2 -1
  14. package/src/shared/schema.ts +1 -1
  15. package/src/shared/utils/__tests__/functionWrapper.test.ts +1 -1
  16. package/src/shared/utils/firebaseHelpers.ts +1 -1
  17. package/src/shared/utils/internal/auth.ts +1 -1
  18. package/src/shared/utils/internal/rateLimiter.ts +1 -1
  19. package/src/shared/utils/vercelHelpers.ts +1 -2
  20. package/src/supabase/baseFunction.ts +3 -2
  21. package/src/supabase/billing/createCheckoutSession.ts +2 -3
  22. package/src/supabase/billing/refreshSubscriptionStatus.ts +2 -1
  23. package/src/supabase/crud/aggregate.ts +0 -1
  24. package/src/supabase/crud/create.ts +0 -1
  25. package/src/supabase/crud/get.ts +0 -1
  26. package/src/supabase/crud/list.ts +0 -1
  27. package/src/supabase/crud/update.ts +0 -1
  28. package/src/supabase/helpers/authProvider.ts +0 -1
  29. package/src/supabase/utils/rateLimiter.ts +2 -1
  30. package/src/vercel/api/billing/change-plan.ts +1 -1
  31. package/src/vercel/api/billing/create-checkout-session.ts +1 -2
  32. package/src/vercel/api/billing/refresh-subscription-status.ts +1 -1
  33. package/src/vercel/api/crud/create.ts +1 -1
  34. package/src/vercel/api/crud/delete.ts +1 -1
  35. package/src/vercel/api/crud/get.ts +1 -1
  36. package/src/vercel/api/crud/list.ts +1 -1
  37. package/src/vercel/api/crud/update.ts +1 -1
  38. package/src/vercel/api/oauth/check-github-access.ts +1 -2
  39. package/src/vercel/api/oauth/exchange-token.ts +1 -2
  40. package/src/vercel/api/oauth/grant-github-access.ts +1 -2
  41. package/src/vercel/baseFunction.ts +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donotdev/functions",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "private": false,
5
5
  "description": "Backend functions for DoNotDev Framework - Firebase, Vercel, and platform-agnostic implementations for auth, billing, CRUD, and OAuth",
6
6
  "main": "./lib/firebase/index.js",
@@ -47,9 +47,9 @@
47
47
  "serve": "firebase emulators:start --only functions"
48
48
  },
49
49
  "dependencies": {
50
- "@donotdev/core": "^0.0.30",
51
- "@donotdev/firebase": "^0.0.16",
52
- "@donotdev/supabase": "^0.0.6"
50
+ "@donotdev/core": "^0.0.35",
51
+ "@donotdev/firebase": "^0.0.18",
52
+ "@donotdev/supabase": "^0.0.7"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@sentry/node": "^10.39.0",
@@ -13,9 +13,9 @@ import { logger } from 'firebase-functions/v2';
13
13
  import { onCall } from 'firebase-functions/v2/https';
14
14
  import * as v from 'valibot';
15
15
 
16
+ import type { SecurityContext } from '@donotdev/core';
16
17
  import { hasRoleAccess } from '@donotdev/core/server';
17
18
  import type { UserRole } from '@donotdev/core/server';
18
- import type { SecurityContext } from '@donotdev/core';
19
19
 
20
20
  import { FUNCTION_CONFIG } from './config/constants.js';
21
21
  import { handleError, DoNotDevError } from '../shared/errorHandling.js';
@@ -9,7 +9,6 @@
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
11
11
 
12
- import Stripe from 'stripe';
13
12
  import * as v from 'valibot';
14
13
 
15
14
  import type { StripeBackConfig } from '@donotdev/core/server';
@@ -27,6 +26,7 @@ import { STRIPE_CONFIG } from '../config/constants.js';
27
26
  import { stripeSecretKey } from '../config/secrets.js';
28
27
 
29
28
  import type { CallableRequest } from 'firebase-functions/v2/https';
29
+ import type Stripe from 'stripe';
30
30
 
31
31
  const changePlanSchema = v.object({
32
32
  userId: v.string(),
@@ -9,7 +9,6 @@
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
11
11
 
12
- import Stripe from 'stripe';
13
12
  import * as v from 'valibot';
14
13
 
15
14
  import type { RefreshSubscriptionRequest } from '@donotdev/core/server';
@@ -20,6 +19,7 @@ import { createBaseFunction } from '../baseFunction.js';
20
19
  import { STRIPE_CONFIG } from '../config/constants.js';
21
20
 
22
21
  import type { CallableRequest } from 'firebase-functions/v2/https';
22
+ import type Stripe from 'stripe';
23
23
 
24
24
  /**
25
25
  * Schema for refreshing subscription status
@@ -25,11 +25,11 @@ import { DoNotDevError, validateDocument } from '../../shared/utils.js';
25
25
  import { createBaseFunction } from '../baseFunction.js';
26
26
  import { CRUD_CONFIG } from '../config/constants.js';
27
27
 
28
+ import type { Query, DocumentData } from 'firebase-admin/firestore';
28
29
  import type {
29
30
  CallableFunction,
30
31
  CallableRequest,
31
32
  } from 'firebase-functions/v2/https';
32
- import type { Query, DocumentData } from 'firebase-admin/firestore';
33
33
 
34
34
  export type CreateEntityRequest = {
35
35
  payload: Record<string, any>;
@@ -22,7 +22,8 @@ import type {
22
22
  EntityOwnershipPublicCondition,
23
23
  UserRole,
24
24
  } from '@donotdev/core/server';
25
- import { getFirebaseAdminFirestore, Query } from '@donotdev/firebase/server';
25
+ import type { Query } from '@donotdev/firebase/server';
26
+ import { getFirebaseAdminFirestore } from '@donotdev/firebase/server';
26
27
 
27
28
  import { transformFirestoreData } from '../../shared/index.js';
28
29
  import { DoNotDevError } from '../../shared/utils.js';
@@ -24,11 +24,11 @@ import { DoNotDevError, validateDocument } from '../../shared/utils.js';
24
24
  import { createBaseFunction } from '../baseFunction.js';
25
25
  import { CRUD_CONFIG } from '../config/constants.js';
26
26
 
27
+ import type { Query, DocumentData } from 'firebase-admin/firestore';
27
28
  import type {
28
29
  CallableFunction,
29
30
  CallableRequest,
30
31
  } from 'firebase-functions/v2/https';
31
- import type { Query, DocumentData } from 'firebase-admin/firestore';
32
32
 
33
33
  export type UpdateEntityRequest = {
34
34
  id: string;
@@ -11,16 +11,18 @@
11
11
 
12
12
  import { describe, it, expect, vi, beforeEach } from 'vitest';
13
13
 
14
- import type {
15
- StripeCheckoutProvider,
16
- AuthCheckoutProvider,
17
- } from '../createCheckout.js';
18
- import { createCheckoutAlgorithm } from '../createCheckout.js';
19
14
  import type {
20
15
  CreateCheckoutSessionRequest,
21
16
  StripeBackConfig,
22
17
  } from '@donotdev/core/server';
23
18
 
19
+ import { createCheckoutAlgorithm } from '../createCheckout.js';
20
+
21
+ import type {
22
+ StripeCheckoutProvider,
23
+ AuthCheckoutProvider,
24
+ } from '../createCheckout.js';
25
+
24
26
  // ---------------------------------------------------------------------------
25
27
  // Fixtures
26
28
  // ---------------------------------------------------------------------------
@@ -80,6 +80,7 @@ vi.mock('../../logger.js', () => ({
80
80
  // Reset idempotency store between tests so events are never pre-marked
81
81
  import { resetIdempotencyStore } from '../idempotency.js';
82
82
  import { processWebhook } from '../webhookHandler.js';
83
+
83
84
  import type {
84
85
  UpdateSubscriptionFn,
85
86
  WebhookAuthProvider,
@@ -9,8 +9,6 @@
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
11
11
 
12
- import Stripe from 'stripe';
13
-
14
12
  import { SUBSCRIPTION_STATUS } from '@donotdev/core/server';
15
13
 
16
14
  import {
@@ -20,6 +18,8 @@ import {
20
18
  import { handleError } from '../../errorHandling.js';
21
19
  import { stripe, validateStripeEnvironment } from '../../utils.js';
22
20
 
21
+ import type Stripe from 'stripe';
22
+
23
23
  /**
24
24
  * Cancel user subscription at period end
25
25
  *
@@ -9,8 +9,6 @@
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
11
11
 
12
- import Stripe from 'stripe';
13
-
14
12
  import {
15
13
  validateStripeBackConfig,
16
14
  SUBSCRIPTION_STATUS,
@@ -27,6 +25,7 @@ import type {
27
25
  SubscriptionData,
28
26
  AuthProvider,
29
27
  } from './helpers/updateUserSubscription.js';
28
+ import type Stripe from 'stripe';
30
29
 
31
30
  // W7: Lazy singleton — resolving at import time reads env vars / Firebase Admin
32
31
  // before they are fully injected (e.g., defineSecret values on Firebase Functions v2).
@@ -10,7 +10,8 @@
10
10
  * @author AMBROISE PARK Consulting
11
11
  */
12
12
 
13
- import { DoNotDevError, EntityHookError } from '@donotdev/core/server';
13
+ import type { EntityHookError } from '@donotdev/core/server';
14
+ import { DoNotDevError } from '@donotdev/core/server';
14
15
 
15
16
  // Re-export DoNotDevError so existing imports from this module continue to work
16
17
  export { DoNotDevError };
@@ -11,12 +11,13 @@
11
11
 
12
12
  import { describe, it, expect, vi } from 'vitest';
13
13
 
14
- import { exchangeTokenAlgorithm, type OAuthProvider } from '../exchangeToken';
15
14
  import type {
16
15
  ExchangeTokenRequest,
17
16
  TokenResponse,
18
17
  } from '@donotdev/core/server';
19
18
 
19
+ import { exchangeTokenAlgorithm, type OAuthProvider } from '../exchangeToken';
20
+
20
21
  // ---------------------------------------------------------------------------
21
22
  // Helpers
22
23
  // ---------------------------------------------------------------------------
@@ -9,7 +9,7 @@
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
11
11
 
12
- import * as v from 'valibot';
12
+ import type * as v from 'valibot';
13
13
 
14
14
  /** Visibility levels matching @donotdev/core */
15
15
  type Visibility = 'guest' | 'user' | 'admin' | 'technical' | 'hidden' | 'owner';
@@ -9,8 +9,8 @@
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
11
11
 
12
- import { describe, it, expect, vi, beforeEach } from 'vitest';
13
12
  import * as v from 'valibot';
13
+ import { describe, it, expect, vi, beforeEach } from 'vitest';
14
14
 
15
15
  import {
16
16
  withValidation,
@@ -10,11 +10,11 @@
10
10
  */
11
11
 
12
12
  import { onCall } from 'firebase-functions/v2/https';
13
- import * as v from 'valibot';
14
13
 
15
14
  import { withSchemaValidation } from './schemaValidation.js';
16
15
 
17
16
  import type { CallableRequest } from 'firebase-functions/v2/https';
17
+ import type * as v from 'valibot';
18
18
 
19
19
  /**
20
20
  * Creates a Firebase onCall function with schema validation
@@ -10,8 +10,8 @@
10
10
  * @author AMBROISE PARK Consulting
11
11
  */
12
12
 
13
- import { getFirebaseAdminAuth } from '@donotdev/firebase/server';
14
13
  import { hasProvider, getProvider } from '@donotdev/core/server';
14
+ import { getFirebaseAdminAuth } from '@donotdev/firebase/server';
15
15
 
16
16
  import type { NextApiRequest } from 'next';
17
17
 
@@ -11,11 +11,11 @@
11
11
 
12
12
  import { logger } from 'firebase-functions/v2';
13
13
 
14
- import { getFirebaseAdminFirestore } from '@donotdev/firebase/server';
15
14
  import type {
16
15
  ServerRateLimitConfig as RateLimitConfig,
17
16
  ServerRateLimitResult as RateLimitResult,
18
17
  } from '@donotdev/core';
18
+ import { getFirebaseAdminFirestore } from '@donotdev/firebase/server';
19
19
 
20
20
  export type { RateLimitConfig, RateLimitResult };
21
21
 
@@ -9,14 +9,13 @@
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
11
11
 
12
- import * as v from 'valibot';
13
-
14
12
  import {
15
13
  withVercelSchemaValidation,
16
14
  validateRequestData,
17
15
  } from './schemaValidation.js';
18
16
 
19
17
  import type { NextApiRequest, NextApiResponse } from 'next';
18
+ import type * as v from 'valibot';
20
19
 
21
20
  /**
22
21
  * Creates a Vercel API handler with schema validation
@@ -15,14 +15,15 @@ import * as v from 'valibot';
15
15
 
16
16
  import { hasRoleAccess } from '@donotdev/core/server';
17
17
  import type { UserRole, SecurityContext } from '@donotdev/core/server';
18
- import type { SupabaseClient } from '@supabase/supabase-js';
19
18
 
19
+ import { recordOperationMetrics } from './utils/monitoring.js';
20
20
  import {
21
21
  checkRateLimitWithPostgres,
22
22
  DEFAULT_RATE_LIMITS,
23
23
  } from './utils/rateLimiter.js';
24
+
24
25
  import type { RateLimitConfig } from './utils/rateLimiter.js';
25
- import { recordOperationMetrics } from './utils/monitoring.js';
26
+ import type { SupabaseClient } from '@supabase/supabase-js';
26
27
 
27
28
  // =============================================================================
28
29
  // Types
@@ -9,8 +9,9 @@
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
11
11
 
12
- import type { StripeBackConfig } from '@donotdev/core/server';
13
12
  import { CreateCheckoutSessionRequestSchema } from '@donotdev/core/server';
13
+ import type { StripeBackConfig } from '@donotdev/core/server';
14
+ import type { CreateCheckoutSessionRequest } from '@donotdev/core/server';
14
15
 
15
16
  import { createCheckoutAlgorithm } from '../../shared/billing/createCheckout.js';
16
17
  import {
@@ -21,8 +22,6 @@ import {
21
22
  import { createSupabaseHandler } from '../baseFunction.js';
22
23
  import { createSupabaseAuthProvider } from '../helpers/authProvider.js';
23
24
 
24
- import type { CreateCheckoutSessionRequest } from '@donotdev/core/server';
25
-
26
25
  // =============================================================================
27
26
  // Factory
28
27
  // =============================================================================
@@ -9,7 +9,6 @@
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
11
11
 
12
- import Stripe from 'stripe';
13
12
  import * as v from 'valibot';
14
13
 
15
14
  import {
@@ -20,6 +19,8 @@ import {
20
19
  import { createSupabaseHandler } from '../baseFunction.js';
21
20
  import { createSupabaseAuthProvider } from '../helpers/authProvider.js';
22
21
 
22
+ import type Stripe from 'stripe';
23
+
23
24
  // =============================================================================
24
25
  // Schema
25
26
  // =============================================================================
@@ -12,7 +12,6 @@
12
12
  import * as v from 'valibot';
13
13
 
14
14
  import type { UserRole } from '@donotdev/core/server';
15
-
16
15
  import { defaultFieldMapper } from '@donotdev/supabase';
17
16
 
18
17
  import { DoNotDevError } from '../../shared/utils.js';
@@ -16,7 +16,6 @@ import {
16
16
  filterVisibleFields,
17
17
  } from '@donotdev/core/server';
18
18
  import type { UserRole, UniqueKeyDefinition } from '@donotdev/core/server';
19
-
20
19
  import { defaultFieldMapper } from '@donotdev/supabase';
21
20
 
22
21
  import { createMetadata } from '../../shared/index.js';
@@ -17,7 +17,6 @@ import {
17
17
  HIDDEN_STATUSES,
18
18
  } from '@donotdev/core/server';
19
19
  import type { EntityOwnershipConfig, UserRole } from '@donotdev/core/server';
20
-
21
20
  import {
22
21
  createEntityAwareMapper,
23
22
  defaultFieldMapper,
@@ -21,7 +21,6 @@ import type {
21
21
  EntityOwnershipPublicCondition,
22
22
  UserRole,
23
23
  } from '@donotdev/core/server';
24
-
25
24
  import {
26
25
  createEntityAwareMapper,
27
26
  defaultFieldMapper,
@@ -12,7 +12,6 @@
12
12
  import * as v from 'valibot';
13
13
 
14
14
  import type { UserRole, UniqueKeyDefinition } from '@donotdev/core/server';
15
-
16
15
  import { defaultFieldMapper } from '@donotdev/supabase';
17
16
 
18
17
  import { updateMetadata } from '../../shared/index.js';
@@ -11,7 +11,6 @@
11
11
  */
12
12
 
13
13
  import type { AuthProvider } from '../../shared/billing/helpers/updateUserSubscription.js';
14
-
15
14
  import type { SupabaseClient } from '@supabase/supabase-js';
16
15
 
17
16
  // =============================================================================
@@ -23,12 +23,13 @@
23
23
  * @author AMBROISE PARK Consulting
24
24
  */
25
25
 
26
- import type { SupabaseClient } from '@supabase/supabase-js';
27
26
  import type {
28
27
  ServerRateLimitConfig as RateLimitConfig,
29
28
  ServerRateLimitResult as RateLimitResult,
30
29
  } from '@donotdev/core';
31
30
 
31
+ import type { SupabaseClient } from '@supabase/supabase-js';
32
+
32
33
  export type { RateLimitConfig, RateLimitResult };
33
34
 
34
35
  /**
@@ -9,7 +9,6 @@
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
11
11
 
12
- import Stripe from 'stripe';
13
12
  import * as v from 'valibot';
14
13
 
15
14
  import type { StripeBackConfig } from '@donotdev/core/server';
@@ -21,6 +20,7 @@ import { stripe, validateStripeEnvironment } from '../../../shared/utils.js';
21
20
  import { createVercelBaseFunction } from '../../baseFunction.js';
22
21
 
23
22
  import type { NextApiRequest, NextApiResponse } from 'next';
23
+ import type Stripe from 'stripe';
24
24
 
25
25
  const changePlanSchema = v.object({
26
26
  userId: v.string(),
@@ -9,8 +9,6 @@
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
11
11
 
12
- import * as v from 'valibot';
13
-
14
12
  import { CreateCheckoutSessionRequestSchema } from '@donotdev/core/server';
15
13
  import type {
16
14
  CreateCheckoutSessionRequest,
@@ -23,6 +21,7 @@ import { stripe, validateStripeEnvironment } from '../../../shared/utils.js';
23
21
  import { createVercelBaseFunction } from '../../baseFunction.js';
24
22
 
25
23
  import type { NextApiRequest, NextApiResponse } from 'next';
24
+ import type * as v from 'valibot';
26
25
 
27
26
  /**
28
27
  * Business logic for creating checkout sessions
@@ -9,7 +9,6 @@
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
11
11
 
12
- import Stripe from 'stripe';
13
12
  import * as v from 'valibot';
14
13
 
15
14
  import type { RefreshSubscriptionRequest } from '@donotdev/core/server';
@@ -19,6 +18,7 @@ import { stripe, validateStripeEnvironment } from '../../../shared/utils.js';
19
18
  import { createVercelBaseFunction } from '../../baseFunction.js';
20
19
 
21
20
  import type { NextApiRequest, NextApiResponse } from 'next';
21
+ import type Stripe from 'stripe';
22
22
 
23
23
  const refreshSubscriptionStatusSchema = v.object({
24
24
  userId: v.pipe(v.string(), v.minLength(1, 'User ID is required')),
@@ -19,11 +19,11 @@ import {
19
19
  transformFirestoreData,
20
20
  } from '../../../shared/index.js';
21
21
  import { createMetadata } from '../../../shared/index.js';
22
+ import { verifyAuthToken } from '../../../shared/utils/internal/auth.js';
22
23
  import {
23
24
  validateCollectionName,
24
25
  validateDocument,
25
26
  } from '../../../shared/utils.js';
26
- import { verifyAuthToken } from '../../../shared/utils/internal/auth.js';
27
27
 
28
28
  import type { NextApiRequest, NextApiResponse } from 'next';
29
29
 
@@ -13,8 +13,8 @@ import type { GetEntityData } from '@donotdev/core/server';
13
13
  import { getFirebaseAdminFirestore } from '@donotdev/firebase/server';
14
14
 
15
15
  import { handleError } from '../../../shared/errorHandling.js';
16
- import { validateCollectionName } from '../../../shared/utils.js';
17
16
  import { verifyAuthToken } from '../../../shared/utils/internal/auth.js';
17
+ import { validateCollectionName } from '../../../shared/utils.js';
18
18
 
19
19
  import type { NextApiRequest, NextApiResponse } from 'next';
20
20
 
@@ -16,8 +16,8 @@ import { getFirebaseAdminFirestore } from '@donotdev/firebase/server';
16
16
  import { handleError } from '../../../shared/errorHandling.js';
17
17
  import { transformFirestoreData } from '../../../shared/index.js';
18
18
  import { filterVisibleFields } from '../../../shared/index.js';
19
- import { validateCollectionName } from '../../../shared/utils.js';
20
19
  import { verifyAuthToken } from '../../../shared/utils/internal/auth.js';
20
+ import { validateCollectionName } from '../../../shared/utils.js';
21
21
 
22
22
  import type { NextApiRequest, NextApiResponse } from 'next';
23
23
 
@@ -16,8 +16,8 @@ import { getFirebaseAdminFirestore } from '@donotdev/firebase/server';
16
16
  import { handleError } from '../../../shared/errorHandling.js';
17
17
  import { transformFirestoreData } from '../../../shared/index.js';
18
18
  import { filterVisibleFields } from '../../../shared/index.js';
19
- import { validateCollectionName } from '../../../shared/utils.js';
20
19
  import { verifyAuthToken } from '../../../shared/utils/internal/auth.js';
20
+ import { validateCollectionName } from '../../../shared/utils.js';
21
21
 
22
22
  import type { NextApiRequest, NextApiResponse } from 'next';
23
23
 
@@ -19,11 +19,11 @@ import {
19
19
  transformFirestoreData,
20
20
  } from '../../../shared/index.js';
21
21
  import { updateMetadata } from '../../../shared/index.js';
22
+ import { verifyAuthToken } from '../../../shared/utils/internal/auth.js';
22
23
  import {
23
24
  validateCollectionName,
24
25
  validateDocument,
25
26
  } from '../../../shared/utils.js';
26
- import { verifyAuthToken } from '../../../shared/utils/internal/auth.js';
27
27
 
28
28
  import type { NextApiRequest, NextApiResponse } from 'next';
29
29
 
@@ -9,8 +9,6 @@
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
11
11
 
12
- import * as v from 'valibot';
13
-
14
12
  import {
15
13
  checkGitHubAccessSchema,
16
14
  type CheckGitHubAccessRequest,
@@ -21,6 +19,7 @@ import { GitHubApiService } from '../../../shared/index.js';
21
19
  import { createVercelBaseFunction } from '../../baseFunction.js';
22
20
 
23
21
  import type { NextApiRequest, NextApiResponse } from 'next';
22
+ import type * as v from 'valibot';
24
23
 
25
24
  /**
26
25
  * Business logic for checking GitHub access
@@ -9,8 +9,6 @@
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
11
11
 
12
- import * as v from 'valibot';
13
-
14
12
  import {
15
13
  OAUTH_PARTNERS,
16
14
  exchangeTokenSchema,
@@ -25,6 +23,7 @@ import {
25
23
  import { createVercelBaseFunction } from '../../baseFunction.js';
26
24
 
27
25
  import type { NextApiRequest, NextApiResponse } from 'next';
26
+ import type * as v from 'valibot';
28
27
 
29
28
  /**
30
29
  * Business logic for exchanging OAuth tokens
@@ -9,8 +9,6 @@
9
9
  * @author AMBROISE PARK Consulting
10
10
  */
11
11
 
12
- import * as v from 'valibot';
13
-
14
12
  import {
15
13
  grantGitHubAccessSchema,
16
14
  type GrantGitHubAccessRequest,
@@ -21,6 +19,7 @@ import { GitHubApiService } from '../../../shared/index.js';
21
19
  import { createVercelBaseFunction } from '../../baseFunction.js';
22
20
 
23
21
  import type { NextApiRequest, NextApiResponse } from 'next';
22
+ import type * as v from 'valibot';
24
23
 
25
24
  /**
26
25
  * Business logic for granting GitHub access
@@ -11,14 +11,15 @@
11
11
 
12
12
  import * as v from 'valibot';
13
13
 
14
+ import type { SecurityContext } from '@donotdev/core';
15
+
14
16
  import { handleError, DoNotDevError } from '../shared/errorHandling.js';
17
+ import { verifyAuthToken } from '../shared/utils/internal/auth.js';
15
18
  import { recordPaymentMetrics } from '../shared/utils/internal/monitoring.js';
16
19
  import {
17
20
  checkRateLimitWithFirestore,
18
21
  DEFAULT_RATE_LIMITS,
19
22
  } from '../shared/utils/internal/rateLimiter.js';
20
- import { verifyAuthToken } from '../shared/utils/internal/auth.js';
21
- import type { SecurityContext } from '@donotdev/core';
22
23
 
23
24
  import type { AuthProvider } from '../shared/utils/internal/auth.js';
24
25
  import type { NextApiRequest, NextApiResponse } from 'next';