@fantastic.dev/better-stripe 0.50.3 → 0.52.0

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 (88) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +5 -1
  3. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +166 -32
  4. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  5. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +83 -16
  6. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  7. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +134 -0
  8. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  9. package/dist/client/connect/payoutSyncTestHelpers.d.ts +67 -0
  10. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  11. package/dist/client/index.d.ts +3 -0
  12. package/dist/client/index.d.ts.map +1 -1
  13. package/dist/client/index.js +4 -0
  14. package/dist/client/index.js.map +1 -1
  15. package/dist/client/usage/boundaries.d.ts +132 -0
  16. package/dist/client/usage/boundaries.d.ts.map +1 -0
  17. package/dist/client/usage/boundaries.js +43 -0
  18. package/dist/client/usage/boundaries.js.map +1 -0
  19. package/dist/client/usage/client.d.ts +37 -0
  20. package/dist/client/usage/client.d.ts.map +1 -0
  21. package/dist/client/usage/client.js +59 -0
  22. package/dist/client/usage/client.js.map +1 -0
  23. package/dist/client/usage/contracts.d.ts +59 -0
  24. package/dist/client/usage/contracts.d.ts.map +1 -0
  25. package/dist/client/usage/contracts.js +63 -0
  26. package/dist/client/usage/contracts.js.map +1 -0
  27. package/dist/client/usage/index.d.ts +7 -0
  28. package/dist/client/usage/index.d.ts.map +1 -0
  29. package/dist/client/usage/index.js +4 -0
  30. package/dist/client/usage/index.js.map +1 -0
  31. package/dist/client/usage/records.d.ts +50 -0
  32. package/dist/client/usage/records.d.ts.map +1 -0
  33. package/dist/client/usage/records.js +54 -0
  34. package/dist/client/usage/records.js.map +1 -0
  35. package/dist/component/_generated/api.d.ts +6 -0
  36. package/dist/component/_generated/api.d.ts.map +1 -1
  37. package/dist/component/_generated/api.js.map +1 -1
  38. package/dist/component/_generated/component.d.ts +79 -0
  39. package/dist/component/_generated/component.d.ts.map +1 -1
  40. package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
  41. package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
  42. package/dist/component/earnings/triggers.d.ts +178 -16
  43. package/dist/component/earnings/triggers.d.ts.map +1 -1
  44. package/dist/component/payoutRelease/queries.d.ts +2 -2
  45. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  46. package/dist/component/schema.d.ts +67 -0
  47. package/dist/component/schema.js +5 -0
  48. package/dist/component/schema.js.map +1 -1
  49. package/dist/component/usage/helpers.d.ts +13 -0
  50. package/dist/component/usage/helpers.d.ts.map +1 -0
  51. package/dist/component/usage/helpers.js +34 -0
  52. package/dist/component/usage/helpers.js.map +1 -0
  53. package/dist/component/usage/mutations.d.ts +14 -0
  54. package/dist/component/usage/mutations.d.ts.map +1 -0
  55. package/dist/component/usage/mutations.js +124 -0
  56. package/dist/component/usage/mutations.js.map +1 -0
  57. package/dist/component/usage/queries.d.ts +62 -0
  58. package/dist/component/usage/queries.d.ts.map +1 -0
  59. package/dist/component/usage/queries.js +65 -0
  60. package/dist/component/usage/queries.js.map +1 -0
  61. package/dist/component/usage/schema.d.ts +110 -0
  62. package/dist/component/usage/schema.d.ts.map +1 -0
  63. package/dist/component/usage/schema.js +54 -0
  64. package/dist/component/usage/schema.js.map +1 -0
  65. package/docs/README.md +7 -0
  66. package/docs/development.md +26 -8
  67. package/docs/metered-usage.md +289 -37
  68. package/docs/metering-setup.md +184 -0
  69. package/docs/usage-ledger.md +62 -0
  70. package/package.json +8 -2
  71. package/src/client/index.ts +5 -0
  72. package/src/client/transferContinuation.test.ts +2 -6
  73. package/src/client/usage/boundaries.test.ts +136 -0
  74. package/src/client/usage/boundaries.ts +182 -0
  75. package/src/client/usage/client.ts +97 -0
  76. package/src/client/usage/contracts.test.ts +145 -0
  77. package/src/client/usage/contracts.ts +79 -0
  78. package/src/client/usage/index.ts +34 -0
  79. package/src/client/usage/ledger-client.test.ts +74 -0
  80. package/src/client/usage/records.ts +76 -0
  81. package/src/component/_generated/api.ts +6 -0
  82. package/src/component/_generated/component.ts +106 -0
  83. package/src/component/schema.ts +10 -0
  84. package/src/component/usage/helpers.ts +33 -0
  85. package/src/component/usage/ledger.test.ts +310 -0
  86. package/src/component/usage/mutations.ts +139 -0
  87. package/src/component/usage/queries.ts +69 -0
  88. package/src/component/usage/schema.ts +65 -0
