@raideno/convex-stripe 0.3.8 → 0.3.9

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
@@ -33,7 +33,7 @@ declare type ActionOperation = "createCustomer";
33
33
 
34
34
  declare type AllRedirectHandlers = (typeof REDIRECT_HANDLERS)[number];
35
35
 
36
- export declare const allStripeTablesExcept: (tables: Array<keyof typeof stripeTables>) => typeof stripeTables;
36
+ export declare const allStripeTablesExcept: <const T extends Array<keyof typeof stripeTables>>(tables: T) => Omit<typeof stripeTables, T[number]>;
37
37
 
38
38
  declare type ArgSchema = Record<string, Validator<any, "optional" | "required", any>>;
39
39
 
@@ -62,14 +62,14 @@ export declare function buildSignedReturnUrl<O extends ReturnOrigin>({ configura
62
62
  data: ReturnDataMap[O];
63
63
  }): Promise<string>;
64
64
 
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>;
65
+ export declare type CallbackAfterChange<Schema extends SchemaDefinition<GenericSchema, boolean> = SchemaDefinition<GenericSchema, boolean>> = (context: GenericMutationCtx<DataModelFromSchemaDefinition<Schema>>, operation: "upsert" | "delete" | "insert", event: CallbackEvent<Schema>) => Promise<void>;
66
66
 
67
- export declare type CallbackEvent = {
68
- [K in keyof StripeDataModel]: {
67
+ export declare type CallbackEvent<Schema extends SchemaDefinition<GenericSchema, boolean> = SchemaDefinition<GenericSchema, boolean>> = {
68
+ [K in SchemaStripeTableKeys<Schema>]: {
69
69
  table: K;
70
70
  _id: StripeDataModel[K]["document"]["_id"];
71
71
  };
72
- }[keyof StripeDataModel];
72
+ }[SchemaStripeTableKeys<Schema>];
73
73
 
74
74
  declare const CreateAccountImplementation: {
75
75
  name: string;
@@ -1964,7 +1964,7 @@ export declare class Logger {
1964
1964
  debug(message: string): void;
1965
1965
  }
1966
1966
 
1967
- export declare const onlyStripeTables: (tables: Array<keyof typeof stripeTables>) => typeof stripeTables;
1967
+ export declare const onlyStripeTables: <const T extends Array<keyof typeof stripeTables>>(tables: T) => Pick<typeof stripeTables, T[number]>;
1968
1968
 
1969
1969
  declare const PayImplementation: {
1970
1970
  name: string;
@@ -2027,6 +2027,9 @@ declare type ReturnDataMap = {
2027
2027
 
2028
2028
  declare type ReturnOrigin = (typeof RETURN_ORIGINS)[number];
2029
2029
 
2030
+ /** The stripe table keys that are present in the user's schema. */
2031
+ declare type SchemaStripeTableKeys<Schema extends SchemaDefinition<GenericSchema, boolean>> = Extract<keyof StripeDataModel, keyof Schema["tables"]>;
2032
+
2030
2033
  declare type StripeDataModel = DataModelFromSchemaDefinition<typeof stripeSchema>;
2031
2034
 
2032
2035
  /**
package/dist/server.js CHANGED
@@ -5638,16 +5638,14 @@ const stripeTables = {
5638
5638
  };
5639
5639
  defineSchema(stripeTables);
5640
5640
  const allStripeTablesExcept = (tables) => Object.fromEntries(
5641
- Object.entries(stripeTables).map(([table, definition]) => [
5642
- table,
5643
- !tables.includes(table) ? definition : void 0
5644
- ])
5641
+ Object.entries(stripeTables).filter(
5642
+ ([table]) => !tables.includes(table)
5643
+ )
5645
5644
  );
5646
5645
  const onlyStripeTables = (tables) => Object.fromEntries(
5647
- Object.entries(stripeTables).map(([table, definition]) => [
5648
- table,
5649
- tables.includes(table) ? definition : void 0
5650
- ])
5646
+ Object.entries(stripeTables).filter(
5647
+ ([table]) => tables.includes(table)
5648
+ )
5651
5649
  );
5652
5650
  const DEFAULT_CONFIGURATION = {
5653
5651
  schema: void 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raideno/convex-stripe",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "description": "Easy stripe billing for convex apps.",
5
5
  "keywords": [
6
6
  "billing",