@raideno/convex-stripe 0.3.9 → 0.3.10

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 (3) hide show
  1. package/dist/index.d.ts +13 -1116
  2. package/dist/server.js +168 -169
  3. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -5501,7 +5501,7 @@ const stripeTables = {
5501
5501
  stripe: v.object(CustomerSchema),
5502
5502
  lastSyncedAt: v.number(),
5503
5503
  accountId: v.optional(v.string())
5504
- }).index("byEntityId", ["entityId"]).index("byAccountId", ["accountId"]).index(BY_STRIPE_ID_INDEX_NAME, ["customerId"]),
5504
+ }).index("byEntityId", ["entityId"]).index("byAccountId", ["accountId"]).index("byAccountIdAndEntityid", ["accountId", "entityId"]).index(BY_STRIPE_ID_INDEX_NAME, ["customerId"]),
5505
5505
  stripeSubscriptions: defineTable({
5506
5506
  subscriptionId: v.union(v.string(), v.null()),
5507
5507
  customerId: v.string(),
@@ -5800,8 +5800,14 @@ const normalizeOptions = (options) => {
5800
5800
  const defineActionCallableFunction = (spec) => spec;
5801
5801
  const defineActionImplementation = (spec) => spec;
5802
5802
  const defineMutationImplementation = (spec) => spec;
5803
- async function deleteById(context, table, indexName, idField, idValue) {
5804
- const existing = await context.db.query(table).withIndex(indexName, (q) => q.eq(idField, idValue)).unique();
5803
+ async function deleteById(context, table, indexName, indexValues) {
5804
+ const existing = await context.db.query(table).withIndex(indexName, (q) => {
5805
+ let query = q;
5806
+ for (const [field, value] of Object.entries(indexValues)) {
5807
+ query = query.eq(field, value);
5808
+ }
5809
+ return query;
5810
+ }).unique();
5805
5811
  if (existing) {
5806
5812
  await context.db.delete(existing._id);
5807
5813
  return existing._id;
@@ -5814,11 +5820,23 @@ async function selectAll(context, table) {
5814
5820
  async function selectById(context, table, id) {
5815
5821
  return await context.db.get(id);
5816
5822
  }
5817
- async function selectOne(context, table, indexName, field, value) {
5818
- return await context.db.query(table).withIndex(indexName, (q) => q.eq(field, value)).unique();
5823
+ async function selectOne(context, table, indexName, indexValues) {
5824
+ return await context.db.query(table).withIndex(indexName, (q) => {
5825
+ let query = q;
5826
+ for (const [field, value] of Object.entries(indexValues)) {
5827
+ query = query.eq(field, value);
5828
+ }
5829
+ return query;
5830
+ }).unique();
5819
5831
  }
5820
- async function upsert(context, table, indexName, idField, data) {
5821
- const existing = await context.db.query(table).withIndex(indexName, (q) => q.eq(idField, data[idField])).unique();
5832
+ async function upsert(context, table, indexName, indexValues, data) {
5833
+ const existing = await context.db.query(table).withIndex(indexName, (q) => {
5834
+ let query = q;
5835
+ for (const [field, value] of Object.entries(indexValues)) {
5836
+ query = query.eq(field, value);
5837
+ }
5838
+ return query;
5839
+ }).unique();
5822
5840
  if (existing) {
5823
5841
  await context.db.patch(existing._id, {
5824
5842
  ...data,
@@ -5865,11 +5883,8 @@ const StoreImplementation = defineMutationImplementation({
5865
5883
  operation: v.string(),
5866
5884
  table: v.string(),
5867
5885
  indexName: v.optional(v.string()),
5868
- idField: v.optional(v.string()),
5886
+ indexValues: v.optional(v.any()),
5869
5887
  data: v.optional(v.any()),
5870
- idValue: v.optional(v.any()),
5871
- field: v.optional(v.string()),
5872
- value: v.optional(v.any()),
5873
5888
  id: v.optional(v.any())
5874
5889
  },
5875
5890
  handler: async (context, args, configuration) => {
@@ -5890,21 +5905,21 @@ const StoreImplementation = defineMutationImplementation({
5890
5905
  if (!args.indexName) {
5891
5906
  throw new Error('Missing "indexName" for upsert');
5892
5907
  }
5893
- if (!args.idField) {
5894
- throw new Error('Missing "idField" for upsert');
5908
+ if (!args.indexValues || typeof args.indexValues !== "object") {
5909
+ throw new Error('Missing "indexValues" for upsert');
5895
5910
  }
5896
5911
  if (args.data == null) {
5897
5912
  throw new Error('Missing "data" for upsert');
5898
5913
  }
5899
5914
  const upsertIndexName = args.indexName;
5900
- const upsertIdField = args.idField;
5915
+ const upsertIndexValues = args.indexValues;
5901
5916
  const upsertData = args.data;
5902
5917
  const _id = await wrapStoreOperation(
5903
5918
  upsert(
5904
5919
  context,
5905
5920
  table,
5906
5921
  upsertIndexName,
5907
- upsertIdField,
5922
+ upsertIndexValues,
5908
5923
  upsertData
5909
5924
  ),
5910
5925
  table
@@ -5920,14 +5935,17 @@ const StoreImplementation = defineMutationImplementation({
5920
5935
  } catch (error) {
5921
5936
  console.error("[afterChange]:", error);
5922
5937
  }
5923
- return { _id };
5938
+ return _id;
5924
5939
  }
5925
5940
  case "insert": {
5926
5941
  if (args.data == null) {
5927
5942
  throw new Error('Missing "data" for insert');
5928
5943
  }
5929
5944
  const insertData = args.data;
5930
- const _id = await wrapStoreOperation(insert(context, table, insertData), table);
5945
+ const _id = await wrapStoreOperation(
5946
+ insert(context, table, insertData),
5947
+ table
5948
+ );
5931
5949
  if (configuration.callbacks && configuration.callbacks.afterChange)
5932
5950
  try {
5933
5951
  await configuration.callbacks.afterChange(
@@ -5939,28 +5957,23 @@ const StoreImplementation = defineMutationImplementation({
5939
5957
  } catch (error) {
5940
5958
  console.error("[afterChange]:", error);
5941
5959
  }
5942
- return { _id };
5960
+ return _id;
5943
5961
  }
5944
5962
  case "deleteById": {
5945
5963
  if (!args.indexName) {
5946
5964
  throw new Error('Missing "indexName" for deleteById');
5947
5965
  }
5948
- if (!args.idField) {
5949
- throw new Error('Missing "idField" for deleteById');
5950
- }
5951
- if (typeof args.idValue === "undefined") {
5952
- throw new Error('Missing "idValue" for deleteById');
5966
+ if (!args.indexValues || typeof args.indexValues !== "object") {
5967
+ throw new Error('Missing "indexValues" for deleteById');
5953
5968
  }
5954
5969
  const deleteByIdIndexName = args.indexName;
5955
- const deleteByIdIdField = args.idField;
5956
- const deleteByIdIdValue = args.idValue;
5970
+ const deleteByIdIndexValues = args.indexValues;
5957
5971
  const _id = await wrapStoreOperation(
5958
5972
  deleteById(
5959
5973
  context,
5960
5974
  table,
5961
5975
  deleteByIdIndexName,
5962
- deleteByIdIdField,
5963
- deleteByIdIdValue
5976
+ deleteByIdIndexValues
5964
5977
  ),
5965
5978
  table
5966
5979
  );
@@ -5975,43 +5988,36 @@ const StoreImplementation = defineMutationImplementation({
5975
5988
  } catch (error) {
5976
5989
  console.error("[afterChange]:", error);
5977
5990
  }
5978
- return { _id };
5991
+ return _id;
5979
5992
  }
5980
5993
  case "selectOne": {
5981
5994
  if (!args.indexName) {
5982
5995
  throw new Error('Missing "indexName" for selectOne');
5983
5996
  }
5984
- if (!args.field) {
5985
- throw new Error('Missing "field" for selectOne');
5986
- }
5987
- if (typeof args.value === "undefined") {
5988
- throw new Error('Missing "value" for selectOne');
5997
+ if (!args.indexValues || typeof args.indexValues !== "object") {
5998
+ throw new Error('Missing "indexValues" for selectOne');
5989
5999
  }
5990
6000
  const selectOneIndexName = args.indexName;
5991
- const selectOneField = args.field;
5992
- const selectOneValue = args.value;
6001
+ const selectOneIndexValues = args.indexValues;
5993
6002
  const doc = await wrapStoreOperation(
5994
- selectOne(
5995
- context,
5996
- table,
5997
- selectOneIndexName,
5998
- selectOneField,
5999
- selectOneValue
6000
- ),
6003
+ selectOne(context, table, selectOneIndexName, selectOneIndexValues),
6001
6004
  table
6002
6005
  );
6003
- return { doc };
6006
+ return doc;
6004
6007
  }
6005
6008
  case "selectById": {
6006
6009
  if (args.id == null) {
6007
6010
  throw new Error('Missing "id" for selectById');
6008
6011
  }
6009
- const doc = await wrapStoreOperation(selectById(context, table, args.id), table);
6010
- return { doc };
6012
+ const doc = await wrapStoreOperation(
6013
+ selectById(context, table, args.id),
6014
+ table
6015
+ );
6016
+ return doc;
6011
6017
  }
6012
6018
  case "selectAll": {
6013
6019
  const docs = await wrapStoreOperation(selectAll(context, table), table);
6014
- return { docs };
6020
+ return docs;
6015
6021
  }
6016
6022
  }
6017
6023
  }
@@ -6028,18 +6034,17 @@ const CreateAccountImplementation = defineActionCallableFunction({
6028
6034
  const stripe = new Stripe(configuration.stripe.secret_key, {
6029
6035
  apiVersion: configuration.stripe.version
6030
6036
  });
6031
- const stripeAccount = (await storeDispatchTyped(
6037
+ const stripeAccount = await storeDispatchTyped(
6032
6038
  {
6033
6039
  operation: "selectOne",
6034
6040
  table: "stripeAccounts",
6035
6041
  indexName: "byEntityId",
6036
- field: "entityId",
6037
- value: args.entityId
6042
+ indexValues: { entityId: args.entityId }
6038
6043
  },
6039
6044
  context,
6040
6045
  configuration,
6041
6046
  options
6042
- )).doc;
6047
+ );
6043
6048
  if (stripeAccount) {
6044
6049
  return stripeAccount;
6045
6050
  } else {
@@ -6086,12 +6091,10 @@ const CreateAccountImplementation = defineActionCallableFunction({
6086
6091
  },
6087
6092
  lastSyncedAt: Date.now()
6088
6093
  };
6089
- const response = await storeDispatchTyped(
6094
+ const _id = await storeDispatchTyped(
6090
6095
  {
6091
- operation: "upsert",
6096
+ operation: "insert",
6092
6097
  table: "stripeAccounts",
6093
- indexName: "byEntityId",
6094
- idField: "entityId",
6095
6098
  data
6096
6099
  },
6097
6100
  context,
@@ -6099,7 +6102,7 @@ const CreateAccountImplementation = defineActionCallableFunction({
6099
6102
  options
6100
6103
  );
6101
6104
  return {
6102
- _id: response.id,
6105
+ _id,
6103
6106
  ...data,
6104
6107
  _creationTime: (/* @__PURE__ */ new Date()).getTime()
6105
6108
  };
@@ -6143,7 +6146,7 @@ const SubscriptionSyncImplementation = defineActionImplementation({
6143
6146
  operation: "upsert",
6144
6147
  table: "stripeSubscriptions",
6145
6148
  indexName: "byCustomerId",
6146
- idField: "customerId",
6149
+ indexValues: { customerId },
6147
6150
  data: {
6148
6151
  subscriptionId: null,
6149
6152
  customerId,
@@ -6164,7 +6167,7 @@ const SubscriptionSyncImplementation = defineActionImplementation({
6164
6167
  operation: "upsert",
6165
6168
  table: "stripeSubscriptions",
6166
6169
  indexName: "byCustomerId",
6167
- idField: "customerId",
6170
+ indexValues: { customerId },
6168
6171
  data: {
6169
6172
  accountId: args.accountId,
6170
6173
  subscriptionId: subscription.id,
@@ -6194,14 +6197,13 @@ const PayReturnImplementation = defineRedirectHandler({
6194
6197
  operation: "selectOne",
6195
6198
  table: "stripeCustomers",
6196
6199
  indexName: "byEntityId",
6197
- field: "entityId",
6198
- value: data.entityId
6200
+ indexValues: { entityId: data.entityId }
6199
6201
  },
6200
6202
  context,
6201
6203
  configuration,
6202
6204
  options
6203
6205
  );
6204
- const customerId = customer?.doc?.customerId || null;
6206
+ const customerId = customer?.customerId || null;
6205
6207
  if (customerId) {
6206
6208
  await SubscriptionSyncImplementation.handler(
6207
6209
  context,
@@ -6228,14 +6230,13 @@ const PortalReturnImplementation = defineRedirectHandler({
6228
6230
  operation: "selectOne",
6229
6231
  table: "stripeCustomers",
6230
6232
  indexName: "byEntityId",
6231
- field: "entityId",
6232
- value: data.entityId
6233
+ indexValues: { entityId: data.entityId }
6233
6234
  },
6234
6235
  context,
6235
6236
  configuration,
6236
6237
  options
6237
6238
  );
6238
- const customerId = customer?.doc?.customerId || null;
6239
+ const customerId = customer?.customerId || null;
6239
6240
  if (customerId) {
6240
6241
  await SubscriptionSyncImplementation.handler(
6241
6242
  context,
@@ -6262,14 +6263,13 @@ const SubscribeReturnImplementation = defineRedirectHandler({
6262
6263
  operation: "selectOne",
6263
6264
  table: "stripeCustomers",
6264
6265
  indexName: "byEntityId",
6265
- field: "entityId",
6266
- value: data.entityId
6266
+ indexValues: { entityId: data.entityId }
6267
6267
  },
6268
6268
  context,
6269
6269
  configuration,
6270
6270
  options
6271
6271
  );
6272
- const customerId = customer?.doc?.customerId || null;
6272
+ const customerId = customer?.customerId || null;
6273
6273
  if (customerId) {
6274
6274
  await SubscriptionSyncImplementation.handler(
6275
6275
  context,
@@ -6533,18 +6533,20 @@ const CreateCustomerImplementation = defineActionCallableFunction({
6533
6533
  const stripe = new Stripe(configuration.stripe.secret_key, {
6534
6534
  apiVersion: configuration.stripe.version
6535
6535
  });
6536
- const stripeCustomer = (await storeDispatchTyped(
6536
+ const stripeCustomer = await storeDispatchTyped(
6537
6537
  {
6538
6538
  operation: "selectOne",
6539
6539
  table: "stripeCustomers",
6540
- indexName: "byEntityId",
6541
- field: "entityId",
6542
- value: args.entityId
6540
+ indexName: "byAccountIdAndEntityid",
6541
+ indexValues: {
6542
+ entityId: args.entityId,
6543
+ accountId: stripeOptions.stripeAccount
6544
+ }
6543
6545
  },
6544
6546
  context,
6545
6547
  configuration,
6546
6548
  options
6547
- )).doc;
6549
+ );
6548
6550
  if (stripeCustomer) {
6549
6551
  return stripeCustomer;
6550
6552
  } else {
@@ -6594,14 +6596,13 @@ const CreateCustomerImplementation = defineActionCallableFunction({
6594
6596
  tax_ids: customer.tax_ids,
6595
6597
  test_clock: typeof customer.test_clock === "string" ? customer.test_clock : customer.test_clock?.id
6596
6598
  },
6597
- lastSyncedAt: Date.now()
6599
+ lastSyncedAt: Date.now(),
6600
+ accountId: stripeOptions.stripeAccount
6598
6601
  };
6599
- const response = await storeDispatchTyped(
6602
+ const _id = await storeDispatchTyped(
6600
6603
  {
6601
- operation: "upsert",
6604
+ operation: "insert",
6602
6605
  table: "stripeCustomers",
6603
- indexName: "byEntityId",
6604
- idField: "entityId",
6605
6606
  data
6606
6607
  },
6607
6608
  context,
@@ -6609,7 +6610,7 @@ const CreateCustomerImplementation = defineActionCallableFunction({
6609
6610
  options
6610
6611
  );
6611
6612
  return {
6612
- _id: response.id,
6613
+ _id,
6613
6614
  ...data,
6614
6615
  _creationTime: (/* @__PURE__ */ new Date()).getTime()
6615
6616
  };
@@ -6628,15 +6629,17 @@ const PayImplementation = defineActionCallableFunction({
6628
6629
  {
6629
6630
  operation: "selectOne",
6630
6631
  table: "stripeCustomers",
6631
- indexName: "byEntityId",
6632
- field: "entityId",
6633
- value: args.entityId
6632
+ indexName: "byAccountIdAndEntityid",
6633
+ indexValues: {
6634
+ entityId: args.entityId,
6635
+ accountId: stripeOptions.stripeAccount
6636
+ }
6634
6637
  },
6635
6638
  context,
6636
6639
  configuration,
6637
6640
  options
6638
6641
  );
6639
- let customerId = stripeCustomer?.doc?.customerId || null;
6642
+ let customerId = stripeCustomer?.customerId || null;
6640
6643
  if (!customerId) {
6641
6644
  if (!createStripeCustomerIfMissing) {
6642
6645
  throw new Error(
@@ -6650,7 +6653,7 @@ const PayImplementation = defineActionCallableFunction({
6650
6653
  email: void 0,
6651
6654
  metadata: void 0
6652
6655
  },
6653
- {},
6656
+ stripeOptions,
6654
6657
  configuration,
6655
6658
  options
6656
6659
  )).customerId;
@@ -6719,14 +6722,13 @@ const PayImplementation = defineActionCallableFunction({
6719
6722
  );
6720
6723
  await storeDispatchTyped(
6721
6724
  {
6722
- operation: "upsert",
6725
+ operation: "insert",
6723
6726
  table: "stripeCheckoutSessions",
6724
- indexName: BY_STRIPE_ID_INDEX_NAME,
6725
- idField: "checkoutSessionId",
6726
6727
  data: {
6727
6728
  checkoutSessionId: checkout.id,
6728
6729
  stripe: CheckoutSessionStripeToConvex(checkout),
6729
- lastSyncedAt: Date.now()
6730
+ lastSyncedAt: Date.now(),
6731
+ accountId: stripeOptions.stripeAccount
6730
6732
  }
6731
6733
  },
6732
6734
  context,
@@ -6737,14 +6739,13 @@ const PayImplementation = defineActionCallableFunction({
6737
6739
  if (paymentIntent && paymentIntent !== null && typeof paymentIntent !== "string") {
6738
6740
  await storeDispatchTyped(
6739
6741
  {
6740
- operation: "upsert",
6742
+ operation: "insert",
6741
6743
  table: "stripePaymentIntents",
6742
- indexName: BY_STRIPE_ID_INDEX_NAME,
6743
- idField: "paymentIntentId",
6744
6744
  data: {
6745
6745
  paymentIntentId: paymentIntent.id,
6746
6746
  stripe: PaymentIntentStripeToConvex(paymentIntent),
6747
- lastSyncedAt: Date.now()
6747
+ lastSyncedAt: Date.now(),
6748
+ accountId: stripeOptions.stripeAccount
6748
6749
  }
6749
6750
  },
6750
6751
  context,
@@ -6767,15 +6768,17 @@ const PortalImplementation = defineActionCallableFunction({
6767
6768
  {
6768
6769
  operation: "selectOne",
6769
6770
  table: "stripeCustomers",
6770
- indexName: "byEntityId",
6771
- field: "entityId",
6772
- value: args.entityId
6771
+ indexName: "byAccountIdAndEntityid",
6772
+ indexValues: {
6773
+ entityId: args.entityId,
6774
+ accountId: stripeOptions.stripeAccount
6775
+ }
6773
6776
  },
6774
6777
  context,
6775
6778
  configuration,
6776
6779
  options
6777
6780
  );
6778
- let customerId = stripeCustomer?.doc?.customerId || null;
6781
+ let customerId = stripeCustomer?.customerId || null;
6779
6782
  if (!customerId) {
6780
6783
  if (!createStripeCustomerIfMissing) {
6781
6784
  throw new Error(
@@ -6789,7 +6792,7 @@ const PortalImplementation = defineActionCallableFunction({
6789
6792
  email: void 0,
6790
6793
  metadata: void 0
6791
6794
  },
6792
- {},
6795
+ stripeOptions,
6793
6796
  configuration,
6794
6797
  options
6795
6798
  )).customerId;
@@ -6833,15 +6836,17 @@ const SubscribeImplementation = defineActionCallableFunction({
6833
6836
  {
6834
6837
  operation: "selectOne",
6835
6838
  table: "stripeCustomers",
6836
- indexName: "byEntityId",
6837
- field: "entityId",
6838
- value: args.entityId
6839
+ indexName: "byAccountIdAndEntityid",
6840
+ indexValues: {
6841
+ entityId: args.entityId,
6842
+ accountId: stripeOptions.stripeAccount
6843
+ }
6839
6844
  },
6840
6845
  context,
6841
6846
  configuration,
6842
6847
  options
6843
6848
  );
6844
- let customerId = stripeCustomer?.doc?.customerId || null;
6849
+ let customerId = stripeCustomer?.customerId || null;
6845
6850
  if (!customerId) {
6846
6851
  if (!createStripeCustomerIfMissing) {
6847
6852
  throw new Error(
@@ -6855,7 +6860,7 @@ const SubscribeImplementation = defineActionCallableFunction({
6855
6860
  email: void 0,
6856
6861
  metadata: void 0
6857
6862
  },
6858
- {},
6863
+ stripeOptions,
6859
6864
  configuration,
6860
6865
  options
6861
6866
  )).customerId;
@@ -6923,14 +6928,13 @@ const SubscribeImplementation = defineActionCallableFunction({
6923
6928
  );
6924
6929
  await storeDispatchTyped(
6925
6930
  {
6926
- operation: "upsert",
6931
+ operation: "insert",
6927
6932
  table: "stripeCheckoutSessions",
6928
- indexName: BY_STRIPE_ID_INDEX_NAME,
6929
- idField: "checkoutSessionId",
6930
6933
  data: {
6931
6934
  checkoutSessionId: checkout.id,
6932
6935
  stripe: CheckoutSessionStripeToConvex(checkout),
6933
- lastSyncedAt: Date.now()
6936
+ lastSyncedAt: Date.now(),
6937
+ accountId: stripeOptions.stripeAccount
6934
6938
  }
6935
6939
  },
6936
6940
  context,
@@ -6941,14 +6945,13 @@ const SubscribeImplementation = defineActionCallableFunction({
6941
6945
  if (subscription && subscription !== null && typeof subscription !== "string") {
6942
6946
  await storeDispatchTyped(
6943
6947
  {
6944
- operation: "upsert",
6948
+ operation: "insert",
6945
6949
  table: "stripeSubscriptions",
6946
- indexName: BY_STRIPE_ID_INDEX_NAME,
6947
- idField: "subscriptionId",
6948
6950
  data: {
6949
6951
  subscriptionId: subscription.id,
6950
6952
  customerId,
6951
6953
  stripe: SubscriptionStripeToConvex(subscription),
6954
+ accountId: stripeOptions.stripeAccount,
6952
6955
  lastSyncedAt: Date.now()
6953
6956
  }
6954
6957
  },
@@ -7289,7 +7292,7 @@ const AccountsSyncImplementation = defineActionImplementation({
7289
7292
  operation: "upsert",
7290
7293
  table: "stripeAccounts",
7291
7294
  indexName: BY_STRIPE_ID_INDEX_NAME,
7292
- idField: "accountId",
7295
+ indexValues: { accountId: account.id },
7293
7296
  data: {
7294
7297
  accountId: account.id,
7295
7298
  entityId,
@@ -7323,7 +7326,7 @@ const BillingPortalConfigurationsSyncImplementation = defineActionImplementation
7323
7326
  {
7324
7327
  operation: "upsert",
7325
7328
  table: "stripeBillingPortalConfigurations",
7326
- idField: "billingPortalConfigurationId",
7329
+ indexValues: { billingPortalConfigurationId: billingPortalConfiguration.id },
7327
7330
  indexName: BY_STRIPE_ID_INDEX_NAME,
7328
7331
  data: {
7329
7332
  billingPortalConfigurationId: billingPortalConfiguration.id,
@@ -7362,7 +7365,7 @@ const CapabilitiesSyncImplementation = defineActionImplementation({
7362
7365
  operation: "upsert",
7363
7366
  table: "stripeCapabilities",
7364
7367
  indexName: BY_STRIPE_ID_INDEX_NAME,
7365
- idField: "capabilityId",
7368
+ indexValues: { capabilityId: capability.id },
7366
7369
  data: {
7367
7370
  capabilityId: capability.id,
7368
7371
  stripe: CapabilityStripeToConvex(capability),
@@ -7397,7 +7400,7 @@ const ChargesSyncImplementation = defineActionImplementation({
7397
7400
  operation: "upsert",
7398
7401
  indexName: BY_STRIPE_ID_INDEX_NAME,
7399
7402
  table: "stripeCharges",
7400
- idField: "chargeId",
7403
+ indexValues: { chargeId: charge.id },
7401
7404
  data: {
7402
7405
  chargeId: charge.id,
7403
7406
  stripe: ChargeStripeToConvex(charge),
@@ -7430,7 +7433,7 @@ const CheckoutSessionsSyncImplementation = defineActionImplementation({
7430
7433
  {
7431
7434
  operation: "upsert",
7432
7435
  table: "stripeCheckoutSessions",
7433
- idField: "checkoutSessionId",
7436
+ indexValues: { checkoutSessionId: checkoutSession.id },
7434
7437
  indexName: BY_STRIPE_ID_INDEX_NAME,
7435
7438
  data: {
7436
7439
  checkoutSessionId: checkoutSession.id,
@@ -7465,7 +7468,7 @@ const CouponsSyncImplementation = defineActionImplementation({
7465
7468
  operation: "upsert",
7466
7469
  table: "stripeCoupons",
7467
7470
  indexName: BY_STRIPE_ID_INDEX_NAME,
7468
- idField: "couponId",
7471
+ indexValues: { couponId: coupon.id },
7469
7472
  data: {
7470
7473
  couponId: coupon.id,
7471
7474
  stripe: CouponStripeToConvex(coupon),
@@ -7499,7 +7502,7 @@ const CreditNotesSyncImplementation = defineActionImplementation({
7499
7502
  operation: "upsert",
7500
7503
  table: "stripeCreditNotes",
7501
7504
  indexName: BY_STRIPE_ID_INDEX_NAME,
7502
- idField: "creditNoteId",
7505
+ indexValues: { creditNoteId: creditNote.id },
7503
7506
  data: {
7504
7507
  creditNoteId: creditNote.id,
7505
7508
  stripe: CreditNoteStripeToConvex(creditNote),
@@ -7538,7 +7541,7 @@ const CustomersSyncImplementation = defineActionImplementation({
7538
7541
  operation: "upsert",
7539
7542
  table: "stripeCustomers",
7540
7543
  indexName: BY_STRIPE_ID_INDEX_NAME,
7541
- idField: "customerId",
7544
+ indexValues: { customerId: customer.id },
7542
7545
  data: {
7543
7546
  customerId: customer.id,
7544
7547
  entityId,
@@ -7573,7 +7576,7 @@ const DisputesSyncImplementation = defineActionImplementation({
7573
7576
  operation: "upsert",
7574
7577
  table: "stripeDisputes",
7575
7578
  indexName: BY_STRIPE_ID_INDEX_NAME,
7576
- idField: "disputeId",
7579
+ indexValues: { disputeId: dispute.id },
7577
7580
  data: {
7578
7581
  disputeId: dispute.id,
7579
7582
  stripe: DisputeStripeToConvex(dispute),
@@ -7607,7 +7610,7 @@ const EarlyFraudWarningsSyncImplementation = defineActionImplementation({
7607
7610
  operation: "upsert",
7608
7611
  table: "stripeEarlyFraudWarnings",
7609
7612
  indexName: BY_STRIPE_ID_INDEX_NAME,
7610
- idField: "earlyFraudWarningId",
7613
+ indexValues: { earlyFraudWarningId: early_fraud_warning.id },
7611
7614
  data: {
7612
7615
  earlyFraudWarningId: early_fraud_warning.id,
7613
7616
  stripe: EarlyFraudWarningStripeToConvex(early_fraud_warning),
@@ -7644,7 +7647,7 @@ const InvoicesSyncImplementation = defineActionImplementation({
7644
7647
  {
7645
7648
  operation: "upsert",
7646
7649
  table: "stripeInvoices",
7647
- idField: "invoiceId",
7650
+ indexValues: { invoiceId: invoice.id },
7648
7651
  indexName: BY_STRIPE_ID_INDEX_NAME,
7649
7652
  data: {
7650
7653
  invoiceId: invoice.id,
@@ -7682,7 +7685,7 @@ const PaymentIntentsSyncImplementation = defineActionImplementation({
7682
7685
  operation: "upsert",
7683
7686
  table: "stripePaymentIntents",
7684
7687
  indexName: BY_STRIPE_ID_INDEX_NAME,
7685
- idField: "paymentIntentId",
7688
+ indexValues: { paymentIntentId: paymentIntent.id },
7686
7689
  data: {
7687
7690
  paymentIntentId: paymentIntent.id,
7688
7691
  stripe: PaymentIntentStripeToConvex(paymentIntent),
@@ -7716,7 +7719,7 @@ const PaymentMethodsSyncImplementation = defineActionImplementation({
7716
7719
  operation: "upsert",
7717
7720
  table: "stripePaymentMethods",
7718
7721
  indexName: BY_STRIPE_ID_INDEX_NAME,
7719
- idField: "paymentMethodId",
7722
+ indexValues: { paymentMethodId: paymentMethod.id },
7720
7723
  data: {
7721
7724
  paymentMethodId: paymentMethod.id,
7722
7725
  stripe: PaymentMethodStripeToConvex(paymentMethod),
@@ -7750,7 +7753,7 @@ const PayoutsSyncImplementation = defineActionImplementation({
7750
7753
  operation: "upsert",
7751
7754
  table: "stripePayouts",
7752
7755
  indexName: BY_STRIPE_ID_INDEX_NAME,
7753
- idField: "payoutId",
7756
+ indexValues: { payoutId: payout.id },
7754
7757
  data: {
7755
7758
  payoutId: payout.id,
7756
7759
  stripe: PayoutStripeToConvex(payout),
@@ -7787,7 +7790,7 @@ const PlansSyncImplementation = defineActionImplementation({
7787
7790
  operation: "upsert",
7788
7791
  table: "stripePlans",
7789
7792
  indexName: BY_STRIPE_ID_INDEX_NAME,
7790
- idField: "planId",
7793
+ indexValues: { planId: plan.id },
7791
7794
  data: {
7792
7795
  planId: plan.id,
7793
7796
  stripe: PlanStripeToConvex(plan),
@@ -7824,7 +7827,7 @@ const PricesSyncImplementation = defineActionImplementation({
7824
7827
  operation: "upsert",
7825
7828
  table: "stripePrices",
7826
7829
  indexName: BY_STRIPE_ID_INDEX_NAME,
7827
- idField: "priceId",
7830
+ indexValues: { priceId: price.id },
7828
7831
  data: {
7829
7832
  priceId: price.id,
7830
7833
  stripe: PriceStripeToConvex(price),
@@ -7859,7 +7862,7 @@ const ProductsSyncImplementation = defineActionImplementation({
7859
7862
  options
7860
7863
  );
7861
7864
  const localProductsById = new Map(
7862
- (localProductsResponse.docs || []).map((p) => [p.productId, p])
7865
+ (localProductsResponse || []).map((p) => [p.productId, p])
7863
7866
  );
7864
7867
  const products = await stripe.products.list({ limit: 100 }, { stripeAccount: args.accountId }).autoPagingToArray({ limit: 1e4 });
7865
7868
  const stripeProductIds = /* @__PURE__ */ new Set();
@@ -7874,7 +7877,7 @@ const ProductsSyncImplementation = defineActionImplementation({
7874
7877
  operation: "upsert",
7875
7878
  table: "stripeProducts",
7876
7879
  indexName: BY_STRIPE_ID_INDEX_NAME,
7877
- idField: "productId",
7880
+ indexValues: { productId: product.id },
7878
7881
  data: {
7879
7882
  productId: product.id,
7880
7883
  stripe: ProductStripeToConvex(product),
@@ -7908,7 +7911,7 @@ const PromotionCodesSyncImplementation = defineActionImplementation({
7908
7911
  operation: "upsert",
7909
7912
  table: "stripePromotionCodes",
7910
7913
  indexName: BY_STRIPE_ID_INDEX_NAME,
7911
- idField: "promotionCodeId",
7914
+ indexValues: { promotionCodeId: promotionCode.id },
7912
7915
  data: {
7913
7916
  promotionCodeId: promotionCode.id,
7914
7917
  stripe: PromotionCodeStripeToConvex(promotionCode),
@@ -7942,7 +7945,7 @@ const RefundsSyncImplementation = defineActionImplementation({
7942
7945
  operation: "upsert",
7943
7946
  table: "stripeRefunds",
7944
7947
  indexName: BY_STRIPE_ID_INDEX_NAME,
7945
- idField: "refundId",
7948
+ indexValues: { refundId: refund.id },
7946
7949
  data: {
7947
7950
  refundId: refund.id,
7948
7951
  stripe: RefundStripeToConvex(refund),
@@ -7976,7 +7979,7 @@ const ReviewsSyncImplementation = defineActionImplementation({
7976
7979
  operation: "upsert",
7977
7980
  table: "stripeReviews",
7978
7981
  indexName: BY_STRIPE_ID_INDEX_NAME,
7979
- idField: "reviewId",
7982
+ indexValues: { reviewId: review.id },
7980
7983
  data: {
7981
7984
  reviewId: review.id,
7982
7985
  stripe: ReviewStripeToConvex(review),
@@ -8010,7 +8013,7 @@ const SetupIntentsSyncImplementation = defineActionImplementation({
8010
8013
  operation: "upsert",
8011
8014
  table: "stripeSetupIntents",
8012
8015
  indexName: BY_STRIPE_ID_INDEX_NAME,
8013
- idField: "setupIntentId",
8016
+ indexValues: { setupIntentId: setupIntent.id },
8014
8017
  data: {
8015
8018
  setupIntentId: setupIntent.id,
8016
8019
  stripe: SetupIntentStripeToConvex(setupIntent),
@@ -8044,7 +8047,7 @@ const SubscriptionSchedulesSyncImplementation = defineActionImplementation({
8044
8047
  {
8045
8048
  operation: "upsert",
8046
8049
  table: "stripeSubscriptionSchedules",
8047
- idField: "subscriptionScheduleId",
8050
+ indexValues: { subscriptionScheduleId: subscriptionSchedule.id },
8048
8051
  indexName: BY_STRIPE_ID_INDEX_NAME,
8049
8052
  data: {
8050
8053
  subscriptionScheduleId: subscriptionSchedule.id,
@@ -8091,7 +8094,7 @@ const SubscriptionsSyncImplementation = defineActionImplementation({
8091
8094
  operation: "upsert",
8092
8095
  table: "stripeSubscriptions",
8093
8096
  indexName: "byCustomerId",
8094
- idField: "customerId",
8097
+ indexValues: { customerId },
8095
8098
  data: {
8096
8099
  customerId,
8097
8100
  subscriptionId: subscription.id,
@@ -8116,14 +8119,14 @@ const SubscriptionsSyncImplementation = defineActionImplementation({
8116
8119
  (s) => typeof s.customer === "string" ? s.customer : s.customer.id
8117
8120
  )
8118
8121
  );
8119
- for (const sub of localSubsResponse.docs || []) {
8122
+ for (const sub of localSubsResponse || []) {
8120
8123
  if (!hasSub.has(sub.customerId)) {
8121
8124
  await storeDispatchTyped(
8122
8125
  {
8123
8126
  operation: "upsert",
8124
8127
  table: "stripeSubscriptions",
8125
8128
  indexName: "byCustomerId",
8126
- idField: "customerId",
8129
+ indexValues: { customerId: sub.customerId },
8127
8130
  data: {
8128
8131
  customerId: sub.customerId,
8129
8132
  subscriptionId: null,
@@ -8158,7 +8161,7 @@ const TaxIdsSyncImplementation = defineActionImplementation({
8158
8161
  operation: "upsert",
8159
8162
  table: "stripeTaxIds",
8160
8163
  indexName: BY_STRIPE_ID_INDEX_NAME,
8161
- idField: "taxIdId",
8164
+ indexValues: { taxIdId: taxId.id },
8162
8165
  data: {
8163
8166
  taxIdId: taxId.id,
8164
8167
  stripe: TaxIdStripeToConvex(taxId),
@@ -8192,7 +8195,7 @@ const TransfersSyncImplementation = defineActionImplementation({
8192
8195
  operation: "upsert",
8193
8196
  table: "stripeTransfers",
8194
8197
  indexName: BY_STRIPE_ID_INDEX_NAME,
8195
- idField: "transferId",
8198
+ indexValues: { transferId: transfer.id },
8196
8199
  data: {
8197
8200
  transferId: transfer.id,
8198
8201
  stripe: TransferStripeToConvex(transfer),
@@ -8359,7 +8362,7 @@ const AccountsHandlerImplementation = defineWebhookHandler({
8359
8362
  operation: "upsert",
8360
8363
  table: "stripeAccounts",
8361
8364
  indexName: BY_STRIPE_ID_INDEX_NAME,
8362
- idField: "accountId",
8365
+ indexValues: { accountId: account.id },
8363
8366
  data: {
8364
8367
  accountId: account.id,
8365
8368
  entityId,
@@ -8391,7 +8394,7 @@ const BillingPortalConfigurationHandlerImplementation = defineWebhookHandler({
8391
8394
  operation: "upsert",
8392
8395
  table: "stripeBillingPortalConfigurations",
8393
8396
  indexName: BY_STRIPE_ID_INDEX_NAME,
8394
- idField: "billingPortalConfigurationId",
8397
+ indexValues: { billingPortalConfigurationId: billingPortalConfiguration.id },
8395
8398
  data: {
8396
8399
  billingPortalConfigurationId: billingPortalConfiguration.id,
8397
8400
  stripe: BillingPortalConfigurationStripeToConvex(
@@ -8421,7 +8424,7 @@ const CapabilitiesHandlerImplementation = defineWebhookHandler({
8421
8424
  operation: "upsert",
8422
8425
  table: "stripeCapabilities",
8423
8426
  indexName: BY_STRIPE_ID_INDEX_NAME,
8424
- idField: "capabilityId",
8427
+ indexValues: { capabilityId: capability.id },
8425
8428
  data: {
8426
8429
  capabilityId: capability.id,
8427
8430
  stripe: CapabilityStripeToConvex(capability),
@@ -8463,7 +8466,7 @@ const ChargesHandlerImplementation = defineWebhookHandler({
8463
8466
  operation: "upsert",
8464
8467
  table: "stripeCharges",
8465
8468
  indexName: BY_STRIPE_ID_INDEX_NAME,
8466
- idField: "chargeId",
8469
+ indexValues: { chargeId: charge.id },
8467
8470
  data: {
8468
8471
  chargeId: charge.id,
8469
8472
  stripe: ChargeStripeToConvex(charge),
@@ -8499,7 +8502,7 @@ const CheckoutSessionsHandlerImplementation = defineWebhookHandler({
8499
8502
  operation: "upsert",
8500
8503
  table: "stripeCheckoutSessions",
8501
8504
  indexName: BY_STRIPE_ID_INDEX_NAME,
8502
- idField: "checkoutSessionId",
8505
+ indexValues: { checkoutSessionId: checkoutSession.id },
8503
8506
  data: {
8504
8507
  checkoutSessionId: checkoutSession.id,
8505
8508
  stripe: CheckoutSessionStripeToConvex(checkoutSession),
@@ -8528,7 +8531,7 @@ const CouponsHandlerImplementation = defineWebhookHandler({
8528
8531
  operation: "upsert",
8529
8532
  table: "stripeCoupons",
8530
8533
  indexName: BY_STRIPE_ID_INDEX_NAME,
8531
- idField: "couponId",
8534
+ indexValues: { couponId: coupon.id },
8532
8535
  data: {
8533
8536
  couponId: coupon.id,
8534
8537
  stripe: CouponStripeToConvex(coupon),
@@ -8547,8 +8550,7 @@ const CouponsHandlerImplementation = defineWebhookHandler({
8547
8550
  operation: "deleteById",
8548
8551
  table: "stripeCoupons",
8549
8552
  indexName: BY_STRIPE_ID_INDEX_NAME,
8550
- idField: "couponId",
8551
- idValue: coupon.id
8553
+ indexValues: { couponId: coupon.id }
8552
8554
  },
8553
8555
  context,
8554
8556
  configuration,
@@ -8572,7 +8574,7 @@ const CreditNotesHandlerImplementation = defineWebhookHandler({
8572
8574
  operation: "upsert",
8573
8575
  table: "stripeCreditNotes",
8574
8576
  indexName: BY_STRIPE_ID_INDEX_NAME,
8575
- idField: "creditNoteId",
8577
+ indexValues: { creditNoteId: creditNote.id },
8576
8578
  data: {
8577
8579
  creditNoteId: creditNote.id,
8578
8580
  stripe: CreditNoteStripeToConvex(creditNote),
@@ -8608,7 +8610,7 @@ const CustomersHandlerImplementation = defineWebhookHandler({
8608
8610
  operation: "upsert",
8609
8611
  table: "stripeCustomers",
8610
8612
  indexName: "byEntityId",
8611
- idField: "entityId",
8613
+ indexValues: { entityId },
8612
8614
  data: {
8613
8615
  customerId: customer.id,
8614
8616
  entityId,
@@ -8628,8 +8630,7 @@ const CustomersHandlerImplementation = defineWebhookHandler({
8628
8630
  operation: "deleteById",
8629
8631
  table: "stripeCustomers",
8630
8632
  indexName: BY_STRIPE_ID_INDEX_NAME,
8631
- idField: "customerId",
8632
- idValue: customer.id
8633
+ indexValues: { customerId: customer.id }
8633
8634
  },
8634
8635
  context,
8635
8636
  configuration,
@@ -8661,7 +8662,7 @@ const DisputesHandlerImplementation = defineWebhookHandler({
8661
8662
  operation: "upsert",
8662
8663
  table: "stripeDisputes",
8663
8664
  indexName: BY_STRIPE_ID_INDEX_NAME,
8664
- idField: "disputeId",
8665
+ indexValues: { disputeId: dispute.id },
8665
8666
  data: {
8666
8667
  disputeId: dispute.id,
8667
8668
  stripe: DisputeStripeToConvex(dispute),
@@ -8693,7 +8694,7 @@ const EarlyFraudWarningsHandlerImplementation = defineWebhookHandler({
8693
8694
  operation: "upsert",
8694
8695
  table: "stripeEarlyFraudWarnings",
8695
8696
  indexName: BY_STRIPE_ID_INDEX_NAME,
8696
- idField: "earlyFraudWarningId",
8697
+ indexValues: { earlyFraudWarningId: earlyFraudWarning.id },
8697
8698
  data: {
8698
8699
  earlyFraudWarningId: earlyFraudWarning.id,
8699
8700
  stripe: EarlyFraudWarningStripeToConvex(earlyFraudWarning),
@@ -8757,7 +8758,7 @@ const InvoicesHandlerImplementation = defineWebhookHandler({
8757
8758
  operation: "upsert",
8758
8759
  table: "stripeInvoices",
8759
8760
  indexName: BY_STRIPE_ID_INDEX_NAME,
8760
- idField: "invoiceId",
8761
+ indexValues: { invoiceId: invoice.id },
8761
8762
  data: {
8762
8763
  invoiceId: invoice.id,
8763
8764
  stripe: InvoiceStripeToConvex({
@@ -8788,7 +8789,7 @@ const MandatesHandlerImplementation = defineWebhookHandler({
8788
8789
  operation: "upsert",
8789
8790
  table: "stripeMandates",
8790
8791
  indexName: BY_STRIPE_ID_INDEX_NAME,
8791
- idField: "mandateId",
8792
+ indexValues: { mandateId: mandate.id },
8792
8793
  data: {
8793
8794
  mandateId: mandate.id,
8794
8795
  stripe: MandateStripeToConvex(mandate),
@@ -8832,7 +8833,7 @@ const PaymentIntentsHandlerImplementation = defineWebhookHandler({
8832
8833
  operation: "upsert",
8833
8834
  table: "stripePaymentIntents",
8834
8835
  indexName: BY_STRIPE_ID_INDEX_NAME,
8835
- idField: "paymentIntentId",
8836
+ indexValues: { paymentIntentId: paymentIntent.id },
8836
8837
  data: {
8837
8838
  paymentIntentId: paymentIntent.id,
8838
8839
  stripe: PaymentIntentStripeToConvex(paymentIntent),
@@ -8868,7 +8869,7 @@ const PaymentMethodsHandlerImplementation = defineWebhookHandler({
8868
8869
  operation: "upsert",
8869
8870
  table: "stripePaymentMethods",
8870
8871
  indexName: BY_STRIPE_ID_INDEX_NAME,
8871
- idField: "paymentMethodId",
8872
+ indexValues: { paymentMethodId: paymentMethod.id },
8872
8873
  data: {
8873
8874
  paymentMethodId: paymentMethod.id,
8874
8875
  stripe: PaymentMethodStripeToConvex(paymentMethod),
@@ -8908,7 +8909,7 @@ const PayoutsHandlerImplementation = defineWebhookHandler({
8908
8909
  operation: "upsert",
8909
8910
  table: "stripePayouts",
8910
8911
  indexName: BY_STRIPE_ID_INDEX_NAME,
8911
- idField: "payoutId",
8912
+ indexValues: { payoutId: payout.id },
8912
8913
  data: {
8913
8914
  payoutId: payout.id,
8914
8915
  stripe: PayoutStripeToConvex(payout),
@@ -8938,7 +8939,7 @@ const PlansHandlerImplementation = defineWebhookHandler({
8938
8939
  operation: "upsert",
8939
8940
  table: "stripePlans",
8940
8941
  indexName: BY_STRIPE_ID_INDEX_NAME,
8941
- idField: "planId",
8942
+ indexValues: { planId: plan.id },
8942
8943
  data: {
8943
8944
  planId: plan.id,
8944
8945
  stripe: PlanStripeToConvex(plan),
@@ -8967,7 +8968,7 @@ const PricesHandlerImplementation = defineWebhookHandler({
8967
8968
  operation: "upsert",
8968
8969
  table: "stripePrices",
8969
8970
  indexName: BY_STRIPE_ID_INDEX_NAME,
8970
- idField: "priceId",
8971
+ indexValues: { priceId: price.id },
8971
8972
  data: {
8972
8973
  priceId: price.id,
8973
8974
  stripe: PriceStripeToConvex(price),
@@ -8986,8 +8987,7 @@ const PricesHandlerImplementation = defineWebhookHandler({
8986
8987
  operation: "deleteById",
8987
8988
  table: "stripePrices",
8988
8989
  indexName: BY_STRIPE_ID_INDEX_NAME,
8989
- idField: "priceId",
8990
- idValue: price.id
8990
+ indexValues: { priceId: price.id }
8991
8991
  },
8992
8992
  context,
8993
8993
  configuration,
@@ -9010,7 +9010,7 @@ const ProductsHandlerImplementation = defineWebhookHandler({
9010
9010
  operation: "upsert",
9011
9011
  table: "stripeProducts",
9012
9012
  indexName: BY_STRIPE_ID_INDEX_NAME,
9013
- idField: "productId",
9013
+ indexValues: { productId: product.id },
9014
9014
  data: {
9015
9015
  productId: product.id,
9016
9016
  stripe: ProductStripeToConvex(product),
@@ -9029,8 +9029,7 @@ const ProductsHandlerImplementation = defineWebhookHandler({
9029
9029
  operation: "deleteById",
9030
9030
  table: "stripeProducts",
9031
9031
  indexName: BY_STRIPE_ID_INDEX_NAME,
9032
- idField: "productId",
9033
- idValue: product.id
9032
+ indexValues: { productId: product.id }
9034
9033
  },
9035
9034
  context,
9036
9035
  configuration,
@@ -9053,7 +9052,7 @@ const PromotionCodesHandlerImplementation = defineWebhookHandler({
9053
9052
  operation: "upsert",
9054
9053
  table: "stripePromotionCodes",
9055
9054
  indexName: BY_STRIPE_ID_INDEX_NAME,
9056
- idField: "promotionCodeId",
9055
+ indexValues: { promotionCodeId: promotionCode.id },
9057
9056
  data: {
9058
9057
  promotionCodeId: promotionCode.id,
9059
9058
  stripe: PromotionCodeStripeToConvex(promotionCode),
@@ -9088,7 +9087,7 @@ const RefundsHandlerImplementation = defineWebhookHandler({
9088
9087
  operation: "upsert",
9089
9088
  table: "stripeRefunds",
9090
9089
  indexName: BY_STRIPE_ID_INDEX_NAME,
9091
- idField: "refundId",
9090
+ indexValues: { refundId: refund.id },
9092
9091
  data: {
9093
9092
  refundId: refund.id,
9094
9093
  stripe: RefundStripeToConvex(refund),
@@ -9117,7 +9116,7 @@ const ReviewsHandlerImplementation = defineWebhookHandler({
9117
9116
  operation: "upsert",
9118
9117
  table: "stripeReviews",
9119
9118
  indexName: BY_STRIPE_ID_INDEX_NAME,
9120
- idField: "reviewId",
9119
+ indexValues: { reviewId: review.id },
9121
9120
  data: {
9122
9121
  reviewId: review.id,
9123
9122
  stripe: ReviewStripeToConvex(review),
@@ -9159,7 +9158,7 @@ const SetupIntentHandlerImplementation = defineWebhookHandler({
9159
9158
  operation: "upsert",
9160
9159
  table: "stripeSetupIntents",
9161
9160
  indexName: BY_STRIPE_ID_INDEX_NAME,
9162
- idField: "setupIntentId",
9161
+ indexValues: { setupIntentId: setupIntent.id },
9163
9162
  data: {
9164
9163
  setupIntentId: setupIntent.id,
9165
9164
  stripe: SetupIntentStripeToConvex(setupIntent),
@@ -9201,7 +9200,7 @@ const SubscriptionSchedulesHandlerImplementation = defineWebhookHandler({
9201
9200
  operation: "upsert",
9202
9201
  table: "stripeSubscriptionSchedules",
9203
9202
  indexName: BY_STRIPE_ID_INDEX_NAME,
9204
- idField: "subscriptionScheduleId",
9203
+ indexValues: { subscriptionScheduleId: subscriptionSchedule.id },
9205
9204
  data: {
9206
9205
  subscriptionScheduleId: subscriptionSchedule.id,
9207
9206
  stripe: SubscriptionScheduleStripeToConvex(subscriptionSchedule),
@@ -9245,7 +9244,7 @@ const SubscriptionsHandlerImplementation = defineWebhookHandler({
9245
9244
  operation: "upsert",
9246
9245
  table: "stripeSubscriptions",
9247
9246
  indexName: BY_STRIPE_ID_INDEX_NAME,
9248
- idField: "subscriptionId",
9247
+ indexValues: { subscriptionId: subscription.id },
9249
9248
  data: {
9250
9249
  subscriptionId: subscription.id,
9251
9250
  customerId: typeof subscription.customer === "string" ? subscription.customer : subscription.customer.id,
@@ -9280,7 +9279,7 @@ const TaxIdHandlerImplementation = defineWebhookHandler({
9280
9279
  operation: "upsert",
9281
9280
  table: "stripeTaxIds",
9282
9281
  indexName: BY_STRIPE_ID_INDEX_NAME,
9283
- idField: "taxIdId",
9282
+ indexValues: { taxIdId: taxId.id },
9284
9283
  data: {
9285
9284
  taxIdId: taxId.id,
9286
9285
  stripe: TaxIdStripeToConvex(taxId),
@@ -9316,7 +9315,7 @@ const TransfersHandlerImplementation = defineWebhookHandler({
9316
9315
  operation: "upsert",
9317
9316
  table: "stripeTransfers",
9318
9317
  indexName: BY_STRIPE_ID_INDEX_NAME,
9319
- idField: "transferId",
9318
+ indexValues: { transferId: transfer.id },
9320
9319
  data: {
9321
9320
  accountId: event.account,
9322
9321
  transferId: transfer.id,