@raideno/convex-stripe 0.3.1 → 0.3.3

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.
package/dist/index.d.ts CHANGED
@@ -40,6 +40,7 @@ export declare type CallbackAfterChange = (context: GenericMutationCtx<any>, ope
40
40
  export declare type CallbackEvent = {
41
41
  [K in keyof StripeDataModel]: {
42
42
  table: K;
43
+ _id: StripeDataModel[K]["document"]["_id"];
43
44
  };
44
45
  }[keyof StripeDataModel];
45
46
 
@@ -47,7 +48,7 @@ declare const CreateAccountImplementation: {
47
48
  name: string;
48
49
  handler: (context: GenericActionCtx<StripeDataModel>, args: {
49
50
  entityId: string;
50
- } & Omit<default_2.AccountCreateParams, "type">, stripeOptions: default_2.RequestOptions, configuration: InternalConfiguration, options: InternalOptions) => Promise<{
51
+ } & default_2.AccountCreateParams, stripeOptions: default_2.RequestOptions, configuration: InternalConfiguration, options: InternalOptions) => Promise<{
51
52
  _id: GenericId<"stripeAccounts">;
52
53
  _creationTime: number;
53
54
  entityId?: string | undefined;
@@ -484,19 +485,12 @@ export declare const internalConvexStripe: (configuration_: InputConfiguration,
484
485
  operation: string;
485
486
  table: string;
486
487
  }, Promise<{
487
- id: GenericId<"stripeAccounts" | "stripeProducts" | "stripePrices" | "stripeCustomers" | "stripeSubscriptions" | "stripeCoupons" | "stripePromotionCodes" | "stripePayouts" | "stripeRefunds" | "stripePaymentIntents" | "stripeCheckoutSessions" | "stripeInvoices" | "stripeReviews" | "stripePlans" | "stripeDisputes" | "stripeEarlyFraudWarnings" | "stripeTaxIds" | "stripeSetupIntents" | "stripeCreditNotes" | "stripeCharges" | "stripePaymentMethods" | "stripeSubscriptionSchedules" | "stripeMandates" | "stripeBillingPortalConfigurations" | "stripeTransfers" | "stripeCapabilities">;
488
- deleted?: undefined;
489
- doc?: undefined;
490
- docs?: undefined;
491
- } | {
492
- deleted: boolean;
493
- id?: undefined;
488
+ _id: GenericId<"stripeAccounts" | "stripeProducts" | "stripePrices" | "stripeCustomers" | "stripeSubscriptions" | "stripeCoupons" | "stripePromotionCodes" | "stripePayouts" | "stripeRefunds" | "stripePaymentIntents" | "stripeCheckoutSessions" | "stripeInvoices" | "stripeReviews" | "stripePlans" | "stripeDisputes" | "stripeEarlyFraudWarnings" | "stripeTaxIds" | "stripeSetupIntents" | "stripeCreditNotes" | "stripeCharges" | "stripePaymentMethods" | "stripeSubscriptionSchedules" | "stripeMandates" | "stripeBillingPortalConfigurations" | "stripeTransfers" | "stripeCapabilities"> | null;
494
489
  doc?: undefined;
495
490
  docs?: undefined;
496
491
  } | {
497
492
  doc: any;
498
- id?: undefined;
499
- deleted?: undefined;
493
+ _id?: undefined;
500
494
  docs?: undefined;
501
495
  } | {
502
496
  docs: ({
@@ -1598,8 +1592,7 @@ export declare const internalConvexStripe: (configuration_: InputConfiguration,
1598
1592
  lastSyncedAt: number;
1599
1593
  capabilityId: string;
1600
1594
  })[];
1601
- id?: undefined;
1602
- deleted?: undefined;
1595
+ _id?: undefined;
1603
1596
  doc?: undefined;
1604
1597
  } | undefined>>;
1605
1598
  /**
package/dist/server.js CHANGED
@@ -5770,9 +5770,9 @@ async function deleteById(context, table, indexName, idField, idValue) {
5770
5770
  const existing = await context.db.query(table).withIndex(indexName, (q) => q.eq(idField, idValue)).unique();
5771
5771
  if (existing) {
5772
5772
  await context.db.delete(existing._id);
5773
- return true;
5773
+ return existing._id;
5774
5774
  }
5775
- return false;
5775
+ return null;
5776
5776
  }
5777
5777
  async function selectAll(context, table) {
5778
5778
  return await context.db.query(table).collect();
@@ -5844,7 +5844,7 @@ const StoreImplementation = defineMutationImplementation({
5844
5844
  const upsertIndexName = args.indexName;
5845
5845
  const upsertIdField = args.idField;
5846
5846
  const upsertData = args.data;
5847
- const id = await upsert(
5847
+ const _id = await upsert(
5848
5848
  context,
5849
5849
  table,
5850
5850
  upsertIndexName,
@@ -5857,31 +5857,31 @@ const StoreImplementation = defineMutationImplementation({
5857
5857
  context,
5858
5858
  "upsert",
5859
5859
  // TODO: remove any
5860
- { table }
5860
+ { table, _id }
5861
5861
  );
5862
5862
  } catch (error) {
5863
5863
  console.error("[afterChange]:", error);
5864
5864
  }
5865
- return { id };
5865
+ return { _id };
5866
5866
  }
5867
5867
  case "insert": {
5868
5868
  if (args.data == null) {
5869
5869
  throw new Error('Missing "data" for insert');
5870
5870
  }
5871
5871
  const insertData = args.data;
5872
- const id = await insert(context, table, insertData);
5872
+ const _id = await insert(context, table, insertData);
5873
5873
  if (configuration.callbacks && configuration.callbacks.afterChange)
5874
5874
  try {
5875
5875
  await configuration.callbacks.afterChange(
5876
5876
  context,
5877
5877
  "insert",
5878
5878
  // TODO: remove any
5879
- { table }
5879
+ { table, _id }
5880
5880
  );
5881
5881
  } catch (error) {
5882
5882
  console.error("[afterChange]:", error);
5883
5883
  }
5884
- return { id };
5884
+ return { _id };
5885
5885
  }
5886
5886
  case "deleteById": {
5887
5887
  if (!args.indexName) {
@@ -5896,7 +5896,7 @@ const StoreImplementation = defineMutationImplementation({
5896
5896
  const deleteByIdIndexName = args.indexName;
5897
5897
  const deleteByIdIdField = args.idField;
5898
5898
  const deleteByIdIdValue = args.idValue;
5899
- const deleted = await deleteById(
5899
+ const _id = await deleteById(
5900
5900
  context,
5901
5901
  table,
5902
5902
  deleteByIdIndexName,
@@ -5909,12 +5909,12 @@ const StoreImplementation = defineMutationImplementation({
5909
5909
  context,
5910
5910
  "delete",
5911
5911
  // TODO: remove any
5912
- { table }
5912
+ { table, _id }
5913
5913
  );
5914
5914
  } catch (error) {
5915
5915
  console.error("[afterChange]:", error);
5916
5916
  }
5917
- return { deleted };
5917
+ return { _id };
5918
5918
  }
5919
5919
  case "selectOne": {
5920
5920
  if (!args.indexName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raideno/convex-stripe",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Easy stripe billing for convex apps.",
5
5
  "keywords": [
6
6
  "billing",