@@ -9,17 +9,6 @@ export declare const bridge: import("convex/server").RegisteredAction<"internal"
9
9
  stripeSubscriptionId: string;
10
10
  version: number;
11
11
  }, Promise<{
12
- status: "ready";
13
- value: {
14
- customerAccount: string;
15
- enabled?: boolean | undefined;
16
- paymentMethodId: string | null;
17
- paymentMethodTypes?: string[] | null | undefined;
18
- phase: "apply" | "attach" | "create";
19
- providerApiVersion: string;
20
- stripeSubscriptionId: string;
21
- };
22
- } | {
23
12
  reason: "history_incomplete" | "provider_outcome_unknown";
24
13
  retryable: false;
25
14
  status: "unknown";
@@ -35,5 +24,16 @@ export declare const bridge: import("convex/server").RegisteredAction<"internal"
35
24
  reason: "provider_pending";
36
25
  retryable: true;
37
26
  status: "not_ready";
27
+ } | {
28
+ status: "ready";
29
+ value: {
30
+ customerAccount: string;
31
+ enabled?: boolean | undefined;
32
+ paymentMethodId: string | null;
33
+ paymentMethodTypes?: string[] | null | undefined;
34
+ phase: "apply" | "attach" | "create";
35
+ providerApiVersion: string;
36
+ stripeSubscriptionId: string;
37
+ };
38
38
  }>>;
39
39
  //# sourceMappingURL=actions.d.ts.map
@@ -5,6 +5,14 @@ export declare function savePreparationHandler(ctx: MutationCtx, args: Infer<typ
5
5
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
6
6
  }>;
