stripe-experiment-sync 1.0.11 → 1.0.12

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "./chunk-XTL72K7K.js";
3
+ } from "./chunk-IO2EEPFD.js";
4
4
 
5
5
  // src/stripeSync.ts
6
6
  import Stripe2 from "stripe";
@@ -2,11 +2,11 @@ import {
2
2
  StripeSync,
3
3
  createStripeWebSocketClient,
4
4
  runMigrations
5
- } from "./chunk-LFXGDVMC.js";
5
+ } from "./chunk-2TIRMOJR.js";
6
6
  import {
7
7
  install,
8
8
  uninstall
9
- } from "./chunk-EVNKMOYA.js";
9
+ } from "./chunk-RAM7OG7J.js";
10
10
 
11
11
  // src/cli/config.ts
12
12
  import dotenv from "dotenv";
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "stripe-experiment-sync",
4
- version: "1.0.11",
4
+ version: "1.0.12",
5
5
  private: false,
6
6
  description: "Stripe Sync Engine to sync Stripe data to Postgres",
7
7
  type: "module",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "./chunk-XTL72K7K.js";
3
+ } from "./chunk-IO2EEPFD.js";
4
4
 
5
5
  // src/supabase/supabase.ts
6
6
  import { SupabaseManagementAPI } from "supabase-management-js";
