stripe-experiment-sync 1.0.6 → 1.0.8

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.
@@ -0,0 +1,69 @@
1
+ interface Config {
2
+ stripeApiKey: string;
3
+ ngrokAuthToken?: string;
4
+ databaseUrl: string;
5
+ }
6
+ interface CliOptions {
7
+ stripeKey?: string;
8
+ ngrokToken?: string;
9
+ databaseUrl?: string;
10
+ }
11
+ /**
12
+ * Load configuration from .env file, environment variables, and interactive prompts.
13
+ * Values are masked with *** when prompting for sensitive information.
14
+ */
15
+ declare function loadConfig(options: CliOptions): Promise<Config>;
16
+
17
+ interface DeployOptions {
18
+ supabaseAccessToken?: string;
19
+ supabaseProjectRef?: string;
20
+ stripeKey?: string;
21
+ packageVersion?: string;
22
+ }
23
+
24
+ /**
25
+ * Backfill command - backfills a specific entity type from Stripe.
26
+ */
27
+ declare function backfillCommand(options: CliOptions, entityName: string): Promise<void>;
28
+ /**
29
+ * Migration command - runs database migrations only.
30
+ */
31
+ declare function migrateCommand(options: CliOptions): Promise<void>;
32
+ /**
33
+ * Main sync command - syncs Stripe data to PostgreSQL using webhooks for real-time updates.
34
+ * Supports two modes:
35
+ * - WebSocket mode (default): Direct connection to Stripe via WebSocket, no ngrok needed
36
+ * - Webhook mode: Uses ngrok tunnel + Express server (when NGROK_AUTH_TOKEN is provided)
37
+ */
38
+ declare function syncCommand(options: CliOptions): Promise<void>;
39
+ /**
40
+ * Install command - installs Stripe sync Edge Functions to Supabase.
41
+ * 1. Validates Supabase project access
42
+ * 2. Deploys stripe-setup, stripe-webhook, and stripe-worker Edge Functions
43
+ * 3. Sets required secrets (STRIPE_SECRET_KEY)
44
+ * 4. Runs the setup function to create webhook and run migrations
45
+ */
46
+ declare function installCommand(options: DeployOptions): Promise<void>;
47
+ /**
48
+ * Uninstall command - removes Stripe sync Edge Functions and resources from Supabase.
49
+ * 1. Validates Supabase project access
50
+ * 2. Deletes Stripe webhooks
51
+ * 3. Deletes Edge Functions (stripe-setup, stripe-webhook, stripe-worker)
52
+ * 4. Deletes secrets and pg_cron jobs
53
+ * 5. Drops the stripe schema
54
+ */
55
+ declare function uninstallCommand(options: DeployOptions): Promise<void>;
56
+
57
+ interface NgrokTunnel {
58
+ url: string;
59
+ close: () => Promise<void>;
60
+ }
61
+ /**
62
+ * Create an ngrok tunnel to expose the local server to the internet.
63
+ * @param port - The local port to expose
64
+ * @param authToken - ngrok authentication token
65
+ * @returns The tunnel URL and a close function
66
+ */
67
+ declare function createTunnel(port: number, authToken: string): Promise<NgrokTunnel>;
68
+
69
+ export { type CliOptions, type Config, type DeployOptions, type NgrokTunnel, backfillCommand, createTunnel, installCommand, loadConfig, migrateCommand, syncCommand, uninstallCommand };
@@ -0,0 +1,69 @@
1
+ interface Config {
2
+ stripeApiKey: string;
3
+ ngrokAuthToken?: string;
4
+ databaseUrl: string;
5
+ }
6
+ interface CliOptions {
7
+ stripeKey?: string;
8
+ ngrokToken?: string;
9
+ databaseUrl?: string;
10
+ }
11
+ /**
12
+ * Load configuration from .env file, environment variables, and interactive prompts.
13
+ * Values are masked with *** when prompting for sensitive information.
14
+ */
15
+ declare function loadConfig(options: CliOptions): Promise<Config>;
16
+
17
+ interface DeployOptions {
18
+ supabaseAccessToken?: string;
19
+ supabaseProjectRef?: string;
20
+ stripeKey?: string;
21
+ packageVersion?: string;
22
+ }
23
+
24
+ /**
25
+ * Backfill command - backfills a specific entity type from Stripe.
26
+ */
27
+ declare function backfillCommand(options: CliOptions, entityName: string): Promise<void>;
28
+ /**
29
+ * Migration command - runs database migrations only.
30
+ */
31
+ declare function migrateCommand(options: CliOptions): Promise<void>;
32
+ /**
33
+ * Main sync command - syncs Stripe data to PostgreSQL using webhooks for real-time updates.
34
+ * Supports two modes:
35
+ * - WebSocket mode (default): Direct connection to Stripe via WebSocket, no ngrok needed
36
+ * - Webhook mode: Uses ngrok tunnel + Express server (when NGROK_AUTH_TOKEN is provided)
37
+ */
38
+ declare function syncCommand(options: CliOptions): Promise<void>;
39
+ /**
40
+ * Install command - installs Stripe sync Edge Functions to Supabase.
41
+ * 1. Validates Supabase project access
42
+ * 2. Deploys stripe-setup, stripe-webhook, and stripe-worker Edge Functions
43
+ * 3. Sets required secrets (STRIPE_SECRET_KEY)
44
+ * 4. Runs the setup function to create webhook and run migrations
45
+ */
46
+ declare function installCommand(options: DeployOptions): Promise<void>;
47
+ /**
48
+ * Uninstall command - removes Stripe sync Edge Functions and resources from Supabase.
49
+ * 1. Validates Supabase project access
50
+ * 2. Deletes Stripe webhooks
51
+ * 3. Deletes Edge Functions (stripe-setup, stripe-webhook, stripe-worker)
52
+ * 4. Deletes secrets and pg_cron jobs
53
+ * 5. Drops the stripe schema
54
+ */
55
+ declare function uninstallCommand(options: DeployOptions): Promise<void>;
56
+
57
+ interface NgrokTunnel {
58
+ url: string;
59
+ close: () => Promise<void>;
60
+ }
61
+ /**
62
+ * Create an ngrok tunnel to expose the local server to the internet.
63
+ * @param port - The local port to expose
64
+ * @param authToken - ngrok authentication token
65
+ * @returns The tunnel URL and a close function
66
+ */
67
+ declare function createTunnel(port: number, authToken: string): Promise<NgrokTunnel>;
68
+
69
+ export { type CliOptions, type Config, type DeployOptions, type NgrokTunnel, backfillCommand, createTunnel, installCommand, loadConfig, migrateCommand, syncCommand, uninstallCommand };
@@ -0,0 +1,21 @@
1
+ import {
2
+ backfillCommand,
3
+ createTunnel,
4
+ installCommand,
5
+ loadConfig,
6
+ migrateCommand,
7
+ syncCommand,
8
+ uninstallCommand
9
+ } from "../chunk-YH6KRZDQ.js";
10
+ import "../chunk-J7BH3XD6.js";
11
+ import "../chunk-X2OQQCC2.js";
12
+ import "../chunk-CKWVW2JK.js";
13
+ export {
14
+ backfillCommand,
15
+ createTunnel,
16
+ installCommand,
17
+ loadConfig,
18
+ migrateCommand,
19
+ syncCommand,
20
+ uninstallCommand
21
+ };