7
7
  export declare function beginHandler(ctx: MutationCtx, args: Infer<typeof beginArgs>): Promise<{
8
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
9
+ retryable: false;
10
+ status: "conflict";
11
+ } | {
12
+ reason: "policy_invalid";
13
+ retryable: false;
14
+ status: "rejected";
15
+ } | {
8
16
  operation: {
9
17
  accountId: string;
10
18
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -15,14 +23,6 @@ export declare function beginHandler(ctx: MutationCtx, args: Infer<typeof beginA
15
23
  } | {
16
24
  enabled: boolean;
17
25
  status: "unchanged";
18
- } | {
19
- reason: "identity_changed" | "revision_changed" | "scope_busy";
20
- retryable: false;
21
- status: "conflict";
22
- } | {
23
- reason: "policy_invalid";
24
- retryable: false;
25
- status: "rejected";
26
26
  } | {
27
27
  reason: "provider_pending";
28
28
  retryable: true;
@@ -372,6 +372,14 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
372
372
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
373
373
  requestKey: string;
374
374
  result?: {
375
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
376
+ retryable: false;
377
+ status: "conflict";
378
+ } | {
379
+ reason: "policy_invalid";
380
+ retryable: false;
381
+ status: "rejected";
382
+ } | {
375
383
  operation: {
376
384
  accountId: string;
377
385
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -382,14 +390,6 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
382
390
  } | {
383
391
  enabled: boolean;
384
392
  status: "unchanged";
385
- } | {
386
- reason: "identity_changed" | "revision_changed" | "scope_busy";
387
- retryable: false;
388
- status: "conflict";
389
- } | {
390
- reason: "policy_invalid";
391
- retryable: false;
392
- status: "rejected";
393
393
  } | {
394
394
  reason: "provider_pending";
395
395
  retryable: true;
@@ -1993,6 +1993,87 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
1993
1993
  searchIndexes: {};
1994
1994
  vectorIndexes: {};
1995
1995
  };
1996
+ usageEvents: {
1997
+ document: {
1998
+ _creationTime: number;
1999
+ _id: import("convex/values").GenericId<"usageEvents">;
2000
+ acceptedAt: number;
2001
+ identity: string;
2002
+ occurredAt: number;
2003
+ recordJson: string;
2004
+ reservationId?: import("convex/values").GenericId<"usageReservations"> | undefined;
2005
+ scopeKey: string;
2006
+ subscriptionJson: string;
2007
+ };
2008
+ fieldPaths: "_id" | ("_creationTime" | "acceptedAt" | "identity" | "occurredAt" | "recordJson" | "reservationId" | "scopeKey" | "subscriptionJson");
2009
+ indexes: {
2010
+ by_id: ["_id"];
2011
+ by_creation_time: ["_creationTime"];
2012
+ by_identity: ["identity", "_creationTime"];
2013
+ by_scope_time: ["scopeKey", "occurredAt", "_creationTime"];
2014
+ };
2015
+ searchIndexes: {};
2016
+ vectorIndexes: {};
2017
+ };
2018
+ usageOutbox: {
2019
+ document: {
2020
+ _creationTime: number;
2021
+ _id: import("convex/values").GenericId<"usageOutbox">;
2022
+ attempts: number;
2023
+ dispatch?: string | undefined;
2024
+ eventId: import("convex/values").GenericId<"usageEvents">;
2025
+ nextAttemptAt: number;
2026
+ providerIdentifier: string;
2027
+ scopeKey: string;
2028
+ state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
2029
+ };
2030
+ fieldPaths: "_id" | ("_creationTime" | "attempts" | "dispatch" | "eventId" | "nextAttemptAt" | "providerIdentifier" | "scopeKey" | "state");
2031
+ indexes: {
2032
+ by_id: ["_id"];
2033
+ by_creation_time: ["_creationTime"];
2034
+ by_event: ["eventId", "_creationTime"];
2035
+ by_scope_state: ["scopeKey", "state", "_creationTime"];
2036
+ by_state_next: ["state", "nextAttemptAt", "_creationTime"];
2037
+ };
2038
+ searchIndexes: {};
2039
+ vectorIndexes: {};
2040
+ };
2041
+ usageReservations: {
2042
+ document: {
2043
+ _creationTime: number;
2044
+ _id: import("convex/values").GenericId<"usageReservations">;
2045
+ eventId?: import("convex/values").GenericId<"usageEvents"> | undefined;
2046
+ planJson: string;
2047
+ scaledQuantity: string;
2048
+ scopeKey: string;
2049
+ sourceEventId: string;
2050
+ state: "committed" | "released" | "reserved";
2051
+ };
2052
+ fieldPaths: "_id" | ("_creationTime" | "eventId" | "planJson" | "scaledQuantity" | "scopeKey" | "sourceEventId" | "state");
2053
+ indexes: {
2054
+ by_id: ["_id"];
2055
+ by_creation_time: ["_creationTime"];
2056
+ by_scope_source: ["scopeKey", "sourceEventId", "_creationTime"];
2057
+ };
2058
+ searchIndexes: {};
2059
+ vectorIndexes: {};
2060
+ };
2061
+ usageScopeCounters: {
2062
+ document: {
2063
+ _creationTime: number;
2064
+ _id: import("convex/values").GenericId<"usageScopeCounters">;
2065
+ count: number;
2066
+ scopeKey: string;
2067
+ };
2068
+ fieldPaths: "_id" | ("_creationTime" | "count" | "scopeKey");
2069
+ indexes: {
2070
+ by_id: ["_id"];
2071
+ by_creation_time: ["_creationTime"];
2072
+ by_scope: ["scopeKey", "_creationTime"];
2073
+ };
2074
+ searchIndexes: {};
2075
+ vectorIndexes: {};
2076
+ };
1996
2077
  webhookEvents: {
1997
2078
  document: {
1998
2079
  _creationTime: number;
@@ -2388,6 +2469,14 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
2388
2469
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
2389
2470
  requestKey: string;
2390
2471
  result?: {
2472
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
2473
+ retryable: false;
2474
+ status: "conflict";
2475
+ } | {
2476
+ reason: "policy_invalid";
2477
+ retryable: false;
2478
+ status: "rejected";
2479
+ } | {
2391
2480
  operation: {
2392
2481
  accountId: string;
2393
2482
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2398,14 +2487,6 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
2398
2487
  } | {
2399
2488
  enabled: boolean;
2400
2489
  status: "unchanged";
2401
- } | {
2402
- reason: "identity_changed" | "revision_changed" | "scope_busy";
2403
- retryable: false;
2404
- status: "conflict";
2405
- } | {
2406
- reason: "policy_invalid";
2407
- retryable: false;
2408
- status: "rejected";
2409
2490
  } | {
2410
2491
  reason: "provider_pending";
2411
2492
  retryable: true;
@@ -4009,6 +4090,87 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
4009
4090
  searchIndexes: {};
4010
4091
  vectorIndexes: {};
4011
4092
  };
4093
+ usageEvents: {
4094
+ document: {
4095
+ _creationTime: number;
4096
+ _id: import("convex/values").GenericId<"usageEvents">;
4097
+ acceptedAt: number;
4098
+ identity: string;
4099
+ occurredAt: number;
4100
+ recordJson: string;
4101
+ reservationId?: import("convex/values").GenericId<"usageReservations"> | undefined;
4102
+ scopeKey: string;
4103
+ subscriptionJson: string;
4104
+ };
4105
+ fieldPaths: "_id" | ("_creationTime" | "acceptedAt" | "identity" | "occurredAt" | "recordJson" | "reservationId" | "scopeKey" | "subscriptionJson");
4106
+ indexes: {
4107
+ by_id: ["_id"];
4108
+ by_creation_time: ["_creationTime"];
4109
+ by_identity: ["identity", "_creationTime"];
4110
+ by_scope_time: ["scopeKey", "occurredAt", "_creationTime"];
4111
+ };
4112
+ searchIndexes: {};
4113
+ vectorIndexes: {};
4114
+ };
4115
+ usageOutbox: {
4116
+ document: {
4117
+ _creationTime: number;
4118
+ _id: import("convex/values").GenericId<"usageOutbox">;
4119
+ attempts: number;
4120
+ dispatch?: string | undefined;
4121
+ eventId: import("convex/values").GenericId<"usageEvents">;
4122
+ nextAttemptAt: number;
4123
+ providerIdentifier: string;
4124
+ scopeKey: string;
4125
+ state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
4126
+ };
4127
+ fieldPaths: "_id" | ("_creationTime" | "attempts" | "dispatch" | "eventId" | "nextAttemptAt" | "providerIdentifier" | "scopeKey" | "state");
4128
+ indexes: {
4129
+ by_id: ["_id"];
4130
+ by_creation_time: ["_creationTime"];
4131
+ by_event: ["eventId", "_creationTime"];
4132
+ by_scope_state: ["scopeKey", "state", "_creationTime"];
4133
+ by_state_next: ["state", "nextAttemptAt", "_creationTime"];
4134
+ };
4135
+ searchIndexes: {};
4136
+ vectorIndexes: {};
4137
+ };
4138
+ usageReservations: {
4139
+ document: {
4140
+ _creationTime: number;
4141
+ _id: import("convex/values").GenericId<"usageReservations">;
4142
+ eventId?: import("convex/values").GenericId<"usageEvents"> | undefined;
4143
+ planJson: string;
4144
+ scaledQuantity: string;
4145
+ scopeKey: string;
4146
+ sourceEventId: string;
4147
+ state: "committed" | "released" | "reserved";
4148
+ };
4149
+ fieldPaths: "_id" | ("_creationTime" | "eventId" | "planJson" | "scaledQuantity" | "scopeKey" | "sourceEventId" | "state");
4150
+ indexes: {
4151
+ by_id: ["_id"];
4152
+ by_creation_time: ["_creationTime"];
4153
+ by_scope_source: ["scopeKey", "sourceEventId", "_creationTime"];
4154
+ };
4155
+ searchIndexes: {};
4156
+ vectorIndexes: {};
4157
+ };
4158
+ usageScopeCounters: {
4159
+ document: {
4160
+ _creationTime: number;
4161
+ _id: import("convex/values").GenericId<"usageScopeCounters">;
4162
+ count: number;
4163
+ scopeKey: string;
4164
+ };
4165
+ fieldPaths: "_id" | ("_creationTime" | "count" | "scopeKey");
4166
+ indexes: {
4167
+ by_id: ["_id"];
4168
+ by_creation_time: ["_creationTime"];
4169
+ by_scope: ["scopeKey", "_creationTime"];
4170
+ };
4171
+ searchIndexes: {};
4172
+ vectorIndexes: {};
4173
+ };
4012
4174
  webhookEvents: {
4013
4175
  document: {
4014
4176
  _creationTime: number;
@@ -1 +1 @@
1
- {"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../../../src/component/earnings/triggers.ts"],"names":[],"mappings":"AA6GA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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Id: string;
164
164
  ownerKey: string;
165
165
  }, Promise<{
166
- transfers?: undefined;
167
- claims?: undefined;
168
166
  status: "held";
169
167
  reason: "snapshot_limit";
168
+ transfers?: undefined;
169
+ claims?: undefined;
170
170
  } | {
171
171
  reason?: undefined;
172
172
  status: "ready";
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/payoutRelease/queries.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIlB,CAAC;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiBd,CAAC;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BlB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;GAQf,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,QAAQ;;;;;;YAsBE,MAAM;YAAmB,gBAAgB;;;YAS3C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE1B,CAAC"}
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/payoutRelease/queries.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIlB,CAAC;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiBd,CAAC;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BlB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;GAQf,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,QAAQ;;;;YAsBE,MAAM;YAAmB,gBAAgB;;;;;YAS3C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE1B,CAAC"}
@@ -1,4 +1,71 @@
1
1
  declare const _default: import("convex/server").SchemaDefinition<{
2
+ usageEvents: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
+ acceptedAt: number;
4
+ identity: string;
5
+ occurredAt: number;
6
+ recordJson: string;
7
+ reservationId?: import("convex/values").GenericId<"usageReservations"> | undefined;
8
+ scopeKey: string;
9
+ subscriptionJson: string;
10
+ }, {
11
+ reservationId: import("convex/values").VId<import("convex/values").GenericId<"usageReservations"> | undefined, "optional">;
12
+ scopeKey: import("convex/values").VString<string, "required">;
13
+ identity: import("convex/values").VString<string, "required">;
14
+ recordJson: import("convex/values").VString<string, "required">;
15
+ subscriptionJson: import("convex/values").VString<string, "required">;
16
+ occurredAt: import("convex/values").VFloat64<number, "required">;
17
+ acceptedAt: import("convex/values").VFloat64<number, "required">;
18
+ }, "required", "acceptedAt" | "identity" | "occurredAt" | "recordJson" | "reservationId" | "scopeKey" | "subscriptionJson">, {
19
+ by_identity: ["identity", "_creationTime"];
20
+ by_scope_time: ["scopeKey", "occurredAt", "_creationTime"];
21
+ }, {}, {}>;
22
+ usageOutbox: import("convex/server").TableDefinition<import("convex/values").VObject<{
23
+ attempts: number;
24
+ dispatch?: string | undefined;
25
+ eventId: import("convex/values").GenericId<"usageEvents">;
26
+ nextAttemptAt: number;
27
+ providerIdentifier: string;
28
+ scopeKey: string;
29
+ state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
30
+ }, {
31
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
32
+ scopeKey: import("convex/values").VString<string, "required">;
33
+ state: import("convex/values").VUnion<"held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"sending", "required">, import("convex/values").VLiteral<"provider_accepted", "required">, import("convex/values").VLiteral<"rejected", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"held", "required">], "required", never>;
34
+ attempts: import("convex/values").VFloat64<number, "required">;
35
+ nextAttemptAt: import("convex/values").VFloat64<number, "required">;
36
+ providerIdentifier: import("convex/values").VString<string, "required">;
37
+ dispatch: import("convex/values").VString<string | undefined, "optional">;
38
+ }, "required", "attempts" | "dispatch" | "eventId" | "nextAttemptAt" | "providerIdentifier" | "scopeKey" | "state">, {
39
+ by_event: ["eventId", "_creationTime"];
40
+ by_scope_state: ["scopeKey", "state", "_creationTime"];
41
+ by_state_next: ["state", "nextAttemptAt", "_creationTime"];
42
+ }, {}, {}>;
43
+ usageScopeCounters: import("convex/server").TableDefinition<import("convex/values").VObject<{
44
+ count: number;
45
+ scopeKey: string;
46
+ }, {
47
+ scopeKey: import("convex/values").VString<string, "required">;
48
+ count: import("convex/values").VFloat64<number, "required">;
49
+ }, "required", "count" | "scopeKey">, {
50
+ by_scope: ["scopeKey", "_creationTime"];
51
+ }, {}, {}>;
52
+ usageReservations: import("convex/server").TableDefinition<import("convex/values").VObject<{
53
+ eventId?: import("convex/values").GenericId<"usageEvents"> | undefined;
54
+ planJson: string;
55
+ scaledQuantity: string;
56
+ scopeKey: string;
57
+ sourceEventId: string;
58
+ state: "committed" | "released" | "reserved";
59
+ }, {
60
+ scopeKey: import("convex/values").VString<string, "required">;
61
+ sourceEventId: import("convex/values").VString<string, "required">;
62
+ planJson: import("convex/values").VString<string, "required">;
63
+ scaledQuantity: import("convex/values").VString<string, "required">;
64
+ state: import("convex/values").VUnion<"committed" | "released" | "reserved", [import("convex/values").VLiteral<"reserved", "required">, import("convex/values").VLiteral<"committed", "required">, import("convex/values").VLiteral<"released", "required">], "required", never>;
65
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents"> | undefined, "optional">;
66
+ }, "required", "eventId" | "planJson" | "scaledQuantity" | "scopeKey" | "sourceEventId" | "state">, {
67
+ by_scope_source: ["scopeKey", "sourceEventId", "_creationTime"];
68
+ }, {}, {}>;
2
69
  refundSyncClaims: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
70
  acceptedAt?: number | undefined;
4
71
  acceptedContext?: string | undefined;
@@ -19,12 +19,17 @@ import { currencyTotalsTable } from "./earnings/schema.js";
19
19
  import { claimsTable, balancesTable, groupsTable, reservationsTable, } from "./costRecovery/schema";
20
20
  import { allocationsTable, commissionTermsTable, commissionDecisionsTable, } from "./settlement/schema";
21
21
  import { defineSchema } from "convex/server";
22
+ import { usageEventsTable, usageOutboxTable, usageScopeCountersTable, usageReservationsTable, } from "./usage/schema.js";
22
23
  import { checkoutSessionsTable, invoicesTable, subscriptionsTable, } from "./billing/schema";
23
24
  import { disputesTable, paymentsTable, payoutsTable, pendingFeeRefundsTable, refundsTable, transferReversalOpsTable, transfersTable, } from "./connect/schema";
24
25
  import { accountsTable } from "./core/schema";
25
26
  import { pricesTable, productsTable } from "./products/schema";
26
27
  import { webhookEventsTable } from "./webhooks/schema";
27
28
  export default defineSchema({
29
+ usageEvents: usageEventsTable,
30
+ usageOutbox: usageOutboxTable,
31
+ usageScopeCounters: usageScopeCountersTable,
32
+ usageReservations: usageReservationsTable,
28
33
  refundSyncClaims: refundSyncClaimsTable,
29
34
  processingCostReconciliationOperations,
30
35
  recoveryWorkflowOperations,
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,eAAe,IAAI,sCAAsC,EAAE,MAAM,0CAA0C,CAAC;AACrH,OAAO,EACL,eAAe,IAAI,0BAA0B,EAC7C,aAAa,IAAI,wBAAwB,GAC1C,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,iBAAiB,IAAI,0BAA0B,EAC/C,eAAe,IAAI,wBAAwB,E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X,aAAa,EAAE,kBAAkB;CAClC,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { UsageScope } from "../../client/usage/records.js";
2
+ export declare function scopeKey(input: UsageScope): string;
3
+ export declare function subscriptionSnapshot(json: string): {
4
+ subscriptionId: string;
5
+ subscriptionItemId: string;
6
+ stripePriceId: string;
7
+ period: {
8
+ start: number;
9
+ end: number;
10
+ };
11
+ interval: "month";
12
+ };
13
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/component/usage/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,UAIzC;AAkBD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM;;;;;;;;;EAOhD"}
@@ -0,0 +1,34 @@
1
+ import { z } from "zod";
2
+ import { scopeSchema } from "../../client/usage/records.js";
3
+ export function scopeKey(input) {
4
+ const key = JSON.stringify(scopeSchema.parse(input));
5
+ if (key.length > 512)
6
+ throw new Error("Usage scope exceeds size limit");
7
+ return key;
8
+ }
9
+ const seconds = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
10
+ const subscriptionSchema = z.strictObject({
11
+ subscriptionId: z
12
+ .string()
13
+ .regex(/^sub_[a-zA-Z0-9]+$/)
14
+ .max(100),
15
+ subscriptionItemId: z
16
+ .string()
17
+ .regex(/^si_[a-zA-Z0-9]+$/)
18
+ .max(100),
19
+ stripePriceId: z
20
+ .string()
21
+ .regex(/^price_[a-zA-Z0-9]+$/)
22
+ .max(100),
23
+ period: z.strictObject({ start: seconds, end: seconds }),
24
+ interval: z.literal("month"),
25
+ });
26
+ export function subscriptionSnapshot(json) {
27
+ if (new TextEncoder().encode(json).length > 2048)
28
+ throw new Error("Usage subscription exceeds size limit");
29
+ const subscription = subscriptionSchema.parse(JSON.parse(json));
30
+ if (subscription.period.end <= subscription.period.start)
31
+ throw new Error("Invalid usage subscription period");
32
+ return subscription;
33
+ }
34
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/component/usage/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAE5D,MAAM,UAAU,QAAQ,CAAC,KAAiB;IACxC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACrD,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACxE,OAAO,GAAG,CAAC;AACb,CAAC;AACD,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAC5E,MAAM,kBAAkB,GAAG,CAAC,CAAC,YAAY,CAAC;IACxC,cAAc,EAAE,CAAC;SACd,MAAM,EAAE;SACR,KAAK,CAAC,oBAAoB,CAAC;SAC3B,GAAG,CAAC,GAAG,CAAC;IACX,kBAAkB,EAAE,CAAC;SAClB,MAAM,EAAE;SACR,KAAK,CAAC,mBAAmB,CAAC;SAC1B,GAAG,CAAC,GAAG,CAAC;IACX,aAAa,EAAE,CAAC;SACb,MAAM,EAAE;SACR,KAAK,CAAC,sBAAsB,CAAC;SAC7B,GAAG,CAAC,GAAG,CAAC;IACX,MAAM,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;IACxD,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;CAC7B,CAAC,CAAC;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,IAAI,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,IAAI;QAC9C,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,MAAM,YAAY,GAAG,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,IAAI,YAAY,CAAC,MAAM,CAAC,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,KAAK;QACtD,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /** Trusted host mutation. Authenticate, authorize scope and verify native binding first. */
2
+ export declare const record: import("convex/server").RegisteredMutation<"public", {
3
+ dispatch?: string | undefined;
4
+ inputJson: string;
5
+ quota?: number | undefined;
6
+ reservationId?: import("convex/values").GenericId<"usageReservations"> | undefined;
7
+ subscriptionJson: string;
8
+ }, Promise<{
9
+ eventId: import("convex/values").GenericId<"usageEvents">;
10
+ identity: string;
11
+ acceptedAt: number;
12
+ delivery: "queued";
13
+ }>>;
14
+ //# sourceMappingURL=mutations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/component/usage/mutations.ts"],"names":[],"mappings":"AAWA,4FAA4F;AAC5F,eAAO,MAAM,MAAM;;;;;;;;;;cA+CD,QAAQ;GA+ExB,CAAC"}