@revealui/services 0.0.2 → 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.
Files changed (112) hide show
  1. package/LICENSE +22 -202
  2. package/LICENSE.commercial +112 -0
  3. package/README.md +177 -0
  4. package/dist/api/create-checkout-session/index.d.ts +2 -0
  5. package/dist/api/create-checkout-session/index.d.ts.map +1 -0
  6. package/dist/api/create-checkout-session/index.js +61 -0
  7. package/dist/api/create-checkout-session/index.js.map +1 -0
  8. package/dist/api/create-portal-link/index.d.ts +2 -0
  9. package/dist/api/create-portal-link/index.d.ts.map +1 -0
  10. package/dist/api/create-portal-link/index.js +37 -0
  11. package/dist/api/create-portal-link/index.js.map +1 -0
  12. package/dist/api/handlers/customer-handlers.d.ts +27 -0
  13. package/dist/api/handlers/customer-handlers.d.ts.map +1 -0
  14. package/dist/api/handlers/customer-handlers.js +86 -0
  15. package/dist/api/handlers/customer-handlers.js.map +1 -0
  16. package/dist/api/handlers/index.d.ts +18 -0
  17. package/dist/api/handlers/index.d.ts.map +1 -0
  18. package/dist/api/handlers/index.js +18 -0
  19. package/dist/api/handlers/index.js.map +1 -0
  20. package/dist/api/handlers/invoice-handlers.d.ts +9 -0
  21. package/dist/api/handlers/invoice-handlers.d.ts.map +1 -0
  22. package/dist/api/handlers/invoice-handlers.js +52 -0
  23. package/dist/api/handlers/invoice-handlers.js.map +1 -0
  24. package/dist/api/handlers/payment-handlers.d.ts +13 -0
  25. package/dist/api/handlers/payment-handlers.d.ts.map +1 -0
  26. package/dist/api/handlers/payment-handlers.js +133 -0
  27. package/dist/api/handlers/payment-handlers.js.map +1 -0
  28. package/dist/api/handlers/payment-intent.d.ts +21 -0
  29. package/dist/api/handlers/payment-intent.d.ts.map +1 -0
  30. package/dist/api/handlers/payment-intent.js +87 -0
  31. package/dist/api/handlers/payment-intent.js.map +1 -0
  32. package/dist/api/handlers/product-handlers.d.ts +11 -0
  33. package/dist/api/handlers/product-handlers.d.ts.map +1 -0
  34. package/dist/api/handlers/product-handlers.js +43 -0
  35. package/dist/api/handlers/product-handlers.js.map +1 -0
  36. package/dist/api/handlers/subscription-handlers.d.ts +13 -0
  37. package/dist/api/handlers/subscription-handlers.d.ts.map +1 -0
  38. package/dist/api/handlers/subscription-handlers.js +115 -0
  39. package/dist/api/handlers/subscription-handlers.js.map +1 -0
  40. package/dist/api/index.d.ts +8 -0
  41. package/dist/api/index.d.ts.map +1 -0
  42. package/dist/api/index.js +8 -0
  43. package/dist/api/index.js.map +1 -0
  44. package/dist/api/types/stripe.d.ts +42 -0
  45. package/dist/api/types/stripe.d.ts.map +1 -0
  46. package/dist/api/types/stripe.js +72 -0
  47. package/dist/api/types/stripe.js.map +1 -0
  48. package/dist/api/update-price/index.d.ts +42 -0
  49. package/dist/api/update-price/index.d.ts.map +1 -0
  50. package/dist/api/update-price/index.js +78 -0
  51. package/dist/api/update-price/index.js.map +1 -0
  52. package/dist/api/update-product/index.d.ts +44 -0
  53. package/dist/api/update-product/index.d.ts.map +1 -0
  54. package/dist/api/update-product/index.js +85 -0
  55. package/dist/api/update-product/index.js.map +1 -0
  56. package/dist/api/utils.d.ts +34 -0
  57. package/dist/api/utils.d.ts.map +1 -0
  58. package/dist/api/utils.js +66 -0
  59. package/dist/api/utils.js.map +1 -0
  60. package/dist/api/webhooks/index.d.ts +2 -0
  61. package/dist/api/webhooks/index.d.ts.map +1 -0
  62. package/dist/api/webhooks/index.js +270 -0
  63. package/dist/api/webhooks/index.js.map +1 -0
  64. package/dist/client/index.d.ts +11 -0
  65. package/dist/client/index.d.ts.map +1 -0
  66. package/dist/client/index.js +12 -0
  67. package/dist/client/index.js.map +1 -0
  68. package/dist/index.d.ts +35 -0
  69. package/dist/index.d.ts.map +1 -0
  70. package/dist/index.js +46 -0
  71. package/dist/index.js.map +1 -0
  72. package/dist/stripe/db-circuit-breaker.d.ts +47 -0
  73. package/dist/stripe/db-circuit-breaker.d.ts.map +1 -0
  74. package/dist/stripe/db-circuit-breaker.js +223 -0
  75. package/dist/stripe/db-circuit-breaker.js.map +1 -0
  76. package/dist/stripe/index.d.ts +2 -0
  77. package/dist/stripe/index.d.ts.map +1 -0
  78. package/dist/stripe/index.js +2 -0
  79. package/dist/stripe/index.js.map +1 -0
  80. package/dist/stripe/stripeClient.d.ts +126 -0
  81. package/dist/stripe/stripeClient.d.ts.map +1 -0
  82. package/dist/stripe/stripeClient.js +226 -0
  83. package/dist/stripe/stripeClient.js.map +1 -0
  84. package/dist/supabase/index.d.ts +6 -0
  85. package/dist/supabase/index.d.ts.map +1 -0
  86. package/dist/supabase/index.js +5 -0
  87. package/dist/supabase/index.js.map +1 -0
  88. package/dist/supabase/resilience.d.ts +50 -0
  89. package/dist/supabase/resilience.d.ts.map +1 -0
  90. package/dist/supabase/resilience.js +166 -0
  91. package/dist/supabase/resilience.js.map +1 -0
  92. package/dist/supabase/types.d.ts +206 -0
  93. package/dist/supabase/types.d.ts.map +1 -0
  94. package/dist/supabase/types.js +19 -0
  95. package/dist/supabase/types.js.map +1 -0
  96. package/dist/supabase/utils/client.d.ts +4 -0
  97. package/dist/supabase/utils/client.d.ts.map +1 -0
  98. package/dist/supabase/utils/client.js +12 -0
  99. package/dist/supabase/utils/client.js.map +1 -0
  100. package/dist/supabase/utils/server.d.ts +10 -0
  101. package/dist/supabase/utils/server.d.ts.map +1 -0
  102. package/dist/supabase/utils/server.js +49 -0
  103. package/dist/supabase/utils/server.js.map +1 -0
  104. package/dist/supabase/utils/web.d.ts +4 -0
  105. package/dist/supabase/utils/web.d.ts.map +1 -0
  106. package/dist/supabase/utils/web.js +37 -0
  107. package/dist/supabase/utils/web.js.map +1 -0
  108. package/package.json +70 -54
  109. package/dist/.vite/ssr-manifest.json +0 -209
  110. package/dist/assets/index-Bai9hEWd.js +0 -16
  111. package/dist/assets/index-Bai9hEWd.js.map +0 -1
  112. package/dist/index.html +0 -23
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Supabase Resilience Layer
3
+ *
4
+ * Provides circuit breaker + retry protection for Supabase operations,
5
+ * matching the resilience pattern used in packages/services/src/stripe/stripeClient.ts.
6
+ *
7
+ * NOTE: Circuit breaker state is in-memory (per-instance).
8
+ * TODO: For multi-instance deployments, replace with Redis-backed state.
9
+ * Uses createLogger from @revealui/core. Wire up to alerting when circuit opens.
10
+ */
11
+ type CircuitState = 'closed' | 'open' | 'half-open';
12
+ interface CircuitBreakerState {
13
+ state: CircuitState;
14
+ failures: number;
15
+ lastFailureTime: number;
16
+ successCount: number;
17
+ }
18
+ declare function getCircuitBreaker(operationName: string): CircuitBreakerState;
19
+ declare function recordFailure(operationName: string): void;
20
+ declare function recordSuccess(operationName: string): void;
21
+ declare function isCircuitOpen(operationName: string): boolean;
22
+ /**
23
+ * Wrap a Supabase operation with circuit breaker + exponential-backoff retry.
24
+ *
25
+ * Usage:
26
+ * ```ts
27
+ * const data = await withSupabaseResilience(
28
+ * () => supabase.from('documents').select('*'),
29
+ * 'documents.select',
30
+ * )
31
+ * ```
32
+ */
33
+ export declare function withSupabaseResilience<T>(operation: () => Promise<T>, operationName: string): Promise<T>;
34
+ export declare const __supabaseCircuitBreakers: Map<string, CircuitBreakerState>;
35
+ export declare const __supabaseCircuitBreakerConfig: {
36
+ failureThreshold: number;
37
+ resetTimeout: number;
38
+ successThreshold: number;
39
+ };
40
+ export declare const __supabaseRetryConfig: {
41
+ maxAttempts: number;
42
+ backoff: readonly [100, 200, 400];
43
+ timeout: number;
44
+ };
45
+ export declare const __supabaseGetCircuitBreaker: typeof getCircuitBreaker;
46
+ export declare const __supabaseRecordFailure: typeof recordFailure;
47
+ export declare const __supabaseRecordSuccess: typeof recordSuccess;
48
+ export declare const __supabaseIsCircuitOpen: typeof isCircuitOpen;
49
+ export {};
50
+ //# sourceMappingURL=resilience.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resilience.d.ts","sourceRoot":"","sources":["../../src/supabase/resilience.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAUH,KAAK,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAA;AAEnD,UAAU,mBAAmB;IAC3B,KAAK,EAAE,YAAY,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;CACrB;AAwBD,iBAAS,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,mBAAmB,CAWrE;AAED,iBAAS,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAelD;AAED,iBAAS,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAelD;AAED,iBAAS,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAgBrD;AAuBD;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAAC,CAAC,EAC5C,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,CAAC,CAAC,CA0DZ;AAGD,eAAO,MAAM,yBAAyB,kCAAkB,CAAA;AACxD,eAAO,MAAM,8BAA8B;;;;CAAyB,CAAA;AACpE,eAAO,MAAM,qBAAqB;;;;CAAe,CAAA;AACjD,eAAO,MAAM,2BAA2B,0BAAoB,CAAA;AAC5D,eAAO,MAAM,uBAAuB,sBAAgB,CAAA;AACpD,eAAO,MAAM,uBAAuB,sBAAgB,CAAA;AACpD,eAAO,MAAM,uBAAuB,sBAAgB,CAAA"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Supabase Resilience Layer
3
+ *
4
+ * Provides circuit breaker + retry protection for Supabase operations,
5
+ * matching the resilience pattern used in packages/services/src/stripe/stripeClient.ts.
6
+ *
7
+ * NOTE: Circuit breaker state is in-memory (per-instance).
8
+ * TODO: For multi-instance deployments, replace with Redis-backed state.
9
+ * Uses createLogger from @revealui/core. Wire up to alerting when circuit opens.
10
+ */
11
+ import { createLogger } from '@revealui/core/observability/logger';
12
+ const logger = createLogger({ service: 'Supabase' });
13
+ // ---------------------------------------------------------------------------
14
+ // Configuration — mirrors Stripe circuit breaker config for consistency
15
+ // ---------------------------------------------------------------------------
16
+ const CIRCUIT_BREAKER_CONFIG = {
17
+ failureThreshold: 5,
18
+ resetTimeout: 30_000,
19
+ successThreshold: 2,
20
+ };
21
+ const RETRY_CONFIG = {
22
+ maxAttempts: 3,
23
+ backoff: [100, 200, 400],
24
+ timeout: 10_000,
25
+ };
26
+ // ---------------------------------------------------------------------------
27
+ // Circuit breaker state store (in-memory)
28
+ // ---------------------------------------------------------------------------
29
+ const circuitBreakers = new Map();
30
+ function getCircuitBreaker(operationName) {
31
+ if (!circuitBreakers.has(operationName)) {
32
+ circuitBreakers.set(operationName, {
33
+ state: 'closed',
34
+ failures: 0,
35
+ lastFailureTime: 0,
36
+ successCount: 0,
37
+ });
38
+ }
39
+ // biome-ignore lint/style/noNonNullAssertion: just set above
40
+ return circuitBreakers.get(operationName);
41
+ }
42
+ function recordFailure(operationName) {
43
+ const breaker = getCircuitBreaker(operationName);
44
+ breaker.failures++;
45
+ breaker.lastFailureTime = Date.now();
46
+ if (breaker.failures >= CIRCUIT_BREAKER_CONFIG.failureThreshold) {
47
+ if (breaker.state !== 'open') {
48
+ logger.warn(`Circuit breaker OPENED for Supabase:${operationName}`, {
49
+ failures: breaker.failures,
50
+ threshold: CIRCUIT_BREAKER_CONFIG.failureThreshold,
51
+ });
52
+ }
53
+ breaker.state = 'open';
54
+ breaker.successCount = 0;
55
+ }
56
+ }
57
+ function recordSuccess(operationName) {
58
+ const breaker = getCircuitBreaker(operationName);
59
+ breaker.failures = 0;
60
+ if (breaker.state === 'half-open') {
61
+ breaker.successCount++;
62
+ if (breaker.successCount >= CIRCUIT_BREAKER_CONFIG.successThreshold) {
63
+ logger.info(`Circuit breaker CLOSED for Supabase:${operationName}`);
64
+ breaker.state = 'closed';
65
+ breaker.successCount = 0;
66
+ }
67
+ }
68
+ else if (breaker.state === 'open') {
69
+ breaker.state = 'closed';
70
+ breaker.successCount = 0;
71
+ }
72
+ }
73
+ function isCircuitOpen(operationName) {
74
+ const breaker = getCircuitBreaker(operationName);
75
+ if (breaker.state === 'closed')
76
+ return false;
77
+ if (breaker.state === 'open') {
78
+ const elapsed = Date.now() - breaker.lastFailureTime;
79
+ if (elapsed >= CIRCUIT_BREAKER_CONFIG.resetTimeout) {
80
+ breaker.state = 'half-open';
81
+ breaker.successCount = 0;
82
+ return false;
83
+ }
84
+ return true;
85
+ }
86
+ return false; // half-open: allow one attempt
87
+ }
88
+ // ---------------------------------------------------------------------------
89
+ // Helpers
90
+ // ---------------------------------------------------------------------------
91
+ function sleep(ms) {
92
+ return new Promise((resolve) => setTimeout(resolve, ms));
93
+ }
94
+ function withTimeout(promise, ms) {
95
+ return Promise.race([
96
+ promise,
97
+ new Promise((_, reject) => setTimeout(() => reject(new Error(`Supabase operation timed out after ${ms}ms`)), ms)),
98
+ ]);
99
+ }
100
+ // ---------------------------------------------------------------------------
101
+ // Public API
102
+ // ---------------------------------------------------------------------------
103
+ /**
104
+ * Wrap a Supabase operation with circuit breaker + exponential-backoff retry.
105
+ *
106
+ * Usage:
107
+ * ```ts
108
+ * const data = await withSupabaseResilience(
109
+ * () => supabase.from('documents').select('*'),
110
+ * 'documents.select',
111
+ * )
112
+ * ```
113
+ */
114
+ export async function withSupabaseResilience(operation, operationName) {
115
+ if (isCircuitOpen(operationName)) {
116
+ logger.error(`Circuit breaker OPEN for Supabase:${operationName}`, undefined, {
117
+ operation: operationName,
118
+ state: 'open',
119
+ });
120
+ throw new Error(`Circuit breaker is OPEN for Supabase:${operationName}. Service may be unavailable.`);
121
+ }
122
+ let lastError;
123
+ for (let attempt = 0; attempt < RETRY_CONFIG.maxAttempts; attempt++) {
124
+ try {
125
+ const result = await withTimeout(operation(), RETRY_CONFIG.timeout);
126
+ recordSuccess(operationName);
127
+ return result;
128
+ }
129
+ catch (error) {
130
+ lastError = error;
131
+ const isRetryable = error instanceof Error &&
132
+ (error.message.includes('timeout') ||
133
+ error.message.includes('ECONNREFUSED') ||
134
+ error.message.includes('ETIMEDOUT') ||
135
+ error.message.includes('network') ||
136
+ error.message.includes('fetch failed'));
137
+ if (!isRetryable) {
138
+ recordFailure(operationName);
139
+ logger.error(`Supabase:${operationName} failed (non-retryable)`, error instanceof Error ? error : new Error(String(error)), { attempt: attempt + 1 });
140
+ throw error;
141
+ }
142
+ logger.warn(`Supabase:${operationName} failed (retryable), retrying...`, {
143
+ attempt: attempt + 1,
144
+ maxAttempts: RETRY_CONFIG.maxAttempts,
145
+ error: error instanceof Error ? error.message : String(error),
146
+ });
147
+ if (attempt < RETRY_CONFIG.maxAttempts - 1) {
148
+ const backoffMs = RETRY_CONFIG.backoff[attempt] ?? RETRY_CONFIG.backoff.at(-1) ?? 1000;
149
+ await sleep(backoffMs);
150
+ }
151
+ }
152
+ }
153
+ recordFailure(operationName);
154
+ throw lastError instanceof Error
155
+ ? new Error(`Supabase:${operationName} failed after ${RETRY_CONFIG.maxAttempts} attempts: ${lastError.message}`)
156
+ : new Error(`Supabase:${operationName} failed after ${RETRY_CONFIG.maxAttempts} attempts`);
157
+ }
158
+ // Test-only exports
159
+ export const __supabaseCircuitBreakers = circuitBreakers;
160
+ export const __supabaseCircuitBreakerConfig = CIRCUIT_BREAKER_CONFIG;
161
+ export const __supabaseRetryConfig = RETRY_CONFIG;
162
+ export const __supabaseGetCircuitBreaker = getCircuitBreaker;
163
+ export const __supabaseRecordFailure = recordFailure;
164
+ export const __supabaseRecordSuccess = recordSuccess;
165
+ export const __supabaseIsCircuitOpen = isCircuitOpen;
166
+ //# sourceMappingURL=resilience.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resilience.js","sourceRoot":"","sources":["../../src/supabase/resilience.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAElE,MAAM,MAAM,GAAG,YAAY,CAAC,EAAE,OAAO,EAAE,UAA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,IAAI,CAAA;gBACtF,MAAM,KAAK,CAAC,SAAS,CAAC,CAAA;YACxB,CAAC;QACH,CAAC;IACH,CAAC;IAED,aAAa,CAAC,aAAa,CAAC,CAAA;IAC5B,MAAM,SAAS,YAAY,KAAK;QAC9B,CAAC,CAAC,IAAI,KAAK,CACP,YAAY,aAAa,iBAAiB,YAAY,CAAC,WAAW,cAAc,SAAS,CAAC,OAAO,EAAE,CACpG;QACH,CAAC,CAAC,IAAI,KAAK,CAAC,YAAY,aAAa,iBAAiB,YAAY,CAAC,WAAW,WAAW,CAAC,CAAA;AAC9F,CAAC;AAED,oBAAoB;AACpB,MAAM,CAAC,MAAM,yBAAyB,GAAG,eAAe,CAAA;AACxD,MAAM,CAAC,MAAM,8BAA8B,GAAG,sBAAsB,CAAA;AACpE,MAAM,CAAC,MAAM,qBAAqB,GAAG,YAAY,CAAA;AACjD,MAAM,CAAC,MAAM,2BAA2B,GAAG,iBAAiB,CAAA;AAC5D,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAA;AACpD,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAA;AACpD,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAA"}
@@ -0,0 +1,206 @@
1
+ /**
2
+ * Supabase Database Types (Billing Tables)
3
+ *
4
+ * Manually maintained types for the 4 Supabase billing tables:
5
+ * users, products, prices, subscriptions.
6
+ *
7
+ * These tables live in Supabase (NOT NeonDB) and are used by the
8
+ * Stripe billing integration. The schema rarely changes.
9
+ *
10
+ * Originally generated by `supabase gen types typescript` (PostgREST 13.0.5).
11
+ * If the Supabase billing schema changes, regenerate with:
12
+ * npx supabase gen types typescript --project-id <id> > this-file.ts
13
+ */
14
+ export type Json = string | number | boolean | null | {
15
+ [key: string]: Json | undefined;
16
+ } | Json[];
17
+ export type Database = {
18
+ __InternalSupabase: {
19
+ PostgrestVersion: '13.0.5';
20
+ };
21
+ public: {
22
+ Tables: {
23
+ prices: {
24
+ Row: {
25
+ created_at: string | null;
26
+ id: string;
27
+ price_j_s_o_n: string;
28
+ updated_at: string | null;
29
+ };
30
+ Insert: {
31
+ created_at?: string | null;
32
+ id?: string;
33
+ price_j_s_o_n: string;
34
+ updated_at?: string | null;
35
+ };
36
+ Update: {
37
+ created_at?: string | null;
38
+ id?: string;
39
+ price_j_s_o_n?: string;
40
+ updated_at?: string | null;
41
+ };
42
+ Relationships: [];
43
+ };
44
+ products: {
45
+ Row: {
46
+ created_at: string | null;
47
+ id: string;
48
+ price_j_s_o_n: string | null;
49
+ stripe_product_i_d: string;
50
+ title: string;
51
+ updated_at: string | null;
52
+ };
53
+ Insert: {
54
+ created_at?: string | null;
55
+ id?: string;
56
+ price_j_s_o_n?: string | null;
57
+ stripe_product_i_d: string;
58
+ title: string;
59
+ updated_at?: string | null;
60
+ };
61
+ Update: {
62
+ created_at?: string | null;
63
+ id?: string;
64
+ price_j_s_o_n?: string | null;
65
+ stripe_product_i_d?: string;
66
+ title?: string;
67
+ updated_at?: string | null;
68
+ };
69
+ Relationships: [];
70
+ };
71
+ subscriptions: {
72
+ Row: {
73
+ created_at: string | null;
74
+ id: string;
75
+ metadata: Json | null;
76
+ price_id: string | null;
77
+ status: string;
78
+ stripe_subscription_id: string;
79
+ updated_at: string | null;
80
+ user_id: string | null;
81
+ };
82
+ Insert: {
83
+ created_at?: string | null;
84
+ id?: string;
85
+ metadata?: Json | null;
86
+ price_id?: string | null;
87
+ status: string;
88
+ stripe_subscription_id: string;
89
+ updated_at?: string | null;
90
+ user_id?: string | null;
91
+ };
92
+ Update: {
93
+ created_at?: string | null;
94
+ id?: string;
95
+ metadata?: Json | null;
96
+ price_id?: string | null;
97
+ status?: string;
98
+ stripe_subscription_id?: string;
99
+ updated_at?: string | null;
100
+ user_id?: string | null;
101
+ };
102
+ Relationships: [
103
+ {
104
+ foreignKeyName: 'subscriptions_user_id_fkey';
105
+ columns: ['user_id'];
106
+ isOneToOne: false;
107
+ referencedRelation: 'users';
108
+ referencedColumns: ['id'];
109
+ }
110
+ ];
111
+ };
112
+ users: {
113
+ Row: {
114
+ created_at: string | null;
115
+ email: string;
116
+ id: string;
117
+ stripe_customer_id: string | null;
118
+ updated_at: string | null;
119
+ };
120
+ Insert: {
121
+ created_at?: string | null;
122
+ email: string;
123
+ id?: string;
124
+ stripe_customer_id?: string | null;
125
+ updated_at?: string | null;
126
+ };
127
+ Update: {
128
+ created_at?: string | null;
129
+ email?: string;
130
+ id?: string;
131
+ stripe_customer_id?: string | null;
132
+ updated_at?: string | null;
133
+ };
134
+ Relationships: [];
135
+ };
136
+ };
137
+ Views: {
138
+ [_ in never]: never;
139
+ };
140
+ Functions: {
141
+ [_ in never]: never;
142
+ };
143
+ Enums: {
144
+ [_ in never]: never;
145
+ };
146
+ CompositeTypes: {
147
+ [_ in never]: never;
148
+ };
149
+ };
150
+ };
151
+ type DatabaseWithoutInternals = Omit<Database, '__InternalSupabase'>;
152
+ type DefaultSchema = DatabaseWithoutInternals[Extract<keyof Database, 'public'>];
153
+ export type Tables<DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema['Tables'] & DefaultSchema['Views']) | {
154
+ schema: keyof DatabaseWithoutInternals;
155
+ }, TableName extends DefaultSchemaTableNameOrOptions extends {
156
+ schema: keyof DatabaseWithoutInternals;
157
+ } ? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] & DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Views']) : never = never> = DefaultSchemaTableNameOrOptions extends {
158
+ schema: keyof DatabaseWithoutInternals;
159
+ } ? (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] & DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Views'])[TableName] extends {
160
+ Row: infer R;
161
+ } ? R : never : DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema['Tables'] & DefaultSchema['Views']) ? (DefaultSchema['Tables'] & DefaultSchema['Views'])[DefaultSchemaTableNameOrOptions] extends {
162
+ Row: infer R;
163
+ } ? R : never : never;
164
+ export type TablesInsert<DefaultSchemaTableNameOrOptions extends keyof DefaultSchema['Tables'] | {
165
+ schema: keyof DatabaseWithoutInternals;
166
+ }, TableName extends DefaultSchemaTableNameOrOptions extends {
167
+ schema: keyof DatabaseWithoutInternals;
168
+ } ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] : never = never> = DefaultSchemaTableNameOrOptions extends {
169
+ schema: keyof DatabaseWithoutInternals;
170
+ } ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'][TableName] extends {
171
+ Insert: infer I;
172
+ } ? I : never : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema['Tables'] ? DefaultSchema['Tables'][DefaultSchemaTableNameOrOptions] extends {
173
+ Insert: infer I;
174
+ } ? I : never : never;
175
+ export type TablesUpdate<DefaultSchemaTableNameOrOptions extends keyof DefaultSchema['Tables'] | {
176
+ schema: keyof DatabaseWithoutInternals;
177
+ }, TableName extends DefaultSchemaTableNameOrOptions extends {
178
+ schema: keyof DatabaseWithoutInternals;
179
+ } ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'] : never = never> = DefaultSchemaTableNameOrOptions extends {
180
+ schema: keyof DatabaseWithoutInternals;
181
+ } ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions['schema']]['Tables'][TableName] extends {
182
+ Update: infer U;
183
+ } ? U : never : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema['Tables'] ? DefaultSchema['Tables'][DefaultSchemaTableNameOrOptions] extends {
184
+ Update: infer U;
185
+ } ? U : never : never;
186
+ export type Enums<DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema['Enums'] | {
187
+ schema: keyof DatabaseWithoutInternals;
188
+ }, EnumName extends DefaultSchemaEnumNameOrOptions extends {
189
+ schema: keyof DatabaseWithoutInternals;
190
+ } ? keyof DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions['schema']]['Enums'] : never = never> = DefaultSchemaEnumNameOrOptions extends {
191
+ schema: keyof DatabaseWithoutInternals;
192
+ } ? DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions['schema']]['Enums'][EnumName] : DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema['Enums'] ? DefaultSchema['Enums'][DefaultSchemaEnumNameOrOptions] : never;
193
+ export type CompositeTypes<PublicCompositeTypeNameOrOptions extends keyof DefaultSchema['CompositeTypes'] | {
194
+ schema: keyof DatabaseWithoutInternals;
195
+ }, CompositeTypeName extends PublicCompositeTypeNameOrOptions extends {
196
+ schema: keyof DatabaseWithoutInternals;
197
+ } ? keyof DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions['schema']]['CompositeTypes'] : never = never> = PublicCompositeTypeNameOrOptions extends {
198
+ schema: keyof DatabaseWithoutInternals;
199
+ } ? DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions['schema']]['CompositeTypes'][CompositeTypeName] : PublicCompositeTypeNameOrOptions extends keyof DefaultSchema['CompositeTypes'] ? DefaultSchema['CompositeTypes'][PublicCompositeTypeNameOrOptions] : never;
200
+ export declare const Constants: {
201
+ readonly public: {
202
+ readonly Enums: {};
203
+ };
204
+ };
205
+ export {};
206
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/supabase/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,GAAG,IAAI,EAAE,CAAA;AAElG,MAAM,MAAM,QAAQ,GAAG;IAGrB,kBAAkB,EAAE;QAClB,gBAAgB,EAAE,QAAQ,CAAA;KAC3B,CAAA;IACD,MAAM,EAAE;QACN,MAAM,EAAE;YACN,MAAM,EAAE;gBAC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A;CACvC,GACG,MAAM,wBAAwB,CAAC,gCAAgC,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAC5F,KAAK,GAAG,KAAK,IACf,gCAAgC,SAAS;IAC3C,MAAM,EAAE,MAAM,wBAAwB,CAAA;CACvC,GACG,wBAAwB,CAAC,gCAAgC,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,iBAAiB,CAAC,GACzG,gCAAgC,SAAS,MAAM,aAAa,CAAC,gBAAgB,CAAC,GAC5E,aAAa,CAAC,gBAAgB,CAAC,CAAC,gCAAgC,CAAC,GACjE,KAAK,CAAA;AAEX,eAAO,MAAM,SAAS;;;;CAIZ,CAAA"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Supabase Database Types (Billing Tables)
3
+ *
4
+ * Manually maintained types for the 4 Supabase billing tables:
5
+ * users, products, prices, subscriptions.
6
+ *
7
+ * These tables live in Supabase (NOT NeonDB) and are used by the
8
+ * Stripe billing integration. The schema rarely changes.
9
+ *
10
+ * Originally generated by `supabase gen types typescript` (PostgREST 13.0.5).
11
+ * If the Supabase billing schema changes, regenerate with:
12
+ * npx supabase gen types typescript --project-id <id> > this-file.ts
13
+ */
14
+ export const Constants = {
15
+ public: {
16
+ Enums: {},
17
+ },
18
+ };
19
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/supabase/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAgQH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,MAAM,EAAE;QACN,KAAK,EAAE,EAAE;KACV;CACO,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { createBrowserClient } from '@supabase/ssr';
2
+ import type { Database } from '../types.js';
3
+ export default function createClient(): ReturnType<typeof createBrowserClient<Database>> | null;
4
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/supabase/utils/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,CAAC,OAAO,UAAU,YAAY,IAAI,UAAU,CAAC,OAAO,mBAAmB,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAU9F"}
@@ -0,0 +1,12 @@
1
+ 'use client';
2
+ import { createBrowserClient } from '@supabase/ssr';
3
+ export default function createClient() {
4
+ const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
5
+ const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
6
+ // Return null during build if credentials not available
7
+ if (!(supabaseUrl && supabaseKey)) {
8
+ return null;
9
+ }
10
+ return createBrowserClient(supabaseUrl, supabaseKey);
11
+ }
12
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/supabase/utils/client.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAGnD,MAAM,CAAC,OAAO,UAAU,YAAY;IAClC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAA;IACxD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAA;IAE7D,wDAAwD;IACxD,IAAI,CAAC,CAAC,WAAW,IAAI,WAAW,CAAC,EAAE,CAAC;QAClC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,mBAAmB,CAAW,WAAW,EAAE,WAAW,CAAC,CAAA;AAChE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { IncomingMessage, ServerResponse } from 'node:http';
2
+ import { createServerClient } from '@supabase/ssr';
3
+ import type { Database } from '../types.js';
4
+ interface Context {
5
+ req: IncomingMessage;
6
+ res: ServerResponse;
7
+ }
8
+ export default function createClient(context: Context): ReturnType<typeof createServerClient<Database>> | null;
9
+ export {};
10
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/supabase/utils/server.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAA4C,MAAM,eAAe,CAAA;AAC5F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,UAAU,OAAO;IACf,GAAG,EAAE,eAAe,CAAA;IACpB,GAAG,EAAE,cAAc,CAAA;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,OAAO,EAAE,OAAO,GACf,UAAU,CAAC,OAAO,kBAAkB,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CA4BxD"}
@@ -0,0 +1,49 @@
1
+ // import { DEFAULT_COOKIE_OPTIONS } from "@supabase/ssr";
2
+ // import { supabaseServerClient } from "./supabaseServerClient";
3
+ // import { supabaseBrowserClient } from "./supabaseBrowserClient";
4
+ // export const supabaseServer = supabaseServerClient(DEFAULT_COOKIE_OPTIONS);
5
+ // export const supabaseBrowser = supabaseBrowserClient();
6
+ import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr';
7
+ export default function createClient(context) {
8
+ const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
9
+ const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
10
+ // Return null during build if credentials not available
11
+ if (!(supabaseUrl && supabaseKey)) {
12
+ return null;
13
+ }
14
+ const cookies = parseCookieHeader(context.req.headers.cookie ?? '');
15
+ return createServerClient(supabaseUrl, supabaseKey, {
16
+ cookies: {
17
+ getAll() {
18
+ return Promise.resolve(cookies.map((c) => ({
19
+ name: c.name,
20
+ value: c.value || '',
21
+ })));
22
+ },
23
+ setAll(cookiesToSet) {
24
+ cookiesToSet.forEach(({ name, value, options }) => {
25
+ context.res.appendHeader('Set-Cookie', serializeCookieHeader(name, value, options));
26
+ });
27
+ },
28
+ },
29
+ });
30
+ }
31
+ // {
32
+ // cookies: {
33
+ // getAll() {
34
+ // return cookieStore.getAll();
35
+ // },
36
+ // setAll(cookiesToSet) {
37
+ // try {
38
+ // cookiesToSet.forEach(({ name, value, options }) =>
39
+ // cookieStore.set(name, value, options),
40
+ // );
41
+ // } catch {
42
+ // // The `setAll` method was called from a Server Component.
43
+ // // This can be ignored if you have middleware refreshing
44
+ // // user sessions.
45
+ // }
46
+ // },
47
+ // },
48
+ // },
49
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/supabase/utils/server.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,iEAAiE;AACjE,mEAAmE;AACnE,8EAA8E;AAC9E,0DAA0D;AAG1D,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAQ5F,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,OAAgB;IAEhB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAA;IACxD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAA;IAE7D,wDAAwD;IACxD,IAAI,CAAC,CAAC,WAAW,IAAI,WAAW,CAAC,EAAE,CAAC;QAClC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAA;IAEnE,OAAO,kBAAkB,CAAW,WAAW,EAAE,WAAW,EAAE;QAC5D,OAAO,EAAE;YACP,MAAM;gBACJ,OAAO,OAAO,CAAC,OAAO,CACpB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;oBAClB,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,KAAK,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE;iBACrB,CAAC,CAAC,CACJ,CAAA;YACH,CAAC;YACD,MAAM,CAAC,YAAY;gBACjB,YAAY,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE;oBAChD,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,YAAY,EAAE,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;gBACrF,CAAC,CAAC,CAAA;YACJ,CAAC;SACF;KACF,CAAC,CAAA;AACJ,CAAC;AACD,IAAI;AACJ,eAAe;AACf,iBAAiB;AACjB,qCAAqC;AACrC,SAAS;AACT,6BAA6B;AAC7B,cAAc;AACd,6DAA6D;AAC7D,mDAAmD;AACnD,aAAa;AACb,kBAAkB;AAClB,qEAAqE;AACrE,mEAAmE;AACnE,4BAA4B;AAC5B,UAAU;AACV,SAAS;AACT,OAAO;AACP,KAAK"}
@@ -0,0 +1,4 @@
1
+ import { createServerClient as createSSRClient } from '@supabase/ssr';
2
+ import type { Database } from '../types.js';
3
+ export declare function createServerClientFromRequest(request: Request): ReturnType<typeof createSSRClient<Database>> | null;
4
+ //# sourceMappingURL=web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../../src/supabase/utils/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,IAAI,eAAe,EAAE,MAAM,eAAe,CAAA;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,OAAO,GACf,UAAU,CAAC,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAqCrD"}
@@ -0,0 +1,37 @@
1
+ import { createServerClient as createSSRClient } from '@supabase/ssr';
2
+ export function createServerClientFromRequest(request) {
3
+ const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
4
+ const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
5
+ if (!(supabaseUrl && supabaseKey)) {
6
+ return null;
7
+ }
8
+ const client = createSSRClient(supabaseUrl, supabaseKey, {
9
+ cookies: {
10
+ getAll() {
11
+ const cookieHeader = request.headers.get('cookie') || '';
12
+ // Parse cookies from header
13
+ if (!cookieHeader) {
14
+ return Promise.resolve([]);
15
+ }
16
+ const cookies = cookieHeader.split(';').map((c) => {
17
+ const trimmed = c.trim();
18
+ const equalIndex = trimmed.indexOf('=');
19
+ if (equalIndex === -1) {
20
+ return { name: trimmed, value: '' };
21
+ }
22
+ const name = trimmed.slice(0, equalIndex);
23
+ const value = trimmed.slice(equalIndex + 1);
24
+ return { name, value };
25
+ });
26
+ return Promise.resolve(cookies);
27
+ },
28
+ setAll() {
29
+ // In serverless/Web API environment, we can't set cookies directly here
30
+ // Cookies should be set via Response headers in the route handler
31
+ // This is a no-op here - actual cookie setting happens in route handler
32
+ },
33
+ },
34
+ });
35
+ return client;
36
+ }
37
+ //# sourceMappingURL=web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../../src/supabase/utils/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,IAAI,eAAe,EAAE,MAAM,eAAe,CAAA;AAGrE,MAAM,UAAU,6BAA6B,CAC3C,OAAgB;IAEhB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAA;IACxD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAA;IAE7D,IAAI,CAAC,CAAC,WAAW,IAAI,WAAW,CAAC,EAAE,CAAC;QAClC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,MAAM,GAAG,eAAe,CAAW,WAAW,EAAE,WAAW,EAAE;QACjE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