@raideno/convex-stripe 0.3.1 → 0.3.2
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 +6 -12
- package/dist/server.js +11 -11
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { GenericDataModel } from 'convex/server';
|
|
|
5
5
|
import { GenericId } from 'convex/values';
|
|
6
6
|
import { GenericMutationCtx } from 'convex/server';
|
|
7
7
|
import { HttpRouter } from 'convex/server';
|
|
8
|
+
import { IdField } from 'convex/server';
|
|
8
9
|
import { Infer } from 'convex/values';
|
|
9
10
|
import { RegisteredAction } from 'convex/server';
|
|
10
11
|
import { RegisteredMutation } from 'convex/server';
|
|
@@ -40,6 +41,7 @@ export declare type CallbackAfterChange = (context: GenericMutationCtx<any>, ope
|
|
|
40
41
|
export declare type CallbackEvent = {
|
|
41
42
|
[K in keyof StripeDataModel]: {
|
|
42
43
|
table: K;
|
|
44
|
+
_id: IdField<K>;
|
|
43
45
|
};
|
|
44
46
|
}[keyof StripeDataModel];
|
|
45
47
|
|
|
@@ -47,7 +49,7 @@ declare const CreateAccountImplementation: {
|
|
|
47
49
|
name: string;
|
|
48
50
|
handler: (context: GenericActionCtx<StripeDataModel>, args: {
|
|
49
51
|
entityId: string;
|
|
50
|
-
} &
|
|
52
|
+
} & default_2.AccountCreateParams, stripeOptions: default_2.RequestOptions, configuration: InternalConfiguration, options: InternalOptions) => Promise<{
|
|
51
53
|
_id: GenericId<"stripeAccounts">;
|
|
52
54
|
_creationTime: number;
|
|
53
55
|
entityId?: string | undefined;
|
|
@@ -484,19 +486,12 @@ export declare const internalConvexStripe: (configuration_: InputConfiguration,
|
|
|
484
486
|
operation: string;
|
|
485
487
|
table: string;
|
|
486
488
|
}, Promise<{
|
|
487
|
-
|
|
488
|
-
deleted?: undefined;
|
|
489
|
-
doc?: undefined;
|
|
490
|
-
docs?: undefined;
|
|
491
|
-
} | {
|
|
492
|
-
deleted: boolean;
|
|
493
|
-
id?: undefined;
|
|
489
|
+
_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
490
|
doc?: undefined;
|
|
495
491
|
docs?: undefined;
|
|
496
492
|
} | {
|
|
497
493
|
doc: any;
|
|
498
|
-
|
|
499
|
-
deleted?: undefined;
|
|
494
|
+
_id?: undefined;
|
|
500
495
|
docs?: undefined;
|
|
501
496
|
} | {
|
|
502
497
|
docs: ({
|
|
@@ -1598,8 +1593,7 @@ export declare const internalConvexStripe: (configuration_: InputConfiguration,
|
|
|
1598
1593
|
lastSyncedAt: number;
|
|
1599
1594
|
capabilityId: string;
|
|
1600
1595
|
})[];
|
|
1601
|
-
|
|
1602
|
-
deleted?: undefined;
|
|
1596
|
+
_id?: undefined;
|
|
1603
1597
|
doc?: undefined;
|
|
1604
1598
|
} | undefined>>;
|
|
1605
1599
|
/**
|
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
|
|
5773
|
+
return existing._id;
|
|
5774
5774
|
}
|
|
5775
|
-
return
|
|
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
|
|
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 {
|
|
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
|
|
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 {
|
|
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
|
|
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 {
|
|
5917
|
+
return { _id };
|
|
5918
5918
|
}
|
|
5919
5919
|
case "selectOne": {
|
|
5920
5920
|
if (!args.indexName) {
|