@@ -301,7 +301,7 @@ var SupabaseSetupClient = class {
301
301
  * Removes all Edge Functions, secrets, database resources, and Stripe webhooks
302
302
  */
303
303
  async uninstall(stripeSecretKey) {
304
- const stripe = new Stripe(stripeSecretKey, { apiVersion: "2025-02-24.acacia" });
304
+ const stripe = stripeSecretKey ? new Stripe(stripeSecretKey, { apiVersion: "2025-02-24.acacia" }) : null;
305
305
  try {
306
306
  try {
307
307
  const webhookResult = await this.runSQL(`
@@ -310,7 +310,7 @@ var SupabaseSetupClient = class {
310
310
  const webhookIds = webhookResult[0]?.rows?.map((r) => r.id) || [];
311
311
  for (const webhookId of webhookIds) {
312
312
  try {
313
- await stripe.webhookEndpoints.del(webhookId);
313
+ await stripe?.webhookEndpoints.del(webhookId);
314
314
  } catch (err) {
315
315
  console.warn(`Could not delete Stripe webhook ${webhookId}:`, err);
316
316
  }
@@ -440,13 +440,15 @@ async function install(params) {
440
440
  }
441
441
  async function uninstall(params) {
442
442
  const { supabaseAccessToken, supabaseProjectRef, stripeKey } = params;
443
- const trimmedStripeKey = stripeKey.trim();
444
- if (!trimmedStripeKey.startsWith("sk_") && !trimmedStripeKey.startsWith("rk_")) {
443
+ const trimmedStripeKey = stripeKey && stripeKey.trim();
444
+ if (trimmedStripeKey && !trimmedStripeKey.startsWith("sk_") && !trimmedStripeKey.startsWith("rk_")) {
445
445
  throw new Error('Stripe key should start with "sk_" or "rk_"');
446
446
  }
447
447
  const client = new SupabaseSetupClient({
448
448
  accessToken: supabaseAccessToken,
449
- projectRef: supabaseProjectRef
449
+ projectRef: supabaseProjectRef,
450
+ projectBaseUrl: params.baseProjectUrl,
451
+ managementApiBaseUrl: params.baseManagementApiUrl
450
452
  });
451
453
  await client.uninstall(trimmedStripeKey);
452
454
  }
@@ -33,7 +33,7 @@ var import_commander = require("commander");
33
33
  // package.json
34
34
  var package_default = {
35
35
  name: "stripe-experiment-sync",
36
- version: "1.0.11",
36
+ version: "1.0.12",
37
37
  private: false,
38
38
  description: "Stripe Sync Engine to sync Stripe data to Postgres",
39
39
  type: "module",
@@ -3926,7 +3926,7 @@ var SupabaseSetupClient = class {
3926
3926
  * Removes all Edge Functions, secrets, database resources, and Stripe webhooks
3927
3927
  */
3928
3928
  async uninstall(stripeSecretKey) {
3929
- const stripe = new import_stripe3.default(stripeSecretKey, { apiVersion: "2025-02-24.acacia" });
3929
+ const stripe = stripeSecretKey ? new import_stripe3.default(stripeSecretKey, { apiVersion: "2025-02-24.acacia" }) : null;
3930
3930
  try {
3931
3931
  try {
3932
3932
  const webhookResult = await this.runSQL(`
@@ -3935,7 +3935,7 @@ var SupabaseSetupClient = class {
3935
3935
  const webhookIds = webhookResult[0]?.rows?.map((r) => r.id) || [];
3936
3936
  for (const webhookId of webhookIds) {
3937
3937
  try {
3938
- await stripe.webhookEndpoints.del(webhookId);
3938
+ await stripe?.webhookEndpoints.del(webhookId);
3939
3939
  } catch (err) {
3940
3940
  console.warn(`Could not delete Stripe webhook ${webhookId}:`, err);
3941
3941
  }
@@ -4065,13 +4065,15 @@ async function install(params) {
4065
4065
  }
4066
4066
  async function uninstall(params) {
4067
4067
  const { supabaseAccessToken, supabaseProjectRef, stripeKey } = params;
4068
- const trimmedStripeKey = stripeKey.trim();
4069
- if (!trimmedStripeKey.startsWith("sk_") && !trimmedStripeKey.startsWith("rk_")) {
4068
+ const trimmedStripeKey = stripeKey && stripeKey.trim();
4069
+ if (trimmedStripeKey && !trimmedStripeKey.startsWith("sk_") && !trimmedStripeKey.startsWith("rk_")) {
4070
4070
  throw new Error('Stripe key should start with "sk_" or "rk_"');
4071
4071
  }
4072
4072
  const client = new SupabaseSetupClient({
4073
4073
  accessToken: supabaseAccessToken,
4074
- projectRef: supabaseProjectRef
4074
+ projectRef: supabaseProjectRef,
4075
+ projectBaseUrl: params.baseProjectUrl,
4076
+ managementApiBaseUrl: params.baseManagementApiUrl
4075
4077
  });
4076
4078
  await client.uninstall(trimmedStripeKey);
4077
4079
  }
package/dist/cli/index.js CHANGED
@@ -5,12 +5,12 @@ import {
5
5
  migrateCommand,
6
6
  syncCommand,
7
7
  uninstallCommand
8
- } from "../chunk-4MOFTZ53.js";
9
- import "../chunk-LFXGDVMC.js";
10
- import "../chunk-EVNKMOYA.js";
8
+ } from "../chunk-6KTLIYUL.js";
9
+ import "../chunk-2TIRMOJR.js";
10
+ import "../chunk-RAM7OG7J.js";
11
11
  import {
12
12
  package_default
13
- } from "../chunk-XTL72K7K.js";
13
+ } from "../chunk-IO2EEPFD.js";
14
14
 
15
15
  // src/cli/index.ts
16
16
  import { Command } from "commander";
package/dist/cli/lib.cjs CHANGED
@@ -105,7 +105,7 @@ async function loadConfig(options) {
105
105
  // package.json
106
106
  var package_default = {
107
107
  name: "stripe-experiment-sync",
108
- version: "1.0.11",
108
+ version: "1.0.12",
109
109
  private: false,
110
110
  description: "Stripe Sync Engine to sync Stripe data to Postgres",
111
111
  type: "module",
@@ -3940,7 +3940,7 @@ var SupabaseSetupClient = class {
3940
3940
  * Removes all Edge Functions, secrets, database resources, and Stripe webhooks
3941
3941
  */
3942
3942
  async uninstall(stripeSecretKey) {
3943
- const stripe = new import_stripe3.default(stripeSecretKey, { apiVersion: "2025-02-24.acacia" });
3943
+ const stripe = stripeSecretKey ? new import_stripe3.default(stripeSecretKey, { apiVersion: "2025-02-24.acacia" }) : null;
3944
3944
  try {
3945
3945
  try {
3946
3946
  const webhookResult = await this.runSQL(`
@@ -3949,7 +3949,7 @@ var SupabaseSetupClient = class {
3949
3949
  const webhookIds = webhookResult[0]?.rows?.map((r) => r.id) || [];
3950
3950
  for (const webhookId of webhookIds) {
3951
3951
  try {
3952
- await stripe.webhookEndpoints.del(webhookId);
3952
+ await stripe?.webhookEndpoints.del(webhookId);
3953
3953
  } catch (err) {
3954
3954
  console.warn(`Could not delete Stripe webhook ${webhookId}:`, err);
3955
3955
  }
@@ -4079,13 +4079,15 @@ async function install(params) {
4079
4079
  }
4080
4080
  async function uninstall(params) {
4081
4081
  const { supabaseAccessToken, supabaseProjectRef, stripeKey } = params;
4082
- const trimmedStripeKey = stripeKey.trim();
4083
- if (!trimmedStripeKey.startsWith("sk_") && !trimmedStripeKey.startsWith("rk_")) {
4082
+ const trimmedStripeKey = stripeKey && stripeKey.trim();
4083
+ if (trimmedStripeKey && !trimmedStripeKey.startsWith("sk_") && !trimmedStripeKey.startsWith("rk_")) {
4084
4084
  throw new Error('Stripe key should start with "sk_" or "rk_"');
4085
4085
  }
4086
4086
  const client = new SupabaseSetupClient({
4087
4087
  accessToken: supabaseAccessToken,
4088
- projectRef: supabaseProjectRef
4088
+ projectRef: supabaseProjectRef,
4089
+ projectBaseUrl: params.baseProjectUrl,
4090
+ managementApiBaseUrl: params.baseManagementApiUrl
4089
4091
  });
4090
4092
  await client.uninstall(trimmedStripeKey);
4091
4093
  }
package/dist/cli/lib.js CHANGED
@@ -6,10 +6,10 @@ import {
6
6
  migrateCommand,
7
7
  syncCommand,
8
8
  uninstallCommand
9
- } from "../chunk-4MOFTZ53.js";
10
- import "../chunk-LFXGDVMC.js";
11
- import "../chunk-EVNKMOYA.js";
12
- import "../chunk-XTL72K7K.js";
9
+ } from "../chunk-6KTLIYUL.js";
10
+ import "../chunk-2TIRMOJR.js";
11
+ import "../chunk-RAM7OG7J.js";
12
+ import "../chunk-IO2EEPFD.js";
13
13
  export {
14
14
  backfillCommand,
15
15
  createTunnel,
package/dist/index.cjs CHANGED
@@ -46,7 +46,7 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
46
46
  // package.json
47
47
  var package_default = {
48
48
  name: "stripe-experiment-sync",
49
- version: "1.0.11",
49
+ version: "1.0.12",
50
50
  private: false,
51
51
  description: "Stripe Sync Engine to sync Stripe data to Postgres",
52
52
  type: "module",
package/dist/index.js CHANGED
@@ -5,8 +5,8 @@ import {
5
5
  createStripeWebSocketClient,
6
6
  hashApiKey,
7
7
  runMigrations
8
- } from "./chunk-LFXGDVMC.js";
9
- import "./chunk-XTL72K7K.js";
8
+ } from "./chunk-2TIRMOJR.js";
9
+ import "./chunk-IO2EEPFD.js";
10
10
  export {
11
11
  PostgresClient,
12
12
  StripeSync,
@@ -64,7 +64,7 @@ var workerFunctionCode = stripe_worker_default;
64
64
  // package.json
65
65
  var package_default = {
66
66
  name: "stripe-experiment-sync",
67
- version: "1.0.11",
67
+ version: "1.0.12",
68
68
  private: false,
69
69
  description: "Stripe Sync Engine to sync Stripe data to Postgres",
70
70
  type: "module",
@@ -425,7 +425,7 @@ var SupabaseSetupClient = class {
425
425
  * Removes all Edge Functions, secrets, database resources, and Stripe webhooks
426
426
  */
427
427
  async uninstall(stripeSecretKey) {
428
- const stripe = new import_stripe.default(stripeSecretKey, { apiVersion: "2025-02-24.acacia" });
428
+ const stripe = stripeSecretKey ? new import_stripe.default(stripeSecretKey, { apiVersion: "2025-02-24.acacia" }) : null;
429
429
  try {
430
430
  try {
431
431
  const webhookResult = await this.runSQL(`
@@ -434,7 +434,7 @@ var SupabaseSetupClient = class {
434
434
  const webhookIds = webhookResult[0]?.rows?.map((r) => r.id) || [];
435
435
  for (const webhookId of webhookIds) {
436
436
  try {
437
- await stripe.webhookEndpoints.del(webhookId);
437
+ await stripe?.webhookEndpoints.del(webhookId);
438
438
  } catch (err) {
439
439
  console.warn(`Could not delete Stripe webhook ${webhookId}:`, err);
440
440
  }
@@ -564,13 +564,15 @@ async function install(params) {
564
564
  }
565
565
  async function uninstall(params) {
566
566
  const { supabaseAccessToken, supabaseProjectRef, stripeKey } = params;
567
- const trimmedStripeKey = stripeKey.trim();
568
- if (!trimmedStripeKey.startsWith("sk_") && !trimmedStripeKey.startsWith("rk_")) {
567
+ const trimmedStripeKey = stripeKey && stripeKey.trim();
568
+ if (trimmedStripeKey && !trimmedStripeKey.startsWith("sk_") && !trimmedStripeKey.startsWith("rk_")) {
569
569
  throw new Error('Stripe key should start with "sk_" or "rk_"');
570
570
  }
571
571
  const client = new SupabaseSetupClient({
572
572
  accessToken: supabaseAccessToken,
573
- projectRef: supabaseProjectRef
573
+ projectRef: supabaseProjectRef,
574
+ projectBaseUrl: params.baseProjectUrl,
575
+ managementApiBaseUrl: params.baseManagementApiUrl
574
576
  });
575
577
  await client.uninstall(trimmedStripeKey);
576
578
  }
@@ -93,7 +93,7 @@ declare class SupabaseSetupClient {
93
93
  * Uninstall stripe-sync from a Supabase project
94
94
  * Removes all Edge Functions, secrets, database resources, and Stripe webhooks
95
95
  */
96
- uninstall(stripeSecretKey: string): Promise<void>;
96
+ uninstall(stripeSecretKey?: string): Promise<void>;
97
97
  /**
98
98
  * Inject package version into Edge Function code
99
99
  */
@@ -112,7 +112,9 @@ declare function install(params: {
112
112
  declare function uninstall(params: {
113
113
  supabaseAccessToken: string;
114
114
  supabaseProjectRef: string;
115
- stripeKey: string;
115
+ stripeKey?: string;
116
+ baseProjectUrl?: string;
117
+ baseManagementApiUrl?: string;
116
118
  }): Promise<void>;
117
119
 
118
120
  declare const setupFunctionCode: string;
@@ -93,7 +93,7 @@ declare class SupabaseSetupClient {
93
93
  * Uninstall stripe-sync from a Supabase project
94
94
  * Removes all Edge Functions, secrets, database resources, and Stripe webhooks
95
95
  */
96
- uninstall(stripeSecretKey: string): Promise<void>;
96
+ uninstall(stripeSecretKey?: string): Promise<void>;
97
97
  /**
98
98
  * Inject package version into Edge Function code
99
99
  */
@@ -112,7 +112,9 @@ declare function install(params: {
112
112
  declare function uninstall(params: {
113
113
  supabaseAccessToken: string;
114
114
  supabaseProjectRef: string;
115
- stripeKey: string;
115
+ stripeKey?: string;
116
+ baseProjectUrl?: string;
117
+ baseManagementApiUrl?: string;
116
118
  }): Promise<void>;
117
119
 
118
120
  declare const setupFunctionCode: string;
@@ -9,8 +9,8 @@ import {
9
9
  uninstall,
10
10
  webhookFunctionCode,
11
11
  workerFunctionCode
12
- } from "../chunk-EVNKMOYA.js";
13
- import "../chunk-XTL72K7K.js";
12
+ } from "../chunk-RAM7OG7J.js";
13
+ import "../chunk-IO2EEPFD.js";
14
14
  export {
15
15
  INSTALLATION_ERROR_SUFFIX,
16
16
  INSTALLATION_INSTALLED_SUFFIX,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stripe-experiment-sync",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "private": false,
5
5
  "description": "Stripe Sync Engine to sync Stripe data to Postgres",
6
6
  "type": "module",