@raideno/convex-stripe 0.3.6 → 0.3.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.
- package/dist/index.d.ts +11 -11
- package/dist/server.js +10 -6
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export declare function buildSignedReturnUrl<O extends ReturnOrigin>({ configura
|
|
|
62
62
|
data: ReturnDataMap[O];
|
|
63
63
|
}): Promise<string>;
|
|
64
64
|
|
|
65
|
-
export declare type CallbackAfterChange = (context: GenericMutationCtx<
|
|
65
|
+
export declare type CallbackAfterChange<Schema extends SchemaDefinition<GenericSchema, boolean> = SchemaDefinition<GenericSchema, boolean>> = (context: GenericMutationCtx<DataModelFromSchemaDefinition<Schema>>, operation: "upsert" | "delete" | "insert", event: CallbackEvent) => Promise<void>;
|
|
66
66
|
|
|
67
67
|
export declare type CallbackEvent = {
|
|
68
68
|
[K in keyof StripeDataModel]: {
|
|
@@ -226,8 +226,8 @@ declare type InferArgs<S extends ArgSchema> = {
|
|
|
226
226
|
[K in keyof S as S[K] extends Validator<any, "optional", any> ? K : never]?: Infer<S[K]>;
|
|
227
227
|
};
|
|
228
228
|
|
|
229
|
-
export declare interface InputConfiguration {
|
|
230
|
-
schema:
|
|
229
|
+
export declare interface InputConfiguration<Schema extends SchemaDefinition<GenericSchema, boolean> = SchemaDefinition<GenericSchema, boolean>> {
|
|
230
|
+
schema: Schema;
|
|
231
231
|
stripe: {
|
|
232
232
|
/** Stripe API version to pin against (recommended for stability). */
|
|
233
233
|
version?: default_2.StripeConfig["apiVersion"];
|
|
@@ -291,7 +291,7 @@ export declare interface InputConfiguration {
|
|
|
291
291
|
};
|
|
292
292
|
callbacks?: {
|
|
293
293
|
/** Called after a row is inserted/upserted/deleted in your Stripe tables. */
|
|
294
|
-
afterChange?: CallbackAfterChange
|
|
294
|
+
afterChange?: CallbackAfterChange<Schema>;
|
|
295
295
|
};
|
|
296
296
|
/**
|
|
297
297
|
* If true, avoids attaching routes/state globally (depends on your library meaning).
|
|
@@ -334,7 +334,7 @@ export declare type InternalConfiguration = RecursiveDeepRequired<InputConfigura
|
|
|
334
334
|
* },
|
|
335
335
|
* });
|
|
336
336
|
*/
|
|
337
|
-
export declare const internalConvexStripe: (configuration_: InputConfiguration & {
|
|
337
|
+
export declare const internalConvexStripe: <Schema extends SchemaDefinition<GenericSchema, boolean>>(configuration_: InputConfiguration<Schema> & {
|
|
338
338
|
sync?: {
|
|
339
339
|
tables?: never;
|
|
340
340
|
};
|
|
@@ -383,7 +383,7 @@ export declare const internalConvexStripe: (configuration_: InputConfiguration &
|
|
|
383
383
|
* @param args - Customer identifier and return URL.
|
|
384
384
|
* @param options - Optional overrides (e.g. portal configuration ID).
|
|
385
385
|
*/
|
|
386
|
-
portal: (context: GenericActionCtx<
|
|
386
|
+
portal: (context: GenericActionCtx<DataModelFromSchemaDefinition<Schema>>, args: Parameters<(typeof PortalImplementation)["handler"]>[1], options?: Parameters<(typeof PortalImplementation)["handler"]>[2]) => Promise<default_2.Response<default_2.BillingPortal.Session>>;
|
|
387
387
|
/**
|
|
388
388
|
* Creates a Stripe Checkout session in `subscription` mode.
|
|
389
389
|
* Redirects the user to Stripe Checkout to set up a recurring subscription.
|
|
@@ -392,7 +392,7 @@ export declare const internalConvexStripe: (configuration_: InputConfiguration &
|
|
|
392
392
|
* @param args - Price ID, customer info, and success/cancel URLs.
|
|
393
393
|
* @param options - Optional overrides for the Checkout session.
|
|
394
394
|
*/
|
|
395
|
-
subscribe: (context: GenericActionCtx<
|
|
395
|
+
subscribe: (context: GenericActionCtx<DataModelFromSchemaDefinition<Schema>>, args: Parameters<(typeof SubscribeImplementation)["handler"]>[1], options?: Parameters<(typeof SubscribeImplementation)["handler"]>[2]) => Promise<default_2.Response<default_2.Checkout.Session>>;
|
|
396
396
|
/**
|
|
397
397
|
* Creates a Stripe Checkout session in `payment` mode (one-time payment).
|
|
398
398
|
*
|
|
@@ -400,7 +400,7 @@ export declare const internalConvexStripe: (configuration_: InputConfiguration &
|
|
|
400
400
|
* @param args - Price ID, quantity, and success/cancel URLs.
|
|
401
401
|
* @param options - Optional overrides for the Checkout session.
|
|
402
402
|
*/
|
|
403
|
-
pay: (context: GenericActionCtx<
|
|
403
|
+
pay: (context: GenericActionCtx<DataModelFromSchemaDefinition<Schema>>, args: Parameters<(typeof PayImplementation)["handler"]>[1], options?: Parameters<(typeof PayImplementation)["handler"]>[2]) => Promise<default_2.Response<default_2.Checkout.Session>>;
|
|
404
404
|
customers: {
|
|
405
405
|
/**
|
|
406
406
|
* Creates a new Stripe Customer and stores it in your Convex database.
|
|
@@ -409,7 +409,7 @@ export declare const internalConvexStripe: (configuration_: InputConfiguration &
|
|
|
409
409
|
* @param args - Customer details (email, name, metadata, etc.).
|
|
410
410
|
* @param options - Optional overrides for the customer creation.
|
|
411
411
|
*/
|
|
412
|
-
create: (context: GenericActionCtx<
|
|
412
|
+
create: (context: GenericActionCtx<DataModelFromSchemaDefinition<Schema>>, args: Parameters<(typeof CreateCustomerImplementation)["handler"]>[1], options?: Parameters<(typeof CreateCustomerImplementation)["handler"]>[2]) => Promise<{
|
|
413
413
|
_id: GenericId<"stripeCustomers">;
|
|
414
414
|
_creationTime: number;
|
|
415
415
|
accountId?: string | undefined;
|
|
@@ -485,7 +485,7 @@ export declare const internalConvexStripe: (configuration_: InputConfiguration &
|
|
|
485
485
|
* @param args - Account type, email, and capabilities.
|
|
486
486
|
* @param options - Optional overrides for the account creation.
|
|
487
487
|
*/
|
|
488
|
-
create: (context: GenericActionCtx<
|
|
488
|
+
create: (context: GenericActionCtx<DataModelFromSchemaDefinition<Schema>>, args: Parameters<(typeof CreateAccountImplementation)["handler"]>[1], options?: Parameters<(typeof CreateAccountImplementation)["handler"]>[2]) => Promise<{
|
|
489
489
|
_id: GenericId<"stripeAccounts">;
|
|
490
490
|
_creationTime: number;
|
|
491
491
|
entityId?: string | undefined;
|
|
@@ -525,7 +525,7 @@ export declare const internalConvexStripe: (configuration_: InputConfiguration &
|
|
|
525
525
|
* @param args - Account ID, refresh URL, and return URL.
|
|
526
526
|
* @param options - Optional overrides for the account link.
|
|
527
527
|
*/
|
|
528
|
-
link: (context: GenericActionCtx<
|
|
528
|
+
link: (context: GenericActionCtx<DataModelFromSchemaDefinition<Schema>>, args: Parameters<(typeof CreateAccountLinkImplementation)["handler"]>[1], options?: Parameters<(typeof CreateAccountLinkImplementation)["handler"]>[2]) => Promise<default_2.Response<default_2.AccountLink>>;
|
|
529
529
|
};
|
|
530
530
|
/**
|
|
531
531
|
* Returns a set of pre-built, authorization-aware Convex functions
|
package/dist/server.js
CHANGED
|
@@ -5775,7 +5775,10 @@ const DEFAULT_CONFIGURATION = {
|
|
|
5775
5775
|
}
|
|
5776
5776
|
};
|
|
5777
5777
|
const normalizeConfiguration = (configuration) => {
|
|
5778
|
-
const output = deepmerge(
|
|
5778
|
+
const output = deepmerge(
|
|
5779
|
+
DEFAULT_CONFIGURATION,
|
|
5780
|
+
configuration
|
|
5781
|
+
);
|
|
5779
5782
|
const stripeTableNames = Object.keys(stripeTables);
|
|
5780
5783
|
output.sync.tables = Object.fromEntries(
|
|
5781
5784
|
Object.keys(configuration.schema.tables).filter((table) => stripeTableNames.includes(table)).map((table) => [table, true])
|
|
@@ -5789,7 +5792,12 @@ const DEFAULT_OPTIONS = {
|
|
|
5789
5792
|
base: "stripe"
|
|
5790
5793
|
};
|
|
5791
5794
|
const normalizeOptions = (options) => {
|
|
5792
|
-
|
|
5795
|
+
const { logger, ...rest } = options;
|
|
5796
|
+
const merged = deepmerge(DEFAULT_OPTIONS, rest);
|
|
5797
|
+
return {
|
|
5798
|
+
...merged,
|
|
5799
|
+
logger: logger || DEFAULT_OPTIONS.logger
|
|
5800
|
+
};
|
|
5793
5801
|
};
|
|
5794
5802
|
const defineActionCallableFunction = (spec) => spec;
|
|
5795
5803
|
const defineActionImplementation = (spec) => spec;
|
|
@@ -8974,8 +8982,6 @@ const PricesHandlerImplementation = defineWebhookHandler({
|
|
|
8974
8982
|
options
|
|
8975
8983
|
);
|
|
8976
8984
|
break;
|
|
8977
|
-
// TODO: careful here as the deletion is just a soft delete in Stripe
|
|
8978
|
-
// so maybe we want to keep the record and just mark it as deleted?
|
|
8979
8985
|
case "price.deleted":
|
|
8980
8986
|
await storeDispatchTyped(
|
|
8981
8987
|
{
|
|
@@ -9019,8 +9025,6 @@ const ProductsHandlerImplementation = defineWebhookHandler({
|
|
|
9019
9025
|
options
|
|
9020
9026
|
);
|
|
9021
9027
|
break;
|
|
9022
|
-
// TODO: careful here as the deletion is just a soft delete in Stripe
|
|
9023
|
-
// so maybe we want to keep the record and just mark it as deleted?
|
|
9024
9028
|
case "product.deleted":
|
|
9025
9029
|
await storeDispatchTyped(
|
|
9026
9030
|
{
|
package/package.json
CHANGED